@stimulus-plumbers/controllers 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -8
- package/dist/controllers.manifest.json +125 -12
- package/dist/stimulus-plumbers-controllers.es.js +681 -312
- package/dist/stimulus-plumbers-controllers.umd.js +1 -1
- package/package.json +1 -1
- package/src/accessibility/aria.js +6 -0
- package/src/accessibility/focus.js +4 -20
- package/src/accessibility/keyboard.js +134 -28
- package/src/controllers/calendar_decade_controller.js +99 -0
- package/src/controllers/calendar_decade_selector_controller.js +14 -0
- package/src/controllers/calendar_month_controller.js +69 -17
- package/src/controllers/calendar_month_selector_controller.js +14 -0
- package/src/controllers/calendar_year_controller.js +104 -0
- package/src/controllers/calendar_year_selector_controller.js +14 -0
- package/src/controllers/combobox_date_controller.js +36 -85
- package/src/controllers/combobox_dropdown_controller.js +12 -25
- package/src/controllers/input_combobox_controller.js +0 -1
- package/src/controllers/modal_controller.js +4 -1
- package/src/controllers/popover_controller.js +5 -0
- package/src/controllers/timeline_controller.js +71 -0
- package/src/index.js +6 -1
- package/src/plumbers/calendar-selector.js +85 -0
- package/src/plumbers/calendar.js +25 -13
- package/src/plumbers/index.js +5 -0
- package/src/plumbers/visibility.js +3 -3
- package/src/controllers/calendar_observer_controller.js +0 -27
|
@@ -33,7 +33,7 @@ var a = class {
|
|
|
33
33
|
if (!this.isActive) return;
|
|
34
34
|
this.isActive = !1, this.container.removeEventListener("keydown", this.handleKeyDown);
|
|
35
35
|
let e = this.options.returnFocus || this.previouslyFocused;
|
|
36
|
-
e && r(e) && e.focus();
|
|
36
|
+
e && r(e) && e.focus(), typeof this.options.onDeactivate == "function" && this.options.onDeactivate();
|
|
37
37
|
}
|
|
38
38
|
handleKeyDown = (e) => {
|
|
39
39
|
if (e.key === "Escape" && this.options.escapeDeactivates) {
|
|
@@ -46,26 +46,16 @@ var a = class {
|
|
|
46
46
|
let r = t[0], i = t[t.length - 1];
|
|
47
47
|
e.shiftKey && document.activeElement === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && document.activeElement === i && (e.preventDefault(), r.focus());
|
|
48
48
|
};
|
|
49
|
-
}, o = class {
|
|
50
|
-
constructor() {
|
|
51
|
-
this.savedElement = null;
|
|
52
|
-
}
|
|
53
|
-
save() {
|
|
54
|
-
this.savedElement = document.activeElement;
|
|
55
|
-
}
|
|
56
|
-
restore() {
|
|
57
|
-
this.savedElement && r(this.savedElement) && (this.savedElement.focus(), this.savedElement = null);
|
|
58
|
-
}
|
|
59
49
|
};
|
|
60
50
|
//#endregion
|
|
61
51
|
//#region src/accessibility/keyboard.js
|
|
62
|
-
function
|
|
52
|
+
function o(e, t) {
|
|
63
53
|
return e.key === t;
|
|
64
54
|
}
|
|
65
|
-
function
|
|
55
|
+
function s(e) {
|
|
66
56
|
return e.key === "Enter" || e.key === " ";
|
|
67
57
|
}
|
|
68
|
-
function
|
|
58
|
+
function c(e) {
|
|
69
59
|
return [
|
|
70
60
|
"ArrowUp",
|
|
71
61
|
"ArrowDown",
|
|
@@ -73,60 +63,135 @@ function l(e) {
|
|
|
73
63
|
"ArrowRight"
|
|
74
64
|
].includes(e.key);
|
|
75
65
|
}
|
|
76
|
-
function
|
|
66
|
+
function l(e) {
|
|
77
67
|
e.preventDefault(), e.stopPropagation();
|
|
78
68
|
}
|
|
79
|
-
var
|
|
80
|
-
constructor(e, t =
|
|
81
|
-
this.items = e, this.currentIndex = t, this.
|
|
69
|
+
var u = class {
|
|
70
|
+
constructor(e, t = {}) {
|
|
71
|
+
this.items = Array.from(e), this.currentIndex = t.initialIndex ?? 0, this.orientation = t.orientation ?? "both", this.wrap = t.wrap ?? !0, this._handleKeyDown = this._handleKeyDown.bind(this), this._handleClick = this._handleClick.bind(this);
|
|
82
72
|
}
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
activate() {
|
|
74
|
+
return this.updateTabIndex(), this.items.forEach((e) => {
|
|
75
|
+
e.addEventListener("keydown", this._handleKeyDown), e.addEventListener("click", this._handleClick);
|
|
76
|
+
}), this;
|
|
77
|
+
}
|
|
78
|
+
deactivate() {
|
|
79
|
+
this.items.forEach((e) => {
|
|
80
|
+
e.removeEventListener("keydown", this._handleKeyDown), e.removeEventListener("click", this._handleClick);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
updateItems(e) {
|
|
84
|
+
this.deactivate(), this.items = Array.from(e), this.currentIndex = Math.min(this.currentIndex, Math.max(0, this.items.length - 1)), this.activate();
|
|
85
|
+
}
|
|
86
|
+
setCurrentIndex(e) {
|
|
87
|
+
e >= 0 && e < this.items.length && (this.currentIndex = e, this.updateTabIndex(), this.items[e].focus());
|
|
88
|
+
}
|
|
89
|
+
updateTabIndex() {
|
|
90
|
+
this.items.forEach((e, t) => {
|
|
91
|
+
e.tabIndex = t === this.currentIndex ? 0 : -1;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
_handleClick(e) {
|
|
95
|
+
let t = this.items.indexOf(e.currentTarget);
|
|
96
|
+
t !== -1 && (this.currentIndex = t, this.updateTabIndex());
|
|
97
|
+
}
|
|
98
|
+
_handleKeyDown(e) {
|
|
99
|
+
let t = this.items.indexOf(e.currentTarget);
|
|
100
|
+
t !== -1 && t !== this.currentIndex && (this.currentIndex = t, this.updateTabIndex());
|
|
101
|
+
let n = this.orientation === "horizontal" ? [] : ["ArrowUp", "ArrowDown"], r = this.orientation === "vertical" ? [] : ["ArrowLeft", "ArrowRight"];
|
|
102
|
+
if (![
|
|
103
|
+
...n,
|
|
104
|
+
...r,
|
|
105
|
+
"Home",
|
|
106
|
+
"End"
|
|
107
|
+
].includes(e.key)) return;
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
let i = t === -1 ? this.currentIndex : t, a;
|
|
85
110
|
switch (e.key) {
|
|
86
111
|
case "ArrowDown":
|
|
87
112
|
case "ArrowRight":
|
|
88
|
-
|
|
113
|
+
a = this.wrap ? (i + 1) % this.items.length : Math.min(i + 1, this.items.length - 1);
|
|
89
114
|
break;
|
|
90
115
|
case "ArrowUp":
|
|
91
116
|
case "ArrowLeft":
|
|
92
|
-
|
|
117
|
+
a = this.wrap ? (i - 1 + this.items.length) % this.items.length : Math.max(i - 1, 0);
|
|
93
118
|
break;
|
|
94
119
|
case "Home":
|
|
95
|
-
|
|
120
|
+
a = 0;
|
|
96
121
|
break;
|
|
97
122
|
case "End":
|
|
98
|
-
|
|
123
|
+
a = this.items.length - 1;
|
|
99
124
|
break;
|
|
100
|
-
default: return;
|
|
101
125
|
}
|
|
102
|
-
this.setCurrentIndex(
|
|
126
|
+
this.setCurrentIndex(a);
|
|
103
127
|
}
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
}, d = class {
|
|
129
|
+
constructor(e, t = {}) {
|
|
130
|
+
this.listbox = e, this.itemSelector = t.itemSelector ?? "[role=\"option\"]:not([aria-disabled=\"true\"]):not([hidden])", this.wrap = t.wrap ?? !1, this.orientation = t.orientation ?? "vertical";
|
|
106
131
|
}
|
|
107
|
-
|
|
108
|
-
this.
|
|
109
|
-
e.tabIndex = t === this.currentIndex ? 0 : -1;
|
|
110
|
-
});
|
|
132
|
+
get selectedItem() {
|
|
133
|
+
return this.listbox.querySelector(`${this.itemSelector}[aria-selected="true"]`) ?? null;
|
|
111
134
|
}
|
|
112
|
-
|
|
113
|
-
|
|
135
|
+
get currentIndex() {
|
|
136
|
+
return Array.from(this.listbox.querySelectorAll(this.itemSelector)).indexOf(this.selectedItem);
|
|
137
|
+
}
|
|
138
|
+
_selectItem(e) {
|
|
139
|
+
Array.from(this.listbox.querySelectorAll(this.itemSelector)).forEach((e) => e.setAttribute("aria-selected", "false")), e.setAttribute("aria-selected", "true"), e.scrollIntoView({ block: "nearest" });
|
|
114
140
|
}
|
|
115
|
-
|
|
141
|
+
step(e) {
|
|
142
|
+
let t = Array.from(this.listbox.querySelectorAll(this.itemSelector));
|
|
143
|
+
if (!t.length) return;
|
|
144
|
+
let n = this.listbox.querySelector(`${this.itemSelector}[aria-selected="true"]`), r = t.indexOf(n), i;
|
|
145
|
+
i = e > 0 ? this.wrap ? t[(r + 1) % t.length] : t[Math.min(r + 1, t.length - 1)] : this.wrap ? t[(r - 1 + t.length) % t.length] : t[Math.max(r - 1, 0)], !(!i || i === n) && this._selectItem(i);
|
|
146
|
+
}
|
|
147
|
+
handleKeyDown(e) {
|
|
148
|
+
let t = this.orientation === "horizontal" ? [] : ["ArrowUp", "ArrowDown"], n = this.orientation === "vertical" ? [] : ["ArrowLeft", "ArrowRight"];
|
|
149
|
+
if (![
|
|
150
|
+
...t,
|
|
151
|
+
...n,
|
|
152
|
+
"Home",
|
|
153
|
+
"End",
|
|
154
|
+
"Enter",
|
|
155
|
+
" "
|
|
156
|
+
].includes(e.key)) return;
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
let r = Array.from(this.listbox.querySelectorAll(this.itemSelector));
|
|
159
|
+
switch (e.key) {
|
|
160
|
+
case "ArrowDown":
|
|
161
|
+
case "ArrowRight":
|
|
162
|
+
this.step(1);
|
|
163
|
+
break;
|
|
164
|
+
case "ArrowUp":
|
|
165
|
+
case "ArrowLeft":
|
|
166
|
+
this.step(-1);
|
|
167
|
+
break;
|
|
168
|
+
case "Home":
|
|
169
|
+
r.length && this._selectItem(r[0]);
|
|
170
|
+
break;
|
|
171
|
+
case "End":
|
|
172
|
+
r.length && this._selectItem(r[r.length - 1]);
|
|
173
|
+
break;
|
|
174
|
+
case "Enter":
|
|
175
|
+
case " ":
|
|
176
|
+
this.listbox.querySelector(`${this.itemSelector}[aria-selected="true"]`)?.click();
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}, ee = (e, t, n) => {
|
|
116
181
|
let r = document.querySelector(`[data-live-region="${e}"]`);
|
|
117
182
|
return r || (r = document.createElement("div"), r.className = "sr-only", r.dataset.liveRegion = e, r.setAttribute("aria-live", e), r.setAttribute("aria-atomic", t.toString()), r.setAttribute("aria-relevant", n), document.body.appendChild(r)), r;
|
|
118
183
|
};
|
|
119
|
-
function
|
|
120
|
-
let { politeness: n = "polite", atomic: r = !0, relevant: i = "additions text" } = t, a =
|
|
184
|
+
function f(e, t = {}) {
|
|
185
|
+
let { politeness: n = "polite", atomic: r = !0, relevant: i = "additions text" } = t, a = ee(n, r, i);
|
|
121
186
|
a.textContent = "", setTimeout(() => {
|
|
122
187
|
a.textContent = e;
|
|
123
188
|
}, 100);
|
|
124
189
|
}
|
|
125
|
-
var
|
|
190
|
+
var p = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, m = (e, t = "element") => e.id ||= p(t), h = (e, t, n) => {
|
|
126
191
|
e.setAttribute(t, n.toString());
|
|
127
|
-
},
|
|
128
|
-
function
|
|
129
|
-
|
|
192
|
+
}, g = (e, t) => h(e, "aria-expanded", t), _ = (e, t) => h(e, "aria-pressed", t), te = (e, t) => h(e, "aria-checked", t), v = (e, t) => t ? e.setAttribute("hidden", "") : e.removeAttribute("hidden");
|
|
193
|
+
function ne(e, t) {
|
|
194
|
+
h(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
|
|
130
195
|
}
|
|
131
196
|
var y = {
|
|
132
197
|
menu: "menu",
|
|
@@ -157,7 +222,7 @@ var C = (e, t) => {
|
|
|
157
222
|
e.hasAttribute(t) && e.removeAttribute(t);
|
|
158
223
|
});
|
|
159
224
|
};
|
|
160
|
-
function
|
|
225
|
+
function re({ trigger: e, target: t, attributes: n = null }) {
|
|
161
226
|
!e || !t || (C(e, n || [
|
|
162
227
|
"aria-controls",
|
|
163
228
|
"aria-haspopup",
|
|
@@ -193,28 +258,28 @@ function T(e, t) {
|
|
|
193
258
|
for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
|
|
194
259
|
return n === e.length;
|
|
195
260
|
}
|
|
196
|
-
function
|
|
261
|
+
function ie(e, t) {
|
|
197
262
|
return t.includes(e);
|
|
198
263
|
}
|
|
199
|
-
function
|
|
264
|
+
function ae(e, t) {
|
|
200
265
|
return t.startsWith(e);
|
|
201
266
|
}
|
|
202
|
-
function
|
|
203
|
-
return e === "contains" ?
|
|
267
|
+
function oe(e) {
|
|
268
|
+
return e === "contains" ? ie : e === "prefix" ? ae : T;
|
|
204
269
|
}
|
|
205
|
-
function
|
|
270
|
+
function se(e, t) {
|
|
206
271
|
return t === "textContent" ? e.textContent?.trim().toLowerCase() ?? "" : (e.getAttribute(t) ?? "").toLowerCase();
|
|
207
272
|
}
|
|
208
273
|
function E(e, t, n = {}) {
|
|
209
|
-
let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i :
|
|
274
|
+
let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : oe(r), s = t.toLowerCase(), c = 0;
|
|
210
275
|
return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
|
|
211
|
-
let t = a.some((t) => o(s,
|
|
276
|
+
let t = a.some((t) => o(s, se(e, t)));
|
|
212
277
|
e.hidden = !t, t && c++;
|
|
213
278
|
}), c;
|
|
214
279
|
}
|
|
215
280
|
//#endregion
|
|
216
281
|
//#region src/plumbers/plumber/geometry.js
|
|
217
|
-
var
|
|
282
|
+
var ce = {
|
|
218
283
|
get top() {
|
|
219
284
|
return "bottom";
|
|
220
285
|
},
|
|
@@ -228,7 +293,7 @@ var D = {
|
|
|
228
293
|
return "left";
|
|
229
294
|
}
|
|
230
295
|
};
|
|
231
|
-
function
|
|
296
|
+
function D({ x: e, y: t, width: n, height: r }) {
|
|
232
297
|
return {
|
|
233
298
|
x: e,
|
|
234
299
|
y: t,
|
|
@@ -240,39 +305,39 @@ function O({ x: e, y: t, width: n, height: r }) {
|
|
|
240
305
|
bottom: t + r
|
|
241
306
|
};
|
|
242
307
|
}
|
|
243
|
-
function
|
|
244
|
-
return
|
|
308
|
+
function O() {
|
|
309
|
+
return D({
|
|
245
310
|
x: 0,
|
|
246
311
|
y: 0,
|
|
247
312
|
width: window.innerWidth || document.documentElement.clientWidth,
|
|
248
313
|
height: window.innerHeight || document.documentElement.clientHeight
|
|
249
314
|
});
|
|
250
315
|
}
|
|
251
|
-
function
|
|
316
|
+
function le(e) {
|
|
252
317
|
if (!(e instanceof HTMLElement)) return !1;
|
|
253
|
-
let t =
|
|
318
|
+
let t = O(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
|
|
254
319
|
return r && i;
|
|
255
320
|
}
|
|
256
321
|
//#endregion
|
|
257
322
|
//#region src/plumbers/plumber/config.js
|
|
258
|
-
var
|
|
323
|
+
var k = {
|
|
259
324
|
get visibleOnly() {
|
|
260
325
|
return !0;
|
|
261
326
|
},
|
|
262
327
|
hiddenClass: null
|
|
263
|
-
},
|
|
328
|
+
}, ue = {
|
|
264
329
|
element: null,
|
|
265
330
|
visible: null,
|
|
266
331
|
dispatch: !0,
|
|
267
332
|
prefix: ""
|
|
268
|
-
},
|
|
333
|
+
}, A = class {
|
|
269
334
|
constructor(e, t = {}) {
|
|
270
335
|
this.controller = e;
|
|
271
|
-
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({},
|
|
272
|
-
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r :
|
|
336
|
+
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ue, t);
|
|
337
|
+
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : k.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
|
|
273
338
|
}
|
|
274
339
|
get visible() {
|
|
275
|
-
return this.element instanceof HTMLElement ? this.visibleOnly ?
|
|
340
|
+
return this.element instanceof HTMLElement ? this.visibleOnly ? le(this.element) && this.isVisible(this.element) : !0 : !1;
|
|
276
341
|
}
|
|
277
342
|
isVisible(e) {
|
|
278
343
|
if (this.visibleCallback) {
|
|
@@ -301,7 +366,7 @@ var A = {
|
|
|
301
366
|
return n instanceof Promise ? await n : n;
|
|
302
367
|
}
|
|
303
368
|
}
|
|
304
|
-
},
|
|
369
|
+
}, de = {
|
|
305
370
|
normalize(e) {
|
|
306
371
|
return typeof e == "string" ? e : "";
|
|
307
372
|
},
|
|
@@ -311,7 +376,7 @@ var A = {
|
|
|
311
376
|
};
|
|
312
377
|
//#endregion
|
|
313
378
|
//#region src/plumbers/formatters/credit_card.js
|
|
314
|
-
function
|
|
379
|
+
function fe(e) {
|
|
315
380
|
let t = 0, n = !1;
|
|
316
381
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
317
382
|
let i = parseInt(e[r], 10);
|
|
@@ -319,32 +384,32 @@ function ue(e) {
|
|
|
319
384
|
}
|
|
320
385
|
return t % 10 == 0;
|
|
321
386
|
}
|
|
322
|
-
var
|
|
387
|
+
var pe = /\D/g, me = /^\d{13,19}$/, he = /(.{4})(?=.)/g, ge = {
|
|
323
388
|
normalize(e) {
|
|
324
|
-
return typeof e == "string" ? e.replace(
|
|
389
|
+
return typeof e == "string" ? e.replace(pe, "") : "";
|
|
325
390
|
},
|
|
326
391
|
validate(e) {
|
|
327
|
-
return typeof e != "string" || !
|
|
392
|
+
return typeof e != "string" || !me.test(e) ? !1 : fe(e);
|
|
328
393
|
},
|
|
329
394
|
format(e) {
|
|
330
|
-
return typeof e == "string" ? e.replace(
|
|
395
|
+
return typeof e == "string" ? e.replace(he, "$1 ") : "";
|
|
331
396
|
}
|
|
332
|
-
},
|
|
397
|
+
}, j = { 1: 10 }, M = /\D/g, _e = /^\+\d{7,15}$/, ve = {
|
|
333
398
|
normalize(e) {
|
|
334
399
|
if (typeof e != "string") return "";
|
|
335
|
-
let t = e.trimStart().startsWith("+"), n = e.replace(
|
|
400
|
+
let t = e.trimStart().startsWith("+"), n = e.replace(M, "");
|
|
336
401
|
return t ? `+${n}` : n;
|
|
337
402
|
},
|
|
338
403
|
validate(e) {
|
|
339
404
|
if (typeof e != "string") return !1;
|
|
340
|
-
if (
|
|
341
|
-
let t = e.replace(
|
|
342
|
-
return Object.values(
|
|
405
|
+
if (_e.test(e)) return !0;
|
|
406
|
+
let t = e.replace(M, "");
|
|
407
|
+
return Object.values(j).includes(t.length);
|
|
343
408
|
},
|
|
344
409
|
format(e) {
|
|
345
410
|
if (typeof e != "string") return "";
|
|
346
|
-
let t = e.replace(
|
|
347
|
-
for (let [e, n] of Object.entries(
|
|
411
|
+
let t = e.replace(M, "");
|
|
412
|
+
for (let [e, n] of Object.entries(j)) {
|
|
348
413
|
if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
|
|
349
414
|
let r = n + e.length;
|
|
350
415
|
if (t.length === r && t.startsWith(e)) {
|
|
@@ -354,16 +419,16 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
354
419
|
}
|
|
355
420
|
return e;
|
|
356
421
|
}
|
|
357
|
-
},
|
|
422
|
+
}, ye = /[^\d.,-]/g, be = /^-?\d+(\.\d+)?$/, xe = {
|
|
358
423
|
normalize(e) {
|
|
359
424
|
if (typeof e != "string") return "";
|
|
360
|
-
let t = e.replace(
|
|
425
|
+
let t = e.replace(ye, "");
|
|
361
426
|
if (!t) return "";
|
|
362
427
|
let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
|
|
363
428
|
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
429
|
},
|
|
365
430
|
validate(e) {
|
|
366
|
-
return typeof e == "string" ?
|
|
431
|
+
return typeof e == "string" ? be.test(e) : !1;
|
|
367
432
|
},
|
|
368
433
|
format(e, t = {}) {
|
|
369
434
|
if (typeof e != "string") return "";
|
|
@@ -383,18 +448,18 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
383
448
|
return e;
|
|
384
449
|
}
|
|
385
450
|
}
|
|
386
|
-
},
|
|
451
|
+
}, N = /^\d{4}-\d{2}-\d{2}$/, Se = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, Ce = /\D/g, P = {
|
|
387
452
|
normalize(e) {
|
|
388
453
|
if (typeof e != "string") return "";
|
|
389
454
|
let t = e.trim();
|
|
390
|
-
if (
|
|
391
|
-
let n = t.match(
|
|
455
|
+
if (N.test(t)) return t;
|
|
456
|
+
let n = t.match(Se);
|
|
392
457
|
if (n) {
|
|
393
458
|
let [, e, t, r] = n;
|
|
394
459
|
if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
|
|
395
460
|
if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
|
|
396
461
|
}
|
|
397
|
-
let r = t.replace(
|
|
462
|
+
let r = t.replace(Ce, "");
|
|
398
463
|
if (r.length === 8) {
|
|
399
464
|
let e = parseInt(r.slice(0, 4), 10);
|
|
400
465
|
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 +468,8 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
403
468
|
},
|
|
404
469
|
validate(e) {
|
|
405
470
|
if (typeof e != "string") return !1;
|
|
406
|
-
let t =
|
|
407
|
-
if (!
|
|
471
|
+
let t = P.normalize(e);
|
|
472
|
+
if (!N.test(t)) return !1;
|
|
408
473
|
let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
|
|
409
474
|
return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
|
|
410
475
|
},
|
|
@@ -424,11 +489,11 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
424
489
|
return e;
|
|
425
490
|
}
|
|
426
491
|
}
|
|
427
|
-
},
|
|
492
|
+
}, we = /^([01]?\d|2[0-3]):([0-5]\d)$/, F = {
|
|
428
493
|
normalize(e) {
|
|
429
494
|
if (typeof e != "string") return "";
|
|
430
495
|
let t = e.trim();
|
|
431
|
-
if (
|
|
496
|
+
if (we.test(t)) {
|
|
432
497
|
let [e, n] = t.split(":");
|
|
433
498
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
|
|
434
499
|
}
|
|
@@ -440,7 +505,7 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
440
505
|
return "";
|
|
441
506
|
},
|
|
442
507
|
validate(e) {
|
|
443
|
-
return
|
|
508
|
+
return F.normalize(e) !== "";
|
|
444
509
|
},
|
|
445
510
|
format(e, t = {}) {
|
|
446
511
|
if (typeof e != "string") return "";
|
|
@@ -451,32 +516,32 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
451
516
|
let a = r < 12 ? "AM" : "PM";
|
|
452
517
|
return `${r % 12 || 12}:${i} ${a}`;
|
|
453
518
|
}
|
|
454
|
-
},
|
|
519
|
+
}, I = {
|
|
455
520
|
PLAIN: "plain",
|
|
456
521
|
CREDIT_CARD: "creditCard",
|
|
457
522
|
PHONE: "phone",
|
|
458
523
|
CURRENCY: "currency",
|
|
459
524
|
DATE: "date",
|
|
460
525
|
TIME: "time"
|
|
461
|
-
},
|
|
462
|
-
[
|
|
463
|
-
[
|
|
464
|
-
[
|
|
465
|
-
[
|
|
466
|
-
[
|
|
467
|
-
[
|
|
468
|
-
]),
|
|
469
|
-
type:
|
|
526
|
+
}, L = new Map([
|
|
527
|
+
[I.PLAIN, de],
|
|
528
|
+
[I.CREDIT_CARD, ge],
|
|
529
|
+
[I.PHONE, ve],
|
|
530
|
+
[I.CURRENCY, xe],
|
|
531
|
+
[I.DATE, P],
|
|
532
|
+
[I.TIME, F]
|
|
533
|
+
]), R = {
|
|
534
|
+
type: I.PLAIN,
|
|
470
535
|
options: {}
|
|
471
|
-
},
|
|
536
|
+
}, z = class extends A {
|
|
472
537
|
static register(e, t) {
|
|
473
|
-
|
|
538
|
+
L.set(e, t);
|
|
474
539
|
}
|
|
475
540
|
constructor(e, t = {}) {
|
|
476
|
-
super(e, t), this.type = t.type ??
|
|
541
|
+
super(e, t), this.type = t.type ?? R.type, this.options = t.options ?? R.options, this.enhance();
|
|
477
542
|
}
|
|
478
543
|
enhance() {
|
|
479
|
-
let e = this, t =
|
|
544
|
+
let e = this, t = L.get(e.type) ?? L.get(I.PLAIN), n = {
|
|
480
545
|
normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
481
546
|
validate: (n) => t.validate?.(n, e.options) ?? !0,
|
|
482
547
|
format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
@@ -490,30 +555,30 @@ var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
|
490
555
|
configurable: !0
|
|
491
556
|
});
|
|
492
557
|
}
|
|
493
|
-
},
|
|
494
|
-
function
|
|
558
|
+
}, B = (e, t) => new z(e, t), Te = /^\d{4}-\d{2}-\d{2}$/;
|
|
559
|
+
function V(e) {
|
|
495
560
|
return e instanceof Date && !isNaN(e);
|
|
496
561
|
}
|
|
497
|
-
function
|
|
562
|
+
function H(...e) {
|
|
498
563
|
if (e.length === 0) throw "Missing values to parse as date";
|
|
499
564
|
if (e.length === 1) {
|
|
500
565
|
let t = e[0];
|
|
501
566
|
if (!t) return;
|
|
502
|
-
if (typeof t == "string" &&
|
|
567
|
+
if (typeof t == "string" && Te.test(t)) {
|
|
503
568
|
let [e, n, r] = t.split("-").map(Number), i = new Date(e, n - 1, r);
|
|
504
|
-
if (
|
|
569
|
+
if (V(i)) return i;
|
|
505
570
|
} else {
|
|
506
571
|
let e = new Date(t);
|
|
507
|
-
if (
|
|
572
|
+
if (V(e)) return e;
|
|
508
573
|
}
|
|
509
574
|
} else {
|
|
510
575
|
let t = new Date(...e);
|
|
511
|
-
if (
|
|
576
|
+
if (V(t)) return t;
|
|
512
577
|
}
|
|
513
578
|
}
|
|
514
579
|
//#endregion
|
|
515
580
|
//#region src/plumbers/calendar.js
|
|
516
|
-
var
|
|
581
|
+
var U = 7, Ee = 12, W = 10, G = {
|
|
517
582
|
locales: ["default"],
|
|
518
583
|
today: "",
|
|
519
584
|
day: null,
|
|
@@ -528,15 +593,15 @@ var G = 7, K = {
|
|
|
528
593
|
disabledYears: [],
|
|
529
594
|
firstDayOfWeek: 0,
|
|
530
595
|
onNavigated: "navigated"
|
|
531
|
-
},
|
|
596
|
+
}, De = class extends A {
|
|
532
597
|
constructor(e, t = {}) {
|
|
533
598
|
super(e, t);
|
|
534
|
-
let n = Object.assign({},
|
|
535
|
-
this.onNavigated = r, this.since =
|
|
599
|
+
let n = Object.assign({}, G, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
|
|
600
|
+
this.onNavigated = r, this.since = H(i), this.till = H(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : G.firstDayOfWeek;
|
|
536
601
|
let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
|
|
537
602
|
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
|
-
let { today:
|
|
539
|
-
this.now =
|
|
603
|
+
let { today: ee, day: f, month: p, year: m } = n;
|
|
604
|
+
this.now = H(ee) || /* @__PURE__ */ new Date(), typeof m == "number" && typeof p == "number" && typeof f == "number" ? this.current = H(m, p, f) : this.current = this.now, this.build(), this.enhance();
|
|
540
605
|
}
|
|
541
606
|
build() {
|
|
542
607
|
this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear(), this.yearsOfDecade = this.buildYearsOfDecade();
|
|
@@ -572,7 +637,7 @@ var G = 7, K = {
|
|
|
572
637
|
let a = new Date(t, e, i);
|
|
573
638
|
n.push(r(a));
|
|
574
639
|
}
|
|
575
|
-
let s = n.length %
|
|
640
|
+
let s = n.length % U, c = s === 0 ? 0 : U - s;
|
|
576
641
|
for (let i = 1; i <= c; i++) {
|
|
577
642
|
let a = new Date(t, e + 1, i);
|
|
578
643
|
n.push(r(a));
|
|
@@ -581,43 +646,47 @@ var G = 7, K = {
|
|
|
581
646
|
}
|
|
582
647
|
buildMonthsOfYear() {
|
|
583
648
|
let e = new Intl.DateTimeFormat(this.localesValue, { month: "long" }), t = new Intl.DateTimeFormat(this.localesValue, { month: "short" }), n = new Intl.DateTimeFormat(this.localesValue, { month: "numeric" }), r = [];
|
|
584
|
-
for (let i = 0; i <
|
|
585
|
-
let a = new Date(this.year, i);
|
|
649
|
+
for (let i = 0; i < Ee; i++) {
|
|
650
|
+
let a = new Date(this.year, i), o = new Date(this.year, i, 1), s = new Date(this.year, i + 1, 0), c = t.format(a), l = e.format(a), u = this.since && s < this.since || this.till && o > this.till, d = this.disabledMonths.some((e) => i == e || c === e || l === e);
|
|
586
651
|
r.push({
|
|
587
652
|
date: a,
|
|
588
653
|
value: a.getMonth(),
|
|
589
|
-
long:
|
|
590
|
-
short:
|
|
591
|
-
numeric: n.format(a)
|
|
654
|
+
long: l,
|
|
655
|
+
short: c,
|
|
656
|
+
numeric: n.format(a),
|
|
657
|
+
disabled: u || d
|
|
592
658
|
});
|
|
593
659
|
}
|
|
594
660
|
return r;
|
|
595
661
|
}
|
|
596
662
|
buildYearsOfDecade() {
|
|
597
|
-
let e = Math.floor(this.year /
|
|
598
|
-
for (let n = e - 1; n <= e +
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
663
|
+
let e = Math.floor(this.year / W) * W, t = [];
|
|
664
|
+
for (let n = e - 1; n <= e + W; n++) {
|
|
665
|
+
let r = n < e || n > e + W - 1, i = this.since && n < this.since.getFullYear() || this.till && n > this.till.getFullYear(), a = this.disabledYears.some((e) => n == e);
|
|
666
|
+
t.push({
|
|
667
|
+
value: n,
|
|
668
|
+
current: n === this.year,
|
|
669
|
+
disabled: r || i || a
|
|
670
|
+
});
|
|
671
|
+
}
|
|
603
672
|
return t;
|
|
604
673
|
}
|
|
605
674
|
get today() {
|
|
606
675
|
return this.now;
|
|
607
676
|
}
|
|
608
677
|
set today(e) {
|
|
609
|
-
if (!
|
|
678
|
+
if (!V(e)) return;
|
|
610
679
|
let t = this.month ?? e.getMonth(), n = this.year ?? e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear() ? e.getDate() : 1;
|
|
611
680
|
this.now = new Date(n, t, r);
|
|
612
681
|
}
|
|
613
682
|
get current() {
|
|
614
|
-
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ?
|
|
683
|
+
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? H(this.year, this.month, this.day) : null;
|
|
615
684
|
}
|
|
616
685
|
set current(e) {
|
|
617
|
-
|
|
686
|
+
V(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
|
|
618
687
|
}
|
|
619
688
|
navigate = async (e) => {
|
|
620
|
-
if (!
|
|
689
|
+
if (!V(e)) return;
|
|
621
690
|
let t = this.current, n = e.toISOString(), r = t.toISOString();
|
|
622
691
|
this.dispatch("navigate", { detail: {
|
|
623
692
|
from: r,
|
|
@@ -648,7 +717,7 @@ var G = 7, K = {
|
|
|
648
717
|
await this.navigate(n);
|
|
649
718
|
};
|
|
650
719
|
isDisabled = (e) => {
|
|
651
|
-
if (!
|
|
720
|
+
if (!V(e)) return !1;
|
|
652
721
|
if (this.disabledDates.length) {
|
|
653
722
|
let t = e.getTime();
|
|
654
723
|
for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
|
|
@@ -678,7 +747,7 @@ var G = 7, K = {
|
|
|
678
747
|
return !1;
|
|
679
748
|
};
|
|
680
749
|
isWithinRange = (e) => {
|
|
681
|
-
if (!
|
|
750
|
+
if (!V(e)) return !1;
|
|
682
751
|
let t = !0;
|
|
683
752
|
return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
|
|
684
753
|
};
|
|
@@ -744,18 +813,78 @@ var G = 7, K = {
|
|
|
744
813
|
};
|
|
745
814
|
} });
|
|
746
815
|
}
|
|
747
|
-
},
|
|
816
|
+
}, K = (e, t) => new De(e, t), Oe = class extends A {
|
|
817
|
+
constructor(e, t = {}) {
|
|
818
|
+
super(e, t), this.handle = this.handle.bind(this), this.onSelect = t.onSelect || null;
|
|
819
|
+
}
|
|
820
|
+
attach() {
|
|
821
|
+
this.element.addEventListener("click", this.handle);
|
|
822
|
+
}
|
|
823
|
+
detach() {
|
|
824
|
+
this.element.removeEventListener("click", this.handle);
|
|
825
|
+
}
|
|
826
|
+
handle(e) {
|
|
827
|
+
if (!(e.target instanceof HTMLElement)) return;
|
|
828
|
+
e.preventDefault();
|
|
829
|
+
let t = e.target instanceof HTMLTimeElement ? e.target.parentElement : e.target;
|
|
830
|
+
if (t.disabled || t.getAttribute("aria-disabled") === "true") return;
|
|
831
|
+
let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
|
|
832
|
+
if (!n) return;
|
|
833
|
+
let r = H(n.dateTime);
|
|
834
|
+
if (!r) return;
|
|
835
|
+
this.dispatch("selecting", { target: t });
|
|
836
|
+
let i = r.toISOString();
|
|
837
|
+
this.onSelect ? this.awaitCallback(this.onSelect, i) : this.dispatch("selected", { detail: {
|
|
838
|
+
epoch: r.getTime(),
|
|
839
|
+
iso: i
|
|
840
|
+
} });
|
|
841
|
+
}
|
|
842
|
+
}, ke = class extends A {
|
|
843
|
+
constructor(e, t = {}) {
|
|
844
|
+
super(e, t), this.handle = this.handle.bind(this);
|
|
845
|
+
}
|
|
846
|
+
attach() {
|
|
847
|
+
this.element.addEventListener("click", this.handle);
|
|
848
|
+
}
|
|
849
|
+
detach() {
|
|
850
|
+
this.element.removeEventListener("click", this.handle);
|
|
851
|
+
}
|
|
852
|
+
handle(e) {
|
|
853
|
+
let t = e.target.closest("button[data-month]");
|
|
854
|
+
if (!t || t.disabled || t.getAttribute("aria-disabled") === "true") return;
|
|
855
|
+
e.preventDefault();
|
|
856
|
+
let n = parseInt(t.dataset.month, 10);
|
|
857
|
+
isNaN(n) || this.dispatch("selected", { detail: { month: n } });
|
|
858
|
+
}
|
|
859
|
+
}, Ae = class extends A {
|
|
860
|
+
constructor(e, t = {}) {
|
|
861
|
+
super(e, t), this.handle = this.handle.bind(this);
|
|
862
|
+
}
|
|
863
|
+
attach() {
|
|
864
|
+
this.element.addEventListener("click", this.handle);
|
|
865
|
+
}
|
|
866
|
+
detach() {
|
|
867
|
+
this.element.removeEventListener("click", this.handle);
|
|
868
|
+
}
|
|
869
|
+
handle(e) {
|
|
870
|
+
let t = e.target.closest("button[data-year]");
|
|
871
|
+
if (!t || t.disabled || t.getAttribute("aria-disabled") === "true") return;
|
|
872
|
+
e.preventDefault();
|
|
873
|
+
let n = parseInt(t.dataset.year, 10);
|
|
874
|
+
isNaN(n) || this.dispatch("selected", { detail: { year: n } });
|
|
875
|
+
}
|
|
876
|
+
}, q = (e, t) => new Oe(e, t), J = (e, t) => new ke(e, t), Y = (e, t) => new Ae(e, t), X = {
|
|
748
877
|
content: null,
|
|
749
878
|
url: "",
|
|
750
879
|
reload: "never",
|
|
751
880
|
stale: 3600,
|
|
752
881
|
onLoad: "canLoad",
|
|
753
882
|
onLoaded: "contentLoaded"
|
|
754
|
-
},
|
|
883
|
+
}, je = class extends A {
|
|
755
884
|
constructor(e, t = {}) {
|
|
756
885
|
super(e, t);
|
|
757
|
-
let n = Object.assign({},
|
|
758
|
-
this.content = r, this.url = i, this.reload = typeof a == "string" ? a :
|
|
886
|
+
let n = Object.assign({}, X, t), { content: r, url: i, reload: a, stale: o } = n;
|
|
887
|
+
this.content = r, this.url = i, this.reload = typeof a == "string" ? a : X.reload, this.stale = typeof o == "number" ? o : X.stale;
|
|
759
888
|
let { onLoad: s, onLoaded: c } = n;
|
|
760
889
|
this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
|
|
761
890
|
}
|
|
@@ -764,7 +893,7 @@ var G = 7, K = {
|
|
|
764
893
|
case "never": return !1;
|
|
765
894
|
case "always": return !0;
|
|
766
895
|
default: {
|
|
767
|
-
let e =
|
|
896
|
+
let e = H(this.loadedAt);
|
|
768
897
|
return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
|
|
769
898
|
}
|
|
770
899
|
}
|
|
@@ -790,7 +919,7 @@ var G = 7, K = {
|
|
|
790
919
|
let e = this;
|
|
791
920
|
Object.assign(this.controller, { load: e.load.bind(e) });
|
|
792
921
|
}
|
|
793
|
-
},
|
|
922
|
+
}, Me = (e, t) => new je(e, t), Z = class extends A {
|
|
794
923
|
observe(e) {
|
|
795
924
|
this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
|
|
796
925
|
}
|
|
@@ -803,21 +932,21 @@ var G = 7, K = {
|
|
|
803
932
|
e.unobserve(), t();
|
|
804
933
|
};
|
|
805
934
|
}
|
|
806
|
-
},
|
|
935
|
+
}, Ne = {
|
|
807
936
|
trigger: null,
|
|
808
937
|
events: ["click"],
|
|
809
938
|
onDismissed: "dismissed"
|
|
810
|
-
},
|
|
939
|
+
}, Pe = class extends Z {
|
|
811
940
|
constructor(e, t = {}) {
|
|
812
941
|
super(e, t);
|
|
813
|
-
let { trigger: n, events: r, onDismissed: i } = Object.assign({},
|
|
942
|
+
let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Ne, t);
|
|
814
943
|
this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
|
|
815
944
|
}
|
|
816
945
|
dismiss = async (e) => {
|
|
817
946
|
let { target: t } = e;
|
|
818
947
|
t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
|
|
819
948
|
};
|
|
820
|
-
},
|
|
949
|
+
}, Q = (e, t) => new Pe(e, t), Fe = {
|
|
821
950
|
anchor: null,
|
|
822
951
|
events: ["click"],
|
|
823
952
|
placement: "bottom",
|
|
@@ -825,10 +954,10 @@ var G = 7, K = {
|
|
|
825
954
|
onFlipped: "flipped",
|
|
826
955
|
ariaRole: null,
|
|
827
956
|
respectMotion: !0
|
|
828
|
-
},
|
|
957
|
+
}, Ie = class extends Z {
|
|
829
958
|
constructor(e, t = {}) {
|
|
830
959
|
super(e, t);
|
|
831
|
-
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({},
|
|
960
|
+
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, Fe, t);
|
|
832
961
|
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({
|
|
833
962
|
trigger: this.anchor,
|
|
834
963
|
target: this.element,
|
|
@@ -847,7 +976,7 @@ var G = 7, K = {
|
|
|
847
976
|
}), this.dispatch("flipped", { detail: { placement: e } });
|
|
848
977
|
};
|
|
849
978
|
flippedRect(e, t) {
|
|
850
|
-
let n = this.quadrumRect(e,
|
|
979
|
+
let n = this.quadrumRect(e, O()), r = [this.placement, ce[this.placement]], i = {};
|
|
851
980
|
for (; !Object.keys(i).length && r.length > 0;) {
|
|
852
981
|
let a = r.shift();
|
|
853
982
|
if (!this.biggerRectThan(n[a], t)) continue;
|
|
@@ -858,25 +987,25 @@ var G = 7, K = {
|
|
|
858
987
|
}
|
|
859
988
|
quadrumRect(e, t) {
|
|
860
989
|
return {
|
|
861
|
-
left:
|
|
990
|
+
left: D({
|
|
862
991
|
x: t.x,
|
|
863
992
|
y: t.y,
|
|
864
993
|
width: e.x - t.x,
|
|
865
994
|
height: t.height
|
|
866
995
|
}),
|
|
867
|
-
right:
|
|
996
|
+
right: D({
|
|
868
997
|
x: e.x + e.width,
|
|
869
998
|
y: t.y,
|
|
870
999
|
width: t.width - (e.x + e.width),
|
|
871
1000
|
height: t.height
|
|
872
1001
|
}),
|
|
873
|
-
top:
|
|
1002
|
+
top: D({
|
|
874
1003
|
x: t.x,
|
|
875
1004
|
y: t.y,
|
|
876
1005
|
width: t.width,
|
|
877
1006
|
height: e.y - t.y
|
|
878
1007
|
}),
|
|
879
|
-
bottom:
|
|
1008
|
+
bottom: D({
|
|
880
1009
|
x: t.x,
|
|
881
1010
|
y: e.y + e.height,
|
|
882
1011
|
width: t.width,
|
|
@@ -886,25 +1015,25 @@ var G = 7, K = {
|
|
|
886
1015
|
}
|
|
887
1016
|
quadrumPlacement(e, t, n) {
|
|
888
1017
|
switch (t) {
|
|
889
|
-
case "top": return
|
|
1018
|
+
case "top": return D({
|
|
890
1019
|
x: n.x,
|
|
891
1020
|
y: e.y - n.height,
|
|
892
1021
|
width: n.width,
|
|
893
1022
|
height: n.height
|
|
894
1023
|
});
|
|
895
|
-
case "bottom": return
|
|
1024
|
+
case "bottom": return D({
|
|
896
1025
|
x: n.x,
|
|
897
1026
|
y: e.y + e.height,
|
|
898
1027
|
width: n.width,
|
|
899
1028
|
height: n.height
|
|
900
1029
|
});
|
|
901
|
-
case "left": return
|
|
1030
|
+
case "left": return D({
|
|
902
1031
|
x: e.x - n.width,
|
|
903
1032
|
y: n.y,
|
|
904
1033
|
width: n.width,
|
|
905
1034
|
height: n.height
|
|
906
1035
|
});
|
|
907
|
-
case "right": return
|
|
1036
|
+
case "right": return D({
|
|
908
1037
|
x: e.x + e.width,
|
|
909
1038
|
y: n.y,
|
|
910
1039
|
width: n.width,
|
|
@@ -918,7 +1047,7 @@ var G = 7, K = {
|
|
|
918
1047
|
case "top":
|
|
919
1048
|
case "bottom": {
|
|
920
1049
|
let t = e.x;
|
|
921
|
-
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width),
|
|
1050
|
+
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), D({
|
|
922
1051
|
x: t,
|
|
923
1052
|
y: n.y,
|
|
924
1053
|
width: n.width,
|
|
@@ -928,7 +1057,7 @@ var G = 7, K = {
|
|
|
928
1057
|
case "left":
|
|
929
1058
|
case "right": {
|
|
930
1059
|
let t = e.y;
|
|
931
|
-
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height),
|
|
1060
|
+
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), D({
|
|
932
1061
|
x: n.x,
|
|
933
1062
|
y: t,
|
|
934
1063
|
width: n.width,
|
|
@@ -944,7 +1073,7 @@ var G = 7, K = {
|
|
|
944
1073
|
enhance() {
|
|
945
1074
|
super.enhance(), this.controller.flip = this.flip;
|
|
946
1075
|
}
|
|
947
|
-
},
|
|
1076
|
+
}, Le = (e, t) => new Ie(e, t), Re = {
|
|
948
1077
|
events: ["resize"],
|
|
949
1078
|
boundaries: [
|
|
950
1079
|
"top",
|
|
@@ -953,10 +1082,10 @@ var G = 7, K = {
|
|
|
953
1082
|
],
|
|
954
1083
|
onShifted: "shifted",
|
|
955
1084
|
respectMotion: !0
|
|
956
|
-
},
|
|
1085
|
+
}, ze = class extends Z {
|
|
957
1086
|
constructor(e, t = {}) {
|
|
958
1087
|
super(e, t);
|
|
959
|
-
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({},
|
|
1088
|
+
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Re, t);
|
|
960
1089
|
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);
|
|
961
1090
|
}
|
|
962
1091
|
shift = async () => {
|
|
@@ -966,14 +1095,14 @@ var G = 7, K = {
|
|
|
966
1095
|
this.element.style.transition = this.respectMotion && this.prefersReducedMotion ? "none" : "", this.element.style.transform = `translate(${t}px, ${n}px)`, await this.awaitCallback(this.onShifted, e), this.dispatch("shifted", { detail: e });
|
|
967
1096
|
};
|
|
968
1097
|
overflowRect(e, t) {
|
|
969
|
-
let n = {}, r =
|
|
1098
|
+
let n = {}, r = O(), i = D({
|
|
970
1099
|
x: e.x - t.x,
|
|
971
1100
|
y: e.y - t.y,
|
|
972
1101
|
width: e.width,
|
|
973
1102
|
height: e.height
|
|
974
1103
|
});
|
|
975
1104
|
for (let e of this.boundaries) {
|
|
976
|
-
let t = this.directionDistance(i, e, r), a =
|
|
1105
|
+
let t = this.directionDistance(i, e, r), a = ce[e];
|
|
977
1106
|
t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
|
|
978
1107
|
}
|
|
979
1108
|
return n;
|
|
@@ -1005,27 +1134,27 @@ var G = 7, K = {
|
|
|
1005
1134
|
enhance() {
|
|
1006
1135
|
super.enhance(), this.controller.shift = this.shift;
|
|
1007
1136
|
}
|
|
1008
|
-
},
|
|
1137
|
+
}, Be = (e, t) => new ze(e, t), Ve = {
|
|
1009
1138
|
visibility: "visibility",
|
|
1010
1139
|
onShown: "shown",
|
|
1011
1140
|
onHidden: "hidden"
|
|
1012
|
-
},
|
|
1141
|
+
}, He = class extends A {
|
|
1013
1142
|
constructor(e, t = {}) {
|
|
1014
|
-
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({},
|
|
1143
|
+
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Ve, t), o = typeof n == "string" ? n : Ve.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
|
|
1015
1144
|
(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));
|
|
1016
1145
|
}
|
|
1017
1146
|
isVisible(e) {
|
|
1018
1147
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1019
|
-
let t =
|
|
1148
|
+
let t = k.hiddenClass;
|
|
1020
1149
|
return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
|
|
1021
1150
|
}
|
|
1022
1151
|
toggle(e, t) {
|
|
1023
1152
|
if (!(e instanceof HTMLElement)) return;
|
|
1024
|
-
let n =
|
|
1025
|
-
n ? t ? e.classList.remove(n) : e.classList.add(n) :
|
|
1153
|
+
let n = k.hiddenClass;
|
|
1154
|
+
n ? t ? e.classList.remove(n) : e.classList.add(n) : v(e, !t);
|
|
1026
1155
|
}
|
|
1027
1156
|
activate(e) {
|
|
1028
|
-
this.activator && this.activator
|
|
1157
|
+
this.activator && g(this.activator, e);
|
|
1029
1158
|
}
|
|
1030
1159
|
async show() {
|
|
1031
1160
|
!(this.element instanceof HTMLElement) || this.isVisible(this.element) || (this.dispatch("show"), this.toggle(this.element, !0), this.activate(!0), await this.awaitCallback(this.onShown, { target: this.element }), this.dispatch("shown"));
|
|
@@ -1044,14 +1173,118 @@ var G = 7, K = {
|
|
|
1044
1173
|
return t;
|
|
1045
1174
|
} });
|
|
1046
1175
|
}
|
|
1047
|
-
},
|
|
1176
|
+
}, Ue = (e, t) => new He(e, t), We = 4, Ge = class extends e {
|
|
1177
|
+
static targets = ["grid"];
|
|
1178
|
+
static values = {
|
|
1179
|
+
current: Number,
|
|
1180
|
+
today: {
|
|
1181
|
+
type: String,
|
|
1182
|
+
default: ""
|
|
1183
|
+
},
|
|
1184
|
+
selected: {
|
|
1185
|
+
type: String,
|
|
1186
|
+
default: ""
|
|
1187
|
+
},
|
|
1188
|
+
since: {
|
|
1189
|
+
type: String,
|
|
1190
|
+
default: ""
|
|
1191
|
+
},
|
|
1192
|
+
till: {
|
|
1193
|
+
type: String,
|
|
1194
|
+
default: ""
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
initialize() {
|
|
1198
|
+
this.selector = Y(this), K(this, {
|
|
1199
|
+
today: this.todayValue,
|
|
1200
|
+
year: this.currentValue || void 0,
|
|
1201
|
+
since: this.sinceValue || null,
|
|
1202
|
+
till: this.tillValue || null
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
connect() {
|
|
1206
|
+
this.selector.attach(), this.navigated();
|
|
1207
|
+
}
|
|
1208
|
+
disconnect() {
|
|
1209
|
+
this.selector.detach();
|
|
1210
|
+
}
|
|
1211
|
+
currentValueChanged() {
|
|
1212
|
+
!this.calendar || !this.hasCurrentValue || this.calendar.navigate(this.currentDate);
|
|
1213
|
+
}
|
|
1214
|
+
selectedValueChanged() {
|
|
1215
|
+
if (!this.hasGridTarget) return;
|
|
1216
|
+
let e = H(this.selectedValue), t = e ? e.getFullYear() : null;
|
|
1217
|
+
this.gridTarget.querySelectorAll("button[data-year]").forEach((e) => {
|
|
1218
|
+
let n = parseInt(e.dataset.year, 10);
|
|
1219
|
+
e.setAttribute("aria-selected", n === t ? "true" : "false");
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
navigate(e) {
|
|
1223
|
+
this.currentValue = e.getFullYear();
|
|
1224
|
+
}
|
|
1225
|
+
step(e, t) {
|
|
1226
|
+
return this.calendar.step(e, t);
|
|
1227
|
+
}
|
|
1228
|
+
navigated() {
|
|
1229
|
+
this.drawGrid();
|
|
1230
|
+
}
|
|
1231
|
+
get currentDate() {
|
|
1232
|
+
return new Date(this.currentValue, 0, 1);
|
|
1233
|
+
}
|
|
1234
|
+
drawGrid() {
|
|
1235
|
+
if (!this.hasGridTarget) return;
|
|
1236
|
+
let { yearsOfDecade: e } = this.calendar, t = this.calendar.today.getFullYear(), n = H(this.selectedValue), r = n ? n.getFullYear() : null, i = [];
|
|
1237
|
+
for (let n of e) {
|
|
1238
|
+
let e = document.createElement("button");
|
|
1239
|
+
e.type = "button", e.textContent = n.value, e.dataset.year = n.value, e.setAttribute("role", "gridcell"), e.setAttribute("aria-selected", n.value === r ? "true" : "false"), n.value === t && e.setAttribute("aria-current", "year"), n.disabled && e.setAttribute("aria-disabled", "true"), i.push(e);
|
|
1240
|
+
}
|
|
1241
|
+
let a = document.createElement("div");
|
|
1242
|
+
a.setAttribute("role", "rowgroup");
|
|
1243
|
+
for (let e = 0; e < i.length; e += We) {
|
|
1244
|
+
let t = document.createElement("div");
|
|
1245
|
+
t.setAttribute("role", "row");
|
|
1246
|
+
for (let n of i.slice(e, e + We)) t.appendChild(n);
|
|
1247
|
+
a.appendChild(t);
|
|
1248
|
+
}
|
|
1249
|
+
this.gridTarget.replaceChildren(a);
|
|
1250
|
+
}
|
|
1251
|
+
}, Ke = class extends e {
|
|
1252
|
+
initialize() {
|
|
1253
|
+
this.selector = Y(this);
|
|
1254
|
+
}
|
|
1255
|
+
connect() {
|
|
1256
|
+
this.selector.attach();
|
|
1257
|
+
}
|
|
1258
|
+
disconnect() {
|
|
1259
|
+
this.selector.detach();
|
|
1260
|
+
}
|
|
1261
|
+
}, qe = class extends e {
|
|
1048
1262
|
static targets = ["daysOfWeek", "daysOfMonth"];
|
|
1049
1263
|
static classes = [
|
|
1050
1264
|
"dayOfWeek",
|
|
1051
1265
|
"dayOfMonth",
|
|
1266
|
+
"dayOfOtherMonth",
|
|
1052
1267
|
"row"
|
|
1053
1268
|
];
|
|
1054
1269
|
static values = {
|
|
1270
|
+
year: Number,
|
|
1271
|
+
month: Number,
|
|
1272
|
+
today: {
|
|
1273
|
+
type: String,
|
|
1274
|
+
default: ""
|
|
1275
|
+
},
|
|
1276
|
+
selected: {
|
|
1277
|
+
type: String,
|
|
1278
|
+
default: ""
|
|
1279
|
+
},
|
|
1280
|
+
since: {
|
|
1281
|
+
type: String,
|
|
1282
|
+
default: ""
|
|
1283
|
+
},
|
|
1284
|
+
till: {
|
|
1285
|
+
type: String,
|
|
1286
|
+
default: ""
|
|
1287
|
+
},
|
|
1055
1288
|
locales: {
|
|
1056
1289
|
type: Array,
|
|
1057
1290
|
default: ["default"]
|
|
@@ -1067,41 +1300,60 @@ var G = 7, K = {
|
|
|
1067
1300
|
daysOfOtherMonth: {
|
|
1068
1301
|
type: Boolean,
|
|
1069
1302
|
default: !1
|
|
1070
|
-
},
|
|
1071
|
-
today: {
|
|
1072
|
-
type: String,
|
|
1073
|
-
default: ""
|
|
1074
|
-
},
|
|
1075
|
-
selected: {
|
|
1076
|
-
type: String,
|
|
1077
|
-
default: ""
|
|
1078
1303
|
}
|
|
1079
1304
|
};
|
|
1080
1305
|
initialize() {
|
|
1081
|
-
|
|
1306
|
+
this.selector = q(this, { onSelect: "select" }), K(this, {
|
|
1307
|
+
today: this.todayValue,
|
|
1308
|
+
since: this.sinceValue || null,
|
|
1309
|
+
till: this.tillValue || null
|
|
1310
|
+
});
|
|
1082
1311
|
}
|
|
1083
1312
|
connect() {
|
|
1084
|
-
this.
|
|
1313
|
+
this.selector.attach(), this.navigated();
|
|
1085
1314
|
}
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1315
|
+
disconnect() {
|
|
1316
|
+
this.selector.detach();
|
|
1317
|
+
}
|
|
1318
|
+
yearValueChanged() {
|
|
1319
|
+
!this.calendar || !this.hasYearValue || this._scheduleNavigate();
|
|
1320
|
+
}
|
|
1321
|
+
monthValueChanged() {
|
|
1322
|
+
!this.calendar || !this.hasYearValue || this._scheduleNavigate();
|
|
1323
|
+
}
|
|
1324
|
+
_scheduleNavigate() {
|
|
1325
|
+
this._navigatePending || (this._navigatePending = !0, queueMicrotask(async () => {
|
|
1326
|
+
this._navigatePending = !1, await this.calendar.navigate(this.currentDate), this.navigated();
|
|
1327
|
+
}));
|
|
1088
1328
|
}
|
|
1089
1329
|
selectedValueChanged() {
|
|
1090
1330
|
if (!this.hasDaysOfMonthTarget || (this.daysOfMonthTarget.querySelectorAll("[aria-selected]").forEach((e) => {
|
|
1091
1331
|
e.setAttribute("aria-selected", "false");
|
|
1092
1332
|
}), !this.selectedValue)) return;
|
|
1093
|
-
let e =
|
|
1333
|
+
let e = H(this.selectedValue);
|
|
1094
1334
|
if (!e) return;
|
|
1095
1335
|
let t = this.daysOfMonthTarget.querySelector(`time[datetime="${e.toISOString()}"]`);
|
|
1096
|
-
t && t.closest("[aria-selected]")
|
|
1336
|
+
t && t.closest("[aria-selected]")?.setAttribute("aria-selected", "true");
|
|
1097
1337
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
t && (this.selectedValue = t);
|
|
1338
|
+
navigate(e) {
|
|
1339
|
+
this.yearValue = e.getFullYear(), this.monthValue = e.getMonth();
|
|
1101
1340
|
}
|
|
1102
|
-
|
|
1341
|
+
step(e, t) {
|
|
1342
|
+
return this.calendar.step(e, t);
|
|
1343
|
+
}
|
|
1344
|
+
select(e) {
|
|
1345
|
+
let t = H(e);
|
|
1346
|
+
t && (this.selectedValue = e, (t.getMonth() !== this.calendar.month || t.getFullYear() !== this.calendar.year) && this.calendar.navigate(t), this.dispatch("selected", { detail: {
|
|
1347
|
+
epoch: t.getTime(),
|
|
1348
|
+
iso: e
|
|
1349
|
+
} }));
|
|
1350
|
+
}
|
|
1351
|
+
navigated() {
|
|
1103
1352
|
this.drawDaysOfWeek(), this.drawDaysOfMonth(), this.selectedValueChanged();
|
|
1104
1353
|
}
|
|
1354
|
+
get currentDate() {
|
|
1355
|
+
return new Date(this.yearValue, this.monthValue, 1);
|
|
1356
|
+
}
|
|
1105
1357
|
createDayElement(e, { selectable: t = !1, disabled: n = !1 } = {}) {
|
|
1106
1358
|
let r = document.createElement(t ? "button" : "div");
|
|
1107
1359
|
return r.tabIndex = -1, e ? r.textContent = e : r.setAttribute("aria-hidden", "true"), n && (r instanceof HTMLButtonElement ? r.disabled = !0 : r.setAttribute("aria-disabled", "true")), r;
|
|
@@ -1120,13 +1372,13 @@ var G = 7, K = {
|
|
|
1120
1372
|
if (!this.hasDaysOfMonthTarget) return;
|
|
1121
1373
|
let e = this.calendar.today, t = new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime(), n = [];
|
|
1122
1374
|
for (let e of this.calendar.daysOfMonth) {
|
|
1123
|
-
let r =
|
|
1124
|
-
selectable: e.current,
|
|
1125
|
-
disabled: r
|
|
1375
|
+
let r = this.calendar.isDisabled(e.date) || !this.calendar.isWithinRange(e.date), i = !e.current && this.daysOfOtherMonthValue && !r, a = e.current || this.daysOfOtherMonthValue ? e.value : "", o = this.createDayElement(a, {
|
|
1376
|
+
selectable: e.current || i,
|
|
1377
|
+
disabled: e.current ? r : !i
|
|
1126
1378
|
});
|
|
1127
|
-
t === e.date.getTime() &&
|
|
1128
|
-
let
|
|
1129
|
-
|
|
1379
|
+
t === e.date.getTime() && o.setAttribute("aria-current", "date"), (e.current || this.daysOfOtherMonthValue) && o.setAttribute("aria-selected", ""), !e.current && this.daysOfOtherMonthValue && this.hasDayOfOtherMonthClass ? o.classList.add(...this.dayOfOtherMonthClasses) : this.hasDayOfMonthClass && o.classList.add(...this.dayOfMonthClasses);
|
|
1380
|
+
let s = document.createElement("time");
|
|
1381
|
+
s.dateTime = e.iso, o.appendChild(s), n.push(o);
|
|
1130
1382
|
}
|
|
1131
1383
|
let r = [];
|
|
1132
1384
|
for (let e = 0; e < n.length; e += 7) {
|
|
@@ -1137,27 +1389,112 @@ var G = 7, K = {
|
|
|
1137
1389
|
}
|
|
1138
1390
|
this.daysOfMonthTarget.replaceChildren(...r);
|
|
1139
1391
|
}
|
|
1140
|
-
},
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
e.preventDefault();
|
|
1144
|
-
let t = e.target instanceof HTMLTimeElement ? e.target.parentElement : e.target;
|
|
1145
|
-
if (t.disabled || t.getAttribute("aria-disabled") === "true") return;
|
|
1146
|
-
this.dispatch("selecting", { target: t });
|
|
1147
|
-
let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
|
|
1148
|
-
if (!n) return console.error(`unable to locate time element within ${t}`);
|
|
1149
|
-
let r = W(n.dateTime);
|
|
1150
|
-
if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
|
|
1151
|
-
this.select(r.toISOString());
|
|
1392
|
+
}, Je = class extends e {
|
|
1393
|
+
initialize() {
|
|
1394
|
+
this.selector = q(this);
|
|
1152
1395
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1396
|
+
connect() {
|
|
1397
|
+
this.selector.attach();
|
|
1398
|
+
}
|
|
1399
|
+
disconnect() {
|
|
1400
|
+
this.selector.detach();
|
|
1401
|
+
}
|
|
1402
|
+
}, Ye = 4, Xe = class extends e {
|
|
1403
|
+
static targets = ["grid"];
|
|
1404
|
+
static values = {
|
|
1405
|
+
current: Number,
|
|
1406
|
+
today: {
|
|
1407
|
+
type: String,
|
|
1408
|
+
default: ""
|
|
1409
|
+
},
|
|
1410
|
+
selected: {
|
|
1411
|
+
type: String,
|
|
1412
|
+
default: ""
|
|
1413
|
+
},
|
|
1414
|
+
since: {
|
|
1415
|
+
type: String,
|
|
1416
|
+
default: ""
|
|
1417
|
+
},
|
|
1418
|
+
till: {
|
|
1419
|
+
type: String,
|
|
1420
|
+
default: ""
|
|
1421
|
+
},
|
|
1422
|
+
locales: {
|
|
1423
|
+
type: Array,
|
|
1424
|
+
default: ["default"]
|
|
1425
|
+
},
|
|
1426
|
+
monthFormat: {
|
|
1427
|
+
type: String,
|
|
1428
|
+
default: "short"
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
initialize() {
|
|
1432
|
+
this.selector = J(this), K(this, {
|
|
1433
|
+
today: this.todayValue,
|
|
1434
|
+
year: this.currentValue || void 0,
|
|
1435
|
+
since: this.sinceValue || null,
|
|
1436
|
+
till: this.tillValue || null
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
connect() {
|
|
1440
|
+
this.selector.attach(), this.navigated();
|
|
1441
|
+
}
|
|
1442
|
+
disconnect() {
|
|
1443
|
+
this.selector.detach();
|
|
1159
1444
|
}
|
|
1160
|
-
|
|
1445
|
+
currentValueChanged() {
|
|
1446
|
+
!this.calendar || !this.hasCurrentValue || this.calendar.navigate(this.currentDate);
|
|
1447
|
+
}
|
|
1448
|
+
selectedValueChanged() {
|
|
1449
|
+
if (!this.hasGridTarget) return;
|
|
1450
|
+
let e = H(this.selectedValue);
|
|
1451
|
+
this.gridTarget.querySelectorAll("button[data-month]").forEach((t) => {
|
|
1452
|
+
let n = parseInt(t.dataset.month, 10) - 1;
|
|
1453
|
+
t.setAttribute("aria-selected", e && e.getMonth() === n ? "true" : "false");
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
navigate(e) {
|
|
1457
|
+
this.currentValue = e.getFullYear();
|
|
1458
|
+
}
|
|
1459
|
+
step(e, t) {
|
|
1460
|
+
return this.calendar.step(e, t);
|
|
1461
|
+
}
|
|
1462
|
+
navigated() {
|
|
1463
|
+
this.drawGrid();
|
|
1464
|
+
}
|
|
1465
|
+
get currentDate() {
|
|
1466
|
+
return new Date(this.currentValue, 0, 1);
|
|
1467
|
+
}
|
|
1468
|
+
drawGrid() {
|
|
1469
|
+
if (!this.hasGridTarget) return;
|
|
1470
|
+
let { year: e, monthsOfYear: t } = this.calendar, n = this.calendar.today, r = H(this.selectedValue), i = [], a = new Intl.DateTimeFormat(this.localesValue, { month: this.monthFormatValue });
|
|
1471
|
+
for (let o of t) {
|
|
1472
|
+
let t = document.createElement("button");
|
|
1473
|
+
t.type = "button", t.textContent = a.format(o.date), t.dataset.month = o.value + 1, t.setAttribute("role", "gridcell");
|
|
1474
|
+
let s = r && r.getMonth() === o.value;
|
|
1475
|
+
t.setAttribute("aria-selected", s ? "true" : "false"), o.value === n.getMonth() && e === n.getFullYear() && t.setAttribute("aria-current", "month"), o.disabled && t.setAttribute("aria-disabled", "true"), i.push(t);
|
|
1476
|
+
}
|
|
1477
|
+
let o = document.createElement("div");
|
|
1478
|
+
o.setAttribute("role", "rowgroup");
|
|
1479
|
+
for (let e = 0; e < i.length; e += Ye) {
|
|
1480
|
+
let t = document.createElement("div");
|
|
1481
|
+
t.setAttribute("role", "row");
|
|
1482
|
+
for (let n of i.slice(e, e + Ye)) t.appendChild(n);
|
|
1483
|
+
o.appendChild(t);
|
|
1484
|
+
}
|
|
1485
|
+
this.gridTarget.replaceChildren(o);
|
|
1486
|
+
}
|
|
1487
|
+
}, Ze = class extends e {
|
|
1488
|
+
initialize() {
|
|
1489
|
+
this.selector = J(this);
|
|
1490
|
+
}
|
|
1491
|
+
connect() {
|
|
1492
|
+
this.selector.attach();
|
|
1493
|
+
}
|
|
1494
|
+
disconnect() {
|
|
1495
|
+
this.selector.detach();
|
|
1496
|
+
}
|
|
1497
|
+
}, Qe = class extends e {
|
|
1161
1498
|
static targets = ["source"];
|
|
1162
1499
|
static values = { contentType: {
|
|
1163
1500
|
type: String,
|
|
@@ -1191,19 +1528,20 @@ var G = 7, K = {
|
|
|
1191
1528
|
"month",
|
|
1192
1529
|
"year",
|
|
1193
1530
|
"decade"
|
|
1194
|
-
],
|
|
1531
|
+
], $e = class extends e {
|
|
1195
1532
|
static targets = [
|
|
1196
1533
|
"previous",
|
|
1197
1534
|
"next",
|
|
1198
1535
|
"day",
|
|
1199
1536
|
"month",
|
|
1200
1537
|
"year",
|
|
1201
|
-
"viewTitle"
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
"
|
|
1538
|
+
"viewTitle"
|
|
1539
|
+
];
|
|
1540
|
+
static outlets = [
|
|
1541
|
+
"calendar-month",
|
|
1542
|
+
"calendar-year",
|
|
1543
|
+
"calendar-decade"
|
|
1205
1544
|
];
|
|
1206
|
-
static outlets = ["calendar-month"];
|
|
1207
1545
|
static values = {
|
|
1208
1546
|
date: String,
|
|
1209
1547
|
view: {
|
|
@@ -1228,16 +1566,16 @@ var G = 7, K = {
|
|
|
1228
1566
|
}
|
|
1229
1567
|
};
|
|
1230
1568
|
initialize() {
|
|
1231
|
-
this.previous = this.previous.bind(this), this.next = this.next.bind(this)
|
|
1569
|
+
this.previous = this.previous.bind(this), this.next = this.next.bind(this);
|
|
1232
1570
|
}
|
|
1233
1571
|
async calendarMonthOutletConnected() {
|
|
1234
1572
|
if (this.dateValue) {
|
|
1235
|
-
let e =
|
|
1573
|
+
let e = H(this.dateValue);
|
|
1236
1574
|
e && await this.calendarMonthOutlet.calendar.navigate(e);
|
|
1237
1575
|
}
|
|
1238
1576
|
this.draw();
|
|
1239
1577
|
}
|
|
1240
|
-
|
|
1578
|
+
onDaySelect(e) {
|
|
1241
1579
|
this.dateValue = e.detail.iso, this.draw(), this.dispatch("selected", {
|
|
1242
1580
|
detail: { value: e.detail.iso },
|
|
1243
1581
|
bubbles: !0
|
|
@@ -1247,17 +1585,17 @@ var G = 7, K = {
|
|
|
1247
1585
|
let e = $.indexOf(this.viewValue);
|
|
1248
1586
|
e < $.length - 1 && (this.viewValue = $[e + 1], this.draw());
|
|
1249
1587
|
}
|
|
1250
|
-
async
|
|
1251
|
-
let t = e.
|
|
1252
|
-
if (!
|
|
1253
|
-
let
|
|
1254
|
-
await this.calendarMonthOutlet.calendar.navigate(new Date(
|
|
1588
|
+
async onMonthSelect(e) {
|
|
1589
|
+
let { month: t } = e.detail;
|
|
1590
|
+
if (!this.hasCalendarMonthOutlet) return;
|
|
1591
|
+
let { year: n } = this.calendarMonthOutlet.calendar;
|
|
1592
|
+
await this.calendarMonthOutlet.calendar.navigate(new Date(n, t - 1, 1)), this.viewValue = "month", this.draw();
|
|
1255
1593
|
}
|
|
1256
|
-
async
|
|
1257
|
-
let t = e.
|
|
1258
|
-
if (!
|
|
1259
|
-
let
|
|
1260
|
-
await this.calendarMonthOutlet.calendar.navigate(new Date(
|
|
1594
|
+
async onYearSelect(e) {
|
|
1595
|
+
let { year: t } = e.detail;
|
|
1596
|
+
if (!this.hasCalendarMonthOutlet) return;
|
|
1597
|
+
let { month: n } = this.calendarMonthOutlet.calendar;
|
|
1598
|
+
await this.calendarMonthOutlet.calendar.navigate(new Date(t, n, 1)), this.hasCalendarYearOutlet && this.calendarYearOutlet.navigate(this.calendarMonthOutlet.calendar.current), this.viewValue = "year", this.draw();
|
|
1261
1599
|
}
|
|
1262
1600
|
previousTargetConnected(e) {
|
|
1263
1601
|
e.addEventListener("click", this.previous);
|
|
@@ -1266,7 +1604,7 @@ var G = 7, K = {
|
|
|
1266
1604
|
e.removeEventListener("click", this.previous);
|
|
1267
1605
|
}
|
|
1268
1606
|
async previous() {
|
|
1269
|
-
await this.calendarMonthOutlet.calendar.step(...this.stepArgs(-1)), this.draw();
|
|
1607
|
+
await this.calendarMonthOutlet.calendar.step(...this.stepArgs(-1)), this.syncOutletValues(), this.draw();
|
|
1270
1608
|
}
|
|
1271
1609
|
nextTargetConnected(e) {
|
|
1272
1610
|
e.addEventListener("click", this.next);
|
|
@@ -1275,22 +1613,10 @@ var G = 7, K = {
|
|
|
1275
1613
|
e.removeEventListener("click", this.next);
|
|
1276
1614
|
}
|
|
1277
1615
|
async next() {
|
|
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);
|
|
1616
|
+
await this.calendarMonthOutlet.calendar.step(...this.stepArgs(1)), this.syncOutletValues(), this.draw();
|
|
1291
1617
|
}
|
|
1292
1618
|
draw() {
|
|
1293
|
-
this.drawDay(), this.drawMonth(), this.drawYear(), this.drawViewTitle(), this.
|
|
1619
|
+
this.drawDay(), this.drawMonth(), this.drawYear(), this.drawViewTitle(), this.drawView();
|
|
1294
1620
|
}
|
|
1295
1621
|
drawDay() {
|
|
1296
1622
|
if (!this.hasDayTarget || !this.hasCalendarMonthOutlet) return;
|
|
@@ -1312,23 +1638,13 @@ var G = 7, K = {
|
|
|
1312
1638
|
let { year: e, month: t } = this.calendarMonthOutlet.calendar;
|
|
1313
1639
|
this.viewTitleTarget.textContent = this.viewTitleLabel(e, t);
|
|
1314
1640
|
}
|
|
1315
|
-
|
|
1316
|
-
if (!this.
|
|
1317
|
-
let {
|
|
1318
|
-
|
|
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);
|
|
1641
|
+
syncOutletValues() {
|
|
1642
|
+
if (!this.hasCalendarMonthOutlet) return;
|
|
1643
|
+
let { current: e } = this.calendarMonthOutlet.calendar;
|
|
1644
|
+
e && (this.hasCalendarYearOutlet && this.calendarYearOutlet.navigate(e), this.hasCalendarDecadeOutlet && this.calendarDecadeOutlet.navigate(e));
|
|
1323
1645
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
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);
|
|
1646
|
+
stepArgs(e) {
|
|
1647
|
+
return this.viewValue === "year" ? ["year", e] : this.viewValue === "decade" ? ["year", e * 10] : ["month", e];
|
|
1332
1648
|
}
|
|
1333
1649
|
viewTitleLabel(e, t) {
|
|
1334
1650
|
if (this.viewValue === "year") return String(e);
|
|
@@ -1341,16 +1657,15 @@ var G = 7, K = {
|
|
|
1341
1657
|
year: "numeric"
|
|
1342
1658
|
}).format(new Date(e, t));
|
|
1343
1659
|
}
|
|
1344
|
-
stepArgs(e) {
|
|
1345
|
-
return this.viewValue === "year" ? ["year", e] : this.viewValue === "decade" ? ["year", e * 10] : ["month", e];
|
|
1346
|
-
}
|
|
1347
1660
|
drawView() {
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1661
|
+
let e = this.viewValue === "month", t = this.viewValue === "year", n = this.viewValue === "decade";
|
|
1662
|
+
if (this.hasCalendarMonthOutlet) {
|
|
1663
|
+
let t = this.calendarMonthOutlet;
|
|
1664
|
+
t.hasDaysOfWeekTarget && (t.daysOfWeekTarget.hidden = !e), t.hasDaysOfMonthTarget && (t.daysOfMonthTarget.hidden = !e);
|
|
1351
1665
|
}
|
|
1666
|
+
this.hasCalendarYearOutlet && (this.calendarYearOutletElement.hidden = !t), this.hasCalendarDecadeOutlet && (this.calendarDecadeOutletElement.hidden = !n);
|
|
1352
1667
|
}
|
|
1353
|
-
},
|
|
1668
|
+
}, et = class extends e {
|
|
1354
1669
|
static targets = [
|
|
1355
1670
|
"listbox",
|
|
1356
1671
|
"loading",
|
|
@@ -1373,6 +1688,12 @@ var G = 7, K = {
|
|
|
1373
1688
|
initialize() {
|
|
1374
1689
|
this._requestor = new w();
|
|
1375
1690
|
}
|
|
1691
|
+
connect() {
|
|
1692
|
+
this.hasListboxTarget && (this.listboxNav = new d(this.listboxTarget));
|
|
1693
|
+
}
|
|
1694
|
+
disconnect() {
|
|
1695
|
+
this._requestor.cancel();
|
|
1696
|
+
}
|
|
1376
1697
|
onSelect(e) {
|
|
1377
1698
|
let t = e.target.closest("[role=\"option\"]");
|
|
1378
1699
|
!t || t.getAttribute("aria-disabled") === "true" || this.select(t.dataset.value ?? "");
|
|
@@ -1387,24 +1708,7 @@ var G = 7, K = {
|
|
|
1387
1708
|
});
|
|
1388
1709
|
}
|
|
1389
1710
|
onNavigate(e) {
|
|
1390
|
-
|
|
1391
|
-
"ArrowUp",
|
|
1392
|
-
"ArrowDown",
|
|
1393
|
-
"Enter",
|
|
1394
|
-
" "
|
|
1395
|
-
].includes(e.key)) {
|
|
1396
|
-
if (e.preventDefault(), e.key === "Enter" || e.key === " ") {
|
|
1397
|
-
this.listboxTarget.querySelector("[aria-selected=\"true\"]")?.click();
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
this.step(e.key === "ArrowDown" ? 1 : -1);
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
step(e) {
|
|
1404
|
-
let t = [...this.listboxTarget.querySelectorAll("[role=\"option\"]:not([aria-disabled=\"true\"]):not([hidden])")];
|
|
1405
|
-
if (!t.length) return;
|
|
1406
|
-
let n = this.listboxTarget.querySelector("[aria-selected=\"true\"]"), r = t.indexOf(n), i = e > 0 ? t[Math.min(r + 1, t.length - 1)] : t[Math.max(r - 1, 0)];
|
|
1407
|
-
!i || i === n || (t.forEach((e) => e.setAttribute("aria-selected", "false")), i.setAttribute("aria-selected", "true"), i.scrollIntoView({ block: "nearest" }));
|
|
1711
|
+
this.listboxNav?.handleKeyDown(e);
|
|
1408
1712
|
}
|
|
1409
1713
|
filter(e) {
|
|
1410
1714
|
if (this.urlValue) {
|
|
@@ -1428,10 +1732,7 @@ var G = 7, K = {
|
|
|
1428
1732
|
setEmpty(e) {
|
|
1429
1733
|
this.hasEmptyTarget && (this.emptyTarget.hidden = !e);
|
|
1430
1734
|
}
|
|
1431
|
-
|
|
1432
|
-
this._requestor.cancel();
|
|
1433
|
-
}
|
|
1434
|
-
}, Be = class extends e {
|
|
1735
|
+
}, tt = class extends e {
|
|
1435
1736
|
static targets = [
|
|
1436
1737
|
"hour",
|
|
1437
1738
|
"minute",
|
|
@@ -1467,12 +1768,12 @@ var G = 7, K = {
|
|
|
1467
1768
|
selectedValue(e) {
|
|
1468
1769
|
return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
|
|
1469
1770
|
}
|
|
1470
|
-
},
|
|
1771
|
+
}, nt = class extends e {
|
|
1471
1772
|
static targets = ["trigger"];
|
|
1472
1773
|
connect() {
|
|
1473
|
-
|
|
1774
|
+
Q(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
|
|
1474
1775
|
}
|
|
1475
|
-
},
|
|
1776
|
+
}, rt = class extends e {
|
|
1476
1777
|
static targets = ["anchor", "reference"];
|
|
1477
1778
|
static values = {
|
|
1478
1779
|
placement: {
|
|
@@ -1497,7 +1798,7 @@ var G = 7, K = {
|
|
|
1497
1798
|
console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
|
|
1498
1799
|
return;
|
|
1499
1800
|
}
|
|
1500
|
-
|
|
1801
|
+
Le(this, {
|
|
1501
1802
|
element: this.referenceTarget,
|
|
1502
1803
|
anchor: this.anchorTarget,
|
|
1503
1804
|
placement: this.placementValue,
|
|
@@ -1505,7 +1806,7 @@ var G = 7, K = {
|
|
|
1505
1806
|
ariaRole: this.roleValue
|
|
1506
1807
|
});
|
|
1507
1808
|
}
|
|
1508
|
-
},
|
|
1809
|
+
}, it = class extends e {
|
|
1509
1810
|
static targets = ["trigger", "input"];
|
|
1510
1811
|
static values = {
|
|
1511
1812
|
value: String,
|
|
@@ -1530,7 +1831,7 @@ var G = 7, K = {
|
|
|
1530
1831
|
valueValueChanged(e) {
|
|
1531
1832
|
this.hasInputTarget && (this.inputTarget.value = e), this.dispatch("changed", { detail: { value: e } });
|
|
1532
1833
|
}
|
|
1533
|
-
},
|
|
1834
|
+
}, at = class extends e {
|
|
1534
1835
|
static targets = ["input", "toggle"];
|
|
1535
1836
|
static values = {
|
|
1536
1837
|
format: {
|
|
@@ -1547,19 +1848,19 @@ var G = 7, K = {
|
|
|
1547
1848
|
}
|
|
1548
1849
|
};
|
|
1549
1850
|
connect() {
|
|
1550
|
-
|
|
1851
|
+
B(this, {
|
|
1551
1852
|
type: this.formatValue,
|
|
1552
1853
|
options: this.optionsValue
|
|
1553
1854
|
}), this.format(this.readValue()), this.drawToggle();
|
|
1554
1855
|
}
|
|
1555
1856
|
formatValueChanged() {
|
|
1556
|
-
this.formatter && (
|
|
1857
|
+
this.formatter && (B(this, {
|
|
1557
1858
|
type: this.formatValue,
|
|
1558
1859
|
options: this.optionsValue
|
|
1559
1860
|
}), this.format(this.readValue()), this.drawToggle());
|
|
1560
1861
|
}
|
|
1561
1862
|
optionsValueChanged() {
|
|
1562
|
-
this.formatter && (
|
|
1863
|
+
this.formatter && (B(this, {
|
|
1563
1864
|
type: this.formatValue,
|
|
1564
1865
|
options: this.optionsValue
|
|
1565
1866
|
}), this.format(this.readValue()));
|
|
@@ -1599,7 +1900,7 @@ var G = 7, K = {
|
|
|
1599
1900
|
let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
|
|
1600
1901
|
this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
|
|
1601
1902
|
}
|
|
1602
|
-
},
|
|
1903
|
+
}, ot = class extends e {
|
|
1603
1904
|
static targets = ["input", "clear"];
|
|
1604
1905
|
initialize() {
|
|
1605
1906
|
this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
|
|
@@ -1622,7 +1923,7 @@ var G = 7, K = {
|
|
|
1622
1923
|
handleEscape(e) {
|
|
1623
1924
|
e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
|
|
1624
1925
|
}
|
|
1625
|
-
},
|
|
1926
|
+
}, st = class extends e {
|
|
1626
1927
|
static targets = ["modal", "overlay"];
|
|
1627
1928
|
initialize() {
|
|
1628
1929
|
this.onCancel = this.close.bind(this);
|
|
@@ -1631,7 +1932,10 @@ var G = 7, K = {
|
|
|
1631
1932
|
this.hasModalTarget || console.error("ModalController requires a modal target. Add data-modal-target=\"modal\" to your element.");
|
|
1632
1933
|
}
|
|
1633
1934
|
modalTargetConnected(e) {
|
|
1634
|
-
this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, {
|
|
1935
|
+
this.isNativeDialog = e instanceof HTMLDialogElement, this.isNativeDialog ? (e.addEventListener("cancel", this.onCancel), e.addEventListener("click", this.onBackdropClick)) : (this.focusTrap = new a(e, {
|
|
1936
|
+
escapeDeactivates: !0,
|
|
1937
|
+
onDeactivate: () => this.close()
|
|
1938
|
+
}), Q(this, { element: e }));
|
|
1635
1939
|
}
|
|
1636
1940
|
modalTargetDisconnected(e) {
|
|
1637
1941
|
this.isNativeDialog && (e.removeEventListener("cancel", this.onCancel), e.removeEventListener("click", this.onBackdropClick));
|
|
@@ -1646,7 +1950,7 @@ var G = 7, K = {
|
|
|
1646
1950
|
let e = this.hasOverlayTarget ? this.overlayTarget : this.modalTarget;
|
|
1647
1951
|
e.hidden = !1, document.body.style.overflow = "hidden", this.focusTrap && this.focusTrap.activate();
|
|
1648
1952
|
}
|
|
1649
|
-
|
|
1953
|
+
f("Modal opened");
|
|
1650
1954
|
}
|
|
1651
1955
|
}
|
|
1652
1956
|
close(e) {
|
|
@@ -1658,19 +1962,19 @@ var G = 7, K = {
|
|
|
1658
1962
|
let e = this.hasOverlayTarget ? this.overlayTarget : this.modalTarget;
|
|
1659
1963
|
e.hidden = !0, document.body.style.overflow = "", this.focusTrap && this.focusTrap.deactivate();
|
|
1660
1964
|
}
|
|
1661
|
-
|
|
1965
|
+
f("Modal closed");
|
|
1662
1966
|
}
|
|
1663
1967
|
}
|
|
1664
1968
|
onBackdropClick = (e) => {
|
|
1665
1969
|
let t = this.modalTarget.getBoundingClientRect();
|
|
1666
1970
|
(e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
|
|
1667
1971
|
};
|
|
1668
|
-
},
|
|
1972
|
+
}, ct = class extends e {
|
|
1669
1973
|
static targets = ["content"];
|
|
1670
1974
|
connect() {
|
|
1671
|
-
|
|
1975
|
+
Be(this, { element: this.hasContentTarget ? this.contentTarget : null });
|
|
1672
1976
|
}
|
|
1673
|
-
},
|
|
1977
|
+
}, lt = class extends e {
|
|
1674
1978
|
static targets = [
|
|
1675
1979
|
"trigger",
|
|
1676
1980
|
"panel",
|
|
@@ -1692,16 +1996,24 @@ var G = 7, K = {
|
|
|
1692
1996
|
closeOnSelect: {
|
|
1693
1997
|
type: Boolean,
|
|
1694
1998
|
default: !0
|
|
1999
|
+
},
|
|
2000
|
+
announceOpen: {
|
|
2001
|
+
type: String,
|
|
2002
|
+
default: "Panel opened"
|
|
2003
|
+
},
|
|
2004
|
+
announceClose: {
|
|
2005
|
+
type: String,
|
|
2006
|
+
default: "Panel closed"
|
|
1695
2007
|
}
|
|
1696
2008
|
};
|
|
1697
2009
|
connect() {
|
|
1698
|
-
|
|
2010
|
+
Me(this, {
|
|
1699
2011
|
element: this.hasPanelTarget ? this.panelTarget : null,
|
|
1700
2012
|
url: this.hasUrlValue ? this.urlValue : null
|
|
1701
|
-
}), this.hasPanelTarget && (
|
|
2013
|
+
}), this.hasPanelTarget && (Ue(this, {
|
|
1702
2014
|
element: this.panelTarget,
|
|
1703
2015
|
activator: this.hasTriggerTarget ? this.triggerTarget : null
|
|
1704
|
-
}),
|
|
2016
|
+
}), Q(this)), this.hasLoaderTarget && Ue(this, {
|
|
1705
2017
|
element: this.loaderTarget,
|
|
1706
2018
|
visibility: "contentLoaderVisibility"
|
|
1707
2019
|
});
|
|
@@ -1722,10 +2034,10 @@ var G = 7, K = {
|
|
|
1722
2034
|
this.closeOnSelectValue && await this.close();
|
|
1723
2035
|
}
|
|
1724
2036
|
async shown() {
|
|
1725
|
-
await this.load(), this.hasPanelTarget && i(this.panelTarget);
|
|
2037
|
+
await this.load(), this.hasPanelTarget && i(this.panelTarget), f(this.announceOpenValue);
|
|
1726
2038
|
}
|
|
1727
2039
|
async hidden() {
|
|
1728
|
-
this.hasTriggerTarget && this.triggerTarget.focus();
|
|
2040
|
+
this.hasTriggerTarget && this.triggerTarget.focus(), f(this.announceCloseValue);
|
|
1729
2041
|
}
|
|
1730
2042
|
canLoad() {
|
|
1731
2043
|
return this.hasPanelTarget && this.panelTarget.tagName.toLowerCase() === "turbo-frame" ? (this.hasUrlValue && this.panelTarget.setAttribute("src", this.urlValue), !1) : !0;
|
|
@@ -1746,6 +2058,63 @@ var G = 7, K = {
|
|
|
1746
2058
|
contentLoader() {
|
|
1747
2059
|
if (this.hasTemplateTarget) return this.templateTarget instanceof HTMLTemplateElement ? this.templateTarget.content : this.templateTarget.innerHTML;
|
|
1748
2060
|
}
|
|
2061
|
+
}, ut = class extends e {
|
|
2062
|
+
static targets = [
|
|
2063
|
+
"trigger",
|
|
2064
|
+
"detail",
|
|
2065
|
+
"time"
|
|
2066
|
+
];
|
|
2067
|
+
static values = { dateFormat: {
|
|
2068
|
+
type: Object,
|
|
2069
|
+
default: {}
|
|
2070
|
+
} };
|
|
2071
|
+
connect() {
|
|
2072
|
+
this.rovingTabIndex = new u(this.triggerTargets, { orientation: "vertical" }), this.rovingTabIndex.activate();
|
|
2073
|
+
}
|
|
2074
|
+
disconnect() {
|
|
2075
|
+
this.rovingTabIndex?.deactivate(), this.rovingTabIndex = null;
|
|
2076
|
+
}
|
|
2077
|
+
toggle(e) {
|
|
2078
|
+
let t = e.currentTarget;
|
|
2079
|
+
t.getAttribute("aria-expanded") === "true" ? this.collapseItem(t) : this.expandItem(t);
|
|
2080
|
+
}
|
|
2081
|
+
expand(e) {
|
|
2082
|
+
this.expandItem(e.currentTarget);
|
|
2083
|
+
}
|
|
2084
|
+
collapse(e) {
|
|
2085
|
+
this.collapseItem(e.currentTarget);
|
|
2086
|
+
}
|
|
2087
|
+
expandItem(e) {
|
|
2088
|
+
let t = this.detailTargets.find((t) => t.id === e.getAttribute("aria-controls")) ?? null;
|
|
2089
|
+
this.dispatch("expand", { detail: {
|
|
2090
|
+
trigger: e,
|
|
2091
|
+
detail: t
|
|
2092
|
+
} }), g(e, !0), t && (v(t, !1), f(`${e.textContent.trim()} expanded`)), this.dispatch("expanded", { detail: {
|
|
2093
|
+
trigger: e,
|
|
2094
|
+
detail: t
|
|
2095
|
+
} });
|
|
2096
|
+
}
|
|
2097
|
+
collapseItem(e) {
|
|
2098
|
+
let t = this.detailTargets.find((t) => t.id === e.getAttribute("aria-controls")) ?? null;
|
|
2099
|
+
this.dispatch("collapse", { detail: {
|
|
2100
|
+
trigger: e,
|
|
2101
|
+
detail: t
|
|
2102
|
+
} }), g(e, !1), t && (v(t, !0), f(`${e.textContent.trim()} collapsed`)), this.dispatch("collapsed", { detail: {
|
|
2103
|
+
trigger: e,
|
|
2104
|
+
detail: t
|
|
2105
|
+
} });
|
|
2106
|
+
}
|
|
2107
|
+
triggerTargetConnected(e) {
|
|
2108
|
+
e.hasAttribute("aria-expanded") || e.setAttribute("aria-expanded", "false"), this.rovingTabIndex?.updateItems(this.triggerTargets);
|
|
2109
|
+
}
|
|
2110
|
+
triggerTargetDisconnected() {
|
|
2111
|
+
this.rovingTabIndex?.updateItems(this.triggerTargets);
|
|
2112
|
+
}
|
|
2113
|
+
timeTargetConnected(e) {
|
|
2114
|
+
if (!Object.keys(this.dateFormatValue).length || e.textContent.trim()) return;
|
|
2115
|
+
let t = P.format(e.getAttribute("datetime"), this.dateFormatValue);
|
|
2116
|
+
t && (e.textContent = t);
|
|
2117
|
+
}
|
|
1749
2118
|
};
|
|
1750
2119
|
//#endregion
|
|
1751
|
-
export { y as ARIA_HASPOPUP_VALUES,
|
|
2120
|
+
export { y as ARIA_HASPOPUP_VALUES, Ge as CalendarDecadeController, Ke as CalendarDecadeSelectorController, qe as CalendarMonthController, Je as CalendarMonthSelectorController, Xe as CalendarYearController, Ze as CalendarYearSelectorController, Qe as ClipboardController, $e as ComboboxDateController, et as ComboboxDropdownController, tt as ComboboxTimeController, nt as DismisserController, t as FOCUSABLE_SELECTOR, I as FORMATTER_TYPES, rt as FlipperController, a as FocusTrap, z as Formatter, ot as InputClearableController, it as InputComboboxController, at as InputFormatterController, d as ListboxNavigation, st as ModalController, ct as PannerController, lt as PopoverController, w as Requestor, u as RovingTabIndex, ut as TimelineController, f as announce, S as connectTriggerToTarget, re as disconnectTriggerFromTarget, m as ensureId, E as filterOptions, i as focusFirst, T as fuzzyMatcher, p as generateId, n as getFocusableElements, s as isActivationKey, c as isArrowKey, o as isKey, r as isVisible, l as preventDefault, h as setAriaState, te as setChecked, ne as setDisabled, g as setExpanded, v as setHidden, _ as setPressed };
|