@mhmo91/schmancy 0.4.60 → 0.4.62

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 (34) hide show
  1. package/ai/autocomplete.md +49 -12
  2. package/dist/ai/autocomplete.md +49 -12
  3. package/dist/{autocomplete-CF67hOX7.js → autocomplete-B7JYyVgi.js} +13 -28
  4. package/dist/autocomplete-B7JYyVgi.js.map +1 -0
  5. package/dist/autocomplete-CdUGguah.cjs +57 -0
  6. package/dist/autocomplete-CdUGguah.cjs.map +1 -0
  7. package/dist/autocomplete.cjs +1 -1
  8. package/dist/autocomplete.js +1 -1
  9. package/dist/{avatar-C8g7jgmf.cjs → avatar-CPKFq9zM.cjs} +2 -2
  10. package/dist/{avatar-C8g7jgmf.cjs.map → avatar-CPKFq9zM.cjs.map} +1 -1
  11. package/dist/{avatar-C7V7DXNX.js → avatar-DWN-scnK.js} +3 -3
  12. package/dist/{avatar-C7V7DXNX.js.map → avatar-DWN-scnK.js.map} +1 -1
  13. package/dist/badge.cjs +1 -1
  14. package/dist/badge.js +1 -1
  15. package/dist/button.cjs +1 -1
  16. package/dist/button.js +1 -1
  17. package/dist/content-drawer.cjs +1 -1
  18. package/dist/content-drawer.js +1 -1
  19. package/dist/{icon-button-BEmjBwBq.js → icon-button-DIiL6-Vv.js} +13 -17
  20. package/dist/icon-button-DIiL6-Vv.js.map +1 -0
  21. package/dist/{icon-button-tVZLMjEJ.cjs → icon-button-DScsyzbc.cjs} +2 -6
  22. package/dist/icon-button-DScsyzbc.cjs.map +1 -0
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/nav-drawer.cjs +1 -1
  26. package/dist/nav-drawer.js +1 -1
  27. package/dist/teleport.cjs +1 -1
  28. package/dist/teleport.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/autocomplete-CF67hOX7.js.map +0 -1
  31. package/dist/autocomplete-CU-jz4zG.cjs +0 -74
  32. package/dist/autocomplete-CU-jz4zG.cjs.map +0 -1
  33. package/dist/icon-button-BEmjBwBq.js.map +0 -1
  34. package/dist/icon-button-tVZLMjEJ.cjs.map +0 -1
@@ -1,5 +1,8 @@
1
1
  # Schmancy Autocomplete - AI Reference
2
2
 
3
+ ## Overview
4
+ A searchable dropdown component with fuzzy search, keyboard navigation, and multi-select support. Uses similarity scoring for intelligent option filtering.
5
+
3
6
  ```js
4
7
  // Basic Autocomplete (Single-Select)
5
8
  <schmancy-autocomplete
@@ -38,17 +41,19 @@
38
41
  </schmancy-autocomplete>
39
42
 
40
43
  // Autocomplete Properties
41
- value: string // Selected value for single-select, comma-separated string for multi-select (legacy API)
42
- values: string[] // Array of selected values for multi-select (preferred API for multi-select)
43
- multi: boolean // Enable multi-select mode
44
- label: string // Input label
45
- placeholder: string // Input placeholder
46
- required: boolean // Mark as required for validation
47
- size: string // Input size: "sm", "md", "lg"
48
- maxHeight: string // Maximum height of dropdown
49
- debounceMs: number // Debounce delay in milliseconds for filtering
50
- autocomplete: string // Value for input's autocomplete attribute
51
- description: string // Description for screen readers
44
+ value: string // Selected value for single-select, comma-separated string for multi-select (legacy API)
45
+ values: string[] // Array of selected values for multi-select (preferred API for multi-select)
46
+ multi: boolean // Enable multi-select mode
47
+ label: string // Input label
48
+ placeholder: string // Input placeholder
49
+ required: boolean // Mark as required for validation
50
+ size: string // Input size: "sm", "md", "lg"
51
+ maxHeight: string // Maximum height of dropdown (default: "300px")
52
+ debounceMs: number // Debounce delay in milliseconds for filtering (default: 200)
53
+ similarityThreshold: number // Minimum similarity score to show option (0-1, default: 0.3)
54
+ autocomplete: string // Value for input's autocomplete attribute
55
+ description: string // Description for screen readers
56
+ name: string // Form field name for form submission
52
57
 
53
58
  // Autocomplete Events
54
59
  @change // Fires when selection changes with { detail: { value, values? } }
@@ -132,4 +137,36 @@ handleChange(e) {
132
137
 
133
138
  <schmancy-button type="submit">Submit</schmancy-button>
134
139
  </schmancy-form>
135
- ```
140
+ ```
141
+
142
+ ## Key Features
143
+
144
+ ### Fuzzy Search
145
+ - Uses similarity scoring algorithm to find best matches
146
+ - Searches both option labels and values
147
+ - Configurable similarity threshold (0-1)
148
+ - Options are sorted by relevance score
149
+
150
+ ### Keyboard Navigation
151
+ - `ArrowDown/ArrowUp` - Navigate through options
152
+ - `Enter/Space` - Select focused option
153
+ - `Escape` - Close dropdown
154
+ - `Tab` - Move to next field and close dropdown
155
+ - `Home/End` - Jump to first/last option
156
+
157
+ ### Auto-Select on Blur
158
+ - In single-select mode, automatically selects the best matching option when input loses focus
159
+ - Only triggers if there's a search term and a good match
160
+ - Helps with quick data entry
161
+
162
+ ### Accessibility
163
+ - Full ARIA support with proper roles and attributes
164
+ - Screen reader announcements for option counts and selections
165
+ - Keyboard-only navigation support
166
+ - Focus management
167
+
168
+ ### Performance
169
+ - Debounced search input (configurable delay)
170
+ - Efficient RxJS-based state management
171
+ - Virtual scrolling for large option lists
172
+ - Options are only filtered when dropdown is open
@@ -1,5 +1,8 @@
1
1
  # Schmancy Autocomplete - AI Reference
2
2
 
3
+ ## Overview
4
+ A searchable dropdown component with fuzzy search, keyboard navigation, and multi-select support. Uses similarity scoring for intelligent option filtering.
5
+
3
6
  ```js
4
7
  // Basic Autocomplete (Single-Select)
5
8
  <schmancy-autocomplete
@@ -38,17 +41,19 @@
38
41
  </schmancy-autocomplete>
39
42
 
40
43
  // Autocomplete Properties
41
- value: string // Selected value for single-select, comma-separated string for multi-select (legacy API)
42
- values: string[] // Array of selected values for multi-select (preferred API for multi-select)
43
- multi: boolean // Enable multi-select mode
44
- label: string // Input label
45
- placeholder: string // Input placeholder
46
- required: boolean // Mark as required for validation
47
- size: string // Input size: "sm", "md", "lg"
48
- maxHeight: string // Maximum height of dropdown
49
- debounceMs: number // Debounce delay in milliseconds for filtering
50
- autocomplete: string // Value for input's autocomplete attribute
51
- description: string // Description for screen readers
44
+ value: string // Selected value for single-select, comma-separated string for multi-select (legacy API)
45
+ values: string[] // Array of selected values for multi-select (preferred API for multi-select)
46
+ multi: boolean // Enable multi-select mode
47
+ label: string // Input label
48
+ placeholder: string // Input placeholder
49
+ required: boolean // Mark as required for validation
50
+ size: string // Input size: "sm", "md", "lg"
51
+ maxHeight: string // Maximum height of dropdown (default: "300px")
52
+ debounceMs: number // Debounce delay in milliseconds for filtering (default: 200)
53
+ similarityThreshold: number // Minimum similarity score to show option (0-1, default: 0.3)
54
+ autocomplete: string // Value for input's autocomplete attribute
55
+ description: string // Description for screen readers
56
+ name: string // Form field name for form submission
52
57
 
53
58
  // Autocomplete Events
54
59
  @change // Fires when selection changes with { detail: { value, values? } }
