diff --git a/web/src/lib/components/ui/Combobox.svelte b/web/src/lib/components/ui/Combobox.svelte index 6b925297..d187c862 100644 --- a/web/src/lib/components/ui/Combobox.svelte +++ b/web/src/lib/components/ui/Combobox.svelte @@ -8,13 +8,11 @@ root: "relative inline-block w-full", trigger: "flex min-h-9 cursor-pointer items-center gap-2 px-2.5 py-1", value: "min-w-0 flex-1 truncate text-left typography-paragraph-regular", - panel: - "combobox-panel fixed z-50 m-0 hidden max-h-[min(24rem,calc(100dvh-1rem))] w-80 max-w-[calc(100vw-1rem)] popover-transition flex-col overflow-hidden rounded-sm border border-border-default bg-background-default p-0 text-foreground-default shadow-regular open:flex dark:shadow-none", + panel: "combobox-panel fixed z-50 m-0 hidden max-h-[min(24rem,calc(100dvh-1rem))] w-80 max-w-[calc(100vw-1rem)] popover-transition flex-col overflow-hidden rounded-sm border border-border-default bg-background-default p-0 text-foreground-default shadow-regular open:flex dark:shadow-none", search: "shrink-0 border-b border-border-default p-2", list: "min-h-0 flex-1 overflow-y-auto p-1", groupHeading: "px-2 pt-2 pb-1 font-semibold text-foreground-muted first:pt-1", - option: - "flex w-full cursor-pointer items-center gap-2 rounded-sm bg-transparent px-2 py-1.5 text-left aria-disabled:cursor-not-allowed aria-disabled:text-foreground-disabled data-active:bg-background-subtle dark:data-active:bg-background-subtle", + option: "flex w-full cursor-pointer items-center gap-2 rounded-sm bg-transparent px-2 py-1.5 text-left aria-disabled:cursor-not-allowed aria-disabled:text-foreground-disabled data-active:bg-background-subtle dark:data-active:bg-background-subtle", check: "size-4 shrink-0 text-foreground-default", optionLabel: "min-w-0 flex-1 truncate", hint: "shrink-0 text-foreground-subtle", @@ -62,7 +60,9 @@ id?: string; class?: string; panelClass?: string; + listClass?: string; footer?: Snippet; + filter?: boolean; } let { @@ -82,7 +82,9 @@ id, class: className, panelClass, - footer + listClass, + footer, + filter = true }: Props = $props(); const panelId = $props.id(); @@ -269,27 +271,35 @@ style="position-anchor: {anchorName}" class={classes.panel({ class: panelClass })} > -
- = 0 ? optionId(activeIndex) : undefined} - aria-label={label ? `${label} filter` : "Filter options"} - /> -
+ {#if filter} +
+ = 0 ? optionId(activeIndex) : undefined} + aria-label={label ? `${label} filter` : "Filter options"} + /> +
+ {/if} -
+
{#each rows as { option, index, heading } (option.value)} {#if heading}
{heading}
@@ -338,6 +348,8 @@ /* the gap to the trigger — margin, because position-area owns inset */ margin-top: 0.25rem; position-try: flip-block; + /* as wide as the trigger, instead of the fixed fallback width */ + width: anchor-size(width); } .combobox-panel[data-align="left"] {