@cal.macconnachie/web-components 1.0.1 → 1.0.3

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.
@@ -1,1697 +0,0 @@
1
- const R = globalThis, I = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, F = Symbol(), J = /* @__PURE__ */ new WeakMap();
2
- let oe = class {
3
- constructor(e, r, t) {
4
- if (this._$cssResult$ = !0, t !== F) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
- this.cssText = e, this.t = r;
6
- }
7
- get styleSheet() {
8
- let e = this.o;
9
- const r = this.t;
10
- if (I && e === void 0) {
11
- const t = r !== void 0 && r.length === 1;
12
- t && (e = J.get(r)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), t && J.set(r, e));
13
- }
14
- return e;
15
- }
16
- toString() {
17
- return this.cssText;
18
- }
19
- };
20
- const pe = (i) => new oe(typeof i == "string" ? i : i + "", void 0, F), ue = (i, ...e) => {
21
- const r = i.length === 1 ? i[0] : e.reduce(((t, s, o) => t + ((a) => {
22
- if (a._$cssResult$ === !0) return a.cssText;
23
- if (typeof a == "number") return a;
24
- throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
- })(s) + i[o + 1]), i[0]);
26
- return new oe(r, i, F);
27
- }, me = (i, e) => {
28
- if (I) i.adoptedStyleSheets = e.map(((r) => r instanceof CSSStyleSheet ? r : r.styleSheet));
29
- else for (const r of e) {
30
- const t = document.createElement("style"), s = R.litNonce;
31
- s !== void 0 && t.setAttribute("nonce", s), t.textContent = r.cssText, i.appendChild(t);
32
- }
33
- }, G = I ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
34
- let r = "";
35
- for (const t of e.cssRules) r += t.cssText;
36
- return pe(r);
37
- })(i) : i;
38
- const { is: ge, defineProperty: ve, getOwnPropertyDescriptor: ye, getOwnPropertyNames: fe, getOwnPropertySymbols: $e, getPrototypeOf: be } = Object, Y = globalThis, Z = Y.trustedTypes, _e = Z ? Z.emptyScript : "", we = Y.reactiveElementPolyfillSupport, E = (i, e) => i, N = { toAttribute(i, e) {
39
- switch (e) {
40
- case Boolean:
41
- i = i ? _e : 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 r = i;
50
- switch (e) {
51
- case Boolean:
52
- r = i !== null;
53
- break;
54
- case Number:
55
- r = i === null ? null : Number(i);
56
- break;
57
- case Object:
58
- case Array:
59
- try {
60
- r = JSON.parse(i);
61
- } catch {
62
- r = null;
63
- }
64
- }
65
- return r;
66
- } }, L = (i, e) => !ge(i, e), X = { attribute: !0, type: String, converter: N, reflect: !1, useDefault: !1, hasChanged: L };
67
- Symbol.metadata ??= Symbol("metadata"), Y.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, r = X) {
76
- if (r.state && (r.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((r = Object.create(r)).wrapped = !0), this.elementProperties.set(e, r), !r.noAccessor) {
77
- const t = Symbol(), s = this.getPropertyDescriptor(e, t, r);
78
- s !== void 0 && ve(this.prototype, e, s);
79
- }
80
- }
81
- static getPropertyDescriptor(e, r, t) {
82
- const { get: s, set: o } = ye(this.prototype, e) ?? { get() {
83
- return this[r];
84
- }, set(a) {
85
- this[r] = a;
86
- } };
87
- return { get: s, set(a) {
88
- const l = s?.call(this);
89
- o?.call(this, a), this.requestUpdate(e, l, t);
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(E("elementProperties"))) return;
97
- const e = be(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(E("finalized"))) return;
102
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(E("properties"))) {
103
- const r = this.properties, t = [...fe(r), ...$e(r)];
104
- for (const s of t) this.createProperty(s, r[s]);
105
- }
106
- const e = this[Symbol.metadata];
107
- if (e !== null) {
108
- const r = litPropertyMetadata.get(e);
109
- if (r !== void 0) for (const [t, s] of r) this.elementProperties.set(t, s);
110
- }
111
- this._$Eh = /* @__PURE__ */ new Map();
112
- for (const [r, t] of this.elementProperties) {
113
- const s = this._$Eu(r, t);
114
- s !== void 0 && this._$Eh.set(s, r);
115
- }
116
- this.elementStyles = this.finalizeStyles(this.styles);
117
- }
118
- static finalizeStyles(e) {
119
- const r = [];
120
- if (Array.isArray(e)) {
121
- const t = new Set(e.flat(1 / 0).reverse());
122
- for (const s of t) r.unshift(G(s));
123
- } else e !== void 0 && r.push(G(e));
124
- return r;
125
- }
126
- static _$Eu(e, r) {
127
- const t = r.attribute;
128
- return t === !1 ? void 0 : typeof t == "string" ? t : 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(), r = this.constructor.elementProperties;
144
- for (const t of r.keys()) this.hasOwnProperty(t) && (e.set(t, this[t]), delete this[t]);
145
- e.size > 0 && (this._$Ep = e);
146
- }
147
- createRenderRoot() {
148
- const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
- return me(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, r, t) {
160
- this._$AK(e, t);
161
- }
162
- _$ET(e, r) {
163
- const t = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, t);
164
- if (s !== void 0 && t.reflect === !0) {
165
- const o = (t.converter?.toAttribute !== void 0 ? t.converter : N).toAttribute(r, t.type);
166
- this._$Em = e, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
167
- }
168
- }
169
- _$AK(e, r) {
170
- const t = this.constructor, s = t._$Eh.get(e);
171
- if (s !== void 0 && this._$Em !== s) {
172
- const o = t.getPropertyOptions(s), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : N;
173
- this._$Em = s;
174
- const l = a.fromAttribute(r, o.type);
175
- this[s] = l ?? this._$Ej?.get(s) ?? l, this._$Em = null;
176
- }
177
- }
178
- requestUpdate(e, r, t) {
179
- if (e !== void 0) {
180
- const s = this.constructor, o = this[e];
181
- if (t ??= s.getPropertyOptions(e), !((t.hasChanged ?? L)(o, r) || t.useDefault && t.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(s._$Eu(e, t)))) return;
182
- this.C(e, r, t);
183
- }
184
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
185
- }
186
- C(e, r, { useDefault: t, reflect: s, wrapped: o }, a) {
187
- t && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? r ?? this[e]), o !== !0 || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || t || (r = void 0), this._$AL.set(e, r)), s === !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 (r) {
194
- Promise.reject(r);
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 [s, o] of this._$Ep) this[s] = o;
207
- this._$Ep = void 0;
208
- }
209
- const t = this.constructor.elementProperties;
210
- if (t.size > 0) for (const [s, o] of t) {
211
- const { wrapped: a } = o, l = this[s];
212
- a !== !0 || this._$AL.has(s) || l === void 0 || this.C(s, void 0, o, l);
213
- }
214
- }
215
- let e = !1;
216
- const r = this._$AL;
217
- try {
218
- e = this.shouldUpdate(r), e ? (this.willUpdate(r), this._$EO?.forEach(((t) => t.hostUpdate?.())), this.update(r)) : this._$EM();
219
- } catch (t) {
220
- throw e = !1, this._$EM(), t;
221
- }
222
- e && this._$AE(r);
223
- }
224
- willUpdate(e) {
225
- }
226
- _$AE(e) {
227
- this._$EO?.forEach(((r) => r.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(((r) => this._$ET(r, this[r]))), this._$EM();
243
- }
244
- updated(e) {
245
- }
246
- firstUpdated(e) {
247
- }
248
- };
249
- x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[E("elementProperties")] = /* @__PURE__ */ new Map(), x[E("finalized")] = /* @__PURE__ */ new Map(), we?.({ ReactiveElement: x }), (Y.reactiveElementVersions ??= []).push("2.1.1");
250
- const V = globalThis, U = V.trustedTypes, Q = U ? U.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ae = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, ne = "?" + _, Se = `<${ne}>`, A = document, C = () => A.createComment(""), T = (i) => i === null || typeof i != "object" && typeof i != "function", q = Array.isArray, Ae = (i) => q(i) || typeof i?.[Symbol.iterator] == "function", B = `[
251
- \f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ee = /-->/g, te = />/g, w = RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
252
- \f\r"'\`<>=]|("|')|))|$)`, "g"), re = /'/g, ie = /"/g, le = /^(?:script|style|textarea|title)$/i, ke = (i) => (e, ...r) => ({ _$litType$: i, strings: e, values: r }), p = ke(1), k = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), se = /* @__PURE__ */ new WeakMap(), S = A.createTreeWalker(A, 129);
253
- function ce(i, e) {
254
- if (!q(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
- return Q !== void 0 ? Q.createHTML(e) : e;
256
- }
257
- const xe = (i, e) => {
258
- const r = i.length - 1, t = [];
259
- let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = M;
260
- for (let l = 0; l < r; l++) {
261
- const n = i[l];
262
- let m, g, h = -1, f = 0;
263
- for (; f < n.length && (a.lastIndex = f, g = a.exec(n), g !== null); ) f = a.lastIndex, a === M ? g[1] === "!--" ? a = ee : g[1] !== void 0 ? a = te : g[2] !== void 0 ? (le.test(g[2]) && (s = RegExp("</" + g[2], "g")), a = w) : g[3] !== void 0 && (a = w) : a === w ? g[0] === ">" ? (a = s ?? M, h = -1) : g[1] === void 0 ? h = -2 : (h = a.lastIndex - g[2].length, m = g[1], a = g[3] === void 0 ? w : g[3] === '"' ? ie : re) : a === ie || a === re ? a = w : a === ee || a === te ? a = M : (a = w, s = void 0);
264
- const b = a === w && i[l + 1].startsWith("/>") ? " " : "";
265
- o += a === M ? n + Se : h >= 0 ? (t.push(m), n.slice(0, h) + ae + n.slice(h) + _ + b) : n + _ + (h === -2 ? l : b);
266
- }
267
- return [ce(i, o + (i[r] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), t];
268
- };
269
- class H {
270
- constructor({ strings: e, _$litType$: r }, t) {
271
- let s;
272
- this.parts = [];
273
- let o = 0, a = 0;
274
- const l = e.length - 1, n = this.parts, [m, g] = xe(e, r);
275
- if (this.el = H.createElement(m, t), S.currentNode = this.el.content, r === 2 || r === 3) {
276
- const h = this.el.content.firstChild;
277
- h.replaceWith(...h.childNodes);
278
- }
279
- for (; (s = S.nextNode()) !== null && n.length < l; ) {
280
- if (s.nodeType === 1) {
281
- if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(ae)) {
282
- const f = g[a++], b = s.getAttribute(h).split(_), z = /([.?@])?(.*)/.exec(f);
283
- n.push({ type: 1, index: o, name: z[2], strings: b, ctor: z[1] === "." ? Me : z[1] === "?" ? Ee : z[1] === "@" ? De : j }), s.removeAttribute(h);
284
- } else h.startsWith(_) && (n.push({ type: 6, index: o }), s.removeAttribute(h));
285
- if (le.test(s.tagName)) {
286
- const h = s.textContent.split(_), f = h.length - 1;
287
- if (f > 0) {
288
- s.textContent = U ? U.emptyScript : "";
289
- for (let b = 0; b < f; b++) s.append(h[b], C()), S.nextNode(), n.push({ type: 2, index: ++o });
290
- s.append(h[f], C());
291
- }
292
- }
293
- } else if (s.nodeType === 8) if (s.data === ne) n.push({ type: 2, index: o });
294
- else {
295
- let h = -1;
296
- for (; (h = s.data.indexOf(_, h + 1)) !== -1; ) n.push({ type: 7, index: o }), h += _.length - 1;
297
- }
298
- o++;
299
- }
300
- }
301
- static createElement(e, r) {
302
- const t = A.createElement("template");
303
- return t.innerHTML = e, t;
304
- }
305
- }
306
- function P(i, e, r = i, t) {
307
- if (e === k) return e;
308
- let s = t !== void 0 ? r._$Co?.[t] : r._$Cl;
309
- const o = T(e) ? void 0 : e._$litDirective$;
310
- return s?.constructor !== o && (s?._$AO?.(!1), o === void 0 ? s = void 0 : (s = new o(i), s._$AT(i, r, t)), t !== void 0 ? (r._$Co ??= [])[t] = s : r._$Cl = s), s !== void 0 && (e = P(i, s._$AS(i, e.values), s, t)), e;
311
- }
312
- class Pe {
313
- constructor(e, r) {
314
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = r;
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: r }, parts: t } = this._$AD, s = (e?.creationScope ?? A).importNode(r, !0);
324
- S.currentNode = s;
325
- let o = S.nextNode(), a = 0, l = 0, n = t[0];
326
- for (; n !== void 0; ) {
327
- if (a === n.index) {
328
- let m;
329
- n.type === 2 ? m = new O(o, o.nextSibling, this, e) : n.type === 1 ? m = new n.ctor(o, n.name, n.strings, this, e) : n.type === 6 && (m = new Ce(o, this, e)), this._$AV.push(m), n = t[++l];
330
- }
331
- a !== n?.index && (o = S.nextNode(), a++);
332
- }
333
- return S.currentNode = A, s;
334
- }
335
- p(e) {
336
- let r = 0;
337
- for (const t of this._$AV) t !== void 0 && (t.strings !== void 0 ? (t._$AI(e, t, r), r += t.strings.length - 2) : t._$AI(e[r])), r++;
338
- }
339
- }
340
- class O {
341
- get _$AU() {
342
- return this._$AM?._$AU ?? this._$Cv;
343
- }
344
- constructor(e, r, t, s) {
345
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = e, this._$AB = r, this._$AM = t, this.options = s, this._$Cv = s?.isConnected ?? !0;
346
- }
347
- get parentNode() {
348
- let e = this._$AA.parentNode;
349
- const r = this._$AM;
350
- return r !== void 0 && e?.nodeType === 11 && (e = r.parentNode), e;
351
- }
352
- get startNode() {
353
- return this._$AA;
354
- }
355
- get endNode() {
356
- return this._$AB;
357
- }
358
- _$AI(e, r = this) {
359
- e = P(this, e, r), T(e) ? e === u || e == null || e === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : e !== this._$AH && e !== k && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ae(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 !== u && T(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
369
- }
370
- $(e) {
371
- const { values: r, _$litType$: t } = e, s = typeof t == "number" ? this._$AC(e) : (t.el === void 0 && (t.el = H.createElement(ce(t.h, t.h[0]), this.options)), t);
372
- if (this._$AH?._$AD === s) this._$AH.p(r);
373
- else {
374
- const o = new Pe(s, this), a = o.u(this.options);
375
- o.p(r), this.T(a), this._$AH = o;
376
- }
377
- }
378
- _$AC(e) {
379
- let r = se.get(e.strings);
380
- return r === void 0 && se.set(e.strings, r = new H(e)), r;
381
- }
382
- k(e) {
383
- q(this._$AH) || (this._$AH = [], this._$AR());
384
- const r = this._$AH;
385
- let t, s = 0;
386
- for (const o of e) s === r.length ? r.push(t = new O(this.O(C()), this.O(C()), this, this.options)) : t = r[s], t._$AI(o), s++;
387
- s < r.length && (this._$AR(t && t._$AB.nextSibling, s), r.length = s);
388
- }
389
- _$AR(e = this._$AA.nextSibling, r) {
390
- for (this._$AP?.(!1, !0, r); e !== this._$AB; ) {
391
- const t = e.nextSibling;
392
- e.remove(), e = t;
393
- }
394
- }
395
- setConnected(e) {
396
- this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
397
- }
398
- }
399
- class j {
400
- get tagName() {
401
- return this.element.tagName;
402
- }
403
- get _$AU() {
404
- return this._$AM._$AU;
405
- }
406
- constructor(e, r, t, s, o) {
407
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = e, this.name = r, this._$AM = s, this.options = o, t.length > 2 || t[0] !== "" || t[1] !== "" ? (this._$AH = Array(t.length - 1).fill(new String()), this.strings = t) : this._$AH = u;
408
- }
409
- _$AI(e, r = this, t, s) {
410
- const o = this.strings;
411
- let a = !1;
412
- if (o === void 0) e = P(this, e, r, 0), a = !T(e) || e !== this._$AH && e !== k, a && (this._$AH = e);
413
- else {
414
- const l = e;
415
- let n, m;
416
- for (e = o[0], n = 0; n < o.length - 1; n++) m = P(this, l[t + n], r, n), m === k && (m = this._$AH[n]), a ||= !T(m) || m !== this._$AH[n], m === u ? e = u : e !== u && (e += (m ?? "") + o[n + 1]), this._$AH[n] = m;
417
- }
418
- a && !s && this.j(e);
419
- }
420
- j(e) {
421
- e === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
422
- }
423
- }
424
- class Me extends j {
425
- constructor() {
426
- super(...arguments), this.type = 3;
427
- }
428
- j(e) {
429
- this.element[this.name] = e === u ? void 0 : e;
430
- }
431
- }
432
- class Ee extends j {
433
- constructor() {
434
- super(...arguments), this.type = 4;
435
- }
436
- j(e) {
437
- this.element.toggleAttribute(this.name, !!e && e !== u);
438
- }
439
- }
440
- class De extends j {
441
- constructor(e, r, t, s, o) {
442
- super(e, r, t, s, o), this.type = 5;
443
- }
444
- _$AI(e, r = this) {
445
- if ((e = P(this, e, r, 0) ?? u) === k) return;
446
- const t = this._$AH, s = e === u && t !== u || e.capture !== t.capture || e.once !== t.once || e.passive !== t.passive, o = e !== u && (t === u || s);
447
- s && this.element.removeEventListener(this.name, this, t), 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 Ce {
454
- constructor(e, r, t) {
455
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = t;
456
- }
457
- get _$AU() {
458
- return this._$AM._$AU;
459
- }
460
- _$AI(e) {
461
- P(this, e);
462
- }
463
- }
464
- const Te = V.litHtmlPolyfillSupport;
465
- Te?.(H, O), (V.litHtmlVersions ??= []).push("3.3.1");
466
- const He = (i, e, r) => {
467
- const t = r?.renderBefore ?? e;
468
- let s = t._$litPart$;
469
- if (s === void 0) {
470
- const o = r?.renderBefore ?? null;
471
- t._$litPart$ = s = new O(e.insertBefore(C(), o), o, void 0, r ?? {});
472
- }
473
- return s._$AI(i), s;
474
- };
475
- const W = globalThis;
476
- let D = 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 r = this.render();
486
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = He(r, 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 k;
496
- }
497
- };
498
- D._$litElement$ = !0, D.finalized = !0, W.litElementHydrateSupport?.({ LitElement: D });
499
- const Oe = W.litElementPolyfillSupport;
500
- Oe?.({ LitElement: D });
501
- (W.litElementVersions ??= []).push("4.2.1");
502
- const ze = (i) => (e, r) => {
503
- r !== void 0 ? r.addInitializer((() => {
504
- customElements.define(i, e);
505
- })) : customElements.define(i, e);
506
- };
507
- const Re = { attribute: !0, type: String, converter: N, reflect: !1, hasChanged: L }, Ne = (i = Re, e, r) => {
508
- const { kind: t, metadata: s } = r;
509
- let o = globalThis.litPropertyMetadata.get(s);
510
- if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), t === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(r.name, i), t === "accessor") {
511
- const { name: a } = r;
512
- return { set(l) {
513
- const n = e.get.call(this);
514
- e.set.call(this, l), this.requestUpdate(a, n, i);
515
- }, init(l) {
516
- return l !== void 0 && this.C(a, void 0, i, l), l;
517
- } };
518
- }
519
- if (t === "setter") {
520
- const { name: a } = r;
521
- return function(l) {
522
- const n = this[a];
523
- e.call(this, l), this.requestUpdate(a, n, i);
524
- };
525
- }
526
- throw Error("Unsupported decorator location: " + t);
527
- };
528
- function v(i) {
529
- return (e, r) => typeof r == "object" ? Ne(i, e, r) : ((t, s, o) => {
530
- const a = s.hasOwnProperty(o);
531
- return s.constructor.createProperty(o, t), a ? Object.getOwnPropertyDescriptor(s, o) : void 0;
532
- })(i, e, r);
533
- }
534
- function y(i) {
535
- return v({ ...i, state: !0, attribute: !1 });
536
- }
537
- const Ue = (i, e, r) => (r.configurable = !0, r.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(i, e, r), r);
538
- function de(i, e) {
539
- return (r, t, s) => {
540
- const o = (a) => a.renderRoot?.querySelector(i) ?? null;
541
- return Ue(r, t, { get() {
542
- return o(this);
543
- } });
544
- };
545
- }
546
- const Ye = { ATTRIBUTE: 1 }, je = (i) => (...e) => ({ _$litDirective$: i, values: e });
547
- class Be {
548
- constructor(e) {
549
- }
550
- get _$AU() {
551
- return this._$AM._$AU;
552
- }
553
- _$AT(e, r, t) {
554
- this._$Ct = e, this._$AM = r, this._$Ci = t;
555
- }
556
- _$AS(e, r) {
557
- return this.update(e, r);
558
- }
559
- update(e, r) {
560
- return this.render(...r);
561
- }
562
- }
563
- const $ = je(class extends Be {
564
- constructor(i) {
565
- if (super(i), i.type !== Ye.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(((t) => t !== ""))));
573
- for (const t in e) e[t] && !this.nt?.has(t) && this.st.add(t);
574
- return this.render(e);
575
- }
576
- const r = i.element.classList;
577
- for (const t of this.st) t in e || (r.remove(t), this.st.delete(t));
578
- for (const t in e) {
579
- const s = !!e[t];
580
- s === this.st.has(t) || this.nt?.has(t) || (s ? (r.add(t), this.st.add(t)) : (r.remove(t), this.st.delete(t)));
581
- }
582
- return k;
583
- }
584
- });
585
- const Ie = (i) => i ?? u;
586
- var Fe = Object.defineProperty, he = (i, e, r, t) => {
587
- for (var s = void 0, o = i.length - 1, a; o >= 0; o--)
588
- (a = i[o]) && (s = a(e, r, s) || s);
589
- return s && Fe(e, r, s), s;
590
- };
591
- class K extends D {
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"), r = localStorage.getItem(this.storageKey), t = window.matchMedia("(prefers-color-scheme: dark)").matches;
598
- e ? this.theme = e : r ? (this.theme = r, this.applyTheme()) : t ? (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 r = e;
605
- r.target !== this && r.detail.theme !== this.theme && (this.theme = r.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
- he([
618
- v({ type: String, attribute: "data-theme", reflect: !0 })
619
- ], K.prototype, "theme");
620
- he([
621
- v({ type: String, attribute: "storage-key" })
622
- ], K.prototype, "storageKey");
623
- var Le = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, d = (i, e, r, t) => {
624
- for (var s = t > 1 ? void 0 : t ? Ve(e, r) : e, o = i.length - 1, a; o >= 0; o--)
625
- (a = i[o]) && (s = (t ? a(e, r, s) : a(s)) || s);
626
- return t && s && Le(e, r, s), s;
627
- };
628
- let c = class extends K {
629
- constructor() {
630
- super(...arguments), this.value = "", this.placeholder = "Select date and time", this.required = !1, this.disabled = !1, this.size = "md", this.format = "12", this.isOpen = !1, this.currentMonth = (/* @__PURE__ */ new Date()).getMonth(), this.currentYear = (/* @__PURE__ */ new Date()).getFullYear(), this.showMonthPicker = !1, this.showYearPicker = !1, this.yearRangeStart = (/* @__PURE__ */ new Date()).getFullYear() - 5, this.selectedDate = "", this.selectedHour = 12, this.selectedMinute = 0, this.selectedPeriod = "AM", this.isFlipped = !1, this.currentStep = "date", this.inputId = `datetime-picker-${Math.random().toString(36).substr(2, 9)}`, this.weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], this.monthNames = [
631
- "Jan",
632
- "Feb",
633
- "Mar",
634
- "Apr",
635
- "May",
636
- "Jun",
637
- "Jul",
638
- "Aug",
639
- "Sep",
640
- "Oct",
641
- "Nov",
642
- "Dec"
643
- ];
644
- }
645
- connectedCallback() {
646
- super.connectedCallback(), this.parseValue();
647
- }
648
- updated(i) {
649
- i.has("value") && this.parseValue();
650
- }
651
- parseValue() {
652
- if (!this.value) return;
653
- const [i, e] = this.value.split("T");
654
- if (!i || !e) return;
655
- this.selectedDate = i;
656
- const r = /* @__PURE__ */ new Date(i + "T00:00:00");
657
- isNaN(r.getTime()) || (this.currentMonth = r.getMonth(), this.currentYear = r.getFullYear());
658
- const [t, s] = e.split(":").map(Number);
659
- isNaN(t) || isNaN(s) || (this.selectedMinute = s, this.format === "12" ? t === 0 ? (this.selectedHour = 12, this.selectedPeriod = "AM") : t < 12 ? (this.selectedHour = t, this.selectedPeriod = "AM") : t === 12 ? (this.selectedHour = 12, this.selectedPeriod = "PM") : (this.selectedHour = t - 12, this.selectedPeriod = "PM") : this.selectedHour = t);
660
- }
661
- get displayValue() {
662
- if (!this.value) return "";
663
- const [i, e] = this.value.split("T");
664
- if (!i || !e) return this.value;
665
- const r = /* @__PURE__ */ new Date(i + "T00:00:00"), t = isNaN(r.getTime()) ? i : r.toLocaleDateString("en-US", {
666
- year: "numeric",
667
- month: "short",
668
- day: "numeric"
669
- }), [s, o] = e.split(":").map(Number);
670
- let a = e;
671
- if (!isNaN(s) && !isNaN(o))
672
- if (this.format === "12") {
673
- const l = s < 12 ? "AM" : "PM";
674
- a = `${s === 0 ? 12 : s > 12 ? s - 12 : s}:${String(o).padStart(2, "0")} ${l}`;
675
- } else
676
- a = `${String(s).padStart(2, "0")}:${String(o).padStart(2, "0")}`;
677
- return `${t} ${a}`;
678
- }
679
- get currentMonthName() {
680
- return new Date(this.currentYear, this.currentMonth).toLocaleDateString("en-US", { month: "long" });
681
- }
682
- get yearRangeEnd() {
683
- return this.yearRangeStart + 11;
684
- }
685
- get yearRange() {
686
- const i = [];
687
- for (let e = this.yearRangeStart; e <= this.yearRangeEnd; e++)
688
- i.push(e);
689
- return i;
690
- }
691
- get calendarDays() {
692
- const i = new Date(this.currentYear, this.currentMonth, 1), e = new Date(this.currentYear, this.currentMonth + 1, 0), r = i.getDay(), t = e.getDate(), s = [];
693
- for (let o = 0; o < r; o++)
694
- s.push(null);
695
- for (let o = 1; o <= t; o++)
696
- s.push(o);
697
- for (; s.length < 42; )
698
- s.push(null);
699
- return s.slice(0, 42);
700
- }
701
- get hours() {
702
- return this.format === "12" ? Array.from({ length: 12 }, (i, e) => e + 1) : Array.from({ length: 24 }, (i, e) => e);
703
- }
704
- get minutes() {
705
- return Array.from({ length: 60 }, (i, e) => e);
706
- }
707
- handleDisplayClick() {
708
- this.disabled || this.togglePicker();
709
- }
710
- togglePicker() {
711
- if (this.isOpen = !this.isOpen, this.isOpen && !this.selectedDate) {
712
- const i = /* @__PURE__ */ new Date(), e = i.getFullYear(), r = String(i.getMonth() + 1).padStart(2, "0"), t = String(i.getDate()).padStart(2, "0");
713
- this.selectedDate = `${e}-${r}-${t}`;
714
- }
715
- this.isOpen && requestAnimationFrame(() => this.updateDropdownPosition());
716
- }
717
- updateDropdownPosition() {
718
- if (!this.datetimeContainer || !this.datetimeDisplay) return;
719
- const i = this.datetimeDisplay.getBoundingClientRect(), e = 320, r = window.innerHeight - i.bottom, t = i.top;
720
- this.isFlipped = r < e && t > r;
721
- }
722
- closePicker() {
723
- this.isOpen = !1, this.showMonthPicker = !1, this.showYearPicker = !1, this.isFlipped = !1, this.currentStep = "date";
724
- }
725
- selectDate(i) {
726
- const e = new Date(this.currentYear, this.currentMonth, i), r = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0");
727
- this.selectedDate = `${r}-${t}-${s}`, this.currentStep = "time";
728
- }
729
- selectHour(i) {
730
- this.selectedHour = i;
731
- }
732
- selectMinute(i) {
733
- this.selectedMinute = i;
734
- }
735
- selectPeriod(i) {
736
- this.selectedPeriod = i;
737
- }
738
- goBackToDateStep() {
739
- this.currentStep = "date";
740
- }
741
- selectNow() {
742
- const i = /* @__PURE__ */ new Date(), e = i.getFullYear(), r = String(i.getMonth() + 1).padStart(2, "0"), t = String(i.getDate()).padStart(2, "0");
743
- this.selectedDate = `${e}-${r}-${t}`, this.currentMonth = i.getMonth(), this.currentYear = i.getFullYear();
744
- const s = i.getHours(), o = i.getMinutes();
745
- this.selectedMinute = o, this.format === "12" ? s === 0 ? (this.selectedHour = 12, this.selectedPeriod = "AM") : s < 12 ? (this.selectedHour = s, this.selectedPeriod = "AM") : s === 12 ? (this.selectedHour = 12, this.selectedPeriod = "PM") : (this.selectedHour = s - 12, this.selectedPeriod = "PM") : this.selectedHour = s, this.applyDateTime();
746
- }
747
- applyDateTime() {
748
- if (!this.selectedDate) return;
749
- let i = this.selectedHour;
750
- this.format === "12" && (this.selectedPeriod === "AM" ? i = this.selectedHour === 12 ? 0 : this.selectedHour : i = this.selectedHour === 12 ? 12 : this.selectedHour + 12);
751
- const e = `${String(i).padStart(2, "0")}:${String(this.selectedMinute).padStart(2, "0")}`, r = `${this.selectedDate}T${e}`, t = this.value;
752
- this.value = r, this.dispatchEvent(
753
- new CustomEvent("change", {
754
- detail: { value: r, oldValue: t },
755
- bubbles: !0,
756
- composed: !0
757
- })
758
- ), this.closePicker();
759
- }
760
- previousMonth(i) {
761
- i.stopPropagation(), this.currentMonth === 0 ? (this.currentMonth = 11, this.currentYear--) : this.currentMonth--;
762
- }
763
- nextMonth(i) {
764
- i.stopPropagation(), this.currentMonth === 11 ? (this.currentMonth = 0, this.currentYear++) : this.currentMonth++;
765
- }
766
- isSelectedDate(i) {
767
- if (!this.selectedDate) return !1;
768
- const e = /* @__PURE__ */ new Date(this.selectedDate + "T00:00:00");
769
- return e.getDate() === i && e.getMonth() === this.currentMonth && e.getFullYear() === this.currentYear;
770
- }
771
- isToday(i) {
772
- const e = /* @__PURE__ */ new Date();
773
- return e.getDate() === i && e.getMonth() === this.currentMonth && e.getFullYear() === this.currentYear;
774
- }
775
- isDisabled(i) {
776
- const e = new Date(this.currentYear, this.currentMonth, i), r = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0"), o = `${r}-${t}-${s}`;
777
- return !!(this.minDate && o < this.minDate || this.maxDate && o > this.maxDate);
778
- }
779
- selectMonth(i) {
780
- this.currentMonth = i, this.showMonthPicker = !1;
781
- }
782
- selectYear(i) {
783
- this.currentYear = i, this.showYearPicker = !1, (i < this.yearRangeStart || i > this.yearRangeEnd) && (this.yearRangeStart = i - 5);
784
- }
785
- yearRangeBack(i) {
786
- i.stopPropagation(), this.yearRangeStart -= 12;
787
- }
788
- yearRangeForward(i) {
789
- i.stopPropagation(), this.yearRangeStart += 12;
790
- }
791
- handleKeydown(i) {
792
- if (!this.disabled)
793
- switch (i.key) {
794
- case "Enter":
795
- case " ":
796
- i.preventDefault(), this.isOpen ? this.applyDateTime() : this.togglePicker();
797
- break;
798
- case "Escape":
799
- i.preventDefault(), this.closePicker();
800
- break;
801
- }
802
- }
803
- render() {
804
- const i = !!this.error, e = {
805
- "datetime-wrapper": !0,
806
- [`datetime-picker--${this.size}`]: !0,
807
- "datetime-picker--error": i
808
- }, r = {
809
- "datetime-display": !0,
810
- "datetime-display--open": this.isOpen,
811
- "datetime-display--empty": !this.value,
812
- "datetime-disabled": this.disabled
813
- };
814
- return p`
815
- <div class="datetime-picker-group">
816
- ${this.label ? p`
817
- <label for=${this.inputId} class="datetime-picker-label">
818
- ${this.label}
819
- ${this.required ? p`<span class="required-indicator" aria-label="required">*</span>` : ""}
820
- </label>
821
- ` : ""}
822
-
823
- <div class=${$(e)}>
824
- <div
825
- id=${this.inputId}
826
- class=${$(r)}
827
- @click=${this.handleDisplayClick}
828
- @keydown=${this.handleKeydown}
829
- tabindex=${this.disabled ? -1 : 0}
830
- role="button"
831
- aria-haspopup="dialog"
832
- aria-expanded=${this.isOpen}
833
- aria-describedby=${Ie(i ? `${this.inputId}-error` : void 0)}
834
- aria-invalid=${i}
835
- >
836
- ${this.displayValue || this.placeholder}
837
- </div>
838
-
839
- <div class="datetime-icon">
840
- <svg viewBox="0 0 20 20" fill="currentColor">
841
- <path
842
- fill-rule="evenodd"
843
- d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
844
- clip-rule="evenodd"
845
- />
846
- </svg>
847
- </div>
848
-
849
- ${this.isOpen ? p`
850
- <div class="datetime-overlay" @click=${this.closePicker}></div>
851
- <div
852
- class=${$({
853
- "datetime-container": !0,
854
- "datetime-container--flipped": this.isFlipped
855
- })}
856
- role="dialog"
857
- aria-label="Choose date and time"
858
- >
859
- ${this.currentStep === "date" ? p`
860
- ${this.showMonthPicker ? p`
861
- <div class="picker-overlay">
862
- <div class="month-picker-container">
863
- <div class="month-picker-grid">
864
- ${this.monthNames.map(
865
- (t, s) => p`
866
- <div
867
- class=${$({
868
- "month-item": !0,
869
- "month-selected": s === this.currentMonth
870
- })}
871
- @click=${() => this.selectMonth(s)}
872
- >
873
- ${t}
874
- </div>
875
- `
876
- )}
877
- </div>
878
- </div>
879
- </div>
880
- ` : this.showYearPicker ? p`
881
- <div class="picker-overlay">
882
- <div class="year-picker-container">
883
- <div class="year-picker-header">
884
- <button
885
- type="button"
886
- class="year-nav"
887
- @click=${this.yearRangeBack}
888
- >
889
-
890
- </button>
891
- <span class="year-range"
892
- >${this.yearRangeStart} - ${this.yearRangeEnd}</span
893
- >
894
- <button
895
- type="button"
896
- class="year-nav"
897
- @click=${this.yearRangeForward}
898
- >
899
-
900
- </button>
901
- </div>
902
- <div class="year-picker-grid">
903
- ${this.yearRange.map(
904
- (t) => p`
905
- <div
906
- class=${$({
907
- "year-item": !0,
908
- "year-selected": t === this.currentYear
909
- })}
910
- @click=${() => this.selectYear(t)}
911
- >
912
- ${t}
913
- </div>
914
- `
915
- )}
916
- </div>
917
- </div>
918
- </div>
919
- ` : p`
920
- <div class="step-header">
921
- <div class="step-title">Select Date</div>
922
- </div>
923
- <div class="calendar-section">
924
- <div class="calendar-header">
925
- <button
926
- type="button"
927
- class="calendar-nav"
928
- @click=${this.previousMonth}
929
- >
930
-
931
- </button>
932
- <div class="calendar-month-year">
933
- <span
934
- class="month-selector"
935
- @click=${() => this.showMonthPicker = !0}
936
- >
937
- ${this.currentMonthName}
938
- </span>
939
- <span
940
- class="year-selector"
941
- @click=${() => this.showYearPicker = !0}
942
- >
943
- ${this.currentYear}
944
- </span>
945
- </div>
946
- <button
947
- type="button"
948
- class="calendar-nav"
949
- @click=${this.nextMonth}
950
- >
951
-
952
- </button>
953
- </div>
954
-
955
- <div class="calendar-weekdays">
956
- ${this.weekDays.map(
957
- (t) => p`<div class="calendar-weekday">${t}</div>`
958
- )}
959
- </div>
960
-
961
- <div class="calendar-days">
962
- ${this.calendarDays.map(
963
- (t) => t ? p`
964
- <div
965
- class=${$({
966
- "calendar-day": !0,
967
- "day-selected": this.isSelectedDate(t),
968
- "day-today": this.isToday(t),
969
- "day-disabled": this.isDisabled(t)
970
- })}
971
- @click=${() => !this.isDisabled(t) && this.selectDate(t)}
972
- >
973
- ${t}
974
- </div>
975
- ` : p`<div class="calendar-day day-empty"></div>`
976
- )}
977
- </div>
978
- </div>
979
-
980
- <div class="datetime-footer">
981
- <button type="button" class="datetime-btn" @click=${this.selectNow}>
982
- Now
983
- </button>
984
- </div>
985
- `}
986
- ` : p`
987
- <div class="step-header">
988
- <button
989
- type="button"
990
- class="step-back-btn"
991
- @click=${this.goBackToDateStep}
992
- aria-label="Go back to date selection"
993
- >
994
-
995
- </button>
996
- <div class="step-title">Select Time</div>
997
- </div>
998
-
999
- <div class="time-section">
1000
- <div class="time-selectors">
1001
- <div class="time-column">
1002
- <div class="time-column-label">Hour</div>
1003
- <div class="time-scroll">
1004
- ${this.hours.map(
1005
- (t) => p`
1006
- <div
1007
- class=${$({
1008
- "time-option": !0,
1009
- "time-option--selected": t === this.selectedHour
1010
- })}
1011
- @click=${() => this.selectHour(t)}
1012
- >
1013
- ${this.format === "24" ? String(t).padStart(2, "0") : t}
1014
- </div>
1015
- `
1016
- )}
1017
- </div>
1018
- </div>
1019
-
1020
- <div class="time-column">
1021
- <div class="time-column-label">Minute</div>
1022
- <div class="time-scroll">
1023
- ${this.minutes.map(
1024
- (t) => p`
1025
- <div
1026
- class=${$({
1027
- "time-option": !0,
1028
- "time-option--selected": t === this.selectedMinute
1029
- })}
1030
- @click=${() => this.selectMinute(t)}
1031
- >
1032
- ${String(t).padStart(2, "0")}
1033
- </div>
1034
- `
1035
- )}
1036
- </div>
1037
- </div>
1038
-
1039
- ${this.format === "12" ? p`
1040
- <div class="time-column">
1041
- <div class="time-column-label">Period</div>
1042
- <div class="time-scroll">
1043
- ${["AM", "PM"].map(
1044
- (t) => p`
1045
- <div
1046
- class=${$({
1047
- "time-option": !0,
1048
- "time-option--selected": t === this.selectedPeriod
1049
- })}
1050
- @click=${() => this.selectPeriod(t)}
1051
- >
1052
- ${t}
1053
- </div>
1054
- `
1055
- )}
1056
- </div>
1057
- </div>
1058
- ` : ""}
1059
- </div>
1060
- </div>
1061
-
1062
- <div class="datetime-footer">
1063
- <button type="button" class="datetime-btn" @click=${this.applyDateTime}>
1064
- Apply
1065
- </button>
1066
- </div>
1067
- `}
1068
- </div>
1069
- ` : ""}
1070
- </div>
1071
-
1072
- ${i ? p`
1073
- <div id="${this.inputId}-error" class="datetime-picker-error" role="alert">
1074
- ${this.error}
1075
- </div>
1076
- ` : this.hint ? p` <div class="datetime-picker-hint">${this.hint}</div> ` : ""}
1077
- </div>
1078
- `;
1079
- }
1080
- };
1081
- c.styles = ue`
1082
- :host {
1083
- display: block;
1084
- position: relative;
1085
- }
1086
-
1087
- .datetime-picker-group {
1088
- display: flex;
1089
- flex-direction: column;
1090
- gap: var(--space-2);
1091
- }
1092
-
1093
- .datetime-picker-label {
1094
- display: flex;
1095
- align-items: center;
1096
- gap: var(--space-1);
1097
- font-size: var(--font-size-sm);
1098
- font-weight: var(--font-weight-medium);
1099
- color: var(--color-text-primary);
1100
- line-height: var(--line-height-tight);
1101
- }
1102
-
1103
- .required-indicator {
1104
- color: var(--color-error);
1105
- font-weight: var(--font-weight-bold);
1106
- }
1107
-
1108
- .datetime-wrapper {
1109
- position: relative;
1110
- }
1111
-
1112
- .datetime-display {
1113
- width: 100%;
1114
- font-family: var(--font-family-sans);
1115
- background-color: var(--color-bg-primary);
1116
- border: 1px solid var(--color-border);
1117
- border-radius: var(--radius-md);
1118
- transition: all var(--transition-fast);
1119
- color: var(--color-text-primary);
1120
- cursor: pointer;
1121
- user-select: none;
1122
- display: flex;
1123
- align-items: center;
1124
- box-sizing: border-box;
1125
- }
1126
-
1127
- .datetime-display:hover:not(.datetime-disabled) {
1128
- border-color: var(--color-border-hover);
1129
- }
1130
-
1131
- .datetime-display--open {
1132
- border-color: var(--color-border-focus);
1133
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
1134
- }
1135
-
1136
- .datetime-display--empty {
1137
- color: var(--color-text-muted);
1138
- }
1139
-
1140
- /* Sizes */
1141
- .datetime-picker--sm .datetime-display {
1142
- padding: var(--space-2) var(--space-3);
1143
- padding-right: var(--space-8);
1144
- font-size: var(--font-size-sm);
1145
- }
1146
-
1147
- .datetime-picker--md .datetime-display {
1148
- padding: var(--space-3) var(--space-4);
1149
- padding-right: var(--space-10);
1150
- font-size: var(--font-size-base);
1151
- }
1152
-
1153
- .datetime-picker--lg .datetime-display {
1154
- padding: var(--space-4) var(--space-5);
1155
- padding-right: var(--space-12);
1156
- font-size: var(--font-size-lg);
1157
- }
1158
-
1159
- /* States */
1160
- .datetime-picker--error .datetime-display {
1161
- border-color: var(--color-error);
1162
- }
1163
-
1164
- .datetime-picker--error .datetime-display--open {
1165
- box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
1166
- }
1167
-
1168
- .datetime-disabled {
1169
- opacity: 0.5;
1170
- cursor: not-allowed !important;
1171
- background-color: var(--color-bg-muted);
1172
- }
1173
-
1174
- .datetime-icon {
1175
- position: absolute;
1176
- right: var(--space-3);
1177
- top: 50%;
1178
- transform: translateY(-50%);
1179
- color: var(--color-text-secondary);
1180
- pointer-events: none;
1181
- }
1182
-
1183
- .datetime-icon svg {
1184
- width: 1.25em;
1185
- height: 1.25em;
1186
- display: block;
1187
- }
1188
-
1189
- /* DateTime Picker Container */
1190
- .datetime-overlay {
1191
- position: fixed;
1192
- top: 0;
1193
- left: 0;
1194
- right: 0;
1195
- bottom: 0;
1196
- z-index: 999;
1197
- background: transparent;
1198
- }
1199
-
1200
- .datetime-container {
1201
- position: absolute;
1202
- top: calc(100% + 4px);
1203
- left: 0;
1204
- min-width: 300px;
1205
- background: var(--color-bg-primary);
1206
- border: 1px solid var(--color-border-focus);
1207
- border-radius: var(--radius-md);
1208
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
1209
- z-index: 1000;
1210
- padding: var(--space-2);
1211
- display: flex;
1212
- flex-direction: column;
1213
- gap: 0;
1214
- }
1215
-
1216
- .datetime-container--flipped {
1217
- top: auto;
1218
- bottom: calc(100% + 4px);
1219
- }
1220
-
1221
- /* Calendar Styles (same as date-picker) */
1222
- .calendar-header {
1223
- display: flex;
1224
- justify-content: space-between;
1225
- align-items: center;
1226
- margin-bottom: var(--space-2);
1227
- padding: 0 var(--space-1);
1228
- }
1229
-
1230
- .calendar-nav {
1231
- background: none;
1232
- border: none;
1233
- color: var(--color-text-secondary);
1234
- font-size: 1.1rem;
1235
- cursor: pointer;
1236
- padding: var(--space-1);
1237
- border-radius: 50%;
1238
- width: 28px;
1239
- height: 28px;
1240
- display: flex;
1241
- align-items: center;
1242
- justify-content: center;
1243
- transition: all 0.2s ease;
1244
- }
1245
-
1246
- .calendar-nav:hover {
1247
- background-color: var(--color-bg-secondary);
1248
- color: var(--color-text-primary);
1249
- }
1250
-
1251
- .calendar-month-year {
1252
- font-size: var(--font-size-sm);
1253
- font-weight: var(--font-weight-medium);
1254
- color: var(--color-text-primary);
1255
- display: flex;
1256
- gap: var(--space-1);
1257
- align-items: center;
1258
- }
1259
-
1260
- .month-selector,
1261
- .year-selector {
1262
- cursor: pointer;
1263
- padding: 2px var(--space-2);
1264
- border-radius: var(--radius-md);
1265
- transition: all 0.2s ease;
1266
- border: 1px solid transparent;
1267
- }
1268
-
1269
- .month-selector:hover,
1270
- .year-selector:hover {
1271
- background-color: var(--color-bg-secondary);
1272
- border-color: var(--color-border);
1273
- }
1274
-
1275
- .calendar-weekdays {
1276
- display: grid;
1277
- grid-template-columns: repeat(7, 1fr);
1278
- gap: 0;
1279
- margin-bottom: var(--space-1);
1280
- }
1281
-
1282
- .calendar-weekday {
1283
- text-align: center;
1284
- font-size: var(--font-size-xs);
1285
- font-weight: var(--font-weight-medium);
1286
- color: var(--color-text-secondary);
1287
- padding: 2px;
1288
- }
1289
-
1290
- .calendar-days {
1291
- display: grid;
1292
- grid-template-columns: repeat(7, 1fr);
1293
- gap: 1px;
1294
- padding: var(--space-1) 0;
1295
- }
1296
-
1297
- .calendar-day {
1298
- aspect-ratio: 1;
1299
- display: flex;
1300
- align-items: center;
1301
- justify-content: center;
1302
- font-size: var(--font-size-sm);
1303
- color: var(--color-text-primary);
1304
- cursor: pointer;
1305
- border-radius: 50%;
1306
- transition: all 0.15s ease;
1307
- min-height: 32px;
1308
- }
1309
-
1310
- .calendar-day:not(.day-empty):not(.day-disabled):hover {
1311
- background-color: var(--color-bg-secondary);
1312
- }
1313
-
1314
- .day-empty {
1315
- cursor: default;
1316
- }
1317
-
1318
- .day-selected {
1319
- background-color: var(--color-primary);
1320
- color: white;
1321
- font-weight: var(--font-weight-medium);
1322
- }
1323
-
1324
- .day-selected:hover {
1325
- background-color: var(--color-primary) !important;
1326
- transform: scale(1.1);
1327
- }
1328
-
1329
- .day-today {
1330
- position: relative;
1331
- font-weight: var(--font-weight-medium);
1332
- }
1333
-
1334
- .day-today::after {
1335
- content: '';
1336
- position: absolute;
1337
- bottom: 2px;
1338
- left: 50%;
1339
- transform: translateX(-50%);
1340
- width: 4px;
1341
- height: 4px;
1342
- background-color: var(--color-primary);
1343
- border-radius: 50%;
1344
- }
1345
-
1346
- .day-selected.day-today::after {
1347
- background-color: white;
1348
- }
1349
-
1350
- .day-disabled {
1351
- opacity: 0.3;
1352
- cursor: not-allowed;
1353
- }
1354
-
1355
- .day-disabled:hover {
1356
- background-color: transparent !important;
1357
- }
1358
-
1359
- /* Time Selectors */
1360
- .time-section {
1361
- display: flex;
1362
- flex-direction: column;
1363
- }
1364
-
1365
- .time-selectors {
1366
- display: flex;
1367
- gap: var(--space-2);
1368
- align-items: stretch;
1369
- }
1370
-
1371
- .time-column {
1372
- flex: 1;
1373
- display: flex;
1374
- flex-direction: column;
1375
- }
1376
-
1377
- .time-column-label {
1378
- font-size: var(--font-size-xs);
1379
- font-weight: var(--font-weight-medium);
1380
- color: var(--color-text-secondary);
1381
- text-align: center;
1382
- margin-bottom: var(--space-2);
1383
- }
1384
-
1385
- .time-scroll {
1386
- max-height: 200px;
1387
- overflow-y: auto;
1388
- border: 1px solid var(--color-border);
1389
- border-radius: var(--radius-md);
1390
- scrollbar-width: thin;
1391
- scrollbar-color: var(--color-border) transparent;
1392
- }
1393
-
1394
- .time-scroll::-webkit-scrollbar {
1395
- width: 6px;
1396
- }
1397
-
1398
- .time-scroll::-webkit-scrollbar-track {
1399
- background: transparent;
1400
- }
1401
-
1402
- .time-scroll::-webkit-scrollbar-thumb {
1403
- background: var(--color-border);
1404
- border-radius: 3px;
1405
- }
1406
-
1407
- .time-scroll::-webkit-scrollbar-thumb:hover {
1408
- background: var(--color-border-hover);
1409
- }
1410
-
1411
- .time-option {
1412
- padding: var(--space-2) var(--space-3);
1413
- cursor: pointer;
1414
- transition: background-color var(--transition-fast);
1415
- color: var(--color-text-primary);
1416
- text-align: center;
1417
- font-size: var(--font-size-sm);
1418
- }
1419
-
1420
- .time-option:hover {
1421
- background-color: var(--color-bg-secondary);
1422
- }
1423
-
1424
- .time-option--selected {
1425
- background-color: var(--color-primary);
1426
- color: white;
1427
- font-weight: var(--font-weight-medium);
1428
- }
1429
-
1430
- .time-option--selected:hover {
1431
- background-color: var(--color-primary);
1432
- }
1433
-
1434
- /* Footer */
1435
- .datetime-footer {
1436
- display: flex;
1437
- justify-content: space-between;
1438
- gap: var(--space-2);
1439
- border-top: 1px solid var(--color-border);
1440
- padding-top: var(--space-3);
1441
- margin-top: var(--space-3);
1442
- }
1443
-
1444
- .datetime-btn {
1445
- flex: 1;
1446
- background: transparent;
1447
- border: none;
1448
- color: var(--color-primary);
1449
- font-size: var(--font-size-xs);
1450
- font-weight: var(--font-weight-medium);
1451
- padding: var(--space-2) var(--space-3);
1452
- border-radius: var(--radius-md);
1453
- cursor: pointer;
1454
- transition: all 0.2s ease;
1455
- }
1456
-
1457
- .datetime-btn:hover {
1458
- background-color: var(--color-bg-secondary);
1459
- color: var(--color-primary);
1460
- }
1461
-
1462
- /* Step indicator */
1463
- .step-header {
1464
- display: flex;
1465
- align-items: center;
1466
- gap: var(--space-2);
1467
- padding-bottom: var(--space-2);
1468
- border-bottom: 1px solid var(--color-border);
1469
- margin-bottom: var(--space-2);
1470
- }
1471
-
1472
- .step-back-btn {
1473
- background: none;
1474
- border: none;
1475
- color: var(--color-text-secondary);
1476
- font-size: 1.1rem;
1477
- cursor: pointer;
1478
- padding: var(--space-1);
1479
- border-radius: 50%;
1480
- width: 28px;
1481
- height: 28px;
1482
- display: flex;
1483
- align-items: center;
1484
- justify-content: center;
1485
- transition: all 0.2s ease;
1486
- }
1487
-
1488
- .step-back-btn:hover {
1489
- background-color: var(--color-bg-secondary);
1490
- color: var(--color-text-primary);
1491
- }
1492
-
1493
- .step-title {
1494
- font-size: var(--font-size-sm);
1495
- font-weight: var(--font-weight-medium);
1496
- color: var(--color-text-primary);
1497
- flex: 1;
1498
- }
1499
-
1500
- /* Picker Overlay */
1501
- .picker-overlay {
1502
- position: absolute;
1503
- top: 0;
1504
- left: 0;
1505
- right: 0;
1506
- bottom: 0;
1507
- background: var(--color-bg-primary);
1508
- border-radius: var(--radius-md);
1509
- padding: var(--space-3);
1510
- z-index: 10;
1511
- animation: fadeIn 0.15s ease;
1512
- }
1513
-
1514
- @keyframes fadeIn {
1515
- from {
1516
- opacity: 0;
1517
- }
1518
- to {
1519
- opacity: 1;
1520
- }
1521
- }
1522
-
1523
- .month-picker-container,
1524
- .year-picker-container {
1525
- display: flex;
1526
- flex-direction: column;
1527
- height: 100%;
1528
- }
1529
-
1530
- .month-picker-grid,
1531
- .year-picker-grid {
1532
- display: grid;
1533
- grid-template-columns: repeat(3, 1fr);
1534
- gap: var(--space-2);
1535
- flex: 1;
1536
- align-content: center;
1537
- }
1538
-
1539
- .month-item,
1540
- .year-item {
1541
- padding: var(--space-4) var(--space-2);
1542
- text-align: center;
1543
- cursor: pointer;
1544
- border-radius: var(--radius-md);
1545
- font-size: var(--font-size-sm);
1546
- color: var(--color-text-primary);
1547
- transition: all 0.15s ease;
1548
- border: 1px solid transparent;
1549
- }
1550
-
1551
- .month-item:hover,
1552
- .year-item:hover {
1553
- background-color: var(--color-bg-secondary);
1554
- }
1555
-
1556
- .month-selected,
1557
- .year-selected {
1558
- background-color: var(--color-primary);
1559
- color: white;
1560
- font-weight: var(--font-weight-medium);
1561
- }
1562
-
1563
- .month-selected:hover,
1564
- .year-selected:hover {
1565
- background-color: var(--color-primary);
1566
- }
1567
-
1568
- .year-picker-header {
1569
- display: flex;
1570
- justify-content: space-between;
1571
- align-items: center;
1572
- margin-bottom: var(--space-3);
1573
- padding: var(--space-2);
1574
- border-bottom: 1px solid var(--color-border);
1575
- flex-shrink: 0;
1576
- }
1577
-
1578
- .year-nav {
1579
- background: none;
1580
- border: none;
1581
- color: var(--color-text-secondary);
1582
- font-size: 1.25rem;
1583
- cursor: pointer;
1584
- padding: var(--space-1) var(--space-2);
1585
- border-radius: 50%;
1586
- width: 32px;
1587
- height: 32px;
1588
- display: flex;
1589
- align-items: center;
1590
- justify-content: center;
1591
- transition: all 0.2s ease;
1592
- }
1593
-
1594
- .year-nav:hover {
1595
- background-color: var(--color-bg-secondary);
1596
- color: var(--color-text-primary);
1597
- }
1598
-
1599
- .year-range {
1600
- font-size: var(--font-size-sm);
1601
- font-weight: var(--font-weight-medium);
1602
- color: var(--color-text-primary);
1603
- }
1604
-
1605
- .datetime-picker-error {
1606
- font-size: var(--font-size-sm);
1607
- color: var(--color-error);
1608
- line-height: var(--line-height-tight);
1609
- }
1610
-
1611
- .datetime-picker-hint {
1612
- font-size: var(--font-size-sm);
1613
- color: var(--color-text-muted);
1614
- line-height: var(--line-height-tight);
1615
- }
1616
- `;
1617
- d([
1618
- v({ type: String })
1619
- ], c.prototype, "value", 2);
1620
- d([
1621
- v({ type: String })
1622
- ], c.prototype, "label", 2);
1623
- d([
1624
- v({ type: String })
1625
- ], c.prototype, "placeholder", 2);
1626
- d([
1627
- v({ type: Boolean, reflect: !0 })
1628
- ], c.prototype, "required", 2);
1629
- d([
1630
- v({ type: Boolean, reflect: !0 })
1631
- ], c.prototype, "disabled", 2);
1632
- d([
1633
- v({ type: String })
1634
- ], c.prototype, "error", 2);
1635
- d([
1636
- v({ type: String })
1637
- ], c.prototype, "hint", 2);
1638
- d([
1639
- v({ type: String })
1640
- ], c.prototype, "size", 2);
1641
- d([
1642
- v({ type: String })
1643
- ], c.prototype, "minDate", 2);
1644
- d([
1645
- v({ type: String })
1646
- ], c.prototype, "maxDate", 2);
1647
- d([
1648
- v({ type: String })
1649
- ], c.prototype, "format", 2);
1650
- d([
1651
- y()
1652
- ], c.prototype, "isOpen", 2);
1653
- d([
1654
- y()
1655
- ], c.prototype, "currentMonth", 2);
1656
- d([
1657
- y()
1658
- ], c.prototype, "currentYear", 2);
1659
- d([
1660
- y()
1661
- ], c.prototype, "showMonthPicker", 2);
1662
- d([
1663
- y()
1664
- ], c.prototype, "showYearPicker", 2);
1665
- d([
1666
- y()
1667
- ], c.prototype, "yearRangeStart", 2);
1668
- d([
1669
- y()
1670
- ], c.prototype, "selectedDate", 2);
1671
- d([
1672
- y()
1673
- ], c.prototype, "selectedHour", 2);
1674
- d([
1675
- y()
1676
- ], c.prototype, "selectedMinute", 2);
1677
- d([
1678
- y()
1679
- ], c.prototype, "selectedPeriod", 2);
1680
- d([
1681
- y()
1682
- ], c.prototype, "isFlipped", 2);
1683
- d([
1684
- y()
1685
- ], c.prototype, "currentStep", 2);
1686
- d([
1687
- de(".datetime-display")
1688
- ], c.prototype, "datetimeDisplay", 2);
1689
- d([
1690
- de(".datetime-container")
1691
- ], c.prototype, "datetimeContainer", 2);
1692
- c = d([
1693
- ze("base-datetime-picker")
1694
- ], c);
1695
- export {
1696
- c as BaseDateTimePicker
1697
- };