@f-ewald/components 1.43.0 → 1.44.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.
@@ -1917,7 +1917,7 @@
1917
1917
  "declarations": [
1918
1918
  {
1919
1919
  "kind": "class",
1920
- "description": "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\ndrop-in replacement for a plain `<input>` inside a `<form>`: set `name` on\nthe element itself and consumers keep reading\n`new FormData(form).get(name)` and calling `form.reset()` unchanged — the\nsubmitted value is the picked option's `value`, while `key` is available\nvia the `option-select` event and the `selectedOption` getter for cases\nthat need the underlying id rather than the display text.\n\nSupports 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\nEach option may also carry a pre-rendered `icon` (shown before the value)\nand a `description` (a smaller, muted line under the value); options\nwithout them render as a plain value.\n\nSet `clearable` to show an in-field clear action whenever a value is\npresent.",
1920
+ "description": "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\ndrop-in replacement for a plain `<input>` inside a `<form>`: set `name` on\nthe element itself and consumers keep reading\n`new FormData(form).get(name)` and calling `form.reset()` unchanged — the\nsubmitted value is the picked option's `value`, while `key` is available\nvia the `option-select` event and the `selectedOption` getter for cases\nthat need the underlying id rather than the display text.\n\nSupports 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\nEach option may also carry a pre-rendered `icon` (shown before the value)\nand a `description` (a smaller, muted line under the value); options\nwithout them render as a plain value. The selected option's icon also\nshows inside the field until the text is edited. Picking an option sets\n`selectedKey`; set `selectedKey` and `value` together to show a selection\nmade elsewhere.\n\nSet `clearable` to show an in-field clear action whenever a value is\npresent.",
1921
1921
  "name": "AutocompleteInput",
1922
1922
  "members": [
1923
1923
  {
@@ -2030,6 +2030,16 @@
2030
2030
  "default": "null",
2031
2031
  "description": "Fixed candidate list to filter locally instead of fetching from\n`endpoint`. When set (non-null), no network request is ever made —\nthis takes priority over the API mode."
2032
2032
  },
2033
+ {
2034
+ "kind": "field",
2035
+ "name": "selectedKey",
2036
+ "type": {
2037
+ "text": "string | null"
2038
+ },
2039
+ "default": "null",
2040
+ "description": "Key of the selected option: set by picking one, or by the caller together with `value`.",
2041
+ "attribute": "selected-key"
2042
+ },
2033
2043
  {
2034
2044
  "kind": "field",
2035
2045
  "name": "_suggestions",
@@ -2172,7 +2182,7 @@
2172
2182
  "type": {
2173
2183
  "text": "AutocompleteOption | null"
2174
2184
  },
2175
- "description": "Last-picked option, or null once the input diverges from it.",
2185
+ "description": "Selected option (picked, or matching `selectedKey`), or null once the input diverges from it.",
2176
2186
  "readonly": true
2177
2187
  },
2178
2188
  {
@@ -2525,6 +2535,15 @@
2525
2535
  "default": "3",
2526
2536
  "description": "Minimum query length before suggestions are shown.",
2527
2537
  "fieldName": "minLength"
2538
+ },
2539
+ {
2540
+ "name": "selected-key",
2541
+ "type": {
2542
+ "text": "string | null"
2543
+ },
2544
+ "default": "null",
2545
+ "description": "Key of the selected option: set by picking one, or by the caller together with `value`.",
2546
+ "fieldName": "selectedKey"
2528
2547
  }
2529
2548
  ],
2530
2549
  "superclass": {
@@ -30,7 +30,10 @@ export interface AutocompleteOption {
30
30
  *
31
31
  * Each option may also carry a pre-rendered `icon` (shown before the value)
32
32
  * and a `description` (a smaller, muted line under the value); options
33
- * without them render as a plain value.
33
+ * without them render as a plain value. The selected option's icon also
34
+ * shows inside the field until the text is edited. Picking an option sets
35
+ * `selectedKey`; set `selectedKey` and `value` together to show a selection
36
+ * made elsewhere.
34
37
  *
35
38
  * Set `clearable` to show an in-field clear action whenever a value is
36
39
  * present.
@@ -67,13 +70,15 @@ export declare class AutocompleteInput extends LitElement {
67
70
  * this takes priority over the API mode.
68
71
  */
69
72
  options: AutocompleteOption[] | null;
73
+ /** Key of the selected option: set by picking one, or by the caller together with `value`. */
74
+ selectedKey: string | null;
70
75
  private _suggestions;
71
76
  private _open;
72
77
  private _activeIndex;
73
78
  private _formDisabled;
74
79
  private _formFieldConfig;
75
80
  private _input?;
76
- /** Last-picked option, or null once the input diverges from it. */
81
+ /** Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. */
77
82
  get selectedOption(): AutocompleteOption | null;
78
83
  /**
79
84
  * Applies or clears label configuration supplied by a wrapping `form-field`.
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-input.d.ts","sourceRoot":"","sources":["../src/autocomplete-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI/F,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAKvC,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,8HAA8H;IAC9H,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,wGAAwG;IACxG,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,iBAAkB,SAAQ,UAAU;;IAC/C,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BAyOpB;IAEF,mFAAmF;IACvE,KAAK,SAAM;IACvB,sDAAsD;IAC1C,WAAW,SAAM;IAC7B,8DAA8D;IACjC,Q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BAAgB,CAAC,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAE9D;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,QAQpD;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,QAEjD;IAEQ,oBAAoB,SAK5B;IAED,0FAA0F;IAC1F,iBAAiB,SAKhB;IAED,sEAAsE;IACtE,oBAAoB,CAAC,QAAQ,EAAE,OAAO,QAQrC;IAED,OAAO,CAAC,OAAO;IA8Df,OAAO,CAAC,SAAS;IAuCjB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,gBAAgB;IAyDxB,OAAO,CAAC,iBAAiB;IA8BhB,MAAM,sBAoEd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,iBAAiB,CAAC;KACzC;CACF"}
@@ -32,7 +32,10 @@ let instanceCount = 0;
32
32
  *
33
33
  * Each option may also carry a pre-rendered `icon` (shown before the value)
34
34
  * and a `description` (a smaller, muted line under the value); options
35
- * without them render as a plain value.
35
+ * without them render as a plain value. The selected option's icon also
36
+ * shows inside the field until the text is edited. Picking an option sets
37
+ * `selectedKey`; set `selectedKey` and `value` together to show a selection
38
+ * made elsewhere.
36
39
  *
37
40
  * Set `clearable` to show an in-field clear action whenever a value is
38
41
  * present.
@@ -68,6 +71,8 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
68
71
  * this takes priority over the API mode.
69
72
  */
70
73
  this.options = null;
74
+ /** Key of the selected option: set by picking one, or by the caller together with `value`. */
75
+ this.selectedKey = null;
71
76
  this._suggestions = [];
72
77
  this._open = false;
73
78
  this._activeIndex = -1;
@@ -119,6 +124,19 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
119
124
  .field-shell.clearable input {
120
125
  padding-right: 2rem;
121
126
  }
127
+ .field-shell.has-icon input {
128
+ padding-left: 2rem;
129
+ }
130
+ .field-icon {
131
+ position: absolute;
132
+ top: 50%;
133
+ left: 0.75rem;
134
+ display: inline-flex;
135
+ line-height: 0;
136
+ transform: translateY(-50%);
137
+ color: var(--ui-text-muted, #64748b);
138
+ pointer-events: none;
139
+ }
122
140
  .clear-button {
123
141
  position: absolute;
124
142
  top: 0;
@@ -192,6 +210,12 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
192
210
  .field-shell.floating .clear-button {
193
211
  top: 0.5rem;
194
212
  }
213
+ .field-shell.floating .field-icon {
214
+ top: 2rem;
215
+ }
216
+ .field-shell.has-icon .floating-label {
217
+ left: 2rem;
218
+ }
195
219
  .field-shell.floating.has-value .floating-label,
196
220
  .field-shell.floating:focus-within .floating-label {
197
221
  top: 0.25rem;
@@ -331,11 +355,11 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
331
355
  get #isDisabled() {
332
356
  return this.disabled || this._formDisabled;
333
357
  }
334
- /** Last-picked option, or null once the input diverges from it. */
358
+ /** Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. */
335
359
  get selectedOption() {
336
360
  if (this.#lastPicked && this.#lastPicked.value === this.value)
337
361
  return this.#lastPicked;
338
- return null;
362
+ return this.options?.find((o) => o.key === this.selectedKey && o.value === this.value) ?? null;
339
363
  }
340
364
  /**
341
365
  * Applies or clears label configuration supplied by a wrapping `form-field`.
@@ -520,6 +544,7 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
520
544
  }
521
545
  #selectOption(o) {
522
546
  this.value = o.value;
547
+ this.selectedKey = o.key;
523
548
  this.#lastPicked = o;
524
549
  this._open = false;
525
550
  this._suggestions = [];
@@ -588,12 +613,16 @@ let AutocompleteInput = class AutocompleteInput extends LitElement {
588
613
  const expanded = this._open && !this.#isDisabled;
589
614
  const floating = Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);
590
615
  const showClear = this.clearable && Boolean(this.value) && !this.#isDisabled;
616
+ const icon = this.selectedOption?.icon;
591
617
  return html `
592
618
  <div
593
619
  class="field-shell ${this.clearable ? "clearable" : ""} ${floating
594
620
  ? "floating"
595
- : ""} ${this.value ? "has-value" : ""} ${this.#isDisabled ? "disabled" : ""}"
621
+ : ""} ${this.value ? "has-value" : ""} ${this.#isDisabled ? "disabled" : ""} ${icon
622
+ ? "has-icon"
623
+ : ""}"
596
624
  >
625
+ ${icon ? html `<span class="field-icon" aria-hidden="true">${icon}</span>` : nothing}
597
626
  ${floating
598
627
  ? html `
599
628
  <label class="floating-label" for=${this.#inputId}>
@@ -675,6 +704,9 @@ __decorate([
675
704
  __decorate([
676
705
  property({ attribute: false })
677
706
  ], AutocompleteInput.prototype, "options", void 0);
707
+ __decorate([
708
+ property({ attribute: "selected-key" })
709
+ ], AutocompleteInput.prototype, "selectedKey", void 0);
678
710
  __decorate([
679
711
  state()
680
712
  ], AutocompleteInput.prototype, "_suggestions", void 0);
@@ -1 +1 @@
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,EAA4C,MAAM,KAAK,CAAC;AAC/F,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;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,IAAI,aAAa,GAAG,CAAC,CAAC;AAYtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QA8OL,mFAAmF;QACvE,UAAK,GAAG,EAAE,CAAC;QACvB,sDAAsD;QAC1C,gBAAW,GAAG,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AAK,CAAC,OAAO,CAAC;iDAAmC;AA7QvC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA2lB7B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues, type TemplateResult } 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 /** Optional pre-rendered icon shown before the value, e.g. `iconServer(14)`. Local `options` only — not JSON-serializable. */\n icon?: TemplateResult;\n /** Optional secondary line shown under the value in smaller, muted text. Not matched when filtering. */\n description?: 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 * Each option may also carry a pre-rendered `icon` (shown before the value)\n * and a `description` (a smaller, muted line under the value); options\n * without them render as a plain value.\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: var(--ui-border-width, 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: var(--ui-border-width, 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 display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n }\n .suggestion-icon {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n /* Centers the icon on the value's first line rather than the whole row. */\n min-height: calc(1em * var(--ui-line-height-tight, 1.25));\n color: var(--ui-text-muted, #64748b);\n }\n .suggestion-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .suggestion-description {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-xs, 0.6875rem);\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 .suggestion.active :is(.suggestion-icon, .suggestion-description),\n .suggestion:hover :is(.suggestion-icon, .suggestion-description) {\n color: HighlightText;\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.icon ? html`<span class=\"suggestion-icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n <span class=\"suggestion-text\">\n <span class=\"suggestion-value\">${o.value}</span>\n ${o.description ? html`<span class=\"suggestion-description\">${o.description}</span>` : nothing}\n </span>\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
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EAAE;2DAAgE;AAEhD;IAAvB,KAAK,CAAC,OAAO,CAAC;iDAAmC;AAlSvC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAqnB7B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues, type TemplateResult } 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 /** Optional pre-rendered icon shown before the value, e.g. `iconServer(14)`. Local `options` only — not JSON-serializable. */\n icon?: TemplateResult;\n /** Optional secondary line shown under the value in smaller, muted text. Not matched when filtering. */\n description?: 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 * Each option may also carry a pre-rendered `icon` (shown before the value)\n * and a `description` (a smaller, muted line under the value); options\n * without them render as a plain value. The selected option's icon also\n * shows inside the field until the text is edited. Picking an option sets\n * `selectedKey`; set `selectedKey` and `value` together to show a selection\n * made elsewhere.\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: var(--ui-border-width, 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 .field-shell.has-icon input {\n padding-left: 2rem;\n }\n .field-icon {\n position: absolute;\n top: 50%;\n left: 0.75rem;\n display: inline-flex;\n line-height: 0;\n transform: translateY(-50%);\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\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 .field-icon {\n top: 2rem;\n }\n .field-shell.has-icon .floating-label {\n left: 2rem;\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: var(--ui-border-width, 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 display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n }\n .suggestion-icon {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n /* Centers the icon on the value's first line rather than the whole row. */\n min-height: calc(1em * var(--ui-line-height-tight, 1.25));\n color: var(--ui-text-muted, #64748b);\n }\n .suggestion-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .suggestion-description {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-xs, 0.6875rem);\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 .suggestion.active :is(.suggestion-icon, .suggestion-description),\n .suggestion:hover :is(.suggestion-icon, .suggestion-description) {\n color: HighlightText;\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 /** Key of the selected option: set by picking one, or by the caller together with `value`. */\n @property({ attribute: \"selected-key\" }) selectedKey: string | 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 /** Selected option (picked, or matching `selectedKey`), 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 this.options?.find((o) => o.key === this.selectedKey && o.value === this.value) ?? 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.selectedKey = o.key;\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.icon ? html`<span class=\"suggestion-icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n <span class=\"suggestion-text\">\n <span class=\"suggestion-value\">${o.value}</span>\n ${o.description ? html`<span class=\"suggestion-description\">${o.description}</span>` : nothing}\n </span>\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 const icon = this.selectedOption?.icon;\n return html`\n <div\n class=\"field-shell ${this.clearable ? \"clearable\" : \"\"} ${floating\n ? \"floating\"\n : \"\"} ${this.value ? \"has-value\" : \"\"} ${this.#isDisabled ? \"disabled\" : \"\"} ${icon\n ? \"has-icon\"\n : \"\"}\"\n >\n ${icon ? html`<span class=\"field-icon\" aria-hidden=\"true\">${icon}</span>` : nothing}\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"]}
@@ -20,7 +20,10 @@ Supports two suggestion sources:
20
20
 
21
21
  Each option may also carry a pre-rendered `icon` (shown before the value)
22
22
  and a `description` (a smaller, muted line under the value); options
23
- without them render as a plain value.
23
+ without them render as a plain value. The selected option's icon also
24
+ shows inside the field until the text is edited. Picking an option sets
25
+ `selectedKey`; set `selectedKey` and `value` together to show a selection
26
+ made elsewhere.
24
27
 
25
28
  Set `clearable` to show an in-field clear action whenever a value is
26
29
  present.
@@ -66,7 +69,8 @@ import "@f-ewald/components/autocomplete-input.js";
66
69
  | `debounce` | `debounce` | `number` | `300` | Debounce delay (ms) before firing a request/filter after typing. |
67
70
  | `minLength` | `min-length` | `number` | `3` | Minimum query length before suggestions are shown. |
68
71
  | `options` | _(JS property only)_ | `AutocompleteOption[] | null` | `null` | Fixed candidate list to filter locally instead of fetching from `endpoint`. When set (non-null), no network request is ever made — this takes priority over the API mode. |
69
- | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Last-picked option, or null once the input diverges from it. _(read-only)_ |
72
+ | `selectedKey` | `selected-key` | `string | null` | `null` | Key of the selected option: set by picking one, or by the caller together with `value`. |
73
+ | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. _(read-only)_ |
70
74
 
71
75
  ## Events
72
76
 
package/llms.txt CHANGED
@@ -371,14 +371,17 @@ Supports two suggestion sources:
371
371
 
372
372
  Each option may also carry a pre-rendered `icon` (shown before the value)
373
373
  and a `description` (a smaller, muted line under the value); options
374
- without them render as a plain value.
374
+ without them render as a plain value. The selected option's icon also
375
+ shows inside the field until the text is edited. Picking an option sets
376
+ `selectedKey`; set `selectedKey` and `value` together to show a selection
377
+ made elsewhere.
375
378
 
376
379
  Set `clearable` to show an in-field clear action whenever a value is
377
380
  present.
378
381
 
379
382
  Import: `import "@f-ewald/components/autocomplete-input.js";`
380
383
 
381
- Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
384
+ Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedKey` (attribute `selected-key`) : string | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
382
385
  Events: `option-select`, `input`
383
386
  CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-regular`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
384
387
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "1.43.0",
4
+ "version": "1.44.0",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",