stimulus_plumbers 0.4.9 → 0.4.11
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +2 -2
- data/app/assets/javascripts/stimulus-plumbers/controllers.manifest.json +36 -3
- data/app/assets/javascripts/stimulus-plumbers/index.es.js +351 -173
- data/app/assets/javascripts/stimulus-plumbers/index.es.js.map +1 -1
- data/app/assets/javascripts/stimulus-plumbers/index.umd.js +1 -1
- data/app/assets/javascripts/stimulus-plumbers/index.umd.js.map +1 -1
- data/docs/component/form.md +27 -5
- data/docs/guide.md +9 -0
- data/lib/generators/stimulus_plumbers/install/install_generator.rb +7 -1
- data/lib/stimulus_plumbers/engine.rb +0 -4
- data/lib/stimulus_plumbers/form/builder.rb +4 -0
- data/lib/stimulus_plumbers/form/field.rb +1 -1
- data/lib/stimulus_plumbers/form/fields/inputs/code.rb +86 -0
- data/lib/stimulus_plumbers/form/fields/inputs/credit_card.rb +98 -0
- data/lib/stimulus_plumbers/form/fields/renderer.rb +2 -0
- data/lib/stimulus_plumbers/generators/css_entrypoint.rb +53 -0
- data/lib/stimulus_plumbers/generators/tokens_directive.rb +5 -5
- data/lib/stimulus_plumbers/themes/schema.rb +43 -22
- data/lib/stimulus_plumbers/version.rb +1 -1
- data/vendor/ARIA.md +7 -0
- data/vendor/component/manifest.json +3 -0
- data/vendor/controller/docs/input-formatter.md +87 -21
- data/vendor/controller/manifest.json +36 -3
- metadata +3 -1
|
@@ -195,49 +195,49 @@ function m(e, t = {}) {
|
|
|
195
195
|
}
|
|
196
196
|
var h = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, ee = (e, t = "element") => e.id ||= h(t), g = (e, t, n) => {
|
|
197
197
|
e.setAttribute(t, n.toString());
|
|
198
|
-
}, _ = (e, t) => g(e, "aria-expanded", t),
|
|
199
|
-
function
|
|
198
|
+
}, _ = (e, t) => g(e, "aria-expanded", t), te = (e) => e.getAttribute("aria-expanded") === "true", ne = (e, t) => g(e, "aria-pressed", t), re = (e, t) => g(e, "aria-checked", t), v = (e, t) => g(e, "aria-selected", t), y = (e, t) => t ? e.setAttribute("aria-current", t) : e.removeAttribute("aria-current"), b = (e, t) => t ? e.setAttribute("hidden", "") : e.removeAttribute("hidden"), x = (e, t) => g(e, "aria-hidden", t), S = (e, t) => g(e, "aria-disabled", t), C = (e) => e.getAttribute("aria-disabled") === "true";
|
|
199
|
+
function w(e, t) {
|
|
200
200
|
g(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
|
|
201
201
|
}
|
|
202
|
-
var
|
|
202
|
+
var T = (e, t) => g(e, "aria-valuemin", t), E = (e, t) => g(e, "aria-valuemax", t), D = (e, t) => t == null ? e.removeAttribute("aria-valuenow") : g(e, "aria-valuenow", t), O = {
|
|
203
203
|
menu: "menu",
|
|
204
204
|
listbox: "listbox",
|
|
205
205
|
tree: "tree",
|
|
206
206
|
grid: "grid",
|
|
207
207
|
dialog: "dialog"
|
|
208
|
-
},
|
|
208
|
+
}, ie = (e, t, n) => {
|
|
209
209
|
Object.entries(t).forEach(([t, r]) => {
|
|
210
210
|
e.setAttribute(t, r), n[t] = r;
|
|
211
211
|
});
|
|
212
|
-
},
|
|
213
|
-
function
|
|
212
|
+
}, k = (e, t, n) => n || !e.hasAttribute(t);
|
|
213
|
+
function ae({ trigger: e, target: t, role: n = null, override: r = !1 }) {
|
|
214
214
|
let i = {
|
|
215
215
|
trigger: {},
|
|
216
216
|
target: {}
|
|
217
217
|
};
|
|
218
218
|
if (!e || !t) return i;
|
|
219
219
|
let a = {}, o = {};
|
|
220
|
-
if (n &&
|
|
221
|
-
let e =
|
|
220
|
+
if (n && k(t, "role", r) && (o.role = n), t.id && (k(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && k(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && k(e, "aria-haspopup", r)) {
|
|
221
|
+
let e = O[n] || "true";
|
|
222
222
|
e && (a["aria-haspopup"] = e);
|
|
223
223
|
}
|
|
224
|
-
return
|
|
224
|
+
return ie(t, o, i.target), ie(e, a, i.trigger), i;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var oe = (e, t) => {
|
|
227
227
|
t.forEach((t) => {
|
|
228
228
|
e.hasAttribute(t) && e.removeAttribute(t);
|
|
229
229
|
});
|
|
230
230
|
};
|
|
231
|
-
function
|
|
232
|
-
!e || !t || (
|
|
231
|
+
function se({ trigger: e, target: t, attributes: n = null }) {
|
|
232
|
+
!e || !t || (oe(e, n || [
|
|
233
233
|
"aria-controls",
|
|
234
234
|
"aria-haspopup",
|
|
235
235
|
"aria-describedby"
|
|
236
|
-
]), (!n || n.includes("role")) &&
|
|
236
|
+
]), (!n || n.includes("role")) && oe(t, ["role"]));
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region src/requestor.js
|
|
240
|
-
var
|
|
240
|
+
var A = class {
|
|
241
241
|
constructor() {
|
|
242
242
|
this._abortController = null, this._timer = null;
|
|
243
243
|
}
|
|
@@ -259,7 +259,7 @@ var k = class {
|
|
|
259
259
|
};
|
|
260
260
|
//#endregion
|
|
261
261
|
//#region src/researcher.js
|
|
262
|
-
function
|
|
262
|
+
function ce(e, t) {
|
|
263
263
|
let n = 0;
|
|
264
264
|
for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
|
|
265
265
|
return n === e.length;
|
|
@@ -271,12 +271,12 @@ function ue(e, t) {
|
|
|
271
271
|
return t.startsWith(e);
|
|
272
272
|
}
|
|
273
273
|
function de(e) {
|
|
274
|
-
return e === "contains" ? le : e === "prefix" ? ue :
|
|
274
|
+
return e === "contains" ? le : e === "prefix" ? ue : ce;
|
|
275
275
|
}
|
|
276
276
|
function fe(e, t) {
|
|
277
277
|
return t === "textContent" ? e.textContent?.trim().toLowerCase() ?? "" : (e.getAttribute(t) ?? "").toLowerCase();
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function pe(e, t, n = {}) {
|
|
280
280
|
let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : de(r), s = t.toLowerCase(), c = 0;
|
|
281
281
|
return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
|
|
282
282
|
let t = a.some((t) => o(s, fe(e, t)));
|
|
@@ -285,7 +285,7 @@ function j(e, t, n = {}) {
|
|
|
285
285
|
}
|
|
286
286
|
//#endregion
|
|
287
287
|
//#region src/plumbers/plumber/geometry.js
|
|
288
|
-
var
|
|
288
|
+
var me = {
|
|
289
289
|
get top() {
|
|
290
290
|
return "bottom";
|
|
291
291
|
},
|
|
@@ -299,7 +299,7 @@ var pe = {
|
|
|
299
299
|
return "left";
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
-
function
|
|
302
|
+
function j({ x: e, y: t, width: n, height: r }) {
|
|
303
303
|
return {
|
|
304
304
|
x: e,
|
|
305
305
|
y: t,
|
|
@@ -311,42 +311,42 @@ function M({ x: e, y: t, width: n, height: r }) {
|
|
|
311
311
|
bottom: t + r
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function he(e, t = "vertical") {
|
|
315
315
|
return t === "horizontal" ? e.left + e.width / 2 : e.top + e.height / 2;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
return
|
|
317
|
+
function M() {
|
|
318
|
+
return j({
|
|
319
319
|
x: 0,
|
|
320
320
|
y: 0,
|
|
321
321
|
width: window.innerWidth || document.documentElement.clientWidth,
|
|
322
322
|
height: window.innerHeight || document.documentElement.clientHeight
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function ge(e) {
|
|
326
326
|
if (!(e instanceof HTMLElement)) return !1;
|
|
327
|
-
let t =
|
|
327
|
+
let t = M(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
|
|
328
328
|
return r && i;
|
|
329
329
|
}
|
|
330
330
|
//#endregion
|
|
331
331
|
//#region src/plumbers/plumber/config.js
|
|
332
|
-
var
|
|
332
|
+
var N = {
|
|
333
333
|
get visibleOnly() {
|
|
334
334
|
return !0;
|
|
335
335
|
},
|
|
336
336
|
hiddenClass: null
|
|
337
|
-
},
|
|
337
|
+
}, _e = {
|
|
338
338
|
element: null,
|
|
339
339
|
visible: null,
|
|
340
340
|
dispatch: !0,
|
|
341
341
|
prefix: ""
|
|
342
|
-
},
|
|
342
|
+
}, P = class {
|
|
343
343
|
constructor(e, t = {}) {
|
|
344
344
|
this.controller = e;
|
|
345
|
-
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({},
|
|
346
|
-
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r :
|
|
345
|
+
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, _e, t);
|
|
346
|
+
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : N.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
|
|
347
347
|
}
|
|
348
348
|
get visible() {
|
|
349
|
-
return this.element instanceof HTMLElement ? !this.visibleOnly ||
|
|
349
|
+
return this.element instanceof HTMLElement ? !this.visibleOnly || ge(this.element) && this.isVisible(this.element) : !1;
|
|
350
350
|
}
|
|
351
351
|
isVisible(e) {
|
|
352
352
|
if (this.visibleCallback) {
|
|
@@ -375,7 +375,7 @@ var P = {
|
|
|
375
375
|
return n instanceof Promise ? await n : n;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
},
|
|
378
|
+
}, ve = {
|
|
379
379
|
normalize(e) {
|
|
380
380
|
return typeof e == "string" ? e : "";
|
|
381
381
|
},
|
|
@@ -385,7 +385,7 @@ var P = {
|
|
|
385
385
|
};
|
|
386
386
|
//#endregion
|
|
387
387
|
//#region src/plumbers/formatters/credit_card.js
|
|
388
|
-
function
|
|
388
|
+
function ye(e) {
|
|
389
389
|
let t = 0, n = !1;
|
|
390
390
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
391
391
|
let i = parseInt(e[r], 10);
|
|
@@ -393,17 +393,28 @@ function ve(e) {
|
|
|
393
393
|
}
|
|
394
394
|
return t % 10 == 0;
|
|
395
395
|
}
|
|
396
|
-
var
|
|
396
|
+
var be = /\D/g, xe = /^\d{13,19}$/, Se = /(.{4})(?=.)/g, Ce = {
|
|
397
397
|
normalize(e) {
|
|
398
|
-
return typeof e == "string" ? e.replace(
|
|
398
|
+
return typeof e == "string" ? e.replace(be, "") : "";
|
|
399
399
|
},
|
|
400
400
|
validate(e) {
|
|
401
|
-
return typeof e != "string" || !
|
|
401
|
+
return typeof e != "string" || !xe.test(e) ? !1 : ye(e);
|
|
402
402
|
},
|
|
403
403
|
format(e) {
|
|
404
|
-
return typeof e == "string" ? e.replace(
|
|
404
|
+
return typeof e == "string" ? e.replace(Se, "$1 ") : "";
|
|
405
|
+
},
|
|
406
|
+
cells() {
|
|
407
|
+
return {
|
|
408
|
+
groups: [
|
|
409
|
+
4,
|
|
410
|
+
4,
|
|
411
|
+
4,
|
|
412
|
+
4
|
|
413
|
+
],
|
|
414
|
+
length: 0
|
|
415
|
+
};
|
|
405
416
|
}
|
|
406
|
-
},
|
|
417
|
+
}, F = { 1: 10 }, I = /\D/g, we = /^\+\d{7,15}$/, Te = {
|
|
407
418
|
normalize(e) {
|
|
408
419
|
if (typeof e != "string") return "";
|
|
409
420
|
let t = e.trimStart().startsWith("+"), n = e.replace(I, "");
|
|
@@ -413,12 +424,12 @@ var ye = /\D/g, be = /^\d{13,19}$/, xe = /(.{4})(?=.)/g, Se = {
|
|
|
413
424
|
if (typeof e != "string") return !1;
|
|
414
425
|
if (we.test(e)) return !0;
|
|
415
426
|
let t = e.replace(I, "");
|
|
416
|
-
return Object.values(
|
|
427
|
+
return Object.values(F).includes(t.length);
|
|
417
428
|
},
|
|
418
429
|
format(e) {
|
|
419
430
|
if (typeof e != "string") return "";
|
|
420
431
|
let t = e.replace(I, "");
|
|
421
|
-
for (let [e, n] of Object.entries(
|
|
432
|
+
for (let [e, n] of Object.entries(F)) {
|
|
422
433
|
if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
|
|
423
434
|
let r = n + e.length;
|
|
424
435
|
if (t.length === r && t.startsWith(e)) {
|
|
@@ -526,36 +537,63 @@ var ye = /\D/g, be = /^\d{13,19}$/, xe = /(.{4})(?=.)/g, Se = {
|
|
|
526
537
|
return `${r % 12 || 12}:${i} ${a}`;
|
|
527
538
|
}
|
|
528
539
|
}, B = {
|
|
540
|
+
digits: /[^0-9]/g,
|
|
541
|
+
letters: /[^a-zA-Z]/g,
|
|
542
|
+
alphanumeric: /[^0-9a-zA-Z]/g
|
|
543
|
+
}, Me = {
|
|
544
|
+
normalize(e, t = {}) {
|
|
545
|
+
if (typeof e != "string") return "";
|
|
546
|
+
let n = B[t.charset] ?? B.alphanumeric, r = e.replace(n, "").toUpperCase(), i = t.length ?? 0;
|
|
547
|
+
return i > 0 ? r.slice(0, i) : r;
|
|
548
|
+
},
|
|
549
|
+
validate(e, t = {}) {
|
|
550
|
+
if (typeof e != "string") return !1;
|
|
551
|
+
let n = t.length ?? 0;
|
|
552
|
+
return n > 0 ? e.length === n : !0;
|
|
553
|
+
},
|
|
554
|
+
format(e) {
|
|
555
|
+
return typeof e == "string" ? e : "";
|
|
556
|
+
},
|
|
557
|
+
cells(e = {}) {
|
|
558
|
+
return {
|
|
559
|
+
groups: [],
|
|
560
|
+
length: e.length ?? 0
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}, V = {
|
|
529
564
|
PLAIN: "plain",
|
|
530
565
|
CREDIT_CARD: "creditCard",
|
|
531
566
|
PHONE: "phone",
|
|
532
567
|
CURRENCY: "currency",
|
|
533
568
|
DATE: "date",
|
|
534
|
-
TIME: "time"
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
[
|
|
538
|
-
[
|
|
539
|
-
[
|
|
540
|
-
[
|
|
541
|
-
[
|
|
542
|
-
]
|
|
543
|
-
|
|
569
|
+
TIME: "time",
|
|
570
|
+
CODE: "code"
|
|
571
|
+
}, H = /* @__PURE__ */ new Map([
|
|
572
|
+
[V.PLAIN, ve],
|
|
573
|
+
[V.CREDIT_CARD, Ce],
|
|
574
|
+
[V.PHONE, Te],
|
|
575
|
+
[V.CURRENCY, Oe],
|
|
576
|
+
[V.DATE, R],
|
|
577
|
+
[V.TIME, z],
|
|
578
|
+
[V.CODE, Me]
|
|
579
|
+
]), Ne = {
|
|
580
|
+
type: V.PLAIN,
|
|
544
581
|
options: {}
|
|
545
|
-
},
|
|
582
|
+
}, Pe = class extends P {
|
|
546
583
|
static register(e, t) {
|
|
547
|
-
|
|
584
|
+
H.set(e, t);
|
|
548
585
|
}
|
|
549
586
|
constructor(e, t = {}) {
|
|
550
|
-
super(e, t), this.type = t.type ??
|
|
587
|
+
super(e, t), this.type = t.type ?? Ne.type, this.options = t.options ?? Ne.options, this.enhance();
|
|
551
588
|
}
|
|
552
589
|
enhance() {
|
|
553
|
-
let e = this, t =
|
|
590
|
+
let e = this, t = H.get(e.type) ?? H.get(V.PLAIN), n = {
|
|
554
591
|
normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
555
592
|
validate: (n) => t.validate?.(n, e.options) ?? !0,
|
|
556
593
|
format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
557
594
|
mask: (n) => t.mask?.(n, e.options) ?? null,
|
|
558
|
-
maskable: () => typeof t.mask == "function"
|
|
595
|
+
maskable: () => typeof t.mask == "function",
|
|
596
|
+
cells: () => typeof t.cells == "function" ? t.cells(e.options) : null
|
|
559
597
|
};
|
|
560
598
|
Object.defineProperty(this.controller, "formatter", {
|
|
561
599
|
get() {
|
|
@@ -564,7 +602,89 @@ var ye = /\D/g, be = /^\d{13,19}$/, xe = /(.{4})(?=.)/g, Se = {
|
|
|
564
602
|
configurable: !0
|
|
565
603
|
});
|
|
566
604
|
}
|
|
567
|
-
},
|
|
605
|
+
}, U = (e, t) => new Pe(e, t), Fe = {
|
|
606
|
+
groups: [],
|
|
607
|
+
length: 0
|
|
608
|
+
}, W = (e) => {
|
|
609
|
+
let t = [], n = 0;
|
|
610
|
+
for (let r of e) n += r, t.push(n);
|
|
611
|
+
return t;
|
|
612
|
+
}, Ie = class extends P {
|
|
613
|
+
constructor(e, t = {}) {
|
|
614
|
+
super(e, t), this.groups = Array.isArray(t.groups) ? t.groups : Fe.groups, this.length = t.length ?? Fe.length, this.adopt(), this.enhance();
|
|
615
|
+
}
|
|
616
|
+
get cells() {
|
|
617
|
+
return this.controller.cellTargets ?? [];
|
|
618
|
+
}
|
|
619
|
+
expected() {
|
|
620
|
+
if (this.length > 0) return this.length;
|
|
621
|
+
let e = this.groups.reduce((e, t) => e + t, 0);
|
|
622
|
+
return e > 0 ? e : this.cells.length;
|
|
623
|
+
}
|
|
624
|
+
active() {
|
|
625
|
+
return this.grouped ? this.expected() : Math.min(this.cells.length, this.expected());
|
|
626
|
+
}
|
|
627
|
+
get grouped() {
|
|
628
|
+
return this.groups.length > 0 && this.cells.length === this.groups.length;
|
|
629
|
+
}
|
|
630
|
+
adopt() {
|
|
631
|
+
let e = this.expected();
|
|
632
|
+
this.cells.length < e && console.warn(`[CharacterCells] expected ${e} cells, found ${this.cells.length}`);
|
|
633
|
+
let t = W(this.groups);
|
|
634
|
+
if (this.grouped) {
|
|
635
|
+
this.cells.forEach((n, r) => {
|
|
636
|
+
x(n, !0);
|
|
637
|
+
let i = (r === 0 ? 0 : t[r - 1]) >= e;
|
|
638
|
+
n.toggleAttribute("data-inactive", i), i && (n.textContent = "", n.removeAttribute("data-filled"), n.removeAttribute("data-caret")), n.setAttribute("data-group-index", r), n.removeAttribute("data-group-end");
|
|
639
|
+
});
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this.cells.forEach((n, r) => {
|
|
643
|
+
x(n, !0);
|
|
644
|
+
let i = r >= e;
|
|
645
|
+
n.toggleAttribute("data-inactive", i), i && (n.textContent = "", n.removeAttribute("data-filled"), n.removeAttribute("data-caret"));
|
|
646
|
+
let a = t.findIndex((e) => r < e);
|
|
647
|
+
a >= 0 ? (n.setAttribute("data-group-index", a), n.toggleAttribute("data-group-end", r === t[a] - 1)) : (n.removeAttribute("data-group-index"), n.removeAttribute("data-group-end"));
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
enhance() {
|
|
651
|
+
let e = this, t = {
|
|
652
|
+
draw: (t, n) => e.draw(t, n),
|
|
653
|
+
clear: () => e.draw(""),
|
|
654
|
+
active: () => e.active()
|
|
655
|
+
};
|
|
656
|
+
Object.defineProperty(this.controller, "characterCells", {
|
|
657
|
+
get() {
|
|
658
|
+
return t;
|
|
659
|
+
},
|
|
660
|
+
configurable: !0
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
draw(e = "", { focused: t = !1 } = {}) {
|
|
664
|
+
let n = typeof e == "string" ? e : "";
|
|
665
|
+
if (this.grouped) {
|
|
666
|
+
let e = W(this.groups);
|
|
667
|
+
this.cells.forEach((r, i) => {
|
|
668
|
+
let a = i === 0 ? 0 : e[i - 1], o = e[i];
|
|
669
|
+
if (a >= this.expected()) {
|
|
670
|
+
r.textContent = "", r.removeAttribute("data-filled"), r.removeAttribute("data-caret");
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
let s = n.slice(a, o);
|
|
674
|
+
r.textContent = s, r.toggleAttribute("data-filled", s.length > 0), r.toggleAttribute("data-caret", t && n.length >= a && n.length < o);
|
|
675
|
+
});
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
let r = n.split(""), i = this.active();
|
|
679
|
+
this.cells.forEach((e, n) => {
|
|
680
|
+
if (n >= i) {
|
|
681
|
+
e.textContent = "", e.removeAttribute("data-filled"), e.removeAttribute("data-caret");
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
e.textContent = r[n] ?? "", e.toggleAttribute("data-filled", r[n] != null), e.toggleAttribute("data-caret", t && n === r.length);
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}, Le = (e, t) => new Ie(e, t), Re = /^\d{4}-\d{2}-\d{2}$/;
|
|
568
688
|
function G(e) {
|
|
569
689
|
return e instanceof Date && !isNaN(e);
|
|
570
690
|
}
|
|
@@ -573,7 +693,7 @@ function K(...e) {
|
|
|
573
693
|
if (e.length === 1) {
|
|
574
694
|
let t = e[0];
|
|
575
695
|
if (!t) return;
|
|
576
|
-
if (typeof t == "string" &&
|
|
696
|
+
if (typeof t == "string" && Re.test(t)) {
|
|
577
697
|
let [e, n, r] = t.split("-").map(Number), i = new Date(e, n - 1, r);
|
|
578
698
|
if (G(i)) return i;
|
|
579
699
|
} else {
|
|
@@ -587,7 +707,7 @@ function K(...e) {
|
|
|
587
707
|
}
|
|
588
708
|
//#endregion
|
|
589
709
|
//#region src/plumbers/calendar.js
|
|
590
|
-
var
|
|
710
|
+
var ze = 7, Be = 12, q = 10, Ve = {
|
|
591
711
|
locales: ["default"],
|
|
592
712
|
today: "",
|
|
593
713
|
day: null,
|
|
@@ -602,11 +722,11 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
602
722
|
disabledYears: [],
|
|
603
723
|
firstDayOfWeek: 0,
|
|
604
724
|
onNavigated: "navigated"
|
|
605
|
-
},
|
|
725
|
+
}, He = class extends P {
|
|
606
726
|
constructor(e, t = {}) {
|
|
607
727
|
super(e, t);
|
|
608
|
-
let n = Object.assign({},
|
|
609
|
-
this.onNavigated = r, this.since = K(i), this.till = K(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o :
|
|
728
|
+
let n = Object.assign({}, Ve, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
|
|
729
|
+
this.onNavigated = r, this.since = K(i), this.till = K(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : Ve.firstDayOfWeek;
|
|
610
730
|
let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
|
|
611
731
|
this.disabledDates = Array.isArray(s) ? s : [], this.disabledWeekdays = Array.isArray(c) ? c : [], this.disabledDays = Array.isArray(l) ? l : [], this.disabledMonths = Array.isArray(u) ? u : [], this.disabledYears = Array.isArray(d) ? d : [];
|
|
612
732
|
let { today: f, day: p, month: m, year: h } = n;
|
|
@@ -646,7 +766,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
646
766
|
let a = new Date(t, e, i);
|
|
647
767
|
n.push(r(a));
|
|
648
768
|
}
|
|
649
|
-
let s = n.length %
|
|
769
|
+
let s = n.length % ze, c = s === 0 ? 0 : ze - s;
|
|
650
770
|
for (let i = 1; i <= c; i++) {
|
|
651
771
|
let a = new Date(t, e + 1, i);
|
|
652
772
|
n.push(r(a));
|
|
@@ -655,7 +775,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
655
775
|
}
|
|
656
776
|
buildMonthsOfYear() {
|
|
657
777
|
let e = new Intl.DateTimeFormat(this.localesValue, { month: "long" }), t = new Intl.DateTimeFormat(this.localesValue, { month: "short" }), n = new Intl.DateTimeFormat(this.localesValue, { month: "numeric" }), r = [];
|
|
658
|
-
for (let i = 0; i <
|
|
778
|
+
for (let i = 0; i < Be; i++) {
|
|
659
779
|
let a = new Date(this.year, i), o = new Date(this.year, i, 1), s = new Date(this.year, i + 1, 0), c = t.format(a), l = e.format(a), u = this.since && s < this.since || this.till && o > this.till, d = this.disabledMonths.some((e) => i == e || c === e || l === e);
|
|
660
780
|
r.push({
|
|
661
781
|
date: a,
|
|
@@ -822,7 +942,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
822
942
|
};
|
|
823
943
|
} });
|
|
824
944
|
}
|
|
825
|
-
}, J = (e, t) => new
|
|
945
|
+
}, J = (e, t) => new He(e, t), Ue = class extends P {
|
|
826
946
|
constructor(e, t = {}) {
|
|
827
947
|
super(e, t), this.handle = this.handle.bind(this), this.onSelect = t.onSelect || null;
|
|
828
948
|
}
|
|
@@ -848,7 +968,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
848
968
|
iso: i
|
|
849
969
|
} });
|
|
850
970
|
}
|
|
851
|
-
},
|
|
971
|
+
}, We = class extends P {
|
|
852
972
|
constructor(e, t = {}) {
|
|
853
973
|
super(e, t), this.handle = this.handle.bind(this);
|
|
854
974
|
}
|
|
@@ -865,7 +985,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
865
985
|
let n = parseInt(t.dataset.month, 10);
|
|
866
986
|
isNaN(n) || this.dispatch("selected", { detail: { month: n } });
|
|
867
987
|
}
|
|
868
|
-
},
|
|
988
|
+
}, Ge = class extends P {
|
|
869
989
|
constructor(e, t = {}) {
|
|
870
990
|
super(e, t), this.handle = this.handle.bind(this);
|
|
871
991
|
}
|
|
@@ -882,20 +1002,20 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
882
1002
|
let n = parseInt(t.dataset.year, 10);
|
|
883
1003
|
isNaN(n) || this.dispatch("selected", { detail: { year: n } });
|
|
884
1004
|
}
|
|
885
|
-
},
|
|
1005
|
+
}, Ke = (e, t) => new Ue(e, t), qe = (e, t) => new We(e, t), Je = (e, t) => new Ge(e, t), Y = {
|
|
886
1006
|
content: null,
|
|
887
1007
|
url: "",
|
|
888
1008
|
reload: "never",
|
|
889
1009
|
stale: 3600,
|
|
890
1010
|
onLoad: "canLoad",
|
|
891
1011
|
onLoaded: "contentLoaded"
|
|
892
|
-
},
|
|
1012
|
+
}, Ye = class extends P {
|
|
893
1013
|
constructor(e, t = {}) {
|
|
894
1014
|
super(e, t);
|
|
895
1015
|
let n = Object.assign({}, Y, t), { content: r, url: i, reload: a, stale: o } = n;
|
|
896
1016
|
this.content = r, this.url = i, this.reload = typeof a == "string" ? a : Y.reload, this.stale = typeof o == "number" ? o : Y.stale;
|
|
897
1017
|
let { onLoad: s, onLoaded: c } = n;
|
|
898
|
-
this.onLoad = s, this.onLoaded = c, this._requestor = new
|
|
1018
|
+
this.onLoad = s, this.onLoaded = c, this._requestor = new A(), this.enhance();
|
|
899
1019
|
}
|
|
900
1020
|
get reloadable() {
|
|
901
1021
|
switch (this.reload) {
|
|
@@ -928,7 +1048,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
928
1048
|
let e = this;
|
|
929
1049
|
Object.assign(this.controller, { load: e.load.bind(e) });
|
|
930
1050
|
}
|
|
931
|
-
},
|
|
1051
|
+
}, Xe = (e, t) => new Ye(e, t), X = class extends P {
|
|
932
1052
|
observe(e) {
|
|
933
1053
|
this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
|
|
934
1054
|
}
|
|
@@ -941,21 +1061,21 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
941
1061
|
e.unobserve(), t();
|
|
942
1062
|
};
|
|
943
1063
|
}
|
|
944
|
-
},
|
|
1064
|
+
}, Ze = {
|
|
945
1065
|
trigger: null,
|
|
946
1066
|
events: ["click"],
|
|
947
1067
|
onDismissed: "dismissed"
|
|
948
|
-
},
|
|
1068
|
+
}, Qe = class extends X {
|
|
949
1069
|
constructor(e, t = {}) {
|
|
950
1070
|
super(e, t);
|
|
951
|
-
let { trigger: n, events: r, onDismissed: i } = Object.assign({},
|
|
1071
|
+
let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Ze, t);
|
|
952
1072
|
this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
|
|
953
1073
|
}
|
|
954
1074
|
dismiss = async (e) => {
|
|
955
1075
|
let { target: t } = e;
|
|
956
1076
|
t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
|
|
957
1077
|
};
|
|
958
|
-
}, Z = (e, t) => new
|
|
1078
|
+
}, Z = (e, t) => new Qe(e, t), $e = {
|
|
959
1079
|
anchor: null,
|
|
960
1080
|
events: ["click"],
|
|
961
1081
|
placement: "bottom",
|
|
@@ -963,11 +1083,11 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
963
1083
|
onFlipped: "flipped",
|
|
964
1084
|
ariaRole: null,
|
|
965
1085
|
respectMotion: !0
|
|
966
|
-
},
|
|
1086
|
+
}, et = class extends X {
|
|
967
1087
|
constructor(e, t = {}) {
|
|
968
1088
|
super(e, t);
|
|
969
|
-
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({},
|
|
970
|
-
this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element &&
|
|
1089
|
+
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, $e, t);
|
|
1090
|
+
this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && ae({
|
|
971
1091
|
trigger: this.anchor,
|
|
972
1092
|
target: this.element,
|
|
973
1093
|
role: this.ariaRole
|
|
@@ -985,7 +1105,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
985
1105
|
}), this.dispatch("flipped", { detail: { placement: e } });
|
|
986
1106
|
};
|
|
987
1107
|
flippedRect(e, t) {
|
|
988
|
-
let n = this.quadrumRect(e,
|
|
1108
|
+
let n = this.quadrumRect(e, M()), r = [this.placement, me[this.placement]], i = {};
|
|
989
1109
|
for (; !Object.keys(i).length && r.length > 0;) {
|
|
990
1110
|
let a = r.shift();
|
|
991
1111
|
if (!this.biggerRectThan(n[a], t)) continue;
|
|
@@ -996,25 +1116,25 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
996
1116
|
}
|
|
997
1117
|
quadrumRect(e, t) {
|
|
998
1118
|
return {
|
|
999
|
-
left:
|
|
1119
|
+
left: j({
|
|
1000
1120
|
x: t.x,
|
|
1001
1121
|
y: t.y,
|
|
1002
1122
|
width: e.x - t.x,
|
|
1003
1123
|
height: t.height
|
|
1004
1124
|
}),
|
|
1005
|
-
right:
|
|
1125
|
+
right: j({
|
|
1006
1126
|
x: e.x + e.width,
|
|
1007
1127
|
y: t.y,
|
|
1008
1128
|
width: t.width - (e.x + e.width),
|
|
1009
1129
|
height: t.height
|
|
1010
1130
|
}),
|
|
1011
|
-
top:
|
|
1131
|
+
top: j({
|
|
1012
1132
|
x: t.x,
|
|
1013
1133
|
y: t.y,
|
|
1014
1134
|
width: t.width,
|
|
1015
1135
|
height: e.y - t.y
|
|
1016
1136
|
}),
|
|
1017
|
-
bottom:
|
|
1137
|
+
bottom: j({
|
|
1018
1138
|
x: t.x,
|
|
1019
1139
|
y: e.y + e.height,
|
|
1020
1140
|
width: t.width,
|
|
@@ -1024,25 +1144,25 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1024
1144
|
}
|
|
1025
1145
|
quadrumPlacement(e, t, n) {
|
|
1026
1146
|
switch (t) {
|
|
1027
|
-
case "top": return
|
|
1147
|
+
case "top": return j({
|
|
1028
1148
|
x: n.x,
|
|
1029
1149
|
y: e.y - n.height,
|
|
1030
1150
|
width: n.width,
|
|
1031
1151
|
height: n.height
|
|
1032
1152
|
});
|
|
1033
|
-
case "bottom": return
|
|
1153
|
+
case "bottom": return j({
|
|
1034
1154
|
x: n.x,
|
|
1035
1155
|
y: e.y + e.height,
|
|
1036
1156
|
width: n.width,
|
|
1037
1157
|
height: n.height
|
|
1038
1158
|
});
|
|
1039
|
-
case "left": return
|
|
1159
|
+
case "left": return j({
|
|
1040
1160
|
x: e.x - n.width,
|
|
1041
1161
|
y: n.y,
|
|
1042
1162
|
width: n.width,
|
|
1043
1163
|
height: n.height
|
|
1044
1164
|
});
|
|
1045
|
-
case "right": return
|
|
1165
|
+
case "right": return j({
|
|
1046
1166
|
x: e.x + e.width,
|
|
1047
1167
|
y: n.y,
|
|
1048
1168
|
width: n.width,
|
|
@@ -1056,7 +1176,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1056
1176
|
case "top":
|
|
1057
1177
|
case "bottom": {
|
|
1058
1178
|
let t = e.x;
|
|
1059
|
-
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width),
|
|
1179
|
+
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), j({
|
|
1060
1180
|
x: t,
|
|
1061
1181
|
y: n.y,
|
|
1062
1182
|
width: n.width,
|
|
@@ -1066,7 +1186,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1066
1186
|
case "left":
|
|
1067
1187
|
case "right": {
|
|
1068
1188
|
let t = e.y;
|
|
1069
|
-
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height),
|
|
1189
|
+
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), j({
|
|
1070
1190
|
x: n.x,
|
|
1071
1191
|
y: t,
|
|
1072
1192
|
width: n.width,
|
|
@@ -1082,11 +1202,11 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1082
1202
|
enhance() {
|
|
1083
1203
|
super.enhance(), this.controller.flip = this.flip;
|
|
1084
1204
|
}
|
|
1085
|
-
},
|
|
1205
|
+
}, tt = (e, t) => new et(e, t), nt = {
|
|
1086
1206
|
moveKey: "Alt",
|
|
1087
1207
|
onMoved: null,
|
|
1088
1208
|
orientation: "vertical"
|
|
1089
|
-
},
|
|
1209
|
+
}, rt = {
|
|
1090
1210
|
vertical: {
|
|
1091
1211
|
back: "ArrowUp",
|
|
1092
1212
|
forward: "ArrowDown"
|
|
@@ -1095,11 +1215,11 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1095
1215
|
back: "ArrowLeft",
|
|
1096
1216
|
forward: "ArrowRight"
|
|
1097
1217
|
}
|
|
1098
|
-
},
|
|
1218
|
+
}, it = class extends P {
|
|
1099
1219
|
constructor(e, t = {}) {
|
|
1100
1220
|
super(e, t);
|
|
1101
|
-
let { moveKey: n, onMoved: r, orientation: i } = Object.assign({},
|
|
1102
|
-
this.moveKey = u[n] ? n :
|
|
1221
|
+
let { moveKey: n, onMoved: r, orientation: i } = Object.assign({}, nt, t);
|
|
1222
|
+
this.moveKey = u[n] ? n : nt.moveKey, this.onMoved = r, this.orientation = i, this.draggingItem = null, this.onKeydown = this.onKeydown.bind(this);
|
|
1103
1223
|
}
|
|
1104
1224
|
get items() {
|
|
1105
1225
|
return this.controller.itemTargets;
|
|
@@ -1117,7 +1237,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1117
1237
|
e.forEach((e) => this.detachItem(e));
|
|
1118
1238
|
}
|
|
1119
1239
|
resolveMoveKeys(e) {
|
|
1120
|
-
let { back: t, forward: n } =
|
|
1240
|
+
let { back: t, forward: n } = rt[this.orientation];
|
|
1121
1241
|
return this.orientation === "horizontal" && getComputedStyle(e).direction === "rtl" ? {
|
|
1122
1242
|
back: n,
|
|
1123
1243
|
forward: t
|
|
@@ -1156,9 +1276,9 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1156
1276
|
return this.draggingItem = null, this.dispatch("reordered", { detail: { itemIds: this.orderedIds() } }), n;
|
|
1157
1277
|
}
|
|
1158
1278
|
midpointOf(e) {
|
|
1159
|
-
return
|
|
1279
|
+
return he(e.getBoundingClientRect(), this.orientation);
|
|
1160
1280
|
}
|
|
1161
|
-
},
|
|
1281
|
+
}, at = (e, t) => new it(e, t), ot = {
|
|
1162
1282
|
events: ["resize"],
|
|
1163
1283
|
boundaries: [
|
|
1164
1284
|
"top",
|
|
@@ -1167,10 +1287,10 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1167
1287
|
],
|
|
1168
1288
|
onShifted: "shifted",
|
|
1169
1289
|
respectMotion: !0
|
|
1170
|
-
},
|
|
1290
|
+
}, st = class extends X {
|
|
1171
1291
|
constructor(e, t = {}) {
|
|
1172
1292
|
super(e, t);
|
|
1173
|
-
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({},
|
|
1293
|
+
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, ot, t);
|
|
1174
1294
|
this.onShifted = n, this.events = r, this.boundaries = i, this.respectMotion = a, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.enhance(), this.observe(this.shift);
|
|
1175
1295
|
}
|
|
1176
1296
|
shift = async () => {
|
|
@@ -1180,14 +1300,14 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1180
1300
|
this.element.style.transition = this.respectMotion && this.prefersReducedMotion ? "none" : "", this.element.style.transform = `translate(${t}px, ${n}px)`, await this.awaitCallback(this.onShifted, e), this.dispatch("shifted", { detail: e });
|
|
1181
1301
|
};
|
|
1182
1302
|
overflowRect(e, t) {
|
|
1183
|
-
let n = {}, r =
|
|
1303
|
+
let n = {}, r = M(), i = j({
|
|
1184
1304
|
x: e.x - t.x,
|
|
1185
1305
|
y: e.y - t.y,
|
|
1186
1306
|
width: e.width,
|
|
1187
1307
|
height: e.height
|
|
1188
1308
|
});
|
|
1189
1309
|
for (let e of this.boundaries) {
|
|
1190
|
-
let t = this.directionDistance(i, e, r), a =
|
|
1310
|
+
let t = this.directionDistance(i, e, r), a = me[e];
|
|
1191
1311
|
t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
|
|
1192
1312
|
}
|
|
1193
1313
|
return n;
|
|
@@ -1219,24 +1339,24 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1219
1339
|
enhance() {
|
|
1220
1340
|
super.enhance(), this.controller.shift = this.shift;
|
|
1221
1341
|
}
|
|
1222
|
-
},
|
|
1342
|
+
}, ct = (e, t) => new st(e, t), lt = {
|
|
1223
1343
|
visibility: "visibility",
|
|
1224
1344
|
onShown: "shown",
|
|
1225
1345
|
onHidden: "hidden"
|
|
1226
|
-
},
|
|
1346
|
+
}, ut = class extends P {
|
|
1227
1347
|
constructor(e, t = {}) {
|
|
1228
|
-
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({},
|
|
1348
|
+
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, lt, t), o = typeof n == "string" ? n : lt.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
|
|
1229
1349
|
(typeof t.visible != "boolean" || t.visible) && (t.visible = `${o}.${s}`), super(e, t), this.visibility = o, this.visibilityResolver = s, this.onShown = r, this.onHidden = i, this.activator = a instanceof HTMLElement ? a : null, this.enhance(), this.element instanceof HTMLElement && this.activate(this.isVisible(this.element));
|
|
1230
1350
|
}
|
|
1231
1351
|
isVisible(e) {
|
|
1232
1352
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1233
|
-
let t =
|
|
1353
|
+
let t = N.hiddenClass;
|
|
1234
1354
|
return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
|
|
1235
1355
|
}
|
|
1236
1356
|
toggle(e, t) {
|
|
1237
1357
|
if (!(e instanceof HTMLElement)) return;
|
|
1238
|
-
let n =
|
|
1239
|
-
n ? t ? e.classList.remove(n) : e.classList.add(n) :
|
|
1358
|
+
let n = N.hiddenClass;
|
|
1359
|
+
n ? t ? e.classList.remove(n) : e.classList.add(n) : b(e, !t);
|
|
1240
1360
|
}
|
|
1241
1361
|
activate(e) {
|
|
1242
1362
|
this.activator && _(this.activator, e);
|
|
@@ -1258,7 +1378,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1258
1378
|
return t;
|
|
1259
1379
|
} });
|
|
1260
1380
|
}
|
|
1261
|
-
}, Q = (e, t) => new
|
|
1381
|
+
}, Q = (e, t) => new ut(e, t), dt = 4, ft = class extends e {
|
|
1262
1382
|
static targets = ["grid"];
|
|
1263
1383
|
static values = {
|
|
1264
1384
|
current: Number,
|
|
@@ -1280,7 +1400,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1280
1400
|
}
|
|
1281
1401
|
};
|
|
1282
1402
|
initialize() {
|
|
1283
|
-
this.selector =
|
|
1403
|
+
this.selector = Je(this), J(this, {
|
|
1284
1404
|
today: this.todayValue,
|
|
1285
1405
|
year: this.currentValue || void 0,
|
|
1286
1406
|
since: this.sinceValue || null,
|
|
@@ -1300,7 +1420,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1300
1420
|
if (!this.hasGridTarget) return;
|
|
1301
1421
|
let e = K(this.selectedValue), t = e ? e.getFullYear() : null;
|
|
1302
1422
|
this.gridTarget.querySelectorAll("button[data-year]").forEach((e) => {
|
|
1303
|
-
|
|
1423
|
+
v(e, parseInt(e.dataset.year, 10) === t);
|
|
1304
1424
|
});
|
|
1305
1425
|
}
|
|
1306
1426
|
navigate(e) {
|
|
@@ -1320,21 +1440,21 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1320
1440
|
let { yearsOfDecade: e } = this.calendar, t = this.calendar.today.getFullYear(), n = K(this.selectedValue), r = n ? n.getFullYear() : null, i = [];
|
|
1321
1441
|
for (let n of e) {
|
|
1322
1442
|
let e = document.createElement("button");
|
|
1323
|
-
e.type = "button", e.textContent = n.value, e.dataset.year = n.value, e.setAttribute("role", "gridcell"),
|
|
1443
|
+
e.type = "button", e.textContent = n.value, e.dataset.year = n.value, e.setAttribute("role", "gridcell"), v(e, n.value === r), n.value === t && y(e, "year"), n.disabled && S(e, !0), i.push(e);
|
|
1324
1444
|
}
|
|
1325
1445
|
let a = document.createElement("div");
|
|
1326
1446
|
a.setAttribute("role", "rowgroup");
|
|
1327
|
-
for (let e = 0; e < i.length; e +=
|
|
1447
|
+
for (let e = 0; e < i.length; e += dt) {
|
|
1328
1448
|
let t = document.createElement("div");
|
|
1329
1449
|
t.setAttribute("role", "row");
|
|
1330
|
-
for (let n of i.slice(e, e +
|
|
1450
|
+
for (let n of i.slice(e, e + dt)) t.appendChild(n);
|
|
1331
1451
|
a.appendChild(t);
|
|
1332
1452
|
}
|
|
1333
1453
|
this.gridTarget.replaceChildren(a);
|
|
1334
1454
|
}
|
|
1335
|
-
},
|
|
1455
|
+
}, pt = class extends e {
|
|
1336
1456
|
initialize() {
|
|
1337
|
-
this.selector =
|
|
1457
|
+
this.selector = Je(this);
|
|
1338
1458
|
}
|
|
1339
1459
|
connect() {
|
|
1340
1460
|
this.selector.attach();
|
|
@@ -1342,7 +1462,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1342
1462
|
disconnect() {
|
|
1343
1463
|
this.selector.detach();
|
|
1344
1464
|
}
|
|
1345
|
-
},
|
|
1465
|
+
}, mt = class extends e {
|
|
1346
1466
|
static targets = ["daysOfWeek", "daysOfMonth"];
|
|
1347
1467
|
static classes = [
|
|
1348
1468
|
"dayOfWeek",
|
|
@@ -1387,7 +1507,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1387
1507
|
}
|
|
1388
1508
|
};
|
|
1389
1509
|
initialize() {
|
|
1390
|
-
this.selector =
|
|
1510
|
+
this.selector = Ke(this, { onSelect: "select" }), J(this, {
|
|
1391
1511
|
today: this.todayValue,
|
|
1392
1512
|
since: this.sinceValue || null,
|
|
1393
1513
|
till: this.tillValue || null
|
|
@@ -1412,14 +1532,14 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1412
1532
|
}
|
|
1413
1533
|
selectedValueChanged() {
|
|
1414
1534
|
if (!this.hasDaysOfMonthTarget || (this.daysOfMonthTarget.querySelectorAll("[aria-selected]").forEach((e) => {
|
|
1415
|
-
|
|
1535
|
+
v(e, !1);
|
|
1416
1536
|
}), !this.selectedValue)) return;
|
|
1417
1537
|
let e = K(this.selectedValue);
|
|
1418
1538
|
if (!e) return;
|
|
1419
1539
|
let t = this.daysOfMonthTarget.querySelector(`time[datetime="${e.toISOString()}"]`);
|
|
1420
1540
|
if (t) {
|
|
1421
1541
|
let e = t.closest("[aria-selected]");
|
|
1422
|
-
e &&
|
|
1542
|
+
e && v(e, !0);
|
|
1423
1543
|
}
|
|
1424
1544
|
}
|
|
1425
1545
|
navigate(e) {
|
|
@@ -1443,7 +1563,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1443
1563
|
}
|
|
1444
1564
|
createDayElement(e, { selectable: t = !1, disabled: n = !1 } = {}) {
|
|
1445
1565
|
let r = document.createElement(t ? "button" : "div");
|
|
1446
|
-
return r.tabIndex = -1, e ? r.textContent = e :
|
|
1566
|
+
return r.tabIndex = -1, e ? r.textContent = e : x(r, !0), n && (r instanceof HTMLButtonElement ? r.disabled = !0 : S(r, !0)), r;
|
|
1447
1567
|
}
|
|
1448
1568
|
drawDaysOfWeek() {
|
|
1449
1569
|
if (!this.hasDaysOfWeekTarget) return;
|
|
@@ -1463,7 +1583,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1463
1583
|
selectable: e.current || i,
|
|
1464
1584
|
disabled: e.current ? r : !i
|
|
1465
1585
|
});
|
|
1466
|
-
t === e.date.getTime() &&
|
|
1586
|
+
t === e.date.getTime() && y(o, "date"), (e.current || this.daysOfOtherMonthValue) && o.setAttribute("aria-selected", ""), !e.current && this.daysOfOtherMonthValue && this.hasDayOfOtherMonthClass ? o.classList.add(...this.dayOfOtherMonthClasses) : this.hasDayOfMonthClass && o.classList.add(...this.dayOfMonthClasses);
|
|
1467
1587
|
let s = document.createElement("time");
|
|
1468
1588
|
s.dateTime = e.iso, o.appendChild(s), n.push(o);
|
|
1469
1589
|
}
|
|
@@ -1476,9 +1596,9 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1476
1596
|
}
|
|
1477
1597
|
this.daysOfMonthTarget.replaceChildren(...r);
|
|
1478
1598
|
}
|
|
1479
|
-
},
|
|
1599
|
+
}, ht = class extends e {
|
|
1480
1600
|
initialize() {
|
|
1481
|
-
this.selector =
|
|
1601
|
+
this.selector = Ke(this);
|
|
1482
1602
|
}
|
|
1483
1603
|
connect() {
|
|
1484
1604
|
this.selector.attach();
|
|
@@ -1486,7 +1606,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1486
1606
|
disconnect() {
|
|
1487
1607
|
this.selector.detach();
|
|
1488
1608
|
}
|
|
1489
|
-
},
|
|
1609
|
+
}, gt = 4, _t = class extends e {
|
|
1490
1610
|
static targets = ["grid"];
|
|
1491
1611
|
static values = {
|
|
1492
1612
|
current: Number,
|
|
@@ -1516,7 +1636,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1516
1636
|
}
|
|
1517
1637
|
};
|
|
1518
1638
|
initialize() {
|
|
1519
|
-
this.selector =
|
|
1639
|
+
this.selector = qe(this), J(this, {
|
|
1520
1640
|
today: this.todayValue,
|
|
1521
1641
|
year: this.currentValue || void 0,
|
|
1522
1642
|
since: this.sinceValue || null,
|
|
@@ -1537,7 +1657,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1537
1657
|
let e = K(this.selectedValue);
|
|
1538
1658
|
this.gridTarget.querySelectorAll("button[data-month]").forEach((t) => {
|
|
1539
1659
|
let n = parseInt(t.dataset.month, 10) - 1;
|
|
1540
|
-
|
|
1660
|
+
v(t, !!e && e.getMonth() === n);
|
|
1541
1661
|
});
|
|
1542
1662
|
}
|
|
1543
1663
|
navigate(e) {
|
|
@@ -1557,21 +1677,21 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1557
1677
|
let { year: e, monthsOfYear: t } = this.calendar, n = this.calendar.today, r = K(this.selectedValue), i = [], a = new Intl.DateTimeFormat(this.localesValue, { month: this.monthFormatValue });
|
|
1558
1678
|
for (let o of t) {
|
|
1559
1679
|
let t = document.createElement("button");
|
|
1560
|
-
t.type = "button", t.textContent = a.format(o.date), t.dataset.month = o.value + 1, t.setAttribute("role", "gridcell"),
|
|
1680
|
+
t.type = "button", t.textContent = a.format(o.date), t.dataset.month = o.value + 1, t.setAttribute("role", "gridcell"), v(t, !!r && r.getMonth() === o.value), o.value === n.getMonth() && e === n.getFullYear() && y(t, "month"), o.disabled && S(t, !0), i.push(t);
|
|
1561
1681
|
}
|
|
1562
1682
|
let o = document.createElement("div");
|
|
1563
1683
|
o.setAttribute("role", "rowgroup");
|
|
1564
|
-
for (let e = 0; e < i.length; e +=
|
|
1684
|
+
for (let e = 0; e < i.length; e += gt) {
|
|
1565
1685
|
let t = document.createElement("div");
|
|
1566
1686
|
t.setAttribute("role", "row");
|
|
1567
|
-
for (let n of i.slice(e, e +
|
|
1687
|
+
for (let n of i.slice(e, e + gt)) t.appendChild(n);
|
|
1568
1688
|
o.appendChild(t);
|
|
1569
1689
|
}
|
|
1570
1690
|
this.gridTarget.replaceChildren(o);
|
|
1571
1691
|
}
|
|
1572
|
-
},
|
|
1692
|
+
}, vt = class extends e {
|
|
1573
1693
|
initialize() {
|
|
1574
|
-
this.selector =
|
|
1694
|
+
this.selector = qe(this);
|
|
1575
1695
|
}
|
|
1576
1696
|
connect() {
|
|
1577
1697
|
this.selector.attach();
|
|
@@ -1579,7 +1699,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1579
1699
|
disconnect() {
|
|
1580
1700
|
this.selector.detach();
|
|
1581
1701
|
}
|
|
1582
|
-
},
|
|
1702
|
+
}, yt = class extends e {
|
|
1583
1703
|
static targets = ["master", "item"];
|
|
1584
1704
|
connect() {
|
|
1585
1705
|
this.recompute();
|
|
@@ -1599,7 +1719,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1599
1719
|
enabledItems() {
|
|
1600
1720
|
return this.itemTargets.filter((e) => !e.disabled);
|
|
1601
1721
|
}
|
|
1602
|
-
},
|
|
1722
|
+
}, bt = class extends e {
|
|
1603
1723
|
static targets = ["source"];
|
|
1604
1724
|
static values = { contentType: {
|
|
1605
1725
|
type: String,
|
|
@@ -1633,7 +1753,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1633
1753
|
"month",
|
|
1634
1754
|
"year",
|
|
1635
1755
|
"decade"
|
|
1636
|
-
],
|
|
1756
|
+
], xt = class extends e {
|
|
1637
1757
|
static targets = [
|
|
1638
1758
|
"previous",
|
|
1639
1759
|
"next",
|
|
@@ -1770,7 +1890,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1770
1890
|
}
|
|
1771
1891
|
this.hasCalendarYearOutlet && (this.calendarYearOutletElement.hidden = !t), this.hasCalendarDecadeOutlet && (this.calendarDecadeOutletElement.hidden = !n);
|
|
1772
1892
|
}
|
|
1773
|
-
},
|
|
1893
|
+
}, St = class extends e {
|
|
1774
1894
|
static targets = [
|
|
1775
1895
|
"listbox",
|
|
1776
1896
|
"loading",
|
|
@@ -1791,7 +1911,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1791
1911
|
}
|
|
1792
1912
|
};
|
|
1793
1913
|
initialize() {
|
|
1794
|
-
this._requestor = new
|
|
1914
|
+
this._requestor = new A();
|
|
1795
1915
|
}
|
|
1796
1916
|
connect() {
|
|
1797
1917
|
this.hasListboxTarget && (this.listboxNav = new f(this.listboxTarget));
|
|
@@ -1801,13 +1921,13 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1801
1921
|
}
|
|
1802
1922
|
onSelect(e) {
|
|
1803
1923
|
let t = e.target.closest("[role=\"option\"]");
|
|
1804
|
-
!t ||
|
|
1924
|
+
!t || C(t) || this.select(t.dataset.value ?? "");
|
|
1805
1925
|
}
|
|
1806
1926
|
select(e) {
|
|
1807
1927
|
let t = this.listboxTarget.querySelectorAll("[role=\"option\"]");
|
|
1808
|
-
t.forEach((e) =>
|
|
1928
|
+
t.forEach((e) => v(e, !1));
|
|
1809
1929
|
let n = [...t].find((t) => t.dataset.value === e);
|
|
1810
|
-
n &&
|
|
1930
|
+
n && v(n, !0), this.dispatch("selected", {
|
|
1811
1931
|
detail: { value: e },
|
|
1812
1932
|
bubbles: !0
|
|
1813
1933
|
});
|
|
@@ -1824,7 +1944,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1824
1944
|
e.name !== "AbortError" && console.error("[combobox-dropdown] fetch failed", e);
|
|
1825
1945
|
}).finally(() => this.setLoading(!1)), this.delayValue);
|
|
1826
1946
|
} else {
|
|
1827
|
-
let t =
|
|
1947
|
+
let t = pe(this.listboxTarget, e);
|
|
1828
1948
|
this.setEmpty(t === 0);
|
|
1829
1949
|
}
|
|
1830
1950
|
}
|
|
@@ -1837,7 +1957,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1837
1957
|
setEmpty(e) {
|
|
1838
1958
|
this.hasEmptyTarget && (this.emptyTarget.hidden = !e);
|
|
1839
1959
|
}
|
|
1840
|
-
},
|
|
1960
|
+
}, Ct = class extends e {
|
|
1841
1961
|
static targets = [
|
|
1842
1962
|
"hour",
|
|
1843
1963
|
"minute",
|
|
@@ -1848,7 +1968,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1848
1968
|
}
|
|
1849
1969
|
onSelect(e) {
|
|
1850
1970
|
let t = e.target.closest("[role=\"option\"]");
|
|
1851
|
-
t && (t.closest("[role=\"listbox\"]").querySelectorAll("[role=\"option\"]").forEach((e) =>
|
|
1971
|
+
t && (t.closest("[role=\"listbox\"]").querySelectorAll("[role=\"option\"]").forEach((e) => v(e, !1)), v(t, !0), this.select(this.toH24()));
|
|
1852
1972
|
}
|
|
1853
1973
|
select(e) {
|
|
1854
1974
|
e && this.dispatch("selected", {
|
|
@@ -1861,7 +1981,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1861
1981
|
}
|
|
1862
1982
|
step(e, t) {
|
|
1863
1983
|
let n = [...e.querySelectorAll("[role=\"option\"]")], r = e.querySelector("[aria-selected=\"true\"]"), i = n.indexOf(r), a = t > 0 ? n[Math.min(i + 1, n.length - 1)] : n[Math.max(i - 1, 0)];
|
|
1864
|
-
!a || a === r || (n.forEach((e) =>
|
|
1984
|
+
!a || a === r || (n.forEach((e) => v(e, !1)), v(a, !0), a.scrollIntoView({ block: "nearest" }), this.select(this.toH24()));
|
|
1865
1985
|
}
|
|
1866
1986
|
toH24() {
|
|
1867
1987
|
let e = this.selectedValue(this.hourTarget), t = this.selectedValue(this.minuteTarget);
|
|
@@ -1873,12 +1993,12 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1873
1993
|
selectedValue(e) {
|
|
1874
1994
|
return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
|
|
1875
1995
|
}
|
|
1876
|
-
},
|
|
1996
|
+
}, wt = class extends e {
|
|
1877
1997
|
static targets = ["trigger"];
|
|
1878
1998
|
connect() {
|
|
1879
1999
|
Z(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
|
|
1880
2000
|
}
|
|
1881
|
-
},
|
|
2001
|
+
}, Tt = class extends e {
|
|
1882
2002
|
static targets = ["anchor", "reference"];
|
|
1883
2003
|
static values = {
|
|
1884
2004
|
placement: {
|
|
@@ -1903,7 +2023,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1903
2023
|
console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
|
|
1904
2024
|
return;
|
|
1905
2025
|
}
|
|
1906
|
-
|
|
2026
|
+
tt(this, {
|
|
1907
2027
|
element: this.referenceTarget,
|
|
1908
2028
|
anchor: this.anchorTarget,
|
|
1909
2029
|
placement: this.placementValue,
|
|
@@ -1911,7 +2031,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1911
2031
|
ariaRole: this.roleValue
|
|
1912
2032
|
});
|
|
1913
2033
|
}
|
|
1914
|
-
},
|
|
2034
|
+
}, Et = class extends e {
|
|
1915
2035
|
static targets = ["trigger", "input"];
|
|
1916
2036
|
static values = {
|
|
1917
2037
|
value: String,
|
|
@@ -1936,8 +2056,12 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1936
2056
|
valueValueChanged(e) {
|
|
1937
2057
|
this.hasInputTarget && (this.inputTarget.value = e), this.dispatch("changed", { detail: { value: e } });
|
|
1938
2058
|
}
|
|
1939
|
-
},
|
|
1940
|
-
static targets = [
|
|
2059
|
+
}, Dt = class extends e {
|
|
2060
|
+
static targets = [
|
|
2061
|
+
"input",
|
|
2062
|
+
"toggle",
|
|
2063
|
+
"cell"
|
|
2064
|
+
];
|
|
1941
2065
|
static values = {
|
|
1942
2066
|
format: {
|
|
1943
2067
|
type: String,
|
|
@@ -1950,32 +2074,42 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1950
2074
|
revealed: {
|
|
1951
2075
|
type: Boolean,
|
|
1952
2076
|
default: !1
|
|
2077
|
+
},
|
|
2078
|
+
groups: {
|
|
2079
|
+
type: Array,
|
|
2080
|
+
default: []
|
|
1953
2081
|
}
|
|
1954
2082
|
};
|
|
1955
2083
|
connect() {
|
|
1956
|
-
|
|
2084
|
+
U(this, {
|
|
1957
2085
|
type: this.formatValue,
|
|
1958
2086
|
options: this.optionsValue
|
|
1959
|
-
}), this.format(this.readValue()), this.drawToggle();
|
|
2087
|
+
}), this.attachCells(), this.primeFilledState(), this.format(this.readValue()), this.drawToggle();
|
|
1960
2088
|
}
|
|
1961
2089
|
formatValueChanged() {
|
|
1962
|
-
this.formatter && (
|
|
2090
|
+
this.formatter && (U(this, {
|
|
1963
2091
|
type: this.formatValue,
|
|
1964
2092
|
options: this.optionsValue
|
|
1965
|
-
}), this.format(this.readValue()), this.drawToggle());
|
|
2093
|
+
}), this.attachCells(), this.primeFilledState(), this.format(this.readValue()), this.drawToggle());
|
|
1966
2094
|
}
|
|
1967
2095
|
optionsValueChanged() {
|
|
1968
|
-
this.formatter && (
|
|
2096
|
+
this.formatter && (U(this, {
|
|
1969
2097
|
type: this.formatValue,
|
|
1970
2098
|
options: this.optionsValue
|
|
1971
|
-
}), this.format(this.readValue()));
|
|
2099
|
+
}), this.attachCells(), this.primeFilledState(), this.format(this.readValue()));
|
|
1972
2100
|
}
|
|
1973
2101
|
revealedValueChanged() {
|
|
1974
2102
|
this.formatter && (this.format(this.readValue()), this.drawToggle());
|
|
1975
2103
|
}
|
|
2104
|
+
groupsValueChanged() {
|
|
2105
|
+
this.formatter && (this.attachCells(), this.format(this.readValue()));
|
|
2106
|
+
}
|
|
1976
2107
|
onChange(e) {
|
|
1977
2108
|
this.format(e?.detail?.value ?? "");
|
|
1978
2109
|
}
|
|
2110
|
+
cellTargetConnected() {
|
|
2111
|
+
this.formatter && (this.attachCells(), this.drawCells(this.cellsValue(this.formatter.normalize(this.readValue()))));
|
|
2112
|
+
}
|
|
1979
2113
|
format(e) {
|
|
1980
2114
|
this.formatter && this.onFormatting(e);
|
|
1981
2115
|
}
|
|
@@ -1988,10 +2122,45 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
1988
2122
|
let n = this.formatter.normalize(t);
|
|
1989
2123
|
this.formatter.validate(n) && this.format(n);
|
|
1990
2124
|
}
|
|
2125
|
+
attachCells() {
|
|
2126
|
+
if (!this.hasCellTarget) return;
|
|
2127
|
+
let e = this.formatter.cells();
|
|
2128
|
+
if (!e) {
|
|
2129
|
+
this.detachCells();
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
let t = this.groupsValue.length > 0;
|
|
2133
|
+
Le(this, {
|
|
2134
|
+
groups: t ? this.groupsValue : e.groups ?? [],
|
|
2135
|
+
length: t ? 0 : e.length ?? 0
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
detachCells() {
|
|
2139
|
+
this.hasCellTarget && (this.cellTargets.forEach((e) => {
|
|
2140
|
+
e.textContent = "", e.removeAttribute("data-filled"), e.removeAttribute("data-caret");
|
|
2141
|
+
}), delete this.characterCells);
|
|
2142
|
+
}
|
|
2143
|
+
onInput() {
|
|
2144
|
+
this.format(this.readValue());
|
|
2145
|
+
}
|
|
2146
|
+
onFocus() {
|
|
2147
|
+
this.drawCells(this.cellsValue(this.formatter?.normalize(this.readValue()) ?? ""));
|
|
2148
|
+
}
|
|
2149
|
+
onBlur() {
|
|
2150
|
+
this.drawCells(this.cellsValue(this.formatter?.normalize(this.readValue()) ?? ""));
|
|
2151
|
+
}
|
|
2152
|
+
cellsValue(e) {
|
|
2153
|
+
return !this.formatter || this.revealedValue || !this.formatter.maskable() ? e : this.formatter.mask(e);
|
|
2154
|
+
}
|
|
2155
|
+
drawCells(e) {
|
|
2156
|
+
if (!this.hasCellTarget) return;
|
|
2157
|
+
let t = this.hasInputTarget && document.activeElement === this.inputTarget;
|
|
2158
|
+
this.characterCells?.draw(e, { focused: t });
|
|
2159
|
+
}
|
|
1991
2160
|
drawToggle() {
|
|
1992
2161
|
if (!this.hasToggleTarget) return;
|
|
1993
2162
|
let e = this.formatter?.maskable() || this.formatValue === "password";
|
|
1994
|
-
this.toggleTarget.hidden = !e, e &&
|
|
2163
|
+
this.toggleTarget.hidden = !e, e && ne(this.toggleTarget, this.revealedValue);
|
|
1995
2164
|
}
|
|
1996
2165
|
readValue() {
|
|
1997
2166
|
return this.hasInputTarget ? this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value : this.inputTarget.textContent : "";
|
|
@@ -2003,9 +2172,18 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2003
2172
|
return;
|
|
2004
2173
|
}
|
|
2005
2174
|
let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
|
|
2006
|
-
this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
|
|
2175
|
+
this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } }), this.drawCells(this.cellsValue(t));
|
|
2176
|
+
let r = this.isFull(t);
|
|
2177
|
+
r && !this.wasFull && this.dispatch("filled", { detail: { value: t } }), this.wasFull = r;
|
|
2007
2178
|
}
|
|
2008
|
-
|
|
2179
|
+
isFull(e) {
|
|
2180
|
+
let t = this.characterCells?.active() ?? this.formatter?.cells()?.length ?? 0;
|
|
2181
|
+
return t > 0 && e.length === t && this.formatter.validate(e);
|
|
2182
|
+
}
|
|
2183
|
+
primeFilledState() {
|
|
2184
|
+
this.wasFull = this.isFull(this.formatter.normalize(this.readValue()));
|
|
2185
|
+
}
|
|
2186
|
+
}, Ot = class extends e {
|
|
2009
2187
|
static targets = ["input", "clear"];
|
|
2010
2188
|
initialize() {
|
|
2011
2189
|
this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
|
|
@@ -2028,7 +2206,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2028
2206
|
handleEscape(e) {
|
|
2029
2207
|
e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
|
|
2030
2208
|
}
|
|
2031
|
-
},
|
|
2209
|
+
}, kt = class extends e {
|
|
2032
2210
|
static targets = ["modal", "overlay"];
|
|
2033
2211
|
initialize() {
|
|
2034
2212
|
this.onCancel = this.close.bind(this);
|
|
@@ -2074,12 +2252,12 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2074
2252
|
let t = this.modalTarget.getBoundingClientRect();
|
|
2075
2253
|
(e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
|
|
2076
2254
|
};
|
|
2077
|
-
},
|
|
2255
|
+
}, At = class extends e {
|
|
2078
2256
|
static targets = ["content"];
|
|
2079
2257
|
connect() {
|
|
2080
|
-
|
|
2258
|
+
ct(this, { element: this.hasContentTarget ? this.contentTarget : null });
|
|
2081
2259
|
}
|
|
2082
|
-
},
|
|
2260
|
+
}, jt = class extends e {
|
|
2083
2261
|
static targets = [
|
|
2084
2262
|
"trigger",
|
|
2085
2263
|
"panel",
|
|
@@ -2111,7 +2289,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2111
2289
|
}
|
|
2112
2290
|
};
|
|
2113
2291
|
connect() {
|
|
2114
|
-
|
|
2292
|
+
Xe(this, {
|
|
2115
2293
|
element: this.hasPanelTarget ? this.panelTarget : null,
|
|
2116
2294
|
url: this.hasUrlValue ? this.urlValue : null
|
|
2117
2295
|
}), this.hasPanelTarget && (Q(this, {
|
|
@@ -2162,7 +2340,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2162
2340
|
contentLoader() {
|
|
2163
2341
|
if (this.hasTemplateTarget) return this.templateTarget instanceof HTMLTemplateElement ? this.templateTarget.content : this.templateTarget.innerHTML;
|
|
2164
2342
|
}
|
|
2165
|
-
},
|
|
2343
|
+
}, Mt = class extends e {
|
|
2166
2344
|
static targets = ["fill", "meter"];
|
|
2167
2345
|
static values = {
|
|
2168
2346
|
variant: {
|
|
@@ -2213,7 +2391,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2213
2391
|
switch (this.variantValue) {
|
|
2214
2392
|
case "meter": return this.renderMeter();
|
|
2215
2393
|
case "ring":
|
|
2216
|
-
case "bar": return
|
|
2394
|
+
case "bar": return T(this.element, this.minValue), E(this.element, this.maxValue), D(this.element, this.indeterminateValue ? null : this.currentValue), this.element.classList.toggle("sp-progress-indeterminate", this.indeterminateValue), this.variantValue === "ring" ? this.renderRing() : this.renderBar();
|
|
2217
2395
|
default: return;
|
|
2218
2396
|
}
|
|
2219
2397
|
}
|
|
@@ -2249,7 +2427,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2249
2427
|
let e = this.meterTarget;
|
|
2250
2428
|
e.value = this.currentValue, e.min = this.minValue, e.max = this.maxValue, this.hasLowValue && (e.low = this.lowValue), this.hasHighValue && (e.high = this.highValue), this.hasOptimumValue && (e.optimum = this.optimumValue);
|
|
2251
2429
|
}
|
|
2252
|
-
},
|
|
2430
|
+
}, Nt = class extends e {
|
|
2253
2431
|
static targets = [
|
|
2254
2432
|
"item",
|
|
2255
2433
|
"handle",
|
|
@@ -2270,7 +2448,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2270
2448
|
}
|
|
2271
2449
|
};
|
|
2272
2450
|
connect() {
|
|
2273
|
-
this.reorderable =
|
|
2451
|
+
this.reorderable = at(this, {
|
|
2274
2452
|
moveKey: this.moveKeyValue,
|
|
2275
2453
|
orientation: this.orientationValue,
|
|
2276
2454
|
onMoved: "moved"
|
|
@@ -2286,7 +2464,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2286
2464
|
this.reorderable?.detachItem(e), this.rovingTabIndex?.updateItems(this.itemTargets);
|
|
2287
2465
|
}
|
|
2288
2466
|
editingValueChanged(e) {
|
|
2289
|
-
this.triggerTargets.forEach((t) =>
|
|
2467
|
+
this.triggerTargets.forEach((t) => w(t, e));
|
|
2290
2468
|
}
|
|
2291
2469
|
toggleEditing() {
|
|
2292
2470
|
this.editingValue = !this.editingValue;
|
|
@@ -2311,7 +2489,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2311
2489
|
moved(e) {
|
|
2312
2490
|
this.rovingTabIndex?.updateItems(this.itemTargets), this.rovingTabIndex.setCurrentIndex(this.itemTargets.indexOf(e));
|
|
2313
2491
|
}
|
|
2314
|
-
},
|
|
2492
|
+
}, Pt = class extends e {
|
|
2315
2493
|
static targets = [
|
|
2316
2494
|
"trigger",
|
|
2317
2495
|
"detail",
|
|
@@ -2329,7 +2507,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2329
2507
|
}
|
|
2330
2508
|
toggle(e) {
|
|
2331
2509
|
let t = e.currentTarget;
|
|
2332
|
-
|
|
2510
|
+
te(t) ? this.collapseItem(t) : this.expandItem(t);
|
|
2333
2511
|
}
|
|
2334
2512
|
expand(e) {
|
|
2335
2513
|
this.expandItem(e.currentTarget);
|
|
@@ -2342,7 +2520,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2342
2520
|
this.dispatch("expand", { detail: {
|
|
2343
2521
|
trigger: e,
|
|
2344
2522
|
detail: t
|
|
2345
|
-
} }), _(e, !0), t && (
|
|
2523
|
+
} }), _(e, !0), t && (b(t, !1), m(`${e.textContent.trim()} expanded`)), this.dispatch("expanded", { detail: {
|
|
2346
2524
|
trigger: e,
|
|
2347
2525
|
detail: t
|
|
2348
2526
|
} });
|
|
@@ -2352,7 +2530,7 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2352
2530
|
this.dispatch("collapse", { detail: {
|
|
2353
2531
|
trigger: e,
|
|
2354
2532
|
detail: t
|
|
2355
|
-
} }), _(e, !1), t && (
|
|
2533
|
+
} }), _(e, !1), t && (b(t, !0), m(`${e.textContent.trim()} collapsed`)), this.dispatch("collapsed", { detail: {
|
|
2356
2534
|
trigger: e,
|
|
2357
2535
|
detail: t
|
|
2358
2536
|
} });
|
|
@@ -2368,13 +2546,13 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2368
2546
|
let t = R.format(e.getAttribute("datetime"), this.dateFormatValue);
|
|
2369
2547
|
t && (e.textContent = t);
|
|
2370
2548
|
}
|
|
2371
|
-
},
|
|
2549
|
+
}, Ft = class extends e {
|
|
2372
2550
|
static targets = ["content"];
|
|
2373
2551
|
connect() {
|
|
2374
2552
|
Z(this);
|
|
2375
2553
|
}
|
|
2376
2554
|
contentTargetConnected(e) {
|
|
2377
|
-
|
|
2555
|
+
ct(this, { element: e }), Q(this, { element: e });
|
|
2378
2556
|
}
|
|
2379
2557
|
async dismissed() {
|
|
2380
2558
|
this.hasContentTarget && await this.visibility.hide();
|
|
@@ -2384,6 +2562,6 @@ var Ne = 7, Pe = 12, q = 10, Fe = {
|
|
|
2384
2562
|
}
|
|
2385
2563
|
};
|
|
2386
2564
|
//#endregion
|
|
2387
|
-
export {
|
|
2565
|
+
export { O as ARIA_HASPOPUP_VALUES, ft as CalendarDecadeController, pt as CalendarDecadeSelectorController, mt as CalendarMonthController, ht as CalendarMonthSelectorController, _t as CalendarYearController, vt as CalendarYearSelectorController, Ie as CharacterCells, yt as ChecklistController, bt as ClipboardController, xt as ComboboxDateController, St as ComboboxDropdownController, Ct as ComboboxTimeController, wt as DismisserController, t as FOCUSABLE_SELECTOR, V as FORMATTER_TYPES, Tt as FlipperController, a as FocusTrap, Pe as Formatter, Ot as InputClearableController, Et as InputComboboxController, Dt as InputFormatterController, f as ListboxNavigation, u as MODIFIER_KEYS, kt as ModalController, At as PannerController, jt as PopoverController, Mt as ProgressController, Nt as ReorderableController, A as Requestor, d as RovingTabIndex, Pt as TimelineController, Ft as VisibilityController, m as announce, Le as attachCharacterCells, ae as connectTriggerToTarget, se as disconnectTriggerFromTarget, ee as ensureId, pe as filterOptions, i as focusFirst, ce as fuzzyMatcher, h as generateId, n as getFocusableElements, s as isActivationKey, C as isAriaDisabled, c as isArrowKey, te as isExpanded, o as isKey, r as isVisible, l as preventDefault, S as setAriaDisabled, x as setAriaHidden, g as setAriaState, re as setChecked, y as setCurrent, w as setDisabled, _ as setExpanded, b as setHidden, ne as setPressed, v as setSelected, E as setValueMax, T as setValueMin, D as setValueNow };
|
|
2388
2566
|
|
|
2389
2567
|
//# sourceMappingURL=index.es.js.map
|