@mhmo91/schmancy 0.4.59 → 0.4.61
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.
- package/dist/autocomplete-CF67hOX7.js +256 -0
- package/dist/autocomplete-CF67hOX7.js.map +1 -0
- package/dist/autocomplete-CU-jz4zG.cjs +74 -0
- package/dist/autocomplete-CU-jz4zG.cjs.map +1 -0
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/{avatar-BL_lAqVL.js → avatar-Kpd_4yAD.js} +3 -3
- package/dist/{avatar-BL_lAqVL.js.map → avatar-Kpd_4yAD.js.map} +1 -1
- package/dist/{avatar-D5Dk8vXN.cjs → avatar-YI-yiAV0.cjs} +2 -2
- package/dist/{avatar-D5Dk8vXN.cjs.map → avatar-YI-yiAV0.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{icon-button-BEmjBwBq.js → icon-button-DIiL6-Vv.js} +13 -17
- package/dist/icon-button-DIiL6-Vv.js.map +1 -0
- package/dist/{icon-button-tVZLMjEJ.cjs → icon-button-DScsyzbc.cjs} +2 -6
- package/dist/icon-button-DScsyzbc.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/autocomplete/autocomplete.d.ts +1 -2
- package/dist/autocomplete-BSiHfYty.cjs +0 -73
- package/dist/autocomplete-BSiHfYty.cjs.map +0 -1
- package/dist/autocomplete-D52TZSRM.js +0 -267
- package/dist/autocomplete-D52TZSRM.js.map +0 -1
- package/dist/icon-button-BEmjBwBq.js.map +0 -1
- package/dist/icon-button-tVZLMjEJ.cjs.map +0 -1
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject as f, Subject as k, fromEvent as y, combineLatest as C, timer as _, of as R, EMPTY as O, merge as q } from "rxjs";
|
|
2
|
-
import { classMap as T } from "lit/directives/class-map.js";
|
|
3
|
-
import "lit/directives/style-map.js";
|
|
4
|
-
import { $ as j } from "./litElement.mixin-YJTCObjn.js";
|
|
5
|
-
import "./tailwind.mixin-CbvBtwqu.js";
|
|
6
|
-
import { property as c, state as x, query as A, queryAssignedElements as L, customElement as M } from "lit/decorators.js";
|
|
7
|
-
import { html as w } from "lit";
|
|
8
|
-
import { createRef as I, ref as P } from "lit/directives/ref.js";
|
|
9
|
-
import { tap as a, takeUntil as d, distinctUntilChanged as S, debounceTime as N, withLatestFrom as v, take as b, filter as m, switchMap as g, startWith as z, map as E } from "rxjs/operators";
|
|
10
|
-
import { s as V } from "./search-6Hr7K1gh.js";
|
|
11
|
-
var H = Object.defineProperty, B = Object.getOwnPropertyDescriptor, u = (e, t, s, n) => {
|
|
12
|
-
for (var i, l = n > 1 ? void 0 : n ? B(t, s) : t, p = e.length - 1; p >= 0; p--) (i = e[p]) && (l = (n ? i(t, s, l) : i(l)) || l);
|
|
13
|
-
return n && l && H(t, s, l), l;
|
|
14
|
-
};
|
|
15
|
-
let o = class extends j(":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}") {
|
|
16
|
-
constructor() {
|
|
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 = I(), this._selectedValue$ = new f(""), this._selectedValues$ = new f([]), this._inputValue$ = new f(""), this._open$ = new f(!1), this._options$ = new f([]), this._optionSelect$ = new k(), this._documentClick$ = new k(), this._checkAutofill$ = new k();
|
|
18
|
-
}
|
|
19
|
-
get values() {
|
|
20
|
-
return [...this._selectedValues$.value];
|
|
21
|
-
}
|
|
22
|
-
set values(e) {
|
|
23
|
-
this._selectedValues$.next(Array.isArray(e) ? [...e] : []);
|
|
24
|
-
}
|
|
25
|
-
get value() {
|
|
26
|
-
return this.multi ? this._selectedValues$.value.join(",") : this._selectedValue$.value;
|
|
27
|
-
}
|
|
28
|
-
set value(e) {
|
|
29
|
-
this.multi ? this._selectedValues$.next(e ? e.split(",").map((t) => t.trim()).filter(Boolean) : []) : this._selectedValue$.next(e);
|
|
30
|
-
}
|
|
31
|
-
connectedCallback() {
|
|
32
|
-
super.connectedCallback(), this.id || (this.id = `sch-autocomplete-${Math.random().toString(36).slice(2, 9)}`), this._setupAutocompleteLogic(), this._setupDocumentClickHandler(), this._setupAutofillDetection();
|
|
33
|
-
}
|
|
34
|
-
_setupAutocompleteLogic() {
|
|
35
|
-
this._options$.pipe(a((e) => {
|
|
36
|
-
e.forEach((t, s) => {
|
|
37
|
-
t.setAttribute("role", "option"), t.tabIndex = -1, t.id || (t.id = `${this.id}-option-${s}`), t.hasAttribute("data-event-bound") || (y(t, "click").pipe(a((n) => n.stopPropagation()), d(this.disconnecting)).subscribe(() => this._optionSelect$.next(t)), t.setAttribute("data-event-bound", "true"));
|
|
38
|
-
});
|
|
39
|
-
}), d(this.disconnecting)).subscribe(), C([this._selectedValue$, this._selectedValues$, this._options$]).pipe(a(([e, t, s]) => {
|
|
40
|
-
s.forEach((n) => {
|
|
41
|
-
n.selected = this.multi ? t.includes(n.value) : n.value === e, n.setAttribute("aria-selected", String(n.selected));
|
|
42
|
-
});
|
|
43
|
-
}), d(this.disconnecting)).subscribe(), this._inputValue$.pipe(S(), N(this.debounceMs), v(this._options$, this._open$), a(([e, t, s]) => {
|
|
44
|
-
if (!s) return;
|
|
45
|
-
const n = e.trim();
|
|
46
|
-
if (n) {
|
|
47
|
-
const i = t.map((p) => {
|
|
48
|
-
const r = p.label || p.textContent || "", h = p.value, $ = V(n, r), D = V(n, h);
|
|
49
|
-
return { option: p, score: Math.max(1.1 * $, D) };
|
|
50
|
-
});
|
|
51
|
-
i.sort((p, r) => r.score - p.score);
|
|
52
|
-
let l = 0;
|
|
53
|
-
i.forEach((p, r) => {
|
|
54
|
-
const { option: h, score: $ } = p;
|
|
55
|
-
$ < this.similarityThreshold ? h.hidden = !0 : (h.hidden = !1, l++, h.style.order = String(r));
|
|
56
|
-
}), this._visibleOptionsCount = l, this._hasResults = l > 0;
|
|
57
|
-
} else t.forEach((i) => {
|
|
58
|
-
i.hidden = !1, i.style.order = "0";
|
|
59
|
-
}), this._visibleOptionsCount = t.length, this._hasResults = !0;
|
|
60
|
-
this._announceToScreenReader(this._visibleOptionsCount > 0 ? `${this._visibleOptionsCount} option${this._visibleOptionsCount === 1 ? "" : "s"} available.` : "No results found.");
|
|
61
|
-
}), d(this.disconnecting)).subscribe(), this._optionSelect$.pipe(v(this._selectedValue$, this._selectedValues$), a(([e, t, s]) => {
|
|
62
|
-
if (this.multi) {
|
|
63
|
-
const n = s.indexOf(e.value), i = n > -1 ? [...s.slice(0, n), ...s.slice(n + 1)] : [...s, e.value];
|
|
64
|
-
this._selectedValues$.next(i), this._inputValue$.next(""), this._inputValue = "";
|
|
65
|
-
const l = this._getSelectedLabels();
|
|
66
|
-
this._announceToScreenReader(l.length > 0 ? `Selected: ${l.join(", ")}` : "No options selected");
|
|
67
|
-
} else this._selectedValue$.next(e.value), this._open$.next(!1), this._open = !1, this._inputValue = e.label || e.textContent || "", this._inputValue$.next(this._inputValue), _(100).pipe(a(() => this._inputElementRef.value?.blur()), b(1)).subscribe(), this._announceToScreenReader(`Selected: ${e.label || e.textContent}`);
|
|
68
|
-
}), a(() => this._fireChangeEvent()), d(this.disconnecting)).subscribe(), C([this._open$, this._selectedValue$, this._selectedValues$, this._options$]).pipe(m(() => !this._open$.value), a(([, e, t, s]) => {
|
|
69
|
-
if (this.multi) {
|
|
70
|
-
const n = s.filter((i) => t.includes(i.value)).map((i) => i.label || i.textContent || "");
|
|
71
|
-
this._inputValue = n.join(", ");
|
|
72
|
-
} else {
|
|
73
|
-
const n = s.find((i) => i.value === e);
|
|
74
|
-
this._inputValue = n && (n.label || n.textContent) || "";
|
|
75
|
-
}
|
|
76
|
-
this._inputValue$.next(this._inputValue);
|
|
77
|
-
}), d(this.disconnecting)).subscribe(), this._open$.pipe(a((e) => this._open = e), d(this.disconnecting)).subscribe();
|
|
78
|
-
}
|
|
79
|
-
_setupDocumentClickHandler() {
|
|
80
|
-
this._documentClick$.pipe(m((e) => !e.composedPath().includes(this)), m((e) => !this._options.some((t) => e.composedPath().includes(t))), m(() => this._open), a(() => {
|
|
81
|
-
this._open$.next(!1), this._updateInputDisplay();
|
|
82
|
-
}), d(this.disconnecting)).subscribe(), this._open$.pipe(S(), g((e) => e ? _(10).pipe(a(() => document.addEventListener("click", (t) => this._documentClick$.next(t))), g(() => O)) : R(null).pipe(a(() => document.removeEventListener("click", (t) => this._documentClick$.next(t))))), d(this.disconnecting)).subscribe();
|
|
83
|
-
}
|
|
84
|
-
_setupAutofillDetection() {
|
|
85
|
-
q(_(100, 500).pipe(b(10)), this._checkAutofill$, _(100).pipe(g(() => y(window, "load").pipe(z(null))))).pipe(E(() => {
|
|
86
|
-
const e = this._inputElementRef.value;
|
|
87
|
-
return e ? e.shadowRoot?.querySelector("input") || e.querySelector("input") || e._inputRef?.value : null;
|
|
88
|
-
}), m((e) => !!e), E((e) => e.value), m((e) => !!e && e.trim().length > 0), S(), v(this._options$), a(([e, t]) => {
|
|
89
|
-
let s = null, n = 0;
|
|
90
|
-
if (t.forEach((i) => {
|
|
91
|
-
const l = i.label || i.textContent || "", p = i.value, r = V(e, l), h = V(e, p), $ = Math.max(r, h);
|
|
92
|
-
$ > n && $ >= this.similarityThreshold && (n = $, s = i);
|
|
93
|
-
}), s) {
|
|
94
|
-
this.multi ? this._selectedValues$.next([s.value]) : this._selectedValue$.next(s.value);
|
|
95
|
-
const i = s.label || s.textContent || "";
|
|
96
|
-
this._inputValue = i, this._inputValue$.next(i);
|
|
97
|
-
const l = this._inputElementRef.value;
|
|
98
|
-
l && (l.value = i), this._open$.next(!1), this._fireChangeEvent(), this._announceToScreenReader(`Autofilled: ${i}`);
|
|
99
|
-
}
|
|
100
|
-
}), d(this.disconnecting)).subscribe(), _(100).pipe(E(() => {
|
|
101
|
-
const e = this._inputElementRef.value;
|
|
102
|
-
return e ? e.shadowRoot?.querySelector("input") || e.querySelector("input") || e._inputRef?.value : null;
|
|
103
|
-
}), m((e) => !!e), g((e) => y(e, "animationstart").pipe(m((t) => t.animationName === "onAutoFillStart"), a(() => {
|
|
104
|
-
_(100).pipe(a(() => this._checkAutofill$.next()), b(1)).subscribe();
|
|
105
|
-
}))), d(this.disconnecting)).subscribe();
|
|
106
|
-
}
|
|
107
|
-
_updateInputDisplay() {
|
|
108
|
-
R(null).pipe(v(this._selectedValue$, this._selectedValues$, this._options$, this._open$), a(([, e, t, s, n]) => {
|
|
109
|
-
if (this._inputElementRef.value && (!n || !this.multi)) {
|
|
110
|
-
if (this.multi) {
|
|
111
|
-
const i = s.filter((l) => t.includes(l.value)).map((l) => l.label || l.textContent || "");
|
|
112
|
-
this._inputValue = i.join(", ");
|
|
113
|
-
} else {
|
|
114
|
-
const i = s.find((l) => l.value === e);
|
|
115
|
-
this._inputValue = i && (i.label || i.textContent) || "";
|
|
116
|
-
}
|
|
117
|
-
this._inputValue$.next(this._inputValue), this._inputElementRef.value.value = this._inputValue;
|
|
118
|
-
}
|
|
119
|
-
}), b(1)).subscribe();
|
|
120
|
-
}
|
|
121
|
-
_getSelectedLabels() {
|
|
122
|
-
return this._options.filter((e) => this.multi ? this._selectedValues$.value.includes(e.value) : e.value === this._selectedValue$.value).map((e) => e.label || e.textContent || "");
|
|
123
|
-
}
|
|
124
|
-
_announceToScreenReader(e) {
|
|
125
|
-
const t = this.shadowRoot?.querySelector("#live-status");
|
|
126
|
-
t && (t.textContent = e);
|
|
127
|
-
}
|
|
128
|
-
_fireChangeEvent() {
|
|
129
|
-
const e = { value: this.value };
|
|
130
|
-
this.multi && (e.values = [...this._selectedValues$.value]), this.dispatchEvent(new CustomEvent("change", { detail: e, bubbles: !0, composed: !0 }));
|
|
131
|
-
}
|
|
132
|
-
checkValidity() {
|
|
133
|
-
return !this.required || (this.multi ? this._selectedValues$.value.length > 0 : !!this._selectedValue$.value);
|
|
134
|
-
}
|
|
135
|
-
reportValidity() {
|
|
136
|
-
return this._inputElementRef.value ? this._inputElementRef.value.reportValidity() : this.checkValidity();
|
|
137
|
-
}
|
|
138
|
-
firstUpdated() {
|
|
139
|
-
_(200).pipe(a(() => this._checkAutofill$.next()), b(1)).subscribe(), this._options$.pipe(m((e) => e.length > 0), a(() => this._checkAutofill$.next()), d(this.disconnecting)).subscribe();
|
|
140
|
-
}
|
|
141
|
-
render() {
|
|
142
|
-
const e = `${this.id}-desc`;
|
|
143
|
-
return w`
|
|
144
|
-
<div class="relative">
|
|
145
|
-
<!-- Screen reader live region -->
|
|
146
|
-
<div id="live-status" role="status" aria-live="polite" class="sr-only"></div>
|
|
147
|
-
|
|
148
|
-
<!-- Description -->
|
|
149
|
-
${this.description ? w`<div id="${e}" class="sr-only">${this.description}</div>` : ""}
|
|
150
|
-
|
|
151
|
-
<!-- Input -->
|
|
152
|
-
<slot name="trigger">
|
|
153
|
-
<schmancy-input
|
|
154
|
-
.size=${this.size}
|
|
155
|
-
${P(this._inputElementRef)}
|
|
156
|
-
id="autocomplete-input"
|
|
157
|
-
class="w-full"
|
|
158
|
-
.name=${this.name || this.label?.toLowerCase().replace(/\s+/g, "-")}
|
|
159
|
-
.label=${this.label}
|
|
160
|
-
.placeholder=${this.placeholder}
|
|
161
|
-
.required=${this.required}
|
|
162
|
-
.value=${this._inputValue}
|
|
163
|
-
type="text"
|
|
164
|
-
autocomplete=${this.autocomplete}
|
|
165
|
-
clickable
|
|
166
|
-
role="combobox"
|
|
167
|
-
aria-autocomplete="list"
|
|
168
|
-
aria-haspopup="listbox"
|
|
169
|
-
aria-controls="options"
|
|
170
|
-
aria-expanded=${this._open}
|
|
171
|
-
aria-describedby=${this.description ? e : void 0}
|
|
172
|
-
@input=${(t) => {
|
|
173
|
-
const s = t.target.value;
|
|
174
|
-
this._inputValue = s, this._inputValue$.next(s);
|
|
175
|
-
}}
|
|
176
|
-
@focus=${(t) => {
|
|
177
|
-
t.stopPropagation();
|
|
178
|
-
const s = this.multi ? this._selectedValues$.value.length > 0 : !!this._selectedValue$.value;
|
|
179
|
-
this.multi && !s && (this._inputValue = "", this._inputValue$.next(""), this._inputElementRef.value && (this._inputElementRef.value.value = "")), this._open$.next(!0);
|
|
180
|
-
}}
|
|
181
|
-
@click=${(t) => {
|
|
182
|
-
t.stopPropagation(), this._open$.next(!0);
|
|
183
|
-
}}
|
|
184
|
-
@keydown=${(t) => {
|
|
185
|
-
this._handleKeyDown(t);
|
|
186
|
-
}}
|
|
187
|
-
>
|
|
188
|
-
</schmancy-input>
|
|
189
|
-
</slot>
|
|
190
|
-
|
|
191
|
-
<!-- Options dropdown -->
|
|
192
|
-
<ul
|
|
193
|
-
id="options"
|
|
194
|
-
class=${T({ 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 })}
|
|
195
|
-
role="listbox"
|
|
196
|
-
aria-multiselectable=${this.multi ? "true" : "false"}
|
|
197
|
-
aria-label=${`${this.label || "Options"} dropdown`}
|
|
198
|
-
?hidden=${!this._open}
|
|
199
|
-
style="max-height: ${this.maxHeight}; display: ${this._open ? "flex" : "none"};"
|
|
200
|
-
@slotchange=${() => {
|
|
201
|
-
this._options$.next(this._options), _(100).pipe(a(() => this._checkAutofill$.next()), b(1)).subscribe();
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
<slot></slot>
|
|
205
|
-
${this._hasResults ? "" : w`
|
|
206
|
-
<li class="px-3 py-2 text-sm text-muted">No results found</li>
|
|
207
|
-
`}
|
|
208
|
-
</ul>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
<style>
|
|
212
|
-
:host {
|
|
213
|
-
display: block;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
@keyframes onAutoFillStart {
|
|
217
|
-
from {/**/}
|
|
218
|
-
to {/**/}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
sch-input::part(input):-webkit-autofill,
|
|
222
|
-
sch-input input:-webkit-autofill {
|
|
223
|
-
animation-name: onAutoFillStart;
|
|
224
|
-
animation-duration: 1ms;
|
|
225
|
-
}
|
|
226
|
-
</style>
|
|
227
|
-
`;
|
|
228
|
-
}
|
|
229
|
-
_handleKeyDown(e) {
|
|
230
|
-
y(document, "keydown").pipe(b(1), v(this._open$, this._options$), a(([t, s, n]) => {
|
|
231
|
-
if (!s && (t.key === "ArrowDown" || t.key === "Enter")) return t.preventDefault(), this._open$.next(!0), void _(10).pipe(a(() => {
|
|
232
|
-
n.find((h) => !h.hidden)?.focus();
|
|
233
|
-
}), b(1)).subscribe();
|
|
234
|
-
if (!s) return;
|
|
235
|
-
const i = n.filter((r) => !r.hidden).sort((r, h) => parseInt(r.style.order || "0") - parseInt(h.style.order || "0")), l = i.find((r) => r === document.activeElement), p = l ? i.indexOf(l) : -1;
|
|
236
|
-
switch (t.key) {
|
|
237
|
-
case "Escape":
|
|
238
|
-
t.preventDefault(), this._open$.next(!1), this._updateInputDisplay(), this._inputElementRef.value?.focus();
|
|
239
|
-
break;
|
|
240
|
-
case "Tab":
|
|
241
|
-
this._open$.next(!1), this._updateInputDisplay();
|
|
242
|
-
break;
|
|
243
|
-
case "ArrowDown":
|
|
244
|
-
t.preventDefault();
|
|
245
|
-
const r = p < i.length - 1 ? p + 1 : 0;
|
|
246
|
-
i[r]?.focus();
|
|
247
|
-
break;
|
|
248
|
-
case "ArrowUp":
|
|
249
|
-
t.preventDefault();
|
|
250
|
-
const h = p > 0 ? p - 1 : i.length - 1;
|
|
251
|
-
i[h]?.focus();
|
|
252
|
-
break;
|
|
253
|
-
case "Home":
|
|
254
|
-
t.preventDefault(), i[0]?.focus();
|
|
255
|
-
break;
|
|
256
|
-
case "End":
|
|
257
|
-
t.preventDefault(), i[i.length - 1]?.focus();
|
|
258
|
-
break;
|
|
259
|
-
case "Enter":
|
|
260
|
-
case " ":
|
|
261
|
-
l && (t.preventDefault(), this._optionSelect$.next(l));
|
|
262
|
-
}
|
|
263
|
-
})).subscribe();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
u([c({ type: Boolean })], o.prototype, "required", 2), u([c({ type: String })], o.prototype, "placeholder", 2), u([c({ type: String, reflect: !0 })], o.prototype, "label", 2), u([c({ type: String })], o.prototype, "name", 2), u([c({ type: String })], o.prototype, "maxHeight", 2), u([c({ type: Boolean })], o.prototype, "multi", 2), u([c({ type: String })], o.prototype, "description", 2), u([c({ type: String, reflect: !0 })], o.prototype, "size", 2), u([c({ type: String })], o.prototype, "autocomplete", 2), u([c({ type: Number })], o.prototype, "debounceMs", 2), u([c({ type: Number })], o.prototype, "similarityThreshold", 2), u([c({ type: Array })], o.prototype, "values", 1), u([c({ type: String, reflect: !0 })], o.prototype, "value", 1), u([x()], o.prototype, "_open", 2), u([x()], o.prototype, "_inputValue", 2), u([x()], o.prototype, "_visibleOptionsCount", 2), u([x()], o.prototype, "_hasResults", 2), u([A("#options")], o.prototype, "_listbox", 2), u([A("sch-input")], o.prototype, "_input", 2), u([L({ flatten: !0 })], o.prototype, "_options", 2), o = u([M("schmancy-autocomplete")], o);
|
|
267
|
-
//# sourceMappingURL=autocomplete-D52TZSRM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-D52TZSRM.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 merge,\n of,\n Subject,\n timer\n} from 'rxjs'\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n map,\n startWith,\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 private _checkAutofill$ = new Subject<void>()\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 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, 'click').pipe(\n tap(e => e.stopPropagation()),\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 private _setupAutofillDetection() {\n // Enhanced autofill detection with fuzzy matching\n merge(\n timer(100, 500).pipe(take(10)),\n this._checkAutofill$,\n timer(100).pipe(\n switchMap(() => \n fromEvent(window, 'load').pipe(startWith(null))\n )\n )\n ).pipe(\n map(() => {\n const schInput = this._inputElementRef.value\n if (!schInput) return null\n return schInput.shadowRoot?.querySelector('input') || \n schInput.querySelector('input') ||\n (schInput as any)._inputRef?.value\n }),\n filter(input => !!input),\n map(input => (input as HTMLInputElement).value),\n filter(value => !!value && value.trim().length > 0),\n distinctUntilChanged(),\n withLatestFrom(this._options$),\n tap(([autofilledValue, options]) => {\n console.log('Autofill detected:', autofilledValue)\n \n // Use fuzzy matching to find best matching option\n let bestMatch: SchmancyOption | null = null\n let bestScore = 0\n \n options.forEach(option => {\n const optionLabel = option.label || option.textContent || ''\n const optionValue = option.value\n \n // Calculate similarity scores\n const labelScore = similarity(autofilledValue, optionLabel)\n const valueScore = similarity(autofilledValue, optionValue)\n \n // Use the higher score\n const score = Math.max(labelScore, valueScore)\n \n // Keep track of best match\n if (score > bestScore && score >= this.similarityThreshold) {\n bestScore = score\n bestMatch = option\n }\n })\n\n if (bestMatch) {\n console.log('Found matching option:', bestMatch.value, 'with score:', bestScore)\n \n // Select the option\n if (this.multi) {\n this._selectedValues$.next([bestMatch.value])\n } else {\n this._selectedValue$.next(bestMatch.value)\n }\n \n // Update input to show the label\n const displayValue = bestMatch.label || bestMatch.textContent || ''\n this._inputValue = displayValue\n this._inputValue$.next(displayValue)\n \n // Update the actual input element\n const input = this._inputElementRef.value\n if (input) {\n input.value = displayValue\n }\n \n // Close dropdown if open\n this._open$.next(false)\n \n // Fire change event\n this._fireChangeEvent()\n \n // Announce to screen reader\n this._announceToScreenReader(`Autofilled: ${displayValue}`)\n }\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\n\n // Chrome autofill animation detection\n timer(100).pipe(\n map(() => {\n const schInput = this._inputElementRef.value\n if (!schInput) return null\n return schInput.shadowRoot?.querySelector('input') || \n schInput.querySelector('input') ||\n (schInput as any)._inputRef?.value\n }),\n filter(input => !!input),\n switchMap(input => {\n return fromEvent<AnimationEvent>(input!, 'animationstart').pipe(\n filter(e => e.animationName === 'onAutoFillStart'),\n tap(() => {\n console.log('Chrome autofill animation detected')\n timer(100).pipe(\n tap(() => this._checkAutofill$.next()),\n take(1)\n ).subscribe()\n })\n )\n }),\n takeUntil(this.disconnecting)\n ).subscribe()\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 timer(200).pipe(\n tap(() => this._checkAutofill$.next()),\n take(1)\n ).subscribe()\n \n this._options$.pipe(\n filter(options => options.length > 0),\n tap(() => this._checkAutofill$.next()),\n takeUntil(this.disconnecting)\n ).subscribe()\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 >\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 timer(100).pipe(\n tap(() => this._checkAutofill$.next()),\n take(1)\n ).subscribe()\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 <style>\n :host {\n display: block;\n }\n\n @keyframes onAutoFillStart {\n from {/**/}\n to {/**/}\n }\n\n sch-input::part(input):-webkit-autofill,\n sch-input input:-webkit-autofill {\n animation-name: onAutoFillStart;\n animation-duration: 1ms;\n }\n </style>\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$","_checkAutofill$","value","vals","next","Array","isArray","join","val","split","map","v","trim","filter","Boolean","connectedCallback","id","Math","random","toString","slice","_setupAutocompleteLogic","_setupDocumentClickHandler","_setupAutofillDetection","pipe","tap","options","forEach","option","index","setAttribute","tabIndex","hasAttribute","fromEvent","e","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","merge","window","startWith","schInput","shadowRoot","querySelector","_inputRef","input","autofilledValue","bestMatch","bestScore","displayValue","animationName","message","liveRegion","detail","values","dispatchEvent","CustomEvent","bubbles","composed","checkValidity","reportValidity","firstUpdated","render","descriptionId","html","ref","toLowerCase","replace","target","hasSelection","_handleKeyDown","classMap","absolute","flex","_e","event","key","preventDefault","firstVisible","focus","visibleOptions","parseInt","focusedOption","activeElement","currentIndex","nextIndex","prevIndex","__decorateClass","property","type","prototype","reflect","Number","state","query","queryAssignedElements","flatten","customElement"],"mappings":";;;;;;;;;;;;;;AA6CA,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,YACRZ,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,KAC9BzB,KAAQ2B,kBAAkB,IAAIF;AAAAA,EAAc;AAAA,EA5C5C,IAAA;AACI,WAAO,CAAA,GAAIzB,KAAKoB,iBAAiBQ,KAAAA;AAAAA,EAAK;AAAA,EAE1C,IAAA,OAAWC;AACP7B,SAAKoB,iBAAiBU,KAAKC,MAAMC,QAAQH,CAAAA,IAAQ,CAAA,GAAIA,CAAAA,IAAQ,CAAA,CAAA;AAAA,EAAE;AAAA,EAKnE,IAAA,QAAID;AACA,WAAO5B,KAAKM,QAC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AEC,MAAMpG,QAAQsG,YAAS,CAAA,CAAA,GAxBlBjL,EAyBbgL,WAAA,SAAA,CAAA,GAgBaH,EAAA,CAAhBM,EAAAA,CAAAA,GAzCgBnL,EAyCAgL,WAAA,SAAA,IACAH,EAAA,CAAhBM,MA1CgBnL,EA0CAgL,WAAA,eAAA,CAAA,GACAH,EAAA,CAAhBM,EAAAA,CAAAA,GA3CgBnL,EA2CAgL,WAAA,wBAAA,CAAA,GACAH,EAAA,CAAhBM,EAAAA,CAAAA,GA5CgBnL,EA4CAgL,WAAA,eAAA,IAGEH,EAAA,CAAlBO,EAAM,UAAA,CAAA,GA/CUpL,EA+CEgL,WAAA,YAAA,CAAA,GACCH,EAAA,CAAnBO,EAAM,eAhDUpL,EAgDGgL,WAAA,UAAA,CAAA,GAC8BH,EAAA,CAAjDQ,EAAsB,EAAEC,YAAS,CAAA,CAAA,GAjDjBtL,EAiDiCgL,WAAA,YAAA,CAAA,GAjDjChL,IAArB6K,EAAA,CADCU,EAAc,uBAAA,CAAA,GACMvL,CAAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button-BEmjBwBq.js","sources":["../src/button/button.ts","../src/button/icon-button.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { when } from 'lit/directives/when.js'\n\nexport interface SchmancyButtonEventMap {\n\tSchmancyFocus: CustomEvent<void>\n\tSchmancyBlur: CustomEvent<void>\n}\n\nexport type ButtonVariant = 'elevated' | 'filled' | 'filled tonal' | 'outlined' | 'text'\n\n/**\n * A button component.\n * @element schmancy-button\n * @slot - The default slot.\n * @slot prefix - The prefix slot.\n * @slot suffix - The suffix slot.\n */\n@customElement('schmancy-button')\nexport class SchmancyButton extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t}\n`) {\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tmode: 'open',\n\t\tdelegatesFocus: true,\n\t}\n\n\t@query('[part=\"base\"]', true)\n\tprivate nativeElement!: HTMLElement\n\n\tprivate _ariaLabel!: string\n\n\t/**\n\t * The variant of the button.\n\t * @attr\n\t * @default 'text'\n\t * @public\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic variant: ButtonVariant = 'text'\n\n\t/**\n\t * The width of the button.\n\t * @attr\n\t * @type {'full' | 'auto'}\n\t * @default 'auto'\n\t * @public\n\t */\n\t@property()\n\tpublic width: 'full' | 'auto' = 'auto'\n\n\t/**\n\t * The type of the button.\n\t * Defaults to 'button' (preventing accidental form submissions).\n\t * @attr\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic type: 'button' | 'reset' | 'submit' = 'button'\n\n\t/**\n\t * The URL the button points to.\n\t * If provided, the component will render as an anchor element.\n\t * @attr\n\t */\n\t@property()\n\tpublic href?: string\n\n\t/**\n\t * Determines whether the button is disabled.\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tpublic disabled = false\n\n\tpublic override set ariaLabel(value: string) {\n\t\tconst oldVal = this._ariaLabel\n\t\tthis._ariaLabel = value\n\n\t\tif (this.hasAttribute('aria-label')) {\n\t\t\tthis.removeAttribute('aria-label')\n\t\t}\n\t\tthis.requestUpdate('ariaLabel', oldVal)\n\t}\n\n\t@property({ attribute: 'aria-label' })\n\tpublic override get ariaLabel() {\n\t\treturn this._ariaLabel\n\t}\n\n\t@queryAssignedElements({\n\t\tslot: 'prefix',\n\t\tflatten: true,\n\t\tselector: 'img',\n\t})\n\tprivate prefixImgs!: HTMLImageElement[]\n\n\t@queryAssignedElements({\n\t\tslot: 'suffix',\n\t\tflatten: true,\n\t\tselector: 'img',\n\t})\n\tprivate suffixImgs!: HTMLImageElement[]\n\n\t/** Sets focus in the button. */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.nativeElement.focus(options)\n\t}\n\n\t/** Removes focus from the button. */\n\tpublic override blur() {\n\t\tthis.nativeElement.blur()\n\t}\n\n\tprotected get imgClasses(): string[] {\n\t\treturn ['max-h-[24px]', 'max-w-[24px]', 'object-contain']\n\t}\n\n\tfirstUpdated() {\n\t\t// Add image classes and ensure decorative images have an empty alt.\n\t\tthis.prefixImgs?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t\tif (!img.hasAttribute('alt')) {\n\t\t\t\timg.setAttribute('alt', '')\n\t\t\t}\n\t\t})\n\t\tthis.suffixImgs?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t\tif (!img.hasAttribute('alt')) {\n\t\t\t\timg.setAttribute('alt', '')\n\t\t\t}\n\t\t})\n\t}\n\n\tclick(): void {\n\t\tthis.dispatchEvent(new Event('click', { bubbles: true, composed: true }))\n\t}\n\n\t// Prevent default behavior when the component is disabled.\n\tprivate _preventDefault(event: Event) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\trender() {\n\t\t// Compute classes for the interactive element.\n\t\tconst classes = {\n\t\t\t'z-0 py-[8px] px-[16px] transition-all duration-200 relative rounded-full inline-flex justify-center items-center gap-[8px] outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'cursor-pointer': !this.disabled,\n\t\t\t'opacity-[0.38]': this.disabled,\n\t\t\t'hover:shadow-xs':\n\t\t\t\t!this.disabled &&\n\t\t\t\t(this.variant === 'outlined' ||\n\t\t\t\t\tthis.variant === 'text' ||\n\t\t\t\t\tthis.variant === 'filled' ||\n\t\t\t\t\tthis.variant === 'filled tonal'),\n\t\t\t'hover:shadow-sm': !this.disabled && this.variant === 'elevated',\n\t\t\t'w-full tex-center': this.width === 'full',\n\t\t\t'bg-surface-low text-primary-default shadow-xs': this.variant === 'elevated',\n\t\t\t'bg-transparent text-primary-default border-1 border-solid border-outline': this.variant === 'outlined',\n\t\t\t'bg-primary-default text-primary-on': this.variant === 'filled',\n\t\t\t'bg-secondary-container text-secondary-onContainer': this.variant === 'filled tonal',\n\t\t\t'text-primary-default': this.variant === 'text',\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'absolute inset-0 hover:opacity-[0.08] z-0 rounded-full': true,\n\t\t\t'hover:bg-primary-on': this.variant === 'filled',\n\t\t\t'hover:bg-primary-default': this.variant === 'outlined' || this.variant === 'elevated' || this.variant === 'text',\n\t\t\t'hover:bg-secondary-container': this.variant === 'filled tonal',\n\t\t}\n\n\t\t// If href is provided, render an anchor element.\n\t\tif (this.href) {\n\t\t\treturn html`\n\t\t\t\t<a\n\t\t\t\t\tpart=\"base\"\n\t\t\t\t\thref=${ifDefined(this.disabled ? undefined : this.href)}\n\t\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\t\ttabindex=${this.disabled ? '-1' : '0'}\n\t\t\t\t\taria-disabled=${this.disabled}\n\t\t\t\t\t@click=${this.disabled ? this._preventDefault : undefined}\n\t\t\t\t>\n\t\t\t\t\t${when(!this.disabled, () => html`<div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t\t<slot name=\"prefix\"></slot>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t\t<slot name=\"suffix\"></slot>\n\t\t\t\t</a>\n\t\t\t`\n\t\t}\n\n\t\t// Otherwise, render a native button element.\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tpart=\"base\"\n\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\ttype=${ifDefined(this.type)}\n\t\t\t\ttabindex=${ifDefined(this.disabled ? '-1' : undefined)}\n\t\t\t>\n\t\t\t\t${when(!this.disabled, () => html`<div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t<slot name=\"prefix\"></slot>\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"suffix\"></slot>\n\t\t\t</button>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-button': SchmancyButton\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { css, html, LitElement, PropertyValueMap } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { when } from 'lit/directives/when.js'\nimport { ButtonVariant } from './button'\n\n/**\n * An icon button component.\n * @element schmancy-icon-button\n * @slot - The default slot.\n */\n@customElement('schmancy-icon-button')\nexport class SchmnacyIconButton extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t}\n`) {\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tmode: 'open',\n\t\tdelegatesFocus: true,\n\t}\n\n\t@query('[part=\"base\"]', true)\n\tprivate nativeElement!: HTMLElement\n\n\tprivate _ariaLabel!: string\n\n\t/**\n\t * The size of the icon.\n\t * @attr\n\t * @default 'md'\n\t */\n\t@property({ type: String })\n\tpublic size: 'sm' | 'md' | 'lg' = 'md'\n\n\t/**\n\t * The variant of the button.\n\t * @attr\n\t * @default 'text'\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic variant: ButtonVariant = 'text'\n\n\t/**\n\t * The width of the button.\n\t * @attr\n\t * @type {'full' | 'auto'}\n\t * @default 'auto'\n\t */\n\t@property()\n\tpublic width: 'full' | 'auto' = 'auto'\n\n\t/**\n\t * The type of the button.\n\t * Defaults to 'button' (preventing accidental form submissions).\n\t * @attr\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic type: 'button' | 'reset' | 'submit' = 'button'\n\n\t/**\n\t * The URL the button points to.\n\t * If provided, the component will render as an anchor element.\n\t * @attr\n\t */\n\t@property()\n\tpublic href?: string\n\n\t/**\n\t * Determines whether the button is disabled.\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tpublic disabled = false\n\n\t// Manage aria-label manually so that we can always use our internal property.\n\tpublic override set ariaLabel(value: string) {\n\t\tconst oldVal = this._ariaLabel\n\t\tthis._ariaLabel = value\n\n\t\tif (this.hasAttribute('aria-label')) {\n\t\t\tthis.removeAttribute('aria-label')\n\t\t}\n\t\tthis.requestUpdate('ariaLabel', oldVal)\n\t}\n\n\t@property({ attribute: 'aria-label' })\n\tpublic override get ariaLabel() {\n\t\treturn this._ariaLabel\n\t}\n\n\t/** Sets focus in the button. */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.nativeElement.focus(options)\n\t}\n\n\t/** Removes focus from the button. */\n\tpublic override blur() {\n\t\tthis.nativeElement.blur()\n\t}\n\n\tclick(): void {\n\t\tthis.dispatchEvent(new Event('click', { bubbles: true, composed: true }))\n\t}\n\n\t// Prevent default behavior when the component is disabled.\n\tprivate _preventDefault(event: Event) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n\t\t// Add any first-update logic here if needed.\n\t}\n\n\trender() {\n\t\t// Compute classes for the interactive element.\n\t\tconst classes = {\n\t\t\t'z-0 h-full transition-all duration-200 relative rounded-full inline-flex justify-center items-center gap-[8px] outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'opacity-[0.38]': this.disabled,\n\t\t\t'cursor-pointer': !this.disabled,\n\t\t\t'hover:shadow-xs':\n\t\t\t\t!this.disabled &&\n\t\t\t\t(this.variant === 'outlined' ||\n\t\t\t\t\tthis.variant === 'text' ||\n\t\t\t\t\tthis.variant === 'filled' ||\n\t\t\t\t\tthis.variant === 'filled tonal'),\n\t\t\t'hover:shadow-sm': !this.disabled && this.variant === 'elevated',\n\t\t\t'w-full text-center': this.width === 'full',\n\t\t\t'bg-surface-low text-primary-default shadow-xs': this.variant === 'elevated',\n\t\t\t'bg-transparent text-primary-default border-1 border-outline': this.variant === 'outlined',\n\t\t\t'bg-primary-default text-primary-on': this.variant === 'filled',\n\t\t\t'bg-secondary-container text-secondary-onContainer': this.variant === 'filled tonal',\n\t\t\t'text-primary-default': this.variant === 'text',\n\t\t\t'px-[6px] py-[6px]': this.size === 'sm',\n\t\t\t'px-[8px] py-[8px]': this.size === 'md',\n\t\t\t'px-[12px] py-[12px]': this.size === 'lg',\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'hover:opacity-[0.08] rounded-full z-0': true,\n\t\t\t'hover:bg-primary-on': this.variant === 'filled',\n\t\t\t'hover:bg-primary-default': this.variant === 'outlined' || this.variant === 'elevated' || this.variant === 'text',\n\t\t\t'hover:bg-secondary-container': this.variant === 'filled tonal',\n\t\t}\n\n\t\t// If href is provided, render an anchor element.\n\t\tif (this.href) {\n\t\t\treturn html`\n\t\t\t\t<a\n\t\t\t\t\tpart=\"base\"\n\t\t\t\t\thref=${ifDefined(this.disabled ? undefined : this.href)}\n\t\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\t\ttabindex=${this.disabled ? '-1' : '0'}\n\t\t\t\t\taria-disabled=${this.disabled}\n\t\t\t\t\t@click=${this.disabled ? this._preventDefault : undefined}\n\t\t\t\t>\n\t\t\t\t\t${when(!this.disabled, () => html`<div class=\"absolute inset-0 ${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t\t<schmancy-icon size=${this.size === 'sm' ? '18px' : this.size === 'md' ? '24px' : '32px'}>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-icon>\n\t\t\t\t</a>\n\t\t\t`\n\t\t}\n\n\t\t// Otherwise, render a native button element.\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tpart=\"base\"\n\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\ttype=${ifDefined(this.type)}\n\t\t\t\ttabindex=${ifDefined(this.disabled ? '-1' : undefined)}\n\t\t\t>\n\t\t\t\t${when(!this.disabled, () => html`<div class=\"absolute inset-0 ${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t<schmancy-icon size=${this.size === 'sm' ? '18px' : this.size === 'md' ? '24px' : '32px'}>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</schmancy-icon>\n\t\t\t</button>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-icon-button': SchmnacyIconButton\n\t}\n}\n"],"names":["SchmancyButton","$LitElement","css","constructor","super","arguments","this","variant","width","type","disabled","value","oldVal","_ariaLabel","hasAttribute","removeAttribute","requestUpdate","ariaLabel","options","nativeElement","focus","blur","imgClasses","prefixImgs","forEach","img","classList","add","setAttribute","suffixImgs","click","dispatchEvent","Event","bubbles","composed","event","preventDefault","stopPropagation","render","classes","stateLayerClasses","href","html","ifDefined","classMap","_preventDefault","when","shadowRootOptions","LitElement","mode","delegatesFocus","__decorateClass","query","prototype","property","reflect","String","Boolean","attribute","queryAssignedElements","slot","flatten","selector","customElement","SchmnacyIconButton","size","_changedProperties"],"mappings":";;;;;;;;;;;;;AAqBO,IAAMA,IAAN,cAA6BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;EAAzC,cAAAC;AAAAC,aAAAC,SAAAA,GAuBNC,KAAOC,UAAyB,QAUhCD,KAAOE,QAAyB,QAQhCF,KAAOG,OAAsC,UAe7CH,KAAOI,WAAAA;AAAAA,EAAW;AAAA,EAElB,IAAA,UAA8BC,GAAAA;AAC7B,UAAMC,IAASN,KAAKO;AACpBP,SAAKO,aAAaF,GAEdL,KAAKQ,aAAa,YAAA,KACrBR,KAAKS,gBAAgB,YAAA,GAEtBT,KAAKU,cAAc,aAAaJ,CAAAA;AAAAA,EACjC;AAAA,EAGA,gBAAoBK;AACnB,WAAOX,KAAKO;AAAAA,EACb;AAAA,EAiBgB,M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AAAA,IAAe9C,MAAM+C,OAAAA,CAAAA,CAAAA,GA9CrBQ,EA+CLX,WAAA,QAAA,CAAA,GAQAF,EAAA,CADNG,EAAAA,CAAAA,GAtDWU,EAuDLX,WAAA,QAAA,IAOAF,EAAA,CADNG,EAAS,EAAE7C,MAAMgD,SAASF,SAAAA,GAAS,CAAA,CAAA,GA7DxBS,EA8DLX,WAAA,YAAA,IAcaF,EAAA,CADnBG,EAAS,EAAEI,WAAW,kBA3EXM,EA4EQX,WAAA,aAAA,CAAA,GA5ERW,IAANb,EAAA,CADNY,EAAc,sBAAA,CAAA,GACFC,CAAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button-tVZLMjEJ.cjs","sources":["../src/button/button.ts","../src/button/icon-button.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { when } from 'lit/directives/when.js'\n\nexport interface SchmancyButtonEventMap {\n\tSchmancyFocus: CustomEvent<void>\n\tSchmancyBlur: CustomEvent<void>\n}\n\nexport type ButtonVariant = 'elevated' | 'filled' | 'filled tonal' | 'outlined' | 'text'\n\n/**\n * A button component.\n * @element schmancy-button\n * @slot - The default slot.\n * @slot prefix - The prefix slot.\n * @slot suffix - The suffix slot.\n */\n@customElement('schmancy-button')\nexport class SchmancyButton extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t}\n`) {\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tmode: 'open',\n\t\tdelegatesFocus: true,\n\t}\n\n\t@query('[part=\"base\"]', true)\n\tprivate nativeElement!: HTMLElement\n\n\tprivate _ariaLabel!: string\n\n\t/**\n\t * The variant of the button.\n\t * @attr\n\t * @default 'text'\n\t * @public\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic variant: ButtonVariant = 'text'\n\n\t/**\n\t * The width of the button.\n\t * @attr\n\t * @type {'full' | 'auto'}\n\t * @default 'auto'\n\t * @public\n\t */\n\t@property()\n\tpublic width: 'full' | 'auto' = 'auto'\n\n\t/**\n\t * The type of the button.\n\t * Defaults to 'button' (preventing accidental form submissions).\n\t * @attr\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic type: 'button' | 'reset' | 'submit' = 'button'\n\n\t/**\n\t * The URL the button points to.\n\t * If provided, the component will render as an anchor element.\n\t * @attr\n\t */\n\t@property()\n\tpublic href?: string\n\n\t/**\n\t * Determines whether the button is disabled.\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tpublic disabled = false\n\n\tpublic override set ariaLabel(value: string) {\n\t\tconst oldVal = this._ariaLabel\n\t\tthis._ariaLabel = value\n\n\t\tif (this.hasAttribute('aria-label')) {\n\t\t\tthis.removeAttribute('aria-label')\n\t\t}\n\t\tthis.requestUpdate('ariaLabel', oldVal)\n\t}\n\n\t@property({ attribute: 'aria-label' })\n\tpublic override get ariaLabel() {\n\t\treturn this._ariaLabel\n\t}\n\n\t@queryAssignedElements({\n\t\tslot: 'prefix',\n\t\tflatten: true,\n\t\tselector: 'img',\n\t})\n\tprivate prefixImgs!: HTMLImageElement[]\n\n\t@queryAssignedElements({\n\t\tslot: 'suffix',\n\t\tflatten: true,\n\t\tselector: 'img',\n\t})\n\tprivate suffixImgs!: HTMLImageElement[]\n\n\t/** Sets focus in the button. */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.nativeElement.focus(options)\n\t}\n\n\t/** Removes focus from the button. */\n\tpublic override blur() {\n\t\tthis.nativeElement.blur()\n\t}\n\n\tprotected get imgClasses(): string[] {\n\t\treturn ['max-h-[24px]', 'max-w-[24px]', 'object-contain']\n\t}\n\n\tfirstUpdated() {\n\t\t// Add image classes and ensure decorative images have an empty alt.\n\t\tthis.prefixImgs?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t\tif (!img.hasAttribute('alt')) {\n\t\t\t\timg.setAttribute('alt', '')\n\t\t\t}\n\t\t})\n\t\tthis.suffixImgs?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t\tif (!img.hasAttribute('alt')) {\n\t\t\t\timg.setAttribute('alt', '')\n\t\t\t}\n\t\t})\n\t}\n\n\tclick(): void {\n\t\tthis.dispatchEvent(new Event('click', { bubbles: true, composed: true }))\n\t}\n\n\t// Prevent default behavior when the component is disabled.\n\tprivate _preventDefault(event: Event) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\trender() {\n\t\t// Compute classes for the interactive element.\n\t\tconst classes = {\n\t\t\t'z-0 py-[8px] px-[16px] transition-all duration-200 relative rounded-full inline-flex justify-center items-center gap-[8px] outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'cursor-pointer': !this.disabled,\n\t\t\t'opacity-[0.38]': this.disabled,\n\t\t\t'hover:shadow-xs':\n\t\t\t\t!this.disabled &&\n\t\t\t\t(this.variant === 'outlined' ||\n\t\t\t\t\tthis.variant === 'text' ||\n\t\t\t\t\tthis.variant === 'filled' ||\n\t\t\t\t\tthis.variant === 'filled tonal'),\n\t\t\t'hover:shadow-sm': !this.disabled && this.variant === 'elevated',\n\t\t\t'w-full tex-center': this.width === 'full',\n\t\t\t'bg-surface-low text-primary-default shadow-xs': this.variant === 'elevated',\n\t\t\t'bg-transparent text-primary-default border-1 border-solid border-outline': this.variant === 'outlined',\n\t\t\t'bg-primary-default text-primary-on': this.variant === 'filled',\n\t\t\t'bg-secondary-container text-secondary-onContainer': this.variant === 'filled tonal',\n\t\t\t'text-primary-default': this.variant === 'text',\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'absolute inset-0 hover:opacity-[0.08] z-0 rounded-full': true,\n\t\t\t'hover:bg-primary-on': this.variant === 'filled',\n\t\t\t'hover:bg-primary-default': this.variant === 'outlined' || this.variant === 'elevated' || this.variant === 'text',\n\t\t\t'hover:bg-secondary-container': this.variant === 'filled tonal',\n\t\t}\n\n\t\t// If href is provided, render an anchor element.\n\t\tif (this.href) {\n\t\t\treturn html`\n\t\t\t\t<a\n\t\t\t\t\tpart=\"base\"\n\t\t\t\t\thref=${ifDefined(this.disabled ? undefined : this.href)}\n\t\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\t\ttabindex=${this.disabled ? '-1' : '0'}\n\t\t\t\t\taria-disabled=${this.disabled}\n\t\t\t\t\t@click=${this.disabled ? this._preventDefault : undefined}\n\t\t\t\t>\n\t\t\t\t\t${when(!this.disabled, () => html`<div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t\t<slot name=\"prefix\"></slot>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t\t<slot name=\"suffix\"></slot>\n\t\t\t\t</a>\n\t\t\t`\n\t\t}\n\n\t\t// Otherwise, render a native button element.\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tpart=\"base\"\n\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\ttype=${ifDefined(this.type)}\n\t\t\t\ttabindex=${ifDefined(this.disabled ? '-1' : undefined)}\n\t\t\t>\n\t\t\t\t${when(!this.disabled, () => html`<div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t<slot name=\"prefix\"></slot>\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"suffix\"></slot>\n\t\t\t</button>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-button': SchmancyButton\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { css, html, LitElement, PropertyValueMap } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { when } from 'lit/directives/when.js'\nimport { ButtonVariant } from './button'\n\n/**\n * An icon button component.\n * @element schmancy-icon-button\n * @slot - The default slot.\n */\n@customElement('schmancy-icon-button')\nexport class SchmnacyIconButton extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t}\n`) {\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tmode: 'open',\n\t\tdelegatesFocus: true,\n\t}\n\n\t@query('[part=\"base\"]', true)\n\tprivate nativeElement!: HTMLElement\n\n\tprivate _ariaLabel!: string\n\n\t/**\n\t * The size of the icon.\n\t * @attr\n\t * @default 'md'\n\t */\n\t@property({ type: String })\n\tpublic size: 'sm' | 'md' | 'lg' = 'md'\n\n\t/**\n\t * The variant of the button.\n\t * @attr\n\t * @default 'text'\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic variant: ButtonVariant = 'text'\n\n\t/**\n\t * The width of the button.\n\t * @attr\n\t * @type {'full' | 'auto'}\n\t * @default 'auto'\n\t */\n\t@property()\n\tpublic width: 'full' | 'auto' = 'auto'\n\n\t/**\n\t * The type of the button.\n\t * Defaults to 'button' (preventing accidental form submissions).\n\t * @attr\n\t */\n\t@property({ reflect: true, type: String })\n\tpublic type: 'button' | 'reset' | 'submit' = 'button'\n\n\t/**\n\t * The URL the button points to.\n\t * If provided, the component will render as an anchor element.\n\t * @attr\n\t */\n\t@property()\n\tpublic href?: string\n\n\t/**\n\t * Determines whether the button is disabled.\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tpublic disabled = false\n\n\t// Manage aria-label manually so that we can always use our internal property.\n\tpublic override set ariaLabel(value: string) {\n\t\tconst oldVal = this._ariaLabel\n\t\tthis._ariaLabel = value\n\n\t\tif (this.hasAttribute('aria-label')) {\n\t\t\tthis.removeAttribute('aria-label')\n\t\t}\n\t\tthis.requestUpdate('ariaLabel', oldVal)\n\t}\n\n\t@property({ attribute: 'aria-label' })\n\tpublic override get ariaLabel() {\n\t\treturn this._ariaLabel\n\t}\n\n\t/** Sets focus in the button. */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.nativeElement.focus(options)\n\t}\n\n\t/** Removes focus from the button. */\n\tpublic override blur() {\n\t\tthis.nativeElement.blur()\n\t}\n\n\tclick(): void {\n\t\tthis.dispatchEvent(new Event('click', { bubbles: true, composed: true }))\n\t}\n\n\t// Prevent default behavior when the component is disabled.\n\tprivate _preventDefault(event: Event) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n\t\t// Add any first-update logic here if needed.\n\t}\n\n\trender() {\n\t\t// Compute classes for the interactive element.\n\t\tconst classes = {\n\t\t\t'z-0 h-full transition-all duration-200 relative rounded-full inline-flex justify-center items-center gap-[8px] outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'opacity-[0.38]': this.disabled,\n\t\t\t'cursor-pointer': !this.disabled,\n\t\t\t'hover:shadow-xs':\n\t\t\t\t!this.disabled &&\n\t\t\t\t(this.variant === 'outlined' ||\n\t\t\t\t\tthis.variant === 'text' ||\n\t\t\t\t\tthis.variant === 'filled' ||\n\t\t\t\t\tthis.variant === 'filled tonal'),\n\t\t\t'hover:shadow-sm': !this.disabled && this.variant === 'elevated',\n\t\t\t'w-full text-center': this.width === 'full',\n\t\t\t'bg-surface-low text-primary-default shadow-xs': this.variant === 'elevated',\n\t\t\t'bg-transparent text-primary-default border-1 border-outline': this.variant === 'outlined',\n\t\t\t'bg-primary-default text-primary-on': this.variant === 'filled',\n\t\t\t'bg-secondary-container text-secondary-onContainer': this.variant === 'filled tonal',\n\t\t\t'text-primary-default': this.variant === 'text',\n\t\t\t'px-[6px] py-[6px]': this.size === 'sm',\n\t\t\t'px-[8px] py-[8px]': this.size === 'md',\n\t\t\t'px-[12px] py-[12px]': this.size === 'lg',\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'hover:opacity-[0.08] rounded-full z-0': true,\n\t\t\t'hover:bg-primary-on': this.variant === 'filled',\n\t\t\t'hover:bg-primary-default': this.variant === 'outlined' || this.variant === 'elevated' || this.variant === 'text',\n\t\t\t'hover:bg-secondary-container': this.variant === 'filled tonal',\n\t\t}\n\n\t\t// If href is provided, render an anchor element.\n\t\tif (this.href) {\n\t\t\treturn html`\n\t\t\t\t<a\n\t\t\t\t\tpart=\"base\"\n\t\t\t\t\thref=${ifDefined(this.disabled ? undefined : this.href)}\n\t\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\t\ttabindex=${this.disabled ? '-1' : '0'}\n\t\t\t\t\taria-disabled=${this.disabled}\n\t\t\t\t\t@click=${this.disabled ? this._preventDefault : undefined}\n\t\t\t\t>\n\t\t\t\t\t${when(!this.disabled, () => html`<div class=\"absolute inset-0 ${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t\t<schmancy-icon size=${this.size === 'sm' ? '18px' : this.size === 'md' ? '24px' : '32px'}>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-icon>\n\t\t\t\t</a>\n\t\t\t`\n\t\t}\n\n\t\t// Otherwise, render a native button element.\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tpart=\"base\"\n\t\t\t\taria-label=${ifDefined(this.ariaLabel)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\ttype=${ifDefined(this.type)}\n\t\t\t\ttabindex=${ifDefined(this.disabled ? '-1' : undefined)}\n\t\t\t>\n\t\t\t\t${when(!this.disabled, () => html`<div class=\"absolute inset-0 ${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t\t<schmancy-icon size=${this.size === 'sm' ? '18px' : this.size === 'md' ? '24px' : '32px'}>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</schmancy-icon>\n\t\t\t</button>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-icon-button': SchmnacyIconButton\n\t}\n}\n"],"names":["SchmancyButton","$LitElement","css","constructor","super","arguments","this","variant","width","type","disabled","value","oldVal","_ariaLabel","hasAttribute","removeAttribute","requestUpdate","ariaLabel","options","nativeElement","focus","blur","imgClasses","prefixImgs","forEach","img","classList","add","setAttribute","suffixImgs","click","dispatchEvent","Event","bubbles","composed","event","preventDefault","stopPropagation","render","classes","stateLayerClasses","href","html","ifDefined","classMap","_preventDefault","when","shadowRootOptions","LitElement","mode","delegatesFocus","__decorateClass","query","prototype","property","reflect","String","Boolean","attribute","queryAssignedElements","slot","flatten","selector","customElement","SchmnacyIconButton","size","_changedProperties"],"mappings":"2gBAqBaA,QAAAA,eAAN,cAA6BC,EAAAA,YAAYC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA,GAAzC,aAAAC,CAAAC,SAAAC,SAAAA,EAuBNC,KAAOC,QAAyB,OAUhCD,KAAOE,MAAyB,OAQhCF,KAAOG,KAAsC,SAe7CH,KAAOI,SAAAA,EAAW,CAElB,IAAA,UAA8BC,EAAAA,CAC7B,MAAMC,EAASN,KAAKO,WACpBP,KAAKO,WAAaF,EAEdL,KAAKQ,aAAa,YAAA,GACrBR,KAAKS,gBAAgB,YAAA,EAEtBT,KAAKU,cAAc,YAAaJ,CAAAA,CACjC,CAGA,eAAoBK,CACnB,OAAOX,KAAKO,UACb,CAiBgB,MAAMK,EAAAA,CACrBZ,KAAKa,cAAcC,MAAMF,CAAAA,CAC1B,CAGgB,MAAAG,CACff,KAAKa,cAAcE,KAAAA,CACpB,CAEA,IAAA,YAAcC,CACb,MAAO,CAAC,eAAgB,eAAgB,iBACzC,CAEA,eAEChB,KAAKiB,YAAYC,QAAQC,GAAAA,CACxBA,EAAIC,UAAUC,IAAAA,GAAOrB,KAAKgB,UAAAA,EACrBG,EAAIX,aAAa,KAAA,GACrBW,EAAIG,a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