diff --git a/.changeset/great-masks-wonder.md b/.changeset/great-masks-wonder.md new file mode 100644 index 00000000..3d846aa4 --- /dev/null +++ b/.changeset/great-masks-wonder.md @@ -0,0 +1,6 @@ +--- +"@tabula/ui-multi-selector": patch +--- + +Fix empty state + \ No newline at end of file diff --git a/components/ui-multi-selector/src/Search/Search.css.ts b/components/ui-multi-selector/src/Search/Search.css.ts index e4cb6355..938ad419 100644 --- a/components/ui-multi-selector/src/Search/Search.css.ts +++ b/components/ui-multi-selector/src/Search/Search.css.ts @@ -36,6 +36,10 @@ export const root = style([ transition: `color ${uiTheme.duration.fast['1']} ${uiTheme.easing.standard.productive}`, }, + '&:placeholder-shown': { + textOverflow: 'ellipsis', + }, + '&:not(:disabled):not(:focus):hover::placeholder': { color: uiTheme.colors.content.primary, diff --git a/components/ui-multi-selector/src/Tags/Tags.css.ts b/components/ui-multi-selector/src/Tags/Tags.css.ts index e28094e7..5e067cae 100644 --- a/components/ui-multi-selector/src/Tags/Tags.css.ts +++ b/components/ui-multi-selector/src/Tags/Tags.css.ts @@ -5,8 +5,7 @@ import { uiLayers } from '@tabula/ui-theme'; import * as shared from '../shared.css'; export const state = styleVariants({ - isEmpty: {}, - isDisabled: {}, + noPaddings: {}, }); export const root = style({ @@ -24,7 +23,7 @@ export const root = style({ padding: '8px', }, - [`${state.isDisabled}:not(${state.isEmpty})&`]: { + [`${state.noPaddings}&`]: { padding: '0', }, }, @@ -38,10 +37,6 @@ export const clear = style({ position: 'absolute', selectors: { - [`:is(${state.isDisabled}, ${state.isEmpty}) &`]: { - display: 'none', - }, - [`${shared.sizes.small} &`]: { top: '4px', right: '4px', @@ -79,6 +74,10 @@ export const list = style({ gap: '8px', }, + [`${shared.sizes.small}${shared.hasChevron} &`]: { + maxWidth: 'calc(100% - 20px)', + }, + [`${shared.sizes.small} ${clear} + &`]: { maxWidth: 'calc(100% - 24px)', }, @@ -87,6 +86,10 @@ export const list = style({ maxWidth: 'calc(100% - 44px)', }, + [`${shared.sizes.medium}${shared.hasChevron} &`]: { + maxWidth: 'calc(100% - 24px)', + }, + [`${shared.sizes.medium} ${clear} + &`]: { maxWidth: 'calc(100% - 32px)', }, diff --git a/components/ui-multi-selector/src/Tags/Tags.tsx b/components/ui-multi-selector/src/Tags/Tags.tsx index 22c78c83..98e6c9de 100644 --- a/components/ui-multi-selector/src/Tags/Tags.tsx +++ b/components/ui-multi-selector/src/Tags/Tags.tsx @@ -29,15 +29,11 @@ export function Tags({ }: Props): ReactNode { const tags = useTags({ allowsCustomValue, options, selected }); + const isNotEmpty = tags.length > 0; + return ( -
- +
+ {isNotEmpty && !isDisabled && }
{tags.map((it) => renderTag(styles.tag, it))} diff --git a/components/ui-multi-selector/src/UiMultiSelector/UiMultiSelector.css.ts b/components/ui-multi-selector/src/UiMultiSelector/UiMultiSelector.css.ts index 6f310c5f..3901bf44 100644 --- a/components/ui-multi-selector/src/UiMultiSelector/UiMultiSelector.css.ts +++ b/components/ui-multi-selector/src/UiMultiSelector/UiMultiSelector.css.ts @@ -119,6 +119,10 @@ export const search = style({ display: 'inline-block', selectors: { + [`${state.isEmpty} &`]: { + width: '100%', + }, + [`${state.isEmpty}${shared.sizes.small} &`]: { height: '22px', },