stimulus_plumbers 0.3.3 → 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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/app/assets/javascripts/stimulus-plumbers/controllers.manifest.json +273 -0
  4. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +228 -145
  5. data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -1
  6. data/app/assets/stylesheets/stimulus_plumbers/tokens.css +43 -7
  7. data/config/locales/en.yml +10 -0
  8. data/lib/stimulus_plumbers/components/avatar.rb +14 -13
  9. data/lib/stimulus_plumbers/components/button/group.rb +9 -4
  10. data/lib/stimulus_plumbers/components/button/slots.rb +11 -0
  11. data/lib/stimulus_plumbers/components/button.rb +30 -34
  12. data/lib/stimulus_plumbers/components/calendar/turbo/days_of_month.rb +151 -0
  13. data/lib/stimulus_plumbers/components/calendar/turbo/days_of_week.rb +62 -0
  14. data/lib/stimulus_plumbers/components/calendar/turbo/months_of_year.rb +99 -0
  15. data/lib/stimulus_plumbers/components/calendar/turbo/years_of_decade.rb +86 -0
  16. data/lib/stimulus_plumbers/components/calendar/turbo.rb +65 -0
  17. data/lib/stimulus_plumbers/components/calendar.rb +70 -29
  18. data/lib/stimulus_plumbers/components/card/slots.rb +26 -0
  19. data/lib/stimulus_plumbers/components/card.rb +54 -14
  20. data/lib/stimulus_plumbers/components/combobox/builder.rb +45 -0
  21. data/lib/stimulus_plumbers/components/combobox/date/navigation.rb +72 -0
  22. data/lib/stimulus_plumbers/components/combobox/date/navigator.rb +25 -0
  23. data/lib/stimulus_plumbers/components/combobox/date.rb +34 -24
  24. data/lib/stimulus_plumbers/components/combobox/dropdown.rb +27 -24
  25. data/lib/stimulus_plumbers/components/combobox/options/option.rb +1 -1
  26. data/lib/stimulus_plumbers/components/combobox/options/option_group.rb +1 -1
  27. data/lib/stimulus_plumbers/components/combobox/time/drum.rb +1 -1
  28. data/lib/stimulus_plumbers/components/combobox/time.rb +48 -49
  29. data/lib/stimulus_plumbers/components/combobox/trigger.rb +17 -12
  30. data/lib/stimulus_plumbers/components/combobox/typeahead.rb +63 -16
  31. data/lib/stimulus_plumbers/components/combobox.rb +58 -38
  32. data/lib/stimulus_plumbers/components/divider.rb +9 -8
  33. data/lib/stimulus_plumbers/components/icon.rb +5 -1
  34. data/lib/stimulus_plumbers/components/link/slots.rb +11 -0
  35. data/lib/stimulus_plumbers/components/link.rb +63 -0
  36. data/lib/stimulus_plumbers/components/list/item/slots.rb +13 -0
  37. data/lib/stimulus_plumbers/components/list/item.rb +83 -0
  38. data/lib/stimulus_plumbers/components/list/section.rb +73 -0
  39. data/lib/stimulus_plumbers/components/list.rb +31 -0
  40. data/lib/stimulus_plumbers/components/popover/panel.rb +32 -0
  41. data/lib/stimulus_plumbers/components/popover/trigger.rb +27 -0
  42. data/lib/stimulus_plumbers/components/popover.rb +44 -18
  43. data/lib/stimulus_plumbers/engine.rb +1 -0
  44. data/lib/stimulus_plumbers/form/base.rb +103 -0
  45. data/lib/stimulus_plumbers/form/builder.rb +71 -24
  46. data/lib/stimulus_plumbers/form/field.rb +56 -88
  47. data/lib/stimulus_plumbers/form/fields/error.rb +1 -1
  48. data/lib/stimulus_plumbers/form/fields/fieldset.rb +11 -8
  49. data/lib/stimulus_plumbers/form/fields/hint.rb +1 -1
  50. data/lib/stimulus_plumbers/form/fields/inputs/checkbox.rb +115 -0
  51. data/lib/stimulus_plumbers/form/fields/inputs/combobox.rb +24 -0
  52. data/lib/stimulus_plumbers/form/fields/inputs/datetime.rb +40 -58
  53. data/lib/stimulus_plumbers/form/fields/inputs/file.rb +9 -8
  54. data/lib/stimulus_plumbers/form/fields/inputs/password.rb +30 -23
  55. data/lib/stimulus_plumbers/form/fields/inputs/radio.rb +60 -0
  56. data/lib/stimulus_plumbers/form/fields/inputs/search.rb +31 -54
  57. data/lib/stimulus_plumbers/form/fields/inputs/select/grouped.rb +22 -33
  58. data/lib/stimulus_plumbers/form/fields/inputs/select/timezone.rb +3 -46
  59. data/lib/stimulus_plumbers/form/fields/inputs/select/weekday.rb +3 -26
  60. data/lib/stimulus_plumbers/form/fields/inputs/select.rb +62 -61
  61. data/lib/stimulus_plumbers/form/fields/inputs/submit.rb +10 -7
  62. data/lib/stimulus_plumbers/form/fields/inputs/text.rb +29 -22
  63. data/lib/stimulus_plumbers/form/fields/inputs/text_area.rb +9 -8
  64. data/lib/stimulus_plumbers/form/fields/label/floating.rb +41 -0
  65. data/lib/stimulus_plumbers/form/fields/label.rb +9 -3
  66. data/lib/stimulus_plumbers/form/fields/renderer.rb +39 -0
  67. data/lib/stimulus_plumbers/helpers/button_helper.rb +1 -1
  68. data/lib/stimulus_plumbers/helpers/calendar_helper.rb +2 -2
  69. data/lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb +56 -4
  70. data/lib/stimulus_plumbers/helpers/card_helper.rb +1 -11
  71. data/lib/stimulus_plumbers/helpers/combobox_helper.rb +27 -60
  72. data/lib/stimulus_plumbers/helpers/icon_helper.rb +11 -0
  73. data/lib/stimulus_plumbers/helpers/link_helper.rb +11 -0
  74. data/lib/stimulus_plumbers/helpers/list_helper.rb +11 -0
  75. data/lib/stimulus_plumbers/helpers/plumber_helper.rb +3 -6
  76. data/lib/stimulus_plumbers/helpers.rb +6 -2
  77. data/lib/stimulus_plumbers/logger.rb +4 -3
  78. data/lib/stimulus_plumbers/plumber/base.rb +6 -1
  79. data/lib/stimulus_plumbers/plumber/dispatcher/klass_proxy.rb +4 -3
  80. data/lib/stimulus_plumbers/plumber/dispatcher/method_call.rb +4 -3
  81. data/lib/stimulus_plumbers/plumber/dispatcher.rb +4 -4
  82. data/lib/stimulus_plumbers/plumber/options/aria.rb +17 -0
  83. data/lib/stimulus_plumbers/plumber/options/html.rb +29 -0
  84. data/lib/stimulus_plumbers/plumber/options/stimulus.rb +29 -0
  85. data/lib/stimulus_plumbers/plumber/options/theme.rb +19 -0
  86. data/lib/stimulus_plumbers/plumber/options/token_list.rb +29 -0
  87. data/lib/stimulus_plumbers/plumber/renderer.rb +136 -41
  88. data/lib/stimulus_plumbers/plumber/slots.rb +74 -0
  89. data/lib/stimulus_plumbers/themes/base.rb +5 -7
  90. data/lib/stimulus_plumbers/themes/schema/avatar/ranges.rb +13 -0
  91. data/lib/stimulus_plumbers/themes/schema/button/ranges.rb +16 -0
  92. data/lib/stimulus_plumbers/themes/schema/card/ranges.rb +13 -0
  93. data/lib/stimulus_plumbers/themes/schema/form/checkbox/ranges.rb +16 -0
  94. data/lib/stimulus_plumbers/themes/schema/form/radio/ranges.rb +16 -0
  95. data/lib/stimulus_plumbers/themes/schema/form/ranges.rb +1 -2
  96. data/lib/stimulus_plumbers/themes/schema/link/ranges.rb +14 -0
  97. data/lib/stimulus_plumbers/themes/schema/ranges.rb +1 -5
  98. data/lib/stimulus_plumbers/themes/schema.rb +119 -48
  99. data/lib/stimulus_plumbers/version.rb +1 -1
  100. data/lib/stimulus_plumbers.rb +20 -15
  101. metadata +42 -15
  102. data/lib/stimulus_plumbers/components/action_list/item.rb +0 -30
  103. data/lib/stimulus_plumbers/components/action_list/section.rb +0 -28
  104. data/lib/stimulus_plumbers/components/action_list.rb +0 -29
  105. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb +0 -149
  106. data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_week.rb +0 -43
  107. data/lib/stimulus_plumbers/components/calendar/month/turbo.rb +0 -59
  108. data/lib/stimulus_plumbers/components/card/section.rb +0 -31
  109. data/lib/stimulus_plumbers/components/combobox/popover.rb +0 -47
  110. data/lib/stimulus_plumbers/components/date_picker/navigation.rb +0 -41
  111. data/lib/stimulus_plumbers/components/date_picker/navigator.rb +0 -23
  112. data/lib/stimulus_plumbers/components/popover/builder.rb +0 -25
  113. data/lib/stimulus_plumbers/form/fields/inputs/choice.rb +0 -69
  114. data/lib/stimulus_plumbers/helpers/action_list_helper.rb +0 -25
  115. 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, P = /^-?\d+(\.\d+)?$/, F = {
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" ? P.test(e) : !1;
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
- }, I = /^\d{4}-\d{2}-\d{2}$/, ve = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, ye = /\D/g, L = {
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 (I.test(t)) return t;
391
- let n = t.match(ve);
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(ye, "");
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 = L.normalize(e);
407
- if (!I.test(t)) return !1;
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
- }, be = /^([01]?\d|2[0-3]):([0-5]\d)$/, R = {
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 (be.test(t)) {
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 R.normalize(e) !== "";
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
- }, z = {
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
- }, B = new Map([
462
- [z.PLAIN, le],
463
- [z.CREDIT_CARD, me],
464
- [z.PHONE, ge],
465
- [z.CURRENCY, F],
466
- [z.DATE, L],
467
- [z.TIME, R]
468
- ]), V = {
469
- type: z.PLAIN,
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
- }, H = class extends j {
471
+ }, V = class extends j {
472
472
  static register(e, t) {
473
- B.set(e, t);
473
+ z.set(e, t);
474
474
  }
475
475
  constructor(e, t = {}) {
476
- super(e, t), this.type = t.type ?? V.type, this.options = t.options ?? V.options, this.enhance();
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 = B.get(e.type) ?? B.get(z.PLAIN), n = {
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,30 +490,30 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
490
490
  configurable: !0
491
491
  });
492
492
  }
493
- }, U = (e, t) => new H(e, t), xe = /^\d{4}-\d{2}-\d{2}$/;
494
- function W(e) {
493
+ }, H = (e, t) => new V(e, t), Se = /^\d{4}-\d{2}-\d{2}$/;
494
+ function U(e) {
495
495
  return e instanceof Date && !isNaN(e);
496
496
  }
