|
3 | 3 | import { CloseButton, type SizeType, type InputProps, type InputValue, cn } from "$lib";
|
4 | 4 | import { input, clampSize } from ".";
|
5 | 5 |
|
6 |
| - let { children, left, right, value = $bindable(), elementRef = $bindable(), clearable = false, size, color = "default", class: className, wrapperClass, leftClass, rightClass, divClass, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, data = [], maxSuggestions = 5, onSelect, comboClass,onInput, onFocus, onBlur, onKeydown, ...restProps }: InputProps<InputValue> = $props(); |
| 6 | + let { children, left, right, value = $bindable(), elementRef = $bindable(), clearable = false, size, color = "default", class: className, wrapperClass, leftClass, rightClass, divClass, clearableSvgClass, clearableColor = "none", clearableClass, clearableOnClick, data = [], maxSuggestions = 5, onSelect, comboClass, comboItemClass, onInput, onFocus, onBlur, onKeydown, ...restProps }: InputProps<InputValue> = $props(); |
7 | 7 |
|
8 | 8 | // Automatically enable combobox when data is provided
|
9 | 9 | const isCombobox = $derived(Array.isArray(data) && data.length > 0);
|
|
19 | 19 | let _size = $derived(size || clampSize(group?.size) || "md");
|
20 | 20 | const _color = $derived(color === "default" && background ? "tinted" : color);
|
21 | 21 |
|
22 |
| - const { base, input: inputCls, left: leftCls, right: rightCls, clearbtn, combo } = $derived(input({ size: _size, color: _color, group: isGroup })); |
| 22 | + const { base, input: inputCls, left: leftCls, right: rightCls, clearbtn, combo, comboItem } = $derived(input({ size: _size, color: _color, group: isGroup })); |
23 | 23 |
|
24 | 24 | const clearAll = () => {
|
25 | 25 | if (elementRef) {
|
|
202 | 202 | <div class={cn(combo(), comboClass)}>
|
203 | 203 | {#each filteredSuggestions as item, i}
|
204 | 204 | <button type="button" class="w-full px-3 py-2 text-left {i === selectedIndex ? 'bg-gray-100 dark:bg-gray-700' : 'hover:bg-gray-50 dark:hover:bg-gray-700'} focus:outline-none" onclick={() => selectItem(item)} onmouseenter={() => (selectedIndex = i)}>
|
205 |
| - {item} |
| 205 | + <p class={cn(comboItem(),comboItemClass)}>{item}</p> |
206 | 206 | </button>
|
207 | 207 | {/each}
|
208 | 208 | </div>
|
|
0 commit comments