diff --git a/frontend/src/lib/components/select/DraggableTags.svelte b/frontend/src/lib/components/select/DraggableTags.svelte index 3dcd6b3dd3..dc554dcbc1 100644 --- a/frontend/src/lib/components/select/DraggableTags.svelte +++ b/frontend/src/lib/components/select/DraggableTags.svelte @@ -30,7 +30,7 @@ role="listitem" class={twMerge( allowClear ? 'pr-1' : 'pr-3', - 'pl-3 min-h-6 bg-surface-secondary rounded-full flex items-center gap-0.5', + 'pl-3 min-h-6 border bg-surface rounded-full flex items-center gap-0.5', currentlyDraggingIndex !== undefined ? 'hover:opacity-20' : '' )} style={currentlyDraggingIndex === index @@ -54,7 +54,7 @@ {item.label || item.value} {#if allowClear} (onRemove(item), e.stopPropagation())} /> diff --git a/frontend/src/lib/components/select/MultiSelect.svelte b/frontend/src/lib/components/select/MultiSelect.svelte index 16187c4bdf..f028f8482c 100644 --- a/frontend/src/lib/components/select/MultiSelect.svelte +++ b/frontend/src/lib/components/select/MultiSelect.svelte @@ -7,6 +7,7 @@ import DraggableTags from './DraggableTags.svelte' import { Search } from 'lucide-svelte' import { twMerge } from 'tailwind-merge' + import TextInput, { inputBorderClass } from '../text_input/TextInput.svelte' type Value = Item['value'] @@ -59,7 +60,7 @@ let filterText = $state('') let open = $state(false) let wrapperEl: HTMLDivElement | undefined = $state() - let searchInputEl: HTMLInputElement | undefined = $state() + let searchInputEl: TextInput | undefined = $state() $effect(() => searchInputEl?.focus()) @@ -99,7 +100,8 @@
{#if value.length === 0} - + {placeholder} {:else} @@ -134,10 +138,10 @@ /> {/if} - {#if allowClear && !hideMainClearBtn} + {#if allowClear && !hideMainClearBtn && !!value?.length} (clearValue(), e.stopPropagation())} /> @@ -163,12 +167,14 @@ {#snippet header()} {#if processedItems.length - value.length > 0 || onCreateItem}
- (e.preventDefault(), searchInputEl?.focus())} - placeholder="Search" - class="!pr-7" + inputProps={{ + onblur: (e) => (e.preventDefault(), searchInputEl?.focus()), + placeholder: 'Search...' + }} + class="!pr-7 !bg-surface" />
diff --git a/frontend/src/lib/components/select/Select.svelte b/frontend/src/lib/components/select/Select.svelte index ce348251f7..c0458b8029 100644 --- a/frontend/src/lib/components/select/Select.svelte +++ b/frontend/src/lib/components/select/Select.svelte @@ -7,7 +7,7 @@ import { getLabel, processItems, type ProcessedItem } from './utils.svelte' import SelectDropdown from './SelectDropdown.svelte' import { deepEqual } from 'fast-equals' - import { inputBorderClass } from '../text_input/TextInput.svelte' + import { inputBaseClass, inputBorderClass } from '../text_input/TextInput.svelte' type Value = Item['value'] @@ -123,7 +123,7 @@
{:else if clearable && !disabled && value}
- +
{:else if RightIcon}
@@ -141,10 +141,11 @@ : (valueEntry?.label ?? getLabel({ value }) ?? placeholder)} style={containerStyle} class={twMerge( - 'no-default-style !bg-surface-secondary text-ellipsis focus:ring-0 disabled:cursor-not-allowed rounded-md text-sm w-full', + inputBaseClass, inputBorderClass({ error, forceFocus: open }), + 'w-full', open ? '' : 'cursor-pointer', - !loading && value ? 'placeholder-primary' : '', + !loading && value ? 'placeholder-primary' : 'placeholder-hint', (clearable || RightIcon) && !disabled && value ? 'pr-8' : '', inputClass ?? '' )} diff --git a/frontend/src/lib/components/text_input/TextInput.svelte b/frontend/src/lib/components/text_input/TextInput.svelte index ddca906959..4d31daff26 100644 --- a/frontend/src/lib/components/text_input/TextInput.svelte +++ b/frontend/src/lib/components/text_input/TextInput.svelte @@ -32,6 +32,12 @@ error?: string } + export function focus() { + inputEl?.focus() + } + + let inputEl: HTMLInputElement | undefined = $state() + let { inputProps, value = $bindable(), class: className = '', error }: Props = $props() @@ -44,5 +50,6 @@ inputBorderClass({ error: !!error }), className )} + bind:this={inputEl} bind:value />