@cal.macconnachie/web-components 0.0.20 → 1.0.1
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/README.md +3 -0
- package/dist/components/{auth.js → auth-form.js} +689 -805
- package/dist/components/base-button.js +894 -0
- package/dist/components/base-card.js +879 -0
- package/dist/components/base-date-picker.js +1458 -0
- package/dist/components/base-datetime-picker.js +1697 -0
- package/dist/components/base-drawer.js +1300 -0
- package/dist/components/base-input.js +883 -0
- package/dist/components/base-select.js +1076 -0
- package/dist/components/base-tab.js +653 -0
- package/dist/components/base-tabs.js +1246 -0
- package/dist/components/base-textarea.js +921 -0
- package/dist/components/base-time-picker.js +1141 -0
- package/dist/components/favicon.ico +0 -0
- package/dist/components/index.d.ts +399 -33
- package/dist/components/quantity-select.js +859 -0
- package/dist/components/theme-toggle.js +185 -165
- package/dist/favicon.ico +0 -0
- package/dist/index.d.ts +399 -33
- package/dist/index.js +7365 -2352
- package/dist/stylesheets/main.css +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,1076 @@
|
|
|
1
|
+
const D = globalThis, L = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, q = Symbol(), J = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
let le = class {
|
|
3
|
+
constructor(e, t, s) {
|
|
4
|
+
if (this._$cssResult$ = !0, s !== q) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
5
|
+
this.cssText = e, this.t = t;
|
|
6
|
+
}
|
|
7
|
+
get styleSheet() {
|
|
8
|
+
let e = this.o;
|
|
9
|
+
const t = this.t;
|
|
10
|
+
if (L && e === void 0) {
|
|
11
|
+
const s = t !== void 0 && t.length === 1;
|
|
12
|
+
s && (e = J.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && J.set(t, e));
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return this.cssText;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const ue = (i) => new le(typeof i == "string" ? i : i + "", void 0, q), ge = (i, ...e) => {
|
|
21
|
+
const t = i.length === 1 ? i[0] : e.reduce(((s, r, o) => s + ((n) => {
|
|
22
|
+
if (n._$cssResult$ === !0) return n.cssText;
|
|
23
|
+
if (typeof n == "number") return n;
|
|
24
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
25
|
+
})(r) + i[o + 1]), i[0]);
|
|
26
|
+
return new le(t, i, q);
|
|
27
|
+
}, fe = (i, e) => {
|
|
28
|
+
if (L) i.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
|
|
29
|
+
else for (const t of e) {
|
|
30
|
+
const s = document.createElement("style"), r = D.litNonce;
|
|
31
|
+
r !== void 0 && s.setAttribute("nonce", r), s.textContent = t.cssText, i.appendChild(s);
|
|
32
|
+
}
|
|
33
|
+
}, Y = L ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
|
|
34
|
+
let t = "";
|
|
35
|
+
for (const s of e.cssRules) t += s.cssText;
|
|
36
|
+
return ue(t);
|
|
37
|
+
})(i) : i;
|
|
38
|
+
const { is: $e, defineProperty: ve, getOwnPropertyDescriptor: me, getOwnPropertyNames: ye, getOwnPropertySymbols: be, getPrototypeOf: _e } = Object, z = globalThis, Z = z.trustedTypes, Ae = Z ? Z.emptyScript : "", we = z.reactiveElementPolyfillSupport, O = (i, e) => i, H = { toAttribute(i, e) {
|
|
39
|
+
switch (e) {
|
|
40
|
+
case Boolean:
|
|
41
|
+
i = i ? Ae : null;
|
|
42
|
+
break;
|
|
43
|
+
case Object:
|
|
44
|
+
case Array:
|
|
45
|
+
i = i == null ? i : JSON.stringify(i);
|
|
46
|
+
}
|
|
47
|
+
return i;
|
|
48
|
+
}, fromAttribute(i, e) {
|
|
49
|
+
let t = i;
|
|
50
|
+
switch (e) {
|
|
51
|
+
case Boolean:
|
|
52
|
+
t = i !== null;
|
|
53
|
+
break;
|
|
54
|
+
case Number:
|
|
55
|
+
t = i === null ? null : Number(i);
|
|
56
|
+
break;
|
|
57
|
+
case Object:
|
|
58
|
+
case Array:
|
|
59
|
+
try {
|
|
60
|
+
t = JSON.parse(i);
|
|
61
|
+
} catch {
|
|
62
|
+
t = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return t;
|
|
66
|
+
} }, V = (i, e) => !$e(i, e), X = { attribute: !0, type: String, converter: H, reflect: !1, useDefault: !1, hasChanged: V };
|
|
67
|
+
Symbol.metadata ??= Symbol("metadata"), z.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
68
|
+
let x = class extends HTMLElement {
|
|
69
|
+
static addInitializer(e) {
|
|
70
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
71
|
+
}
|
|
72
|
+
static get observedAttributes() {
|
|
73
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
74
|
+
}
|
|
75
|
+
static createProperty(e, t = X) {
|
|
76
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
77
|
+
const s = Symbol(), r = this.getPropertyDescriptor(e, s, t);
|
|
78
|
+
r !== void 0 && ve(this.prototype, e, r);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
static getPropertyDescriptor(e, t, s) {
|
|
82
|
+
const { get: r, set: o } = me(this.prototype, e) ?? { get() {
|
|
83
|
+
return this[t];
|
|
84
|
+
}, set(n) {
|
|
85
|
+
this[t] = n;
|
|
86
|
+
} };
|
|
87
|
+
return { get: r, set(n) {
|
|
88
|
+
const a = r?.call(this);
|
|
89
|
+
o?.call(this, n), this.requestUpdate(e, a, s);
|
|
90
|
+
}, configurable: !0, enumerable: !0 };
|
|
91
|
+
}
|
|
92
|
+
static getPropertyOptions(e) {
|
|
93
|
+
return this.elementProperties.get(e) ?? X;
|
|
94
|
+
}
|
|
95
|
+
static _$Ei() {
|
|
96
|
+
if (this.hasOwnProperty(O("elementProperties"))) return;
|
|
97
|
+
const e = _e(this);
|
|
98
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
99
|
+
}
|
|
100
|
+
static finalize() {
|
|
101
|
+
if (this.hasOwnProperty(O("finalized"))) return;
|
|
102
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(O("properties"))) {
|
|
103
|
+
const t = this.properties, s = [...ye(t), ...be(t)];
|
|
104
|
+
for (const r of s) this.createProperty(r, t[r]);
|
|
105
|
+
}
|
|
106
|
+
const e = this[Symbol.metadata];
|
|
107
|
+
if (e !== null) {
|
|
108
|
+
const t = litPropertyMetadata.get(e);
|
|
109
|
+
if (t !== void 0) for (const [s, r] of t) this.elementProperties.set(s, r);
|
|
110
|
+
}
|
|
111
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
112
|
+
for (const [t, s] of this.elementProperties) {
|
|
113
|
+
const r = this._$Eu(t, s);
|
|
114
|
+
r !== void 0 && this._$Eh.set(r, t);
|
|
115
|
+
}
|
|
116
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
117
|
+
}
|
|
118
|
+
static finalizeStyles(e) {
|
|
119
|
+
const t = [];
|
|
120
|
+
if (Array.isArray(e)) {
|
|
121
|
+
const s = new Set(e.flat(1 / 0).reverse());
|
|
122
|
+
for (const r of s) t.unshift(Y(r));
|
|
123
|
+
} else e !== void 0 && t.push(Y(e));
|
|
124
|
+
return t;
|
|
125
|
+
}
|
|
126
|
+
static _$Eu(e, t) {
|
|
127
|
+
const s = t.attribute;
|
|
128
|
+
return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
129
|
+
}
|
|
130
|
+
constructor() {
|
|
131
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
132
|
+
}
|
|
133
|
+
_$Ev() {
|
|
134
|
+
this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
|
|
135
|
+
}
|
|
136
|
+
addController(e) {
|
|
137
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
138
|
+
}
|
|
139
|
+
removeController(e) {
|
|
140
|
+
this._$EO?.delete(e);
|
|
141
|
+
}
|
|
142
|
+
_$E_() {
|
|
143
|
+
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
144
|
+
for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
|
|
145
|
+
e.size > 0 && (this._$Ep = e);
|
|
146
|
+
}
|
|
147
|
+
createRenderRoot() {
|
|
148
|
+
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
149
|
+
return fe(e, this.constructor.elementStyles), e;
|
|
150
|
+
}
|
|
151
|
+
connectedCallback() {
|
|
152
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
|
|
153
|
+
}
|
|
154
|
+
enableUpdating(e) {
|
|
155
|
+
}
|
|
156
|
+
disconnectedCallback() {
|
|
157
|
+
this._$EO?.forEach(((e) => e.hostDisconnected?.()));
|
|
158
|
+
}
|
|
159
|
+
attributeChangedCallback(e, t, s) {
|
|
160
|
+
this._$AK(e, s);
|
|
161
|
+
}
|
|
162
|
+
_$ET(e, t) {
|
|
163
|
+
const s = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, s);
|
|
164
|
+
if (r !== void 0 && s.reflect === !0) {
|
|
165
|
+
const o = (s.converter?.toAttribute !== void 0 ? s.converter : H).toAttribute(t, s.type);
|
|
166
|
+
this._$Em = e, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
_$AK(e, t) {
|
|
170
|
+
const s = this.constructor, r = s._$Eh.get(e);
|
|
171
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
172
|
+
const o = s.getPropertyOptions(r), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : H;
|
|
173
|
+
this._$Em = r;
|
|
174
|
+
const a = n.fromAttribute(t, o.type);
|
|
175
|
+
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
requestUpdate(e, t, s) {
|
|
179
|
+
if (e !== void 0) {
|
|
180
|
+
const r = this.constructor, o = this[e];
|
|
181
|
+
if (s ??= r.getPropertyOptions(e), !((s.hasChanged ?? V)(o, t) || s.useDefault && s.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(r._$Eu(e, s)))) return;
|
|
182
|
+
this.C(e, t, s);
|
|
183
|
+
}
|
|
184
|
+
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
185
|
+
}
|
|
186
|
+
C(e, t, { useDefault: s, reflect: r, wrapped: o }, n) {
|
|
187
|
+
s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? t ?? this[e]), o !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || s || (t = void 0), this._$AL.set(e, t)), r === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
188
|
+
}
|
|
189
|
+
async _$EP() {
|
|
190
|
+
this.isUpdatePending = !0;
|
|
191
|
+
try {
|
|
192
|
+
await this._$ES;
|
|
193
|
+
} catch (t) {
|
|
194
|
+
Promise.reject(t);
|
|
195
|
+
}
|
|
196
|
+
const e = this.scheduleUpdate();
|
|
197
|
+
return e != null && await e, !this.isUpdatePending;
|
|
198
|
+
}
|
|
199
|
+
scheduleUpdate() {
|
|
200
|
+
return this.performUpdate();
|
|
201
|
+
}
|
|
202
|
+
performUpdate() {
|
|
203
|
+
if (!this.isUpdatePending) return;
|
|
204
|
+
if (!this.hasUpdated) {
|
|
205
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
206
|
+
for (const [r, o] of this._$Ep) this[r] = o;
|
|
207
|
+
this._$Ep = void 0;
|
|
208
|
+
}
|
|
209
|
+
const s = this.constructor.elementProperties;
|
|
210
|
+
if (s.size > 0) for (const [r, o] of s) {
|
|
211
|
+
const { wrapped: n } = o, a = this[r];
|
|
212
|
+
n !== !0 || this._$AL.has(r) || a === void 0 || this.C(r, void 0, o, a);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
let e = !1;
|
|
216
|
+
const t = this._$AL;
|
|
217
|
+
try {
|
|
218
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
219
|
+
} catch (s) {
|
|
220
|
+
throw e = !1, this._$EM(), s;
|
|
221
|
+
}
|
|
222
|
+
e && this._$AE(t);
|
|
223
|
+
}
|
|
224
|
+
willUpdate(e) {
|
|
225
|
+
}
|
|
226
|
+
_$AE(e) {
|
|
227
|
+
this._$EO?.forEach(((t) => t.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
228
|
+
}
|
|
229
|
+
_$EM() {
|
|
230
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
231
|
+
}
|
|
232
|
+
get updateComplete() {
|
|
233
|
+
return this.getUpdateComplete();
|
|
234
|
+
}
|
|
235
|
+
getUpdateComplete() {
|
|
236
|
+
return this._$ES;
|
|
237
|
+
}
|
|
238
|
+
shouldUpdate(e) {
|
|
239
|
+
return !0;
|
|
240
|
+
}
|
|
241
|
+
update(e) {
|
|
242
|
+
this._$Eq &&= this._$Eq.forEach(((t) => this._$ET(t, this[t]))), this._$EM();
|
|
243
|
+
}
|
|
244
|
+
updated(e) {
|
|
245
|
+
}
|
|
246
|
+
firstUpdated(e) {
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[O("elementProperties")] = /* @__PURE__ */ new Map(), x[O("finalized")] = /* @__PURE__ */ new Map(), we?.({ ReactiveElement: x }), (z.reactiveElementVersions ??= []).push("2.1.1");
|
|
250
|
+
const F = globalThis, R = F.trustedTypes, ee = R ? R.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ae = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + y, Ee = `<${he}>`, A = document, T = () => A.createComment(""), k = (i) => i === null || typeof i != "object" && typeof i != "function", K = Array.isArray, xe = (i) => K(i) || typeof i?.[Symbol.iterator] == "function", B = `[
|
|
251
|
+
\f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, te = /-->/g, se = />/g, b = RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
|
|
252
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ie = /'/g, re = /"/g, de = /^(?:script|style|textarea|title)$/i, Se = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), $ = Se(1), w = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), oe = /* @__PURE__ */ new WeakMap(), _ = A.createTreeWalker(A, 129);
|
|
253
|
+
function ce(i, e) {
|
|
254
|
+
if (!K(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
255
|
+
return ee !== void 0 ? ee.createHTML(e) : e;
|
|
256
|
+
}
|
|
257
|
+
const Ce = (i, e) => {
|
|
258
|
+
const t = i.length - 1, s = [];
|
|
259
|
+
let r, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = C;
|
|
260
|
+
for (let a = 0; a < t; a++) {
|
|
261
|
+
const l = i[a];
|
|
262
|
+
let p, g, h = -1, v = 0;
|
|
263
|
+
for (; v < l.length && (n.lastIndex = v, g = n.exec(l), g !== null); ) v = n.lastIndex, n === C ? g[1] === "!--" ? n = te : g[1] !== void 0 ? n = se : g[2] !== void 0 ? (de.test(g[2]) && (r = RegExp("</" + g[2], "g")), n = b) : g[3] !== void 0 && (n = b) : n === b ? g[0] === ">" ? (n = r ?? C, h = -1) : g[1] === void 0 ? h = -2 : (h = n.lastIndex - g[2].length, p = g[1], n = g[3] === void 0 ? b : g[3] === '"' ? re : ie) : n === re || n === ie ? n = b : n === te || n === se ? n = C : (n = b, r = void 0);
|
|
264
|
+
const m = n === b && i[a + 1].startsWith("/>") ? " " : "";
|
|
265
|
+
o += n === C ? l + Ee : h >= 0 ? (s.push(p), l.slice(0, h) + ae + l.slice(h) + y + m) : l + y + (h === -2 ? a : m);
|
|
266
|
+
}
|
|
267
|
+
return [ce(i, o + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
268
|
+
};
|
|
269
|
+
class U {
|
|
270
|
+
constructor({ strings: e, _$litType$: t }, s) {
|
|
271
|
+
let r;
|
|
272
|
+
this.parts = [];
|
|
273
|
+
let o = 0, n = 0;
|
|
274
|
+
const a = e.length - 1, l = this.parts, [p, g] = Ce(e, t);
|
|
275
|
+
if (this.el = U.createElement(p, s), _.currentNode = this.el.content, t === 2 || t === 3) {
|
|
276
|
+
const h = this.el.content.firstChild;
|
|
277
|
+
h.replaceWith(...h.childNodes);
|
|
278
|
+
}
|
|
279
|
+
for (; (r = _.nextNode()) !== null && l.length < a; ) {
|
|
280
|
+
if (r.nodeType === 1) {
|
|
281
|
+
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(ae)) {
|
|
282
|
+
const v = g[n++], m = r.getAttribute(h).split(y), M = /([.?@])?(.*)/.exec(v);
|
|
283
|
+
l.push({ type: 1, index: o, name: M[2], strings: m, ctor: M[1] === "." ? Pe : M[1] === "?" ? Te : M[1] === "@" ? ke : N }), r.removeAttribute(h);
|
|
284
|
+
} else h.startsWith(y) && (l.push({ type: 6, index: o }), r.removeAttribute(h));
|
|
285
|
+
if (de.test(r.tagName)) {
|
|
286
|
+
const h = r.textContent.split(y), v = h.length - 1;
|
|
287
|
+
if (v > 0) {
|
|
288
|
+
r.textContent = R ? R.emptyScript : "";
|
|
289
|
+
for (let m = 0; m < v; m++) r.append(h[m], T()), _.nextNode(), l.push({ type: 2, index: ++o });
|
|
290
|
+
r.append(h[v], T());
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
} else if (r.nodeType === 8) if (r.data === he) l.push({ type: 2, index: o });
|
|
294
|
+
else {
|
|
295
|
+
let h = -1;
|
|
296
|
+
for (; (h = r.data.indexOf(y, h + 1)) !== -1; ) l.push({ type: 7, index: o }), h += y.length - 1;
|
|
297
|
+
}
|
|
298
|
+
o++;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
static createElement(e, t) {
|
|
302
|
+
const s = A.createElement("template");
|
|
303
|
+
return s.innerHTML = e, s;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function S(i, e, t = i, s) {
|
|
307
|
+
if (e === w) return e;
|
|
308
|
+
let r = s !== void 0 ? t._$Co?.[s] : t._$Cl;
|
|
309
|
+
const o = k(e) ? void 0 : e._$litDirective$;
|
|
310
|
+
return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = r : t._$Cl = r), r !== void 0 && (e = S(i, r._$AS(i, e.values), r, s)), e;
|
|
311
|
+
}
|
|
312
|
+
class Oe {
|
|
313
|
+
constructor(e, t) {
|
|
314
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
315
|
+
}
|
|
316
|
+
get parentNode() {
|
|
317
|
+
return this._$AM.parentNode;
|
|
318
|
+
}
|
|
319
|
+
get _$AU() {
|
|
320
|
+
return this._$AM._$AU;
|
|
321
|
+
}
|
|
322
|
+
u(e) {
|
|
323
|
+
const { el: { content: t }, parts: s } = this._$AD, r = (e?.creationScope ?? A).importNode(t, !0);
|
|
324
|
+
_.currentNode = r;
|
|
325
|
+
let o = _.nextNode(), n = 0, a = 0, l = s[0];
|
|
326
|
+
for (; l !== void 0; ) {
|
|
327
|
+
if (n === l.index) {
|
|
328
|
+
let p;
|
|
329
|
+
l.type === 2 ? p = new I(o, o.nextSibling, this, e) : l.type === 1 ? p = new l.ctor(o, l.name, l.strings, this, e) : l.type === 6 && (p = new Ue(o, this, e)), this._$AV.push(p), l = s[++a];
|
|
330
|
+
}
|
|
331
|
+
n !== l?.index && (o = _.nextNode(), n++);
|
|
332
|
+
}
|
|
333
|
+
return _.currentNode = A, r;
|
|
334
|
+
}
|
|
335
|
+
p(e) {
|
|
336
|
+
let t = 0;
|
|
337
|
+
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
class I {
|
|
341
|
+
get _$AU() {
|
|
342
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
343
|
+
}
|
|
344
|
+
constructor(e, t, s, r) {
|
|
345
|
+
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
346
|
+
}
|
|
347
|
+
get parentNode() {
|
|
348
|
+
let e = this._$AA.parentNode;
|
|
349
|
+
const t = this._$AM;
|
|
350
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
351
|
+
}
|
|
352
|
+
get startNode() {
|
|
353
|
+
return this._$AA;
|
|
354
|
+
}
|
|
355
|
+
get endNode() {
|
|
356
|
+
return this._$AB;
|
|
357
|
+
}
|
|
358
|
+
_$AI(e, t = this) {
|
|
359
|
+
e = S(this, e, t), k(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== w && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : xe(e) ? this.k(e) : this._(e);
|
|
360
|
+
}
|
|
361
|
+
O(e) {
|
|
362
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
363
|
+
}
|
|
364
|
+
T(e) {
|
|
365
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
366
|
+
}
|
|
367
|
+
_(e) {
|
|
368
|
+
this._$AH !== c && k(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
|
|
369
|
+
}
|
|
370
|
+
$(e) {
|
|
371
|
+
const { values: t, _$litType$: s } = e, r = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = U.createElement(ce(s.h, s.h[0]), this.options)), s);
|
|
372
|
+
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
373
|
+
else {
|
|
374
|
+
const o = new Oe(r, this), n = o.u(this.options);
|
|
375
|
+
o.p(t), this.T(n), this._$AH = o;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
_$AC(e) {
|
|
379
|
+
let t = oe.get(e.strings);
|
|
380
|
+
return t === void 0 && oe.set(e.strings, t = new U(e)), t;
|
|
381
|
+
}
|
|
382
|
+
k(e) {
|
|
383
|
+
K(this._$AH) || (this._$AH = [], this._$AR());
|
|
384
|
+
const t = this._$AH;
|
|
385
|
+
let s, r = 0;
|
|
386
|
+
for (const o of e) r === t.length ? t.push(s = new I(this.O(T()), this.O(T()), this, this.options)) : s = t[r], s._$AI(o), r++;
|
|
387
|
+
r < t.length && (this._$AR(s && s._$AB.nextSibling, r), t.length = r);
|
|
388
|
+
}
|
|
389
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
390
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
|
|
391
|
+
const s = e.nextSibling;
|
|
392
|
+
e.remove(), e = s;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
setConnected(e) {
|
|
396
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
class N {
|
|
400
|
+
get tagName() {
|
|
401
|
+
return this.element.tagName;
|
|
402
|
+
}
|
|
403
|
+
get _$AU() {
|
|
404
|
+
return this._$AM._$AU;
|
|
405
|
+
}
|
|
406
|
+
constructor(e, t, s, r, o) {
|
|
407
|
+
this.type = 1, this._$AH = c, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = c;
|
|
408
|
+
}
|
|
409
|
+
_$AI(e, t = this, s, r) {
|
|
410
|
+
const o = this.strings;
|
|
411
|
+
let n = !1;
|
|
412
|
+
if (o === void 0) e = S(this, e, t, 0), n = !k(e) || e !== this._$AH && e !== w, n && (this._$AH = e);
|
|
413
|
+
else {
|
|
414
|
+
const a = e;
|
|
415
|
+
let l, p;
|
|
416
|
+
for (e = o[0], l = 0; l < o.length - 1; l++) p = S(this, a[s + l], t, l), p === w && (p = this._$AH[l]), n ||= !k(p) || p !== this._$AH[l], p === c ? e = c : e !== c && (e += (p ?? "") + o[l + 1]), this._$AH[l] = p;
|
|
417
|
+
}
|
|
418
|
+
n && !r && this.j(e);
|
|
419
|
+
}
|
|
420
|
+
j(e) {
|
|
421
|
+
e === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
class Pe extends N {
|
|
425
|
+
constructor() {
|
|
426
|
+
super(...arguments), this.type = 3;
|
|
427
|
+
}
|
|
428
|
+
j(e) {
|
|
429
|
+
this.element[this.name] = e === c ? void 0 : e;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
class Te extends N {
|
|
433
|
+
constructor() {
|
|
434
|
+
super(...arguments), this.type = 4;
|
|
435
|
+
}
|
|
436
|
+
j(e) {
|
|
437
|
+
this.element.toggleAttribute(this.name, !!e && e !== c);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
class ke extends N {
|
|
441
|
+
constructor(e, t, s, r, o) {
|
|
442
|
+
super(e, t, s, r, o), this.type = 5;
|
|
443
|
+
}
|
|
444
|
+
_$AI(e, t = this) {
|
|
445
|
+
if ((e = S(this, e, t, 0) ?? c) === w) return;
|
|
446
|
+
const s = this._$AH, r = e === c && s !== c || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, o = e !== c && (s === c || r);
|
|
447
|
+
r && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
448
|
+
}
|
|
449
|
+
handleEvent(e) {
|
|
450
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
class Ue {
|
|
454
|
+
constructor(e, t, s) {
|
|
455
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
456
|
+
}
|
|
457
|
+
get _$AU() {
|
|
458
|
+
return this._$AM._$AU;
|
|
459
|
+
}
|
|
460
|
+
_$AI(e) {
|
|
461
|
+
S(this, e);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
const Ie = F.litHtmlPolyfillSupport;
|
|
465
|
+
Ie?.(U, I), (F.litHtmlVersions ??= []).push("3.3.1");
|
|
466
|
+
const Me = (i, e, t) => {
|
|
467
|
+
const s = t?.renderBefore ?? e;
|
|
468
|
+
let r = s._$litPart$;
|
|
469
|
+
if (r === void 0) {
|
|
470
|
+
const o = t?.renderBefore ?? null;
|
|
471
|
+
s._$litPart$ = r = new I(e.insertBefore(T(), o), o, void 0, t ?? {});
|
|
472
|
+
}
|
|
473
|
+
return r._$AI(i), r;
|
|
474
|
+
};
|
|
475
|
+
const Q = globalThis;
|
|
476
|
+
let P = class extends x {
|
|
477
|
+
constructor() {
|
|
478
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
479
|
+
}
|
|
480
|
+
createRenderRoot() {
|
|
481
|
+
const e = super.createRenderRoot();
|
|
482
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
483
|
+
}
|
|
484
|
+
update(e) {
|
|
485
|
+
const t = this.render();
|
|
486
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Me(t, this.renderRoot, this.renderOptions);
|
|
487
|
+
}
|
|
488
|
+
connectedCallback() {
|
|
489
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
490
|
+
}
|
|
491
|
+
disconnectedCallback() {
|
|
492
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
493
|
+
}
|
|
494
|
+
render() {
|
|
495
|
+
return w;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
P._$litElement$ = !0, P.finalized = !0, Q.litElementHydrateSupport?.({ LitElement: P });
|
|
499
|
+
const De = Q.litElementPolyfillSupport;
|
|
500
|
+
De?.({ LitElement: P });
|
|
501
|
+
(Q.litElementVersions ??= []).push("4.2.1");
|
|
502
|
+
const He = (i) => (e, t) => {
|
|
503
|
+
t !== void 0 ? t.addInitializer((() => {
|
|
504
|
+
customElements.define(i, e);
|
|
505
|
+
})) : customElements.define(i, e);
|
|
506
|
+
};
|
|
507
|
+
const Re = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: V }, ze = (i = Re, e, t) => {
|
|
508
|
+
const { kind: s, metadata: r } = t;
|
|
509
|
+
let o = globalThis.litPropertyMetadata.get(r);
|
|
510
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(t.name, i), s === "accessor") {
|
|
511
|
+
const { name: n } = t;
|
|
512
|
+
return { set(a) {
|
|
513
|
+
const l = e.get.call(this);
|
|
514
|
+
e.set.call(this, a), this.requestUpdate(n, l, i);
|
|
515
|
+
}, init(a) {
|
|
516
|
+
return a !== void 0 && this.C(n, void 0, i, a), a;
|
|
517
|
+
} };
|
|
518
|
+
}
|
|
519
|
+
if (s === "setter") {
|
|
520
|
+
const { name: n } = t;
|
|
521
|
+
return function(a) {
|
|
522
|
+
const l = this[n];
|
|
523
|
+
e.call(this, a), this.requestUpdate(n, l, i);
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
throw Error("Unsupported decorator location: " + s);
|
|
527
|
+
};
|
|
528
|
+
function f(i) {
|
|
529
|
+
return (e, t) => typeof t == "object" ? ze(i, e, t) : ((s, r, o) => {
|
|
530
|
+
const n = r.hasOwnProperty(o);
|
|
531
|
+
return r.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
|
|
532
|
+
})(i, e, t);
|
|
533
|
+
}
|
|
534
|
+
function j(i) {
|
|
535
|
+
return f({ ...i, state: !0, attribute: !1 });
|
|
536
|
+
}
|
|
537
|
+
const Ne = (i, e, t) => (t.configurable = !0, t.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(i, e, t), t);
|
|
538
|
+
function W(i, e) {
|
|
539
|
+
return (t, s, r) => {
|
|
540
|
+
const o = (n) => n.renderRoot?.querySelector(i) ?? null;
|
|
541
|
+
return Ne(t, s, { get() {
|
|
542
|
+
return o(this);
|
|
543
|
+
} });
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
const je = { ATTRIBUTE: 1 }, Be = (i) => (...e) => ({ _$litDirective$: i, values: e });
|
|
547
|
+
class Le {
|
|
548
|
+
constructor(e) {
|
|
549
|
+
}
|
|
550
|
+
get _$AU() {
|
|
551
|
+
return this._$AM._$AU;
|
|
552
|
+
}
|
|
553
|
+
_$AT(e, t, s) {
|
|
554
|
+
this._$Ct = e, this._$AM = t, this._$Ci = s;
|
|
555
|
+
}
|
|
556
|
+
_$AS(e, t) {
|
|
557
|
+
return this.update(e, t);
|
|
558
|
+
}
|
|
559
|
+
update(e, t) {
|
|
560
|
+
return this.render(...t);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const E = Be(class extends Le {
|
|
564
|
+
constructor(i) {
|
|
565
|
+
if (super(i), i.type !== je.ATTRIBUTE || i.name !== "class" || i.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
566
|
+
}
|
|
567
|
+
render(i) {
|
|
568
|
+
return " " + Object.keys(i).filter(((e) => i[e])).join(" ") + " ";
|
|
569
|
+
}
|
|
570
|
+
update(i, [e]) {
|
|
571
|
+
if (this.st === void 0) {
|
|
572
|
+
this.st = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter(((s) => s !== ""))));
|
|
573
|
+
for (const s in e) e[s] && !this.nt?.has(s) && this.st.add(s);
|
|
574
|
+
return this.render(e);
|
|
575
|
+
}
|
|
576
|
+
const t = i.element.classList;
|
|
577
|
+
for (const s of this.st) s in e || (t.remove(s), this.st.delete(s));
|
|
578
|
+
for (const s in e) {
|
|
579
|
+
const r = !!e[s];
|
|
580
|
+
r === this.st.has(s) || this.nt?.has(s) || (r ? (t.add(s), this.st.add(s)) : (t.remove(s), this.st.delete(s)));
|
|
581
|
+
}
|
|
582
|
+
return w;
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
const ne = (i) => i ?? c;
|
|
586
|
+
var qe = Object.defineProperty, pe = (i, e, t, s) => {
|
|
587
|
+
for (var r = void 0, o = i.length - 1, n; o >= 0; o--)
|
|
588
|
+
(n = i[o]) && (r = n(e, t, r) || r);
|
|
589
|
+
return r && qe(e, t, r), r;
|
|
590
|
+
};
|
|
591
|
+
class G extends P {
|
|
592
|
+
constructor() {
|
|
593
|
+
super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
|
|
594
|
+
}
|
|
595
|
+
connectedCallback() {
|
|
596
|
+
super.connectedCallback();
|
|
597
|
+
const e = document.documentElement.getAttribute("data-theme"), t = localStorage.getItem(this.storageKey), s = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
598
|
+
e ? this.theme = e : t ? (this.theme = t, this.applyTheme()) : s ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
|
|
599
|
+
}
|
|
600
|
+
disconnectedCallback() {
|
|
601
|
+
window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
|
|
602
|
+
}
|
|
603
|
+
handleGlobalThemeChange(e) {
|
|
604
|
+
const t = e;
|
|
605
|
+
t.target !== this && t.detail.theme !== this.theme && (this.theme = t.detail.theme);
|
|
606
|
+
}
|
|
607
|
+
applyTheme() {
|
|
608
|
+
document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
|
|
609
|
+
new CustomEvent("theme-changed", {
|
|
610
|
+
detail: { theme: this.theme },
|
|
611
|
+
bubbles: !0,
|
|
612
|
+
composed: !0
|
|
613
|
+
})
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
pe([
|
|
618
|
+
f({ type: String, attribute: "data-theme", reflect: !0 })
|
|
619
|
+
], G.prototype, "theme");
|
|
620
|
+
pe([
|
|
621
|
+
f({ type: String, attribute: "storage-key" })
|
|
622
|
+
], G.prototype, "storageKey");
|
|
623
|
+
var Ve = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, u = (i, e, t, s) => {
|
|
624
|
+
for (var r = s > 1 ? void 0 : s ? Fe(e, t) : e, o = i.length - 1, n; o >= 0; o--)
|
|
625
|
+
(n = i[o]) && (r = (s ? n(e, t, r) : n(r)) || r);
|
|
626
|
+
return s && r && Ve(e, t, r), r;
|
|
627
|
+
};
|
|
628
|
+
let d = class extends G {
|
|
629
|
+
constructor() {
|
|
630
|
+
super(...arguments), this.value = "", this.placeholder = "Select an option", this.required = !1, this.disabled = !1, this.searchable = !1, this.size = "md", this.options = [], this.isOpen = !1, this.searchQuery = "", this.highlightedIndex = -1, this.isFlipped = !1, this.selectId = `select-${Math.random().toString(36).substr(2, 9)}`;
|
|
631
|
+
}
|
|
632
|
+
get selectedOption() {
|
|
633
|
+
return this.options.find((i) => i.value === this.value);
|
|
634
|
+
}
|
|
635
|
+
get displayValue() {
|
|
636
|
+
return this.selectedOption?.label || this.placeholder;
|
|
637
|
+
}
|
|
638
|
+
get filteredOptions() {
|
|
639
|
+
if (!this.searchable || !this.searchQuery.trim())
|
|
640
|
+
return this.options;
|
|
641
|
+
const i = this.searchQuery.toLowerCase();
|
|
642
|
+
return this.options.filter(
|
|
643
|
+
(e) => e.label.toLowerCase().includes(i) || e.value.toLowerCase().includes(i)
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
handleDisplayClick() {
|
|
647
|
+
this.disabled || this.toggleDropdown();
|
|
648
|
+
}
|
|
649
|
+
toggleDropdown() {
|
|
650
|
+
this.isOpen = !this.isOpen, this.isOpen ? (this.highlightedIndex = this.filteredOptions.findIndex(
|
|
651
|
+
(i) => i.value === this.value
|
|
652
|
+
), this.searchable && requestAnimationFrame(() => {
|
|
653
|
+
this.selectInput?.focus();
|
|
654
|
+
}), requestAnimationFrame(() => this.updateDropdownPosition())) : (this.searchQuery = "", this.highlightedIndex = -1);
|
|
655
|
+
}
|
|
656
|
+
updateDropdownPosition() {
|
|
657
|
+
if (!this.dropdownElement || !this.selectDisplay) return;
|
|
658
|
+
const i = this.selectDisplay.getBoundingClientRect(), e = 240, t = window.innerHeight - i.bottom, s = i.top;
|
|
659
|
+
this.isFlipped = t < e && s > t;
|
|
660
|
+
}
|
|
661
|
+
closeDropdown() {
|
|
662
|
+
this.isOpen = !1, this.searchQuery = "", this.highlightedIndex = -1, this.isFlipped = !1;
|
|
663
|
+
}
|
|
664
|
+
handleSearchInput(i) {
|
|
665
|
+
const e = i.target;
|
|
666
|
+
this.searchQuery = e.value, this.highlightedIndex = 0;
|
|
667
|
+
}
|
|
668
|
+
selectOption(i) {
|
|
669
|
+
const e = this.value;
|
|
670
|
+
this.value = i.value, this.dispatchEvent(
|
|
671
|
+
new CustomEvent("change", {
|
|
672
|
+
detail: { value: i.value, oldValue: e },
|
|
673
|
+
bubbles: !0,
|
|
674
|
+
composed: !0
|
|
675
|
+
})
|
|
676
|
+
), this.closeDropdown();
|
|
677
|
+
}
|
|
678
|
+
handleKeydown(i) {
|
|
679
|
+
if (!this.disabled)
|
|
680
|
+
switch (i.key) {
|
|
681
|
+
case "Enter":
|
|
682
|
+
i.preventDefault(), this.isOpen ? this.highlightedIndex >= 0 && this.highlightedIndex < this.filteredOptions.length && this.selectOption(this.filteredOptions[this.highlightedIndex]) : this.toggleDropdown();
|
|
683
|
+
break;
|
|
684
|
+
case "Escape":
|
|
685
|
+
i.preventDefault(), this.closeDropdown();
|
|
686
|
+
break;
|
|
687
|
+
case "ArrowDown":
|
|
688
|
+
i.preventDefault(), this.isOpen ? (this.highlightedIndex = Math.min(
|
|
689
|
+
this.highlightedIndex + 1,
|
|
690
|
+
this.filteredOptions.length - 1
|
|
691
|
+
), this.scrollToHighlighted()) : this.toggleDropdown();
|
|
692
|
+
break;
|
|
693
|
+
case "ArrowUp":
|
|
694
|
+
i.preventDefault(), this.isOpen && (this.highlightedIndex = Math.max(this.highlightedIndex - 1, 0), this.scrollToHighlighted());
|
|
695
|
+
break;
|
|
696
|
+
case " ":
|
|
697
|
+
this.searchable || (i.preventDefault(), this.isOpen || this.toggleDropdown());
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
scrollToHighlighted() {
|
|
702
|
+
this.highlightedIndex < 0 || requestAnimationFrame(() => {
|
|
703
|
+
const e = this.dropdownElement?.querySelectorAll(".dropdown-option")?.[this.highlightedIndex];
|
|
704
|
+
if (e && this.dropdownElement) {
|
|
705
|
+
const t = this.dropdownElement.getBoundingClientRect(), s = e.getBoundingClientRect();
|
|
706
|
+
s.bottom > t.bottom ? e.scrollIntoView({ block: "end", behavior: "smooth" }) : s.top < t.top && e.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
render() {
|
|
711
|
+
const i = !!this.error, e = {
|
|
712
|
+
"select-wrapper": !0,
|
|
713
|
+
[`select--${this.size}`]: !0,
|
|
714
|
+
"select--error": i
|
|
715
|
+
}, t = {
|
|
716
|
+
"select-display": !0,
|
|
717
|
+
"select-display--open": this.isOpen,
|
|
718
|
+
"select-disabled": this.disabled
|
|
719
|
+
}, s = {
|
|
720
|
+
"select-input": !0,
|
|
721
|
+
"select-disabled": this.disabled
|
|
722
|
+
};
|
|
723
|
+
return $`
|
|
724
|
+
<div class="select-group">
|
|
725
|
+
${this.label ? $`
|
|
726
|
+
<label for=${this.selectId} class="select-label">
|
|
727
|
+
${this.label}
|
|
728
|
+
${this.required ? $`<span class="required-indicator" aria-label="required">*</span>` : ""}
|
|
729
|
+
</label>
|
|
730
|
+
` : ""}
|
|
731
|
+
|
|
732
|
+
<div class=${E(e)}>
|
|
733
|
+
${this.searchable && this.isOpen ? $`
|
|
734
|
+
<input
|
|
735
|
+
id=${this.selectId}
|
|
736
|
+
class=${E(s)}
|
|
737
|
+
type="text"
|
|
738
|
+
placeholder=${this.displayValue}
|
|
739
|
+
?disabled=${this.disabled}
|
|
740
|
+
.value=${this.searchQuery}
|
|
741
|
+
@input=${this.handleSearchInput}
|
|
742
|
+
@keydown=${this.handleKeydown}
|
|
743
|
+
aria-describedby=${ne(i ? `${this.selectId}-error` : void 0)}
|
|
744
|
+
aria-invalid=${i}
|
|
745
|
+
/>
|
|
746
|
+
` : $`
|
|
747
|
+
<div
|
|
748
|
+
id=${this.selectId}
|
|
749
|
+
class=${E(t)}
|
|
750
|
+
@click=${this.handleDisplayClick}
|
|
751
|
+
@keydown=${this.handleKeydown}
|
|
752
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
753
|
+
role="combobox"
|
|
754
|
+
aria-expanded=${this.isOpen}
|
|
755
|
+
aria-haspopup="listbox"
|
|
756
|
+
aria-describedby=${ne(i ? `${this.selectId}-error` : void 0)}
|
|
757
|
+
aria-invalid=${i}
|
|
758
|
+
>
|
|
759
|
+
${this.displayValue}
|
|
760
|
+
</div>
|
|
761
|
+
`}
|
|
762
|
+
|
|
763
|
+
<div class=${E({ "select-chevron": !0, "select-chevron--open": this.isOpen })}>
|
|
764
|
+
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
765
|
+
<path
|
|
766
|
+
fill-rule="evenodd"
|
|
767
|
+
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
|
768
|
+
clip-rule="evenodd"
|
|
769
|
+
/>
|
|
770
|
+
</svg>
|
|
771
|
+
</div>
|
|
772
|
+
|
|
773
|
+
${this.isOpen ? $`
|
|
774
|
+
<div class="dropdown-overlay" @click=${this.closeDropdown}></div>
|
|
775
|
+
<div
|
|
776
|
+
class=${E({
|
|
777
|
+
"dropdown-options": !0,
|
|
778
|
+
"dropdown-options--flipped": this.isFlipped
|
|
779
|
+
})}
|
|
780
|
+
role="listbox"
|
|
781
|
+
>
|
|
782
|
+
${this.filteredOptions.length === 0 ? $` <div class="dropdown-no-results">No options found</div> ` : this.filteredOptions.map(
|
|
783
|
+
(r, o) => $`
|
|
784
|
+
<div
|
|
785
|
+
class=${E({
|
|
786
|
+
"dropdown-option": !0,
|
|
787
|
+
"dropdown-option--selected": r.value === this.value,
|
|
788
|
+
"dropdown-option--highlighted": o === this.highlightedIndex
|
|
789
|
+
})}
|
|
790
|
+
role="option"
|
|
791
|
+
aria-selected=${r.value === this.value}
|
|
792
|
+
@click=${() => this.selectOption(r)}
|
|
793
|
+
>
|
|
794
|
+
${r.label}
|
|
795
|
+
</div>
|
|
796
|
+
`
|
|
797
|
+
)}
|
|
798
|
+
</div>
|
|
799
|
+
` : ""}
|
|
800
|
+
</div>
|
|
801
|
+
|
|
802
|
+
${i ? $`
|
|
803
|
+
<div id="${this.selectId}-error" class="select-error" role="alert">
|
|
804
|
+
${this.error}
|
|
805
|
+
</div>
|
|
806
|
+
` : this.hint ? $` <div class="select-hint">${this.hint}</div> ` : ""}
|
|
807
|
+
</div>
|
|
808
|
+
`;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
d.styles = ge`
|
|
812
|
+
:host {
|
|
813
|
+
display: block;
|
|
814
|
+
position: relative;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.select-group {
|
|
818
|
+
display: flex;
|
|
819
|
+
flex-direction: column;
|
|
820
|
+
gap: var(--space-2);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
.select-label {
|
|
824
|
+
display: flex;
|
|
825
|
+
align-items: center;
|
|
826
|
+
gap: var(--space-1);
|
|
827
|
+
font-size: var(--font-size-sm);
|
|
828
|
+
font-weight: var(--font-weight-medium);
|
|
829
|
+
color: var(--color-text-primary);
|
|
830
|
+
line-height: var(--line-height-tight);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.required-indicator {
|
|
834
|
+
color: var(--color-error);
|
|
835
|
+
font-weight: var(--font-weight-bold);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.select-wrapper {
|
|
839
|
+
position: relative;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
.select-input,
|
|
843
|
+
.select-display {
|
|
844
|
+
width: 100%;
|
|
845
|
+
font-family: var(--font-family-sans);
|
|
846
|
+
background-color: var(--color-bg-primary);
|
|
847
|
+
border: 1px solid var(--color-border);
|
|
848
|
+
border-radius: var(--radius-md);
|
|
849
|
+
transition: all var(--transition-fast);
|
|
850
|
+
color: var(--color-text-primary);
|
|
851
|
+
box-sizing: border-box;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.select-input {
|
|
855
|
+
cursor: text;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.select-display {
|
|
859
|
+
cursor: pointer;
|
|
860
|
+
user-select: none;
|
|
861
|
+
display: flex;
|
|
862
|
+
align-items: center;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.select-input:hover:not(:disabled),
|
|
866
|
+
.select-display:hover:not(.select-disabled) {
|
|
867
|
+
border-color: var(--color-border-hover);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.select-input:focus,
|
|
871
|
+
.select-display--open {
|
|
872
|
+
outline: none;
|
|
873
|
+
border-color: var(--color-border-focus);
|
|
874
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
.select-input::placeholder {
|
|
878
|
+
color: var(--color-text-muted);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/* Sizes */
|
|
882
|
+
.select--sm .select-input,
|
|
883
|
+
.select--sm .select-display {
|
|
884
|
+
padding: var(--space-2) var(--space-3);
|
|
885
|
+
font-size: var(--font-size-sm);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
.select--sm .select-display {
|
|
889
|
+
padding-right: var(--space-8);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.select--md .select-input,
|
|
893
|
+
.select--md .select-display {
|
|
894
|
+
padding: var(--space-3) var(--space-4);
|
|
895
|
+
font-size: var(--font-size-base);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
.select--md .select-display {
|
|
899
|
+
padding-right: var(--space-10);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
.select--lg .select-input,
|
|
903
|
+
.select--lg .select-display {
|
|
904
|
+
padding: var(--space-4) var(--space-5);
|
|
905
|
+
font-size: var(--font-size-lg);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
.select--lg .select-display {
|
|
909
|
+
padding-right: var(--space-12);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/* States */
|
|
913
|
+
.select--error .select-input,
|
|
914
|
+
.select--error .select-display {
|
|
915
|
+
border-color: var(--color-error);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
.select--error .select-input:focus,
|
|
919
|
+
.select--error .select-display--open {
|
|
920
|
+
border-color: var(--color-error);
|
|
921
|
+
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.select-disabled {
|
|
925
|
+
opacity: 0.5;
|
|
926
|
+
cursor: not-allowed !important;
|
|
927
|
+
background-color: var(--color-bg-muted);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
.select-chevron {
|
|
931
|
+
position: absolute;
|
|
932
|
+
right: var(--space-3);
|
|
933
|
+
top: 50%;
|
|
934
|
+
transform: translateY(-50%);
|
|
935
|
+
color: var(--color-text-secondary);
|
|
936
|
+
pointer-events: none;
|
|
937
|
+
transition: transform var(--transition-fast);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.select-chevron--open {
|
|
941
|
+
transform: translateY(-50%) rotate(180deg);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.select-chevron svg {
|
|
945
|
+
width: 1em;
|
|
946
|
+
height: 1em;
|
|
947
|
+
display: block;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/* Dropdown */
|
|
951
|
+
.dropdown-overlay {
|
|
952
|
+
position: fixed;
|
|
953
|
+
top: 0;
|
|
954
|
+
left: 0;
|
|
955
|
+
right: 0;
|
|
956
|
+
bottom: 0;
|
|
957
|
+
z-index: 999;
|
|
958
|
+
background: transparent;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.dropdown-options {
|
|
962
|
+
position: absolute;
|
|
963
|
+
top: calc(100% + 4px);
|
|
964
|
+
left: 0;
|
|
965
|
+
right: 0;
|
|
966
|
+
max-height: 240px;
|
|
967
|
+
overflow-y: auto;
|
|
968
|
+
background: var(--color-bg-primary);
|
|
969
|
+
border: 1px solid var(--color-border-focus);
|
|
970
|
+
border-radius: var(--radius-md);
|
|
971
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
972
|
+
z-index: 1000;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.dropdown-options--flipped {
|
|
976
|
+
top: auto;
|
|
977
|
+
bottom: calc(100% + 4px);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.dropdown-option {
|
|
981
|
+
padding: var(--space-3);
|
|
982
|
+
cursor: pointer;
|
|
983
|
+
transition: background-color var(--transition-fast);
|
|
984
|
+
color: var(--color-text-primary);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.dropdown-option:hover,
|
|
988
|
+
.dropdown-option--highlighted {
|
|
989
|
+
background-color: var(--color-bg-secondary);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.dropdown-option--selected {
|
|
993
|
+
background-color: var(--color-primary-light);
|
|
994
|
+
font-weight: var(--font-weight-medium);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
.dropdown-option--selected:hover,
|
|
998
|
+
.dropdown-option--selected.dropdown-option--highlighted {
|
|
999
|
+
background-color: var(--color-primary-light);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
.dropdown-no-results {
|
|
1003
|
+
padding: var(--space-3);
|
|
1004
|
+
color: var(--color-text-secondary);
|
|
1005
|
+
text-align: center;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.select-error {
|
|
1009
|
+
font-size: var(--font-size-sm);
|
|
1010
|
+
color: var(--color-error);
|
|
1011
|
+
line-height: var(--line-height-tight);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.select-hint {
|
|
1015
|
+
font-size: var(--font-size-sm);
|
|
1016
|
+
color: var(--color-text-muted);
|
|
1017
|
+
line-height: var(--line-height-tight);
|
|
1018
|
+
}
|
|
1019
|
+
`;
|
|
1020
|
+
u([
|
|
1021
|
+
f({ type: String })
|
|
1022
|
+
], d.prototype, "value", 2);
|
|
1023
|
+
u([
|
|
1024
|
+
f({ type: String })
|
|
1025
|
+
], d.prototype, "label", 2);
|
|
1026
|
+
u([
|
|
1027
|
+
f({ type: String })
|
|
1028
|
+
], d.prototype, "placeholder", 2);
|
|
1029
|
+
u([
|
|
1030
|
+
f({ type: Boolean, reflect: !0 })
|
|
1031
|
+
], d.prototype, "required", 2);
|
|
1032
|
+
u([
|
|
1033
|
+
f({ type: Boolean, reflect: !0 })
|
|
1034
|
+
], d.prototype, "disabled", 2);
|
|
1035
|
+
u([
|
|
1036
|
+
f({ type: Boolean, reflect: !0 })
|
|
1037
|
+
], d.prototype, "searchable", 2);
|
|
1038
|
+
u([
|
|
1039
|
+
f({ type: String })
|
|
1040
|
+
], d.prototype, "error", 2);
|
|
1041
|
+
u([
|
|
1042
|
+
f({ type: String })
|
|
1043
|
+
], d.prototype, "hint", 2);
|
|
1044
|
+
u([
|
|
1045
|
+
f({ type: String })
|
|
1046
|
+
], d.prototype, "size", 2);
|
|
1047
|
+
u([
|
|
1048
|
+
f({ type: Array })
|
|
1049
|
+
], d.prototype, "options", 2);
|
|
1050
|
+
u([
|
|
1051
|
+
j()
|
|
1052
|
+
], d.prototype, "isOpen", 2);
|
|
1053
|
+
u([
|
|
1054
|
+
j()
|
|
1055
|
+
], d.prototype, "searchQuery", 2);
|
|
1056
|
+
u([
|
|
1057
|
+
j()
|
|
1058
|
+
], d.prototype, "highlightedIndex", 2);
|
|
1059
|
+
u([
|
|
1060
|
+
j()
|
|
1061
|
+
], d.prototype, "isFlipped", 2);
|
|
1062
|
+
u([
|
|
1063
|
+
W(".select-input")
|
|
1064
|
+
], d.prototype, "selectInput", 2);
|
|
1065
|
+
u([
|
|
1066
|
+
W(".select-display")
|
|
1067
|
+
], d.prototype, "selectDisplay", 2);
|
|
1068
|
+
u([
|
|
1069
|
+
W(".dropdown-options")
|
|
1070
|
+
], d.prototype, "dropdownElement", 2);
|
|
1071
|
+
d = u([
|
|
1072
|
+
He("base-select")
|
|
1073
|
+
], d);
|
|
1074
|
+
export {
|
|
1075
|
+
d as BaseSelect
|
|
1076
|
+
};
|