Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .changeset/great-masks-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tabula/ui-multi-selector": patch
---

Fix empty state

4 changes: 4 additions & 0 deletions components/ui-multi-selector/src/Search/Search.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
17 changes: 10 additions & 7 deletions components/ui-multi-selector/src/Tags/Tags.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -24,7 +23,7 @@ export const root = style({
padding: '8px',
},

[`${state.isDisabled}:not(${state.isEmpty})&`]: {
[`${state.noPaddings}&`]: {
padding: '0',
},
},
Expand All @@ -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',
Expand Down Expand Up @@ -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)',
},
Expand All @@ -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)',
},
Expand Down
12 changes: 4 additions & 8 deletions components/ui-multi-selector/src/Tags/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ export function Tags({
}: Props): ReactNode {
const tags = useTags({ allowsCustomValue, options, selected });

const isNotEmpty = tags.length > 0;

return (
<div
className={clsx(
styles.root,
isDisabled && styles.state.isDisabled,
tags.length === 0 && styles.state.isEmpty,
)}
>
<Clear className={styles.clear} onUpdate={onUpdate} />
<div className={clsx(styles.root, isDisabled && isNotEmpty && styles.state.noPaddings)}>
{isNotEmpty && !isDisabled && <Clear className={styles.clear} onUpdate={onUpdate} />}

<div className={styles.list}>
{tags.map((it) => renderTag(styles.tag, it))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export const search = style({
display: 'inline-block',

selectors: {
[`${state.isEmpty} &`]: {
width: '100%',
},

[`${state.isEmpty}${shared.sizes.small} &`]: {
height: '22px',
},
Expand Down