Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions semcore/base-trigger/src/FilterTrigger.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NeighborLocation, Box, ScreenReaderOnly, Hint } from '@semcore/base-components';
import { Box, ScreenReaderOnly, Hint } from '@semcore/base-components';
import { createComponent, Component, Root, sstyled } from '@semcore/core';
import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
Expand Down Expand Up @@ -144,20 +144,18 @@ class RootFilterTrigger extends Component {
use:aria-label={undefined}
use:aria-labelledby={undefined}
>
<NeighborLocation>
{advancedMode
? (
<Children />
)
: (
<>
<FilterTrigger.TriggerButton>
<Children />
</FilterTrigger.TriggerButton>
{!empty && <FilterTrigger.ClearButton />}
</>
)}
</NeighborLocation>
{advancedMode
? (
<Children />
)
: (
<>
<FilterTrigger.TriggerButton>
<Children />
</FilterTrigger.TriggerButton>
{!empty && <FilterTrigger.ClearButton />}
</>
)}
</SWrapper>,
);
}
Expand All @@ -168,11 +166,11 @@ class TriggerButton extends Component {
static style = style;

render() {
const SFilterTrigger = Root;
const STrigger = Root;
const { Children, styles, empty, triggerRef } = this.asProps;

return sstyled(styles)(
<SFilterTrigger
<STrigger
render={BaseTrigger}
use:role='combobox'
w='100%'
Expand All @@ -188,7 +186,7 @@ class TriggerButton extends Component {
empty,
)}
{empty && <FilterTrigger.Addon tag={ChevronDown} />}
</SFilterTrigger>,
</STrigger>,
);
}
}
Expand All @@ -200,7 +198,7 @@ class ClearButton extends Component {
triggerRef = React.createRef();

render() {
const SFilterTrigger = Root;
const SClear = Root;
const {
styles,
empty,
Expand All @@ -215,7 +213,7 @@ class ClearButton extends Component {

return sstyled(styles)(
<>
<SFilterTrigger
<SClear
ref={this.triggerRef}
render={BaseTrigger}
size={size}
Expand All @@ -226,7 +224,7 @@ class ClearButton extends Component {
__excludeProps={['title']}
>
<FilterTrigger.Addon tag={Close} />
</SFilterTrigger>
</SClear>

<Hint triggerRef={this.triggerRef}>{title ?? ariaLabel ?? getI18nText('clear')}</Hint>
</>,
Expand Down
57 changes: 13 additions & 44 deletions semcore/base-trigger/src/style/base-trigger.shadow.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SBaseTrigger {
white-space: nowrap;
user-select: none;
box-sizing: border-box;
padding: 0;
margin: 0;
box-shadow: none;
text-decoration: none;
Expand All @@ -19,12 +18,15 @@ SBaseTrigger {
font-family: inherit;
cursor: pointer;

background: var(--intergalactic-bg-primary-neutral, oklch(1 0 0)); /* TODO: --intergalactic-control-select-trigger-normal */
background: var(--intergalactic-control-select-trigger-normal, oklch(1 0 0));

font-weight: var(--intergalactic-regular, 400);
border: 1px solid var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));

border-radius: var(--intergalactic-control-rounded, 6px);
padding: 0 var(--intergalactic-spacing-content-inset-inline, 12px);

&::-moz-focus-inner {
border: none;
padding: 0;
Expand All @@ -40,13 +42,13 @@ SBaseTrigger {
}

&:hover {
background-color: var(--intergalactic-bg-primary-neutral-hover, oklch(0.98 0.001 180)); /* TODO: --intergalactic-control-select-trigger-hover */
background-color: var(--intergalactic-control-select-trigger-hover, oklch(0.98 0.001 180));
}

&:active,
&[active] {
border-color: var(--intergalactic-border-info-active, oklch(0.7 0.131 275.2));
background-color: var(--intergalactic-bg-primary-neutral, oklch(1 0 0)); /* TODO: --intergalactic-control-select-trigger-active */
background-color: var(--intergalactic-control-select-trigger-active, oklch(1 0 0));
}
}

Expand All @@ -61,18 +63,17 @@ SInner {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--intergalactic-spacing-content-gap-medium, 6px);
height: 100%;
width: 100%;
}

SText {
display: inline;
/* disable-tokens-validator */
padding: 1px 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: var(--intergalactic-lh-200, 142%);
flex-grow: 1;
text-align: left;
}
Expand All @@ -83,57 +84,25 @@ SAddon {
justify-content: center;
flex-shrink: 0;
pointer-events: none;
}

SBaseAddon {
width: 12px;
height: 12px;
&:only-child {
margin-left: calc(-1 * var(--intergalactic-spacing-1x, 4px));
margin-right: calc(-1 * var(--intergalactic-spacing-1x, 4px));
}
}

SBaseTrigger[size='m'] {
min-width: var(--intergalactic-form-control-m, 32px);
height: var(--intergalactic-form-control-m, 32px);
border-radius: var(--intergalactic-control-rounded, 6px);
padding: 0 var(--intergalactic-spacing-2x, 8px);
font-size: var(--intergalactic-fs-200, 14px);

& SAddon {
&:not(:only-child):first-child {
margin-right: var(--intergalactic-spacing-2x, 8px);
}

&:not(:only-child):last-child {
margin-left: var(--intergalactic-spacing-2x, 8px);
}

&:only-child {
margin-left: calc(-1 * var(--intergalactic-spacing-1x, 4px));
margin-right: calc(-1 * var(--intergalactic-spacing-1x, 4px));
}
}
line-height: var(--intergalactic-lh-200, 142%);
}

SBaseTrigger[size='l'] {
min-width: var(--intergalactic-form-control-l, 44px);
height: var(--intergalactic-form-control-l, 44px);
border-radius: var(--intergalactic-control-rounded, 6px);
padding: 0 var(--intergalactic-spacing-3x, 12px);
font-size: var(--intergalactic-fs-300, 16px);

& SAddon {
&:not(:only-child):first-child {
margin-right: var(--intergalactic-spacing-2x, 8px);
}

&:not(:only-child):last-child {
margin-left: var(--intergalactic-spacing-2x, 8px);
}

&:only-child {
margin-left: calc(-1 * var(--intergalactic-spacing-1x, 4px));
margin-right: calc(-1 * var(--intergalactic-spacing-1x, 4px));
}
}
line-height: var(--intergalactic-lh-300, 150%);
}

SBaseTrigger[neighborLocation='right'] {
Expand Down
9 changes: 6 additions & 3 deletions semcore/base-trigger/src/style/button-trigger.shadow.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
SButtonAddon {
width: 12px;
height: 12px;
width: var(--intergalactic-spacing-3x, 12px);
height: var(--intergalactic-spacing-3x, 12px);
color: var(--intergalactic-icon-non-interactive, oklch(0.094 0.024 153.9 / 0.503));
position: relative;
left: var(--intergalactic-spacing-05x, 2px);
}

SButtonTriggerSpin {
fill: var(--intergalactic-icon-primary-neutral, oklch(0.092 0.024 152.2 / 0.526));
fill: var(--intergalactic-icon-non-interactive, oklch(0.094 0.024 153.9 / 0.503));
}
47 changes: 37 additions & 10 deletions semcore/base-trigger/src/style/filter-trigger.shadow.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
SFilterTrigger[selected] {
border-color: var(--intergalactic-border-info-active, oklch(0.7 0.131 275.2));
background-color: var(--intergalactic-control-secondary-info, oklch(0.527 0.264 262.9 / 0.039));
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
STrigger {
border: none;
position: relative;

&:hover {
background-color: var(--intergalactic-control-secondary-info-hover, oklch(0.525 0.265 263 / 0.077));
}
&[role="combobox"]:not([empty]) {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;

&::before {
content: '';
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 1px;
background-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
transition: height calc(var(--intergalactic-duration-extra-fast, 100) * 1ms) ease-out; /* TODO: Sync with animationin FilterTrigger */
}

&[size='m']::before {
height: 18px;
}
&[size='l']::before {
height: 28px;
}

&:active,
&[active] {
background-color: var(--intergalactic-control-secondary-info-active, oklch(0.524 0.266 263.1 / 0.116));
&:hover::before,
&:active::before {
height: 100%;
}
}
}

SClear {
border: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

SWrapper {
border: 1px solid var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
border-radius: var(--intergalactic-control-rounded, 6px);
display: inline-flex;

&:focus {
Expand Down
Loading