497
- function G(...e) {
497
+ function W(...e) {
498
498
  if (e.length === 0) throw "Missing values to parse as date";
499
499
  if (e.length === 1) {
500
500
  let t = e[0];
501
501
  if (!t) return;
502
- if (typeof t == "string" && xe.test(t)) {
502
+ if (typeof t == "string" && Se.test(t)) {
503
503
  let [e, n, r] = t.split("-").map(Number), i = new Date(e, n - 1, r);
504
- if (W(i)) return i;
504
+ if (U(i)) return i;
505
505
  } else {
506
506
  let e = new Date(t);
507
- if (W(e)) return e;
507
+ if (U(e)) return e;
508
508
  }
509
509
  } else {
510
510
  let t = new Date(...e);
511
- if (W(t)) return t;
511
+ if (U(t)) return t;
512
512
  }
513
513
  }
514
514
  //#endregion
515
515
  //#region src/plumbers/calendar.js
516
- var K = 7, q = {
516
+ var G = 7, K = {
517
517
  locales: ["default"],
518
518
  today: "",
519
519
  day: null,
@@ -528,18 +528,18 @@ var K = 7, q = {
528
528
  disabledYears: [],
529
529
  firstDayOfWeek: 0,
530
530
  onNavigated: "navigated"
531
- }, Se = class extends j {
531
+ }, Ce = class extends j {
532
532
  constructor(e, t = {}) {
533
533
  super(e, t);
534
- let n = Object.assign({}, q, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
535
- this.onNavigated = r, this.since = G(i), this.till = G(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : q.firstDayOfWeek;
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;
536
536
  let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
537
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 : [];
538
538
  let { today: f, day: p, month: m, year: h } = n;
539
- this.now = G(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = G(h, m, p) : this.current = this.now, this.build(), this.enhance();
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();
540
540
  }
541
541
  build() {
542
- 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();
543
543
  }
544
544
  buildDaysOfWeek() {
545
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 = [];
@@ -572,7 +572,7 @@ var K = 7, q = {
572
572
  let a = new Date(t, e, i);
573
573
  n.push(r(a));
574
574
  }
575
- let s = n.length % K, c = s === 0 ? 0 : K - s;
575
+ let s = n.length % G, c = s === 0 ? 0 : G - s;
576
576
  for (let i = 1; i <= c; i++) {
577
577
  let a = new Date(t, e + 1, i);
578
578
  n.push(r(a));
@@ -593,22 +593,31 @@ var K = 7, q = {
593
593
  }
594
594
  return r;
595
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
+ }
596
605
  get today() {
597
606
  return this.now;
598
607
  }
599
608
  set today(e) {
600
- if (!W(e)) return;
609
+ if (!U(e)) return;
601
610
  let t = this.month ?? e.getMonth(), n = this.year ?? e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear() ? e.getDate() : 1;
602
611
  this.now = new Date(n, t, r);
603
612
  }
604
613
  get current() {
605
- return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? G(this.year, this.month, this.day) : null;
614
+ return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? W(this.year, this.month, this.day) : null;
606
615
  }
607
616
  set current(e) {
608
- W(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
617
+ U(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
609
618
  }
610
619
  navigate = async (e) => {
611
- if (!W(e)) return;
620
+ if (!U(e)) return;
612
621
  let t = this.current, n = e.toISOString(), r = t.toISOString();
613
622
  this.dispatch("navigate", { detail: {
614
623
  from: r,
@@ -639,7 +648,7 @@ var K = 7, q = {
639
648
  await this.navigate(n);
640
649
  };
641
650
  isDisabled = (e) => {
642
- if (!W(e)) return !1;
651
+ if (!U(e)) return !1;
643
652
  if (this.disabledDates.length) {
644
653
  let t = e.getTime();
645
654
  for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
@@ -669,7 +678,7 @@ var K = 7, q = {
669
678
  return !1;
670
679
  };
671
680
  isWithinRange = (e) => {
672
- if (!W(e)) return !1;
681
+ if (!U(e)) return !1;
673
682
  let t = !0;
674
683
  return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
675
684
  };
@@ -725,6 +734,9 @@ var K = 7, q = {
725
734
  get monthsOfYear() {
726
735
  return e.monthsOfYear;
727
736
  },
737
+ get yearsOfDecade() {
738
+ return e.yearsOfDecade;
739
+ },
728
740
  navigate: async (t) => await e.navigate(t),
729
741
  step: async (t, n) => await e.step(t, n),
730
742
  isDisabled: (t) => e.isDisabled(t),
@@ -732,18 +744,18 @@ var K = 7, q = {
732
744
  };
733
745
  } });
734
746
  }
735
- }, Ce = (e, t) => new Se(e, t), J = {
747
+ }, we = (e, t) => new Ce(e, t), q = {
736
748
  content: null,
737
749
  url: "",
738
750
  reload: "never",
739
751
  stale: 3600,
740
752
  onLoad: "canLoad",
741
753
  onLoaded: "contentLoaded"
742
- }, we = class extends j {
754
+ }, Te = class extends j {
743
755
  constructor(e, t = {}) {
744
756
  super(e, t);
745
- let n = Object.assign({}, J, t), { content: r, url: i, reload: a, stale: o } = n;
746
- this.content = r, this.url = i, this.reload = typeof a == "string" ? a : J.reload, this.stale = typeof o == "number" ? o : J.stale;
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;
747
759
  let { onLoad: s, onLoaded: c } = n;
748
760
  this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
749
761
  }
@@ -752,7 +764,7 @@ var K = 7, q = {
752
764
  case "never": return !1;
753
765
  case "always": return !0;
754
766
  default: {
755
- let e = G(this.loadedAt);
767
+ let e = W(this.loadedAt);
756
768
  return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
757
769
  }
758
770
  }
@@ -778,7 +790,7 @@ var K = 7, q = {
778
790
  let e = this;
779
791
  Object.assign(this.controller, { load: e.load.bind(e) });
780
792
  }
781
- }, Te = (e, t) => new we(e, t), Y = class extends j {
793
+ }, Ee = (e, t) => new Te(e, t), J = class extends j {
782
794
  observe(e) {
783
795
  this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
784
796
  }
@@ -791,21 +803,21 @@ var K = 7, q = {
791
803
  e.unobserve(), t();
792
804
  };
793
805
  }
794
- }, Ee = {
806
+ }, De = {
795
807
  trigger: null,
796
808
  events: ["click"],
797
809
  onDismissed: "dismissed"
798
- }, De = class extends Y {
810
+ }, Oe = class extends J {
799
811
  constructor(e, t = {}) {
800
812
  super(e, t);
801
- let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Ee, t);
813
+ let { trigger: n, events: r, onDismissed: i } = Object.assign({}, De, t);
802
814
  this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
803
815
  }
804
816
  dismiss = async (e) => {
805
817
  let { target: t } = e;
806
818
  t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
807
819
  };
808
- }, X = (e, t) => new De(e, t), Oe = {
820
+ }, Y = (e, t) => new Oe(e, t), ke = {
809
821
  anchor: null,
810
822
  events: ["click"],
811
823
  placement: "bottom",
@@ -813,10 +825,10 @@ var K = 7, q = {
813
825
  onFlipped: "flipped",
814
826
  ariaRole: null,
815
827
  respectMotion: !0
816
- }, ke = class extends Y {
828
+ }, Ae = class extends J {
817
829
  constructor(e, t = {}) {
818
830
  super(e, t);
819
- let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, Oe, t);
831
+ let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, ke, t);
820
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({
821
833
  trigger: this.anchor,
822
834
  target: this.element,
@@ -932,7 +944,7 @@ var K = 7, q = {
932
944
  enhance() {
933
945
  super.enhance(), this.controller.flip = this.flip;
934
946
  }
935
- }, Ae = (e, t) => new ke(e, t), je = {
947
+ }, je = (e, t) => new Ae(e, t), Me = {
936
948
  events: ["resize"],
937
949
  boundaries: [
938
950
  "top",
@@ -941,10 +953,10 @@ var K = 7, q = {
941
953
  ],
942
954
  onShifted: "shifted",
943
955
  respectMotion: !0
944
- }, Me = class extends Y {
956
+ }, Ne = class extends J {
945
957
  constructor(e, t = {}) {
946
958
  super(e, t);
947
- let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, je, t);
959
+ let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Me, t);
948
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);
949
961
  }
950
962
  shift = async () => {
@@ -993,13 +1005,13 @@ var K = 7, q = {
993
1005
  enhance() {
994
1006
  super.enhance(), this.controller.shift = this.shift;
995
1007
  }
996
- }, Ne = (e, t) => new Me(e, t), Z = {
1008
+ }, Pe = (e, t) => new Ne(e, t), X = {
997
1009
  visibility: "visibility",
998
1010
  onShown: "shown",
999
1011
  onHidden: "hidden"
1000
- }, Pe = class extends j {
1012
+ }, Fe = class extends j {
1001
1013
  constructor(e, t = {}) {
1002
- let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Z, t), o = typeof n == "string" ? n : Z.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
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";
1003
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));
1004
1016
  }
1005
1017
  isVisible(e) {
@@ -1032,12 +1044,12 @@ var K = 7, q = {
1032
1044
  return t;
1033
1045
  } });
1034
1046
  }
1035
- }, Q = (e, t) => new Pe(e, t), $ = class extends e {
1047
+ }, Z = (e, t) => new Fe(e, t), Q = class extends e {
1036
1048
  static targets = ["daysOfWeek", "daysOfMonth"];
1037
1049
  static classes = [
1038
1050
  "dayOfWeek",
1039
1051
  "dayOfMonth",
1040
- "week"
1052
+ "row"
1041
1053
  ];
1042
1054
  static values = {
1043
1055
  locales: {
@@ -1066,7 +1078,7 @@ var K = 7, q = {
1066
1078
  }
1067
1079
  };
1068
1080
  initialize() {
1069
- Ce(this, { today: this.todayValue });
1081
+ we(this, { today: this.todayValue });
1070
1082
  }
1071
1083
  connect() {
1072
1084
  this.draw();
@@ -1078,7 +1090,7 @@ var K = 7, q = {
1078
1090
  if (!this.hasDaysOfMonthTarget || (this.daysOfMonthTarget.querySelectorAll("[aria-selected]").forEach((e) => {
1079
1091
  e.setAttribute("aria-selected", "false");
1080
1092
  }), !this.selectedValue)) return;
1081
- let e = G(this.selectedValue);
1093
+ let e = W(this.selectedValue);
1082
1094
  if (!e) return;
1083
1095
  let t = this.daysOfMonthTarget.querySelector(`time[datetime="${e.toISOString()}"]`);
1084
1096
  t && t.closest("[aria-selected]").setAttribute("aria-selected", "true");
@@ -1102,7 +1114,7 @@ var K = 7, q = {
1102
1114
  r.setAttribute("role", "columnheader"), r.title = n.long, this.hasDayOfWeekClass && r.classList.add(...this.dayOfWeekClasses), t.push(r);
1103
1115
  }
1104
1116
  let n = document.createElement("div");
1105
- n.setAttribute("role", "row"), this.hasWeekClass && n.classList.add(...this.weekClasses), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
1117
+ n.setAttribute("role", "row"), this.hasRowClass && n.classList.add(...this.rowClasses), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
1106
1118
  }
1107
1119
  drawDaysOfMonth() {
1108
1120
  if (!this.hasDaysOfMonthTarget) return;
@@ -1119,13 +1131,13 @@ var K = 7, q = {
1119
1131
  let r = [];
1120
1132
  for (let e = 0; e < n.length; e += 7) {
1121
1133
  let t = document.createElement("div");
1122
- t.setAttribute("role", "row"), this.hasWeekClass && t.classList.add(...this.weekClasses);
1134
+ t.setAttribute("role", "row"), this.hasRowClass && t.classList.add(...this.rowClasses);
1123
1135
  for (let r of n.slice(e, e + 7)) r.setAttribute("role", "gridcell"), t.appendChild(r);
1124
1136
  r.push(t);
1125
1137
  }
1126
1138
  this.daysOfMonthTarget.replaceChildren(...r);
1127
1139
  }
1128
- }, Fe = class extends e {
1140
+ }, Ie = class extends e {
1129
1141
  onSelect(e) {
1130
1142
  if (!(e.target instanceof HTMLElement)) return;
1131
1143
  e.preventDefault();
@@ -1134,18 +1146,18 @@ var K = 7, q = {
1134
1146
  this.dispatch("selecting", { target: t });
1135
1147
  let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
1136
1148
  if (!n) return console.error(`unable to locate time element within ${t}`);
1137
- let r = G(n.dateTime);
1149
+ let r = W(n.dateTime);
1138
1150
  if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
1139
1151
  this.select(r.toISOString());
1140
1152
  }
1141
1153
  select(e) {
1142
- let t = G(e);
1154
+ let t = W(e);
1143
1155
  t && this.dispatch("selected", { detail: {
1144
1156
  epoch: t.getTime(),
1145
1157
  iso: e
1146
1158
  } });
1147
1159
  }
1148
- }, Ie = class extends e {
1160
+ }, Le = class extends e {
1149
1161
  static targets = ["source"];
1150
1162
  static values = { contentType: {
1151
1163
  type: String,
@@ -1175,17 +1187,29 @@ var K = 7, q = {
1175
1187
  });
1176
1188
  }
1177
1189
  }
1178
- }, Le = class extends e {
1190
+ }, $ = [
1191
+ "month",
1192
+ "year",
1193
+ "decade"
1194
+ ], Re = class extends e {
1179
1195
  static targets = [
1180
1196
  "previous",
1181
1197
  "next",
1182
1198
  "day",
1183
1199
  "month",
1184
- "year"
1200
+ "year",
1201
+ "viewTitle",
1202
+ "monthView",
1203
+ "yearView",
1204
+ "decadeView"
1185
1205
  ];
1186
1206
  static outlets = ["calendar-month"];
1187
1207
  static values = {
1188
1208
  date: String,
1209
+ view: {
1210
+ type: String,
1211
+ default: "month"
1212
+ },
1189
1213
  locales: {
1190
1214
  type: Array,
1191
1215
  default: ["default"]
@@ -1204,11 +1228,11 @@ var K = 7, q = {
1204
1228
  }
1205
1229
  };
1206
1230
  initialize() {
1207
- 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);
1208
1232
  }
1209
1233
  async calendarMonthOutletConnected() {
1210
1234
  if (this.dateValue) {
1211
- let e = G(this.dateValue);
1235
+ let e = W(this.dateValue);
1212
1236
  e && await this.calendarMonthOutlet.calendar.navigate(e);
1213
1237
  }
1214
1238
  this.draw();
@@ -1219,6 +1243,22 @@ var K = 7, q = {
1219
1243
  bubbles: !0
1220
1244
  });
1221
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
+ }
1222
1262
  previousTargetConnected(e) {
1223
1263
  e.addEventListener("click", this.previous);
1224
1264
  }
@@ -1226,7 +1266,7 @@ var K = 7, q = {
1226
1266
  e.removeEventListener("click", this.previous);
1227
1267
  }
1228
1268
  async previous() {
1229
- await this.calendarMonthOutlet.calendar.step("month", -1), this.draw();
1269
+ await this.calendarMonthOutlet.calendar.step(...this.stepArgs(-1)), this.draw();
1230
1270
  }
1231
1271
  nextTargetConnected(e) {
1232
1272
  e.addEventListener("click", this.next);
@@ -1235,10 +1275,22 @@ var K = 7, q = {
1235
1275
  e.removeEventListener("click", this.next);
1236
1276
  }
1237
1277
  async next() {
1238
- await this.calendarMonthOutlet.calendar.step("month", 1), this.draw();
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);
1239
1291
  }
1240
1292
  draw() {
1241
- this.drawDay(), this.drawMonth(), this.drawYear();
1293
+ this.drawDay(), this.drawMonth(), this.drawYear(), this.drawViewTitle(), this.drawYearView(), this.drawDecadeView(), this.drawView();
1242
1294
  }
1243
1295
  drawDay() {
1244
1296
  if (!this.hasDayTarget || !this.hasCalendarMonthOutlet) return;
@@ -1255,7 +1307,50 @@ var K = 7, q = {
1255
1307
  let { year: e } = this.calendarMonthOutlet.calendar;
1256
1308
  this.yearTarget.textContent = new Intl.DateTimeFormat(this.localesValue, { year: this.yearFormatValue }).format(new Date(e, 0));
1257
1309
  }
1258
- }, Re = class extends e {
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 {
1259
1354
  static targets = [
1260
1355
  "listbox",
1261
1356
  "loading",
@@ -1336,7 +1431,7 @@ var K = 7, q = {
1336
1431
  disconnect() {
1337
1432
  this._requestor.cancel();
1338
1433
  }
1339
- }, ze = class extends e {
1434
+ }, Be = class extends e {
1340
1435
  static targets = [
1341
1436
  "hour",
1342
1437
  "minute",
@@ -1372,12 +1467,12 @@ var K = 7, q = {
1372
1467
  selectedValue(e) {
1373
1468
  return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
1374
1469
  }
1375
- }, Be = class extends e {
1470
+ }, Ve = class extends e {
1376
1471
  static targets = ["trigger"];
1377
1472
  connect() {
1378
- X(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1473
+ Y(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
1379
1474
  }
1380
- }, Ve = class extends e {
1475
+ }, He = class extends e {
1381
1476
  static targets = ["anchor", "reference"];
1382
1477
  static values = {
1383
1478
  placement: {
@@ -1402,7 +1497,7 @@ var K = 7, q = {
1402
1497
  console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
1403
1498
  return;
1404
1499
  }
1405
- Ae(this, {
1500
+ je(this, {
1406
1501
  element: this.referenceTarget,
1407
1502
  anchor: this.anchorTarget,
1408
1503
  placement: this.placementValue,
@@ -1410,12 +1505,8 @@ var K = 7, q = {
1410
1505
  ariaRole: this.roleValue
1411
1506
  });
1412
1507
  }
1413
- }, He = class extends e {
1414
- static targets = [
1415
- "trigger",
1416
- "popover",
1417
- "input"
1418
- ];
1508
+ }, Ue = class extends e {
1509
+ static targets = ["trigger", "input"];
1419
1510
  static values = {
1420
1511
  value: String,
1421
1512
  minLength: {
@@ -1424,32 +1515,8 @@ var K = 7, q = {
1424
1515
  }
1425
1516
  };
1426
1517
  static outlets = ["combobox-dropdown"];
1427
- connect() {
1428
- X(this), this.hasPopoverTarget && Q(this, {
1429
- element: this.popoverTarget,
1430
- activator: this.hasTriggerTarget ? this.triggerTarget : null
1431
- });
1432
- }
1433
- async dismissed() {
1434
- await this.close();
1435
- }
1436
- async open() {
1437
- this.hasPopoverTarget && await this.visibility.show();
1438
- }
1439
- async close() {
1440
- this.hasPopoverTarget && await this.visibility.hide();
1441
- }
1442
- async toggle() {
1443
- this.visibility?.visible ? await this.close() : await this.open();
1444
- }
1445
- async shown() {
1446
- this.hasPopoverTarget && i(this.popoverTarget);
1447
- }
1448
- async hidden() {
1449
- this.hasTriggerTarget && this.triggerTarget.focus();
1450
- }
1451
- async onSelect(e) {
1452
- 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);
1453
1520
  }
1454
1521
  onInput(e) {
1455
1522
  if (e.target !== this.triggerTarget) return;
@@ -1463,7 +1530,7 @@ var K = 7, q = {
1463
1530
  valueValueChanged(e) {
1464
1531
  this.hasInputTarget && (this.inputTarget.value = e), this.dispatch("changed", { detail: { value: e } });
1465
1532
  }
1466
- }, Ue = class extends e {
1533
+ }, We = class extends e {
1467
1534
  static targets = ["input", "toggle"];
1468
1535
  static values = {
1469
1536
  format: {
@@ -1480,19 +1547,19 @@ var K = 7, q = {
1480
1547
  }
1481
1548
  };
1482
1549
  connect() {
1483
- U(this, {
1550
+ H(this, {
1484
1551
  type: this.formatValue,
1485
1552
  options: this.optionsValue
1486
1553
  }), this.format(this.readValue()), this.drawToggle();
1487
1554
  }
1488
1555
  formatValueChanged() {
1489
- this.formatter && (U(this, {
1556
+ this.formatter && (H(this, {
1490
1557
  type: this.formatValue,
1491
1558
  options: this.optionsValue
1492
1559
  }), this.format(this.readValue()), this.drawToggle());
1493
1560
  }
1494
1561
  optionsValueChanged() {
1495
- this.formatter && (U(this, {
1562
+ this.formatter && (H(this, {
1496
1563
  type: this.formatValue,
1497
1564
  options: this.optionsValue
1498
1565
  }), this.format(this.readValue()));
@@ -1532,7 +1599,7 @@ var K = 7, q = {
1532
1599
  let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
1533
1600
  this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
1534
1601
  }
1535
- }, We = class extends e {
1602
+ }, Ge = class extends e {
1536
1603
  static targets = ["input", "clear"];
1537
1604
  initialize() {
1538
1605
  this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
@@ -1555,7 +1622,7 @@ var K = 7, q = {
1555
1622
  handleEscape(e) {
1556
1623
  e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
1557
1624
  }
1558
- }, Ge = class extends e {
1625
+ }, Ke = class extends e {
1559
1626
  static targets = ["modal", "overlay"];
1560
1627
  initialize() {
1561
1628
  this.onCancel = this.close.bind(this);
@@ -1564,7 +1631,7 @@ var K = 7, q = {
1564
1631
  this.hasModalTarget || console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
1565
1632
  }
1566
1633
  modalTargetConnected(e) {
1567
- this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, { escapeDeactivates: !0 }), X(this, { element: e }));
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 }));
1568
1635
  }
1569
1636
  modalTargetDisconnected(e) {
1570
1637
  this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
@@ -1598,17 +1665,17 @@ var K = 7, q = {
1598
1665
  let t = this.modalTarget.getBoundingClientRect();
1599
1666
  (e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
1600
1667
  };
1601
- }, Ke = class extends e {
1668
+ }, qe = class extends e {
1602
1669
  static targets = ["content"];
1603
1670
  connect() {
1604
- Ne(this, { element: this.hasContentTarget ? this.contentTarget : null });
1671
+ Pe(this, { element: this.hasContentTarget ? this.contentTarget : null });
1605
1672
  }
1606
- }, qe = class extends e {
1673
+ }, Je = class extends e {
1607
1674
  static targets = [
1608
- "content",
1675
+ "trigger",
1676
+ "panel",
1609
1677
  "template",
1610
- "loader",
1611
- "activator"
1678
+ "loader"
1612
1679
  ];
1613
1680
  static classes = ["hidden"];
1614
1681
  static values = {
@@ -1621,37 +1688,53 @@ var K = 7, q = {
1621
1688
  staleAfter: {
1622
1689
  type: Number,
1623
1690
  default: 3600
1691
+ },
1692
+ closeOnSelect: {
1693
+ type: Boolean,
1694
+ default: !0
1624
1695
  }
1625
1696
  };
1626
1697
  connect() {
1627
- Te(this, {
1628
- element: this.hasContentTarget ? this.contentTarget : null,
1698
+ Ee(this, {
1699
+ element: this.hasPanelTarget ? this.panelTarget : null,
1629
1700
  url: this.hasUrlValue ? this.urlValue : null
1630
- }), this.hasContentTarget && Q(this, {
1631
- element: this.contentTarget,
1632
- activator: this.hasActivatorTarget ? this.activatorTarget : null
1633
- }), this.hasLoaderTarget && Q(this, {
1701
+ }), this.hasPanelTarget && (Z(this, {
1702
+ element: this.panelTarget,
1703
+ activator: this.hasTriggerTarget ? this.triggerTarget : null
1704
+ }), Y(this)), this.hasLoaderTarget && Z(this, {
1634
1705
  element: this.loaderTarget,
1635
1706
  visibility: "contentLoaderVisibility"
1636
1707
  });
1637
1708
  }
1638
- async show() {
1639
- await this.visibility.show();
1709
+ async dismissed() {
1710
+ await this.close();
1640
1711
  }
1641
- async hide() {
1642
- await this.visibility.hide();
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();
1643
1723
  }
1644
1724
  async shown() {
1645
- await this.load();
1725
+ await this.load(), this.hasPanelTarget && i(this.panelTarget);
1726
+ }
1727
+ async hidden() {
1728
+ this.hasTriggerTarget && this.triggerTarget.focus();
1646
1729
  }
1647
1730
  canLoad() {
1648
- return this.hasContentTarget && this.contentTarget.tagName.toLowerCase() === "turbo-frame" ? (this.hasUrlValue && this.contentTarget.setAttribute("src", this.urlValue), !1) : !0;
1731
+ return this.hasPanelTarget && this.panelTarget.tagName.toLowerCase() === "turbo-frame" ? (this.hasUrlValue && this.panelTarget.setAttribute("src", this.urlValue), !1) : !0;
1649
1732
  }
1650
1733
  async contentLoading() {
1651
1734
  this.hasLoaderTarget && await this.contentLoaderVisibility.show();
1652
1735
  }
1653
1736
  async contentLoaded({ content: e }) {
1654
- this.hasContentTarget && this.contentTarget.replaceChildren(this.getContentNode(e)), this.hasLoaderTarget && await this.contentLoaderVisibility.hide();
1737
+ this.hasPanelTarget && this.panelTarget.replaceChildren(this.getContentNode(e)), this.hasLoaderTarget && await this.contentLoaderVisibility.hide();
1655
1738
  }
1656
1739
  getContentNode(e) {
1657
1740
  if (typeof e == "string") {
@@ -1665,4 +1748,4 @@ var K = 7, q = {
1665
1748
  }
1666
1749
  };
1667
1750
  //#endregion
1668
- export { y as ARIA_HASPOPUP_VALUES, $ as CalendarMonthController, Fe as CalendarMonthObserverController, Ie as ClipboardController, Le as ComboboxDateController, Re as ComboboxDropdownController, ze as ComboboxTimeController, Be as DismisserController, t as FOCUSABLE_SELECTOR, z as FORMATTER_TYPES, Ve as FlipperController, o as FocusRestoration, a as FocusTrap, H as Formatter, We as InputClearableController, He as InputComboboxController, Ue as InputFormatterController, Ge as ModalController, Ke as PannerController, qe 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 };
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 };