@f-ewald/components 1.30.1 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +2 -0
  2. package/custom-elements.json +275 -1
  3. package/dist/address-autocomplete.js +1 -1
  4. package/dist/address-autocomplete.js.map +1 -1
  5. package/dist/autocomplete-input.js +1 -1
  6. package/dist/autocomplete-input.js.map +1 -1
  7. package/dist/form-field.d.ts.map +1 -1
  8. package/dist/form-field.js +81 -13
  9. package/dist/form-field.js.map +1 -1
  10. package/dist/form-select.js +3 -3
  11. package/dist/form-select.js.map +1 -1
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/multi-select.js +3 -3
  17. package/dist/multi-select.js.map +1 -1
  18. package/dist/progress-bar.d.ts +31 -0
  19. package/dist/progress-bar.d.ts.map +1 -0
  20. package/dist/progress-bar.js +128 -0
  21. package/dist/progress-bar.js.map +1 -0
  22. package/dist/radio-cards.d.ts +19 -0
  23. package/dist/radio-cards.d.ts.map +1 -1
  24. package/dist/radio-cards.js +62 -4
  25. package/dist/radio-cards.js.map +1 -1
  26. package/dist/text-area.js +3 -3
  27. package/dist/text-area.js.map +1 -1
  28. package/dist/ui-admonition.d.ts +33 -0
  29. package/dist/ui-admonition.d.ts.map +1 -0
  30. package/dist/ui-admonition.js +147 -0
  31. package/dist/ui-admonition.js.map +1 -0
  32. package/docs/address-autocomplete.md +1 -0
  33. package/docs/autocomplete-input.md +1 -0
  34. package/docs/form-field.md +2 -0
  35. package/docs/form-select.md +1 -1
  36. package/docs/multi-select.md +1 -0
  37. package/docs/progress-bar.md +51 -0
  38. package/docs/radio-cards.md +9 -0
  39. package/docs/text-area.md +1 -0
  40. package/docs/ui-admonition.md +55 -0
  41. package/llms.txt +59 -7
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"aut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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAgB;AAEU;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;oDAAe;AAMnC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDAA6C;AAE3D;IAAhB,KAAK,EAAE;uDAAiD;AACxC;IAAhB,KAAK,EAAE;gDAAuB;AACd;IAAhB,KAAK,EAAE;uDAA2B;AAClB;IAAhB,KAAK,EAAE;wDAA+B;AACtB;IAAhB,KAAK,EAAE;2DAAgE;AAEhD;IAAvB,KAAK,CAAC,OAAO,CAAC;iDAAmC;AApPvC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA8jB7B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\nimport { submitWithDefaultButton } from \"./utils/form.js\";\n\nlet instanceCount = 0;\n\n/** A single autocomplete candidate: an opaque `key` plus its display `value`. */\nexport interface AutocompleteOption {\n key: string;\n value: string;\n}\n\n/**\n * Generic form-associated text input with a suggestion dropdown, for any\n * \"type to filter a list of `{key, value}` options\" use case. Works as a\n * drop-in replacement for a plain `<input>` inside a `<form>`: set `name` on\n * the element itself and consumers keep reading\n * `new FormData(form).get(name)` and calling `form.reset()` unchanged — the\n * submitted value is the picked option's `value`, while `key` is available\n * via the `option-select` event and the `selectedOption` getter for cases\n * that need the underlying id rather than the display text.\n *\n * Supports two suggestion sources:\n * - **API**: set `endpoint` to a URL that, given a `?<query-param>=<text>`\n * query string, responds with a JSON array of `{key, value}` objects.\n * Requests are debounced as the user types.\n * - **Local array**: set `options` to a fixed `AutocompleteOption[]` and the\n * component filters it client-side instead of making any network\n * request. Useful for small/fixed lists, offline use, or tests. Takes\n * priority over `endpoint` whenever it's non-null.\n *\n * Set `clearable` to show an in-field clear action whenever a value is\n * present.\n *\n * @element autocomplete-input\n * @fires option-select - An option was picked; detail: AutocompleteOption.\n * @fires input - Native-compatible input event fired while editing or clearing.\n */\n@customElement(\"autocomplete-input\")\nexport class AutocompleteInput extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n }\n .field-shell {\n position: relative;\n }\n input {\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n }\n .field-shell.clearable input {\n padding-right: 2rem;\n }\n .clear-button {\n position: absolute;\n top: 0;\n right: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 2rem;\n height: 2rem;\n /* Insets the hover/focus background by the input's 1px border so it\n stays fully inside the field instead of painting over the border. */\n padding: 1px;\n background-clip: content-box;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text-muted, #64748b);\n background-color: transparent;\n cursor: pointer;\n line-height: 0;\n }\n .clear-button:hover {\n color: var(--ui-text, #0f172a);\n background-color: var(--ui-surface-muted, #f8fafc);\n }\n .clear-button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .floating-label {\n position: absolute;\n top: 50%;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n transform: translateY(-50%);\n color: var(--ui-text-muted, #64748b);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n transform 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.clearable .floating-label {\n right: 2rem;\n }\n .field-shell.floating input {\n height: 3rem;\n padding-top: 1.25rem;\n padding-bottom: 0.25rem;\n }\n .field-shell.floating .clear-button {\n top: 0.5rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n transform: none;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) input::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n input:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .suggestions {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 10;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n .suggestion {\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n }\n .suggestion.active,\n .suggestion:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .no-suggestions {\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-style: italic;\n }\n @media (forced-colors: active) {\n input:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n input:disabled {\n color: GrayText;\n opacity: 1;\n }\n .clear-button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: -2px;\n box-shadow: none;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n .suggestion.active,\n .suggestion:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n /** Current input value; also the form-associated value submitted with the form. */\n @property() value = \"\";\n /** Placeholder text shown when the input is empty. */\n @property() placeholder = \"\";\n /** Marks the input as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /** Disables the input and closes its suggestion popup. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /** Shows an in-field clear action while the control has a value. */\n @property({ type: Boolean, reflect: true }) clearable = false;\n /** API endpoint queried in API mode. Ignored when `options` is set. */\n @property() endpoint = \"\";\n /** Query string parameter name the current input text is sent under. */\n @property({ attribute: \"query-param\" }) queryParam = \"q\";\n /** Debounce delay (ms) before firing a request/filter after typing. */\n @property({ type: Number }) debounce = 300;\n /** Minimum query length before suggestions are shown. */\n @property({ type: Number, attribute: \"min-length\" }) minLength = 3;\n /**\n * Fixed candidate list to filter locally instead of fetching from\n * `endpoint`. When set (non-null), no network request is ever made —\n * this takes priority over the API mode.\n */\n @property({ attribute: false }) options: AutocompleteOption[] | null = null;\n\n @state() private _suggestions: AutocompleteOption[] = [];\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _formDisabled = false;\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n @query(\"input\") private _input?: HTMLInputElement;\n\n #internals = this.attachInternals();\n #lastPicked: AutocompleteOption | null = null;\n #debounceTimer: ReturnType<typeof setTimeout> | null = null;\n #abortController: AbortController | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #inputId = `autocomplete-input-field-${++instanceCount}`;\n readonly #listboxId = `autocomplete-input-listbox-${instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** Last-picked option, or null once the input diverges from it. */\n get selectedOption(): AutocompleteOption | null {\n if (this.#lastPicked && this.#lastPicked.value === this.value) return this.#lastPicked;\n return null;\n }\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n protected override willUpdate(changed: PropertyValues) {\n if (changed.has(\"disabled\") && this.#isDisabled) {\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n this._open = false;\n this._activeIndex = -1;\n }\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.has(\"value\")) this.#internals.setFormValue(this.value);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n }\n\n /** Resets to empty on `form.reset()`, per the form-associated custom element contract. */\n formResetCallback() {\n this.value = \"\";\n this._suggestions = [];\n this._open = false;\n this.#lastPicked = null;\n }\n\n /** Mirrors ancestor fieldset disabled state onto the native input. */\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n if (!disabled) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n this._open = false;\n this._activeIndex = -1;\n }\n\n private onInput(e: InputEvent) {\n if (this.#isDisabled) return;\n this.value = (e.target as HTMLInputElement).value;\n this.#lastPicked = null;\n this.#scheduleFetch(this.value);\n }\n\n #scheduleFetch(query: string) {\n if (this.#isDisabled) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n if (query.trim().length < this.minLength) {\n this._suggestions = [];\n this._open = false;\n this._activeIndex = -1;\n return;\n }\n if (this.options) {\n // Local mode: filtering is synchronous and cheap, but keep the same\n // debounce as the API mode so the UX doesn't shift between sources.\n this.#debounceTimer = setTimeout(() => this.#filterLocalOptions(query), this.debounce);\n return;\n }\n this.#debounceTimer = setTimeout(() => void this.#fetchOptions(query), this.debounce);\n }\n\n /** Filters the locally-supplied `options` list for `query`, case-insensitively. */\n #filterLocalOptions(query: string) {\n const needle = query.trim().toLowerCase();\n this._suggestions = (this.options ?? [])\n .filter((o) => o.value.toLowerCase().includes(needle))\n .slice(0, 5);\n this._activeIndex = -1;\n this._open = !this.#isDisabled;\n }\n\n /** Fetches options for `query` from `endpoint`, cancelling any request still in flight. */\n async #fetchOptions(query: string) {\n this.#abortController?.abort();\n const controller = new AbortController();\n this.#abortController = controller;\n try {\n const res = await fetch(this.#buildUrl(query), { signal: controller.signal });\n if (!res.ok) throw new Error(`autocomplete request failed: ${res.status}`);\n if (this.#isDisabled) return;\n this._suggestions = ((await res.json()) as AutocompleteOption[]).slice(0, 5);\n this._activeIndex = -1;\n this._open = true;\n } catch {\n // Aborted (superseded by newer keystroke) or a network failure while\n // typing — fail silently and just close the list.\n if (!controller.signal.aborted) {\n this._suggestions = [];\n this._open = false;\n }\n }\n }\n\n #buildUrl(query: string): string {\n const params = new URLSearchParams({ [this.queryParam]: query });\n return `${this.endpoint}?${params.toString()}`;\n }\n\n private onKeydown(e: KeyboardEvent) {\n if (this.#isDisabled) return;\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1, e);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1, e);\n else if (e.key === \"Enter\") this.#handleEnter(e);\n else if (e.key === \"Escape\") this.#handleEscape(e);\n }\n\n #moveActive(delta: number, e: KeyboardEvent) {\n if (!this._open || this._suggestions.length === 0) return;\n e.preventDefault();\n const n = this._suggestions.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #handleEnter(e: KeyboardEvent) {\n const pick = this._suggestions[this._activeIndex] ?? this._suggestions[0];\n if (this._open && pick) {\n e.preventDefault();\n this.#selectOption(pick);\n return;\n }\n if (this.#internals.form) {\n const form = this.#internals.form;\n window.setTimeout(() => {\n if (!e.defaultPrevented && form.isConnected) submitWithDefaultButton(form);\n });\n }\n }\n\n #handleEscape(e: KeyboardEvent) {\n if (!this._open) return;\n e.preventDefault();\n this._open = false;\n }\n\n private onBlur() {\n this._open = false;\n }\n\n private onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n /** Clears composition state when the control can no longer receive keys. */\n #resetComposition(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n }\n\n #selectOption(o: AutocompleteOption) {\n this.value = o.value;\n this.#lastPicked = o;\n this._open = false;\n this._suggestions = [];\n this.dispatchEvent(new CustomEvent<AutocompleteOption>(\"option-select\", { detail: o, bubbles: true, composed: true }));\n }\n\n /** Clears the field and all pending autocomplete state, then restores input focus. */\n #clear(): void {\n if (this.#isDisabled || !this.value) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#debounceTimer = null;\n this.#abortController?.abort();\n this.#abortController = null;\n this.#resetComposition();\n this.value = \"\";\n this.#lastPicked = null;\n this._suggestions = [];\n this._activeIndex = -1;\n this._open = false;\n this.#internals.setFormValue(\"\");\n this.dispatchEvent(\n new InputEvent(\"input\", {\n bubbles: true,\n composed: true,\n inputType: \"deleteContentBackward\",\n }),\n );\n this._input?.focus({ preventScroll: true });\n }\n\n /** Selects on mousedown (not click) so it wins over the input's blur, which closes the list. */\n #onSuggestionMousedown(e: MouseEvent, o: AutocompleteOption) {\n e.preventDefault();\n this.#selectOption(o);\n }\n\n private renderSuggestions() {\n if (!this._open || this.#isDisabled) return nothing;\n return html`\n <ul id=${this.#listboxId} class=\"suggestions\" role=\"listbox\" aria-label=\"Suggestions\">\n ${this._suggestions.map(\n (o, i) => html`\n <li\n id=${`${this.#listboxId}-option-${i}`}\n role=\"option\"\n aria-selected=${i === this._activeIndex}\n class=\"suggestion ${i === this._activeIndex ? \"active\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#onSuggestionMousedown(e, o)}\n >\n ${o.value}\n </li>\n `,\n )}\n ${this._suggestions.length === 0\n ? html`<li class=\"no-suggestions\" role=\"presentation\">\n <span role=\"status\">No suggestions found</span>\n </li>`\n : nothing}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && !this.#isDisabled && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const expanded = this._open && !this.#isDisabled;\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n const showClear = this.clearable && Boolean(this.value) && !this.#isDisabled;\n return html`\n <div\n class=\"field-shell ${this.clearable ? \"clearable\" : \"\"} ${floating\n ? \"floating\"\n : \"\"} ${this.value ? \"has-value\" : \"\"} ${this.#isDisabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#inputId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <input\n id=${this.#inputId}\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded=${expanded}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n .value=${this.value}\n placeholder=${this.placeholder}\n ?required=${this.required}\n ?disabled=${this.#isDisabled}\n autocomplete=\"off\"\n @input=${this.onInput}\n @compositionstart=${this.onCompositionStart}\n @compositionend=${this.onCompositionEnd}\n @keydown=${this.onKeydown}\n @blur=${this.onBlur}\n />\n ${showClear\n ? html`\n <button\n type=\"button\"\n class=\"clear-button\"\n aria-label=\"Clear input\"\n title=\"Clear input\"\n @mousedown=${(event: MouseEvent) => event.preventDefault()}\n @click=${() => this.#clear()}\n >\n ${iconX(18)}\n </button>\n `\n : nothing}\n ${this.renderSuggestions()}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"autocomplete-input\": AutocompleteInput;\n }\n}\n"]}
1
+ {"version":3,"file":"autocomplete-input.js","sourceRoot":"","sources":["../src/autocomplete-input.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;A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E;AAEhD;IAAvB,KAAK,CAAC,OAAO,CAAC;iDAAmC;AApPvC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA8jB7B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\nimport { submitWithDefaultButton } from \"./utils/form.js\";\n\nlet instanceCount = 0;\n\n/** A single autocomplete candidate: an opaque `key` plus its display `value`. */\nexport interface AutocompleteOption {\n key: string;\n value: string;\n}\n\n/**\n * Generic form-associated text input with a suggestion dropdown, for any\n * \"type to filter a list of `{key, value}` options\" use case. Works as a\n * drop-in replacement for a plain `<input>` inside a `<form>`: set `name` on\n * the element itself and consumers keep reading\n * `new FormData(form).get(name)` and calling `form.reset()` unchanged — the\n * submitted value is the picked option's `value`, while `key` is available\n * via the `option-select` event and the `selectedOption` getter for cases\n * that need the underlying id rather than the display text.\n *\n * Supports two suggestion sources:\n * - **API**: set `endpoint` to a URL that, given a `?<query-param>=<text>`\n * query string, responds with a JSON array of `{key, value}` objects.\n * Requests are debounced as the user types.\n * - **Local array**: set `options` to a fixed `AutocompleteOption[]` and the\n * component filters it client-side instead of making any network\n * request. Useful for small/fixed lists, offline use, or tests. Takes\n * priority over `endpoint` whenever it's non-null.\n *\n * Set `clearable` to show an in-field clear action whenever a value is\n * present.\n *\n * @element autocomplete-input\n * @fires option-select - An option was picked; detail: AutocompleteOption.\n * @fires input - Native-compatible input event fired while editing or clearing.\n */\n@customElement(\"autocomplete-input\")\nexport class AutocompleteInput extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: relative;\n }\n .field-shell {\n position: relative;\n }\n input {\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n width: 100%;\n height: 2rem;\n box-sizing: border-box;\n }\n .field-shell.clearable input {\n padding-right: 2rem;\n }\n .clear-button {\n position: absolute;\n top: 0;\n right: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 2rem;\n height: 2rem;\n /* Insets the hover/focus background by the input's 1px border so it\n stays fully inside the field instead of painting over the border. */\n padding: 1px;\n background-clip: content-box;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text-muted, #64748b);\n background-color: transparent;\n cursor: pointer;\n line-height: 0;\n }\n .clear-button:hover {\n color: var(--ui-text, #0f172a);\n background-color: var(--ui-surface-muted, #f8fafc);\n }\n .clear-button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .floating-label {\n position: absolute;\n top: 50%;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n transform: translateY(-50%);\n color: var(--ui-text-muted, #64748b);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n transform 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.clearable .floating-label {\n right: 2rem;\n }\n .field-shell.floating input {\n height: 3rem;\n padding-top: 1.25rem;\n padding-bottom: 0.25rem;\n }\n .field-shell.floating .clear-button {\n top: 0.5rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n transform: none;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) input::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n input:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n input:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .suggestions {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 10;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n .suggestion {\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n }\n .suggestion.active,\n .suggestion:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .no-suggestions {\n padding: 0.5rem 0.75rem;\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-style: italic;\n }\n @media (forced-colors: active) {\n input:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n input:disabled {\n color: GrayText;\n opacity: 1;\n }\n .clear-button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: -2px;\n box-shadow: none;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n .suggestion.active,\n .suggestion:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n /** Current input value; also the form-associated value submitted with the form. */\n @property() value = \"\";\n /** Placeholder text shown when the input is empty. */\n @property() placeholder = \"\";\n /** Marks the input as required for native form validation. */\n @property({ type: Boolean }) required = false;\n /** Disables the input and closes its suggestion popup. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /** Shows an in-field clear action while the control has a value. */\n @property({ type: Boolean, reflect: true }) clearable = false;\n /** API endpoint queried in API mode. Ignored when `options` is set. */\n @property() endpoint = \"\";\n /** Query string parameter name the current input text is sent under. */\n @property({ attribute: \"query-param\" }) queryParam = \"q\";\n /** Debounce delay (ms) before firing a request/filter after typing. */\n @property({ type: Number }) debounce = 300;\n /** Minimum query length before suggestions are shown. */\n @property({ type: Number, attribute: \"min-length\" }) minLength = 3;\n /**\n * Fixed candidate list to filter locally instead of fetching from\n * `endpoint`. When set (non-null), no network request is ever made —\n * this takes priority over the API mode.\n */\n @property({ attribute: false }) options: AutocompleteOption[] | null = null;\n\n @state() private _suggestions: AutocompleteOption[] = [];\n @state() private _open = false;\n @state() private _activeIndex = -1;\n @state() private _formDisabled = false;\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n @query(\"input\") private _input?: HTMLInputElement;\n\n #internals = this.attachInternals();\n #lastPicked: AutocompleteOption | null = null;\n #debounceTimer: ReturnType<typeof setTimeout> | null = null;\n #abortController: AbortController | null = null;\n #isComposing = false;\n #compositionJustEnded = false;\n #compositionEndTimer: ReturnType<typeof setTimeout> | null = null;\n readonly #inputId = `autocomplete-input-field-${++instanceCount}`;\n readonly #listboxId = `autocomplete-input-listbox-${instanceCount}`;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n /** Last-picked option, or null once the input diverges from it. */\n get selectedOption(): AutocompleteOption | null {\n if (this.#lastPicked && this.#lastPicked.value === this.value) return this.#lastPicked;\n return null;\n }\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n protected override willUpdate(changed: PropertyValues) {\n if (changed.has(\"disabled\") && this.#isDisabled) {\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n this._open = false;\n this._activeIndex = -1;\n }\n }\n\n protected override updated(changed: PropertyValues) {\n if (changed.has(\"value\")) this.#internals.setFormValue(this.value);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n }\n\n /** Resets to empty on `form.reset()`, per the form-associated custom element contract. */\n formResetCallback() {\n this.value = \"\";\n this._suggestions = [];\n this._open = false;\n this.#lastPicked = null;\n }\n\n /** Mirrors ancestor fieldset disabled state onto the native input. */\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled;\n if (!disabled) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#resetComposition();\n this.#abortController?.abort();\n this._open = false;\n this._activeIndex = -1;\n }\n\n private onInput(e: InputEvent) {\n if (this.#isDisabled) return;\n this.value = (e.target as HTMLInputElement).value;\n this.#lastPicked = null;\n this.#scheduleFetch(this.value);\n }\n\n #scheduleFetch(query: string) {\n if (this.#isDisabled) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n if (query.trim().length < this.minLength) {\n this._suggestions = [];\n this._open = false;\n this._activeIndex = -1;\n return;\n }\n if (this.options) {\n // Local mode: filtering is synchronous and cheap, but keep the same\n // debounce as the API mode so the UX doesn't shift between sources.\n this.#debounceTimer = setTimeout(() => this.#filterLocalOptions(query), this.debounce);\n return;\n }\n this.#debounceTimer = setTimeout(() => void this.#fetchOptions(query), this.debounce);\n }\n\n /** Filters the locally-supplied `options` list for `query`, case-insensitively. */\n #filterLocalOptions(query: string) {\n const needle = query.trim().toLowerCase();\n this._suggestions = (this.options ?? [])\n .filter((o) => o.value.toLowerCase().includes(needle))\n .slice(0, 5);\n this._activeIndex = -1;\n this._open = !this.#isDisabled;\n }\n\n /** Fetches options for `query` from `endpoint`, cancelling any request still in flight. */\n async #fetchOptions(query: string) {\n this.#abortController?.abort();\n const controller = new AbortController();\n this.#abortController = controller;\n try {\n const res = await fetch(this.#buildUrl(query), { signal: controller.signal });\n if (!res.ok) throw new Error(`autocomplete request failed: ${res.status}`);\n if (this.#isDisabled) return;\n this._suggestions = ((await res.json()) as AutocompleteOption[]).slice(0, 5);\n this._activeIndex = -1;\n this._open = true;\n } catch {\n // Aborted (superseded by newer keystroke) or a network failure while\n // typing — fail silently and just close the list.\n if (!controller.signal.aborted) {\n this._suggestions = [];\n this._open = false;\n }\n }\n }\n\n #buildUrl(query: string): string {\n const params = new URLSearchParams({ [this.queryParam]: query });\n return `${this.endpoint}?${params.toString()}`;\n }\n\n private onKeydown(e: KeyboardEvent) {\n if (this.#isDisabled) return;\n if (e.isComposing || e.keyCode === 229 || this.#isComposing || this.#compositionJustEnded) {\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1, e);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1, e);\n else if (e.key === \"Enter\") this.#handleEnter(e);\n else if (e.key === \"Escape\") this.#handleEscape(e);\n }\n\n #moveActive(delta: number, e: KeyboardEvent) {\n if (!this._open || this._suggestions.length === 0) return;\n e.preventDefault();\n const n = this._suggestions.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #handleEnter(e: KeyboardEvent) {\n const pick = this._suggestions[this._activeIndex] ?? this._suggestions[0];\n if (this._open && pick) {\n e.preventDefault();\n this.#selectOption(pick);\n return;\n }\n if (this.#internals.form) {\n const form = this.#internals.form;\n window.setTimeout(() => {\n if (!e.defaultPrevented && form.isConnected) submitWithDefaultButton(form);\n });\n }\n }\n\n #handleEscape(e: KeyboardEvent) {\n if (!this._open) return;\n e.preventDefault();\n this._open = false;\n }\n\n private onBlur() {\n this._open = false;\n }\n\n private onCompositionStart(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#compositionJustEnded = false;\n this.#isComposing = true;\n }\n\n private onCompositionEnd(): void {\n this.#isComposing = false;\n this.#compositionJustEnded = true;\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = setTimeout(() => {\n this.#compositionJustEnded = false;\n this.#compositionEndTimer = null;\n });\n }\n\n /** Clears composition state when the control can no longer receive keys. */\n #resetComposition(): void {\n if (this.#compositionEndTimer) clearTimeout(this.#compositionEndTimer);\n this.#compositionEndTimer = null;\n this.#isComposing = false;\n this.#compositionJustEnded = false;\n }\n\n #selectOption(o: AutocompleteOption) {\n this.value = o.value;\n this.#lastPicked = o;\n this._open = false;\n this._suggestions = [];\n this.dispatchEvent(new CustomEvent<AutocompleteOption>(\"option-select\", { detail: o, bubbles: true, composed: true }));\n }\n\n /** Clears the field and all pending autocomplete state, then restores input focus. */\n #clear(): void {\n if (this.#isDisabled || !this.value) return;\n if (this.#debounceTimer) clearTimeout(this.#debounceTimer);\n this.#debounceTimer = null;\n this.#abortController?.abort();\n this.#abortController = null;\n this.#resetComposition();\n this.value = \"\";\n this.#lastPicked = null;\n this._suggestions = [];\n this._activeIndex = -1;\n this._open = false;\n this.#internals.setFormValue(\"\");\n this.dispatchEvent(\n new InputEvent(\"input\", {\n bubbles: true,\n composed: true,\n inputType: \"deleteContentBackward\",\n }),\n );\n this._input?.focus({ preventScroll: true });\n }\n\n /** Selects on mousedown (not click) so it wins over the input's blur, which closes the list. */\n #onSuggestionMousedown(e: MouseEvent, o: AutocompleteOption) {\n e.preventDefault();\n this.#selectOption(o);\n }\n\n private renderSuggestions() {\n if (!this._open || this.#isDisabled) return nothing;\n return html`\n <ul id=${this.#listboxId} class=\"suggestions\" role=\"listbox\" aria-label=\"Suggestions\">\n ${this._suggestions.map(\n (o, i) => html`\n <li\n id=${`${this.#listboxId}-option-${i}`}\n role=\"option\"\n aria-selected=${i === this._activeIndex}\n class=\"suggestion ${i === this._activeIndex ? \"active\" : \"\"}\"\n @mousedown=${(e: MouseEvent) => this.#onSuggestionMousedown(e, o)}\n >\n ${o.value}\n </li>\n `,\n )}\n ${this._suggestions.length === 0\n ? html`<li class=\"no-suggestions\" role=\"presentation\">\n <span role=\"status\">No suggestions found</span>\n </li>`\n : nothing}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && !this.#isDisabled && this._activeIndex >= 0\n ? `${this.#listboxId}-option-${this._activeIndex}`\n : nothing;\n const expanded = this._open && !this.#isDisabled;\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n const showClear = this.clearable && Boolean(this.value) && !this.#isDisabled;\n return html`\n <div\n class=\"field-shell ${this.clearable ? \"clearable\" : \"\"} ${floating\n ? \"floating\"\n : \"\"} ${this.value ? \"has-value\" : \"\"} ${this.#isDisabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#inputId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <input\n id=${this.#inputId}\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded=${expanded}\n aria-controls=${this.#listboxId}\n aria-activedescendant=${activeDescendant}\n .value=${this.value}\n placeholder=${this.placeholder}\n ?required=${this.required}\n ?disabled=${this.#isDisabled}\n autocomplete=\"off\"\n @input=${this.onInput}\n @compositionstart=${this.onCompositionStart}\n @compositionend=${this.onCompositionEnd}\n @keydown=${this.onKeydown}\n @blur=${this.onBlur}\n />\n ${showClear\n ? html`\n <button\n type=\"button\"\n class=\"clear-button\"\n aria-label=\"Clear input\"\n title=\"Clear input\"\n @mousedown=${(event: MouseEvent) => event.preventDefault()}\n @click=${() => this.#clear()}\n >\n ${iconX(18)}\n </button>\n `\n : nothing}\n ${this.renderSuggestions()}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"autocomplete-input\": AutocompleteInput;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["../src/form-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AA8B1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,SAAU,SAAQ,UAAU;;IACvC,OAAgB,MAAM,4BAiLpB;IAEF,wBAAwB;IACZ,KAAK,SAAM;IACvB,4EAA4E;IAChE,IAAI,SAAM;IACtB,uEAAuE;IAC3D,KAAK,SAAM;IACvB,oDAAoD;IACvB,QAAQ,UAAS;IAC9C,uFAAuF;IAEvF,aAAa,UAAS;IAGtB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAE1C,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,eAAe,CAAS;IAwBzC,0EAA0E;IAC1E,UAAmB,YAAY,IAAI,IAAI,CAEtC;IAED,iFAAiF;IACjF,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAQ9D;IAED,4EAA4E;IACnE,oBAAoB,IAAI,IAAI,CAQpC;IAED,gFAAgF;IAChF,OAAO,CAAC,aAAa;IAIrB,6DAA6D;IAC7D,OAAO,CAAC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FAAyF;IACzF,OAAO,CAAC,uBAAuB;IAwItB,MAAM,yCAgCd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
@@ -151,7 +151,7 @@ let FormField = class FormField extends LitElement {
151
151
  font-size 150ms ease;
152
152
  }
153
153
  .control-label.floating-native.multiline .label-text {
154
- top: 0.5rem;
154
+ top: 0.25rem;
155
155
  transform: none;
156
156
  }
157
157
  .control-label.floating-native.has-value .label-text,
@@ -167,11 +167,19 @@ let FormField = class FormField extends LitElement {
167
167
  width: 100%;
168
168
  min-height: 3rem;
169
169
  margin: 0;
170
- padding: 1.25rem 0.75rem 0.25rem;
171
- border: 0;
172
- border-radius: var(--ui-radius-sm, 0.25rem);
173
- color: var(--ui-text, #0f172a);
174
- background: transparent;
170
+ /*
171
+ * !important below survives a host page's own global element reset
172
+ * (e.g. Tailwind v4's layered preflight): a slotted control is real
173
+ * light-DOM content, so the host page's own rules for "input"/
174
+ * "textarea" compete directly against ::slotted() here, and in
175
+ * practice win over it at equal-or-lower specificity despite living
176
+ * in a CSS layer, since ::slotted() rules cross a shadow boundary.
177
+ */
178
+ padding: 1.25rem 0.75rem 0.25rem !important;
179
+ border: 0 !important;
180
+ border-radius: var(--ui-radius-sm, 0.25rem) !important;
181
+ color: var(--ui-text, #0f172a) !important;
182
+ background: transparent !important;
175
183
  font-family: var(
176
184
  --ui-font,
177
185
  ui-sans-serif,
@@ -181,17 +189,20 @@ let FormField = class FormField extends LitElement {
181
189
  "Segoe UI Emoji",
182
190
  "Segoe UI Symbol",
183
191
  "Noto Color Emoji"
184
- );
185
- font-size: var(--ui-font-size-sm, 0.75rem);
186
- line-height: var(--ui-line-height-tight, 1.25);
192
+ ) !important;
193
+ font-size: var(--ui-font-size, 0.875rem) !important;
194
+ line-height: var(--ui-line-height-tight, 1.25) !important;
187
195
  }
188
196
  .control-label.floating-native ::slotted(input) {
189
197
  height: 3rem;
190
198
  }
191
199
  .control-label.floating-native ::slotted(textarea) {
192
- padding-bottom: 0.5rem;
200
+ padding-bottom: 0.5rem !important;
193
201
  resize: vertical;
194
202
  }
203
+ .control-label.floating-native.multiline ::slotted(textarea) {
204
+ padding-top: 1.5rem !important;
205
+ }
195
206
  .control-label.floating-native ::slotted(input:focus-visible),
196
207
  .control-label.floating-native ::slotted(textarea:focus-visible) {
197
208
  outline: none;
@@ -199,7 +210,7 @@ let FormField = class FormField extends LitElement {
199
210
  .control-label.floating-native ::slotted(input:disabled),
200
211
  .control-label.floating-native ::slotted(textarea:disabled) {
201
212
  cursor: not-allowed;
202
- opacity: 0.6;
213
+ opacity: 0.6 !important;
203
214
  }
204
215
  .control-label.floating-native:has(:disabled) .label-text {
205
216
  cursor: not-allowed;
@@ -208,6 +219,48 @@ let FormField = class FormField extends LitElement {
208
219
  .control-label.floating-native ::slotted(input:-webkit-autofill) {
209
220
  animation: form-field-autofill 0.001s;
210
221
  }
222
+ .control-label:not(.floating-native) ::slotted(input),
223
+ .control-label:not(.floating-native) ::slotted(textarea) {
224
+ display: block;
225
+ box-sizing: border-box;
226
+ width: 100%;
227
+ margin: 0;
228
+ /* See the !important note on the floating-native rule above. */
229
+ padding: 0.5rem 0.75rem !important;
230
+ border: 1px solid var(--ui-border, #e2e8f0) !important;
231
+ border-radius: var(--ui-radius-sm, 0.25rem) !important;
232
+ color: var(--ui-text, #0f172a) !important;
233
+ background: var(--ui-surface, #ffffff) !important;
234
+ font-family: var(
235
+ --ui-font,
236
+ ui-sans-serif,
237
+ system-ui,
238
+ sans-serif,
239
+ "Apple Color Emoji",
240
+ "Segoe UI Emoji",
241
+ "Segoe UI Symbol",
242
+ "Noto Color Emoji"
243
+ ) !important;
244
+ font-size: var(--ui-font-size, 0.875rem) !important;
245
+ line-height: var(--ui-line-height-normal, 1.5) !important;
246
+ }
247
+ .control-label:not(.floating-native) ::slotted(input) {
248
+ height: 2rem;
249
+ }
250
+ .control-label:not(.floating-native) ::slotted(textarea) {
251
+ resize: vertical;
252
+ }
253
+ .control-label:not(.floating-native) ::slotted(input:focus-visible),
254
+ .control-label:not(.floating-native) ::slotted(textarea:focus-visible) {
255
+ outline: none;
256
+ border-color: var(--ui-primary, #4f46e5) !important;
257
+ box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
258
+ }
259
+ .control-label:not(.floating-native) ::slotted(input:disabled),
260
+ .control-label:not(.floating-native) ::slotted(textarea:disabled) {
261
+ cursor: not-allowed;
262
+ opacity: 0.6 !important;
263
+ }
211
264
  .required-mark {
212
265
  color: var(--ui-danger, #dc2626);
213
266
  }
@@ -257,8 +310,23 @@ let FormField = class FormField extends LitElement {
257
310
  .control-label.floating-native ::slotted(input:disabled),
258
311
  .control-label.floating-native ::slotted(textarea:disabled),
259
312
  .control-label.floating-native:has(:disabled) .label-text {
260
- color: GrayText;
261
- opacity: 1;
313
+ color: GrayText !important;
314
+ opacity: 1 !important;
315
+ }
316
+ .control-label:not(.floating-native) ::slotted(input),
317
+ .control-label:not(.floating-native) ::slotted(textarea) {
318
+ border-color: CanvasText !important;
319
+ }
320
+ .control-label:not(.floating-native) ::slotted(input:focus-visible),
321
+ .control-label:not(.floating-native) ::slotted(textarea:focus-visible) {
322
+ outline: 2px solid CanvasText;
323
+ outline-offset: 2px;
324
+ box-shadow: none;
325
+ }
326
+ .control-label:not(.floating-native) ::slotted(input:disabled),
327
+ .control-label:not(.floating-native) ::slotted(textarea:disabled) {
328
+ color: GrayText !important;
329
+ opacity: 1 !important;
262
330
  }
263
331
  }
264
332
  `,
@@ -1 +1 @@
1
- {"version":3,"file":"form-field.js","sourceRoot":"","sources":["../src/form-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EACL,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CA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CAAC,UAAU,mBAAmB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;iBAC9G,OAAO;cACV;YACJ,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;CACF,CAAA;AA9Qa;IAAX,QAAQ,EAAE;wCAAY;AAEX;IAAX,QAAQ,EAAE;uCAAW;AAEV;IAAX,QAAQ,EAAE;wCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAkB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;gDAClD;AAGL;IADhB,qBAAqB,EAAE;oDAC2B;AAElC;IAAhB,KAAK,EAAE;gDAA6D;AACpD;IAAhB,KAAK,EAAE;kDAAiC;AApM9B,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAmcrB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport {\n customElement,\n property,\n queryAssignedElements,\n state,\n} from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n supportsFormFieldControl,\n type FormFieldControl,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\nconst NATIVE_TEXT_INPUT_TYPES = new Set([\n \"date\",\n \"datetime-local\",\n \"email\",\n \"month\",\n \"number\",\n \"password\",\n \"search\",\n \"tel\",\n \"text\",\n \"time\",\n \"url\",\n \"week\",\n]);\n\n/**\n * Per-field wrapper for a form control: label, slotted control, and an\n * optional hint or error message, in one consistent unit repeated across a\n * form. Purely presentational — composes whatever control is slotted\n * (`form-select`, `multi-select`, `autocomplete-input`, `ui-checkbox`, etc.)\n * without intercepting its events or value.\n *\n * Set `floating-label` for supported text controls (`input`, `textarea`,\n * `autocomplete-input`, `address-autocomplete`, and `text-area`). The label\n * then rests inside an empty field and moves to a smaller top-left position\n * while focused or non-empty. Other controls keep the external label.\n *\n * The label wraps the default slot for a best-effort visual/click\n * association only: every existing value-entry control encapsulates its\n * real `<input>` inside its own shadow DOM, so there is no light-DOM `id` a\n * `for` attribute could target from outside, and this component cannot set\n * `aria-describedby`/`aria-invalid` on an arbitrary slotted control's\n * shadow-encapsulated input for the same reason. The error message uses\n * `role=\"alert\"` as the practical accessibility mitigation instead of true\n * `aria-describedby` association.\n *\n * @element form-field\n * @slot - The wrapped form control.\n */\n@customElement(\"form-field\")\nexport class FormField extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .control-label {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .label-text {\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .control-label.floating-native {\n position: relative;\n display: block;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-surface, #ffffff);\n box-shadow: inset 0 0 0 1px var(--ui-border, #e2e8f0);\n }\n .control-label.floating-native:focus-within {\n box-shadow:\n inset 0 0 0 1px var(--ui-primary, #4f46e5),\n var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .control-label.floating-native .label-text {\n position: absolute;\n top: 50%;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n overflow: hidden;\n transform: translateY(-50%);\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n transform 150ms ease,\n font-size 150ms ease;\n }\n .control-label.floating-native.multiline .label-text {\n top: 0.5rem;\n transform: none;\n }\n .control-label.floating-native.has-value .label-text,\n .control-label.floating-native:focus-within .label-text {\n top: 0.25rem;\n transform: none;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .control-label.floating-native ::slotted(input),\n .control-label.floating-native ::slotted(textarea) {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 3rem;\n margin: 0;\n padding: 1.25rem 0.75rem 0.25rem;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n color: var(--ui-text, #0f172a);\n background: transparent;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .control-label.floating-native ::slotted(input) {\n height: 3rem;\n }\n .control-label.floating-native ::slotted(textarea) {\n padding-bottom: 0.5rem;\n resize: vertical;\n }\n .control-label.floating-native ::slotted(input:focus-visible),\n .control-label.floating-native ::slotted(textarea:focus-visible) {\n outline: none;\n }\n .control-label.floating-native ::slotted(input:disabled),\n .control-label.floating-native ::slotted(textarea:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .control-label.floating-native:has(:disabled) .label-text {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .control-label.floating-native ::slotted(input:-webkit-autofill) {\n animation: form-field-autofill 0.001s;\n }\n .required-mark {\n color: var(--ui-danger, #dc2626);\n }\n .message {\n font-size: var(--ui-font-size-xs, 0.6875rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n }\n .message.error {\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .control-label.floating-native .label-text {\n transition: none;\n }\n }\n @keyframes form-field-autofill {\n from {\n opacity: 1;\n }\n to {\n opacity: 1;\n }\n }\n @media (forced-colors: active) {\n .control-label.floating-native {\n border: 1px solid CanvasText;\n box-shadow: none;\n }\n .control-label.floating-native:focus-within {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .control-label.floating-native ::slotted(input:disabled),\n .control-label.floating-native ::slotted(textarea:disabled),\n .control-label.floating-native:has(:disabled) .label-text {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Field label text. */\n @property() label = \"\";\n /** Optional helper text shown below the control when there's no `error`. */\n @property() hint = \"\";\n /** Optional error text; replaces the `hint` display when non-empty. */\n @property() error = \"\";\n /** Shows a required indicator next to the label. */\n @property({ type: Boolean }) required = false;\n /** Moves labels inside supported text controls until they receive focus or content. */\n @property({ type: Boolean, reflect: true, attribute: \"floating-label\" })\n floatingLabel = false;\n\n @queryAssignedElements()\n private readonly _assignedElements!: HTMLElement[];\n\n @state() private _floatingKind: \"delegated\" | \"native\" | null = null;\n @state() private _nativeHasValue = false;\n\n readonly #messageId = `form-field-message-${++instanceCount}`;\n #configuredControls = new Set<FormFieldControl>();\n #resetForm: HTMLFormElement | null = null;\n #placeholderControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #placeholder = \"\";\n #accessibleNameControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #accessibleName: string | null = null;\n #nativeEventControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #nativeFocused = false;\n readonly #onNativeValueChange = () => this._onControlValueChange();\n readonly #onNativeFocus = () => this._onControlFocusIn();\n readonly #onNativeBlur = () => this._onControlFocusOut();\n readonly #onNativeAnimation = (event: Event) => {\n if (event instanceof AnimationEvent) this._onNativeAnimationStart(event);\n };\n readonly #onFormReset = () => {\n window.setTimeout(() => {\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n });\n };\n\n /** Synchronizes label configuration after the component first renders. */\n protected override firstUpdated(): void {\n this.#syncControls();\n }\n\n /** Resynchronizes delegated controls when public label configuration changes. */\n protected override updated(changed: PropertyValues<this>): void {\n if (\n changed.has(\"label\") ||\n changed.has(\"required\") ||\n changed.has(\"floatingLabel\")\n ) {\n this.#syncControls();\n }\n }\n\n /** Removes delegated configuration and form listeners when disconnected. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n for (const control of this.#configuredControls) control[formFieldControl](null);\n this.#configuredControls.clear();\n this.#bindNativePlaceholder(null);\n this.#bindNativeAccessibleName(null);\n this.#bindNativeEvents(null);\n this.#bindResetForm(null);\n }\n\n /** Handles assigned-control changes and updates the floating-label strategy. */\n private _onSlotChange(): void {\n this.#syncControls();\n }\n\n /** Tracks native input/textarea content after user edits. */\n private _onControlValueChange(): void {\n if (this._floatingKind !== \"native\") return;\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n }\n\n /** Reveals the native placeholder once focus floats the label. */\n private _onControlFocusIn(): void {\n if (this._floatingKind !== \"native\") return;\n this.#nativeFocused = true;\n this.#syncNativePlaceholder();\n }\n\n /** Hides the native placeholder again when an empty field loses focus. */\n private _onControlFocusOut(): void {\n if (this._floatingKind !== \"native\") return;\n this.#nativeFocused = false;\n this.#syncNativePlaceholder();\n }\n\n /** Focuses a native control when its shadow-rendered floating label is clicked. */\n private _onControlLabelClick(event: MouseEvent): void {\n if (this._floatingKind !== \"native\") return;\n const control = this.#nativeControl();\n if (!control || event.composedPath().includes(control)) return;\n control.focus();\n }\n\n /** Synchronizes native value state when WebKit applies autofill without input events. */\n private _onNativeAnimationStart(event: AnimationEvent): void {\n if (\n this._floatingKind !== \"native\" ||\n event.animationName !== \"form-field-autofill\"\n ) {\n return;\n }\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n }\n\n /** Finds the sole assigned native text control, if present. */\n #nativeControl(): HTMLInputElement | HTMLTextAreaElement | null {\n if (this._assignedElements?.length !== 1) return null;\n const [element] = this._assignedElements;\n if (element instanceof HTMLTextAreaElement) return element;\n if (!(element instanceof HTMLInputElement)) return null;\n return NATIVE_TEXT_INPUT_TYPES.has(element.type) ? element : null;\n }\n\n /** Pushes current label configuration into a supported slotted control. */\n #syncControls(): void {\n const assigned = this._assignedElements ?? [];\n const delegated =\n this.floatingLabel &&\n Boolean(this.label) &&\n assigned.length === 1 &&\n supportsFormFieldControl(assigned[0])\n ? assigned[0]\n : null;\n const native =\n this.floatingLabel && Boolean(this.label) && !delegated\n ? this.#nativeControl()\n : null;\n const nextConfigured = new Set<FormFieldControl>();\n\n if (delegated) {\n delegated[formFieldControl]({\n label: this.label,\n required: this.required,\n floating: true,\n });\n nextConfigured.add(delegated);\n }\n for (const control of this.#configuredControls) {\n if (!nextConfigured.has(control)) control[formFieldControl](null);\n }\n this.#configuredControls = nextConfigured;\n\n this._floatingKind = delegated ? \"delegated\" : native ? \"native\" : null;\n this.#updateNativeValue();\n this.#bindNativePlaceholder(native);\n this.#bindNativeAccessibleName(native);\n this.#bindNativeEvents(native);\n this.#bindResetForm(native?.form ?? null);\n }\n\n /** Updates whether a native control currently contains a value. */\n #updateNativeValue(): void {\n this._nativeHasValue = Boolean(this.#nativeControl()?.value);\n }\n\n /** Preserves the consumer placeholder while floating mode temporarily hides it. */\n #bindNativePlaceholder(\n control: HTMLInputElement | HTMLTextAreaElement | null,\n ): void {\n if (control === this.#placeholderControl) {\n this.#syncNativePlaceholder();\n return;\n }\n if (this.#placeholderControl) this.#placeholderControl.placeholder = this.#placeholder;\n this.#placeholderControl = control;\n this.#placeholder = control?.placeholder ?? \"\";\n this.#nativeFocused = control === document.activeElement;\n this.#syncNativePlaceholder();\n }\n\n /** Applies the correct placeholder for the native label's focus/value state. */\n #syncNativePlaceholder(): void {\n if (!this.#placeholderControl) return;\n this.#placeholderControl.placeholder =\n this.#nativeFocused || this._nativeHasValue ? this.#placeholder : \"\";\n }\n\n /** Applies a shadow-boundary-safe accessible name and restores any prior value. */\n #bindNativeAccessibleName(\n control: HTMLInputElement | HTMLTextAreaElement | null,\n ): void {\n if (control !== this.#accessibleNameControl) {\n if (this.#accessibleNameControl) {\n if (this.#accessibleName == null) {\n this.#accessibleNameControl.removeAttribute(\"aria-label\");\n } else {\n this.#accessibleNameControl.setAttribute(\"aria-label\", this.#accessibleName);\n }\n }\n this.#accessibleNameControl = control;\n this.#accessibleName = control?.getAttribute(\"aria-label\") ?? null;\n }\n if (!control) return;\n control.setAttribute(\n \"aria-label\",\n this.required ? `${this.label} (required)` : this.label,\n );\n }\n\n /** Moves native field listeners directly between assigned controls. */\n #bindNativeEvents(control: HTMLInputElement | HTMLTextAreaElement | null): void {\n if (control === this.#nativeEventControl) return;\n this.#nativeEventControl?.removeEventListener(\"input\", this.#onNativeValueChange);\n this.#nativeEventControl?.removeEventListener(\"change\", this.#onNativeValueChange);\n this.#nativeEventControl?.removeEventListener(\"focus\", this.#onNativeFocus);\n this.#nativeEventControl?.removeEventListener(\"blur\", this.#onNativeBlur);\n this.#nativeEventControl?.removeEventListener(\n \"animationstart\",\n this.#onNativeAnimation,\n );\n this.#nativeEventControl = control;\n this.#nativeEventControl?.addEventListener(\"input\", this.#onNativeValueChange);\n this.#nativeEventControl?.addEventListener(\"change\", this.#onNativeValueChange);\n this.#nativeEventControl?.addEventListener(\"focus\", this.#onNativeFocus);\n this.#nativeEventControl?.addEventListener(\"blur\", this.#onNativeBlur);\n this.#nativeEventControl?.addEventListener(\n \"animationstart\",\n this.#onNativeAnimation,\n );\n }\n\n /** Moves the reset listener to the native control's current owner form. */\n #bindResetForm(form: HTMLFormElement | null): void {\n if (form === this.#resetForm) return;\n this.#resetForm?.removeEventListener(\"reset\", this.#onFormReset);\n this.#resetForm = form;\n this.#resetForm?.addEventListener(\"reset\", this.#onFormReset);\n }\n\n override render() {\n const message = this.error || this.hint;\n const delegatedFloating = this._floatingKind === \"delegated\";\n const nativeFloating = this._floatingKind === \"native\";\n const nativeMultiline =\n nativeFloating && this.#nativeControl() instanceof HTMLTextAreaElement;\n return html`\n <div class=\"field\">\n <label\n class=\"control-label ${nativeFloating ? \"floating-native\" : \"\"} ${nativeMultiline\n ? \"multiline\"\n : \"\"} ${this._nativeHasValue ? \"has-value\" : \"\"}\"\n @click=${this._onControlLabelClick}\n >\n ${this.label && !delegatedFloating\n ? html`<span class=\"label-text\">\n <span>${this.label}</span>\n ${this.required\n ? html`<span class=\"required-mark\" aria-hidden=\"true\">*</span\n ><span class=\"sr-only\"> (required)</span>`\n : nothing}\n </span>`\n : nothing}\n <slot @slotchange=${this._onSlotChange}></slot>\n </label>\n ${message\n ? html`<span id=${this.#messageId} class=\"message ${this.error ? \"error\" : \"\"}\" role=${this.error ? \"alert\" : nothing}\n >${message}</span\n >`\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"form-field\": FormField;\n }\n}\n"]}
1
+ {"version":3,"file":"form-field.js","sourceRoot":"","sources":["../src/form-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EACL,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GAEzB,MAAM,+BAA+B,CAAC;AAEvC,IAAI,aAAa,GAAG,CAAC,CAAC;AACtB,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,MAAM;IACN,gBAAgB;IAChB,OAAO;IACP,OAAO;IACP,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;CACP,CAAC,CAAC;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AAEX;IAAX,QAAQ,EAAE;uCAAW;AAEV;IAAX,QAAQ,EAAE;wCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAkB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;gDAClD;AAGL;IADhB,qBAAqB,EAAE;oDAC2B;AAElC;IAAhB,KAAK,EAAE;gDAA6D;AACpD;IAAhB,KAAK,EAAE;kDAAiC;AAxQ9B,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAugBrB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport {\n customElement,\n property,\n queryAssignedElements,\n state,\n} from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n supportsFormFieldControl,\n type FormFieldControl,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\nconst NATIVE_TEXT_INPUT_TYPES = new Set([\n \"date\",\n \"datetime-local\",\n \"email\",\n \"month\",\n \"number\",\n \"password\",\n \"search\",\n \"tel\",\n \"text\",\n \"time\",\n \"url\",\n \"week\",\n]);\n\n/**\n * Per-field wrapper for a form control: label, slotted control, and an\n * optional hint or error message, in one consistent unit repeated across a\n * form. Purely presentational — composes whatever control is slotted\n * (`form-select`, `multi-select`, `autocomplete-input`, `ui-checkbox`, etc.)\n * without intercepting its events or value.\n *\n * Set `floating-label` for supported text controls (`input`, `textarea`,\n * `autocomplete-input`, `address-autocomplete`, and `text-area`). The label\n * then rests inside an empty field and moves to a smaller top-left position\n * while focused or non-empty. Other controls keep the external label.\n *\n * The label wraps the default slot for a best-effort visual/click\n * association only: every existing value-entry control encapsulates its\n * real `<input>` inside its own shadow DOM, so there is no light-DOM `id` a\n * `for` attribute could target from outside, and this component cannot set\n * `aria-describedby`/`aria-invalid` on an arbitrary slotted control's\n * shadow-encapsulated input for the same reason. The error message uses\n * `role=\"alert\"` as the practical accessibility mitigation instead of true\n * `aria-describedby` association.\n *\n * @element form-field\n * @slot - The wrapped form control.\n */\n@customElement(\"form-field\")\nexport class FormField extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .control-label {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .label-text {\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .control-label.floating-native {\n position: relative;\n display: block;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-surface, #ffffff);\n box-shadow: inset 0 0 0 1px var(--ui-border, #e2e8f0);\n }\n .control-label.floating-native:focus-within {\n box-shadow:\n inset 0 0 0 1px var(--ui-primary, #4f46e5),\n var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .control-label.floating-native .label-text {\n position: absolute;\n top: 50%;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n overflow: hidden;\n transform: translateY(-50%);\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n transform 150ms ease,\n font-size 150ms ease;\n }\n .control-label.floating-native.multiline .label-text {\n top: 0.25rem;\n transform: none;\n }\n .control-label.floating-native.has-value .label-text,\n .control-label.floating-native:focus-within .label-text {\n top: 0.25rem;\n transform: none;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .control-label.floating-native ::slotted(input),\n .control-label.floating-native ::slotted(textarea) {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 3rem;\n margin: 0;\n /*\n * !important below survives a host page's own global element reset\n * (e.g. Tailwind v4's layered preflight): a slotted control is real\n * light-DOM content, so the host page's own rules for \"input\"/\n * \"textarea\" compete directly against ::slotted() here, and in\n * practice win over it at equal-or-lower specificity despite living\n * in a CSS layer, since ::slotted() rules cross a shadow boundary.\n */\n padding: 1.25rem 0.75rem 0.25rem !important;\n border: 0 !important;\n border-radius: var(--ui-radius-sm, 0.25rem) !important;\n color: var(--ui-text, #0f172a) !important;\n background: transparent !important;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n ) !important;\n font-size: var(--ui-font-size, 0.875rem) !important;\n line-height: var(--ui-line-height-tight, 1.25) !important;\n }\n .control-label.floating-native ::slotted(input) {\n height: 3rem;\n }\n .control-label.floating-native ::slotted(textarea) {\n padding-bottom: 0.5rem !important;\n resize: vertical;\n }\n .control-label.floating-native.multiline ::slotted(textarea) {\n padding-top: 1.5rem !important;\n }\n .control-label.floating-native ::slotted(input:focus-visible),\n .control-label.floating-native ::slotted(textarea:focus-visible) {\n outline: none;\n }\n .control-label.floating-native ::slotted(input:disabled),\n .control-label.floating-native ::slotted(textarea:disabled) {\n cursor: not-allowed;\n opacity: 0.6 !important;\n }\n .control-label.floating-native:has(:disabled) .label-text {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .control-label.floating-native ::slotted(input:-webkit-autofill) {\n animation: form-field-autofill 0.001s;\n }\n .control-label:not(.floating-native) ::slotted(input),\n .control-label:not(.floating-native) ::slotted(textarea) {\n display: block;\n box-sizing: border-box;\n width: 100%;\n margin: 0;\n /* See the !important note on the floating-native rule above. */\n padding: 0.5rem 0.75rem !important;\n border: 1px solid var(--ui-border, #e2e8f0) !important;\n border-radius: var(--ui-radius-sm, 0.25rem) !important;\n color: var(--ui-text, #0f172a) !important;\n background: var(--ui-surface, #ffffff) !important;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n ) !important;\n font-size: var(--ui-font-size, 0.875rem) !important;\n line-height: var(--ui-line-height-normal, 1.5) !important;\n }\n .control-label:not(.floating-native) ::slotted(input) {\n height: 2rem;\n }\n .control-label:not(.floating-native) ::slotted(textarea) {\n resize: vertical;\n }\n .control-label:not(.floating-native) ::slotted(input:focus-visible),\n .control-label:not(.floating-native) ::slotted(textarea:focus-visible) {\n outline: none;\n border-color: var(--ui-primary, #4f46e5) !important;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .control-label:not(.floating-native) ::slotted(input:disabled),\n .control-label:not(.floating-native) ::slotted(textarea:disabled) {\n cursor: not-allowed;\n opacity: 0.6 !important;\n }\n .required-mark {\n color: var(--ui-danger, #dc2626);\n }\n .message {\n font-size: var(--ui-font-size-xs, 0.6875rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n }\n .message.error {\n color: var(--ui-danger, #dc2626);\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (prefers-reduced-motion: reduce) {\n .control-label.floating-native .label-text {\n transition: none;\n }\n }\n @keyframes form-field-autofill {\n from {\n opacity: 1;\n }\n to {\n opacity: 1;\n }\n }\n @media (forced-colors: active) {\n .control-label.floating-native {\n border: 1px solid CanvasText;\n box-shadow: none;\n }\n .control-label.floating-native:focus-within {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .control-label.floating-native ::slotted(input:disabled),\n .control-label.floating-native ::slotted(textarea:disabled),\n .control-label.floating-native:has(:disabled) .label-text {\n color: GrayText !important;\n opacity: 1 !important;\n }\n .control-label:not(.floating-native) ::slotted(input),\n .control-label:not(.floating-native) ::slotted(textarea) {\n border-color: CanvasText !important;\n }\n .control-label:not(.floating-native) ::slotted(input:focus-visible),\n .control-label:not(.floating-native) ::slotted(textarea:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .control-label:not(.floating-native) ::slotted(input:disabled),\n .control-label:not(.floating-native) ::slotted(textarea:disabled) {\n color: GrayText !important;\n opacity: 1 !important;\n }\n }\n `,\n ];\n\n /** Field label text. */\n @property() label = \"\";\n /** Optional helper text shown below the control when there's no `error`. */\n @property() hint = \"\";\n /** Optional error text; replaces the `hint` display when non-empty. */\n @property() error = \"\";\n /** Shows a required indicator next to the label. */\n @property({ type: Boolean }) required = false;\n /** Moves labels inside supported text controls until they receive focus or content. */\n @property({ type: Boolean, reflect: true, attribute: \"floating-label\" })\n floatingLabel = false;\n\n @queryAssignedElements()\n private readonly _assignedElements!: HTMLElement[];\n\n @state() private _floatingKind: \"delegated\" | \"native\" | null = null;\n @state() private _nativeHasValue = false;\n\n readonly #messageId = `form-field-message-${++instanceCount}`;\n #configuredControls = new Set<FormFieldControl>();\n #resetForm: HTMLFormElement | null = null;\n #placeholderControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #placeholder = \"\";\n #accessibleNameControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #accessibleName: string | null = null;\n #nativeEventControl: HTMLInputElement | HTMLTextAreaElement | null = null;\n #nativeFocused = false;\n readonly #onNativeValueChange = () => this._onControlValueChange();\n readonly #onNativeFocus = () => this._onControlFocusIn();\n readonly #onNativeBlur = () => this._onControlFocusOut();\n readonly #onNativeAnimation = (event: Event) => {\n if (event instanceof AnimationEvent) this._onNativeAnimationStart(event);\n };\n readonly #onFormReset = () => {\n window.setTimeout(() => {\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n });\n };\n\n /** Synchronizes label configuration after the component first renders. */\n protected override firstUpdated(): void {\n this.#syncControls();\n }\n\n /** Resynchronizes delegated controls when public label configuration changes. */\n protected override updated(changed: PropertyValues<this>): void {\n if (\n changed.has(\"label\") ||\n changed.has(\"required\") ||\n changed.has(\"floatingLabel\")\n ) {\n this.#syncControls();\n }\n }\n\n /** Removes delegated configuration and form listeners when disconnected. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n for (const control of this.#configuredControls) control[formFieldControl](null);\n this.#configuredControls.clear();\n this.#bindNativePlaceholder(null);\n this.#bindNativeAccessibleName(null);\n this.#bindNativeEvents(null);\n this.#bindResetForm(null);\n }\n\n /** Handles assigned-control changes and updates the floating-label strategy. */\n private _onSlotChange(): void {\n this.#syncControls();\n }\n\n /** Tracks native input/textarea content after user edits. */\n private _onControlValueChange(): void {\n if (this._floatingKind !== \"native\") return;\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n }\n\n /** Reveals the native placeholder once focus floats the label. */\n private _onControlFocusIn(): void {\n if (this._floatingKind !== \"native\") return;\n this.#nativeFocused = true;\n this.#syncNativePlaceholder();\n }\n\n /** Hides the native placeholder again when an empty field loses focus. */\n private _onControlFocusOut(): void {\n if (this._floatingKind !== \"native\") return;\n this.#nativeFocused = false;\n this.#syncNativePlaceholder();\n }\n\n /** Focuses a native control when its shadow-rendered floating label is clicked. */\n private _onControlLabelClick(event: MouseEvent): void {\n if (this._floatingKind !== \"native\") return;\n const control = this.#nativeControl();\n if (!control || event.composedPath().includes(control)) return;\n control.focus();\n }\n\n /** Synchronizes native value state when WebKit applies autofill without input events. */\n private _onNativeAnimationStart(event: AnimationEvent): void {\n if (\n this._floatingKind !== \"native\" ||\n event.animationName !== \"form-field-autofill\"\n ) {\n return;\n }\n this.#updateNativeValue();\n this.#syncNativePlaceholder();\n }\n\n /** Finds the sole assigned native text control, if present. */\n #nativeControl(): HTMLInputElement | HTMLTextAreaElement | null {\n if (this._assignedElements?.length !== 1) return null;\n const [element] = this._assignedElements;\n if (element instanceof HTMLTextAreaElement) return element;\n if (!(element instanceof HTMLInputElement)) return null;\n return NATIVE_TEXT_INPUT_TYPES.has(element.type) ? element : null;\n }\n\n /** Pushes current label configuration into a supported slotted control. */\n #syncControls(): void {\n const assigned = this._assignedElements ?? [];\n const delegated =\n this.floatingLabel &&\n Boolean(this.label) &&\n assigned.length === 1 &&\n supportsFormFieldControl(assigned[0])\n ? assigned[0]\n : null;\n const native =\n this.floatingLabel && Boolean(this.label) && !delegated\n ? this.#nativeControl()\n : null;\n const nextConfigured = new Set<FormFieldControl>();\n\n if (delegated) {\n delegated[formFieldControl]({\n label: this.label,\n required: this.required,\n floating: true,\n });\n nextConfigured.add(delegated);\n }\n for (const control of this.#configuredControls) {\n if (!nextConfigured.has(control)) control[formFieldControl](null);\n }\n this.#configuredControls = nextConfigured;\n\n this._floatingKind = delegated ? \"delegated\" : native ? \"native\" : null;\n this.#updateNativeValue();\n this.#bindNativePlaceholder(native);\n this.#bindNativeAccessibleName(native);\n this.#bindNativeEvents(native);\n this.#bindResetForm(native?.form ?? null);\n }\n\n /** Updates whether a native control currently contains a value. */\n #updateNativeValue(): void {\n this._nativeHasValue = Boolean(this.#nativeControl()?.value);\n }\n\n /** Preserves the consumer placeholder while floating mode temporarily hides it. */\n #bindNativePlaceholder(\n control: HTMLInputElement | HTMLTextAreaElement | null,\n ): void {\n if (control === this.#placeholderControl) {\n this.#syncNativePlaceholder();\n return;\n }\n if (this.#placeholderControl) this.#placeholderControl.placeholder = this.#placeholder;\n this.#placeholderControl = control;\n this.#placeholder = control?.placeholder ?? \"\";\n this.#nativeFocused = control === document.activeElement;\n this.#syncNativePlaceholder();\n }\n\n /** Applies the correct placeholder for the native label's focus/value state. */\n #syncNativePlaceholder(): void {\n if (!this.#placeholderControl) return;\n this.#placeholderControl.placeholder =\n this.#nativeFocused || this._nativeHasValue ? this.#placeholder : \"\";\n }\n\n /** Applies a shadow-boundary-safe accessible name and restores any prior value. */\n #bindNativeAccessibleName(\n control: HTMLInputElement | HTMLTextAreaElement | null,\n ): void {\n if (control !== this.#accessibleNameControl) {\n if (this.#accessibleNameControl) {\n if (this.#accessibleName == null) {\n this.#accessibleNameControl.removeAttribute(\"aria-label\");\n } else {\n this.#accessibleNameControl.setAttribute(\"aria-label\", this.#accessibleName);\n }\n }\n this.#accessibleNameControl = control;\n this.#accessibleName = control?.getAttribute(\"aria-label\") ?? null;\n }\n if (!control) return;\n control.setAttribute(\n \"aria-label\",\n this.required ? `${this.label} (required)` : this.label,\n );\n }\n\n /** Moves native field listeners directly between assigned controls. */\n #bindNativeEvents(control: HTMLInputElement | HTMLTextAreaElement | null): void {\n if (control === this.#nativeEventControl) return;\n this.#nativeEventControl?.removeEventListener(\"input\", this.#onNativeValueChange);\n this.#nativeEventControl?.removeEventListener(\"change\", this.#onNativeValueChange);\n this.#nativeEventControl?.removeEventListener(\"focus\", this.#onNativeFocus);\n this.#nativeEventControl?.removeEventListener(\"blur\", this.#onNativeBlur);\n this.#nativeEventControl?.removeEventListener(\n \"animationstart\",\n this.#onNativeAnimation,\n );\n this.#nativeEventControl = control;\n this.#nativeEventControl?.addEventListener(\"input\", this.#onNativeValueChange);\n this.#nativeEventControl?.addEventListener(\"change\", this.#onNativeValueChange);\n this.#nativeEventControl?.addEventListener(\"focus\", this.#onNativeFocus);\n this.#nativeEventControl?.addEventListener(\"blur\", this.#onNativeBlur);\n this.#nativeEventControl?.addEventListener(\n \"animationstart\",\n this.#onNativeAnimation,\n );\n }\n\n /** Moves the reset listener to the native control's current owner form. */\n #bindResetForm(form: HTMLFormElement | null): void {\n if (form === this.#resetForm) return;\n this.#resetForm?.removeEventListener(\"reset\", this.#onFormReset);\n this.#resetForm = form;\n this.#resetForm?.addEventListener(\"reset\", this.#onFormReset);\n }\n\n override render() {\n const message = this.error || this.hint;\n const delegatedFloating = this._floatingKind === \"delegated\";\n const nativeFloating = this._floatingKind === \"native\";\n const nativeMultiline =\n nativeFloating && this.#nativeControl() instanceof HTMLTextAreaElement;\n return html`\n <div class=\"field\">\n <label\n class=\"control-label ${nativeFloating ? \"floating-native\" : \"\"} ${nativeMultiline\n ? \"multiline\"\n : \"\"} ${this._nativeHasValue ? \"has-value\" : \"\"}\"\n @click=${this._onControlLabelClick}\n >\n ${this.label && !delegatedFloating\n ? html`<span class=\"label-text\">\n <span>${this.label}</span>\n ${this.required\n ? html`<span class=\"required-mark\" aria-hidden=\"true\">*</span\n ><span class=\"sr-only\"> (required)</span>`\n : nothing}\n </span>`\n : nothing}\n <slot @slotchange=${this._onSlotChange}></slot>\n </label>\n ${message\n ? html`<span id=${this.#messageId} class=\"message ${this.error ? \"error\" : \"\"}\" role=${this.error ? \"alert\" : nothing}\n >${message}</span\n >`\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"form-field\": FormField;\n }\n}\n"]}
@@ -82,7 +82,7 @@ let FormSelect = class FormSelect extends LitElement {
82
82
  "Segoe UI Symbol",
83
83
  "Noto Color Emoji"
84
84
  );
85
- font-size: var(--ui-font-size-sm, 0.75rem);
85
+ font-size: var(--ui-font-size, 0.875rem);
86
86
  }
87
87
  button.trigger {
88
88
  display: flex;
@@ -102,7 +102,7 @@ let FormSelect = class FormSelect extends LitElement {
102
102
  "Segoe UI Symbol",
103
103
  "Noto Color Emoji"
104
104
  );
105
- font-size: var(--ui-font-size-sm, 0.75rem);
105
+ font-size: var(--ui-font-size, 0.875rem);
106
106
  line-height: var(--ui-line-height-tight, 1.25);
107
107
  color: var(--ui-text, #0f172a);
108
108
  background: var(--ui-surface, #ffffff);
@@ -170,7 +170,7 @@ let FormSelect = class FormSelect extends LitElement {
170
170
  "Segoe UI Symbol",
171
171
  "Noto Color Emoji"
172
172
  );
173
- font-size: var(--ui-font-size-sm, 0.75rem);
173
+ font-size: var(--ui-font-size, 0.875rem);
174
174
  line-height: var(--ui-line-height-tight, 1.25);
175
175
  }
176
176
  .chevron {