stimulus_plumbers 0.3.2 → 0.4.0
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 +72 -0
- data/README.md +3 -1
- data/app/assets/javascripts/stimulus-plumbers/controllers.manifest.json +273 -0
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +269 -160
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -1
- data/app/assets/stylesheets/stimulus_plumbers/tokens.css +56 -13
- data/config/locales/en.yml +10 -0
- data/lib/stimulus_plumbers/components/avatar.rb +24 -17
- data/lib/stimulus_plumbers/components/button/group.rb +15 -4
- data/lib/stimulus_plumbers/components/button/slots.rb +11 -0
- data/lib/stimulus_plumbers/components/button.rb +45 -11
- data/lib/stimulus_plumbers/components/calendar/turbo/days_of_month.rb +151 -0
- data/lib/stimulus_plumbers/components/calendar/turbo/days_of_week.rb +62 -0
- data/lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb +99 -0
- data/lib/stimulus_plumbers/components/calendar/turbo/years_of_decade.rb +86 -0
- data/lib/stimulus_plumbers/components/calendar/turbo.rb +65 -0
- data/lib/stimulus_plumbers/components/calendar.rb +70 -26
- data/lib/stimulus_plumbers/components/card/slots.rb +26 -0
- data/lib/stimulus_plumbers/components/card.rb +56 -10
- data/lib/stimulus_plumbers/components/combobox/builder.rb +45 -0
- data/lib/stimulus_plumbers/components/combobox/date/navigation.rb +72 -0
- data/lib/stimulus_plumbers/components/combobox/date/navigator.rb +25 -0
- data/lib/stimulus_plumbers/components/combobox/date.rb +37 -23
- data/lib/stimulus_plumbers/components/combobox/dropdown.rb +30 -21
- data/lib/stimulus_plumbers/components/combobox/options/option.rb +8 -2
- data/lib/stimulus_plumbers/components/combobox/options/option_group.rb +8 -2
- data/lib/stimulus_plumbers/components/combobox/options.rb +9 -5
- data/lib/stimulus_plumbers/components/combobox/time/drum.rb +8 -2
- data/lib/stimulus_plumbers/components/combobox/time.rb +50 -47
- data/lib/stimulus_plumbers/components/combobox/trigger.rb +62 -14
- data/lib/stimulus_plumbers/components/combobox/typeahead.rb +96 -0
- data/lib/stimulus_plumbers/components/combobox.rb +62 -38
- data/lib/stimulus_plumbers/components/divider.rb +25 -4
- data/lib/stimulus_plumbers/components/icon.rb +11 -17
- data/lib/stimulus_plumbers/components/input_group.rb +29 -0
- data/lib/stimulus_plumbers/components/link/slots.rb +11 -0
- data/lib/stimulus_plumbers/components/link.rb +63 -0
- data/lib/stimulus_plumbers/components/list/item/slots.rb +13 -0
- data/lib/stimulus_plumbers/components/list/item.rb +83 -0
- data/lib/stimulus_plumbers/components/list/section.rb +73 -0
- data/lib/stimulus_plumbers/components/list.rb +31 -0
- data/lib/stimulus_plumbers/components/popover/panel.rb +32 -0
- data/lib/stimulus_plumbers/components/popover/trigger.rb +27 -0
- data/lib/stimulus_plumbers/components/popover.rb +44 -14
- data/lib/stimulus_plumbers/engine.rb +1 -0
- data/lib/stimulus_plumbers/form/base.rb +103 -0
- data/lib/stimulus_plumbers/form/builder.rb +71 -24
- data/lib/stimulus_plumbers/form/field.rb +56 -88
- data/lib/stimulus_plumbers/form/fields/error.rb +1 -1
- data/lib/stimulus_plumbers/form/fields/fieldset.rb +11 -8
- data/lib/stimulus_plumbers/form/fields/hint.rb +1 -1
- data/lib/stimulus_plumbers/form/fields/inputs/checkbox.rb +115 -0
- data/lib/stimulus_plumbers/form/fields/inputs/combobox.rb +24 -0
- data/lib/stimulus_plumbers/form/fields/inputs/datetime.rb +42 -48
- data/lib/stimulus_plumbers/form/fields/inputs/file.rb +9 -8
- data/lib/stimulus_plumbers/form/fields/inputs/password.rb +32 -25
- data/lib/stimulus_plumbers/form/fields/inputs/radio.rb +60 -0
- data/lib/stimulus_plumbers/form/fields/inputs/search.rb +34 -57
- data/lib/stimulus_plumbers/form/fields/inputs/select/grouped.rb +22 -29
- data/lib/stimulus_plumbers/form/fields/inputs/select/timezone.rb +3 -44
- data/lib/stimulus_plumbers/form/fields/inputs/select/weekday.rb +3 -28
- data/lib/stimulus_plumbers/form/fields/inputs/select.rb +62 -49
- data/lib/stimulus_plumbers/form/fields/inputs/submit.rb +10 -7
- data/lib/stimulus_plumbers/form/fields/inputs/text.rb +29 -22
- data/lib/stimulus_plumbers/form/fields/inputs/text_area.rb +9 -8
- data/lib/stimulus_plumbers/form/fields/label/floating.rb +41 -0
- data/lib/stimulus_plumbers/form/fields/label.rb +9 -3
- data/lib/stimulus_plumbers/form/fields/renderer.rb +39 -0
- data/lib/stimulus_plumbers/helpers/avatar_helper.rb +2 -2
- data/lib/stimulus_plumbers/helpers/button_helper.rb +4 -8
- data/lib/stimulus_plumbers/helpers/calendar_helper.rb +14 -11
- data/lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb +49 -11
- data/lib/stimulus_plumbers/helpers/card_helper.rb +2 -12
- data/lib/stimulus_plumbers/helpers/combobox_helper.rb +27 -47
- data/lib/stimulus_plumbers/helpers/divider_helper.rb +2 -2
- data/lib/stimulus_plumbers/helpers/icon_helper.rb +11 -0
- data/lib/stimulus_plumbers/helpers/link_helper.rb +11 -0
- data/lib/stimulus_plumbers/helpers/list_helper.rb +11 -0
- data/lib/stimulus_plumbers/helpers/plumber_helper.rb +3 -6
- data/lib/stimulus_plumbers/helpers/popover_helper.rb +2 -2
- data/lib/stimulus_plumbers/helpers.rb +6 -2
- data/lib/stimulus_plumbers/logger.rb +4 -3
- data/lib/stimulus_plumbers/plumber/base.rb +6 -1
- data/lib/stimulus_plumbers/plumber/dispatcher/klass_proxy.rb +4 -3
- data/lib/stimulus_plumbers/plumber/dispatcher/method_call.rb +4 -3
- data/lib/stimulus_plumbers/plumber/dispatcher.rb +4 -4
- data/lib/stimulus_plumbers/plumber/options/aria.rb +17 -0
- data/lib/stimulus_plumbers/plumber/options/html.rb +29 -0
- data/lib/stimulus_plumbers/plumber/options/stimulus.rb +29 -0
- data/lib/stimulus_plumbers/plumber/options/theme.rb +19 -0
- data/lib/stimulus_plumbers/plumber/options/token_list.rb +29 -0
- data/lib/stimulus_plumbers/plumber/renderer.rb +136 -41
- data/lib/stimulus_plumbers/plumber/slots.rb +74 -0
- data/lib/stimulus_plumbers/themes/base.rb +20 -23
- data/lib/stimulus_plumbers/themes/icons/external.rb +60 -0
- data/lib/stimulus_plumbers/themes/icons/registry.rb +36 -0
- data/lib/stimulus_plumbers/themes/schema/avatar/ranges.rb +13 -0
- data/lib/stimulus_plumbers/themes/schema/button/ranges.rb +16 -0
- data/lib/stimulus_plumbers/themes/schema/card/ranges.rb +13 -0
- data/lib/stimulus_plumbers/themes/schema/form/checkbox/ranges.rb +16 -0
- data/lib/stimulus_plumbers/themes/schema/form/radio/ranges.rb +16 -0
- data/lib/stimulus_plumbers/themes/schema/form/ranges.rb +1 -2
- data/lib/stimulus_plumbers/themes/schema/icon.rb +57 -15
- data/lib/stimulus_plumbers/themes/schema/link/ranges.rb +14 -0
- data/lib/stimulus_plumbers/themes/schema/ranges.rb +1 -5
- data/lib/stimulus_plumbers/themes/schema.rb +142 -67
- data/lib/stimulus_plumbers/version.rb +1 -1
- data/lib/stimulus_plumbers.rb +22 -17
- metadata +46 -17
- data/lib/stimulus_plumbers/components/action_list/item.rb +0 -27
- data/lib/stimulus_plumbers/components/action_list/section.rb +0 -22
- data/lib/stimulus_plumbers/components/action_list.rb +0 -23
- data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb +0 -145
- data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_week.rb +0 -39
- data/lib/stimulus_plumbers/components/calendar/month/turbo.rb +0 -55
- data/lib/stimulus_plumbers/components/card/section.rb +0 -25
- data/lib/stimulus_plumbers/components/combobox/autocomplete.rb +0 -47
- data/lib/stimulus_plumbers/components/combobox/popover.rb +0 -24
- data/lib/stimulus_plumbers/components/date_picker/navigation.rb +0 -41
- data/lib/stimulus_plumbers/components/date_picker/navigator.rb +0 -31
- data/lib/stimulus_plumbers/components/popover/builder.rb +0 -25
- data/lib/stimulus_plumbers/form/fields/input_group.rb +0 -25
- data/lib/stimulus_plumbers/form/fields/inputs/choice.rb +0 -69
- data/lib/stimulus_plumbers/helpers/action_list_helper.rb +0 -25
- data/lib/stimulus_plumbers/plumber/html_options.rb +0 -52
|
@@ -354,7 +354,7 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
354
354
|
}
|
|
355
355
|
return e;
|
|
356
356
|
}
|
|
357
|
-
}, _e = /[^\d.,-]/g,
|
|
357
|
+
}, _e = /[^\d.,-]/g, ve = /^-?\d+(\.\d+)?$/, P = {
|
|
358
358
|
normalize(e) {
|
|
359
359
|
if (typeof e != "string") return "";
|
|
360
360
|
let t = e.replace(_e, "");
|
|
@@ -363,7 +363,7 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
363
363
|
return n > -1 && r > -1 ? n > r ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "") : n > -1 ? t.slice(n + 1).length <= 2 ? t.replace(",", ".") : t.replace(/,/g, "") : t;
|
|
364
364
|
},
|
|
365
365
|
validate(e) {
|
|
366
|
-
return typeof e == "string" ?
|
|
366
|
+
return typeof e == "string" ? ve.test(e) : !1;
|
|
367
367
|
},
|
|
368
368
|
format(e, t = {}) {
|
|
369
369
|
if (typeof e != "string") return "";
|
|
@@ -383,18 +383,18 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, F = /^\d{4}-\d{2}-\d{2}$/, ye = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, be = /\D/g, I = {
|
|
387
387
|
normalize(e) {
|
|
388
388
|
if (typeof e != "string") return "";
|
|
389
389
|
let t = e.trim();
|
|
390
|
-
if (
|
|
391
|
-
let n = t.match(
|
|
390
|
+
if (F.test(t)) return t;
|
|
391
|
+
let n = t.match(ye);
|
|
392
392
|
if (n) {
|
|
393
393
|
let [, e, t, r] = n;
|
|
394
394
|
if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
|
|
395
395
|
if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
|
|
396
396
|
}
|
|
397
|
-
let r = t.replace(
|
|
397
|
+
let r = t.replace(be, "");
|
|
398
398
|
if (r.length === 8) {
|
|
399
399
|
let e = parseInt(r.slice(0, 4), 10);
|
|
400
400
|
return e >= 1e3 && e <= 9999 ? `${r.slice(0, 4)}-${r.slice(4, 6)}-${r.slice(6, 8)}` : `${r.slice(4, 8)}-${r.slice(0, 2)}-${r.slice(2, 4)}`;
|
|
@@ -403,8 +403,8 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
403
403
|
},
|
|
404
404
|
validate(e) {
|
|
405
405
|
if (typeof e != "string") return !1;
|
|
406
|
-
let t =
|
|
407
|
-
if (!
|
|
406
|
+
let t = I.normalize(e);
|
|
407
|
+
if (!F.test(t)) return !1;
|
|
408
408
|
let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
|
|
409
409
|
return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
|
|
410
410
|
},
|
|
@@ -424,11 +424,11 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
424
424
|
return e;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
},
|
|
427
|
+
}, xe = /^([01]?\d|2[0-3]):([0-5]\d)$/, L = {
|
|
428
428
|
normalize(e) {
|
|
429
429
|
if (typeof e != "string") return "";
|
|
430
430
|
let t = e.trim();
|
|
431
|
-
if (
|
|
431
|
+
if (xe.test(t)) {
|
|
432
432
|
let [e, n] = t.split(":");
|
|
433
433
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
|
|
434
434
|
}
|
|
@@ -440,7 +440,7 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
440
440
|
return "";
|
|
441
441
|
},
|
|
442
442
|
validate(e) {
|
|
443
|
-
return
|
|
443
|
+
return L.normalize(e) !== "";
|
|
444
444
|
},
|
|
445
445
|
format(e, t = {}) {
|
|
446
446
|
if (typeof e != "string") return "";
|
|
@@ -451,32 +451,32 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
451
451
|
let a = r < 12 ? "AM" : "PM";
|
|
452
452
|
return `${r % 12 || 12}:${i} ${a}`;
|
|
453
453
|
}
|
|
454
|
-
},
|
|
454
|
+
}, R = {
|
|
455
455
|
PLAIN: "plain",
|
|
456
456
|
CREDIT_CARD: "creditCard",
|
|
457
457
|
PHONE: "phone",
|
|
458
458
|
CURRENCY: "currency",
|
|
459
459
|
DATE: "date",
|
|
460
460
|
TIME: "time"
|
|
461
|
-
},
|
|
462
|
-
[
|
|
463
|
-
[
|
|
464
|
-
[
|
|
465
|
-
[
|
|
466
|
-
[
|
|
467
|
-
[
|
|
468
|
-
]),
|
|
469
|
-
type:
|
|
461
|
+
}, z = new Map([
|
|
462
|
+
[R.PLAIN, le],
|
|
463
|
+
[R.CREDIT_CARD, me],
|
|
464
|
+
[R.PHONE, ge],
|
|
465
|
+
[R.CURRENCY, P],
|
|
466
|
+
[R.DATE, I],
|
|
467
|
+
[R.TIME, L]
|
|
468
|
+
]), B = {
|
|
469
|
+
type: R.PLAIN,
|
|
470
470
|
options: {}
|
|
471
|
-
},
|
|
471
|
+
}, V = class extends j {
|
|
472
472
|
static register(e, t) {
|
|
473
|
-
|
|
473
|
+
z.set(e, t);
|
|
474
474
|
}
|
|
475
475
|
constructor(e, t = {}) {
|
|
476
|
-
super(e, t), this.type = t.type ??
|
|
476
|
+
super(e, t), this.type = t.type ?? B.type, this.options = t.options ?? B.options, this.enhance();
|
|
477
477
|
}
|
|
478
478
|
enhance() {
|
|
479
|
-
let e = this, t =
|
|
479
|
+
let e = this, t = z.get(e.type) ?? z.get(R.PLAIN), n = {
|
|
480
480
|
normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
481
481
|
validate: (n) => t.validate?.(n, e.options) ?? !0,
|
|
482
482
|
format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
@@ -490,25 +490,30 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
490
490
|
configurable: !0
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
},
|
|
494
|
-
|
|
495
|
-
//#region src/plumbers/plumber/date.js
|
|
496
|
-
function W(e) {
|
|
493
|
+
}, H = (e, t) => new V(e, t), Se = /^\d{4}-\d{2}-\d{2}$/;
|
|
494
|
+
function U(e) {
|
|
497
495
|
return e instanceof Date && !isNaN(e);
|
|
498
496
|
}
|
|
499
|
-
function
|
|
497
|
+
function W(...e) {
|
|
500
498
|
if (e.length === 0) throw "Missing values to parse as date";
|
|
501
499
|
if (e.length === 1) {
|
|
502
|
-
let t =
|
|
503
|
-
if (
|
|
500
|
+
let t = e[0];
|
|
501
|
+
if (!t) return;
|
|
502
|
+
if (typeof t == "string" && Se.test(t)) {
|
|
503
|
+
let [e, n, r] = t.split("-").map(Number), i = new Date(e, n - 1, r);
|
|
504
|
+
if (U(i)) return i;
|
|
505
|
+
} else {
|
|
506
|
+
let e = new Date(t);
|
|
507
|
+
if (U(e)) return e;
|
|
508
|
+
}
|
|
504
509
|
} else {
|
|
505
510
|
let t = new Date(...e);
|
|
506
|
-
if (
|
|
511
|
+
if (U(t)) return t;
|
|
507
512
|
}
|
|
508
513
|
}
|
|
509
514
|
//#endregion
|
|
510
515
|
//#region src/plumbers/calendar.js
|
|
511
|
-
var
|
|
516
|
+
var G = 7, K = {
|
|
512
517
|
locales: ["default"],
|
|
513
518
|
today: "",
|
|
514
519
|
day: null,
|
|
@@ -523,18 +528,18 @@ var K = 7, q = {
|
|
|
523
528
|
disabledYears: [],
|
|
524
529
|
firstDayOfWeek: 0,
|
|
525
530
|
onNavigated: "navigated"
|
|
526
|
-
},
|
|
531
|
+
}, Ce = class extends j {
|
|
527
532
|
constructor(e, t = {}) {
|
|
528
533
|
super(e, t);
|
|
529
|
-
let n = Object.assign({},
|
|
530
|
-
this.onNavigated = r, this.since =
|
|
534
|
+
let n = Object.assign({}, K, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
|
|
535
|
+
this.onNavigated = r, this.since = W(i), this.till = W(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : K.firstDayOfWeek;
|
|
531
536
|
let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
|
|
532
537
|
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 : [];
|
|
533
538
|
let { today: f, day: p, month: m, year: h } = n;
|
|
534
|
-
this.now =
|
|
539
|
+
this.now = W(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = W(h, m, p) : this.current = this.now, this.build(), this.enhance();
|
|
535
540
|
}
|
|
536
541
|
build() {
|
|
537
|
-
this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear();
|
|
542
|
+
this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear(), this.yearsOfDecade = this.buildYearsOfDecade();
|
|
538
543
|
}
|
|
539
544
|
buildDaysOfWeek() {
|
|
540
545
|
let e = new Intl.DateTimeFormat(this.localesValue, { weekday: "long" }), t = new Intl.DateTimeFormat(this.localesValue, { weekday: "short" }), n = /* @__PURE__ */ new Date("2024-10-06"), r = [];
|
|
@@ -567,7 +572,7 @@ var K = 7, q = {
|
|
|
567
572
|
let a = new Date(t, e, i);
|
|
568
573
|
n.push(r(a));
|
|
569
574
|
}
|
|
570
|
-
let s = n.length %
|
|
575
|
+
let s = n.length % G, c = s === 0 ? 0 : G - s;
|
|
571
576
|
for (let i = 1; i <= c; i++) {
|
|
572
577
|
let a = new Date(t, e + 1, i);
|
|
573
578
|
n.push(r(a));
|
|
@@ -588,22 +593,31 @@ var K = 7, q = {
|
|
|
588
593
|
}
|
|
589
594
|
return r;
|
|
590
595
|
}
|
|
596
|
+
buildYearsOfDecade() {
|
|
597
|
+
let e = Math.floor(this.year / 10) * 10, t = [];
|
|
598
|
+
for (let n = e - 1; n <= e + 10; n++) t.push({
|
|
599
|
+
value: n,
|
|
600
|
+
current: n === this.year,
|
|
601
|
+
outside: n < e || n > e + 9
|
|
602
|
+
});
|
|
603
|
+
return t;
|
|
604
|
+
}
|
|
591
605
|
get today() {
|
|
592
606
|
return this.now;
|
|
593
607
|
}
|
|
594
608
|
set today(e) {
|
|
595
|
-
if (!
|
|
596
|
-
let t = this.month
|
|
597
|
-
this.now = new Date(n, t,
|
|
609
|
+
if (!U(e)) return;
|
|
610
|
+
let t = this.month ?? e.getMonth(), n = this.year ?? e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear() ? e.getDate() : 1;
|
|
611
|
+
this.now = new Date(n, t, r);
|
|
598
612
|
}
|
|
599
613
|
get current() {
|
|
600
|
-
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ?
|
|
614
|
+
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? W(this.year, this.month, this.day) : null;
|
|
601
615
|
}
|
|
602
616
|
set current(e) {
|
|
603
|
-
|
|
617
|
+
U(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
|
|
604
618
|
}
|
|
605
619
|
navigate = async (e) => {
|
|
606
|
-
if (!
|
|
620
|
+
if (!U(e)) return;
|
|
607
621
|
let t = this.current, n = e.toISOString(), r = t.toISOString();
|
|
608
622
|
this.dispatch("navigate", { detail: {
|
|
609
623
|
from: r,
|
|
@@ -634,7 +648,7 @@ var K = 7, q = {
|
|
|
634
648
|
await this.navigate(n);
|
|
635
649
|
};
|
|
636
650
|
isDisabled = (e) => {
|
|
637
|
-
if (!
|
|
651
|
+
if (!U(e)) return !1;
|
|
638
652
|
if (this.disabledDates.length) {
|
|
639
653
|
let t = e.getTime();
|
|
640
654
|
for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
|
|
@@ -664,7 +678,7 @@ var K = 7, q = {
|
|
|
664
678
|
return !1;
|
|
665
679
|
};
|
|
666
680
|
isWithinRange = (e) => {
|
|
667
|
-
if (!
|
|
681
|
+
if (!U(e)) return !1;
|
|
668
682
|
let t = !0;
|
|
669
683
|
return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
|
|
670
684
|
};
|
|
@@ -720,6 +734,9 @@ var K = 7, q = {
|
|
|
720
734
|
get monthsOfYear() {
|
|
721
735
|
return e.monthsOfYear;
|
|
722
736
|
},
|
|
737
|
+
get yearsOfDecade() {
|
|
738
|
+
return e.yearsOfDecade;
|
|
739
|
+
},
|
|
723
740
|
navigate: async (t) => await e.navigate(t),
|
|
724
741
|
step: async (t, n) => await e.step(t, n),
|
|
725
742
|
isDisabled: (t) => e.isDisabled(t),
|
|
@@ -727,18 +744,18 @@ var K = 7, q = {
|
|
|
727
744
|
};
|
|
728
745
|
} });
|
|
729
746
|
}
|
|
730
|
-
},
|
|
747
|
+
}, we = (e, t) => new Ce(e, t), q = {
|
|
731
748
|
content: null,
|
|
732
749
|
url: "",
|
|
733
750
|
reload: "never",
|
|
734
751
|
stale: 3600,
|
|
735
752
|
onLoad: "canLoad",
|
|
736
753
|
onLoaded: "contentLoaded"
|
|
737
|
-
},
|
|
754
|
+
}, Te = class extends j {
|
|
738
755
|
constructor(e, t = {}) {
|
|
739
756
|
super(e, t);
|
|
740
|
-
let n = Object.assign({},
|
|
741
|
-
this.content = r, this.url = i, this.reload = typeof a == "string" ? a :
|
|
757
|
+
let n = Object.assign({}, q, t), { content: r, url: i, reload: a, stale: o } = n;
|
|
758
|
+
this.content = r, this.url = i, this.reload = typeof a == "string" ? a : q.reload, this.stale = typeof o == "number" ? o : q.stale;
|
|
742
759
|
let { onLoad: s, onLoaded: c } = n;
|
|
743
760
|
this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
|
|
744
761
|
}
|
|
@@ -747,7 +764,7 @@ var K = 7, q = {
|
|
|
747
764
|
case "never": return !1;
|
|
748
765
|
case "always": return !0;
|
|
749
766
|
default: {
|
|
750
|
-
let e =
|
|
767
|
+
let e = W(this.loadedAt);
|
|
751
768
|
return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
|
|
752
769
|
}
|
|
753
770
|
}
|
|
@@ -773,7 +790,7 @@ var K = 7, q = {
|
|
|
773
790
|
let e = this;
|
|
774
791
|
Object.assign(this.controller, { load: e.load.bind(e) });
|
|
775
792
|
}
|
|
776
|
-
},
|
|
793
|
+
}, Ee = (e, t) => new Te(e, t), J = class extends j {
|
|
777
794
|
observe(e) {
|
|
778
795
|
this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
|
|
779
796
|
}
|
|
@@ -786,21 +803,21 @@ var K = 7, q = {
|
|
|
786
803
|
e.unobserve(), t();
|
|
787
804
|
};
|
|
788
805
|
}
|
|
789
|
-
},
|
|
806
|
+
}, De = {
|
|
790
807
|
trigger: null,
|
|
791
808
|
events: ["click"],
|
|
792
809
|
onDismissed: "dismissed"
|
|
793
|
-
},
|
|
810
|
+
}, Oe = class extends J {
|
|
794
811
|
constructor(e, t = {}) {
|
|
795
812
|
super(e, t);
|
|
796
|
-
let { trigger: n, events: r, onDismissed: i } = Object.assign({},
|
|
813
|
+
let { trigger: n, events: r, onDismissed: i } = Object.assign({}, De, t);
|
|
797
814
|
this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
|
|
798
815
|
}
|
|
799
816
|
dismiss = async (e) => {
|
|
800
817
|
let { target: t } = e;
|
|
801
818
|
t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
|
|
802
819
|
};
|
|
803
|
-
},
|
|
820
|
+
}, Y = (e, t) => new Oe(e, t), ke = {
|
|
804
821
|
anchor: null,
|
|
805
822
|
events: ["click"],
|
|
806
823
|
placement: "bottom",
|
|
@@ -808,10 +825,10 @@ var K = 7, q = {
|
|
|
808
825
|
onFlipped: "flipped",
|
|
809
826
|
ariaRole: null,
|
|
810
827
|
respectMotion: !0
|
|
811
|
-
},
|
|
828
|
+
}, Ae = class extends J {
|
|
812
829
|
constructor(e, t = {}) {
|
|
813
830
|
super(e, t);
|
|
814
|
-
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({},
|
|
831
|
+
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, ke, t);
|
|
815
832
|
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 && S({
|
|
816
833
|
trigger: this.anchor,
|
|
817
834
|
target: this.element,
|
|
@@ -927,7 +944,7 @@ var K = 7, q = {
|
|
|
927
944
|
enhance() {
|
|
928
945
|
super.enhance(), this.controller.flip = this.flip;
|
|
929
946
|
}
|
|
930
|
-
},
|
|
947
|
+
}, je = (e, t) => new Ae(e, t), Me = {
|
|
931
948
|
events: ["resize"],
|
|
932
949
|
boundaries: [
|
|
933
950
|
"top",
|
|
@@ -936,10 +953,10 @@ var K = 7, q = {
|
|
|
936
953
|
],
|
|
937
954
|
onShifted: "shifted",
|
|
938
955
|
respectMotion: !0
|
|
939
|
-
},
|
|
956
|
+
}, Ne = class extends J {
|
|
940
957
|
constructor(e, t = {}) {
|
|
941
958
|
super(e, t);
|
|
942
|
-
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({},
|
|
959
|
+
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Me, t);
|
|
943
960
|
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);
|
|
944
961
|
}
|
|
945
962
|
shift = async () => {
|
|
@@ -988,13 +1005,13 @@ var K = 7, q = {
|
|
|
988
1005
|
enhance() {
|
|
989
1006
|
super.enhance(), this.controller.shift = this.shift;
|
|
990
1007
|
}
|
|
991
|
-
},
|
|
1008
|
+
}, Pe = (e, t) => new Ne(e, t), X = {
|
|
992
1009
|
visibility: "visibility",
|
|
993
1010
|
onShown: "shown",
|
|
994
1011
|
onHidden: "hidden"
|
|
995
|
-
},
|
|
1012
|
+
}, Fe = class extends j {
|
|
996
1013
|
constructor(e, t = {}) {
|
|
997
|
-
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({},
|
|
1014
|
+
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, X, t), o = typeof n == "string" ? n : X.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
|
|
998
1015
|
(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));
|
|
999
1016
|
}
|
|
1000
1017
|
isVisible(e) {
|
|
@@ -1027,12 +1044,12 @@ var K = 7, q = {
|
|
|
1027
1044
|
return t;
|
|
1028
1045
|
} });
|
|
1029
1046
|
}
|
|
1030
|
-
},
|
|
1047
|
+
}, Z = (e, t) => new Fe(e, t), Q = class extends e {
|
|
1031
1048
|
static targets = ["daysOfWeek", "daysOfMonth"];
|
|
1032
1049
|
static classes = [
|
|
1033
1050
|
"dayOfWeek",
|
|
1034
1051
|
"dayOfMonth",
|
|
1035
|
-
"
|
|
1052
|
+
"row"
|
|
1036
1053
|
];
|
|
1037
1054
|
static values = {
|
|
1038
1055
|
locales: {
|
|
@@ -1050,10 +1067,18 @@ var K = 7, q = {
|
|
|
1050
1067
|
daysOfOtherMonth: {
|
|
1051
1068
|
type: Boolean,
|
|
1052
1069
|
default: !1
|
|
1070
|
+
},
|
|
1071
|
+
today: {
|
|
1072
|
+
type: String,
|
|
1073
|
+
default: ""
|
|
1074
|
+
},
|
|
1075
|
+
selected: {
|
|
1076
|
+
type: String,
|
|
1077
|
+
default: ""
|
|
1053
1078
|
}
|
|
1054
1079
|
};
|
|
1055
1080
|
initialize() {
|
|
1056
|
-
|
|
1081
|
+
we(this, { today: this.todayValue });
|
|
1057
1082
|
}
|
|
1058
1083
|
connect() {
|
|
1059
1084
|
this.draw();
|
|
@@ -1061,8 +1086,21 @@ var K = 7, q = {
|
|
|
1061
1086
|
navigated() {
|
|
1062
1087
|
this.draw();
|
|
1063
1088
|
}
|
|
1089
|
+
selectedValueChanged() {
|
|
1090
|
+
if (!this.hasDaysOfMonthTarget || (this.daysOfMonthTarget.querySelectorAll("[aria-selected]").forEach((e) => {
|
|
1091
|
+
e.setAttribute("aria-selected", "false");
|
|
1092
|
+
}), !this.selectedValue)) return;
|
|
1093
|
+
let e = W(this.selectedValue);
|
|
1094
|
+
if (!e) return;
|
|
1095
|
+
let t = this.daysOfMonthTarget.querySelector(`time[datetime="${e.toISOString()}"]`);
|
|
1096
|
+
t && t.closest("[aria-selected]").setAttribute("aria-selected", "true");
|
|
1097
|
+
}
|
|
1098
|
+
onSelect(e) {
|
|
1099
|
+
let t = e.detail?.iso;
|
|
1100
|
+
t && (this.selectedValue = t);
|
|
1101
|
+
}
|
|
1064
1102
|
draw() {
|
|
1065
|
-
this.drawDaysOfWeek(), this.drawDaysOfMonth();
|
|
1103
|
+
this.drawDaysOfWeek(), this.drawDaysOfMonth(), this.selectedValueChanged();
|
|
1066
1104
|
}
|
|
1067
1105
|
createDayElement(e, { selectable: t = !1, disabled: n = !1 } = {}) {
|
|
1068
1106
|
let r = document.createElement(t ? "button" : "div");
|
|
@@ -1076,7 +1114,7 @@ var K = 7, q = {
|
|
|
1076
1114
|
r.setAttribute("role", "columnheader"), r.title = n.long, this.hasDayOfWeekClass && r.classList.add(...this.dayOfWeekClasses), t.push(r);
|
|
1077
1115
|
}
|
|
1078
1116
|
let n = document.createElement("div");
|
|
1079
|
-
n.setAttribute("role", "row"), this.
|
|
1117
|
+
n.setAttribute("role", "row"), this.hasRowClass && n.classList.add(...this.rowClasses), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
|
|
1080
1118
|
}
|
|
1081
1119
|
drawDaysOfMonth() {
|
|
1082
1120
|
if (!this.hasDaysOfMonthTarget) return;
|
|
@@ -1086,20 +1124,20 @@ var K = 7, q = {
|
|
|
1086
1124
|
selectable: e.current,
|
|
1087
1125
|
disabled: r
|
|
1088
1126
|
});
|
|
1089
|
-
t === e.date.getTime() && a.setAttribute("aria-current", "date"), this.hasDayOfMonthClass && a.classList.add(...this.dayOfMonthClasses);
|
|
1127
|
+
t === e.date.getTime() && a.setAttribute("aria-current", "date"), (e.current || this.daysOfOtherMonthValue) && a.setAttribute("aria-selected", ""), this.hasDayOfMonthClass && a.classList.add(...this.dayOfMonthClasses);
|
|
1090
1128
|
let o = document.createElement("time");
|
|
1091
1129
|
o.dateTime = e.iso, a.appendChild(o), n.push(a);
|
|
1092
1130
|
}
|
|
1093
1131
|
let r = [];
|
|
1094
1132
|
for (let e = 0; e < n.length; e += 7) {
|
|
1095
1133
|
let t = document.createElement("div");
|
|
1096
|
-
t.setAttribute("role", "row"), this.
|
|
1134
|
+
t.setAttribute("role", "row"), this.hasRowClass && t.classList.add(...this.rowClasses);
|
|
1097
1135
|
for (let r of n.slice(e, e + 7)) r.setAttribute("role", "gridcell"), t.appendChild(r);
|
|
1098
1136
|
r.push(t);
|
|
1099
1137
|
}
|
|
1100
1138
|
this.daysOfMonthTarget.replaceChildren(...r);
|
|
1101
1139
|
}
|
|
1102
|
-
},
|
|
1140
|
+
}, Ie = class extends e {
|
|
1103
1141
|
onSelect(e) {
|
|
1104
1142
|
if (!(e.target instanceof HTMLElement)) return;
|
|
1105
1143
|
e.preventDefault();
|
|
@@ -1108,25 +1146,25 @@ var K = 7, q = {
|
|
|
1108
1146
|
this.dispatch("selecting", { target: t });
|
|
1109
1147
|
let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
|
|
1110
1148
|
if (!n) return console.error(`unable to locate time element within ${t}`);
|
|
1111
|
-
let r =
|
|
1149
|
+
let r = W(n.dateTime);
|
|
1112
1150
|
if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
|
|
1113
1151
|
this.select(r.toISOString());
|
|
1114
1152
|
}
|
|
1115
1153
|
select(e) {
|
|
1116
|
-
let t =
|
|
1154
|
+
let t = W(e);
|
|
1117
1155
|
t && this.dispatch("selected", { detail: {
|
|
1118
1156
|
epoch: t.getTime(),
|
|
1119
1157
|
iso: e
|
|
1120
1158
|
} });
|
|
1121
1159
|
}
|
|
1122
|
-
},
|
|
1160
|
+
}, Le = class extends e {
|
|
1123
1161
|
static targets = ["source"];
|
|
1124
|
-
static values = {
|
|
1162
|
+
static values = { contentType: {
|
|
1125
1163
|
type: String,
|
|
1126
1164
|
default: "text/plain"
|
|
1127
1165
|
} };
|
|
1128
1166
|
onPaste(e) {
|
|
1129
|
-
let t = e.clipboardData?.getData(this.
|
|
1167
|
+
let t = e.clipboardData?.getData(this.contentTypeValue) ?? "", n = Array.from(e.clipboardData?.types ?? []);
|
|
1130
1168
|
e.preventDefault(), this.dispatch("pasted", {
|
|
1131
1169
|
detail: {
|
|
1132
1170
|
text: t,
|
|
@@ -1149,17 +1187,29 @@ var K = 7, q = {
|
|
|
1149
1187
|
});
|
|
1150
1188
|
}
|
|
1151
1189
|
}
|
|
1152
|
-
},
|
|
1190
|
+
}, $ = [
|
|
1191
|
+
"month",
|
|
1192
|
+
"year",
|
|
1193
|
+
"decade"
|
|
1194
|
+
], Re = class extends e {
|
|
1153
1195
|
static targets = [
|
|
1154
1196
|
"previous",
|
|
1155
1197
|
"next",
|
|
1156
1198
|
"day",
|
|
1157
1199
|
"month",
|
|
1158
|
-
"year"
|
|
1200
|
+
"year",
|
|
1201
|
+
"viewTitle",
|
|
1202
|
+
"monthView",
|
|
1203
|
+
"yearView",
|
|
1204
|
+
"decadeView"
|
|
1159
1205
|
];
|
|
1160
1206
|
static outlets = ["calendar-month"];
|
|
1161
1207
|
static values = {
|
|
1162
1208
|
date: String,
|
|
1209
|
+
view: {
|
|
1210
|
+
type: String,
|
|
1211
|
+
default: "month"
|
|
1212
|
+
},
|
|
1163
1213
|
locales: {
|
|
1164
1214
|
type: Array,
|
|
1165
1215
|
default: ["default"]
|
|
@@ -1178,11 +1228,11 @@ var K = 7, q = {
|
|
|
1178
1228
|
}
|
|
1179
1229
|
};
|
|
1180
1230
|
initialize() {
|
|
1181
|
-
this.previous = this.previous.bind(this), this.next = this.next.bind(this);
|
|
1231
|
+
this.previous = this.previous.bind(this), this.next = this.next.bind(this), this.selectMonth = this.selectMonth.bind(this), this.selectYear = this.selectYear.bind(this);
|
|
1182
1232
|
}
|
|
1183
1233
|
async calendarMonthOutletConnected() {
|
|
1184
1234
|
if (this.dateValue) {
|
|
1185
|
-
let e =
|
|
1235
|
+
let e = W(this.dateValue);
|
|
1186
1236
|
e && await this.calendarMonthOutlet.calendar.navigate(e);
|
|
1187
1237
|
}
|
|
1188
1238
|
this.draw();
|
|
@@ -1193,6 +1243,22 @@ var K = 7, q = {
|
|
|
1193
1243
|
bubbles: !0
|
|
1194
1244
|
});
|
|
1195
1245
|
}
|
|
1246
|
+
zoomOut() {
|
|
1247
|
+
let e = $.indexOf(this.viewValue);
|
|
1248
|
+
e < $.length - 1 && (this.viewValue = $[e + 1], this.draw());
|
|
1249
|
+
}
|
|
1250
|
+
async selectMonth(e) {
|
|
1251
|
+
let t = e.target.closest("button[data-month]");
|
|
1252
|
+
if (!t) return;
|
|
1253
|
+
let n = parseInt(t.dataset.month, 10) - 1, { year: r } = this.calendarMonthOutlet.calendar;
|
|
1254
|
+
await this.calendarMonthOutlet.calendar.navigate(new Date(r, n, 1)), this.viewValue = "month", this.draw();
|
|
1255
|
+
}
|
|
1256
|
+
async selectYear(e) {
|
|
1257
|
+
let t = e.target.closest("button[data-year]");
|
|
1258
|
+
if (!t || t.getAttribute("aria-disabled") === "true") return;
|
|
1259
|
+
let n = parseInt(t.dataset.year, 10), { month: r } = this.calendarMonthOutlet.calendar;
|
|
1260
|
+
await this.calendarMonthOutlet.calendar.navigate(new Date(n, r, 1)), this.viewValue = "year", this.draw();
|
|
1261
|
+
}
|
|
1196
1262
|
previousTargetConnected(e) {
|
|
1197
1263
|
e.addEventListener("click", this.previous);
|
|
1198
1264
|
}
|
|
@@ -1200,7 +1266,7 @@ var K = 7, q = {
|
|
|
1200
1266
|
e.removeEventListener("click", this.previous);
|
|
1201
1267
|
}
|
|
1202
1268
|
async previous() {
|
|
1203
|
-
await this.calendarMonthOutlet.calendar.step(
|
|
1269
|
+
await this.calendarMonthOutlet.calendar.step(...this.stepArgs(-1)), this.draw();
|
|
1204
1270
|
}
|
|
1205
1271
|
nextTargetConnected(e) {
|
|
1206
1272
|
e.addEventListener("click", this.next);
|
|
@@ -1209,10 +1275,22 @@ var K = 7, q = {
|
|
|
1209
1275
|
e.removeEventListener("click", this.next);
|
|
1210
1276
|
}
|
|
1211
1277
|
async next() {
|
|
1212
|
-
await this.calendarMonthOutlet.calendar.step(
|
|
1278
|
+
await this.calendarMonthOutlet.calendar.step(...this.stepArgs(1)), this.draw();
|
|
1279
|
+
}
|
|
1280
|
+
yearViewTargetConnected(e) {
|
|
1281
|
+
e.addEventListener("click", this.selectMonth);
|
|
1282
|
+
}
|
|
1283
|
+
yearViewTargetDisconnected(e) {
|
|
1284
|
+
e.removeEventListener("click", this.selectMonth);
|
|
1285
|
+
}
|
|
1286
|
+
decadeViewTargetConnected(e) {
|
|
1287
|
+
e.addEventListener("click", this.selectYear);
|
|
1288
|
+
}
|
|
1289
|
+
decadeViewTargetDisconnected(e) {
|
|
1290
|
+
e.removeEventListener("click", this.selectYear);
|
|
1213
1291
|
}
|
|
1214
1292
|
draw() {
|
|
1215
|
-
this.drawDay(), this.drawMonth(), this.drawYear();
|
|
1293
|
+
this.drawDay(), this.drawMonth(), this.drawYear(), this.drawViewTitle(), this.drawYearView(), this.drawDecadeView(), this.drawView();
|
|
1216
1294
|
}
|
|
1217
1295
|
drawDay() {
|
|
1218
1296
|
if (!this.hasDayTarget || !this.hasCalendarMonthOutlet) return;
|
|
@@ -1229,7 +1307,50 @@ var K = 7, q = {
|
|
|
1229
1307
|
let { year: e } = this.calendarMonthOutlet.calendar;
|
|
1230
1308
|
this.yearTarget.textContent = new Intl.DateTimeFormat(this.localesValue, { year: this.yearFormatValue }).format(new Date(e, 0));
|
|
1231
1309
|
}
|
|
1232
|
-
|
|
1310
|
+
drawViewTitle() {
|
|
1311
|
+
if (!this.hasViewTitleTarget || !this.hasCalendarMonthOutlet) return;
|
|
1312
|
+
let { year: e, month: t } = this.calendarMonthOutlet.calendar;
|
|
1313
|
+
this.viewTitleTarget.textContent = this.viewTitleLabel(e, t);
|
|
1314
|
+
}
|
|
1315
|
+
drawYearView() {
|
|
1316
|
+
if (!this.hasYearViewTarget || !this.hasCalendarMonthOutlet) return;
|
|
1317
|
+
let { year: e, month: t, monthsOfYear: n } = this.calendarMonthOutlet.calendar, r = this.calendarMonthOutlet.calendar.today, i = [];
|
|
1318
|
+
for (let a of n) {
|
|
1319
|
+
let n = document.createElement("button");
|
|
1320
|
+
n.type = "button", n.textContent = a.short, n.dataset.month = a.value + 1, n.setAttribute("role", "gridcell"), n.setAttribute("aria-selected", a.value === t ? "true" : "false"), a.value === r.getMonth() && e === r.getFullYear() && n.setAttribute("aria-current", "month"), i.push(n);
|
|
1321
|
+
}
|
|
1322
|
+
this.yearViewTarget.replaceChildren(...i);
|
|
1323
|
+
}
|
|
1324
|
+
drawDecadeView() {
|
|
1325
|
+
if (!this.hasDecadeViewTarget || !this.hasCalendarMonthOutlet) return;
|
|
1326
|
+
let { year: e, yearsOfDecade: t } = this.calendarMonthOutlet.calendar, n = this.calendarMonthOutlet.calendar.today.getFullYear(), r = [];
|
|
1327
|
+
for (let i of t) {
|
|
1328
|
+
let t = document.createElement("button");
|
|
1329
|
+
t.type = "button", t.textContent = i.value, t.dataset.year = i.value, t.setAttribute("role", "gridcell"), t.setAttribute("aria-selected", i.value === e ? "true" : "false"), i.value === n && t.setAttribute("aria-current", "year"), i.outside && t.setAttribute("aria-disabled", "true"), r.push(t);
|
|
1330
|
+
}
|
|
1331
|
+
this.decadeViewTarget.replaceChildren(...r);
|
|
1332
|
+
}
|
|
1333
|
+
viewTitleLabel(e, t) {
|
|
1334
|
+
if (this.viewValue === "year") return String(e);
|
|
1335
|
+
if (this.viewValue === "decade") {
|
|
1336
|
+
let t = Math.floor(e / 10) * 10;
|
|
1337
|
+
return `${t}–${t + 9}`;
|
|
1338
|
+
}
|
|
1339
|
+
return new Intl.DateTimeFormat(this.localesValue, {
|
|
1340
|
+
month: "long",
|
|
1341
|
+
year: "numeric"
|
|
1342
|
+
}).format(new Date(e, t));
|
|
1343
|
+
}
|
|
1344
|
+
stepArgs(e) {
|
|
1345
|
+
return this.viewValue === "year" ? ["year", e] : this.viewValue === "decade" ? ["year", e * 10] : ["month", e];
|
|
1346
|
+
}
|
|
1347
|
+
drawView() {
|
|
1348
|
+
if (this.hasMonthViewTarget && (this.monthViewTarget.hidden = this.viewValue !== "month"), this.hasYearViewTarget && (this.yearViewTarget.hidden = this.viewValue !== "year"), this.hasDecadeViewTarget && (this.decadeViewTarget.hidden = this.viewValue !== "decade"), this.hasCalendarMonthOutlet) {
|
|
1349
|
+
let e = this.calendarMonthOutlet, t = this.viewValue === "month";
|
|
1350
|
+
e.hasDaysOfWeekTarget && (e.daysOfWeekTarget.hidden = !t), e.hasDaysOfMonthTarget && (e.daysOfMonthTarget.hidden = !t);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}, ze = class extends e {
|
|
1233
1354
|
static targets = [
|
|
1234
1355
|
"listbox",
|
|
1235
1356
|
"loading",
|
|
@@ -1310,7 +1431,7 @@ var K = 7, q = {
|
|
|
1310
1431
|
disconnect() {
|
|
1311
1432
|
this._requestor.cancel();
|
|
1312
1433
|
}
|
|
1313
|
-
},
|
|
1434
|
+
}, Be = class extends e {
|
|
1314
1435
|
static targets = [
|
|
1315
1436
|
"hour",
|
|
1316
1437
|
"minute",
|
|
@@ -1346,12 +1467,12 @@ var K = 7, q = {
|
|
|
1346
1467
|
selectedValue(e) {
|
|
1347
1468
|
return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
|
|
1348
1469
|
}
|
|
1349
|
-
},
|
|
1470
|
+
}, Ve = class extends e {
|
|
1350
1471
|
static targets = ["trigger"];
|
|
1351
1472
|
connect() {
|
|
1352
|
-
|
|
1473
|
+
Y(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
|
|
1353
1474
|
}
|
|
1354
|
-
},
|
|
1475
|
+
}, He = class extends e {
|
|
1355
1476
|
static targets = ["anchor", "reference"];
|
|
1356
1477
|
static values = {
|
|
1357
1478
|
placement: {
|
|
@@ -1376,7 +1497,7 @@ var K = 7, q = {
|
|
|
1376
1497
|
console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
|
|
1377
1498
|
return;
|
|
1378
1499
|
}
|
|
1379
|
-
|
|
1500
|
+
je(this, {
|
|
1380
1501
|
element: this.referenceTarget,
|
|
1381
1502
|
anchor: this.anchorTarget,
|
|
1382
1503
|
placement: this.placementValue,
|
|
@@ -1384,12 +1505,8 @@ var K = 7, q = {
|
|
|
1384
1505
|
ariaRole: this.roleValue
|
|
1385
1506
|
});
|
|
1386
1507
|
}
|
|
1387
|
-
},
|
|
1388
|
-
static targets = [
|
|
1389
|
-
"trigger",
|
|
1390
|
-
"popover",
|
|
1391
|
-
"value"
|
|
1392
|
-
];
|
|
1508
|
+
}, Ue = class extends e {
|
|
1509
|
+
static targets = ["trigger", "input"];
|
|
1393
1510
|
static values = {
|
|
1394
1511
|
value: String,
|
|
1395
1512
|
minLength: {
|
|
@@ -1398,32 +1515,8 @@ var K = 7, q = {
|
|
|
1398
1515
|
}
|
|
1399
1516
|
};
|
|
1400
1517
|
static outlets = ["combobox-dropdown"];
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
element: this.popoverTarget,
|
|
1404
|
-
activator: this.hasTriggerTarget ? this.triggerTarget : null
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
async dismissed() {
|
|
1408
|
-
await this.close();
|
|
1409
|
-
}
|
|
1410
|
-
async open() {
|
|
1411
|
-
this.hasPopoverTarget && await this.visibility.show();
|
|
1412
|
-
}
|
|
1413
|
-
async close() {
|
|
1414
|
-
this.hasPopoverTarget && await this.visibility.hide();
|
|
1415
|
-
}
|
|
1416
|
-
async toggle() {
|
|
1417
|
-
this.visibility?.visible ? await this.close() : await this.open();
|
|
1418
|
-
}
|
|
1419
|
-
async shown() {
|
|
1420
|
-
this.hasPopoverTarget && i(this.popoverTarget);
|
|
1421
|
-
}
|
|
1422
|
-
async hidden() {
|
|
1423
|
-
this.hasTriggerTarget && this.triggerTarget.focus();
|
|
1424
|
-
}
|
|
1425
|
-
async onSelect(e) {
|
|
1426
|
-
e.detail?.value !== void 0 && (this.valueValue = e.detail.value), await this.close();
|
|
1518
|
+
onSelect(e) {
|
|
1519
|
+
e.detail?.value !== void 0 && (this.valueValue = e.detail.value);
|
|
1427
1520
|
}
|
|
1428
1521
|
onInput(e) {
|
|
1429
1522
|
if (e.target !== this.triggerTarget) return;
|
|
@@ -1435,12 +1528,12 @@ var K = 7, q = {
|
|
|
1435
1528
|
this.hasComboboxDropdownOutlet && this.comboboxDropdownOutlet.filter(t);
|
|
1436
1529
|
}
|
|
1437
1530
|
valueValueChanged(e) {
|
|
1438
|
-
this.
|
|
1531
|
+
this.hasInputTarget && (this.inputTarget.value = e), this.dispatch("changed", { detail: { value: e } });
|
|
1439
1532
|
}
|
|
1440
|
-
},
|
|
1533
|
+
}, We = class extends e {
|
|
1441
1534
|
static targets = ["input", "toggle"];
|
|
1442
1535
|
static values = {
|
|
1443
|
-
|
|
1536
|
+
format: {
|
|
1444
1537
|
type: String,
|
|
1445
1538
|
default: "plain"
|
|
1446
1539
|
},
|
|
@@ -1454,20 +1547,20 @@ var K = 7, q = {
|
|
|
1454
1547
|
}
|
|
1455
1548
|
};
|
|
1456
1549
|
connect() {
|
|
1457
|
-
|
|
1458
|
-
type: this.
|
|
1550
|
+
H(this, {
|
|
1551
|
+
type: this.formatValue,
|
|
1459
1552
|
options: this.optionsValue
|
|
1460
1553
|
}), this.format(this.readValue()), this.drawToggle();
|
|
1461
1554
|
}
|
|
1462
|
-
|
|
1463
|
-
this.formatter && (
|
|
1464
|
-
type: this.
|
|
1555
|
+
formatValueChanged() {
|
|
1556
|
+
this.formatter && (H(this, {
|
|
1557
|
+
type: this.formatValue,
|
|
1465
1558
|
options: this.optionsValue
|
|
1466
1559
|
}), this.format(this.readValue()), this.drawToggle());
|
|
1467
1560
|
}
|
|
1468
1561
|
optionsValueChanged() {
|
|
1469
|
-
this.formatter && (
|
|
1470
|
-
type: this.
|
|
1562
|
+
this.formatter && (H(this, {
|
|
1563
|
+
type: this.formatValue,
|
|
1471
1564
|
options: this.optionsValue
|
|
1472
1565
|
}), this.format(this.readValue()));
|
|
1473
1566
|
}
|
|
@@ -1481,7 +1574,7 @@ var K = 7, q = {
|
|
|
1481
1574
|
this.formatter && this.onFormatting(e);
|
|
1482
1575
|
}
|
|
1483
1576
|
toggle() {
|
|
1484
|
-
!this.formatter.maskable() && this.
|
|
1577
|
+
!this.formatter.maskable() && this.formatValue !== "password" || (this.revealedValue = !this.revealedValue);
|
|
1485
1578
|
}
|
|
1486
1579
|
onPaste(e) {
|
|
1487
1580
|
let t = e.detail?.text ?? "";
|
|
@@ -1491,7 +1584,7 @@ var K = 7, q = {
|
|
|
1491
1584
|
}
|
|
1492
1585
|
drawToggle() {
|
|
1493
1586
|
if (!this.hasToggleTarget) return;
|
|
1494
|
-
let e = this.formatter?.maskable() || this.
|
|
1587
|
+
let e = this.formatter?.maskable() || this.formatValue === "password";
|
|
1495
1588
|
this.toggleTarget.hidden = !e, e && _(this.toggleTarget, this.revealedValue);
|
|
1496
1589
|
}
|
|
1497
1590
|
readValue() {
|
|
@@ -1499,14 +1592,14 @@ var K = 7, q = {
|
|
|
1499
1592
|
}
|
|
1500
1593
|
onFormatting(e) {
|
|
1501
1594
|
if (!this.formatter) return;
|
|
1502
|
-
if (this.
|
|
1595
|
+
if (this.formatValue === "password") {
|
|
1503
1596
|
this.hasInputTarget && (this.inputTarget.type = this.revealedValue ? "text" : "password");
|
|
1504
1597
|
return;
|
|
1505
1598
|
}
|
|
1506
1599
|
let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
|
|
1507
1600
|
this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
|
|
1508
1601
|
}
|
|
1509
|
-
},
|
|
1602
|
+
}, Ge = class extends e {
|
|
1510
1603
|
static targets = ["input", "clear"];
|
|
1511
1604
|
initialize() {
|
|
1512
1605
|
this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
|
|
@@ -1529,7 +1622,7 @@ var K = 7, q = {
|
|
|
1529
1622
|
handleEscape(e) {
|
|
1530
1623
|
e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
|
|
1531
1624
|
}
|
|
1532
|
-
},
|
|
1625
|
+
}, Ke = class extends e {
|
|
1533
1626
|
static targets = ["modal", "overlay"];
|
|
1534
1627
|
initialize() {
|
|
1535
1628
|
this.onCancel = this.close.bind(this);
|
|
@@ -1538,7 +1631,7 @@ var K = 7, q = {
|
|
|
1538
1631
|
this.hasModalTarget || console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
|
|
1539
1632
|
}
|
|
1540
1633
|
modalTargetConnected(e) {
|
|
1541
|
-
this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, { escapeDeactivates: !0 }),
|
|
1634
|
+
this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, { escapeDeactivates: !0 }), Y(this, { element: e }));
|
|
1542
1635
|
}
|
|
1543
1636
|
modalTargetDisconnected(e) {
|
|
1544
1637
|
this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
|
|
@@ -1572,17 +1665,17 @@ var K = 7, q = {
|
|
|
1572
1665
|
let t = this.modalTarget.getBoundingClientRect();
|
|
1573
1666
|
(e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
|
|
1574
1667
|
};
|
|
1575
|
-
},
|
|
1668
|
+
}, qe = class extends e {
|
|
1576
1669
|
static targets = ["content"];
|
|
1577
1670
|
connect() {
|
|
1578
|
-
|
|
1671
|
+
Pe(this, { element: this.hasContentTarget ? this.contentTarget : null });
|
|
1579
1672
|
}
|
|
1580
|
-
},
|
|
1673
|
+
}, Je = class extends e {
|
|
1581
1674
|
static targets = [
|
|
1582
|
-
"
|
|
1675
|
+
"trigger",
|
|
1676
|
+
"panel",
|
|
1583
1677
|
"template",
|
|
1584
|
-
"loader"
|
|
1585
|
-
"activator"
|
|
1678
|
+
"loader"
|
|
1586
1679
|
];
|
|
1587
1680
|
static classes = ["hidden"];
|
|
1588
1681
|
static values = {
|
|
@@ -1595,37 +1688,53 @@ var K = 7, q = {
|
|
|
1595
1688
|
staleAfter: {
|
|
1596
1689
|
type: Number,
|
|
1597
1690
|
default: 3600
|
|
1691
|
+
},
|
|
1692
|
+
closeOnSelect: {
|
|
1693
|
+
type: Boolean,
|
|
1694
|
+
default: !0
|
|
1598
1695
|
}
|
|
1599
1696
|
};
|
|
1600
1697
|
connect() {
|
|
1601
|
-
|
|
1602
|
-
element: this.
|
|
1698
|
+
Ee(this, {
|
|
1699
|
+
element: this.hasPanelTarget ? this.panelTarget : null,
|
|
1603
1700
|
url: this.hasUrlValue ? this.urlValue : null
|
|
1604
|
-
}), this.
|
|
1605
|
-
element: this.
|
|
1606
|
-
activator: this.
|
|
1607
|
-
}), this.hasLoaderTarget &&
|
|
1701
|
+
}), this.hasPanelTarget && (Z(this, {
|
|
1702
|
+
element: this.panelTarget,
|
|
1703
|
+
activator: this.hasTriggerTarget ? this.triggerTarget : null
|
|
1704
|
+
}), Y(this)), this.hasLoaderTarget && Z(this, {
|
|
1608
1705
|
element: this.loaderTarget,
|
|
1609
1706
|
visibility: "contentLoaderVisibility"
|
|
1610
1707
|
});
|
|
1611
1708
|
}
|
|
1612
|
-
async
|
|
1613
|
-
await this.
|
|
1709
|
+
async dismissed() {
|
|
1710
|
+
await this.close();
|
|
1614
1711
|
}
|
|
1615
|
-
async
|
|
1616
|
-
await this.visibility.
|
|
1712
|
+
async open() {
|
|
1713
|
+
this.hasPanelTarget && await this.visibility.show();
|
|
1714
|
+
}
|
|
1715
|
+
async close() {
|
|
1716
|
+
this.hasPanelTarget && await this.visibility.hide();
|
|
1717
|
+
}
|
|
1718
|
+
async toggle() {
|
|
1719
|
+
this.visibility?.visible ? await this.close() : await this.open();
|
|
1720
|
+
}
|
|
1721
|
+
async closeOnSelect() {
|
|
1722
|
+
this.closeOnSelectValue && await this.close();
|
|
1617
1723
|
}
|
|
1618
1724
|
async shown() {
|
|
1619
|
-
await this.load();
|
|
1725
|
+
await this.load(), this.hasPanelTarget && i(this.panelTarget);
|
|
1726
|
+
}
|
|
1727
|
+
async hidden() {
|
|
1728
|
+
this.hasTriggerTarget && this.triggerTarget.focus();
|
|
1620
1729
|
}
|
|
1621
1730
|
canLoad() {
|
|
1622
|
-
return this.
|
|
1731
|
+
return this.hasPanelTarget && this.panelTarget.tagName.toLowerCase() === "turbo-frame" ? (this.hasUrlValue && this.panelTarget.setAttribute("src", this.urlValue), !1) : !0;
|
|
1623
1732
|
}
|
|
1624
1733
|
async contentLoading() {
|
|
1625
1734
|
this.hasLoaderTarget && await this.contentLoaderVisibility.show();
|
|
1626
1735
|
}
|
|
1627
1736
|
async contentLoaded({ content: e }) {
|
|
1628
|
-
this.
|
|
1737
|
+
this.hasPanelTarget && this.panelTarget.replaceChildren(this.getContentNode(e)), this.hasLoaderTarget && await this.contentLoaderVisibility.hide();
|
|
1629
1738
|
}
|
|
1630
1739
|
getContentNode(e) {
|
|
1631
1740
|
if (typeof e == "string") {
|
|
@@ -1639,4 +1748,4 @@ var K = 7, q = {
|
|
|
1639
1748
|
}
|
|
1640
1749
|
};
|
|
1641
1750
|
//#endregion
|
|
1642
|
-
export { y as ARIA_HASPOPUP_VALUES,
|
|
1751
|
+
export { y as ARIA_HASPOPUP_VALUES, Q as CalendarMonthController, Ie as CalendarObserverController, Le as ClipboardController, Re as ComboboxDateController, ze as ComboboxDropdownController, Be as ComboboxTimeController, Ve as DismisserController, t as FOCUSABLE_SELECTOR, R as FORMATTER_TYPES, He as FlipperController, o as FocusRestoration, a as FocusTrap, V as Formatter, Ge as InputClearableController, Ue as InputComboboxController, We as InputFormatterController, Ke as ModalController, qe as PannerController, Je as PopoverController, w as Requestor, d as RovingTabIndex, p as announce, S as connectTriggerToTarget, ne as disconnectTriggerFromTarget, h as ensureId, E as filterOptions, i as focusFirst, T as fuzzyMatcher, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, v as setChecked, te as setDisabled, ee as setExpanded, _ as setPressed };
|