/** * createTagsInput - the HEADLESS core behind : an editable * token/chips field (type + Enter/comma to add, Backspace to remove the last, * per-chip remove). Owns the draft text + add/remove behavior + keyboard, * exposed as **prop-getters** you spread onto YOUR OWN markup. No styles/DOM. * * ```svelte * *
* {#each ti.tags as tag, i (tag + i)} * {tag} * {/each} * *
* ``` */ /** Reactive inputs are passed as getters so the core tracks live prop changes. */ export type TagsInputConfig = { value: () => string[]; onChange?: (tags: string[]) => void; disabled?: () => boolean; /** Reject duplicate tags. Default true. */ unique?: () => boolean; max?: () => number; ariaLabel?: () => string | undefined; /** Accessible label for the draft input (localizable). */ addLabel?: () => string | undefined; /** Accessible label prefix for a chip's remove button (localizable). */ removeLabel?: () => string | undefined; id?: () => string | undefined; invalid?: () => boolean; required?: () => boolean; error?: () => string | undefined; hint?: () => string | undefined; }; export declare function createTagsInput(config: TagsInputConfig): { /** Current tags (controlled value). */ readonly tags: string[]; /** Current draft text in the input. */ readonly draft: string; add: (raw: string) => void; removeAt: (i: number) => void; setDraft: (v: string) => void; /** Spread onto the container element. */ rootProps: () => { 'aria-invalid': "true" | undefined; 'aria-required': "true" | undefined; 'aria-describedby': string | undefined; 'aria-label': string | undefined; role: "group"; }; /** Spread onto the text . */ inputProps: () => { type: "text"; value: string; disabled: boolean; 'aria-label': string; oninput: (e: Event) => void; onkeydown: (e: KeyboardEvent) => void; onblur: () => void; }; /** Spread onto the chip wrapper at `index`. */ tagProps: (index: number) => { 'data-idx': number; }; /** Spread onto a chip's remove