diff --git a/src/lib/components/ui/MultiSelect.svelte b/src/lib/components/ui/MultiSelect.svelte index 22a8f09a..7cfa5c94 100644 --- a/src/lib/components/ui/MultiSelect.svelte +++ b/src/lib/components/ui/MultiSelect.svelte @@ -9,6 +9,7 @@ label: string disabled?: boolean color?: string + image?: string } interface Props { @@ -44,6 +45,11 @@ // Convert value array to string array for Bits UI const stringValue = $derived(value.map((v) => String(v))) + // Get first selected option for display (image/color) + const firstSelectedOption = $derived( + value.length > 0 ? options.find((opt) => opt.value === value[0]) : undefined + ) + // Get selected labels for display const selectedLabels = $derived(() => { if (value.length === 0) return null @@ -84,6 +90,11 @@ items={stringOptions} > + {#if firstSelectedOption?.image} + + {:else if firstSelectedOption?.color} + + {/if} {selectedLabels() || placeholder} @@ -99,7 +110,11 @@ style={option.color ? `--option-color: ${option.color}` : ''} > {#snippet children({ selected })} - {option.label} + {/if} + {option.label} @@ -166,6 +181,20 @@ color: var(--text-secondary); } + .trigger-image { + width: $unit-3x; + height: $unit-3x; + flex-shrink: 0; + object-fit: contain; + } + + .trigger-color-dot { + width: 10px; + height: 10px; + border-radius: 50%; + flex-shrink: 0; + } + :global(.chevron) { flex-shrink: 0; color: var(--text-tertiary); @@ -254,6 +283,13 @@ border-bottom-right-radius: $item-corner; } + .item-image { + width: $unit-3x; + height: $unit-3x; + flex-shrink: 0; + object-fit: contain; + } + :global(.check-icon) { opacity: 0; transition: opacity $duration-quick ease;