From 0b57374afbaa5bea5dd002c2e0034a3390b4a776 Mon Sep 17 00:00:00 2001 From: Jo Burgard Date: Wed, 3 Jan 2024 07:15:23 +0100 Subject: [PATCH] Combobox: change styles and make list scrollable --- src/lib/ui/combobox/Combobox.svelte | 34 +++++++++++++++++--------- src/lib/ui/input/index.ts | 2 +- src/stories/ui/Combobox.stories.svelte | 2 ++ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/lib/ui/combobox/Combobox.svelte b/src/lib/ui/combobox/Combobox.svelte index 75fe421..f6c8519 100644 --- a/src/lib/ui/combobox/Combobox.svelte +++ b/src/lib/ui/combobox/Combobox.svelte @@ -62,6 +62,10 @@ SPDX-License-Identifier: Unlicense helpers: { isSelected }, } = createCombobox({ forceVisible: true, + positioning: { + placement: 'bottom-start', + sameWidth: false, + }, }); selected.subscribe((newValue) => (value = newValue)); @@ -79,13 +83,14 @@ SPDX-License-Identifier: Unlicense : showAllResult; +
diff --git a/src/lib/ui/input/index.ts b/src/lib/ui/input/index.ts index c1f3b03..31e2dcd 100644 --- a/src/lib/ui/input/index.ts +++ b/src/lib/ui/input/index.ts @@ -33,7 +33,7 @@ const inputVariants = tv({ // [input[aria-expanded=true]_~_&] works const inputPlaceholderVariants = tv({ base: ` - absolute top-1/2 -translate-y-1/2 text-gray-400 + absolute top-1/2 -translate-y-1/2 text-gray-400 select-none transition-duration-100 transition-ease-out transition-property-[top,font-size,line-height] [input:not(:placeholder-shown)~&,input:focus~&,input[aria-expanded=true]_~_&]:(text-[--color-primary] bg-white px-1 -ml-1 rounded text-xs/3 top-0) `, diff --git a/src/stories/ui/Combobox.stories.svelte b/src/stories/ui/Combobox.stories.svelte index 904e47b..e1d0a39 100644 --- a/src/stories/ui/Combobox.stories.svelte +++ b/src/stories/ui/Combobox.stories.svelte @@ -28,6 +28,8 @@ SPDX-License-Identifier: Unlicense { label: 'Dull' }, { label: 'Deafening' }, { label: 'Destitute' }, + { label: 'emptySpaces' }, + { label: 'empty Spaces' }, { label: 'Stingy' }, { label: 'Spotless' }, { label: 'Furious' },