@@ -132,4 +137,36 @@ handleChange(e) {
132
137
 
133
138
  <schmancy-button type="submit">Submit</schmancy-button>
134
139
  </schmancy-form>
135
- ```
140
+ ```
141
+
142
+ ## Key Features
143
+
144
+ ### Fuzzy Search
145
+ - Uses similarity scoring algorithm to find best matches
146
+ - Searches both option labels and values
147
+ - Configurable similarity threshold (0-1)
148
+ - Options are sorted by relevance score
149
+
150
+ ### Keyboard Navigation
151
+ - `ArrowDown/ArrowUp` - Navigate through options
152
+ - `Enter/Space` - Select focused option
153
+ - `Escape` - Close dropdown
154
+ - `Tab` - Move to next field and close dropdown
155
+ - `Home/End` - Jump to first/last option
156
+
157
+ ### Auto-Select on Blur
158
+ - In single-select mode, automatically selects the best matching option when input loses focus
159
+ - Only triggers if there's a search term and a good match
160
+ - Helps with quick data entry
161
+
162
+ ### Accessibility
163
+ - Full ARIA support with proper roles and attributes
164
+ - Screen reader announcements for option counts and selections
165
+ - Keyboard-only navigation support
166
+ - Focus management
167
+
168
+ ### Performance
169
+ - Debounced search input (configurable delay)
170
+ - Efficient RxJS-based state management
171
+ - Virtual scrolling for large option lists
172
+ - Options are only filtered when dropdown is open
@@ -6,13 +6,13 @@ import "./tailwind.mixin-CbvBtwqu.js";
6
6
  import { property as c, state as m, query as E, queryAssignedElements as j, customElement as L } from "lit/decorators.js";
7
7
  import { html as g } from "lit";
8
8
  import { createRef as M, ref as q } from "lit/directives/ref.js";
9
- import { tap as h, takeUntil as d, distinctUntilChanged as C, debounceTime as I, withLatestFrom as b, take as $, filter as f, switchMap as R } from "rxjs/operators";
10
- import { s as v } from "./search-6Hr7K1gh.js";
9
+ import { tap as h, takeUntil as d, distinctUntilChanged as C, debounceTime as I, withLatestFrom as b, take as $, filter as v, switchMap as D } from "rxjs/operators";
10
+ import { s as f } from "./search-6Hr7K1gh.js";
11
11
  var P = Object.defineProperty, B = Object.getOwnPropertyDescriptor, a = (t, e, n, i) => {
12
12
  for (var s, o = i > 1 ? void 0 : i ? B(e, n) : e, u = t.length - 1; u >= 0; u--) (s = t[u]) && (o = (i ? s(e, n, o) : s(o)) || o);
13
13
  return i && o && P(e, n, o), o;
14
14
  };
15
- let l = class extends T(":host{display:block;border:unset!important;line-height:unset!important;background:unset!important;padding:unset!important;font-size:unset!important;box-shadow:unset!important}:host:focus{box-shadow:unset!important}") {
15
+ let l = class extends T(":host{display:block;border:unset!important;line-height:unset!important;background:unset!important;padding:unset!important;font-size:unset!important;box-shadow:unset!important}:host:focus{box-shadow:unset!important}@keyframes onAutoFillStart{}sch-input::part(input):-webkit-autofill,sch-input input:-webkit-autofill{animation-name:onAutoFillStart;animation-duration:1ms}") {
16
16
  constructor() {
17
17
  super(...arguments), this.required = !1, this.placeholder = "", this.label = "", this.name = "", this.maxHeight = "300px", this.multi = !1, this.description = "", this.size = "md", this.autocomplete = "on", this.debounceMs = 200, this.similarityThreshold = 0.3, this._open = !1, this._inputValue = "", this._visibleOptionsCount = 0, this._hasResults = !0, this._inputElementRef = M(), this._selectedValue$ = new _(""), this._selectedValues$ = new _([]), this._inputValue$ = new _(""), this._open$ = new _(!1), this._options$ = new _([]), this._optionSelect$ = new V(), this._documentClick$ = new V();
18
18
  }
@@ -34,7 +34,9 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
34
34
  _setupAutocompleteLogic() {
35
35
  this._options$.pipe(h((t) => {
36
36
  t.forEach((e, n) => {
37
- e.setAttribute("role", "option"), e.tabIndex = -1, e.id || (e.id = `${this.id}-option-${n}`), e.hasAttribute("data-event-bound") || (w(e, "click").pipe(h((i) => i.stopPropagation()), d(this.disconnecting)).subscribe(() => this._optionSelect$.next(e)), e.setAttribute("data-event-bound", "true"));
37
+ e.setAttribute("role", "option"), e.tabIndex = -1, e.id || (e.id = `${this.id}-option-${n}`), e.hasAttribute("data-event-bound") || (w(e, "pointerdown").pipe(h((i) => {
38
+ i.preventDefault(), i.stopPropagation();
39
+ }), d(this.disconnecting)).subscribe(() => this._optionSelect$.next(e)), e.setAttribute("data-event-bound", "true"));
38
40
  });
39
41
  }), d(this.disconnecting)).subscribe(), k([this._selectedValue$, this._selectedValues$, this._options$]).pipe(h(([t, e, n]) => {
40
42
  n.forEach((i) => {
@@ -45,8 +47,8 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
45
47
  const i = t.trim();
46
48
  if (i) {
47
49
  const s = e.map((u) => {
48
- const p = u.label || u.textContent || "", r = u.value, y = v(i, p), D = v(i, r);
49
- return { option: u, score: Math.max(1.1 * y, D) };
50
+ const p = u.label || u.textContent || "", r = u.value, y = f(i, p), R = f(i, r);
51
+ return { option: u, score: Math.max(1.1 * y, R) };
50
52
  });
51
53
  s.sort((u, p) => p.score - u.score);
52
54
  let o = 0;
@@ -65,7 +67,7 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
65
67
  const o = this._getSelectedLabels();
66
68
  this._announceToScreenReader(o.length > 0 ? `Selected: ${o.join(", ")}` : "No options selected");
67
69
  } else this._selectedValue$.next(t.value), this._open$.next(!1), this._open = !1, this._inputValue = t.label || t.textContent || "", this._inputValue$.next(this._inputValue), x(100).pipe(h(() => this._inputElementRef.value?.blur()), $(1)).subscribe(), this._announceToScreenReader(`Selected: ${t.label || t.textContent}`);
68
- }), h(() => this._fireChangeEvent()), d(this.disconnecting)).subscribe(), k([this._open$, this._selectedValue$, this._selectedValues$, this._options$]).pipe(f(() => !this._open$.value), h(([, t, e, n]) => {
70
+ }), h(() => this._fireChangeEvent()), d(this.disconnecting)).subscribe(), k([this._open$, this._selectedValue$, this._selectedValues$, this._options$]).pipe(v(() => !this._open$.value), h(([, t, e, n]) => {
69
71
  if (this.multi) {
70
72
  const i = n.filter((s) => e.includes(s.value)).map((s) => s.label || s.textContent || "");
71
73
  this._inputValue = i.join(", ");
@@ -77,9 +79,9 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
77
79
  }), d(this.disconnecting)).subscribe(), this._open$.pipe(h((t) => this._open = t), d(this.disconnecting)).subscribe();
78
80
  }
79
81
  _setupDocumentClickHandler() {
80
- this._documentClick$.pipe(f((t) => !t.composedPath().includes(this)), f((t) => !this._options.some((e) => t.composedPath().includes(e))), f(() => this._open), h(() => {
82
+ this._documentClick$.pipe(v((t) => !t.composedPath().includes(this)), v((t) => !this._options.some((e) => t.composedPath().includes(e))), v(() => this._open), h(() => {
81
83
  this._open$.next(!1), this._updateInputDisplay();
82
- }), d(this.disconnecting)).subscribe(), this._open$.pipe(C(), R((t) => t ? x(10).pipe(h(() => document.addEventListener("click", (e) => this._documentClick$.next(e))), R(() => A)) : S(null).pipe(h(() => document.removeEventListener("click", (e) => this._documentClick$.next(e))))), d(this.disconnecting)).subscribe();
84
+ }), d(this.disconnecting)).subscribe(), this._open$.pipe(C(), D((t) => t ? x(10).pipe(h(() => document.addEventListener("click", (e) => this._documentClick$.next(e))), D(() => A)) : S(null).pipe(h(() => document.removeEventListener("click", (e) => this._documentClick$.next(e))))), d(this.disconnecting)).subscribe();
83
85
  }
84
86
  _updateInputDisplay() {
85
87
  S(null).pipe(b(this._selectedValue$, this._selectedValues$, this._options$, this._open$), h(([, t, e, n, i]) => {
@@ -186,23 +188,6 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
186
188
  `}
187
189
  </ul>
188
190
  </div>
189
-
190
- <style>
191
- :host {
192
- display: block;
193
- }
194
-
195
- @keyframes onAutoFillStart {
196
- from {/**/}
197
- to {/**/}
198
- }
199
-
200
- sch-input::part(input):-webkit-autofill,
201
- sch-input input:-webkit-autofill {
202
- animation-name: onAutoFillStart;
203
- animation-duration: 1ms;
204
- }
205
- </style>
206
191
  `;
207
192
  }
208
193
  _handleAutoSelectOnBlur() {
@@ -211,7 +196,7 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
211
196
  let e = null, n = 0;
212
197
  this._options.forEach((i) => {
213
198
  if (i.hidden) return;
214
- const s = i.label || i.textContent || "", o = i.value, u = v(t, s), p = v(t, o), r = Math.max(1.1 * u, p);
199
+ const s = i.label || i.textContent || "", o = i.value, u = f(t, s), p = f(t, o), r = Math.max(1.1 * u, p);
215
200
  r > n && r >= this.similarityThreshold && (n = r, e = i);
216
201
  }), e && (this._optionSelect$.next(e), this._open$.next(!1), this._open = !1);
217
202
  }
@@ -253,4 +238,4 @@ let l = class extends T(":host{display:block;border:unset!important;line-height:
253
238
  }
254
239
  };
255
240
  a([c({ type: Boolean })], l.prototype, "required", 2), a([c({ type: String })], l.prototype, "placeholder", 2), a([c({ type: String, reflect: !0 })], l.prototype, "label", 2), a([c({ type: String })], l.prototype, "name", 2), a([c({ type: String })], l.prototype, "maxHeight", 2), a([c({ type: Boolean })], l.prototype, "multi", 2), a([c({ type: String })], l.prototype, "description", 2), a([c({ type: String, reflect: !0 })], l.prototype, "size", 2), a([c({ type: String })], l.prototype, "autocomplete", 2), a([c({ type: Number })], l.prototype, "debounceMs", 2), a([c({ type: Number })], l.prototype, "similarityThreshold", 2), a([c({ type: Array })], l.prototype, "values", 1), a([c({ type: String, reflect: !0 })], l.prototype, "value", 1), a([m()], l.prototype, "_open", 2), a([m()], l.prototype, "_inputValue", 2), a([m()], l.prototype, "_visibleOptionsCount", 2), a([m()], l.prototype, "_hasResults", 2), a([E("#options")], l.prototype, "_listbox", 2), a([E("sch-input")], l.prototype, "_input", 2), a([j({ flatten: !0 })], l.prototype, "_options", 2), l = a([L("schmancy-autocomplete")], l);
256
- //# sourceMappingURL=autocomplete-CF67hOX7.js.map
241
+ //# sourceMappingURL=autocomplete-B7JYyVgi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete-B7JYyVgi.js","sources":["../src/autocomplete/autocomplete.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { InputSize, SchmancyInput } from '@schmancy/input'\nimport SchmancyOption from '@schmancy/option/option'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport {\n BehaviorSubject,\n combineLatest,\n EMPTY,\n fromEvent,\n of,\n Subject,\n timer\n} from 'rxjs'\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n switchMap,\n take,\n takeUntil,\n tap,\n withLatestFrom\n} from 'rxjs/operators'\nimport style from './autocomplete.scss?inline'\n\n// Import the similarity function (or include it inline)\nimport { similarity } from '../utils/search'\n\nexport type SchmancyAutocompleteChangeEvent = CustomEvent<{\n value: string | string[]\n values?: string[]\n}>\n\ninterface FilteredOption {\n option: SchmancyOption\n score: number\n}\n\n@customElement('schmancy-autocomplete')\nexport default class SchmancyAutocomplete extends $LitElement(style) {\n // Public API properties\n @property({ type: Boolean }) required = false\n @property({ type: String }) placeholder = ''\n @property({ type: String, reflect: true }) label = ''\n @property({ type: String }) name = ''\n @property({ type: String }) maxHeight = '300px'\n @property({ type: Boolean }) multi = false\n @property({ type: String }) description = ''\n @property({ type: String, reflect: true }) size: InputSize = 'md'\n @property({ type: String }) autocomplete = 'on'\n @property({ type: Number }) debounceMs = 200\n @property({ type: Number }) similarityThreshold = 0.3 // Minimum similarity score to show option\n\n // Values property for multi-select mode\n @property({ type: Array })\n get values() {\n return [...this._selectedValues$.value]\n }\n set values(vals: string[]) {\n this._selectedValues$.next(Array.isArray(vals) ? [...vals] : [])\n }\n\n // Value property\n @property({ type: String, reflect: true })\n get value() {\n return this.multi \n ? this._selectedValues$.value.join(',')\n : this._selectedValue$.value\n }\n set value(val: string) {\n if (this.multi) {\n this._selectedValues$.next(\n val ? val.split(',').map(v => v.trim()).filter(Boolean) : []\n )\n } else {\n this._selectedValue$.next(val)\n }\n }\n\n // State\n @state() private _open = false\n @state() private _inputValue = ''\n @state() private _visibleOptionsCount = 0\n @state() private _hasResults = true\n\n // DOM references\n @query('#options') _listbox!: HTMLUListElement\n @query('sch-input') _input!: SchmancyInput\n @queryAssignedElements({ flatten: true }) private _options!: SchmancyOption[]\n private _inputElementRef = createRef<HTMLInputElement>()\n\n // RxJS Subjects\n private _selectedValue$ = new BehaviorSubject<string>('')\n private _selectedValues$ = new BehaviorSubject<string[]>([])\n private _inputValue$ = new BehaviorSubject<string>('')\n private _open$ = new BehaviorSubject<boolean>(false)\n private _options$ = new BehaviorSubject<SchmancyOption[]>([])\n private _optionSelect$ = new Subject<SchmancyOption>()\n private _documentClick$ = new Subject<MouseEvent>()\n\n connectedCallback() {\n super.connectedCallback()\n \n if (!this.id) {\n this.id = `sch-autocomplete-${Math.random().toString(36).slice(2, 9)}`\n }\n\n this._setupAutocompleteLogic()\n this._setupDocumentClickHandler()\n // Complex autofill detection disabled - using simple auto-select on blur instead\n // this._setupAutofillDetection()\n }\n\n private _setupAutocompleteLogic() {\n // Options management pipeline\n this._options$.pipe(\n tap(options => {\n options.forEach((option, index) => {\n option.setAttribute('role', 'option')\n option.tabIndex = -1\n if (!option.id) {\n option.id = `${this.id}-option-${index}`\n }\n if (!option.hasAttribute('data-event-bound')) {\n fromEvent(option, 'pointerdown').pipe(\n tap(e => {\n e.preventDefault() // Prevent blur from firing\n e.stopPropagation()\n }),\n takeUntil(this.disconnecting)\n ).subscribe(() => this._optionSelect$.next(option))\n option.setAttribute('data-event-bound', 'true')\n }\n })\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Selection sync pipeline\n combineLatest([\n this._selectedValue$,\n this._selectedValues$,\n this._options$\n ]).pipe(\n tap(([selectedValue, selectedValues, options]) => {\n options.forEach(option => {\n option.selected = this.multi \n ? selectedValues.includes(option.value)\n : option.value === selectedValue\n option.setAttribute('aria-selected', String(option.selected))\n })\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Enhanced fuzzy filtering pipeline\n this._inputValue$.pipe(\n distinctUntilChanged(),\n debounceTime(this.debounceMs),\n withLatestFrom(this._options$, this._open$),\n tap(([searchTerm, options, isOpen]) => {\n if (!isOpen) return\n\n const term = searchTerm.trim()\n \n if (!term) {\n // Show all options if no search term\n options.forEach(option => {\n option.hidden = false\n option.style.order = '0' // Reset order\n })\n this._visibleOptionsCount = options.length\n this._hasResults = true\n } else {\n // Calculate similarity scores for all options\n const scoredOptions: FilteredOption[] = options.map(option => {\n // Get text to search in (prioritize label, then textContent, then value)\n const optionLabel = option.label || option.textContent || ''\n const optionValue = option.value\n \n // Calculate similarity scores for both label and value\n const labelScore = similarity(term, optionLabel)\n const valueScore = similarity(term, optionValue)\n \n // Use the higher score (prioritizing label matches)\n const score = Math.max(labelScore * 1.1, valueScore) // Slight boost for label matches\n \n return { option, score }\n })\n \n // Sort by score (highest first)\n scoredOptions.sort((a, b) => b.score - a.score)\n \n // Apply visibility and ordering\n let visibleCount = 0\n scoredOptions.forEach((item, index) => {\n const { option, score } = item\n \n // Hide options below threshold\n if (score < this.similarityThreshold) {\n option.hidden = true\n } else {\n option.hidden = false\n visibleCount++\n // Use CSS order to sort visible options by relevance\n option.style.order = String(index)\n }\n })\n \n this._visibleOptionsCount = visibleCount\n this._hasResults = visibleCount > 0\n }\n \n this._announceToScreenReader(\n this._visibleOptionsCount > 0 \n ? `${this._visibleOptionsCount} option${this._visibleOptionsCount === 1 ? '' : 's'} available.`\n : 'No results found.'\n )\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Option selection pipeline\n this._optionSelect$.pipe(\n withLatestFrom(this._selectedValue$, this._selectedValues$),\n tap(([option, _, currentValues]) => {\n if (this.multi) {\n const index = currentValues.indexOf(option.value)\n const newValues = index > -1\n ? [...currentValues.slice(0, index), ...currentValues.slice(index + 1)]\n : [...currentValues, option.value]\n this._selectedValues$.next(newValues)\n \n this._inputValue$.next('')\n this._inputValue = ''\n \n const labels = this._getSelectedLabels()\n this._announceToScreenReader(\n labels.length > 0 \n ? `Selected: ${labels.join(', ')}`\n : 'No options selected'\n )\n } else {\n this._selectedValue$.next(option.value)\n this._open$.next(false)\n this._open = false\n \n this._inputValue = option.label || option.textContent || ''\n this._inputValue$.next(this._inputValue)\n \n timer(100).pipe(\n tap(() => this._inputElementRef.value?.blur()),\n take(1)\n ).subscribe()\n \n this._announceToScreenReader(`Selected: ${option.label || option.textContent}`)\n }\n }),\n tap(() => this._fireChangeEvent()),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Display update pipeline\n combineLatest([\n this._open$,\n this._selectedValue$,\n this._selectedValues$,\n this._options$\n ]).pipe(\n filter(() => !this._open$.value),\n tap(([, selectedValue, selectedValues, options]) => {\n if (this.multi) {\n const labels = options\n .filter(opt => selectedValues.includes(opt.value))\n .map(opt => opt.label || opt.textContent || '')\n this._inputValue = labels.join(', ')\n } else {\n const option = options.find(opt => opt.value === selectedValue)\n this._inputValue = option ? option.label || option.textContent || '' : ''\n }\n this._inputValue$.next(this._inputValue)\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Open state sync\n this._open$.pipe(\n tap(open => this._open = open),\n takeUntil(this.disconnecting)\n ).subscribe()\n }\n\n private _setupDocumentClickHandler() {\n this._documentClick$.pipe(\n filter(e => !e.composedPath().includes(this)),\n filter(e => !this._options.some(opt => e.composedPath().includes(opt))),\n filter(() => this._open),\n tap(() => {\n this._open$.next(false)\n this._updateInputDisplay()\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n this._open$.pipe(\n distinctUntilChanged(),\n switchMap(open => \n open \n ? timer(10).pipe(\n tap(() => document.addEventListener('click', e => this._documentClick$.next(e))),\n switchMap(() => EMPTY)\n )\n : of(null).pipe(\n tap(() => document.removeEventListener('click', e => this._documentClick$.next(e)))\n )\n ),\n takeUntil(this.disconnecting)\n ).subscribe()\n }\n\n\n private _updateInputDisplay() {\n of(null).pipe(\n withLatestFrom(\n this._selectedValue$,\n this._selectedValues$,\n this._options$,\n this._open$\n ),\n tap(([, selectedValue, selectedValues, options, isOpen]) => {\n if (!this._inputElementRef.value) return\n\n if (!isOpen || !this.multi) {\n if (this.multi) {\n const labels = options\n .filter(opt => selectedValues.includes(opt.value))\n .map(opt => opt.label || opt.textContent || '')\n this._inputValue = labels.join(', ')\n } else {\n const option = options.find(opt => opt.value === selectedValue)\n this._inputValue = option ? option.label || option.textContent || '' : ''\n }\n this._inputValue$.next(this._inputValue)\n this._inputElementRef.value.value = this._inputValue\n }\n }),\n take(1)\n ).subscribe()\n }\n\n private _getSelectedLabels(): string[] {\n return this._options\n .filter(option => \n this.multi \n ? this._selectedValues$.value.includes(option.value)\n : option.value === this._selectedValue$.value\n )\n .map(option => option.label || option.textContent || '')\n }\n\n private _announceToScreenReader(message: string) {\n const liveRegion = this.shadowRoot?.querySelector('#live-status')\n if (liveRegion) {\n liveRegion.textContent = message\n }\n }\n\n private _fireChangeEvent() {\n const detail: SchmancyAutocompleteChangeEvent['detail'] = {\n value: this.value,\n }\n\n if (this.multi) {\n detail.values = [...this._selectedValues$.value]\n }\n\n this.dispatchEvent(\n new CustomEvent<SchmancyAutocompleteChangeEvent['detail']>('change', {\n detail,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n public checkValidity(): boolean {\n if (!this.required) return true\n return this.multi \n ? this._selectedValues$.value.length > 0 \n : Boolean(this._selectedValue$.value)\n }\n\n public reportValidity(): boolean {\n if (this._inputElementRef.value) {\n return this._inputElementRef.value.reportValidity()\n }\n return this.checkValidity()\n }\n\n firstUpdated() {\n // Auto-selection now happens on blur, no need for autofill detection\n }\n\n render() {\n const descriptionId = `${this.id}-desc`\n\n return html`\n <div class=\"relative\">\n <!-- Screen reader live region -->\n <div id=\"live-status\" role=\"status\" aria-live=\"polite\" class=\"sr-only\"></div>\n\n <!-- Description -->\n ${this.description ? html`<div id=\"${descriptionId}\" class=\"sr-only\">${this.description}</div>` : ''}\n\n <!-- Input -->\n <slot name=\"trigger\">\n <schmancy-input\n .size=${this.size}\n ${ref(this._inputElementRef)}\n id=\"autocomplete-input\"\n class=\"w-full\"\n .name=${this.name || this.label?.toLowerCase().replace(/\\s+/g, '-')}\n .label=${this.label}\n .placeholder=${this.placeholder}\n .required=${this.required}\n .value=${this._inputValue}\n type=\"text\"\n autocomplete=${this.autocomplete}\n clickable\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-controls=\"options\"\n aria-expanded=${this._open}\n aria-describedby=${this.description ? descriptionId : undefined}\n @input=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._inputValue = value\n this._inputValue$.next(value)\n }}\n @focus=${(e: FocusEvent) => {\n e.stopPropagation()\n \n const hasSelection = this.multi \n ? this._selectedValues$.value.length > 0\n : !!this._selectedValue$.value\n \n if (this.multi && !hasSelection) {\n this._inputValue = ''\n this._inputValue$.next('')\n if (this._inputElementRef.value) {\n this._inputElementRef.value.value = ''\n }\n }\n \n this._open$.next(true)\n }}\n @click=${(e: MouseEvent) => {\n e.stopPropagation()\n this._open$.next(true)\n }}\n @keydown=${(e: KeyboardEvent) => {\n this._handleKeyDown(e)\n }}\n @blur=${() => {\n this._handleAutoSelectOnBlur()\n }}\n >\n </schmancy-input>\n </slot>\n\n <!-- Options dropdown -->\n <ul\n id=\"options\"\n class=${classMap({\n 'absolute': true,\n 'z-[1000]': true,\n 'mt-1': true,\n 'w-full': true,\n 'rounded-md': true,\n 'shadow-md': true,\n 'overflow-auto': true,\n 'min-w-full': true,\n 'bg-surface-low': true,\n 'flex': true,\n 'flex-col': true, // Enable flexbox for ordering\n })}\n role=\"listbox\"\n aria-multiselectable=${this.multi ? 'true' : 'false'}\n aria-label=${`${this.label || 'Options'} dropdown`}\n ?hidden=${!this._open}\n style=\"max-height: ${this.maxHeight}; display: ${this._open ? 'flex' : 'none'};\"\n @slotchange=${() => {\n this._options$.next(this._options)\n }}\n >\n <slot></slot>\n ${!this._hasResults ? html`\n <li class=\"px-3 py-2 text-sm text-muted\">No results found</li>\n ` : ''}\n </ul>\n </div>\n `\n }\n\n private _handleAutoSelectOnBlur() {\n // Only auto-select in single-select mode and when dropdown is open with a search term\n if (this.multi || !this._open || !this._inputValue.trim()) {\n return\n }\n \n const searchTerm = this._inputValue.trim()\n \n // Find the best matching option using the same similarity logic as filtering\n let bestMatch: SchmancyOption | null = null\n let bestScore = 0\n \n this._options.forEach(option => {\n // Skip hidden options\n if (option.hidden) return\n \n // Get text to search in (prioritize label, then textContent, then value)\n const optionLabel = option.label || option.textContent || ''\n const optionValue = option.value\n \n // Calculate similarity scores for both label and value\n const labelScore = similarity(searchTerm, optionLabel)\n const valueScore = similarity(searchTerm, optionValue)\n \n // Use the higher score (prioritizing label matches)\n const score = Math.max(labelScore * 1.1, valueScore) // Slight boost for label matches\n \n // Keep track of best match that meets threshold\n if (score > bestScore && score >= this.similarityThreshold) {\n bestScore = score\n bestMatch = option\n }\n })\n \n // Auto-select the best match if found\n if (bestMatch) {\n // Select the option using the existing pipeline\n this._optionSelect$.next(bestMatch)\n \n // Close the dropdown\n this._open$.next(false)\n this._open = false\n \n console.log('Auto-selected on blur:', bestMatch.value, 'with score:', bestScore)\n }\n }\n\n private _handleKeyDown(_e: KeyboardEvent) {\n fromEvent<KeyboardEvent>(document, 'keydown').pipe(\n take(1),\n withLatestFrom(this._open$, this._options$),\n tap(([event, isOpen, options]) => {\n if (!isOpen && (event.key === 'ArrowDown' || event.key === 'Enter')) {\n event.preventDefault()\n this._open$.next(true)\n \n timer(10).pipe(\n tap(() => {\n const firstVisible = options.find(opt => !opt.hidden)\n firstVisible?.focus()\n }),\n take(1)\n ).subscribe()\n return\n }\n\n if (!isOpen) return\n\n const visibleOptions = options.filter(opt => !opt.hidden)\n .sort((a, b) => parseInt(a.style.order || '0') - parseInt(b.style.order || '0'))\n \n const focusedOption = visibleOptions.find(opt => opt === document.activeElement)\n const currentIndex = focusedOption ? visibleOptions.indexOf(focusedOption) : -1\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n this._open$.next(false)\n this._updateInputDisplay()\n this._inputElementRef.value?.focus()\n break\n\n case 'Tab':\n this._open$.next(false)\n this._updateInputDisplay()\n break\n\n case 'ArrowDown':\n event.preventDefault()\n const nextIndex = currentIndex < visibleOptions.length - 1 ? currentIndex + 1 : 0\n visibleOptions[nextIndex]?.focus()\n break\n\n case 'ArrowUp':\n event.preventDefault()\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : visibleOptions.length - 1\n visibleOptions[prevIndex]?.focus()\n break\n\n case 'Home':\n event.preventDefault()\n visibleOptions[0]?.focus()\n break\n\n case 'End':\n event.preventDefault()\n visibleOptions[visibleOptions.length - 1]?.focus()\n break\n\n case 'Enter':\n case ' ':\n if (focusedOption) {\n event.preventDefault()\n this._optionSelect$.next(focusedOption)\n }\n break\n }\n })\n ).subscribe()\n }\n}\n\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-autocomplete': SchmancyAutocomplete\n }\n}"],"names":["SchmancyAutocomplete","$LitElement","constructor","super","arguments","this","required","placeholder","label","name","maxHeight","multi","description","size","autocomplete","debounceMs","similarityThreshold","_open","_inputValue","_visibleOptionsCount","_hasResults","_inputElementRef","createRef","_selectedValue$","BehaviorSubject","_selectedValues$","_inputValue$","_open$","_options$","_optionSelect$","Subject","_documentClick$","values","value","vals","next","Array","isArray","join","val","split","map","v","trim","filter","Boolean","connectedCallback","id","Math","random","toString","slice","_setupAutocompleteLogic","_setupDocumentClickHandler","pipe","tap","options","forEach","option","index","setAttribute","tabIndex","hasAttribute","fromEvent","e","preventDefault","stopPropagation","takeUntil","disconnecting","subscribe","combineLatest","selectedValue","selectedValues","selected","includes","String","distinctUntilChanged","debounceTime","withLatestFrom","searchTerm","isOpen","term","scoredOptions","optionLabel","textContent","optionValue","labelScore","similarity","valueScore","score","max","sort","a","b","visibleCount","item","hidden","style","order","length","_announceToScreenReader","_","currentValues","indexOf","newValues","labels","_getSelectedLabels","timer","blur","take","_fireChangeEvent","opt","find","open","composedPath","_options","some","_updateInputDisplay","switchMap","document","addEventListener","EMPTY","of","removeEventListener","message","liveRegion","shadowRoot","querySelector","detail","dispatchEvent","CustomEvent","bubbles","composed","checkValidity","reportValidity","firstUpdated","render","descriptionId","html","ref","toLowerCase","replace","target","hasSelection","_handleKeyDown","_handleAutoSelectOnBlur","classMap","absolute","flex","bestMatch","bestScore","_e","event","key","firstVisible","focus","visibleOptions","parseInt","focusedOption","activeElement","currentIndex","nextIndex","prevIndex","__decorateClass","property","type","prototype","reflect","Number","state","query","queryAssignedElements","flatten","customElement"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAqBA,IAArB,cAAkDC;EAAlD,cAAAC;AAAAC,UAAAA,GAAAC,SAAAA,GAEiCC,KAAAC,WAAAA,IACDD,KAAAE,cAAc,IACCF,KAAAG,QAAQ,IACvBH,KAAAI,OAAO,IACPJ,KAAAK,YAAY,SACXL,KAAAM,QAAAA,IACDN,KAAAO,cAAc,IACCP,KAAAQ,OAAkB,MACjCR,KAAAS,eAAe,MACfT,KAAAU,aAAa,KACbV,KAAAW,sBAAsB,KA6BzCX,KAAQY,QAAAA,IACRZ,KAAQa,cAAc,IACtBb,KAAQc,uBAAuB,GAC/Bd,KAAQe,cAAAA,IAMjBf,KAAQgB,mBAAmBC,EAAAA,GAG3BjB,KAAQkB,kBAAkB,IAAIC,EAAwB,EAAA,GACtDnB,KAAQoB,mBAAmB,IAAID,EAA0B,CAAA,CAAA,GACzDnB,KAAQqB,eAAe,IAAIF,EAAwB,EAAA,GACnDnB,KAAQsB,SAAS,IAAIH,EAAAA,EAAyB,GAC9CnB,KAAQuB,YAAY,IAAIJ,EAAkC,CAAA,CAAA,GAC1DnB,KAAQwB,iBAAiB,IAAIC,KAC7BzB,KAAQ0B,kBAAkB,IAAID;AAAAA,EAAoB;AAAA,EA3ClD,IAAA,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H,EAAA,CADHC,EAAS,EAAEC,MAAMjI,MAAAA,CAAAA,CAAAA,GAfDpC,EAgBbsK,WAAA,UAAA,CAAA,GASAH,EAAA,CADHC,EAAS,EAAEC,MAAM1F,QAAQ4F,SAAAA,GAAS,CAAA,CAAA,GAxBlBvK,EAyBbsK,WAAA,SAAA,CAAA,GAgBaH,EAAA,CAAhBM,EAAAA,CAAAA,GAzCgBzK,EAyCAsK,WAAA,SAAA,CAAA,GACAH,EAAA,CAAhBM,EAAAA,CAAAA,GA1CgBzK,EA0CAsK,WAAA,eAAA,CAAA,GACAH,EAAA,CAAhBM,EAAAA,CAAAA,GA3CgBzK,EA2CAsK,WAAA,wBAAA,CAAA,GACAH,EAAA,CAAhBM,EAAAA,CAAAA,GA5CgBzK,EA4CAsK,WAAA,eAAA,CAAA,GAGEH,EAAA,CAAlBO,EAAM,cA/CU1K,EA+CEsK,WAAA,YAAA,CAAA,GACCH,EAAA,CAAnBO,EAAM,WAAA,CAAA,GAhDU1K,EAgDGsK,WAAA,UAAA,CAAA,GAC8BH,EAAA,CAAjDQ,EAAsB,EAAEC,SAAAA,GAAS,CAAA,CAAA,GAjDjB5K,EAiDiCsK,WAAA,YAAA,CAAA,GAjDjCtK,IAArBmK,EAAA,CADCU,EAAc,uBAAA,CAAA,GACM7K,CAAAA;"}
@@ -0,0 +1,57 @@
1
+ "use strict";const h=require("rxjs"),y=require("lit/directives/class-map.js");require("lit/directives/style-map.js");const f=require("./litElement.mixin-BEbYQVKW.cjs");require("./tailwind.mixin-NrMHmraa.cjs");const u=require("lit/decorators.js"),b=require("lit"),$=require("lit/directives/ref.js"),i=require("rxjs/operators"),_=require("./search-DWW8IoOp.cjs");var x=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(e,t,o,s)=>{for(var n,l=s>1?void 0:s?g(t,o):t,p=e.length-1;p>=0;p--)(n=e[p])&&(l=(s?n(t,o,l):n(l))||l);return s&&l&&x(t,o,l),l};let a=class extends f.$LitElement(":host{display:block;border:unset!important;line-height:unset!important;background:unset!important;padding:unset!important;font-size:unset!important;box-shadow:unset!important}:host:focus{box-shadow:unset!important}@keyframes onAutoFillStart{}sch-input::part(input):-webkit-autofill,sch-input input:-webkit-autofill{animation-name:onAutoFillStart;animation-duration:1ms}"){constructor(){super(...arguments),this.required=!1,this.placeholder="",this.label="",this.name="",this.maxHeight="300px",this.multi=!1,this.description="",this.size="md",this.autocomplete="on",this.debounceMs=200,this.similarityThreshold=.3,this._open=!1,this._inputValue="",this._visibleOptionsCount=0,this._hasResults=!0,this._inputElementRef=$.createRef(),this._selectedValue$=new h.BehaviorSubject(""),this._selectedValues$=new h.BehaviorSubject([]),this._inputValue$=new h.BehaviorSubject(""),this._open$=new h.BehaviorSubject(!1),this._options$=new h.BehaviorSubject([]),this._optionSelect$=new h.Subject,this._documentClick$=new h.Subject}get values(){return[...this._selectedValues$.value]}set values(e){this._selectedValues$.next(Array.isArray(e)?[...e]:[])}get value(){return this.multi?this._selectedValues$.value.join(","):this._selectedValue$.value}set value(e){this.multi?this._selectedValues$.next(e?e.split(",").map(t=>t.trim()).filter(Boolean):[]):this._selectedValue$.next(e)}connectedCallback(){super.connectedCallback(),this.id||(this.id=`sch-autocomplete-${Math.random().toString(36).slice(2,9)}`),this._setupAutocompleteLogic(),this._setupDocumentClickHandler()}_setupAutocompleteLogic(){this._options$.pipe(i.tap(e=>{e.forEach((t,o)=>{t.setAttribute("role","option"),t.tabIndex=-1,t.id||(t.id=`${this.id}-option-${o}`),t.hasAttribute("data-event-bound")||(h.fromEvent(t,"pointerdown").pipe(i.tap(s=>{s.preventDefault(),s.stopPropagation()}),i.takeUntil(this.disconnecting)).subscribe(()=>this._optionSelect$.next(t)),t.setAttribute("data-event-bound","true"))})}),i.takeUntil(this.disconnecting)).subscribe(),h.combineLatest([this._selectedValue$,this._selectedValues$,this._options$]).pipe(i.tap(([e,t,o])=>{o.forEach(s=>{s.selected=this.multi?t.includes(s.value):s.value===e,s.setAttribute("aria-selected",String(s.selected))})}),i.takeUntil(this.disconnecting)).subscribe(),this._inputValue$.pipe(i.distinctUntilChanged(),i.debounceTime(this.debounceMs),i.withLatestFrom(this._options$,this._open$),i.tap(([e,t,o])=>{if(!o)return;const s=e.trim();if(s){const n=t.map(p=>{const c=p.label||p.textContent||"",d=p.value,m=_.similarity(s,c),v=_.similarity(s,d);return{option:p,score:Math.max(1.1*m,v)}});n.sort((p,c)=>c.score-p.score);let l=0;n.forEach((p,c)=>{const{option:d,score:m}=p;m<this.similarityThreshold?d.hidden=!0:(d.hidden=!1,l++,d.style.order=String(c))}),this._visibleOptionsCount=l,this._hasResults=l>0}else t.forEach(n=>{n.hidden=!1,n.style.order="0"}),this._visibleOptionsCount=t.length,this._hasResults=!0;this._announceToScreenReader(this._visibleOptionsCount>0?`${this._visibleOptionsCount} option${this._visibleOptionsCount===1?"":"s"} available.`:"No results found.")}),i.takeUntil(this.disconnecting)).subscribe(),this._optionSelect$.pipe(i.withLatestFrom(this._selectedValue$,this._selectedValues$),i.tap(([e,t,o])=>{if(this.multi){const s=o.indexOf(e.value),n=s>-1?[...o.slice(0,s),...o.slice(s+1)]:[...o,e.value];this._selectedValues$.next(n),this._inputValue$.next(""),this._inputValue="";const l=this._getSelectedLabels();this._announceToScreenReader(l.length>0?`Selected: ${l.join(", ")}`:"No options selected")}else this._selectedValue$.next(e.value),this._open$.next(!1),this._open=!1,this._inputValue=e.label||e.textContent||"",this._inputValue$.next(this._inputValue),h.timer(100).pipe(i.tap(()=>this._inputElementRef.value?.blur()),i.take(1)).subscribe(),this._announceToScreenReader(`Selected: ${e.label||e.textContent}`)}),i.tap(()=>this._fireChangeEvent()),i.takeUntil(this.disconnecting)).subscribe(),h.combineLatest([this._open$,this._selectedValue$,this._selectedValues$,this._options$]).pipe(i.filter(()=>!this._open$.value),i.tap(([,e,t,o])=>{if(this.multi){const s=o.filter(n=>t.includes(n.value)).map(n=>n.label||n.textContent||"");this._inputValue=s.join(", ")}else{const s=o.find(n=>n.value===e);this._inputValue=s&&(s.label||s.textContent)||""}this._inputValue$.next(this._inputValue)}),i.takeUntil(this.disconnecting)).subscribe(),this._open$.pipe(i.tap(e=>this._open=e),i.takeUntil(this.disconnecting)).subscribe()}_setupDocumentClickHandler(){this._documentClick$.pipe(i.filter(e=>!e.composedPath().includes(this)),i.filter(e=>!this._options.some(t=>e.composedPath().includes(t))),i.filter(()=>this._open),i.tap(()=>{this._open$.next(!1),this._updateInputDisplay()}),i.takeUntil(this.disconnecting)).subscribe(),this._open$.pipe(i.distinctUntilChanged(),i.switchMap(e=>e?h.timer(10).pipe(i.tap(()=>document.addEventListener("click",t=>this._documentClick$.next(t))),i.switchMap(()=>h.EMPTY)):h.of(null).pipe(i.tap(()=>document.removeEventListener("click",t=>this._documentClick$.next(t))))),i.takeUntil(this.disconnecting)).subscribe()}_updateInputDisplay(){h.of(null).pipe(i.withLatestFrom(this._selectedValue$,this._selectedValues$,this._options$,this._open$),i.tap(([,e,t,o,s])=>{if(this._inputElementRef.value&&(!s||!this.multi)){if(this.multi){const n=o.filter(l=>t.includes(l.value)).map(l=>l.label||l.textContent||"");this._inputValue=n.join(", ")}else{const n=o.find(l=>l.value===e);this._inputValue=n&&(n.label||n.textContent)||""}this._inputValue$.next(this._inputValue),this._inputElementRef.value.value=this._inputValue}}),i.take(1)).subscribe()}_getSelectedLabels(){return this._options.filter(e=>this.multi?this._selectedValues$.value.includes(e.value):e.value===this._selectedValue$.value).map(e=>e.label||e.textContent||"")}_announceToScreenReader(e){const t=this.shadowRoot?.querySelector("#live-status");t&&(t.textContent=e)}_fireChangeEvent(){const e={value:this.value};this.multi&&(e.values=[...this._selectedValues$.value]),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))}checkValidity(){return!this.required||(this.multi?this._selectedValues$.value.length>0:!!this._selectedValue$.value)}reportValidity(){return this._inputElementRef.value?this._inputElementRef.value.reportValidity():this.checkValidity()}firstUpdated(){}render(){const e=`${this.id}-desc`;return b.html`
2
+ <div class="relative">
3
+ <!-- Screen reader live region -->
4
+ <div id="live-status" role="status" aria-live="polite" class="sr-only"></div>
5
+
6
+ <!-- Description -->
7
+ ${this.description?b.html`<div id="${e}" class="sr-only">${this.description}</div>`:""}
8
+
9
+ <!-- Input -->
10
+ <slot name="trigger">
11
+ <schmancy-input
12
+ .size=${this.size}
13
+ ${$.ref(this._inputElementRef)}
14
+ id="autocomplete-input"
15
+ class="w-full"
16
+ .name=${this.name||this.label?.toLowerCase().replace(/\s+/g,"-")}
17
+ .label=${this.label}
18
+ .placeholder=${this.placeholder}
19
+ .required=${this.required}
20
+ .value=${this._inputValue}
21
+ type="text"
22
+ autocomplete=${this.autocomplete}
23
+ clickable
24
+ role="combobox"
25
+ aria-autocomplete="list"
26
+ aria-haspopup="listbox"
27
+ aria-controls="options"
28
+ aria-expanded=${this._open}
29
+ aria-describedby=${this.description?e:void 0}
30
+ @input=${t=>{const o=t.target.value;this._inputValue=o,this._inputValue$.next(o)}}
31
+ @focus=${t=>{t.stopPropagation();const o=this.multi?this._selectedValues$.value.length>0:!!this._selectedValue$.value;this.multi&&!o&&(this._inputValue="",this._inputValue$.next(""),this._inputElementRef.value&&(this._inputElementRef.value.value="")),this._open$.next(!0)}}
32
+ @click=${t=>{t.stopPropagation(),this._open$.next(!0)}}
33
+ @keydown=${t=>{this._handleKeyDown(t)}}
34
+ @blur=${()=>{this._handleAutoSelectOnBlur()}}
35
+ >
36
+ </schmancy-input>
37
+ </slot>
38
+
39
+ <!-- Options dropdown -->
40
+ <ul
41
+ id="options"
42
+ class=${y.classMap({absolute:!0,"z-[1000]":!0,"mt-1":!0,"w-full":!0,"rounded-md":!0,"shadow-md":!0,"overflow-auto":!0,"min-w-full":!0,"bg-surface-low":!0,flex:!0,"flex-col":!0})}
43
+ role="listbox"
44
+ aria-multiselectable=${this.multi?"true":"false"}
45
+ aria-label=${`${this.label||"Options"} dropdown`}
46
+ ?hidden=${!this._open}
47
+ style="max-height: ${this.maxHeight}; display: ${this._open?"flex":"none"};"
48
+ @slotchange=${()=>{this._options$.next(this._options)}}
49
+ >
50
+ <slot></slot>
51
+ ${this._hasResults?"":b.html`
52
+ <li class="px-3 py-2 text-sm text-muted">No results found</li>
53
+ `}
54
+ </ul>
55
+ </div>
56
+ `}_handleAutoSelectOnBlur(){if(this.multi||!this._open||!this._inputValue.trim())return;const e=this._inputValue.trim();let t=null,o=0;this._options.forEach(s=>{if(s.hidden)return;const n=s.label||s.textContent||"",l=s.value,p=_.similarity(e,n),c=_.similarity(e,l),d=Math.max(1.1*p,c);d>o&&d>=this.similarityThreshold&&(o=d,t=s)}),t&&(this._optionSelect$.next(t),this._open$.next(!1),this._open=!1)}_handleKeyDown(e){h.fromEvent(document,"keydown").pipe(i.take(1),i.withLatestFrom(this._open$,this._options$),i.tap(([t,o,s])=>{if(!o&&(t.key==="ArrowDown"||t.key==="Enter"))return t.preventDefault(),this._open$.next(!0),void h.timer(10).pipe(i.tap(()=>{s.find(d=>!d.hidden)?.focus()}),i.take(1)).subscribe();if(!o)return;const n=s.filter(c=>!c.hidden).sort((c,d)=>parseInt(c.style.order||"0")-parseInt(d.style.order||"0")),l=n.find(c=>c===document.activeElement),p=l?n.indexOf(l):-1;switch(t.key){case"Escape":t.preventDefault(),this._open$.next(!1),this._updateInputDisplay(),this._inputElementRef.value?.focus();break;case"Tab":this._open$.next(!1),this._updateInputDisplay();break;case"ArrowDown":t.preventDefault();const c=p<n.length-1?p+1:0;n[c]?.focus();break;case"ArrowUp":t.preventDefault();const d=p>0?p-1:n.length-1;n[d]?.focus();break;case"Home":t.preventDefault(),n[0]?.focus();break;case"End":t.preventDefault(),n[n.length-1]?.focus();break;case"Enter":case" ":l&&(t.preventDefault(),this._optionSelect$.next(l))}})).subscribe()}};r([u.property({type:Boolean})],a.prototype,"required",2),r([u.property({type:String})],a.prototype,"placeholder",2),r([u.property({type:String,reflect:!0})],a.prototype,"label",2),r([u.property({type:String})],a.prototype,"name",2),r([u.property({type:String})],a.prototype,"maxHeight",2),r([u.property({type:Boolean})],a.prototype,"multi",2),r([u.property({type:String})],a.prototype,"description",2),r([u.property({type:String,reflect:!0})],a.prototype,"size",2),r([u.property({type:String})],a.prototype,"autocomplete",2),r([u.property({type:Number})],a.prototype,"debounceMs",2),r([u.property({type:Number})],a.prototype,"similarityThreshold",2),r([u.property({type:Array})],a.prototype,"values",1),r([u.property({type:String,reflect:!0})],a.prototype,"value",1),r([u.state()],a.prototype,"_open",2),r([u.state()],a.prototype,"_inputValue",2),r([u.state()],a.prototype,"_visibleOptionsCount",2),r([u.state()],a.prototype,"_hasResults",2),r([u.query("#options")],a.prototype,"_listbox",2),r([u.query("sch-input")],a.prototype,"_input",2),r([u.queryAssignedElements({flatten:!0})],a.prototype,"_options",2),a=r([u.customElement("schmancy-autocomplete")],a);
57
+ //# sourceMappingURL=autocomplete-CdUGguah.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete-CdUGguah.cjs","sources":["../src/autocomplete/autocomplete.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { InputSize, SchmancyInput } from '@schmancy/input'\nimport SchmancyOption from '@schmancy/option/option'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport {\n BehaviorSubject,\n combineLatest,\n EMPTY,\n fromEvent,\n of,\n Subject,\n timer\n} from 'rxjs'\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n switchMap,\n take,\n takeUntil,\n tap,\n withLatestFrom\n} from 'rxjs/operators'\nimport style from './autocomplete.scss?inline'\n\n// Import the similarity function (or include it inline)\nimport { similarity } from '../utils/search'\n\nexport type SchmancyAutocompleteChangeEvent = CustomEvent<{\n value: string | string[]\n values?: string[]\n}>\n\ninterface FilteredOption {\n option: SchmancyOption\n score: number\n}\n\n@customElement('schmancy-autocomplete')\nexport default class SchmancyAutocomplete extends $LitElement(style) {\n // Public API properties\n @property({ type: Boolean }) required = false\n @property({ type: String }) placeholder = ''\n @property({ type: String, reflect: true }) label = ''\n @property({ type: String }) name = ''\n @property({ type: String }) maxHeight = '300px'\n @property({ type: Boolean }) multi = false\n @property({ type: String }) description = ''\n @property({ type: String, reflect: true }) size: InputSize = 'md'\n @property({ type: String }) autocomplete = 'on'\n @property({ type: Number }) debounceMs = 200\n @property({ type: Number }) similarityThreshold = 0.3 // Minimum similarity score to show option\n\n // Values property for multi-select mode\n @property({ type: Array })\n get values() {\n return [...this._selectedValues$.value]\n }\n set values(vals: string[]) {\n this._selectedValues$.next(Array.isArray(vals) ? [...vals] : [])\n }\n\n // Value property\n @property({ type: String, reflect: true })\n get value() {\n return this.multi \n ? this._selectedValues$.value.join(',')\n : this._selectedValue$.value\n }\n set value(val: string) {\n if (this.multi) {\n this._selectedValues$.next(\n val ? val.split(',').map(v => v.trim()).filter(Boolean) : []\n )\n } else {\n this._selectedValue$.next(val)\n }\n }\n\n // State\n @state() private _open = false\n @state() private _inputValue = ''\n @state() private _visibleOptionsCount = 0\n @state() private _hasResults = true\n\n // DOM references\n @query('#options') _listbox!: HTMLUListElement\n @query('sch-input') _input!: SchmancyInput\n @queryAssignedElements({ flatten: true }) private _options!: SchmancyOption[]\n private _inputElementRef = createRef<HTMLInputElement>()\n\n // RxJS Subjects\n private _selectedValue$ = new BehaviorSubject<string>('')\n private _selectedValues$ = new BehaviorSubject<string[]>([])\n private _inputValue$ = new BehaviorSubject<string>('')\n private _open$ = new BehaviorSubject<boolean>(false)\n private _options$ = new BehaviorSubject<SchmancyOption[]>([])\n private _optionSelect$ = new Subject<SchmancyOption>()\n private _documentClick$ = new Subject<MouseEvent>()\n\n connectedCallback() {\n super.connectedCallback()\n \n if (!this.id) {\n this.id = `sch-autocomplete-${Math.random().toString(36).slice(2, 9)}`\n }\n\n this._setupAutocompleteLogic()\n this._setupDocumentClickHandler()\n // Complex autofill detection disabled - using simple auto-select on blur instead\n // this._setupAutofillDetection()\n }\n\n private _setupAutocompleteLogic() {\n // Options management pipeline\n this._options$.pipe(\n tap(options => {\n options.forEach((option, index) => {\n option.setAttribute('role', 'option')\n option.tabIndex = -1\n if (!option.id) {\n option.id = `${this.id}-option-${index}`\n }\n if (!option.hasAttribute('data-event-bound')) {\n fromEvent(option, 'pointerdown').pipe(\n tap(e => {\n e.preventDefault() // Prevent blur from firing\n e.stopPropagation()\n }),\n takeUntil(this.disconnecting)\n ).subscribe(() => this._optionSelect$.next(option))\n option.setAttribute('data-event-bound', 'true')\n }\n })\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Selection sync pipeline\n combineLatest([\n this._selectedValue$,\n this._selectedValues$,\n this._options$\n ]).pipe(\n tap(([selectedValue, selectedValues, options]) => {\n options.forEach(option => {\n option.selected = this.multi \n ? selectedValues.includes(option.value)\n : option.value === selectedValue\n option.setAttribute('aria-selected', String(option.selected))\n })\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Enhanced fuzzy filtering pipeline\n this._inputValue$.pipe(\n distinctUntilChanged(),\n debounceTime(this.debounceMs),\n withLatestFrom(this._options$, this._open$),\n tap(([searchTerm, options, isOpen]) => {\n if (!isOpen) return\n\n const term = searchTerm.trim()\n \n if (!term) {\n // Show all options if no search term\n options.forEach(option => {\n option.hidden = false\n option.style.order = '0' // Reset order\n })\n this._visibleOptionsCount = options.length\n this._hasResults = true\n } else {\n // Calculate similarity scores for all options\n const scoredOptions: FilteredOption[] = options.map(option => {\n // Get text to search in (prioritize label, then textContent, then value)\n const optionLabel = option.label || option.textContent || ''\n const optionValue = option.value\n \n // Calculate similarity scores for both label and value\n const labelScore = similarity(term, optionLabel)\n const valueScore = similarity(term, optionValue)\n \n // Use the higher score (prioritizing label matches)\n const score = Math.max(labelScore * 1.1, valueScore) // Slight boost for label matches\n \n return { option, score }\n })\n \n // Sort by score (highest first)\n scoredOptions.sort((a, b) => b.score - a.score)\n \n // Apply visibility and ordering\n let visibleCount = 0\n scoredOptions.forEach((item, index) => {\n const { option, score } = item\n \n // Hide options below threshold\n if (score < this.similarityThreshold) {\n option.hidden = true\n } else {\n option.hidden = false\n visibleCount++\n // Use CSS order to sort visible options by relevance\n option.style.order = String(index)\n }\n })\n \n this._visibleOptionsCount = visibleCount\n this._hasResults = visibleCount > 0\n }\n \n this._announceToScreenReader(\n this._visibleOptionsCount > 0 \n ? `${this._visibleOptionsCount} option${this._visibleOptionsCount === 1 ? '' : 's'} available.`\n : 'No results found.'\n )\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Option selection pipeline\n this._optionSelect$.pipe(\n withLatestFrom(this._selectedValue$, this._selectedValues$),\n tap(([option, _, currentValues]) => {\n if (this.multi) {\n const index = currentValues.indexOf(option.value)\n const newValues = index > -1\n ? [...currentValues.slice(0, index), ...currentValues.slice(index + 1)]\n : [...currentValues, option.value]\n this._selectedValues$.next(newValues)\n \n this._inputValue$.next('')\n this._inputValue = ''\n \n const labels = this._getSelectedLabels()\n this._announceToScreenReader(\n labels.length > 0 \n ? `Selected: ${labels.join(', ')}`\n : 'No options selected'\n )\n } else {\n this._selectedValue$.next(option.value)\n this._open$.next(false)\n this._open = false\n \n this._inputValue = option.label || option.textContent || ''\n this._inputValue$.next(this._inputValue)\n \n timer(100).pipe(\n tap(() => this._inputElementRef.value?.blur()),\n take(1)\n ).subscribe()\n \n this._announceToScreenReader(`Selected: ${option.label || option.textContent}`)\n }\n }),\n tap(() => this._fireChangeEvent()),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Display update pipeline\n combineLatest([\n this._open$,\n this._selectedValue$,\n this._selectedValues$,\n this._options$\n ]).pipe(\n filter(() => !this._open$.value),\n tap(([, selectedValue, selectedValues, options]) => {\n if (this.multi) {\n const labels = options\n .filter(opt => selectedValues.includes(opt.value))\n .map(opt => opt.label || opt.textContent || '')\n this._inputValue = labels.join(', ')\n } else {\n const option = options.find(opt => opt.value === selectedValue)\n this._inputValue = option ? option.label || option.textContent || '' : ''\n }\n this._inputValue$.next(this._inputValue)\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Open state sync\n this._open$.pipe(\n tap(open => this._open = open),\n takeUntil(this.disconnecting)\n ).subscribe()\n }\n\n private _setupDocumentClickHandler() {\n this._documentClick$.pipe(\n filter(e => !e.composedPath().includes(this)),\n filter(e => !this._options.some(opt => e.composedPath().includes(opt))),\n filter(() => this._open),\n tap(() => {\n this._open$.next(false)\n this._updateInputDisplay()\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n this._open$.pipe(\n distinctUntilChanged(),\n switchMap(open => \n open \n ? timer(10).pipe(\n tap(() => document.addEventListener('click', e => this._documentClick$.next(e))),\n switchMap(() => EMPTY)\n )\n : of(null).pipe(\n tap(() => document.removeEventListener('click', e => this._documentClick$.next(e)))\n )\n ),\n takeUntil(this.disconnecting)\n ).subscribe()\n }\n\n\n private _updateInputDisplay() {\n of(null).pipe(\n withLatestFrom(\n this._selectedValue$,\n this._selectedValues$,\n this._options$,\n this._open$\n ),\n tap(([, selectedValue, selectedValues, options, isOpen]) => {\n if (!this._inputElementRef.value) return\n\n if (!isOpen || !this.multi) {\n if (this.multi) {\n const labels = options\n .filter(opt => selectedValues.includes(opt.value))\n .map(opt => opt.label || opt.textContent || '')\n this._inputValue = labels.join(', ')\n } else {\n const option = options.find(opt => opt.value === selectedValue)\n this._inputValue = option ? option.label || option.textContent || '' : ''\n }\n this._inputValue$.next(this._inputValue)\n this._inputElementRef.value.value = this._inputValue\n }\n }),\n take(1)\n ).subscribe()\n }\n\n private _getSelectedLabels(): string[] {\n return this._options\n .filter(option => \n this.multi \n ? this._selectedValues$.value.includes(option.value)\n : option.value === this._selectedValue$.value\n )\n .map(option => option.label || option.textContent || '')\n }\n\n private _announceToScreenReader(message: string) {\n const liveRegion = this.shadowRoot?.querySelector('#live-status')\n if (liveRegion) {\n liveRegion.textContent = message\n }\n }\n\n private _fireChangeEvent() {\n const detail: SchmancyAutocompleteChangeEvent['detail'] = {\n value: this.value,\n }\n\n if (this.multi) {\n detail.values = [...this._selectedValues$.value]\n }\n\n this.dispatchEvent(\n new CustomEvent<SchmancyAutocompleteChangeEvent['detail']>('change', {\n detail,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n public checkValidity(): boolean {\n if (!this.required) return true\n return this.multi \n ? this._selectedValues$.value.length > 0 \n : Boolean(this._selectedValue$.value)\n }\n\n public reportValidity(): boolean {\n if (this._inputElementRef.value) {\n return this._inputElementRef.value.reportValidity()\n }\n return this.checkValidity()\n }\n\n firstUpdated() {\n // Auto-selection now happens on blur, no need for autofill detection\n }\n\n render() {\n const descriptionId = `${this.id}-desc`\n\n return html`\n <div class=\"relative\">\n <!-- Screen reader live region -->\n <div id=\"live-status\" role=\"status\" aria-live=\"polite\" class=\"sr-only\"></div>\n\n <!-- Description -->\n ${this.description ? html`<div id=\"${descriptionId}\" class=\"sr-only\">${this.description}</div>` : ''}\n\n <!-- Input -->\n <slot name=\"trigger\">\n <schmancy-input\n .size=${this.size}\n ${ref(this._inputElementRef)}\n id=\"autocomplete-input\"\n class=\"w-full\"\n .name=${this.name || this.label?.toLowerCase().replace(/\\s+/g, '-')}\n .label=${this.label}\n .placeholder=${this.placeholder}\n .required=${this.required}\n .value=${this._inputValue}\n type=\"text\"\n autocomplete=${this.autocomplete}\n clickable\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-controls=\"options\"\n aria-expanded=${this._open}\n aria-describedby=${this.description ? descriptionId : undefined}\n @input=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._inputValue = value\n this._inputValue$.next(value)\n }}\n @focus=${(e: FocusEvent) => {\n e.stopPropagation()\n \n const hasSelection = this.multi \n ? this._selectedValues$.value.length > 0\n : !!this._selectedValue$.value\n \n if (this.multi && !hasSelection) {\n this._inputValue = ''\n this._inputValue$.next('')\n if (this._inputElementRef.value) {\n this._inputElementRef.value.value = ''\n }\n }\n \n this._open$.next(true)\n }}\n @click=${(e: MouseEvent) => {\n e.stopPropagation()\n this._open$.next(true)\n }}\n @keydown=${(e: KeyboardEvent) => {\n this._handleKeyDown(e)\n }}\n @blur=${() => {\n this._handleAutoSelectOnBlur()\n }}\n >\n </schmancy-input>\n </slot>\n\n <!-- Options dropdown -->\n <ul\n id=\"options\"\n class=${classMap({\n 'absolute': true,\n 'z-[1000]': true,\n 'mt-1': true,\n 'w-full': true,\n 'rounded-md': true,\n 'shadow-md': true,\n 'overflow-auto': true,\n 'min-w-full': true,\n 'bg-surface-low': true,\n 'flex': true,\n 'flex-col': true, // Enable flexbox for ordering\n })}\n role=\"listbox\"\n aria-multiselectable=${this.multi ? 'true' : 'false'}\n aria-label=${`${this.label || 'Options'} dropdown`}\n ?hidden=${!this._open}\n style=\"max-height: ${this.maxHeight}; display: ${this._open ? 'flex' : 'none'};\"\n @slotchange=${() => {\n this._options$.next(this._options)\n }}\n >\n <slot></slot>\n ${!this._hasResults ? html`\n <li class=\"px-3 py-2 text-sm text-muted\">No results found</li>\n ` : ''}\n </ul>\n </div>\n `\n }\n\n private _handleAutoSelectOnBlur() {\n // Only auto-select in single-select mode and when dropdown is open with a search term\n if (this.multi || !this._open || !this._inputValue.trim()) {\n return\n }\n \n const searchTerm = this._inputValue.trim()\n \n // Find the best matching option using the same similarity logic as filtering\n let bestMatch: SchmancyOption | null = null\n let bestScore = 0\n \n this._options.forEach(option => {\n // Skip hidden options\n if (option.hidden) return\n \n // Get text to search in (prioritize label, then textContent, then value)\n const optionLabel = option.label || option.textContent || ''\n const optionValue = option.value\n \n // Calculate similarity scores for both label and value\n const labelScore = similarity(searchTerm, optionLabel)\n const valueScore = similarity(searchTerm, optionValue)\n \n // Use the higher score (prioritizing label matches)\n const score = Math.max(labelScore * 1.1, valueScore) // Slight boost for label matches\n \n // Keep track of best match that meets threshold\n if (score > bestScore && score >= this.similarityThreshold) {\n bestScore = score\n bestMatch = option\n }\n })\n \n // Auto-select the best match if found\n if (bestMatch) {\n // Select the option using the existing pipeline\n this._optionSelect$.next(bestMatch)\n \n // Close the dropdown\n this._open$.next(false)\n this._open = false\n \n console.log('Auto-selected on blur:', bestMatch.value, 'with score:', bestScore)\n }\n }\n\n private _handleKeyDown(_e: KeyboardEvent) {\n fromEvent<KeyboardEvent>(document, 'keydown').pipe(\n take(1),\n withLatestFrom(this._open$, this._options$),\n tap(([event, isOpen, options]) => {\n if (!isOpen && (event.key === 'ArrowDown' || event.key === 'Enter')) {\n event.preventDefault()\n this._open$.next(true)\n \n timer(10).pipe(\n tap(() => {\n const firstVisible = options.find(opt => !opt.hidden)\n firstVisible?.focus()\n }),\n take(1)\n ).subscribe()\n return\n }\n\n if (!isOpen) return\n\n const visibleOptions = options.filter(opt => !opt.hidden)\n .sort((a, b) => parseInt(a.style.order || '0') - parseInt(b.style.order || '0'))\n \n const focusedOption = visibleOptions.find(opt => opt === document.activeElement)\n const currentIndex = focusedOption ? visibleOptions.indexOf(focusedOption) : -1\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n this._open$.next(false)\n this._updateInputDisplay()\n this._inputElementRef.value?.focus()\n break\n\n case 'Tab':\n this._open$.next(false)\n this._updateInputDisplay()\n break\n\n case 'ArrowDown':\n event.preventDefault()\n const nextIndex = currentIndex < visibleOptions.length - 1 ? currentIndex + 1 : 0\n visibleOptions[nextIndex]?.focus()\n break\n\n case 'ArrowUp':\n event.preventDefault()\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : visibleOptions.length - 1\n visibleOptions[prevIndex]?.focus()\n break\n\n case 'Home':\n event.preventDefault()\n visibleOptions[0]?.focus()\n break\n\n case 'End':\n event.preventDefault()\n visibleOptions[visibleOptions.length - 1]?.focus()\n break\n\n case 'Enter':\n case ' ':\n if (focusedOption) {\n event.preventDefault()\n this._optionSelect$.next(focusedOption)\n }\n break\n }\n })\n ).subscribe()\n }\n}\n\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-autocomplete': SchmancyAutocomplete\n }\n}"],"names":["SchmancyAutocomplete","$LitElement","constructor","super","arguments","this","required","placeholder","label","name","maxHeight","multi","description","size","autocomplete","debounceMs","similarityThreshold","_open","_inputValue","_visibleOptionsCount","_hasResults","_inputElementRef","createRef","_selectedValue$","BehaviorSubject","_selectedValues$","_inputValue$","_open$","_options$","_optionSelect$","Subject","_documentClick$","values","value","vals","next","Array","isArray","join","val","split","map","v","trim","filter","Boolean","connectedCallback","id","Math","random","toString","slice","_setupAutocompleteLogic","_setupDocumentClickHandler","pipe","tap","options","forEach","option","index","setAttribute","tabIndex","hasAttribute","fromEvent","e","preventDefault","stopPropagation","takeUntil","disconnecting","subscribe","combineLatest","selectedValue","selectedValues","selected","includes","String","distinctUntilChanged","debounceTime","withLatestFrom","searchTerm","isOpen","term","scoredOptions","optionLabel","textContent","optionValue","labelScore","similarity","valueScore","score","max","sort","a","b","visibleCount","item","hidden","style","order","length","_announceToScreenReader","_","currentValues","indexOf","newValues","labels","_getSelectedLabels","timer","blur","take","_fireChangeEvent","opt","find","open","composedPath","_options","some","_updateInputDisplay","switchMap","document","addEventListener","EMPTY","of","removeEventListener","message","liveRegion","shadowRoot","querySelector","detail","dispatchEvent","CustomEvent","bubbles","composed","checkValidity","reportValidity","firstUpdated","render","descriptionId","html","ref","toLowerCase","replace","target","hasSelection","_handleKeyDown","_handleAutoSelectOnBlur","classMap","absolute","flex","bestMatch","bestScore","_e","event","key","focus","visibleOptions","parseInt","focusedOption","activeElement","currentIndex","nextIndex","prevIndex","__decorateClass","property","type","prototype","reflect","Number","state","query","queryAssignedElements","flatten","customElement"],"mappings":"yiBA0CA,IAAqBA,EAArB,cAAkDC,mYAAlD,aAAAC,CAAAC,MAAAA,GAAAC,SAAAA,EAEiCC,KAAAC,SAAAA,GACDD,KAAAE,YAAc,GACCF,KAAAG,MAAQ,GACvBH,KAAAI,KAAO,GACPJ,KAAAK,UAAY,QACXL,KAAAM,MAAAA,GACDN,KAAAO,YAAc,GACCP,KAAAQ,KAAkB,KACjCR,KAAAS,aAAe,KACfT,KAAAU,WAAa,IACbV,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
2
  //# sourceMappingURL=autocomplete.cjs.map
@@ -1,2 +1,2 @@
1
- import "./autocomplete-CF67hOX7.js";
1
+ import "./autocomplete-B7JYyVgi.js";
2
2
  //# sourceMappingURL=autocomplete.js.map
@@ -1,4 +1,4 @@
1
- "use strict";const l=require("lit"),o=require("lit/decorators.js"),s=require("rxjs");require("./animated-text-EjzqX_DQ.cjs");const $=require("./area.component-B2Q4fmyG.cjs");require("./autocomplete-CU-jz4zG.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const _=require("./tailwind.mixin-NrMHmraa.cjs"),D=require("./ripple-C2BHbhcS.cjs");require("./boat-C_4qzJbd.cjs"),require("./spinner-Dx1Ryl5-.cjs"),require("./icon-button-tVZLMjEJ.cjs"),require("./media-CvzaJPdC.cjs"),require("./checkbox-BbrKQhIR.cjs"),require("./chips-BGkLDY0l.cjs"),require("./code-preview-CjcxgpTv.cjs"),require("./payment-card-form-mtpcOUF1.cjs");const p=require("./types.cjs"),d=require("./provide-BxZ2kn_p.cjs"),b=require("./litElement.mixin-BEbYQVKW.cjs"),m=require("./consume-edta5ng5.cjs");require("./date-range-BYQ09fir.cjs"),require("./date-range-inline-CaFUtSBm.cjs"),require("./delay-B9F4XCNZ.cjs"),require("./details-BaRWlZSt.cjs"),require("./dialog-content-B8KcY2sH.cjs"),require("./dialog-service-1uYQx7dw.cjs"),require("./divider-DSnh0b6W.cjs"),require("./dropdown-content-RUtMP_Q9.cjs"),require("./timezone-CDIIaBDU.cjs"),require("./form-Cr0sCISI.cjs"),require("./icon-DaI15W0a.cjs"),require("./input-DbTyzINg.cjs"),require("./flex-BFiiMqk7.cjs"),require("./list-DwM0r5Yf.cjs"),require("./map-B5zH_aTP.cjs"),require("./menu-CRDNeLR4.cjs");const W=require("lit/directives/when.js");require("./notification-service-8yVD9JmC.cjs"),require("./option-CHBn_LVC.cjs"),require("./progress-D2Ir6B3O.cjs"),require("./radio-button--qELnlmY.cjs"),require("./index-DyJ0oDpR.cjs"),require("./select-cK7FzCV1.cjs");const A=require("./sheet-C0bdYFvW.cjs");require("./slider-Dxefxjle.cjs"),require("./schmancy-steps-container-1RPGYqA4.cjs"),require("./context-object-K_1gDFu-.cjs");const N=require("rxjs/operators");require("./surface-BdhBs3Iz.cjs"),require("./table-DOZUn3w8.cjs"),require("./tabs-compatibility-BvLxoOTz.cjs"),require("./textarea-B59CHwhS.cjs"),require("./theme.component-Br50YrTh.cjs"),require("./theme-button-DYpBAOyy.cjs"),require("./tooltip-DA-XG9ME.cjs"),require("./tree--0R_mj8U.cjs"),require("./typewriter-CqwSUASf.cjs"),require("./typography-U5supY1N.cjs");const i=require("./theme.interface-Xg5Zi46a.cjs");var X=Object.defineProperty,H=Object.getOwnPropertyDescriptor,g=(e,t,n,a)=>{for(var c,r=a>1?void 0:a?H(t,n):t,h=e.length-1;h>=0;h--)(c=e[h])&&(r=(a?c(t,n,r):c(r))||r);return a&&r&&X(t,n,r),r};exports.SchmancyBadgeV2=class extends _.TailwindElement(l.css`
1
+ "use strict";const l=require("lit"),o=require("lit/decorators.js"),s=require("rxjs");require("./animated-text-EjzqX_DQ.cjs");const $=require("./area.component-B2Q4fmyG.cjs");require("./autocomplete-CdUGguah.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const _=require("./tailwind.mixin-NrMHmraa.cjs"),D=require("./ripple-C2BHbhcS.cjs");require("./boat-C_4qzJbd.cjs"),require("./spinner-Dx1Ryl5-.cjs"),require("./icon-button-DScsyzbc.cjs"),require("./media-CvzaJPdC.cjs"),require("./checkbox-BbrKQhIR.cjs"),require("./chips-BGkLDY0l.cjs"),require("./code-preview-CjcxgpTv.cjs"),require("./payment-card-form-mtpcOUF1.cjs");const p=require("./types.cjs"),d=require("./provide-BxZ2kn_p.cjs"),b=require("./litElement.mixin-BEbYQVKW.cjs"),m=require("./consume-edta5ng5.cjs");require("./date-range-BYQ09fir.cjs"),require("./date-range-inline-CaFUtSBm.cjs"),require("./delay-B9F4XCNZ.cjs"),require("./details-BaRWlZSt.cjs"),require("./dialog-content-B8KcY2sH.cjs"),require("./dialog-service-1uYQx7dw.cjs"),require("./divider-DSnh0b6W.cjs"),require("./dropdown-content-RUtMP_Q9.cjs"),require("./timezone-CDIIaBDU.cjs"),require("./form-Cr0sCISI.cjs"),require("./icon-DaI15W0a.cjs"),require("./input-DbTyzINg.cjs"),require("./flex-BFiiMqk7.cjs"),require("./list-DwM0r5Yf.cjs"),require("./map-B5zH_aTP.cjs"),require("./menu-CRDNeLR4.cjs");const W=require("lit/directives/when.js");require("./notification-service-8yVD9JmC.cjs"),require("./option-CHBn_LVC.cjs"),require("./progress-D2Ir6B3O.cjs"),require("./radio-button--qELnlmY.cjs"),require("./index-DyJ0oDpR.cjs"),require("./select-cK7FzCV1.cjs");const A=require("./sheet-C0bdYFvW.cjs");require("./slider-Dxefxjle.cjs"),require("./schmancy-steps-container-1RPGYqA4.cjs"),require("./context-object-K_1gDFu-.cjs");const N=require("rxjs/operators");require("./surface-BdhBs3Iz.cjs"),require("./table-DOZUn3w8.cjs"),require("./tabs-compatibility-BvLxoOTz.cjs"),require("./textarea-B59CHwhS.cjs"),require("./theme.component-Br50YrTh.cjs"),require("./theme-button-DYpBAOyy.cjs"),require("./tooltip-DA-XG9ME.cjs"),require("./tree--0R_mj8U.cjs"),require("./typewriter-CqwSUASf.cjs"),require("./typography-U5supY1N.cjs");const i=require("./theme.interface-Xg5Zi46a.cjs");var X=Object.defineProperty,H=Object.getOwnPropertyDescriptor,g=(e,t,n,a)=>{for(var c,r=a>1?void 0:a?H(t,n):t,h=e.length-1;h>=0;h--)(c=e[h])&&(r=(a?c(t,n,r):c(r))||r);return a&&r&&X(t,n,r),r};exports.SchmancyBadgeV2=class extends _.TailwindElement(l.css`
2
2
  :host {
3
3
  display: inline-flex;
4
4
  }
@@ -202,4 +202,4 @@
202
202
  `}getColorAttributes(){const e={primary:{bgColor:i.SchmancyTheme.sys.color.primary.container,color:i.SchmancyTheme.sys.color.primary.onContainer},secondary:{bgColor:i.SchmancyTheme.sys.color.secondary.container,color:i.SchmancyTheme.sys.color.secondary.onContainer},tertiary:{bgColor:i.SchmancyTheme.sys.color.tertiary.container,color:i.SchmancyTheme.sys.color.tertiary.onContainer},success:{bgColor:i.SchmancyTheme.sys.color.success.container,color:i.SchmancyTheme.sys.color.success.onContainer},error:{bgColor:i.SchmancyTheme.sys.color.error.container,color:i.SchmancyTheme.sys.color.error.onContainer},neutral:{bgColor:i.SchmancyTheme.sys.color.surface.container,color:i.SchmancyTheme.sys.color.surface.on}};return D.color(e[this.color])}renderStatusIndicator(){const e={online:i.SchmancyTheme.sys.color.success.default,offline:i.SchmancyTheme.sys.color.surface.onVariant,busy:i.SchmancyTheme.sys.color.error.default,away:i.SchmancyTheme.sys.color.tertiary.default},t={"absolute bottom-0 right-0 rounded-full border-2 border-surface-default":!0,[{xs:"w-1.5 h-1.5",sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3",xl:"w-4 h-4"}[this.size]]:!0};return l.html`
203
203
  <div class="${this.classMap(t)}" style="background-color: ${e[this.status]};"></div>
204
204
  `}},u([o.property({type:String})],exports.SchmancyAvatar.prototype,"initials",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"src",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"icon",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"size",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"color",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"shape",2),u([o.property({type:Boolean})],exports.SchmancyAvatar.prototype,"bordered",2),u([o.property({type:String})],exports.SchmancyAvatar.prototype,"status",2),exports.SchmancyAvatar=u([o.customElement("schmancy-avatar")],exports.SchmancyAvatar),exports.$drawer=Q,exports.HereMorty=B,exports.SchmancyContentDrawerID=I,exports.SchmancyContentDrawerMaxHeight=k,exports.SchmancyContentDrawerMinWidth=M,exports.SchmancyContentDrawerSheetMode=q,exports.SchmancyContentDrawerSheetState=j,exports.SchmancyDrawerNavbarMode=O,exports.SchmancyDrawerNavbarState=z,exports.WhereAreYouRicky=P,exports.schmancyContentDrawer=V,exports.schmancyNavDrawer=R,exports.teleport=x;
205
- //# sourceMappingURL=avatar-C8g7jgmf.cjs.map
205
+ //# sourceMappingURL=avatar-CPKFq9zM.cjs.map