|
6 | 6 | import { computePosition, offset, flip, shift, autoUpdate } from "@floating-ui/dom";
|
7 | 7 | import { onDestroy } from "svelte";
|
8 | 8 |
|
9 |
| - let { value = $bindable([]), placeholder = "Enter tags", class: className, classes, itemClass, spanClass, closeClass, inputClass, closeBtnSize = "xs", unique = false, availableTags = [], showHelper = false, showAvailableTags = false, allowNewTags = true, inputProps = {}, ...restProps }: TagsProps = $props(); |
| 9 | + let { value = $bindable([]), placeholder = "Enter tags", class: className, classes, itemClass, spanClass, closeClass, inputClass, closeBtnSize = "xs", unique = false, availableTags = [], showHelper = false, showAvailableTags = false, allowNewTags = true, inputProps = {}, disabled, ...restProps }: TagsProps = $props(); |
10 | 10 |
|
11 | 11 | warnThemeDeprecation("Tags", { itemClass, spanClass, closeClass, inputClass }, { itemClass: "tag", spanClass: "span", closeClass: "close", inputClass: "input" });
|
12 | 12 | const styling = $derived(
|
|
158 | 158 | <span class={spanCls({ class: clsx(theme?.span, styling.span) })}>
|
159 | 159 | {tag}
|
160 | 160 | </span>
|
161 |
| - <CloseButton size={closeBtnSize} class={close({ class: clsx(theme?.close, styling.close) })} onclick={() => deleteField(index)} /> |
| 161 | + <CloseButton disabled size={closeBtnSize} class={close({ class: clsx(theme?.close, styling.close) })} onclick={() => deleteField(index)} /> |
162 | 162 | </div>
|
163 | 163 | {/each}
|
164 | 164 | <div class="relative w-full" bind:this={inputContainer}>
|
165 |
| - <input {...inputProps} bind:this={inputElement} onkeydown={handleKeys} oninput={handleInput} bind:value={contents} placeholder={value.length === 0 ? placeholder : ""} type="text" autocomplete="off" class={inputCls({ class: clsx(styling.input) })} /> |
| 165 | + <input {...inputProps} disabled bind:this={inputElement} onkeydown={handleKeys} oninput={handleInput} bind:value={contents} placeholder={value.length === 0 ? placeholder : ""} type="text" autocomplete="off" class={inputCls({ class: clsx(styling.input) })} /> |
166 | 166 | {#if availableTags.length > 0 && contents.trim() !== ""}
|
167 | 167 | {@const filteredSuggestions = availableTags.filter((tag) => tag.toLowerCase().includes(contents.trim().toLowerCase()) && (!unique || !value.some((t) => t.toLowerCase() === tag.toLowerCase())))}
|
168 | 168 | {#if filteredSuggestions.length > 0}
|
|
0 commit comments