import { PropertyValues, TemplateResult } from 'lit'; import { BahtFieldBase } from '../field-base.js'; /** * Creatable chip input: value is `string[]` (unique, trimmed, in entry * order). Type text + Enter or comma to add a chip; Backspace on an empty * input removes the last chip; pasting "a, b, c" adds three at once. * * Suggestions come from `field.options` — the SAME list every other * option-bearing field reads, already resolved by `` when the * descriptor uses `options_from` (spec 01 §1: dynamic options are merged * into `field.options` before the primitive ever sees them, so this * component needs no fetcher of its own). They filter as you type * (case-insensitive, prefix matches first) and exclude tags already chosen. * Free text becomes a chip unless `field.allow_new === false`, in which case * only a suggestion's `key` (matched case-insensitively) can become one. * * el.field = { type: 'tags', key: 'labels', options: [...], max_items: 5 }; * el.addEventListener('baht-input', (e) => (draft.labels = e.detail.value)); * * ARIA: APG editable combobox with list autocomplete, same pattern as * — the input is the combobox, the chips sit before it in * the same control, `aria-activedescendant` walks the listbox. */ export declare class BahtTags extends BahtFieldBase { private inputText; private open; private activeIndex; /** Transient reason the last chip attempt was refused (max_length / * max_items / allow_new / duplicate) — cleared on the next successful * add or edit, never persisted, never blocks anything by itself. */ private hint; private inputEl; private readonly onDocMousedown; disconnectedCallback(): void; protected willUpdate(changed: PropertyValues): void; /** The host value as canonical tags — a store/host can hand in anything * (`[1, null]`), and a non-string entry must not crash the render. */ private get tags(); /** A chip shows the matching option's label when the tag happens to be one * (case-insensitive) — same fallback the readonly display (`displayValue`) * already applies; free text with no match shows as typed. */ private chipLabel; private get maxLength(); private get allowNew(); private get suggestions(); /** Same id the base label's `for` points at — clicking the field label * focuses the input natively, no click handler of our own needed. */ private get inputId(); private get listboxId(); private get hintId(); /** Base `describedBy` (error/help) plus the transient refusal hint, when * one is showing. */ private get controlDescribedBy(); private optionId; /** Why `trimmed` can't join `current` right now, or null when it can — * same rules bank20baht-validator re-checks server-side. */ private rejectionFor; /** * `current` + one more chip, or the reason it was refused — null only for * blank input (nothing worth reporting). Pure (no emit) so `addMany` can * fold several candidates into ONE next array before telling the host, * instead of racing `this.value` across several back-to-back emits. */ private nextWithTag; private hintFor; /** Attempt to add one chip; returns whether it landed. A refusal shows a * brief inline hint instead of failing silently. */ private addTag; private removeTag; /** Split pasted / bulk text on commas (and newlines) into separate chips, * emitted as ONE array (see `nextWithTag`). Reports the last refusal only * when NOTHING from the paste landed. */ private addMany; private listen; private close; private highlight; private commitTyped; private pick; private onInput; private onEnter; private onBackspace; private onArrowDown; private onArrowUp; private onEscape; private onKeydown; private onPaste; private onBlur; protected updated(): void; protected renderControl(): TemplateResult; } declare global { interface HTMLElementTagNameMap { 'baht-tags': BahtTags; } }