@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.
- package/README.md +27 -152
- package/package.json +4 -8
- package/dist/components/auth-form.js +0 -2436
- package/dist/components/base-button.js +0 -894
- package/dist/components/base-card.js +0 -879
- package/dist/components/base-date-picker.js +0 -1458
- package/dist/components/base-datetime-picker.js +0 -1697
- package/dist/components/base-drawer.js +0 -1300
- package/dist/components/base-input.js +0 -883
- package/dist/components/base-select.js +0 -1076
- package/dist/components/base-tab.js +0 -653
- package/dist/components/base-tabs.js +0 -1246
- package/dist/components/base-textarea.js +0 -921
- package/dist/components/base-time-picker.js +0 -1141
- package/dist/components/favicon.ico +0 -0
- package/dist/components/index.d.ts +0 -511
- package/dist/components/quantity-select.js +0 -859
- package/dist/components/theme-toggle.js +0 -807
- package/dist/favicon.ico +0 -0
- package/dist/stylesheets/main.css +0 -1
|
@@ -1,1141 +0,0 @@
|
|
|
1
|
-
const z = globalThis, L = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, q = Symbol(), J = /* @__PURE__ */ new WeakMap();
|
|
2
|
-
let oe = class {
|
|
3
|
-
constructor(e, t, i) {
|
|
4
|
-
if (this._$cssResult$ = !0, i !== 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 i = t !== void 0 && t.length === 1;
|
|
12
|
-
i && (e = J.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && J.set(t, e));
|
|
13
|
-
}
|
|
14
|
-
return e;
|
|
15
|
-
}
|
|
16
|
-
toString() {
|
|
17
|
-
return this.cssText;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const pe = (s) => new oe(typeof s == "string" ? s : s + "", void 0, q), ue = (s, ...e) => {
|
|
21
|
-
const t = s.length === 1 ? s[0] : e.reduce(((i, r, o) => i + ((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) + s[o + 1]), s[0]);
|
|
26
|
-
return new oe(t, s, q);
|
|
27
|
-
}, me = (s, e) => {
|
|
28
|
-
if (L) s.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
|
|
29
|
-
else for (const t of e) {
|
|
30
|
-
const i = document.createElement("style"), r = z.litNonce;
|
|
31
|
-
r !== void 0 && i.setAttribute("nonce", r), i.textContent = t.cssText, s.appendChild(i);
|
|
32
|
-
}
|
|
33
|
-
}, Z = L ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
|
|
34
|
-
let t = "";
|
|
35
|
-
for (const i of e.cssRules) t += i.cssText;
|
|
36
|
-
return pe(t);
|
|
37
|
-
})(s) : s;
|
|
38
|
-
const { is: fe, defineProperty: $e, getOwnPropertyDescriptor: ve, getOwnPropertyNames: ge, getOwnPropertySymbols: ye, getPrototypeOf: be } = Object, j = globalThis, Y = j.trustedTypes, _e = Y ? Y.emptyScript : "", Ae = j.reactiveElementPolyfillSupport, k = (s, e) => s, R = { toAttribute(s, e) {
|
|
39
|
-
switch (e) {
|
|
40
|
-
case Boolean:
|
|
41
|
-
s = s ? _e : null;
|
|
42
|
-
break;
|
|
43
|
-
case Object:
|
|
44
|
-
case Array:
|
|
45
|
-
s = s == null ? s : JSON.stringify(s);
|
|
46
|
-
}
|
|
47
|
-
return s;
|
|
48
|
-
}, fromAttribute(s, e) {
|
|
49
|
-
let t = s;
|
|
50
|
-
switch (e) {
|
|
51
|
-
case Boolean:
|
|
52
|
-
t = s !== null;
|
|
53
|
-
break;
|
|
54
|
-
case Number:
|
|
55
|
-
t = s === null ? null : Number(s);
|
|
56
|
-
break;
|
|
57
|
-
case Object:
|
|
58
|
-
case Array:
|
|
59
|
-
try {
|
|
60
|
-
t = JSON.parse(s);
|
|
61
|
-
} catch {
|
|
62
|
-
t = null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return t;
|
|
66
|
-
} }, V = (s, e) => !fe(s, e), Q = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: V };
|
|
67
|
-
Symbol.metadata ??= Symbol("metadata"), j.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
68
|
-
let E = 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 = Q) {
|
|
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 i = Symbol(), r = this.getPropertyDescriptor(e, i, t);
|
|
78
|
-
r !== void 0 && $e(this.prototype, e, r);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
static getPropertyDescriptor(e, t, i) {
|
|
82
|
-
const { get: r, set: o } = ve(this.prototype, e) ?? { get() {
|
|
83
|
-
return this[t];
|
|
84
|
-
}, set(n) {
|
|
85
|
-
this[t] = n;
|
|
86
|
-
} };
|
|
87
|
-
return { get: r, set(n) {
|
|
88
|
-
const l = r?.call(this);
|
|
89
|
-
o?.call(this, n), this.requestUpdate(e, l, i);
|
|
90
|
-
}, configurable: !0, enumerable: !0 };
|
|
91
|
-
}
|
|
92
|
-
static getPropertyOptions(e) {
|
|
93
|
-
return this.elementProperties.get(e) ?? Q;
|
|
94
|
-
}
|
|
95
|
-
static _$Ei() {
|
|
96
|
-
if (this.hasOwnProperty(k("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(k("finalized"))) return;
|
|
102
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(k("properties"))) {
|
|
103
|
-
const t = this.properties, i = [...ge(t), ...ye(t)];
|
|
104
|
-
for (const r of i) 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 [i, r] of t) this.elementProperties.set(i, r);
|
|
110
|
-
}
|
|
111
|
-
this._$Eh = /* @__PURE__ */ new Map();
|
|
112
|
-
for (const [t, i] of this.elementProperties) {
|
|
113
|
-
const r = this._$Eu(t, i);
|
|
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 i = new Set(e.flat(1 / 0).reverse());
|
|
122
|
-
for (const r of i) t.unshift(Z(r));
|
|
123
|
-
} else e !== void 0 && t.push(Z(e));
|
|
124
|
-
return t;
|
|
125
|
-
}
|
|
126
|
-
static _$Eu(e, t) {
|
|
127
|
-
const i = t.attribute;
|
|
128
|
-
return i === !1 ? void 0 : typeof i == "string" ? i : 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 i of t.keys()) this.hasOwnProperty(i) && (e.set(i, this[i]), delete this[i]);
|
|
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, t, i) {
|
|
160
|
-
this._$AK(e, i);
|
|
161
|
-
}
|
|
162
|
-
_$ET(e, t) {
|
|
163
|
-
const i = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, i);
|
|
164
|
-
if (r !== void 0 && i.reflect === !0) {
|
|
165
|
-
const o = (i.converter?.toAttribute !== void 0 ? i.converter : R).toAttribute(t, i.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 i = this.constructor, r = i._$Eh.get(e);
|
|
171
|
-
if (r !== void 0 && this._$Em !== r) {
|
|
172
|
-
const o = i.getPropertyOptions(r), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : R;
|
|
173
|
-
this._$Em = r;
|
|
174
|
-
const l = n.fromAttribute(t, o.type);
|
|
175
|
-
this[r] = l ?? this._$Ej?.get(r) ?? l, this._$Em = null;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
requestUpdate(e, t, i) {
|
|
179
|
-
if (e !== void 0) {
|
|
180
|
-
const r = this.constructor, o = this[e];
|
|
181
|
-
if (i ??= r.getPropertyOptions(e), !((i.hasChanged ?? V)(o, t) || i.useDefault && i.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(r._$Eu(e, i)))) return;
|
|
182
|
-
this.C(e, t, i);
|
|
183
|
-
}
|
|
184
|
-
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
185
|
-
}
|
|
186
|
-
C(e, t, { useDefault: i, reflect: r, wrapped: o }, n) {
|
|
187
|
-
i && !(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 || i || (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 i = this.constructor.elementProperties;
|
|
210
|
-
if (i.size > 0) for (const [r, o] of i) {
|
|
211
|
-
const { wrapped: n } = o, l = this[r];
|
|
212
|
-
n !== !0 || this._$AL.has(r) || l === void 0 || this.C(r, void 0, o, l);
|
|
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(((i) => i.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
219
|
-
} catch (i) {
|
|
220
|
-
throw e = !1, this._$EM(), i;
|
|
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
|
-
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[k("elementProperties")] = /* @__PURE__ */ new Map(), E[k("finalized")] = /* @__PURE__ */ new Map(), Ae?.({ ReactiveElement: E }), (j.reactiveElementVersions ??= []).push("2.1.1");
|
|
250
|
-
const K = globalThis, D = K.trustedTypes, X = D ? D.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ne = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, ae = "?" + y, we = `<${ae}>`, A = document, M = () => A.createComment(""), H = (s) => s === null || typeof s != "object" && typeof s != "function", W = Array.isArray, Se = (s) => W(s) || typeof s?.[Symbol.iterator] == "function", B = `[
|
|
251
|
-
\f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ee = /-->/g, te = />/g, b = RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
|
|
252
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), ie = /'/g, se = /"/g, le = /^(?:script|style|textarea|title)$/i, Ee = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), $ = Ee(1), w = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), re = /* @__PURE__ */ new WeakMap(), _ = A.createTreeWalker(A, 129);
|
|
253
|
-
function he(s, e) {
|
|
254
|
-
if (!W(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
255
|
-
return X !== void 0 ? X.createHTML(e) : e;
|
|
256
|
-
}
|
|
257
|
-
const xe = (s, e) => {
|
|
258
|
-
const t = s.length - 1, i = [];
|
|
259
|
-
let r, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = P;
|
|
260
|
-
for (let l = 0; l < t; l++) {
|
|
261
|
-
const a = s[l];
|
|
262
|
-
let p, m, h = -1, v = 0;
|
|
263
|
-
for (; v < a.length && (n.lastIndex = v, m = n.exec(a), m !== null); ) v = n.lastIndex, n === P ? m[1] === "!--" ? n = ee : m[1] !== void 0 ? n = te : m[2] !== void 0 ? (le.test(m[2]) && (r = RegExp("</" + m[2], "g")), n = b) : m[3] !== void 0 && (n = b) : n === b ? m[0] === ">" ? (n = r ?? P, h = -1) : m[1] === void 0 ? h = -2 : (h = n.lastIndex - m[2].length, p = m[1], n = m[3] === void 0 ? b : m[3] === '"' ? se : ie) : n === se || n === ie ? n = b : n === ee || n === te ? n = P : (n = b, r = void 0);
|
|
264
|
-
const g = n === b && s[l + 1].startsWith("/>") ? " " : "";
|
|
265
|
-
o += n === P ? a + we : h >= 0 ? (i.push(p), a.slice(0, h) + ne + a.slice(h) + y + g) : a + y + (h === -2 ? l : g);
|
|
266
|
-
}
|
|
267
|
-
return [he(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
268
|
-
};
|
|
269
|
-
class T {
|
|
270
|
-
constructor({ strings: e, _$litType$: t }, i) {
|
|
271
|
-
let r;
|
|
272
|
-
this.parts = [];
|
|
273
|
-
let o = 0, n = 0;
|
|
274
|
-
const l = e.length - 1, a = this.parts, [p, m] = xe(e, t);
|
|
275
|
-
if (this.el = T.createElement(p, i), _.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 && a.length < l; ) {
|
|
280
|
-
if (r.nodeType === 1) {
|
|
281
|
-
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(ne)) {
|
|
282
|
-
const v = m[n++], g = r.getAttribute(h).split(y), N = /([.?@])?(.*)/.exec(v);
|
|
283
|
-
a.push({ type: 1, index: o, name: N[2], strings: g, ctor: N[1] === "." ? ke : N[1] === "?" ? Ce : N[1] === "@" ? Me : I }), r.removeAttribute(h);
|
|
284
|
-
} else h.startsWith(y) && (a.push({ type: 6, index: o }), r.removeAttribute(h));
|
|
285
|
-
if (le.test(r.tagName)) {
|
|
286
|
-
const h = r.textContent.split(y), v = h.length - 1;
|
|
287
|
-
if (v > 0) {
|
|
288
|
-
r.textContent = D ? D.emptyScript : "";
|
|
289
|
-
for (let g = 0; g < v; g++) r.append(h[g], M()), _.nextNode(), a.push({ type: 2, index: ++o });
|
|
290
|
-
r.append(h[v], M());
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
} else if (r.nodeType === 8) if (r.data === ae) a.push({ type: 2, index: o });
|
|
294
|
-
else {
|
|
295
|
-
let h = -1;
|
|
296
|
-
for (; (h = r.data.indexOf(y, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += y.length - 1;
|
|
297
|
-
}
|
|
298
|
-
o++;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
static createElement(e, t) {
|
|
302
|
-
const i = A.createElement("template");
|
|
303
|
-
return i.innerHTML = e, i;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function x(s, e, t = s, i) {
|
|
307
|
-
if (e === w) return e;
|
|
308
|
-
let r = i !== void 0 ? t._$Co?.[i] : t._$Cl;
|
|
309
|
-
const o = H(e) ? void 0 : e._$litDirective$;
|
|
310
|
-
return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(s), r._$AT(s, t, i)), i !== void 0 ? (t._$Co ??= [])[i] = r : t._$Cl = r), r !== void 0 && (e = x(s, r._$AS(s, e.values), r, i)), e;
|
|
311
|
-
}
|
|
312
|
-
class Pe {
|
|
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: i } = this._$AD, r = (e?.creationScope ?? A).importNode(t, !0);
|
|
324
|
-
_.currentNode = r;
|
|
325
|
-
let o = _.nextNode(), n = 0, l = 0, a = i[0];
|
|
326
|
-
for (; a !== void 0; ) {
|
|
327
|
-
if (n === a.index) {
|
|
328
|
-
let p;
|
|
329
|
-
a.type === 2 ? p = new O(o, o.nextSibling, this, e) : a.type === 1 ? p = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (p = new He(o, this, e)), this._$AV.push(p), a = i[++l];
|
|
330
|
-
}
|
|
331
|
-
n !== a?.index && (o = _.nextNode(), n++);
|
|
332
|
-
}
|
|
333
|
-
return _.currentNode = A, r;
|
|
334
|
-
}
|
|
335
|
-
p(e) {
|
|
336
|
-
let t = 0;
|
|
337
|
-
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
class O {
|
|
341
|
-
get _$AU() {
|
|
342
|
-
return this._$AM?._$AU ?? this._$Cv;
|
|
343
|
-
}
|
|
344
|
-
constructor(e, t, i, r) {
|
|
345
|
-
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, 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 = x(this, e, t), H(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) : Se(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 && H(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
|
|
369
|
-
}
|
|
370
|
-
$(e) {
|
|
371
|
-
const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = T.createElement(he(i.h, i.h[0]), this.options)), i);
|
|
372
|
-
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
373
|
-
else {
|
|
374
|
-
const o = new Pe(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 = re.get(e.strings);
|
|
380
|
-
return t === void 0 && re.set(e.strings, t = new T(e)), t;
|
|
381
|
-
}
|
|
382
|
-
k(e) {
|
|
383
|
-
W(this._$AH) || (this._$AH = [], this._$AR());
|
|
384
|
-
const t = this._$AH;
|
|
385
|
-
let i, r = 0;
|
|
386
|
-
for (const o of e) r === t.length ? t.push(i = new O(this.O(M()), this.O(M()), this, this.options)) : i = t[r], i._$AI(o), r++;
|
|
387
|
-
r < t.length && (this._$AR(i && i._$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 i = e.nextSibling;
|
|
392
|
-
e.remove(), e = i;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
setConnected(e) {
|
|
396
|
-
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
class I {
|
|
400
|
-
get tagName() {
|
|
401
|
-
return this.element.tagName;
|
|
402
|
-
}
|
|
403
|
-
get _$AU() {
|
|
404
|
-
return this._$AM._$AU;
|
|
405
|
-
}
|
|
406
|
-
constructor(e, t, i, 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, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = c;
|
|
408
|
-
}
|
|
409
|
-
_$AI(e, t = this, i, r) {
|
|
410
|
-
const o = this.strings;
|
|
411
|
-
let n = !1;
|
|
412
|
-
if (o === void 0) e = x(this, e, t, 0), n = !H(e) || e !== this._$AH && e !== w, n && (this._$AH = e);
|
|
413
|
-
else {
|
|
414
|
-
const l = e;
|
|
415
|
-
let a, p;
|
|
416
|
-
for (e = o[0], a = 0; a < o.length - 1; a++) p = x(this, l[i + a], t, a), p === w && (p = this._$AH[a]), n ||= !H(p) || p !== this._$AH[a], p === c ? e = c : e !== c && (e += (p ?? "") + o[a + 1]), this._$AH[a] = 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 ke extends I {
|
|
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 Ce extends I {
|
|
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 Me extends I {
|
|
441
|
-
constructor(e, t, i, r, o) {
|
|
442
|
-
super(e, t, i, r, o), this.type = 5;
|
|
443
|
-
}
|
|
444
|
-
_$AI(e, t = this) {
|
|
445
|
-
if ((e = x(this, e, t, 0) ?? c) === w) return;
|
|
446
|
-
const i = this._$AH, r = e === c && i !== c || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== c && (i === c || r);
|
|
447
|
-
r && this.element.removeEventListener(this.name, this, i), 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 He {
|
|
454
|
-
constructor(e, t, i) {
|
|
455
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i;
|
|
456
|
-
}
|
|
457
|
-
get _$AU() {
|
|
458
|
-
return this._$AM._$AU;
|
|
459
|
-
}
|
|
460
|
-
_$AI(e) {
|
|
461
|
-
x(this, e);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
const Te = K.litHtmlPolyfillSupport;
|
|
465
|
-
Te?.(T, O), (K.litHtmlVersions ??= []).push("3.3.1");
|
|
466
|
-
const Oe = (s, e, t) => {
|
|
467
|
-
const i = t?.renderBefore ?? e;
|
|
468
|
-
let r = i._$litPart$;
|
|
469
|
-
if (r === void 0) {
|
|
470
|
-
const o = t?.renderBefore ?? null;
|
|
471
|
-
i._$litPart$ = r = new O(e.insertBefore(M(), o), o, void 0, t ?? {});
|
|
472
|
-
}
|
|
473
|
-
return r._$AI(s), r;
|
|
474
|
-
};
|
|
475
|
-
const F = globalThis;
|
|
476
|
-
let C = class extends E {
|
|
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 = Oe(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
|
-
C._$litElement$ = !0, C.finalized = !0, F.litElementHydrateSupport?.({ LitElement: C });
|
|
499
|
-
const Ue = F.litElementPolyfillSupport;
|
|
500
|
-
Ue?.({ LitElement: C });
|
|
501
|
-
(F.litElementVersions ??= []).push("4.2.1");
|
|
502
|
-
const Ne = (s) => (e, t) => {
|
|
503
|
-
t !== void 0 ? t.addInitializer((() => {
|
|
504
|
-
customElements.define(s, e);
|
|
505
|
-
})) : customElements.define(s, e);
|
|
506
|
-
};
|
|
507
|
-
const ze = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: V }, Re = (s = ze, e, t) => {
|
|
508
|
-
const { kind: i, metadata: r } = t;
|
|
509
|
-
let o = globalThis.litPropertyMetadata.get(r);
|
|
510
|
-
if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(t.name, s), i === "accessor") {
|
|
511
|
-
const { name: n } = t;
|
|
512
|
-
return { set(l) {
|
|
513
|
-
const a = e.get.call(this);
|
|
514
|
-
e.set.call(this, l), this.requestUpdate(n, a, s);
|
|
515
|
-
}, init(l) {
|
|
516
|
-
return l !== void 0 && this.C(n, void 0, s, l), l;
|
|
517
|
-
} };
|
|
518
|
-
}
|
|
519
|
-
if (i === "setter") {
|
|
520
|
-
const { name: n } = t;
|
|
521
|
-
return function(l) {
|
|
522
|
-
const a = this[n];
|
|
523
|
-
e.call(this, l), this.requestUpdate(n, a, s);
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
throw Error("Unsupported decorator location: " + i);
|
|
527
|
-
};
|
|
528
|
-
function f(s) {
|
|
529
|
-
return (e, t) => typeof t == "object" ? Re(s, e, t) : ((i, r, o) => {
|
|
530
|
-
const n = r.hasOwnProperty(o);
|
|
531
|
-
return r.constructor.createProperty(o, i), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
|
|
532
|
-
})(s, e, t);
|
|
533
|
-
}
|
|
534
|
-
function U(s) {
|
|
535
|
-
return f({ ...s, state: !0, attribute: !1 });
|
|
536
|
-
}
|
|
537
|
-
const De = (s, e, t) => (t.configurable = !0, t.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(s, e, t), t);
|
|
538
|
-
function ce(s, e) {
|
|
539
|
-
return (t, i, r) => {
|
|
540
|
-
const o = (n) => n.renderRoot?.querySelector(s) ?? null;
|
|
541
|
-
return De(t, i, { get() {
|
|
542
|
-
return o(this);
|
|
543
|
-
} });
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
const je = { ATTRIBUTE: 1 }, Ie = (s) => (...e) => ({ _$litDirective$: s, values: e });
|
|
547
|
-
class Be {
|
|
548
|
-
constructor(e) {
|
|
549
|
-
}
|
|
550
|
-
get _$AU() {
|
|
551
|
-
return this._$AM._$AU;
|
|
552
|
-
}
|
|
553
|
-
_$AT(e, t, i) {
|
|
554
|
-
this._$Ct = e, this._$AM = t, this._$Ci = i;
|
|
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 S = Ie(class extends Be {
|
|
564
|
-
constructor(s) {
|
|
565
|
-
if (super(s), s.type !== je.ATTRIBUTE || s.name !== "class" || s.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(s) {
|
|
568
|
-
return " " + Object.keys(s).filter(((e) => s[e])).join(" ") + " ";
|
|
569
|
-
}
|
|
570
|
-
update(s, [e]) {
|
|
571
|
-
if (this.st === void 0) {
|
|
572
|
-
this.st = /* @__PURE__ */ new Set(), s.strings !== void 0 && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter(((i) => i !== ""))));
|
|
573
|
-
for (const i in e) e[i] && !this.nt?.has(i) && this.st.add(i);
|
|
574
|
-
return this.render(e);
|
|
575
|
-
}
|
|
576
|
-
const t = s.element.classList;
|
|
577
|
-
for (const i of this.st) i in e || (t.remove(i), this.st.delete(i));
|
|
578
|
-
for (const i in e) {
|
|
579
|
-
const r = !!e[i];
|
|
580
|
-
r === this.st.has(i) || this.nt?.has(i) || (r ? (t.add(i), this.st.add(i)) : (t.remove(i), this.st.delete(i)));
|
|
581
|
-
}
|
|
582
|
-
return w;
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
const Le = (s) => s ?? c;
|
|
586
|
-
var qe = Object.defineProperty, de = (s, e, t, i) => {
|
|
587
|
-
for (var r = void 0, o = s.length - 1, n; o >= 0; o--)
|
|
588
|
-
(n = s[o]) && (r = n(e, t, r) || r);
|
|
589
|
-
return r && qe(e, t, r), r;
|
|
590
|
-
};
|
|
591
|
-
class G extends C {
|
|
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), i = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
598
|
-
e ? this.theme = e : t ? (this.theme = t, this.applyTheme()) : i ? (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
|
-
de([
|
|
618
|
-
f({ type: String, attribute: "data-theme", reflect: !0 })
|
|
619
|
-
], G.prototype, "theme");
|
|
620
|
-
de([
|
|
621
|
-
f({ type: String, attribute: "storage-key" })
|
|
622
|
-
], G.prototype, "storageKey");
|
|
623
|
-
var Ve = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, u = (s, e, t, i) => {
|
|
624
|
-
for (var r = i > 1 ? void 0 : i ? Ke(e, t) : e, o = s.length - 1, n; o >= 0; o--)
|
|
625
|
-
(n = s[o]) && (r = (i ? n(e, t, r) : n(r)) || r);
|
|
626
|
-
return i && r && Ve(e, t, r), r;
|
|
627
|
-
};
|
|
628
|
-
let d = class extends G {
|
|
629
|
-
constructor() {
|
|
630
|
-
super(...arguments), this.value = "", this.placeholder = "Select a time", this.required = !1, this.disabled = !1, this.size = "md", this.format = "12", this.isOpen = !1, this.selectedHour = 12, this.selectedMinute = 0, this.selectedPeriod = "AM", this.isFlipped = !1, this.inputId = `time-picker-${Math.random().toString(36).substr(2, 9)}`;
|
|
631
|
-
}
|
|
632
|
-
connectedCallback() {
|
|
633
|
-
super.connectedCallback(), this.parseValue();
|
|
634
|
-
}
|
|
635
|
-
updated(s) {
|
|
636
|
-
s.has("value") && this.parseValue();
|
|
637
|
-
}
|
|
638
|
-
parseValue() {
|
|
639
|
-
if (!this.value) return;
|
|
640
|
-
const [s, e] = this.value.split(":").map(Number);
|
|
641
|
-
isNaN(s) || isNaN(e) || (this.selectedMinute = e, 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);
|
|
642
|
-
}
|
|
643
|
-
get displayValue() {
|
|
644
|
-
if (!this.value) return "";
|
|
645
|
-
const [s, e] = this.value.split(":").map(Number);
|
|
646
|
-
if (isNaN(s) || isNaN(e)) return this.value;
|
|
647
|
-
if (this.format === "12") {
|
|
648
|
-
const t = s < 12 ? "AM" : "PM";
|
|
649
|
-
return `${s === 0 ? 12 : s > 12 ? s - 12 : s}:${String(e).padStart(2, "0")} ${t}`;
|
|
650
|
-
} else
|
|
651
|
-
return `${String(s).padStart(2, "0")}:${String(e).padStart(2, "0")}`;
|
|
652
|
-
}
|
|
653
|
-
get hours() {
|
|
654
|
-
return this.format === "12" ? Array.from({ length: 12 }, (s, e) => e + 1) : Array.from({ length: 24 }, (s, e) => e);
|
|
655
|
-
}
|
|
656
|
-
get minutes() {
|
|
657
|
-
return Array.from({ length: 60 }, (s, e) => e);
|
|
658
|
-
}
|
|
659
|
-
handleDisplayClick() {
|
|
660
|
-
this.disabled || this.toggleTimePicker();
|
|
661
|
-
}
|
|
662
|
-
toggleTimePicker() {
|
|
663
|
-
this.isOpen = !this.isOpen, this.isOpen && requestAnimationFrame(() => this.updateDropdownPosition());
|
|
664
|
-
}
|
|
665
|
-
updateDropdownPosition() {
|
|
666
|
-
if (!this.timeContainer || !this.timeDisplay) return;
|
|
667
|
-
const s = this.timeDisplay.getBoundingClientRect(), e = 300, t = window.innerHeight - s.bottom, i = s.top;
|
|
668
|
-
this.isFlipped = t < e && i > t;
|
|
669
|
-
}
|
|
670
|
-
closeTimePicker() {
|
|
671
|
-
this.isOpen = !1, this.isFlipped = !1, this.emitChange();
|
|
672
|
-
}
|
|
673
|
-
selectHour(s) {
|
|
674
|
-
this.selectedHour = s;
|
|
675
|
-
}
|
|
676
|
-
selectMinute(s) {
|
|
677
|
-
this.selectedMinute = s;
|
|
678
|
-
}
|
|
679
|
-
selectPeriod(s) {
|
|
680
|
-
this.selectedPeriod = s;
|
|
681
|
-
}
|
|
682
|
-
selectNow() {
|
|
683
|
-
const s = /* @__PURE__ */ new Date(), e = s.getHours(), t = s.getMinutes();
|
|
684
|
-
this.selectedMinute = t, this.format === "12" ? e === 0 ? (this.selectedHour = 12, this.selectedPeriod = "AM") : e < 12 ? (this.selectedHour = e, this.selectedPeriod = "AM") : e === 12 ? (this.selectedHour = 12, this.selectedPeriod = "PM") : (this.selectedHour = e - 12, this.selectedPeriod = "PM") : this.selectedHour = e, this.closeTimePicker();
|
|
685
|
-
}
|
|
686
|
-
emitChange() {
|
|
687
|
-
let s = this.selectedHour;
|
|
688
|
-
this.format === "12" && (this.selectedPeriod === "AM" ? s = this.selectedHour === 12 ? 0 : this.selectedHour : s = this.selectedHour === 12 ? 12 : this.selectedHour + 12);
|
|
689
|
-
const e = `${String(s).padStart(2, "0")}:${String(this.selectedMinute).padStart(2, "0")}`, t = this.value;
|
|
690
|
-
this.value = e, this.dispatchEvent(
|
|
691
|
-
new CustomEvent("change", {
|
|
692
|
-
detail: { value: e, oldValue: t },
|
|
693
|
-
bubbles: !0,
|
|
694
|
-
composed: !0
|
|
695
|
-
})
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
handleKeydown(s) {
|
|
699
|
-
if (!this.disabled)
|
|
700
|
-
switch (s.key) {
|
|
701
|
-
case "Enter":
|
|
702
|
-
case " ":
|
|
703
|
-
s.preventDefault(), this.isOpen ? this.closeTimePicker() : this.toggleTimePicker();
|
|
704
|
-
break;
|
|
705
|
-
case "Escape":
|
|
706
|
-
s.preventDefault(), this.isOpen && (this.isOpen = !1);
|
|
707
|
-
break;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
render() {
|
|
711
|
-
const s = !!this.error, e = {
|
|
712
|
-
"time-wrapper": !0,
|
|
713
|
-
[`time-picker--${this.size}`]: !0,
|
|
714
|
-
"time-picker--error": s
|
|
715
|
-
}, t = {
|
|
716
|
-
"time-display": !0,
|
|
717
|
-
"time-display--open": this.isOpen,
|
|
718
|
-
"time-display--empty": !this.value,
|
|
719
|
-
"time-disabled": this.disabled
|
|
720
|
-
};
|
|
721
|
-
return $`
|
|
722
|
-
<div class="time-picker-group">
|
|
723
|
-
${this.label ? $`
|
|
724
|
-
<label for=${this.inputId} class="time-picker-label">
|
|
725
|
-
${this.label}
|
|
726
|
-
${this.required ? $`<span class="required-indicator" aria-label="required">*</span>` : ""}
|
|
727
|
-
</label>
|
|
728
|
-
` : ""}
|
|
729
|
-
|
|
730
|
-
<div class=${S(e)}>
|
|
731
|
-
<div
|
|
732
|
-
id=${this.inputId}
|
|
733
|
-
class=${S(t)}
|
|
734
|
-
@click=${this.handleDisplayClick}
|
|
735
|
-
@keydown=${this.handleKeydown}
|
|
736
|
-
tabindex=${this.disabled ? -1 : 0}
|
|
737
|
-
role="button"
|
|
738
|
-
aria-haspopup="dialog"
|
|
739
|
-
aria-expanded=${this.isOpen}
|
|
740
|
-
aria-describedby=${Le(s ? `${this.inputId}-error` : void 0)}
|
|
741
|
-
aria-invalid=${s}
|
|
742
|
-
>
|
|
743
|
-
${this.displayValue || this.placeholder}
|
|
744
|
-
</div>
|
|
745
|
-
|
|
746
|
-
<div class="time-icon">
|
|
747
|
-
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
748
|
-
<path
|
|
749
|
-
fill-rule="evenodd"
|
|
750
|
-
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z"
|
|
751
|
-
clip-rule="evenodd"
|
|
752
|
-
/>
|
|
753
|
-
</svg>
|
|
754
|
-
</div>
|
|
755
|
-
|
|
756
|
-
${this.isOpen ? $`
|
|
757
|
-
<div class="time-overlay" @click=${this.closeTimePicker}></div>
|
|
758
|
-
<div
|
|
759
|
-
class=${S({
|
|
760
|
-
"time-container": !0,
|
|
761
|
-
"time-container--flipped": this.isFlipped
|
|
762
|
-
})}
|
|
763
|
-
role="dialog"
|
|
764
|
-
aria-label="Choose time"
|
|
765
|
-
>
|
|
766
|
-
<div class="time-selectors">
|
|
767
|
-
<div class="time-column">
|
|
768
|
-
<div class="time-column-label">Hour</div>
|
|
769
|
-
<div class="time-scroll">
|
|
770
|
-
${this.hours.map(
|
|
771
|
-
(i) => $`
|
|
772
|
-
<div
|
|
773
|
-
class=${S({
|
|
774
|
-
"time-option": !0,
|
|
775
|
-
"time-option--selected": i === this.selectedHour
|
|
776
|
-
})}
|
|
777
|
-
@click=${() => this.selectHour(i)}
|
|
778
|
-
>
|
|
779
|
-
${this.format === "24" ? String(i).padStart(2, "0") : i}
|
|
780
|
-
</div>
|
|
781
|
-
`
|
|
782
|
-
)}
|
|
783
|
-
</div>
|
|
784
|
-
</div>
|
|
785
|
-
|
|
786
|
-
<div class="time-column">
|
|
787
|
-
<div class="time-column-label">Minute</div>
|
|
788
|
-
<div class="time-scroll">
|
|
789
|
-
${this.minutes.map(
|
|
790
|
-
(i) => $`
|
|
791
|
-
<div
|
|
792
|
-
class=${S({
|
|
793
|
-
"time-option": !0,
|
|
794
|
-
"time-option--selected": i === this.selectedMinute
|
|
795
|
-
})}
|
|
796
|
-
@click=${() => this.selectMinute(i)}
|
|
797
|
-
>
|
|
798
|
-
${String(i).padStart(2, "0")}
|
|
799
|
-
</div>
|
|
800
|
-
`
|
|
801
|
-
)}
|
|
802
|
-
</div>
|
|
803
|
-
</div>
|
|
804
|
-
|
|
805
|
-
${this.format === "12" ? $`
|
|
806
|
-
<div class="time-column">
|
|
807
|
-
<div class="time-column-label">Period</div>
|
|
808
|
-
<div class="time-scroll">
|
|
809
|
-
${["AM", "PM"].map(
|
|
810
|
-
(i) => $`
|
|
811
|
-
<div
|
|
812
|
-
class=${S({
|
|
813
|
-
"time-option": !0,
|
|
814
|
-
"time-option--selected": i === this.selectedPeriod
|
|
815
|
-
})}
|
|
816
|
-
@click=${() => this.selectPeriod(i)}
|
|
817
|
-
>
|
|
818
|
-
${i}
|
|
819
|
-
</div>
|
|
820
|
-
`
|
|
821
|
-
)}
|
|
822
|
-
</div>
|
|
823
|
-
</div>
|
|
824
|
-
` : ""}
|
|
825
|
-
</div>
|
|
826
|
-
|
|
827
|
-
<div class="time-footer">
|
|
828
|
-
<button type="button" class="time-now-btn" @click=${this.selectNow}>
|
|
829
|
-
Now
|
|
830
|
-
</button>
|
|
831
|
-
</div>
|
|
832
|
-
</div>
|
|
833
|
-
` : ""}
|
|
834
|
-
</div>
|
|
835
|
-
|
|
836
|
-
${s ? $`
|
|
837
|
-
<div id="${this.inputId}-error" class="time-picker-error" role="alert">
|
|
838
|
-
${this.error}
|
|
839
|
-
</div>
|
|
840
|
-
` : this.hint ? $` <div class="time-picker-hint">${this.hint}</div> ` : ""}
|
|
841
|
-
</div>
|
|
842
|
-
`;
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
d.styles = ue`
|
|
846
|
-
:host {
|
|
847
|
-
display: block;
|
|
848
|
-
position: relative;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
.time-picker-group {
|
|
852
|
-
display: flex;
|
|
853
|
-
flex-direction: column;
|
|
854
|
-
gap: var(--space-2);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
.time-picker-label {
|
|
858
|
-
display: flex;
|
|
859
|
-
align-items: center;
|
|
860
|
-
gap: var(--space-1);
|
|
861
|
-
font-size: var(--font-size-sm);
|
|
862
|
-
font-weight: var(--font-weight-medium);
|
|
863
|
-
color: var(--color-text-primary);
|
|
864
|
-
line-height: var(--line-height-tight);
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
.required-indicator {
|
|
868
|
-
color: var(--color-error);
|
|
869
|
-
font-weight: var(--font-weight-bold);
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
.time-wrapper {
|
|
873
|
-
position: relative;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
.time-display {
|
|
877
|
-
width: 100%;
|
|
878
|
-
font-family: var(--font-family-sans);
|
|
879
|
-
background-color: var(--color-bg-primary);
|
|
880
|
-
border: 1px solid var(--color-border);
|
|
881
|
-
border-radius: var(--radius-md);
|
|
882
|
-
transition: all var(--transition-fast);
|
|
883
|
-
color: var(--color-text-primary);
|
|
884
|
-
cursor: pointer;
|
|
885
|
-
user-select: none;
|
|
886
|
-
display: flex;
|
|
887
|
-
align-items: center;
|
|
888
|
-
box-sizing: border-box;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
.time-display:hover:not(.time-disabled) {
|
|
892
|
-
border-color: var(--color-border-hover);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.time-display--open {
|
|
896
|
-
border-color: var(--color-border-focus);
|
|
897
|
-
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
.time-display--empty {
|
|
901
|
-
color: var(--color-text-muted);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/* Sizes */
|
|
905
|
-
.time-picker--sm .time-display {
|
|
906
|
-
padding: var(--space-2) var(--space-3);
|
|
907
|
-
padding-right: var(--space-8);
|
|
908
|
-
font-size: var(--font-size-sm);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.time-picker--md .time-display {
|
|
912
|
-
padding: var(--space-3) var(--space-4);
|
|
913
|
-
padding-right: var(--space-10);
|
|
914
|
-
font-size: var(--font-size-base);
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.time-picker--lg .time-display {
|
|
918
|
-
padding: var(--space-4) var(--space-5);
|
|
919
|
-
padding-right: var(--space-12);
|
|
920
|
-
font-size: var(--font-size-lg);
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/* States */
|
|
924
|
-
.time-picker--error .time-display {
|
|
925
|
-
border-color: var(--color-error);
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
.time-picker--error .time-display--open {
|
|
929
|
-
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
.time-disabled {
|
|
933
|
-
opacity: 0.5;
|
|
934
|
-
cursor: not-allowed !important;
|
|
935
|
-
background-color: var(--color-bg-muted);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
.time-icon {
|
|
939
|
-
position: absolute;
|
|
940
|
-
right: var(--space-3);
|
|
941
|
-
top: 50%;
|
|
942
|
-
transform: translateY(-50%);
|
|
943
|
-
color: var(--color-text-secondary);
|
|
944
|
-
pointer-events: none;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
.time-icon svg {
|
|
948
|
-
width: 1.25em;
|
|
949
|
-
height: 1.25em;
|
|
950
|
-
display: block;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
/* Time Picker Dropdown */
|
|
954
|
-
.time-overlay {
|
|
955
|
-
position: fixed;
|
|
956
|
-
top: 0;
|
|
957
|
-
left: 0;
|
|
958
|
-
right: 0;
|
|
959
|
-
bottom: 0;
|
|
960
|
-
z-index: 999;
|
|
961
|
-
background: transparent;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
.time-container {
|
|
965
|
-
position: absolute;
|
|
966
|
-
top: calc(100% + 4px);
|
|
967
|
-
left: 0;
|
|
968
|
-
min-width: 200px;
|
|
969
|
-
background: var(--color-bg-primary);
|
|
970
|
-
border: 1px solid var(--color-border-focus);
|
|
971
|
-
border-radius: var(--radius-md);
|
|
972
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
973
|
-
z-index: 1000;
|
|
974
|
-
padding: var(--space-3);
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
.time-container--flipped {
|
|
978
|
-
top: auto;
|
|
979
|
-
bottom: calc(100% + 4px);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
.time-selectors {
|
|
983
|
-
display: flex;
|
|
984
|
-
gap: var(--space-2);
|
|
985
|
-
align-items: stretch;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
.time-column {
|
|
989
|
-
flex: 1;
|
|
990
|
-
display: flex;
|
|
991
|
-
flex-direction: column;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
.time-column-label {
|
|
995
|
-
font-size: var(--font-size-xs);
|
|
996
|
-
font-weight: var(--font-weight-medium);
|
|
997
|
-
color: var(--color-text-secondary);
|
|
998
|
-
text-align: center;
|
|
999
|
-
margin-bottom: var(--space-2);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
.time-scroll {
|
|
1003
|
-
max-height: 200px;
|
|
1004
|
-
overflow-y: auto;
|
|
1005
|
-
border: 1px solid var(--color-border);
|
|
1006
|
-
border-radius: var(--radius-md);
|
|
1007
|
-
scrollbar-width: thin;
|
|
1008
|
-
scrollbar-color: var(--color-border) transparent;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
.time-scroll::-webkit-scrollbar {
|
|
1012
|
-
width: 6px;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
.time-scroll::-webkit-scrollbar-track {
|
|
1016
|
-
background: transparent;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
.time-scroll::-webkit-scrollbar-thumb {
|
|
1020
|
-
background: var(--color-border);
|
|
1021
|
-
border-radius: 3px;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
.time-scroll::-webkit-scrollbar-thumb:hover {
|
|
1025
|
-
background: var(--color-border-hover);
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
.time-option {
|
|
1029
|
-
padding: var(--space-2) var(--space-3);
|
|
1030
|
-
cursor: pointer;
|
|
1031
|
-
transition: background-color var(--transition-fast);
|
|
1032
|
-
color: var(--color-text-primary);
|
|
1033
|
-
text-align: center;
|
|
1034
|
-
font-size: var(--font-size-sm);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
.time-option:hover {
|
|
1038
|
-
background-color: var(--color-bg-secondary);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
.time-option--selected {
|
|
1042
|
-
background-color: var(--color-primary);
|
|
1043
|
-
color: white;
|
|
1044
|
-
font-weight: var(--font-weight-medium);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
.time-option--selected:hover {
|
|
1048
|
-
background-color: var(--color-primary);
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
.time-footer {
|
|
1052
|
-
margin-top: var(--space-3);
|
|
1053
|
-
padding-top: var(--space-3);
|
|
1054
|
-
border-top: 1px solid var(--color-border);
|
|
1055
|
-
display: flex;
|
|
1056
|
-
justify-content: center;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
.time-now-btn {
|
|
1060
|
-
background: transparent;
|
|
1061
|
-
border: none;
|
|
1062
|
-
color: var(--color-primary);
|
|
1063
|
-
font-size: var(--font-size-xs);
|
|
1064
|
-
font-weight: var(--font-weight-medium);
|
|
1065
|
-
padding: var(--space-1) var(--space-2);
|
|
1066
|
-
border-radius: var(--radius-md);
|
|
1067
|
-
cursor: pointer;
|
|
1068
|
-
transition: all 0.2s ease;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
.time-now-btn:hover {
|
|
1072
|
-
background-color: var(--color-bg-secondary);
|
|
1073
|
-
color: var(--color-primary);
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
.time-picker-error {
|
|
1077
|
-
font-size: var(--font-size-sm);
|
|
1078
|
-
color: var(--color-error);
|
|
1079
|
-
line-height: var(--line-height-tight);
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
.time-picker-hint {
|
|
1083
|
-
font-size: var(--font-size-sm);
|
|
1084
|
-
color: var(--color-text-muted);
|
|
1085
|
-
line-height: var(--line-height-tight);
|
|
1086
|
-
}
|
|
1087
|
-
`;
|
|
1088
|
-
u([
|
|
1089
|
-
f({ type: String })
|
|
1090
|
-
], d.prototype, "value", 2);
|
|
1091
|
-
u([
|
|
1092
|
-
f({ type: String })
|
|
1093
|
-
], d.prototype, "label", 2);
|
|
1094
|
-
u([
|
|
1095
|
-
f({ type: String })
|
|
1096
|
-
], d.prototype, "placeholder", 2);
|
|
1097
|
-
u([
|
|
1098
|
-
f({ type: Boolean, reflect: !0 })
|
|
1099
|
-
], d.prototype, "required", 2);
|
|
1100
|
-
u([
|
|
1101
|
-
f({ type: Boolean, reflect: !0 })
|
|
1102
|
-
], d.prototype, "disabled", 2);
|
|
1103
|
-
u([
|
|
1104
|
-
f({ type: String })
|
|
1105
|
-
], d.prototype, "error", 2);
|
|
1106
|
-
u([
|
|
1107
|
-
f({ type: String })
|
|
1108
|
-
], d.prototype, "hint", 2);
|
|
1109
|
-
u([
|
|
1110
|
-
f({ type: String })
|
|
1111
|
-
], d.prototype, "size", 2);
|
|
1112
|
-
u([
|
|
1113
|
-
f({ type: String })
|
|
1114
|
-
], d.prototype, "format", 2);
|
|
1115
|
-
u([
|
|
1116
|
-
U()
|
|
1117
|
-
], d.prototype, "isOpen", 2);
|
|
1118
|
-
u([
|
|
1119
|
-
U()
|
|
1120
|
-
], d.prototype, "selectedHour", 2);
|
|
1121
|
-
u([
|
|
1122
|
-
U()
|
|
1123
|
-
], d.prototype, "selectedMinute", 2);
|
|
1124
|
-
u([
|
|
1125
|
-
U()
|
|
1126
|
-
], d.prototype, "selectedPeriod", 2);
|
|
1127
|
-
u([
|
|
1128
|
-
U()
|
|
1129
|
-
], d.prototype, "isFlipped", 2);
|
|
1130
|
-
u([
|
|
1131
|
-
ce(".time-display")
|
|
1132
|
-
], d.prototype, "timeDisplay", 2);
|
|
1133
|
-
u([
|
|
1134
|
-
ce(".time-container")
|
|
1135
|
-
], d.prototype, "timeContainer", 2);
|
|
1136
|
-
d = u([
|
|
1137
|
-
Ne("base-time-picker")
|
|
1138
|
-
], d);
|
|
1139
|
-
export {
|
|
1140
|
-
d as BaseTimePicker
|
|
1141
|
-
};
|