@webority/ui-elements 0.24.0 → 0.25.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.
- package/THIRD-PARTY-NOTICES.txt +131 -0
- package/dist/ui-calendar.global.js +1 -0
- package/dist/ui-calendar.js +9895 -0
- package/dist/ui-chart.global.js +21 -0
- package/dist/ui-chart.js +34545 -0
- package/dist/ui-elements.global.js +137 -126
- package/dist/ui-elements.js +2231 -458
- package/dist/ui-rich-text.global.js +204 -0
- package/dist/ui-rich-text.js +16895 -0
- package/package.json +15 -2
package/dist/ui-elements.js
CHANGED
|
@@ -56,20 +56,34 @@ function u(e) {
|
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/formMirror.js
|
|
58
58
|
var d = "data-wui-mirror";
|
|
59
|
-
function f(e, t) {
|
|
59
|
+
function f(e, t, n, r) {
|
|
60
|
+
t.name = n, t.value = r == null ? "" : String(r);
|
|
61
|
+
for (let n of [...t.attributes]) n.name.startsWith("data-val") && !e.hasAttribute(n.name) && t.removeAttribute(n.name);
|
|
62
|
+
for (let n of e.attributes) n.name.startsWith("data-val") && t.setAttribute(n.name, n.value);
|
|
63
|
+
t.disabled = e.hasAttribute("disabled");
|
|
64
|
+
}
|
|
65
|
+
function p(e) {
|
|
66
|
+
let t = document.createElement("input");
|
|
67
|
+
return t.type = "hidden", t.setAttribute(d, ""), e.appendChild(t), t;
|
|
68
|
+
}
|
|
69
|
+
function m(e, t) {
|
|
60
70
|
let n = e.getAttribute("name"), r = e.querySelector(`:scope > input[${d}]`);
|
|
61
71
|
if (!n) {
|
|
62
72
|
r?.remove();
|
|
63
73
|
return;
|
|
64
74
|
}
|
|
65
|
-
r
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
r ||= p(e), f(e, r, n, t);
|
|
76
|
+
}
|
|
77
|
+
function h(e, t) {
|
|
78
|
+
let n = e.getAttribute("name"), r = [...e.querySelectorAll(`:scope > input[${d}]`)], i = n ? t.length > 0 ? t : [""] : [];
|
|
79
|
+
for (let e of r.splice(i.length)) e.remove();
|
|
80
|
+
i.forEach((t, i) => {
|
|
81
|
+
f(e, r[i] ?? p(e), n, t);
|
|
82
|
+
});
|
|
69
83
|
}
|
|
70
84
|
//#endregion
|
|
71
85
|
//#region src/iconGlyphs.g.js
|
|
72
|
-
var
|
|
86
|
+
var g = {
|
|
73
87
|
activity: "<path d=\"M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"m7.33 14.49 2.38-3.09c.34-.44.97-.52 1.41-.18l1.83 1.44c.44.34 1.07.26 1.41-.17l2.31-2.98\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
74
88
|
alarm: "<path d=\"M2 22h20M12 6a9 9 0 0 0-9 9v7h18v-7a9 9 0 0 0-9-9ZM12 2v1M4 4l1 1M20 4l-1 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
75
89
|
"alert-circle": "<path d=\"M12 7.75V13M21.08 8.58v6.84c0 1.12-.6 2.16-1.57 2.73l-5.94 3.43c-.97.56-2.17.56-3.15 0l-5.94-3.43a3.15 3.15 0 0 1-1.57-2.73V8.58c0-1.12.6-2.16 1.57-2.73l5.94-3.43c.97-.56 2.17-.56 3.15 0l5.94 3.43c.97.57 1.57 1.6 1.57 2.73Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M12 16.2v.1\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
@@ -226,14 +240,14 @@ var p = {
|
|
|
226
240
|
"zoom-in": "<path d=\"M11 20a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM8.5 11h5M11 13.5v-5M18.93 20.69c.53 1.6 1.74 1.76 2.67.36.85-1.28.29-2.33-1.25-2.33-1.14-.01-1.78.88-1.42 1.97Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
227
241
|
"zoom-out": "<path d=\"M9 11.7h5M11.5 21a9.5 9.5 0 1 0 0-19 9.5 9.5 0 0 0 0 19ZM22 22l-2-2\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>"
|
|
228
242
|
};
|
|
229
|
-
Object.keys(
|
|
230
|
-
function
|
|
231
|
-
let i =
|
|
243
|
+
Object.keys(g);
|
|
244
|
+
function _(e, { size: t = 16, className: n = "", style: r = "" } = {}) {
|
|
245
|
+
let i = g[e];
|
|
232
246
|
return i ? `<svg class="${n ? `wui-icon ${n}` : "wui-icon"}" data-icon="${e}" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="vertical-align:-.125em${r ? `;${r}` : ""}">${i}</svg>` : "";
|
|
233
247
|
}
|
|
234
248
|
//#endregion
|
|
235
249
|
//#region src/listboxKeyNav.js
|
|
236
|
-
function
|
|
250
|
+
function v(e) {
|
|
237
251
|
let { getVisibleOptions: t, getActive: n, setActive: r, onEnter: i, onEscape: a, onTypeahead: o, typeaheadMs: s = 500 } = e, c = "", l = null, u = () => {
|
|
238
252
|
clearTimeout(l), l = null, c = "";
|
|
239
253
|
};
|
|
@@ -264,18 +278,18 @@ function h(e) {
|
|
|
264
278
|
}
|
|
265
279
|
//#endregion
|
|
266
280
|
//#region src/optionLabel.js
|
|
267
|
-
var
|
|
281
|
+
var y = Symbol("wui.trustedHtml"), b = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), x = (e) => {
|
|
268
282
|
if (!e) return "";
|
|
269
283
|
let t = String(e).toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
270
|
-
return t ?
|
|
271
|
-
},
|
|
284
|
+
return t ? _(t) : "";
|
|
285
|
+
}, S = (e) => `wui-flag wui-flag-${e}`, ee = (e) => {
|
|
272
286
|
let t = String(e ?? "").toLowerCase();
|
|
273
|
-
return /^[a-z]{2}$/.test(t) ? `<span class="${
|
|
274
|
-
},
|
|
287
|
+
return /^[a-z]{2}$/.test(t) ? `<span class="${S(t)}" aria-hidden="true"></span>` : "";
|
|
288
|
+
}, C = (e) => {
|
|
275
289
|
if (e == null) return "";
|
|
276
|
-
let t = e[
|
|
290
|
+
let t = e[y] ? String(e.label ?? "") : b(e.label), n = ee(e.flag) + x(e.icon);
|
|
277
291
|
return n ? `<span class="wui-opt-label">${n}${t}</span>` : t;
|
|
278
|
-
},
|
|
292
|
+
}, w = class extends e {
|
|
279
293
|
static formAssociated = !0;
|
|
280
294
|
_accessibleName() {
|
|
281
295
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -334,14 +348,14 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
334
348
|
return this._value;
|
|
335
349
|
}
|
|
336
350
|
set value(e) {
|
|
337
|
-
this._value = e == null ? "" : String(e),
|
|
351
|
+
this._value = e == null ? "" : String(e), m(this, this._value);
|
|
338
352
|
let t = this._readOptions().find((e) => String(e.value) === this._value);
|
|
339
|
-
this._label = t ?
|
|
353
|
+
this._label = t ? E(t.label) : "", this._syncInput(), this._renderOptions("");
|
|
340
354
|
}
|
|
341
355
|
set options(e) {
|
|
342
356
|
this._optionsProp = Array.isArray(e) ? e : [];
|
|
343
357
|
let t = this._readOptions().find((e) => String(e.value) === this._value);
|
|
344
|
-
t && (this._label =
|
|
358
|
+
t && (this._label = E(t.label)), this._renderOptions(), this._syncInput();
|
|
345
359
|
}
|
|
346
360
|
get options() {
|
|
347
361
|
return this._readOptions();
|
|
@@ -360,7 +374,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
360
374
|
}
|
|
361
375
|
_matchesKnownOption(e) {
|
|
362
376
|
let t = e.toLowerCase();
|
|
363
|
-
return this._readOptions().some((e) =>
|
|
377
|
+
return this._readOptions().some((e) => E(e.label).toLowerCase() === t || String(e.value ?? "").toLowerCase() === t);
|
|
364
378
|
}
|
|
365
379
|
get _minChars() {
|
|
366
380
|
return Math.max(0, Number(this.getAttribute("min-chars")) || +!!this._remote);
|
|
@@ -378,7 +392,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
378
392
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
379
393
|
label: e.innerHTML,
|
|
380
394
|
icon: e.getAttribute("icon") || void 0,
|
|
381
|
-
[
|
|
395
|
+
[y]: !0,
|
|
382
396
|
selected: e.hasAttribute("selected")
|
|
383
397
|
})));
|
|
384
398
|
}
|
|
@@ -392,17 +406,17 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
392
406
|
let r = `${this.id}-listbox`;
|
|
393
407
|
this._listboxId = r, this.innerHTML = `
|
|
394
408
|
<div class="search-select${n}">
|
|
395
|
-
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
396
|
-
<input class="search-select-input search-select-ac-input" placeholder="${
|
|
409
|
+
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${T(r)}" aria-label="${T(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}>
|
|
410
|
+
<input class="search-select-input search-select-ac-input" placeholder="${T(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
397
411
|
<span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
|
|
398
|
-
<button type="button" class="search-select-clear" aria-label="Clear" hidden>${
|
|
412
|
+
<button type="button" class="search-select-clear" aria-label="Clear" hidden>${_("x")}</button>
|
|
399
413
|
</div>
|
|
400
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
414
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${T(r)}" tabindex="-1" hidden>
|
|
401
415
|
<div class="search-select-options"></div>
|
|
402
416
|
<div class="search-select-empty" hidden>No matches</div>
|
|
403
417
|
<div class="search-select-hint" hidden>Type to search…</div>
|
|
404
418
|
</div>
|
|
405
|
-
</div>`, this._rendered = !0,
|
|
419
|
+
</div>`, this._rendered = !0, m(this, this._value), this._wire(), this._syncInput(), this._renderOptions();
|
|
406
420
|
}
|
|
407
421
|
_refs() {
|
|
408
422
|
return {
|
|
@@ -431,7 +445,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
431
445
|
let t = this._refs();
|
|
432
446
|
if (!t.optionsWrap) return;
|
|
433
447
|
let n = e ?? (t.input ? t.input.value : ""), r = n.trim().toLowerCase(), i = this._readOptions();
|
|
434
|
-
!this._remote && r && (i = i.filter((e) =>
|
|
448
|
+
!this._remote && r && (i = i.filter((e) => E(e.label).toLowerCase().includes(r)));
|
|
435
449
|
let a = n.trim(), o = this._allowCustom && a && !this._matchesKnownOption(a) ? [...i, {
|
|
436
450
|
value: a,
|
|
437
451
|
custom: !0
|
|
@@ -439,11 +453,11 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
439
453
|
t.optionsWrap.innerHTML = o.map((e, t) => {
|
|
440
454
|
let n = `${s}-opt-${t}`;
|
|
441
455
|
if (e.custom) {
|
|
442
|
-
let t = `Add “${
|
|
443
|
-
return `<button type="button" role="option" id="${
|
|
456
|
+
let t = `Add “${b(e.value)}”`;
|
|
457
|
+
return `<button type="button" role="option" id="${T(n)}" class="search-select-option search-select-option-custom" data-value="${T(e.value)}" data-custom="true" aria-selected="false">${t}</button>`;
|
|
444
458
|
}
|
|
445
459
|
let r = String(e.value) === String(this._value);
|
|
446
|
-
return `<button type="button" role="option" id="${
|
|
460
|
+
return `<button type="button" role="option" id="${T(n)}" class="search-select-option${r ? " selected" : ""}" data-value="${T(e.value)}" aria-selected="${r}">${C(e)}</button>`;
|
|
447
461
|
}).join(""), this._active = -1, t.control?.removeAttribute("aria-activedescendant");
|
|
448
462
|
let c = r.length < this._minChars;
|
|
449
463
|
t.hint && (t.hint.hidden = !(this._remote && c && !i.length)), t.empty && (t.empty.hidden = this._loading || o.length > 0 || this._remote && c), this._reanchor?.();
|
|
@@ -463,12 +477,12 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
463
477
|
e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), r(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", this._syncInput();
|
|
464
478
|
}, s = (t) => {
|
|
465
479
|
let n = t.dataset.custom === "true";
|
|
466
|
-
this._value = t.dataset.value, this._label = n ? t.dataset.value :
|
|
480
|
+
this._value = t.dataset.value, this._label = n ? t.dataset.value : E(t.innerHTML), m(this, this._value), e.input.value = this._label, this.dispatchEvent(new CustomEvent("change", {
|
|
467
481
|
bubbles: !0,
|
|
468
482
|
detail: { isCustom: n }
|
|
469
483
|
})), o(), e.input.focus();
|
|
470
484
|
}, u = (t) => {
|
|
471
|
-
this._value = t, this._label = t,
|
|
485
|
+
this._value = t, this._label = t, m(this, t), e.input.value = t, this.dispatchEvent(new CustomEvent("change", {
|
|
472
486
|
bubbles: !0,
|
|
473
487
|
detail: { isCustom: !0 }
|
|
474
488
|
})), o();
|
|
@@ -486,7 +500,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
486
500
|
}, this._timer = setTimeout(() => this._fireSearch(t, e), this._debounceMs);
|
|
487
501
|
} else this._renderOptions(t);
|
|
488
502
|
};
|
|
489
|
-
this._navHandler =
|
|
503
|
+
this._navHandler = v({
|
|
490
504
|
getVisibleOptions: n,
|
|
491
505
|
getActive: () => this._active,
|
|
492
506
|
setActive: (e) => r(e),
|
|
@@ -501,7 +515,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
501
515
|
this._navHandler.clearTypeahead(), o();
|
|
502
516
|
}
|
|
503
517
|
});
|
|
504
|
-
let
|
|
518
|
+
let f = (e) => {
|
|
505
519
|
let t = e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA";
|
|
506
520
|
if (e.key === "ArrowDown") {
|
|
507
521
|
e.preventDefault(), i() || a();
|
|
@@ -515,7 +529,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
515
529
|
else if (e.key.length === 1 && (e.ctrlKey || e.metaKey || e.altKey || !i() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA") && (!i() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA")) return;
|
|
516
530
|
this._navHandler.handler(e);
|
|
517
531
|
};
|
|
518
|
-
e.input.addEventListener("focus", () => a()), e.input.addEventListener("input", d), e.input.addEventListener("keydown",
|
|
532
|
+
e.input.addEventListener("focus", () => a()), e.input.addEventListener("input", d), e.input.addEventListener("keydown", f), e.menu.addEventListener("keydown", f), e.input.addEventListener("blur", (t) => {
|
|
519
533
|
if (!this._allowCustom || t.relatedTarget && this.contains(t.relatedTarget)) return;
|
|
520
534
|
let n = e.input.value.trim();
|
|
521
535
|
!n || n === this._label || this._matchesKnownOption(n) || u(n);
|
|
@@ -526,7 +540,7 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
526
540
|
let t = e.target.closest(".search-select-option");
|
|
527
541
|
t && r(this._optionEls().indexOf(t));
|
|
528
542
|
}), e.optionsWrap.addEventListener("mouseleave", () => r(-1)), e.clear?.addEventListener("click", () => {
|
|
529
|
-
this._value = "", this._label = "",
|
|
543
|
+
this._value = "", this._label = "", m(this, ""), e.input.value = "", e.clear.hidden = !0, this._renderOptions(""), this.dispatchEvent(new Event("change", { bubbles: !0 })), e.input.focus();
|
|
530
544
|
}), this._bindGlobal = () => {
|
|
531
545
|
this._teardown(), this._onDocClick = (e) => {
|
|
532
546
|
i() && !this.contains(e.target) && o();
|
|
@@ -550,10 +564,10 @@ var g = Symbol("wui.trustedHtml"), _ = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
550
564
|
disconnectedCallback() {
|
|
551
565
|
this._teardown();
|
|
552
566
|
}
|
|
553
|
-
},
|
|
567
|
+
}, T = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), E = (e) => String(e ?? "").replace(/<[^>]*>/g, "");
|
|
554
568
|
//#endregion
|
|
555
569
|
//#region src/textMatch.js
|
|
556
|
-
function
|
|
570
|
+
function D(e, t) {
|
|
557
571
|
let n = String(e ?? ""), r = String(t ?? "").trim();
|
|
558
572
|
if (!r || !n) return [{
|
|
559
573
|
text: n,
|
|
@@ -579,7 +593,7 @@ function T(e, t) {
|
|
|
579
593
|
}
|
|
580
594
|
//#endregion
|
|
581
595
|
//#region src/WuiCommandPalette.js
|
|
582
|
-
var
|
|
596
|
+
var O = "[role=\"option\"]", te = "No results", ne = class extends e {
|
|
583
597
|
static get observedAttributes() {
|
|
584
598
|
return [
|
|
585
599
|
"filter",
|
|
@@ -622,7 +636,7 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
622
636
|
this.setAttribute("highlight", e ? "true" : "false");
|
|
623
637
|
}
|
|
624
638
|
get emptyText() {
|
|
625
|
-
return this.getAttribute("empty-text") ??
|
|
639
|
+
return this.getAttribute("empty-text") ?? te;
|
|
626
640
|
}
|
|
627
641
|
set emptyText(e) {
|
|
628
642
|
this.setAttribute("empty-text", String(e ?? ""));
|
|
@@ -639,7 +653,7 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
639
653
|
return this.querySelector("[role=\"combobox\"]");
|
|
640
654
|
}
|
|
641
655
|
_optionFrom(e, t = !1) {
|
|
642
|
-
let n = e?.closest?.(
|
|
656
|
+
let n = e?.closest?.(O);
|
|
643
657
|
return n && this.contains(n) && !this._isHidden(n) && (t || !this._isDisabled(n)) ? n : null;
|
|
644
658
|
}
|
|
645
659
|
_isDisabled(e) {
|
|
@@ -649,11 +663,11 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
649
663
|
return e.hidden || !!e.closest("[role=\"group\"]")?.hidden;
|
|
650
664
|
}
|
|
651
665
|
_selectableOptions() {
|
|
652
|
-
return [...this.querySelectorAll(
|
|
666
|
+
return [...this.querySelectorAll(O)].filter((e) => !this._isHidden(e) && !this._isDisabled(e));
|
|
653
667
|
}
|
|
654
668
|
_setActive(e, t) {
|
|
655
669
|
this._activeId = e ? e.id : null;
|
|
656
|
-
for (let t of this.querySelectorAll(
|
|
670
|
+
for (let t of this.querySelectorAll(O)) t.setAttribute("aria-selected", t === e ? "true" : "false");
|
|
657
671
|
let n = this._input();
|
|
658
672
|
n && (e ? n.setAttribute("aria-activedescendant", e.id) : n.removeAttribute("aria-activedescendant")), e && t && e.scrollIntoView({ block: "nearest" });
|
|
659
673
|
}
|
|
@@ -689,11 +703,11 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
689
703
|
}
|
|
690
704
|
_applyFilter() {
|
|
691
705
|
let e = this._input(), t = (e ? e.value : "").trim(), n = t.toLowerCase(), r = this.highlight, i = 0;
|
|
692
|
-
for (let e of this.querySelectorAll(
|
|
706
|
+
for (let e of this.querySelectorAll(O)) {
|
|
693
707
|
let a = e.querySelector(".wui-cmd-item-label"), o = e.dataset.label ?? a?.textContent ?? "", s = !n || o.toLowerCase().includes(n);
|
|
694
|
-
e.hidden = !s, s && i++, a && (a.innerHTML =
|
|
708
|
+
e.hidden = !s, s && i++, a && (a.innerHTML = D(o, r ? t : "").map((e) => e.match ? `<mark class="wui-cmd-mark">${b(e.text)}</mark>` : b(e.text)).join(""));
|
|
695
709
|
}
|
|
696
|
-
for (let e of this.querySelectorAll("[role=\"group\"]")) e.hidden = ![...e.querySelectorAll(
|
|
710
|
+
for (let e of this.querySelectorAll("[role=\"group\"]")) e.hidden = ![...e.querySelectorAll(O)].some((e) => !e.hidden);
|
|
697
711
|
let a = this.querySelector("[role=\"listbox\"]");
|
|
698
712
|
a && (a.hidden = i === 0);
|
|
699
713
|
let o = this.querySelector(".wui-cmd-empty");
|
|
@@ -702,7 +716,7 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
702
716
|
_teardown() {
|
|
703
717
|
this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("click", this._onClick), this.removeEventListener("mousedown", this._onMouseDown), this.removeEventListener("mousemove", this._onMouseMove), this.removeEventListener("input", this._onInput);
|
|
704
718
|
}
|
|
705
|
-
},
|
|
719
|
+
}, re = {
|
|
706
720
|
"--color-primary": "#4F46E5",
|
|
707
721
|
"--color-primary-hover": "#4338CA",
|
|
708
722
|
"--color-text": "#071437",
|
|
@@ -712,21 +726,21 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
712
726
|
"--wui-radius-lg": "14px",
|
|
713
727
|
"--wui-shadow-overlay-lg": "0 24px 60px -16px rgba(7, 20, 55, 0.28)",
|
|
714
728
|
"--wui-z-fixed": "1030"
|
|
715
|
-
},
|
|
729
|
+
}, k = (e) => `var(${e}, ${re[e]})`, ie = `
|
|
716
730
|
:host {
|
|
717
731
|
all: initial;
|
|
718
732
|
position: fixed;
|
|
719
733
|
bottom: 20px;
|
|
720
734
|
left: 20px;
|
|
721
735
|
right: auto;
|
|
722
|
-
z-index: ${
|
|
736
|
+
z-index: ${k("--wui-z-fixed")};
|
|
723
737
|
display: block;
|
|
724
738
|
width: 420px;
|
|
725
739
|
max-width: calc(100vw - 40px);
|
|
726
740
|
font-family: inherit;
|
|
727
741
|
font-size: 16px;
|
|
728
742
|
line-height: 1.5;
|
|
729
|
-
color: ${
|
|
743
|
+
color: ${k("--color-text")};
|
|
730
744
|
}
|
|
731
745
|
:host([position="bottom-right"]) {
|
|
732
746
|
right: 20px;
|
|
@@ -744,10 +758,10 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
744
758
|
|
|
745
759
|
.wui-consent-banner-panel {
|
|
746
760
|
padding: 20px;
|
|
747
|
-
background: ${
|
|
748
|
-
border: 1px solid ${
|
|
749
|
-
border-radius: ${
|
|
750
|
-
box-shadow: ${
|
|
761
|
+
background: ${k("--color-surface")};
|
|
762
|
+
border: 1px solid ${k("--color-border")};
|
|
763
|
+
border-radius: ${k("--wui-radius-lg")};
|
|
764
|
+
box-shadow: ${k("--wui-shadow-overlay-lg")};
|
|
751
765
|
text-align: start;
|
|
752
766
|
pointer-events: auto;
|
|
753
767
|
}
|
|
@@ -756,16 +770,16 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
756
770
|
font-size: 18px;
|
|
757
771
|
font-weight: 600;
|
|
758
772
|
line-height: 1.3;
|
|
759
|
-
color: ${
|
|
773
|
+
color: ${k("--color-text")};
|
|
760
774
|
}
|
|
761
775
|
.wui-consent-banner-description {
|
|
762
776
|
margin: 0 0 16px;
|
|
763
777
|
font-size: 14px;
|
|
764
778
|
line-height: 1.5;
|
|
765
|
-
color: ${
|
|
779
|
+
color: ${k("--color-text-muted")};
|
|
766
780
|
}
|
|
767
781
|
.wui-consent-banner-policy {
|
|
768
|
-
color: ${
|
|
782
|
+
color: ${k("--color-primary")};
|
|
769
783
|
font-weight: 500;
|
|
770
784
|
}
|
|
771
785
|
|
|
@@ -776,15 +790,15 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
776
790
|
margin: 0 0 16px;
|
|
777
791
|
padding: 12px 0;
|
|
778
792
|
overflow-y: auto;
|
|
779
|
-
border-top: 1px solid ${
|
|
780
|
-
border-bottom: 1px solid ${
|
|
793
|
+
border-top: 1px solid ${k("--color-border")};
|
|
794
|
+
border-bottom: 1px solid ${k("--color-border")};
|
|
781
795
|
}
|
|
782
796
|
.wui-consent-banner-category-description {
|
|
783
797
|
margin: 2px 0 0;
|
|
784
798
|
padding-inline-start: 2.5em;
|
|
785
799
|
font-size: 12px;
|
|
786
800
|
line-height: 1.4;
|
|
787
|
-
color: ${
|
|
801
|
+
color: ${k("--color-text-muted")};
|
|
788
802
|
}
|
|
789
803
|
|
|
790
804
|
.form-check {
|
|
@@ -802,20 +816,20 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
802
816
|
margin: 0;
|
|
803
817
|
border: 1px solid rgba(0, 0, 0, 0.25);
|
|
804
818
|
border-radius: 2em;
|
|
805
|
-
background: ${
|
|
819
|
+
background: ${k("--color-surface")} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat;
|
|
806
820
|
cursor: pointer;
|
|
807
821
|
transition: background-position 0.15s ease-in-out;
|
|
808
822
|
}
|
|
809
823
|
.form-check-input:checked {
|
|
810
|
-
border-color: ${
|
|
811
|
-
background: ${
|
|
824
|
+
border-color: ${k("--color-primary")};
|
|
825
|
+
background: ${k("--color-primary")} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat;
|
|
812
826
|
}
|
|
813
827
|
.form-check-input:disabled {
|
|
814
828
|
opacity: 0.5;
|
|
815
829
|
cursor: default;
|
|
816
830
|
}
|
|
817
831
|
.form-check-input:focus-visible {
|
|
818
|
-
outline: 2px solid ${
|
|
832
|
+
outline: 2px solid ${k("--color-primary")};
|
|
819
833
|
outline-offset: 2px;
|
|
820
834
|
}
|
|
821
835
|
.form-check-label {
|
|
@@ -844,33 +858,33 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
844
858
|
cursor: pointer;
|
|
845
859
|
}
|
|
846
860
|
.btn:focus-visible {
|
|
847
|
-
outline: 2px solid ${
|
|
861
|
+
outline: 2px solid ${k("--color-primary")};
|
|
848
862
|
outline-offset: 2px;
|
|
849
863
|
}
|
|
850
864
|
.btn-primary {
|
|
851
|
-
background: ${
|
|
852
|
-
border-color: ${
|
|
865
|
+
background: ${k("--color-primary")};
|
|
866
|
+
border-color: ${k("--color-primary")};
|
|
853
867
|
color: #fff;
|
|
854
868
|
}
|
|
855
869
|
.btn-primary:hover {
|
|
856
|
-
background: ${
|
|
857
|
-
border-color: ${
|
|
870
|
+
background: ${k("--color-primary-hover")};
|
|
871
|
+
border-color: ${k("--color-primary-hover")};
|
|
858
872
|
}
|
|
859
873
|
.btn-outline-secondary {
|
|
860
|
-
border-color: ${
|
|
861
|
-
color: ${
|
|
874
|
+
border-color: ${k("--color-text-muted")};
|
|
875
|
+
color: ${k("--color-text-muted")};
|
|
862
876
|
}
|
|
863
877
|
.btn-outline-secondary:hover {
|
|
864
|
-
background: ${
|
|
878
|
+
background: ${k("--color-text-muted")};
|
|
865
879
|
color: #fff;
|
|
866
880
|
}
|
|
867
881
|
.btn-link {
|
|
868
882
|
font-weight: 400;
|
|
869
|
-
color: ${
|
|
883
|
+
color: ${k("--color-primary")};
|
|
870
884
|
text-decoration: underline;
|
|
871
885
|
}
|
|
872
886
|
.btn-link:hover {
|
|
873
|
-
color: ${
|
|
887
|
+
color: ${k("--color-primary-hover")};
|
|
874
888
|
}
|
|
875
889
|
.wui-consent-banner-settings-toggle {
|
|
876
890
|
margin-inline-end: auto;
|
|
@@ -890,7 +904,7 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
890
904
|
max-width: none;
|
|
891
905
|
}
|
|
892
906
|
}
|
|
893
|
-
`,
|
|
907
|
+
`, ae = "wui-consent-save", oe = "[data-consent-settings]", A = {
|
|
894
908
|
heading: "Cookies on this site",
|
|
895
909
|
description: "We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.",
|
|
896
910
|
policyLabel: "Cookie policy",
|
|
@@ -906,11 +920,11 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
906
920
|
rejectLabel: "Reject all",
|
|
907
921
|
acceptLabel: "Accept all",
|
|
908
922
|
saveLabel: "Save preferences"
|
|
909
|
-
},
|
|
923
|
+
}, se = [
|
|
910
924
|
"analytics",
|
|
911
925
|
"functional",
|
|
912
926
|
"marketing"
|
|
913
|
-
],
|
|
927
|
+
], ce = 0, le = class extends e {
|
|
914
928
|
static get observedAttributes() {
|
|
915
929
|
return [
|
|
916
930
|
"heading",
|
|
@@ -923,12 +937,12 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
923
937
|
];
|
|
924
938
|
}
|
|
925
939
|
constructor() {
|
|
926
|
-
super(),
|
|
940
|
+
super(), ce += 1, this._uid = `wui-consent-${ce}`, this._preferences = {
|
|
927
941
|
analytics: !1,
|
|
928
942
|
functional: !1,
|
|
929
943
|
marketing: !1
|
|
930
944
|
}, this._settings = !1, this._onDocumentClick = (e) => {
|
|
931
|
-
e.target instanceof Element && e.target.closest(
|
|
945
|
+
e.target instanceof Element && e.target.closest(oe) && (e.preventDefault(), this.open({
|
|
932
946
|
settings: !0,
|
|
933
947
|
focus: !0
|
|
934
948
|
}));
|
|
@@ -947,13 +961,13 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
947
961
|
this.toggleAttribute("standalone", e === !0 || e === "" || e === "true");
|
|
948
962
|
}
|
|
949
963
|
get heading() {
|
|
950
|
-
return this.getAttribute("heading") ||
|
|
964
|
+
return this.getAttribute("heading") || A.heading;
|
|
951
965
|
}
|
|
952
966
|
set heading(e) {
|
|
953
967
|
this.setAttribute("heading", String(e ?? ""));
|
|
954
968
|
}
|
|
955
969
|
get description() {
|
|
956
|
-
return this.getAttribute("description") ||
|
|
970
|
+
return this.getAttribute("description") || A.description;
|
|
957
971
|
}
|
|
958
972
|
set description(e) {
|
|
959
973
|
this.setAttribute("description", String(e ?? ""));
|
|
@@ -965,25 +979,25 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
965
979
|
this.setAttribute("policy-href", String(e ?? ""));
|
|
966
980
|
}
|
|
967
981
|
get policyLabel() {
|
|
968
|
-
return this.getAttribute("policy-label") ||
|
|
982
|
+
return this.getAttribute("policy-label") || A.policyLabel;
|
|
969
983
|
}
|
|
970
984
|
set policyLabel(e) {
|
|
971
985
|
this.setAttribute("policy-label", String(e ?? ""));
|
|
972
986
|
}
|
|
973
987
|
get analyticsDescription() {
|
|
974
|
-
return this.getAttribute("analytics-description") ||
|
|
988
|
+
return this.getAttribute("analytics-description") || A.analyticsDescription;
|
|
975
989
|
}
|
|
976
990
|
set analyticsDescription(e) {
|
|
977
991
|
this.setAttribute("analytics-description", String(e ?? ""));
|
|
978
992
|
}
|
|
979
993
|
get functionalDescription() {
|
|
980
|
-
return this.getAttribute("functional-description") ||
|
|
994
|
+
return this.getAttribute("functional-description") || A.functionalDescription;
|
|
981
995
|
}
|
|
982
996
|
set functionalDescription(e) {
|
|
983
997
|
this.setAttribute("functional-description", String(e ?? ""));
|
|
984
998
|
}
|
|
985
999
|
get marketingDescription() {
|
|
986
|
-
return this.getAttribute("marketing-description") ||
|
|
1000
|
+
return this.getAttribute("marketing-description") || A.marketingDescription;
|
|
987
1001
|
}
|
|
988
1002
|
set marketingDescription(e) {
|
|
989
1003
|
this.setAttribute("marketing-description", String(e ?? ""));
|
|
@@ -1011,22 +1025,22 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
1011
1025
|
this._rendered && this.render();
|
|
1012
1026
|
}
|
|
1013
1027
|
render() {
|
|
1014
|
-
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${
|
|
1015
|
-
r.innerHTML = `${r === this ? "" : `<style>${
|
|
1028
|
+
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${fe(this.policyHref)}">${de(this.policyLabel)}</a>` : "", r = this._root();
|
|
1029
|
+
r.innerHTML = `${r === this ? "" : `<style>${ie}</style>`}
|
|
1016
1030
|
<div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden>
|
|
1017
|
-
<h2 class="wui-consent-banner-heading" id="${t}-heading">${
|
|
1018
|
-
<p class="wui-consent-banner-description" id="${t}-description">${
|
|
1031
|
+
<h2 class="wui-consent-banner-heading" id="${t}-heading">${de(this.heading)}</h2>
|
|
1032
|
+
<p class="wui-consent-banner-description" id="${t}-description">${de(this.description)}${n}</p>
|
|
1019
1033
|
<div class="wui-consent-banner-settings" hidden>
|
|
1020
|
-
${
|
|
1021
|
-
${
|
|
1022
|
-
${
|
|
1023
|
-
${
|
|
1034
|
+
${ue(t, "essential", A.essentialLabel, A.essentialDescription, !0)}
|
|
1035
|
+
${ue(t, "analytics", A.analyticsLabel, this.analyticsDescription, !1)}
|
|
1036
|
+
${ue(t, "functional", A.functionalLabel, this.functionalDescription, !1)}
|
|
1037
|
+
${ue(t, "marketing", A.marketingLabel, this.marketingDescription, !1)}
|
|
1024
1038
|
</div>
|
|
1025
1039
|
<div class="wui-consent-banner-actions">
|
|
1026
|
-
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${
|
|
1027
|
-
<button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${
|
|
1028
|
-
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${
|
|
1029
|
-
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${
|
|
1040
|
+
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${A.settingsLabel}</button>
|
|
1041
|
+
<button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${A.rejectLabel}</button>
|
|
1042
|
+
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${A.acceptLabel}</button>
|
|
1043
|
+
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${A.saveLabel}</button>
|
|
1030
1044
|
</div>
|
|
1031
1045
|
</div>`, this._rendered = !0, this._wire(), this._applyPreferences(), this._showSettings(this._settings), e && (this._panel().hidden = !1);
|
|
1032
1046
|
}
|
|
@@ -1056,7 +1070,7 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
1056
1070
|
})), e.querySelector(".wui-consent-banner-save")?.addEventListener("click", () => this._save(this._switchValues())), e.querySelector(".wui-consent-banner-settings-toggle")?.addEventListener("click", () => this._showSettings(!this._settings));
|
|
1057
1071
|
}
|
|
1058
1072
|
_save(e) {
|
|
1059
|
-
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(
|
|
1073
|
+
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(ae, {
|
|
1060
1074
|
bubbles: !0,
|
|
1061
1075
|
composed: !0,
|
|
1062
1076
|
detail: { ...e }
|
|
@@ -1064,11 +1078,11 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
1064
1078
|
}
|
|
1065
1079
|
_switchValues() {
|
|
1066
1080
|
let e = {};
|
|
1067
|
-
for (let t of
|
|
1081
|
+
for (let t of se) e[t] = this._root().querySelector(`input[data-category="${t}"]`)?.checked === !0;
|
|
1068
1082
|
return e;
|
|
1069
1083
|
}
|
|
1070
1084
|
_applyPreferences() {
|
|
1071
|
-
for (let e of
|
|
1085
|
+
for (let e of se) {
|
|
1072
1086
|
let t = this._root().querySelector(`input[data-category="${e}"]`);
|
|
1073
1087
|
t && (t.checked = this._preferences[e]);
|
|
1074
1088
|
}
|
|
@@ -1086,17 +1100,221 @@ var E = "[role=\"option\"]", D = "No results", ee = class extends e {
|
|
|
1086
1100
|
}
|
|
1087
1101
|
}
|
|
1088
1102
|
};
|
|
1089
|
-
function
|
|
1103
|
+
function ue(e, t, n, r, i) {
|
|
1090
1104
|
let a = `${e}-${t}`;
|
|
1091
1105
|
return `<div class="wui-consent-banner-category">
|
|
1092
1106
|
<div class="form-check form-switch">
|
|
1093
1107
|
<input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i ? " checked disabled" : ""} />
|
|
1094
|
-
<label class="form-check-label" for="${a}">${
|
|
1108
|
+
<label class="form-check-label" for="${a}">${de(n)}</label>
|
|
1095
1109
|
</div>
|
|
1096
|
-
<p class="wui-consent-banner-category-description">${
|
|
1110
|
+
<p class="wui-consent-banner-category-description">${de(r)}</p>
|
|
1097
1111
|
</div>`;
|
|
1098
1112
|
}
|
|
1099
|
-
var
|
|
1113
|
+
var de = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), fe = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), pe = "[role=\"menuitem\"]", me = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]", he = "data-open", ge = 500, _e = 10, ve = 400, j = null, ye = null, be = /* @__PURE__ */ new WeakMap();
|
|
1114
|
+
function xe(e, t, n) {
|
|
1115
|
+
let r = be.get(e);
|
|
1116
|
+
if (r) {
|
|
1117
|
+
if (r.region === t || t.contains(r.region)) return !1;
|
|
1118
|
+
r.cancel();
|
|
1119
|
+
}
|
|
1120
|
+
return be.set(e, {
|
|
1121
|
+
region: t,
|
|
1122
|
+
cancel: n
|
|
1123
|
+
}), !0;
|
|
1124
|
+
}
|
|
1125
|
+
var M = (e) => e instanceof Element ? e : e?.parentElement ?? null, Se = class extends e {
|
|
1126
|
+
static get observedAttributes() {
|
|
1127
|
+
return ["disabled"];
|
|
1128
|
+
}
|
|
1129
|
+
constructor() {
|
|
1130
|
+
super(), this._region = null, this._origin = null, this._returnFocus = null, this._press = null, this._swallowClick = !1, this._nav = v({
|
|
1131
|
+
getVisibleOptions: () => this._items(),
|
|
1132
|
+
getActive: () => this._items().indexOf(document.activeElement),
|
|
1133
|
+
setActive: (e) => this._items()[e]?.focus({ preventScroll: !0 })
|
|
1134
|
+
}), this._onContextMenu = (e) => this._handleContextMenu(e), this._onContextMenuCapture = (e) => {
|
|
1135
|
+
this.isOpen && !this._inPanel(e.target) && !this._isKeyEcho() && this.close();
|
|
1136
|
+
}, this._onDocKeyDown = (e) => this._handleDocKeyDown(e), this._onPointerDown = (e) => this._handlePointerDown(e), this._onPressMove = (e) => {
|
|
1137
|
+
this._press && Math.hypot(e.clientX - this._press.x, e.clientY - this._press.y) > _e && this._cancelPress();
|
|
1138
|
+
}, this._onPressEnd = () => this._cancelPress(), this._onClickCapture = (e) => {
|
|
1139
|
+
!this._swallowClick || !this._region?.contains(e.target) || (this._swallowClick = !1, e.preventDefault(), e.stopImmediatePropagation());
|
|
1140
|
+
}, this._onKeyDown = (e) => {
|
|
1141
|
+
this._inPanel(e.target) && this._handleMenuKey(e);
|
|
1142
|
+
}, this._onClick = (e) => this._handleClick(e), this._onMouseMove = (e) => {
|
|
1143
|
+
let t = M(e.target)?.closest(pe);
|
|
1144
|
+
t && this._inPanel(t) && !this._isDisabled(t) && t !== document.activeElement && t.focus({ preventScroll: !0 });
|
|
1145
|
+
}, this._onDismiss = (e) => {
|
|
1146
|
+
e.type === "scroll" && this._inPanel(e.target) || this.close();
|
|
1147
|
+
}, this._onPointerDownCapture = (e) => {
|
|
1148
|
+
this._swallowClick = !1, this.isOpen && !this._inPanel(e.target) && this.close();
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
connectedCallback() {
|
|
1152
|
+
this._teardown(), document.addEventListener("contextmenu", this._onContextMenuCapture, !0), document.addEventListener("contextmenu", this._onContextMenu), document.addEventListener("keydown", this._onDocKeyDown), document.addEventListener("pointerdown", this._onPointerDownCapture, !0), document.addEventListener("pointerdown", this._onPointerDown), document.addEventListener("click", this._onClickCapture, !0), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("click", this._onClick), this.addEventListener("mousemove", this._onMouseMove);
|
|
1153
|
+
}
|
|
1154
|
+
disconnectedCallback() {
|
|
1155
|
+
this._teardown();
|
|
1156
|
+
}
|
|
1157
|
+
attributeChangedCallback() {
|
|
1158
|
+
this.disabled && this.close();
|
|
1159
|
+
}
|
|
1160
|
+
get target() {
|
|
1161
|
+
return this.getAttribute("target");
|
|
1162
|
+
}
|
|
1163
|
+
set target(e) {
|
|
1164
|
+
e == null || e === "" ? this.removeAttribute("target") : this.setAttribute("target", String(e));
|
|
1165
|
+
}
|
|
1166
|
+
get disabled() {
|
|
1167
|
+
return this.hasAttribute("disabled");
|
|
1168
|
+
}
|
|
1169
|
+
set disabled(e) {
|
|
1170
|
+
this.toggleAttribute("disabled", !!e);
|
|
1171
|
+
}
|
|
1172
|
+
get isOpen() {
|
|
1173
|
+
return this._panel()?.hasAttribute(he) ?? !1;
|
|
1174
|
+
}
|
|
1175
|
+
open(e, t, { region: n = this, origin: r = n, keyboard: i = !1 } = {}) {
|
|
1176
|
+
let a = this._panel();
|
|
1177
|
+
if (a) {
|
|
1178
|
+
if (j && j !== this && j.close(!0), !this.isOpen) {
|
|
1179
|
+
let e = document.activeElement;
|
|
1180
|
+
this._returnFocus = e && e !== document.body && !this._inPanel(e) ? e : null;
|
|
1181
|
+
}
|
|
1182
|
+
this._region = n, this._origin = r, ye = null, a.setAttribute(he, ""), j = this, c({ getBoundingClientRect: () => ({
|
|
1183
|
+
left: e,
|
|
1184
|
+
right: e,
|
|
1185
|
+
top: t,
|
|
1186
|
+
bottom: t,
|
|
1187
|
+
width: 0,
|
|
1188
|
+
height: 0
|
|
1189
|
+
}) }, a, { clampHeight: !0 }), window.addEventListener("scroll", this._onDismiss, !0), window.addEventListener("resize", this._onDismiss), window.addEventListener("blur", this._onDismiss), ((i ? this._items()[0] : null) ?? a).focus({ preventScroll: !0 }), this.dispatchEvent(new CustomEvent("wui-context-menu:open", {
|
|
1190
|
+
bubbles: !0,
|
|
1191
|
+
detail: {
|
|
1192
|
+
region: n,
|
|
1193
|
+
origin: r,
|
|
1194
|
+
x: e,
|
|
1195
|
+
y: t
|
|
1196
|
+
}
|
|
1197
|
+
}));
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
close(e = !1) {
|
|
1201
|
+
let t = this._panel();
|
|
1202
|
+
if (!t?.hasAttribute(he)) return;
|
|
1203
|
+
t.removeAttribute(he), j === this && (j = null), window.removeEventListener("scroll", this._onDismiss, !0), window.removeEventListener("resize", this._onDismiss), window.removeEventListener("blur", this._onDismiss), this._nav.teardown();
|
|
1204
|
+
let n = this._returnFocus;
|
|
1205
|
+
this._returnFocus = null, e && n?.isConnected && n.focus({ preventScroll: !0 });
|
|
1206
|
+
}
|
|
1207
|
+
_panel() {
|
|
1208
|
+
return [...this.children].find((e) => e.getAttribute("role") === "menu") ?? null;
|
|
1209
|
+
}
|
|
1210
|
+
_inPanel(e) {
|
|
1211
|
+
return !!e && !!this._panel()?.contains(e);
|
|
1212
|
+
}
|
|
1213
|
+
_items() {
|
|
1214
|
+
return [...this._panel()?.querySelectorAll(pe) ?? []].filter((e) => !this._isDisabled(e));
|
|
1215
|
+
}
|
|
1216
|
+
_isDisabled(e) {
|
|
1217
|
+
return e.getAttribute("aria-disabled") === "true";
|
|
1218
|
+
}
|
|
1219
|
+
_regionFor(e) {
|
|
1220
|
+
let t = M(e);
|
|
1221
|
+
if (!t || this.disabled || !this._panel() || this._inPanel(t) || t.closest(me)) return null;
|
|
1222
|
+
let n = this.target;
|
|
1223
|
+
return n ? t.closest(n) : this.contains(t) ? this : null;
|
|
1224
|
+
}
|
|
1225
|
+
_isKeyEcho() {
|
|
1226
|
+
return ye?.menu === this && this.isOpen && performance.now() - ye.at < ve;
|
|
1227
|
+
}
|
|
1228
|
+
_handleContextMenu(e) {
|
|
1229
|
+
if (this._inPanel(e.target)) {
|
|
1230
|
+
e.preventDefault();
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
if (e.defaultPrevented && !be.has(e)) return;
|
|
1234
|
+
let t = this._regionFor(e.target);
|
|
1235
|
+
if (t) {
|
|
1236
|
+
if (this._isKeyEcho()) {
|
|
1237
|
+
e.preventDefault();
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
e.shiftKey || xe(e, t, () => this.close(!0)) && (e.preventDefault(), this.open(e.clientX, e.clientY, {
|
|
1241
|
+
region: t,
|
|
1242
|
+
origin: M(e.target)
|
|
1243
|
+
}));
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
_handleDocKeyDown(e) {
|
|
1247
|
+
if (e.defaultPrevented && !be.has(e) || !(e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) || this._inPanel(e.target)) return;
|
|
1248
|
+
let t = this._regionFor(e.target);
|
|
1249
|
+
if (!t || !xe(e, t, () => this.close(!0))) return;
|
|
1250
|
+
e.preventDefault();
|
|
1251
|
+
let n = M(e.target), r = n.getBoundingClientRect();
|
|
1252
|
+
this.open(r.left + Math.min(16, r.width / 2), r.bottom, {
|
|
1253
|
+
region: t,
|
|
1254
|
+
origin: n,
|
|
1255
|
+
keyboard: !0
|
|
1256
|
+
}), ye = {
|
|
1257
|
+
menu: this,
|
|
1258
|
+
at: performance.now()
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
_handlePointerDown(e) {
|
|
1262
|
+
if (e.pointerType !== "touch") return;
|
|
1263
|
+
let t = this._regionFor(e.target);
|
|
1264
|
+
if (!t || !xe(e, t, () => this._cancelPress())) return;
|
|
1265
|
+
this._cancelPress();
|
|
1266
|
+
let { clientX: n, clientY: r } = e, i = M(e.target);
|
|
1267
|
+
this._press = {
|
|
1268
|
+
x: n,
|
|
1269
|
+
y: r,
|
|
1270
|
+
timer: setTimeout(() => {
|
|
1271
|
+
this._cancelPress(), this._swallowClick = !0, this.open(n, r, {
|
|
1272
|
+
region: t,
|
|
1273
|
+
origin: i
|
|
1274
|
+
});
|
|
1275
|
+
}, ge)
|
|
1276
|
+
}, document.addEventListener("pointermove", this._onPressMove, { passive: !0 }), document.addEventListener("pointerup", this._onPressEnd), document.addEventListener("pointercancel", this._onPressEnd), window.addEventListener("scroll", this._onPressEnd, !0);
|
|
1277
|
+
}
|
|
1278
|
+
_cancelPress() {
|
|
1279
|
+
this._press && (clearTimeout(this._press.timer), this._press = null, document.removeEventListener("pointermove", this._onPressMove), document.removeEventListener("pointerup", this._onPressEnd), document.removeEventListener("pointercancel", this._onPressEnd), window.removeEventListener("scroll", this._onPressEnd, !0));
|
|
1280
|
+
}
|
|
1281
|
+
_handleMenuKey(e) {
|
|
1282
|
+
if (this.isOpen) if (e.key === "Escape") e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
1283
|
+
else if (e.key === "Tab") this.close(!0);
|
|
1284
|
+
else if (e.key === "ArrowDown" || e.key === "ArrowUp") e.preventDefault(), this._step(e.key === "ArrowDown" ? 1 : -1);
|
|
1285
|
+
else if (e.key === " ") {
|
|
1286
|
+
let t = M(e.target)?.closest(pe);
|
|
1287
|
+
e.preventDefault(), t && t.click();
|
|
1288
|
+
} else this._nav.handler(e);
|
|
1289
|
+
}
|
|
1290
|
+
_step(e) {
|
|
1291
|
+
let t = this._items();
|
|
1292
|
+
if (!t.length) return;
|
|
1293
|
+
let n = t.indexOf(document.activeElement);
|
|
1294
|
+
t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length].focus({ preventScroll: !0 });
|
|
1295
|
+
}
|
|
1296
|
+
_handleClick(e) {
|
|
1297
|
+
let t = M(e.target)?.closest(pe);
|
|
1298
|
+
if (!(!t || !this._inPanel(t))) {
|
|
1299
|
+
if (this._isDisabled(t)) {
|
|
1300
|
+
e.preventDefault(), e.stopPropagation();
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
this.close(!0), this.dispatchEvent(new CustomEvent("wui-context-menu:select", {
|
|
1304
|
+
bubbles: !0,
|
|
1305
|
+
detail: {
|
|
1306
|
+
key: t.dataset.key ?? null,
|
|
1307
|
+
item: t,
|
|
1308
|
+
region: this._region,
|
|
1309
|
+
origin: this._origin
|
|
1310
|
+
}
|
|
1311
|
+
}));
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
_teardown() {
|
|
1315
|
+
this.close(), this._cancelPress(), document.removeEventListener("contextmenu", this._onContextMenuCapture, !0), document.removeEventListener("contextmenu", this._onContextMenu), document.removeEventListener("keydown", this._onDocKeyDown), document.removeEventListener("pointerdown", this._onPointerDownCapture, !0), document.removeEventListener("pointerdown", this._onPointerDown), document.removeEventListener("click", this._onClickCapture, !0), this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("click", this._onClick), this.removeEventListener("mousemove", this._onMouseMove);
|
|
1316
|
+
}
|
|
1317
|
+
}, Ce = [
|
|
1100
1318
|
[
|
|
1101
1319
|
"AF",
|
|
1102
1320
|
"Afghanistan",
|
|
@@ -2322,11 +2540,11 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2322
2540
|
"Zimbabwe",
|
|
2323
2541
|
"263"
|
|
2324
2542
|
]
|
|
2325
|
-
], N = (e) => (
|
|
2543
|
+
], N = (e) => (Ce.find((t) => t[0] === e) || [
|
|
2326
2544
|
"",
|
|
2327
2545
|
"",
|
|
2328
2546
|
""
|
|
2329
|
-
])[2],
|
|
2547
|
+
])[2], we = class extends e {
|
|
2330
2548
|
static formAssociated = !0;
|
|
2331
2549
|
static get observedAttributes() {
|
|
2332
2550
|
return [
|
|
@@ -2385,7 +2603,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2385
2603
|
return this._value;
|
|
2386
2604
|
}
|
|
2387
2605
|
set value(e) {
|
|
2388
|
-
this._value = e == null ? "" : String(e),
|
|
2606
|
+
this._value = e == null ? "" : String(e), m(this, this._value), this._syncSelected(), this._syncReset();
|
|
2389
2607
|
}
|
|
2390
2608
|
set options(e) {
|
|
2391
2609
|
this._optionsProp = Array.isArray(e) ? e : null, this.isConnected && this.render();
|
|
@@ -2400,7 +2618,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2400
2618
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
2401
2619
|
label: e.innerHTML,
|
|
2402
2620
|
icon: e.getAttribute("icon") || void 0,
|
|
2403
|
-
[
|
|
2621
|
+
[y]: !0,
|
|
2404
2622
|
selected: e.hasAttribute("selected")
|
|
2405
2623
|
})));
|
|
2406
2624
|
}
|
|
@@ -2410,27 +2628,27 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2410
2628
|
render() {
|
|
2411
2629
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._snapshotDeclared();
|
|
2412
2630
|
let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...", c = this.getAttribute("search-placeholder") || "Search...", l = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
|
|
2413
|
-
l && (this._value = String(l.value)),
|
|
2631
|
+
l && (this._value = String(l.value)), m(this, this._value), this.id ||= `wui-select-${Math.random().toString(36).slice(2, 9)}`;
|
|
2414
2632
|
let u = `${this.id}-listbox`;
|
|
2415
2633
|
this._listboxId = u;
|
|
2416
2634
|
let d = e.map((e, t) => {
|
|
2417
2635
|
let n = String(e.value) === String(this._value);
|
|
2418
|
-
return `<button type="button" role="option" id="${
|
|
2636
|
+
return `<button type="button" role="option" id="${P(`${u}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${P(e.value)}" aria-selected="${n}">${C(e)}</button>`;
|
|
2419
2637
|
}).join("");
|
|
2420
2638
|
this.innerHTML = `
|
|
2421
2639
|
<div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
|
|
2422
|
-
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
2423
|
-
${a ?
|
|
2424
|
-
${o ? `<span class="search-select-prefix">${
|
|
2425
|
-
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ?
|
|
2426
|
-
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${
|
|
2427
|
-
${
|
|
2640
|
+
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${P(u)}" aria-label="${P(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
2641
|
+
${a ? _(a, { className: "search-select-icon" }) : ""}
|
|
2642
|
+
${o ? `<span class="search-select-prefix">${b(o)}</span>` : ""}
|
|
2643
|
+
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? C(l) : b(s)}</span>
|
|
2644
|
+
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${_("x")}</span>` : ""}
|
|
2645
|
+
${_("chevron-down", { className: "search-select-caret" })}
|
|
2428
2646
|
</button>
|
|
2429
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
2430
|
-
${t ? `<div class="search-select-search">${
|
|
2647
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${P(u)}" tabindex="-1" hidden>
|
|
2648
|
+
${t ? `<div class="search-select-search">${_("search")}<input class="search-select-input" placeholder="${P(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${_("x")}</button></div>` : ""}
|
|
2431
2649
|
<div class="search-select-options">${d}<div class="search-select-empty" hidden>No matches</div></div>
|
|
2432
2650
|
</div>
|
|
2433
|
-
</div>`, this._rendered = !0,
|
|
2651
|
+
</div>`, this._rendered = !0, m(this, this._value), this._wire(), this._syncReset();
|
|
2434
2652
|
}
|
|
2435
2653
|
_refs() {
|
|
2436
2654
|
return {
|
|
@@ -2456,7 +2674,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2456
2674
|
let t = e.dataset.value === String(this._value);
|
|
2457
2675
|
e.classList.toggle("selected", t), e.setAttribute("aria-selected", String(t));
|
|
2458
2676
|
}
|
|
2459
|
-
e && (e.innerHTML = t ?
|
|
2677
|
+
e && (e.innerHTML = t ? C(t) : b(this.getAttribute("placeholder") || "Select..."), e.classList.toggle("search-select-placeholder", !t));
|
|
2460
2678
|
}
|
|
2461
2679
|
_syncReset() {
|
|
2462
2680
|
let { reset: e } = this._refs();
|
|
@@ -2490,7 +2708,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2490
2708
|
}, s = (t) => {
|
|
2491
2709
|
this.value = t.dataset.value, this.dispatchEvent(new Event("change", { bubbles: !0 })), o(), e.control.focus();
|
|
2492
2710
|
};
|
|
2493
|
-
this._navHandler =
|
|
2711
|
+
this._navHandler = v({
|
|
2494
2712
|
getVisibleOptions: () => this._visible(),
|
|
2495
2713
|
getActive: () => this._active,
|
|
2496
2714
|
setActive: (e) => n(e),
|
|
@@ -2532,29 +2750,29 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2532
2750
|
disconnectedCallback() {
|
|
2533
2751
|
this._teardown();
|
|
2534
2752
|
}
|
|
2535
|
-
},
|
|
2753
|
+
}, P = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Te = (e) => {
|
|
2536
2754
|
if (e == null) return null;
|
|
2537
2755
|
let t = String(e).split(",").map((e) => e.trim().toUpperCase()).filter(Boolean);
|
|
2538
2756
|
return t.length ? new Set(t) : null;
|
|
2539
|
-
},
|
|
2540
|
-
let t =
|
|
2541
|
-
return
|
|
2757
|
+
}, Ee = (e) => {
|
|
2758
|
+
let t = Te(e);
|
|
2759
|
+
return Ce.filter(([e]) => !t || t.has(e)).map(([e, t]) => ({
|
|
2542
2760
|
value: e,
|
|
2543
2761
|
label: t,
|
|
2544
2762
|
flag: e
|
|
2545
2763
|
}));
|
|
2546
|
-
},
|
|
2764
|
+
}, De = class extends we {
|
|
2547
2765
|
static get observedAttributes() {
|
|
2548
|
-
return [...
|
|
2766
|
+
return [...we.observedAttributes, "countries"];
|
|
2549
2767
|
}
|
|
2550
2768
|
_readOptions() {
|
|
2551
2769
|
let e = this.getAttribute("countries");
|
|
2552
2770
|
return this._countryCache?.attr !== e && (this._countryCache = {
|
|
2553
2771
|
attr: e,
|
|
2554
|
-
options:
|
|
2772
|
+
options: Ee(e)
|
|
2555
2773
|
}), this._countryCache.options;
|
|
2556
2774
|
}
|
|
2557
|
-
},
|
|
2775
|
+
}, Oe = [
|
|
2558
2776
|
"January",
|
|
2559
2777
|
"February",
|
|
2560
2778
|
"March",
|
|
@@ -2567,7 +2785,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2567
2785
|
"October",
|
|
2568
2786
|
"November",
|
|
2569
2787
|
"December"
|
|
2570
|
-
],
|
|
2788
|
+
], ke = [
|
|
2571
2789
|
"Su",
|
|
2572
2790
|
"Mo",
|
|
2573
2791
|
"Tu",
|
|
@@ -2575,24 +2793,24 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2575
2793
|
"Th",
|
|
2576
2794
|
"Fr",
|
|
2577
2795
|
"Sa"
|
|
2578
|
-
],
|
|
2796
|
+
], Ae = (e) => String(e).padStart(2, "0"), je = (e, t, n) => `${e}-${Ae(t + 1)}-${Ae(n)}`, F = (e) => {
|
|
2579
2797
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
2580
2798
|
return t ? {
|
|
2581
2799
|
y: +t[1],
|
|
2582
2800
|
m: t[2] - 1,
|
|
2583
2801
|
d: +t[3]
|
|
2584
2802
|
} : null;
|
|
2585
|
-
},
|
|
2586
|
-
let t =
|
|
2587
|
-
return t ? `${
|
|
2588
|
-
},
|
|
2803
|
+
}, I = (e) => {
|
|
2804
|
+
let t = F(e);
|
|
2805
|
+
return t ? `${Ae(t.d)} ${Oe[t.m].slice(0, 3)} ${t.y}` : "";
|
|
2806
|
+
}, L = (e, t) => new Date(e, t + 1, 0).getDate(), R = (e, t) => {
|
|
2589
2807
|
for (; t < 0;) t += 12, --e;
|
|
2590
2808
|
for (; t > 11;) t -= 12, e += 1;
|
|
2591
2809
|
return {
|
|
2592
2810
|
y: e,
|
|
2593
2811
|
m: t
|
|
2594
2812
|
};
|
|
2595
|
-
},
|
|
2813
|
+
}, Me = class extends e {
|
|
2596
2814
|
static formAssociated = !0;
|
|
2597
2815
|
static get observedAttributes() {
|
|
2598
2816
|
return [
|
|
@@ -2644,7 +2862,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2644
2862
|
return this._value;
|
|
2645
2863
|
}
|
|
2646
2864
|
set value(e) {
|
|
2647
|
-
this._value = e || "",
|
|
2865
|
+
this._value = e || "", m(this, this._value), this._syncTrigger();
|
|
2648
2866
|
}
|
|
2649
2867
|
_firstDay() {
|
|
2650
2868
|
let e = Number.parseInt(this.getAttribute("first-day") ?? "", 10);
|
|
@@ -2652,29 +2870,29 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2652
2870
|
}
|
|
2653
2871
|
render() {
|
|
2654
2872
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
2655
|
-
let e = this.getAttribute("placeholder") || "Enter Date", t =
|
|
2873
|
+
let e = this.getAttribute("placeholder") || "Enter Date", t = F(this._value);
|
|
2656
2874
|
t && (this._viewY = t.y, this._viewM = t.m);
|
|
2657
2875
|
let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "", i = this.getAttribute("aria-label"), a = this.getAttribute("aria-describedby");
|
|
2658
2876
|
this.innerHTML = `
|
|
2659
2877
|
<div class="datepicker">
|
|
2660
|
-
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${
|
|
2661
|
-
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ?
|
|
2662
|
-
${
|
|
2878
|
+
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${b(i)}"` : ""}${a ? ` aria-describedby="${b(a)}"` : ""}>
|
|
2879
|
+
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? I(this._value) : b(e)}</span>
|
|
2880
|
+
${_("calendar-dots")}
|
|
2663
2881
|
</button>
|
|
2664
2882
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
2665
|
-
</div>`, this._rendered = !0,
|
|
2883
|
+
</div>`, this._rendered = !0, m(this, this._value), this._wire();
|
|
2666
2884
|
}
|
|
2667
2885
|
_syncFormValue() {
|
|
2668
|
-
|
|
2886
|
+
m(this, this._value);
|
|
2669
2887
|
}
|
|
2670
2888
|
_syncTrigger() {
|
|
2671
2889
|
let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
2672
2890
|
if (!t) return;
|
|
2673
|
-
let n =
|
|
2674
|
-
t.textContent = n ?
|
|
2891
|
+
let n = F(this._value);
|
|
2892
|
+
t.textContent = n ? I(this._value) : this.getAttribute("placeholder") || "Enter Date", t.classList.toggle("search-select-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
2675
2893
|
}
|
|
2676
2894
|
_limits() {
|
|
2677
|
-
let e =
|
|
2895
|
+
let e = F(this.getAttribute("min")), t = F(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
|
|
2678
2896
|
return {
|
|
2679
2897
|
dayDisabled: (e, t, i) => {
|
|
2680
2898
|
let a = new Date(e, t, i).getTime();
|
|
@@ -2682,7 +2900,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2682
2900
|
},
|
|
2683
2901
|
monthDisabled: (e, t) => {
|
|
2684
2902
|
let i = new Date(e, t, 1).getTime();
|
|
2685
|
-
return new Date(e, t,
|
|
2903
|
+
return new Date(e, t, L(e, t)).getTime() < n || i > r;
|
|
2686
2904
|
},
|
|
2687
2905
|
yearDisabled: (e) => {
|
|
2688
2906
|
let t = new Date(e, 0, 1).getTime();
|
|
@@ -2695,31 +2913,31 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2695
2913
|
e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
|
|
2696
2914
|
}
|
|
2697
2915
|
_daysHtml() {
|
|
2698
|
-
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n =
|
|
2916
|
+
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n = L(this._viewY, this._viewM), r = F(this._value), i = /* @__PURE__ */ new Date(), { dayDisabled: a } = this._limits(), o = this._focus || r || {
|
|
2699
2917
|
y: this._viewY,
|
|
2700
2918
|
m: this._viewM,
|
|
2701
2919
|
d: 1
|
|
2702
2920
|
}, s = (e, t, n, s) => {
|
|
2703
|
-
let c =
|
|
2921
|
+
let c = je(e, t, n), l = r && r.y === e && r.m === t && r.d === n, u = i.getFullYear() === e && i.getMonth() === t && i.getDate() === n, d = o.y === e && o.m === t && o.d === n, f = a(e, t, n);
|
|
2704
2922
|
return `<button type="button" class="${[
|
|
2705
2923
|
"datepicker-day",
|
|
2706
2924
|
s ? "is-outside" : "",
|
|
2707
2925
|
u ? "is-today" : "",
|
|
2708
2926
|
l ? "is-selected" : ""
|
|
2709
2927
|
].filter(Boolean).join(" ")}" data-iso="${c}" role="gridcell" tabindex="${d && !f ? "0" : "-1"}"${l ? " aria-selected=\"true\"" : ""}${f ? " disabled aria-disabled=\"true\"" : ""}>${n}</button>`;
|
|
2710
|
-
}, c = "", l =
|
|
2928
|
+
}, c = "", l = R(this._viewY, this._viewM - 1), u = L(l.y, l.m);
|
|
2711
2929
|
for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
2712
2930
|
for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
|
|
2713
|
-
let d =
|
|
2931
|
+
let d = R(this._viewY, this._viewM + 1), f = (7 - (t + n) % 7) % 7;
|
|
2714
2932
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
2715
|
-
let p = a(i.getFullYear(), i.getMonth(), i.getDate()),
|
|
2933
|
+
let p = a(i.getFullYear(), i.getMonth(), i.getDate()), m = ke.map((t, n) => ke[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
|
|
2716
2934
|
return `
|
|
2717
2935
|
<div class="datepicker-head">
|
|
2718
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${
|
|
2719
|
-
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${
|
|
2720
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${
|
|
2936
|
+
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${_("chevron-left")}</button>
|
|
2937
|
+
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${Oe[this._viewM]} ${this._viewY}</button>
|
|
2938
|
+
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${_("chevron-right")}</button>
|
|
2721
2939
|
</div>
|
|
2722
|
-
<div class="datepicker-weekdays">${
|
|
2940
|
+
<div class="datepicker-weekdays">${m}</div>
|
|
2723
2941
|
<div class="datepicker-grid${this._slide ? ` ${this._slide}` : ""}" role="grid">${c}</div>
|
|
2724
2942
|
<div class="datepicker-foot">
|
|
2725
2943
|
<button type="button" class="datepicker-link" data-today${p ? " disabled" : ""}>Today</button>
|
|
@@ -2727,25 +2945,25 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2727
2945
|
</div>`;
|
|
2728
2946
|
}
|
|
2729
2947
|
_monthsHtml() {
|
|
2730
|
-
let e =
|
|
2948
|
+
let e = F(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
|
|
2731
2949
|
for (let i = 0; i < 12; i++) {
|
|
2732
2950
|
let a = e && e.y === this._viewY && e.m === i, o = t.getFullYear() === this._viewY && t.getMonth() === i, s = n(this._viewY, i), c = [
|
|
2733
2951
|
"datepicker-cell",
|
|
2734
2952
|
o ? "is-today" : "",
|
|
2735
2953
|
a ? "is-selected" : ""
|
|
2736
2954
|
].filter(Boolean).join(" ");
|
|
2737
|
-
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${
|
|
2955
|
+
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${Oe[i].slice(0, 3)}</button>`;
|
|
2738
2956
|
}
|
|
2739
2957
|
return `
|
|
2740
2958
|
<div class="datepicker-head">
|
|
2741
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${
|
|
2959
|
+
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${_("chevron-left")}</button>
|
|
2742
2960
|
<button type="button" class="datepicker-month" data-view="years" aria-label="Choose year">${this._viewY}</button>
|
|
2743
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${
|
|
2961
|
+
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${_("chevron-right")}</button>
|
|
2744
2962
|
</div>
|
|
2745
2963
|
<div class="datepicker-cells">${r}</div>`;
|
|
2746
2964
|
}
|
|
2747
2965
|
_yearsHtml() {
|
|
2748
|
-
let e =
|
|
2966
|
+
let e = F(this._value), t = (/* @__PURE__ */ new Date()).getFullYear(), { yearDisabled: n } = this._limits(), r = this._viewY - (this._viewY % 10 + 10) % 10 - 1, i = "";
|
|
2749
2967
|
for (let a = 0; a < 12; a++) {
|
|
2750
2968
|
let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
|
|
2751
2969
|
"datepicker-cell",
|
|
@@ -2756,9 +2974,9 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2756
2974
|
}
|
|
2757
2975
|
return `
|
|
2758
2976
|
<div class="datepicker-head">
|
|
2759
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${
|
|
2977
|
+
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${_("chevron-left")}</button>
|
|
2760
2978
|
<span class="datepicker-month">${r + 1} to ${r + 10}</span>
|
|
2761
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${
|
|
2979
|
+
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${_("chevron-right")}</button>
|
|
2762
2980
|
</div>
|
|
2763
2981
|
<div class="datepicker-cells">${i}</div>`;
|
|
2764
2982
|
}
|
|
@@ -2770,21 +2988,21 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2770
2988
|
c(e, t, { clampHeight: !0 });
|
|
2771
2989
|
}
|
|
2772
2990
|
_setFocus(e, t, n, r) {
|
|
2773
|
-
let { y: i, m: a } =
|
|
2991
|
+
let { y: i, m: a } = R(e, t);
|
|
2774
2992
|
this._focus = {
|
|
2775
2993
|
y: i,
|
|
2776
2994
|
m: a,
|
|
2777
2995
|
d: n
|
|
2778
2996
|
};
|
|
2779
2997
|
let o = i !== this._viewY || a !== this._viewM;
|
|
2780
|
-
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${
|
|
2998
|
+
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${je(i, a, n)}"]`)?.focus();
|
|
2781
2999
|
}
|
|
2782
3000
|
_onKey(e) {
|
|
2783
3001
|
if (this._mode !== "days") {
|
|
2784
3002
|
e.key === "Escape" && this._close();
|
|
2785
3003
|
return;
|
|
2786
3004
|
}
|
|
2787
|
-
let t = this._focus ||
|
|
3005
|
+
let t = this._focus || F(this._value) || {
|
|
2788
3006
|
y: this._viewY,
|
|
2789
3007
|
m: this._viewM,
|
|
2790
3008
|
d: 1
|
|
@@ -2802,17 +3020,17 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2802
3020
|
case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
|
|
2803
3021
|
case "PageUp": {
|
|
2804
3022
|
e.preventDefault();
|
|
2805
|
-
let n =
|
|
2806
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
3023
|
+
let n = R(t.y, t.m - (e.shiftKey ? 12 : 1));
|
|
3024
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, L(n.y, n.m)), "slide-prev");
|
|
2807
3025
|
}
|
|
2808
3026
|
case "PageDown": {
|
|
2809
3027
|
e.preventDefault();
|
|
2810
|
-
let n =
|
|
2811
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
3028
|
+
let n = R(t.y, t.m + (e.shiftKey ? 12 : 1));
|
|
3029
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, L(n.y, n.m)), "slide-next");
|
|
2812
3030
|
}
|
|
2813
3031
|
case "Enter":
|
|
2814
3032
|
case " ":
|
|
2815
|
-
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value =
|
|
3033
|
+
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value = je(t.y, t.m, t.d), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
|
|
2816
3034
|
return;
|
|
2817
3035
|
case "Escape": return this._close();
|
|
2818
3036
|
default:
|
|
@@ -2824,7 +3042,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2824
3042
|
if (!e || !t) return;
|
|
2825
3043
|
let r = () => !t.hidden;
|
|
2826
3044
|
this._open = () => {
|
|
2827
|
-
let r = /* @__PURE__ */ new Date(), i =
|
|
3045
|
+
let r = /* @__PURE__ */ new Date(), i = F(this._value);
|
|
2828
3046
|
(i || !this._viewNavigated) && (this._viewY = r.getFullYear(), this._viewM = r.getMonth()), this._mode = "days";
|
|
2829
3047
|
let a = r.getFullYear() === this._viewY && r.getMonth() === this._viewM, o = i && i.y === this._viewY && i.m === this._viewM;
|
|
2830
3048
|
this._focus = o ? i : {
|
|
@@ -2839,7 +3057,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2839
3057
|
let t = e.target.closest("[data-nav]");
|
|
2840
3058
|
if (t) {
|
|
2841
3059
|
this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
|
|
2842
|
-
let e =
|
|
3060
|
+
let e = R(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
2843
3061
|
this._viewY = e.y, this._viewM = e.m, this._focus = {
|
|
2844
3062
|
y: e.y,
|
|
2845
3063
|
m: e.m,
|
|
@@ -2879,7 +3097,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2879
3097
|
if (e.target.closest("[data-today]")) {
|
|
2880
3098
|
let e = /* @__PURE__ */ new Date();
|
|
2881
3099
|
if (this._limits().dayDisabled(e.getFullYear(), e.getMonth(), e.getDate())) return;
|
|
2882
|
-
this.value =
|
|
3100
|
+
this.value = je(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
|
|
2883
3101
|
return;
|
|
2884
3102
|
}
|
|
2885
3103
|
if (e.target.closest("[data-clear]")) {
|
|
@@ -2907,7 +3125,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2907
3125
|
disconnectedCallback() {
|
|
2908
3126
|
this._teardown();
|
|
2909
3127
|
}
|
|
2910
|
-
},
|
|
3128
|
+
}, Ne = class extends e {
|
|
2911
3129
|
static formAssociated = !0;
|
|
2912
3130
|
static get observedAttributes() {
|
|
2913
3131
|
return [
|
|
@@ -2975,20 +3193,20 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
2975
3193
|
text: e,
|
|
2976
3194
|
empty: !0
|
|
2977
3195
|
} : {
|
|
2978
|
-
text: `${
|
|
3196
|
+
text: `${I(this._start) || "Start"} to ${I(this._end) || "End"}`,
|
|
2979
3197
|
empty: !1
|
|
2980
3198
|
};
|
|
2981
3199
|
}
|
|
2982
3200
|
render() {
|
|
2983
3201
|
this._defaultStart === void 0 && (this._defaultStart = this.getAttribute("start") || "", this._defaultEnd = this.getAttribute("end") || "", this._start = this._defaultStart || this._start, this._end = this._defaultEnd || this._end);
|
|
2984
|
-
let e =
|
|
3202
|
+
let e = F(this._start);
|
|
2985
3203
|
e && (this._viewY = e.y, this._viewM = e.m);
|
|
2986
3204
|
let t = this.getAttribute("size"), n = t === "sm" ? " input-sm" : t === "lg" ? " input-lg" : "", { text: r, empty: i } = this._label(), a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
|
|
2987
3205
|
this.innerHTML = `
|
|
2988
3206
|
<div class="daterange">
|
|
2989
|
-
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${
|
|
2990
|
-
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${
|
|
2991
|
-
${
|
|
3207
|
+
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${b(a)}"` : ""}${o ? ` aria-describedby="${b(o)}"` : ""}>
|
|
3208
|
+
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${b(r)}</span>
|
|
3209
|
+
${_("calendar")}
|
|
2992
3210
|
</button>
|
|
2993
3211
|
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
2994
3212
|
</div>`, this._rendered = !0, this._syncMirrors(), this._wire();
|
|
@@ -3015,24 +3233,24 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3015
3233
|
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute("data-range-mirror", e), this.appendChild(r)), r.name = t, r.value = n || "", r.disabled = this.hasAttribute("disabled");
|
|
3016
3234
|
}
|
|
3017
3235
|
_limits() {
|
|
3018
|
-
let e =
|
|
3236
|
+
let e = F(this.getAttribute("min")), t = F(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
|
|
3019
3237
|
return (e, t, i) => {
|
|
3020
3238
|
let a = new Date(e, t, i).getTime();
|
|
3021
3239
|
return a < n || a > r;
|
|
3022
3240
|
};
|
|
3023
3241
|
}
|
|
3024
3242
|
_monthHtml(e, t) {
|
|
3025
|
-
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i =
|
|
3026
|
-
let i =
|
|
3243
|
+
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = L(e, t), a = this._limits(), o = ke.map((e, t) => ke[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
|
|
3244
|
+
let i = je(e, t, n), o = a(e, t, n);
|
|
3027
3245
|
return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
|
|
3028
|
-
}, c = "", l =
|
|
3246
|
+
}, c = "", l = R(e, t - 1), u = L(l.y, l.m);
|
|
3029
3247
|
for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
3030
3248
|
for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
|
|
3031
|
-
let d =
|
|
3249
|
+
let d = R(e, t + 1), f = (7 - (r + i) % 7) % 7;
|
|
3032
3250
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
3033
3251
|
return `
|
|
3034
3252
|
<div class="daterange-cal">
|
|
3035
|
-
<div class="datepicker-month-label">${
|
|
3253
|
+
<div class="datepicker-month-label">${Oe[t]} ${e}</div>
|
|
3036
3254
|
<div class="datepicker-weekdays">${o}</div>
|
|
3037
3255
|
<div class="datepicker-grid" role="grid">${c}</div>
|
|
3038
3256
|
</div>`;
|
|
@@ -3040,11 +3258,11 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3040
3258
|
_renderView() {
|
|
3041
3259
|
let e = this.querySelector(".daterange-pop");
|
|
3042
3260
|
if (!e) return;
|
|
3043
|
-
let t =
|
|
3261
|
+
let t = R(this._viewY, this._viewM + 1);
|
|
3044
3262
|
e.innerHTML = `
|
|
3045
3263
|
<div class="daterange-head">
|
|
3046
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${
|
|
3047
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${
|
|
3264
|
+
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${_("chevron-left")}</button>
|
|
3265
|
+
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${_("chevron-right")}</button>
|
|
3048
3266
|
</div>
|
|
3049
3267
|
<div class="daterange-cals">
|
|
3050
3268
|
${this._monthHtml(this._viewY, this._viewM)}
|
|
@@ -3066,7 +3284,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3066
3284
|
n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
|
|
3067
3285
|
}
|
|
3068
3286
|
let i = e.querySelector("[data-range-hint]");
|
|
3069
|
-
i && (i.textContent = this._start ? this._end ? `${
|
|
3287
|
+
i && (i.textContent = this._start ? this._end ? `${I(this._start)} to ${I(this._end)}` : "Pick an end date" : "Pick a start date");
|
|
3070
3288
|
}
|
|
3071
3289
|
_position(e, t) {
|
|
3072
3290
|
c(e, t, { clampHeight: !0 });
|
|
@@ -3088,7 +3306,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3088
3306
|
if (!e || !t) return;
|
|
3089
3307
|
let r = () => !t.hidden;
|
|
3090
3308
|
this._open = () => {
|
|
3091
|
-
let r =
|
|
3309
|
+
let r = F(this._start);
|
|
3092
3310
|
if (r) this._viewY = r.y, this._viewM = r.m;
|
|
3093
3311
|
else {
|
|
3094
3312
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -3101,7 +3319,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3101
3319
|
this._popClick = !0;
|
|
3102
3320
|
let t = e.target.closest("[data-nav]");
|
|
3103
3321
|
if (t) {
|
|
3104
|
-
let e =
|
|
3322
|
+
let e = R(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
3105
3323
|
this._viewY = e.y, this._viewM = e.m, this._renderView();
|
|
3106
3324
|
return;
|
|
3107
3325
|
}
|
|
@@ -3131,7 +3349,7 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3131
3349
|
disconnectedCallback() {
|
|
3132
3350
|
this._teardown();
|
|
3133
3351
|
}
|
|
3134
|
-
},
|
|
3352
|
+
}, Pe = class extends e {
|
|
3135
3353
|
static get observedAttributes() {
|
|
3136
3354
|
return [
|
|
3137
3355
|
"static",
|
|
@@ -3152,10 +3370,10 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3152
3370
|
e === "static" && this.isConnected && this._wire();
|
|
3153
3371
|
}
|
|
3154
3372
|
_maxScale() {
|
|
3155
|
-
return
|
|
3373
|
+
return Fe(this.getAttribute("max-scale"), 1.6);
|
|
3156
3374
|
}
|
|
3157
3375
|
_radius() {
|
|
3158
|
-
return
|
|
3376
|
+
return Fe(this.getAttribute("radius"), 100);
|
|
3159
3377
|
}
|
|
3160
3378
|
_magnifyEnabled() {
|
|
3161
3379
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -3180,26 +3398,352 @@ var j = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
3180
3398
|
_teardown() {
|
|
3181
3399
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
3182
3400
|
}
|
|
3183
|
-
},
|
|
3401
|
+
}, Fe = (e, t) => {
|
|
3184
3402
|
let n = Number.parseFloat(e);
|
|
3185
3403
|
return Number.isFinite(n) ? n : t;
|
|
3186
|
-
},
|
|
3404
|
+
}, Ie = 4096, Le = [
|
|
3405
|
+
.92,
|
|
3406
|
+
.8,
|
|
3407
|
+
.65,
|
|
3408
|
+
.5
|
|
3409
|
+
], Re = .8, ze = 8;
|
|
3410
|
+
function Be(e) {
|
|
3411
|
+
if (e == null || e === "" || e === "free") return null;
|
|
3412
|
+
let t = typeof e == "number" ? e : Number(e);
|
|
3413
|
+
return Number.isFinite(t) && t > 0 ? t : null;
|
|
3414
|
+
}
|
|
3415
|
+
function Ve(e, t, n) {
|
|
3416
|
+
if (!n) return {
|
|
3417
|
+
x: 0,
|
|
3418
|
+
y: 0,
|
|
3419
|
+
w: e,
|
|
3420
|
+
h: t
|
|
3421
|
+
};
|
|
3422
|
+
let r = e, i = r / n;
|
|
3423
|
+
return i > t && (i = t, r = i * n), {
|
|
3424
|
+
x: (e - r) / 2,
|
|
3425
|
+
y: (t - i) / 2,
|
|
3426
|
+
w: r,
|
|
3427
|
+
h: i
|
|
3428
|
+
};
|
|
3429
|
+
}
|
|
3430
|
+
function He(e, t, n) {
|
|
3431
|
+
return {
|
|
3432
|
+
...e,
|
|
3433
|
+
x: Math.min(Math.max(e.x, 0), Math.max(t - e.w, 0)),
|
|
3434
|
+
y: Math.min(Math.max(e.y, 0), Math.max(n - e.h, 0))
|
|
3435
|
+
};
|
|
3436
|
+
}
|
|
3437
|
+
function Ue(e, t, n, r, i) {
|
|
3438
|
+
return He({
|
|
3439
|
+
...e,
|
|
3440
|
+
x: e.x + t,
|
|
3441
|
+
y: e.y + n
|
|
3442
|
+
}, r, i);
|
|
3443
|
+
}
|
|
3444
|
+
function We(e, t) {
|
|
3445
|
+
return Math.min(32, e, t);
|
|
3446
|
+
}
|
|
3447
|
+
function Ge(e, t) {
|
|
3448
|
+
return t.w / e.w;
|
|
3449
|
+
}
|
|
3450
|
+
function Ke(e, t) {
|
|
3451
|
+
return Math.max(4, Ge(e, t));
|
|
3452
|
+
}
|
|
3453
|
+
function qe(e, t, n, r, i) {
|
|
3454
|
+
let a = Math.min(Math.max(n, 1), Ke(e, t)), o = e.h / e.w, s = Math.min(r, i / o), c = Math.min(Math.max(We(r, i), We(r, i) / o), s), l = Math.min(Math.max(t.w / a, c), s), u = l * o, d = e.x + e.w / 2, f = e.y + e.h / 2;
|
|
3455
|
+
return He({
|
|
3456
|
+
x: d - l / 2,
|
|
3457
|
+
y: f - u / 2,
|
|
3458
|
+
w: l,
|
|
3459
|
+
h: u
|
|
3460
|
+
}, r, i);
|
|
3461
|
+
}
|
|
3462
|
+
var Je = [
|
|
3463
|
+
"nw",
|
|
3464
|
+
"ne",
|
|
3465
|
+
"sw",
|
|
3466
|
+
"se"
|
|
3467
|
+
];
|
|
3468
|
+
function Ye(e, t, n, r, i, a) {
|
|
3469
|
+
let o = We(i, a), s = t.endsWith("w"), c = t.startsWith("n"), l = s ? e.x + e.w : e.x, u = c ? e.y + e.h : e.y, d = Math.min(Math.max(n, 0), i), f = Math.min(Math.max(r, 0), a);
|
|
3470
|
+
return d = s ? Math.min(d, l - o) : Math.max(d, l + o), f = c ? Math.min(f, u - o) : Math.max(f, u + o), {
|
|
3471
|
+
x: Math.min(d, l),
|
|
3472
|
+
y: Math.min(f, u),
|
|
3473
|
+
w: Math.abs(d - l),
|
|
3474
|
+
h: Math.abs(f - u)
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
function Xe(e, t = Ie) {
|
|
3478
|
+
let n = Math.min(1, t / Math.max(e.w, e.h));
|
|
3479
|
+
return {
|
|
3480
|
+
width: Math.max(1, Math.round(e.w * n)),
|
|
3481
|
+
height: Math.max(1, Math.round(e.h * n))
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
var Ze = [
|
|
3485
|
+
"image/png",
|
|
3486
|
+
"image/jpeg",
|
|
3487
|
+
"image/webp"
|
|
3488
|
+
], Qe = {
|
|
3489
|
+
"image/png": ".png",
|
|
3490
|
+
"image/jpeg": ".jpg",
|
|
3491
|
+
"image/webp": ".webp"
|
|
3492
|
+
};
|
|
3493
|
+
function $e(e) {
|
|
3494
|
+
let t = String(e || "").toLowerCase();
|
|
3495
|
+
return Ze.includes(t) ? t : "image/png";
|
|
3496
|
+
}
|
|
3497
|
+
function et(e, t) {
|
|
3498
|
+
let n = String(e || "image"), r = Qe[t];
|
|
3499
|
+
return (t === "image/jpeg" ? /\.jpe?g$/i.test(n) : n.toLowerCase().endsWith(r)) ? n : `${n.replace(/\.[^./\\]+$/, "") || "image"}${r}`;
|
|
3500
|
+
}
|
|
3501
|
+
async function tt(e, { width: t, height: n, type: r, maxBytes: i }) {
|
|
3502
|
+
let a = r, o = t, s = n, c = null;
|
|
3503
|
+
for (let t = 0; t <= ze; t++) {
|
|
3504
|
+
let n = a === "image/png" ? [void 0] : t === 0 ? Le : [Le[1]];
|
|
3505
|
+
for (let t of n) {
|
|
3506
|
+
if (c = await e(o, s, a, t), !c || (c.type && c.type !== a && (a = c.type), !(i > 0) || c.size <= i)) return c;
|
|
3507
|
+
if (a === "image/png") break;
|
|
3508
|
+
}
|
|
3509
|
+
o = Math.max(1, Math.round(o * Re)), s = Math.max(1, Math.round(s * Re));
|
|
3510
|
+
}
|
|
3511
|
+
return c;
|
|
3512
|
+
}
|
|
3513
|
+
//#endregion
|
|
3514
|
+
//#region src/WuiImageCrop.js
|
|
3515
|
+
var nt = .05, rt = .2, it = {
|
|
3516
|
+
w: 320,
|
|
3517
|
+
h: 240
|
|
3518
|
+
}, at = {
|
|
3519
|
+
nw: "top left",
|
|
3520
|
+
ne: "top right",
|
|
3521
|
+
sw: "bottom left",
|
|
3522
|
+
se: "bottom right"
|
|
3523
|
+
}, ot = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M5 12h14\"/></svg>", st = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M5 12h14M12 5v14\"/></svg>", ct = class extends e {
|
|
3524
|
+
static get observedAttributes() {
|
|
3525
|
+
return [
|
|
3526
|
+
"src",
|
|
3527
|
+
"aspect",
|
|
3528
|
+
"round"
|
|
3529
|
+
];
|
|
3530
|
+
}
|
|
3531
|
+
constructor() {
|
|
3532
|
+
super(), this._rect = null, this._base = null, this._natural = null, this._drag = null, this._resizeObserver = null;
|
|
3533
|
+
}
|
|
3534
|
+
get src() {
|
|
3535
|
+
return this.getAttribute("src") || "";
|
|
3536
|
+
}
|
|
3537
|
+
set src(e) {
|
|
3538
|
+
e == null || e === "" ? this.removeAttribute("src") : this.setAttribute("src", String(e));
|
|
3539
|
+
}
|
|
3540
|
+
get aspect() {
|
|
3541
|
+
return Be(this.getAttribute("aspect"));
|
|
3542
|
+
}
|
|
3543
|
+
set aspect(e) {
|
|
3544
|
+
e == null || e === "" ? this.removeAttribute("aspect") : this.setAttribute("aspect", String(e));
|
|
3545
|
+
}
|
|
3546
|
+
get round() {
|
|
3547
|
+
return this.hasAttribute("round");
|
|
3548
|
+
}
|
|
3549
|
+
set round(e) {
|
|
3550
|
+
this.toggleAttribute("round", !!e);
|
|
3551
|
+
}
|
|
3552
|
+
get rect() {
|
|
3553
|
+
return this._rect ? { ...this._rect } : null;
|
|
3554
|
+
}
|
|
3555
|
+
get zoom() {
|
|
3556
|
+
return this._rect ? Ge(this._rect, this._base) : 1;
|
|
3557
|
+
}
|
|
3558
|
+
set zoom(e) {
|
|
3559
|
+
this._rect && (this._rect = qe(this._rect, this._base, Number(e) || 1, this._natural.w, this._natural.h), this._paint(), this._announce());
|
|
3560
|
+
}
|
|
3561
|
+
connectedCallback() {
|
|
3562
|
+
if (!this._rendered) {
|
|
3563
|
+
this.render();
|
|
3564
|
+
return;
|
|
3565
|
+
}
|
|
3566
|
+
this._observe();
|
|
3567
|
+
}
|
|
3568
|
+
disconnectedCallback() {
|
|
3569
|
+
this._resizeObserver?.disconnect(), this._resizeObserver = null;
|
|
3570
|
+
}
|
|
3571
|
+
attributeChangedCallback(e) {
|
|
3572
|
+
this._rendered && (e === "src" ? this._loadImage() : e === "aspect" ? (this._rebuildHandles(), this._resetRect()) : this._frame.classList.toggle("wui-crop-frame--round", this.round));
|
|
3573
|
+
}
|
|
3574
|
+
render() {
|
|
3575
|
+
this.innerHTML = `<div>
|
|
3576
|
+
<div class="wui-crop-stage" tabindex="0" role="group" aria-label="Crop area. Drag the frame or use the arrow keys to move it, and plus or minus to zoom.">
|
|
3577
|
+
<img class="wui-crop-img" alt="" draggable="false">
|
|
3578
|
+
<div class="wui-crop-frame"></div>
|
|
3579
|
+
</div>
|
|
3580
|
+
<div class="wui-crop-controls">
|
|
3581
|
+
<button type="button" class="wui-crop-zoombtn" data-zoom="out" aria-label="Zoom out">${ot}</button>
|
|
3582
|
+
<input type="range" class="form-range wui-crop-zoom" min="1" max="4" step="0.01" value="1" aria-label="Zoom">
|
|
3583
|
+
<button type="button" class="wui-crop-zoombtn" data-zoom="in" aria-label="Zoom in">${st}</button>
|
|
3584
|
+
</div>
|
|
3585
|
+
<div class="visually-hidden" data-wui-crop-live aria-live="polite"></div>
|
|
3586
|
+
</div>`, this._stage = this.querySelector(".wui-crop-stage"), this._img = this.querySelector(".wui-crop-img"), this._frame = this.querySelector(".wui-crop-frame"), this._slider = this.querySelector(".wui-crop-zoom"), this._live = this.querySelector("[data-wui-crop-live]"), this._rendered = !0, this._frame.classList.toggle("wui-crop-frame--round", this.round), this._rebuildHandles(), this._wire(), this._observe(), this._loadImage();
|
|
3587
|
+
}
|
|
3588
|
+
_rebuildHandles() {
|
|
3589
|
+
for (let e of this._frame.querySelectorAll(".wui-crop-handle")) e.remove();
|
|
3590
|
+
if (!this.aspect) for (let e of Je) {
|
|
3591
|
+
let t = document.createElement("button");
|
|
3592
|
+
t.type = "button", t.className = `wui-crop-handle wui-crop-handle--${e}`, t.dataset.handle = e, t.setAttribute("aria-label", `Resize ${at[e]} corner`), this._frame.appendChild(t);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
_loadImage() {
|
|
3596
|
+
this._rect = null, this._natural = null, this._drag = null;
|
|
3597
|
+
let e = this.src;
|
|
3598
|
+
this._img.hidden = !e, this._frame.hidden = !0, e && (this._img.onload = () => {
|
|
3599
|
+
this._natural = {
|
|
3600
|
+
w: this._img.naturalWidth,
|
|
3601
|
+
h: this._img.naturalHeight
|
|
3602
|
+
}, this._resetRect(), this.dispatchEvent(new Event("load"));
|
|
3603
|
+
}, this._img.onerror = () => {
|
|
3604
|
+
this._frame.hidden = !0, this.dispatchEvent(new Event("error"));
|
|
3605
|
+
}, this._img.src = e);
|
|
3606
|
+
}
|
|
3607
|
+
_resetRect() {
|
|
3608
|
+
this._natural && (this._base = Ve(this._natural.w, this._natural.h, this.aspect), this._rect = { ...this._base }, this._frame.hidden = !1, this._paint());
|
|
3609
|
+
}
|
|
3610
|
+
_observe() {
|
|
3611
|
+
typeof ResizeObserver > "u" || this._resizeObserver || (this._resizeObserver = new ResizeObserver(() => this._paint()), this._resizeObserver.observe(this._stage));
|
|
3612
|
+
}
|
|
3613
|
+
_view() {
|
|
3614
|
+
let e = this._stage.clientWidth || it.w, t = this._stage.clientHeight || it.h, n = Math.min(e / this._natural.w, t / this._natural.h), r = this._natural.w * n, i = this._natural.h * n;
|
|
3615
|
+
return {
|
|
3616
|
+
scale: n,
|
|
3617
|
+
left: (e - r) / 2,
|
|
3618
|
+
top: (t - i) / 2,
|
|
3619
|
+
iw: r,
|
|
3620
|
+
ih: i
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
_paint() {
|
|
3624
|
+
if (!this._rect) return;
|
|
3625
|
+
let e = this._view();
|
|
3626
|
+
Object.assign(this._img.style, {
|
|
3627
|
+
left: `${e.left}px`,
|
|
3628
|
+
top: `${e.top}px`,
|
|
3629
|
+
width: `${e.iw}px`,
|
|
3630
|
+
height: `${e.ih}px`
|
|
3631
|
+
});
|
|
3632
|
+
let t = this._rect;
|
|
3633
|
+
Object.assign(this._frame.style, {
|
|
3634
|
+
left: `${e.left + t.x * e.scale}px`,
|
|
3635
|
+
top: `${e.top + t.y * e.scale}px`,
|
|
3636
|
+
width: `${t.w * e.scale}px`,
|
|
3637
|
+
height: `${t.h * e.scale}px`
|
|
3638
|
+
});
|
|
3639
|
+
let n = Ge(t, this._base), r = Ke(t, this._base);
|
|
3640
|
+
this._slider.max = String(r), this._slider.value = String(Math.min(Math.max(n, 1), r)), this._slider.setAttribute("aria-valuetext", `${Math.round(n * 100)}%`);
|
|
3641
|
+
}
|
|
3642
|
+
_announce() {
|
|
3643
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
3644
|
+
bubbles: !0,
|
|
3645
|
+
detail: this.rect
|
|
3646
|
+
}));
|
|
3647
|
+
}
|
|
3648
|
+
_say() {
|
|
3649
|
+
let e = this._rect, t = `Frame ${Math.round(e.w)} by ${Math.round(e.h)} pixels, ${Math.round(e.x)} from the left, ${Math.round(e.y)} from the top, zoom ${Math.round(Ge(e, this._base) * 100)}%.`;
|
|
3650
|
+
this._live.textContent = t === this._live.textContent ? `${t}\u00a0` : t;
|
|
3651
|
+
}
|
|
3652
|
+
_wire() {
|
|
3653
|
+
let e = this._stage;
|
|
3654
|
+
e.addEventListener("pointerdown", (t) => {
|
|
3655
|
+
if (!this._rect || t.button > 0) return;
|
|
3656
|
+
let n = t.target.closest?.(".wui-crop-handle");
|
|
3657
|
+
this._drag = {
|
|
3658
|
+
id: t.pointerId,
|
|
3659
|
+
corner: n ? n.dataset.handle : null,
|
|
3660
|
+
x: t.clientX,
|
|
3661
|
+
y: t.clientY,
|
|
3662
|
+
start: { ...this._rect }
|
|
3663
|
+
}, e.setPointerCapture?.(t.pointerId), n || e.focus(), t.preventDefault();
|
|
3664
|
+
}), e.addEventListener("pointermove", (t) => {
|
|
3665
|
+
let n = this._drag;
|
|
3666
|
+
if (!n || n.id !== t.pointerId) return;
|
|
3667
|
+
let r = this._view(), { w: i, h: a } = this._natural;
|
|
3668
|
+
if (n.corner) {
|
|
3669
|
+
let o = e.getBoundingClientRect(), s = (t.clientX - o.left - e.clientLeft - r.left) / r.scale, c = (t.clientY - o.top - e.clientTop - r.top) / r.scale;
|
|
3670
|
+
this._rect = Ye(this._rect, n.corner, s, c, i, a);
|
|
3671
|
+
} else this._rect = Ue(n.start, (t.clientX - n.x) / r.scale, (t.clientY - n.y) / r.scale, i, a);
|
|
3672
|
+
this._paint();
|
|
3673
|
+
});
|
|
3674
|
+
let t = (t) => {
|
|
3675
|
+
let n = this._drag;
|
|
3676
|
+
!n || n.id !== t.pointerId || (this._drag = null, e.releasePointerCapture?.(t.pointerId), this._announce());
|
|
3677
|
+
};
|
|
3678
|
+
e.addEventListener("pointerup", t), e.addEventListener("pointercancel", t), e.addEventListener("keydown", (e) => this._onKey(e)), e.addEventListener("wheel", (t) => {
|
|
3679
|
+
!this._rect || document.activeElement !== e || (t.preventDefault(), this.zoom *= t.deltaY < 0 ? 1.1 : 1 / 1.1);
|
|
3680
|
+
}, { passive: !1 });
|
|
3681
|
+
for (let e of ["input", "change"]) this._slider.addEventListener(e, (e) => e.stopPropagation());
|
|
3682
|
+
this._slider.addEventListener("input", () => {
|
|
3683
|
+
this.zoom = Number(this._slider.value);
|
|
3684
|
+
});
|
|
3685
|
+
for (let e of this.querySelectorAll(".wui-crop-zoombtn")) e.addEventListener("click", () => {
|
|
3686
|
+
this.zoom *= e.dataset.zoom === "in" ? 1.25 : .8;
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
_onKey(e) {
|
|
3690
|
+
if (!this._rect || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
3691
|
+
let { w: t, h: n } = this._natural;
|
|
3692
|
+
if (e.key === "+" || e.key === "=") this.zoom *= 1.25, this._say();
|
|
3693
|
+
else if (e.key === "-" || e.key === "_") this.zoom *= .8, this._say();
|
|
3694
|
+
else if (e.key.startsWith("Arrow")) {
|
|
3695
|
+
let r = e.shiftKey ? rt : nt, i = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0, a = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0, o = e.target.closest?.(".wui-crop-handle")?.dataset.handle;
|
|
3696
|
+
if (o) {
|
|
3697
|
+
let e = this._rect, s = (o.endsWith("w") ? e.x : e.x + e.w) + i * r * e.w, c = (o.startsWith("n") ? e.y : e.y + e.h) + a * r * e.h;
|
|
3698
|
+
this._rect = Ye(e, o, s, c, t, n);
|
|
3699
|
+
} else this._rect = Ue(this._rect, i * r * this._rect.w, a * r * this._rect.h, t, n);
|
|
3700
|
+
this._paint(), this._announce(), this._say();
|
|
3701
|
+
} else return;
|
|
3702
|
+
e.preventDefault();
|
|
3703
|
+
}
|
|
3704
|
+
async toBlob({ type: e, maxBytes: t = 0 } = {}) {
|
|
3705
|
+
if (!this._rect) return null;
|
|
3706
|
+
let n = $e(e), r = He(this._rect, this._natural.w, this._natural.h), { width: i, height: a } = Xe(r);
|
|
3707
|
+
return tt((e, t, n, i) => new Promise((a) => {
|
|
3708
|
+
let o = document.createElement("canvas");
|
|
3709
|
+
o.width = e, o.height = t;
|
|
3710
|
+
let s = o.getContext("2d");
|
|
3711
|
+
if (!s) {
|
|
3712
|
+
a(null);
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
n === "image/jpeg" && (s.fillStyle = "#fff", s.fillRect(0, 0, e, t)), s.drawImage(this._img, r.x, r.y, r.w, r.h, 0, 0, e, t), o.toBlob(a, n, i);
|
|
3716
|
+
}), {
|
|
3717
|
+
width: i,
|
|
3718
|
+
height: a,
|
|
3719
|
+
type: n,
|
|
3720
|
+
maxBytes: t
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
async toFile({ name: e, type: t, maxBytes: n = 0 } = {}) {
|
|
3724
|
+
let r = await this.toBlob({
|
|
3725
|
+
type: t,
|
|
3726
|
+
maxBytes: n
|
|
3727
|
+
});
|
|
3728
|
+
return r ? new File([r], et(e, r.type), { type: r.type }) : null;
|
|
3729
|
+
}
|
|
3730
|
+
}, lt = {
|
|
3187
3731
|
enter: "Enter",
|
|
3188
3732
|
comma: ",",
|
|
3189
3733
|
space: " ",
|
|
3190
3734
|
tab: "Tab"
|
|
3191
|
-
},
|
|
3735
|
+
}, ut = {
|
|
3192
3736
|
enter: "\n",
|
|
3193
3737
|
comma: ",",
|
|
3194
3738
|
space: " ",
|
|
3195
3739
|
tab: " "
|
|
3196
|
-
},
|
|
3197
|
-
function
|
|
3740
|
+
}, dt = (e) => lt[e], ft = (e) => ut[e];
|
|
3741
|
+
function pt(e, t) {
|
|
3198
3742
|
let n = [String(e ?? "")];
|
|
3199
3743
|
for (let e of t) n = n.flatMap((t) => t.split(e));
|
|
3200
3744
|
return n.map((e) => e.trim()).filter(Boolean);
|
|
3201
3745
|
}
|
|
3202
|
-
var
|
|
3746
|
+
var mt = (e, t) => t.some((t) => String(e ?? "").includes(t)), ht = class extends e {
|
|
3203
3747
|
static formAssociated = !0;
|
|
3204
3748
|
_accessibleName() {
|
|
3205
3749
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -3263,7 +3807,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3263
3807
|
return this._values.slice();
|
|
3264
3808
|
}
|
|
3265
3809
|
set values(e) {
|
|
3266
|
-
this._values = Array.isArray(e) ? e.map(String) : [],
|
|
3810
|
+
this._values = Array.isArray(e) ? e.map(String) : [], h(this, this._values), this._rendered && (this._renderControl(), this._renderOptions(this._query()));
|
|
3267
3811
|
}
|
|
3268
3812
|
set options(e) {
|
|
3269
3813
|
if (this._optionsProp = Array.isArray(e) ? e : null, this._rendered && this._allowCustom) {
|
|
@@ -3296,10 +3840,10 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3296
3840
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
3297
3841
|
label: e.innerHTML,
|
|
3298
3842
|
icon: e.getAttribute("icon") || void 0,
|
|
3299
|
-
[
|
|
3843
|
+
[y]: !0,
|
|
3300
3844
|
selected: e.hasAttribute("selected")
|
|
3301
3845
|
};
|
|
3302
|
-
for (let [n, r] of
|
|
3846
|
+
for (let [n, r] of _t) {
|
|
3303
3847
|
let i = e.getAttribute(n);
|
|
3304
3848
|
i && (t[r] = i);
|
|
3305
3849
|
}
|
|
@@ -3315,12 +3859,12 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3315
3859
|
}
|
|
3316
3860
|
_labelHtmlFor(e) {
|
|
3317
3861
|
let t = this._readOptions().find((t) => String(t.value) === String(e));
|
|
3318
|
-
return t ?
|
|
3862
|
+
return t ? C(t) : b(e);
|
|
3319
3863
|
}
|
|
3320
3864
|
render() {
|
|
3321
3865
|
this._snapshotDeclared();
|
|
3322
3866
|
let e = this._allowCustom, t = this.hasAttribute("searchable") && !e, n = this.getAttribute("search-placeholder") || "Search…", r = this.getAttribute("icon"), i = this.getAttribute("size"), a = i === "sm" ? " search-select-sm" : i === "lg" ? " search-select-lg" : "";
|
|
3323
|
-
|
|
3867
|
+
h(this, this._values), this.id ||= `wui-multiselect-${Math.random().toString(36).slice(2, 9)}`;
|
|
3324
3868
|
let o = `${this.id}-listbox`;
|
|
3325
3869
|
this._listboxId = o;
|
|
3326
3870
|
let s = this.hasAttribute("disabled");
|
|
@@ -3329,41 +3873,41 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3329
3873
|
this.innerHTML = `
|
|
3330
3874
|
<div class="search-select${a}">
|
|
3331
3875
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : ""}>
|
|
3332
|
-
${r ?
|
|
3333
|
-
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
3334
|
-
${
|
|
3876
|
+
${r ? _(r, { className: "search-select-icon" }) : ""}
|
|
3877
|
+
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${z(o)}" aria-label="${z(this._accessibleName())}" aria-describedby="${z(e)}" autocomplete="off"${s ? " disabled" : ""} /></div>
|
|
3878
|
+
${_("chevron-down", { className: "search-select-caret" })}
|
|
3335
3879
|
</div>
|
|
3336
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
3880
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
3337
3881
|
<div class="search-select-options"></div>
|
|
3338
3882
|
</div>
|
|
3339
3883
|
</div>
|
|
3340
|
-
<div class="field-error wui-ms-custom-error" id="${
|
|
3884
|
+
<div class="field-error wui-ms-custom-error" id="${z(e)}" aria-live="polite" hidden></div>`;
|
|
3341
3885
|
} else this.innerHTML = `
|
|
3342
3886
|
<div class="search-select${a}">
|
|
3343
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
3344
|
-
${r ?
|
|
3887
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${z(o)}" aria-label="${z(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
|
|
3888
|
+
${r ? _(r, { className: "search-select-icon" }) : ""}
|
|
3345
3889
|
<div class="ms-chips" data-chips></div>
|
|
3346
|
-
${
|
|
3890
|
+
${_("chevron-down", { className: "search-select-caret" })}
|
|
3347
3891
|
</div>
|
|
3348
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
3349
|
-
${t ? `<div class="search-select-search">${
|
|
3892
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
3893
|
+
${t ? `<div class="search-select-search">${_("search")}<input class="search-select-input" placeholder="${z(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${_("x")}</button></div>` : ""}
|
|
3350
3894
|
<div class="search-select-options"></div>
|
|
3351
3895
|
<div class="search-select-empty" hidden>No matches</div>
|
|
3352
3896
|
</div>
|
|
3353
3897
|
</div>`;
|
|
3354
|
-
this._rendered = !0, this._customError = "",
|
|
3898
|
+
this._rendered = !0, this._customError = "", h(this, this._values), this._renderControl(), this._renderOptions(), this._wire();
|
|
3355
3899
|
}
|
|
3356
3900
|
_renderControl() {
|
|
3357
3901
|
let e = this.querySelector("[data-chips]");
|
|
3358
3902
|
if (!e) return;
|
|
3359
|
-
let t = this.getAttribute("placeholder") || "Select…", n = this._allowCustom ? e.querySelector("[data-input]") : null, r = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${
|
|
3903
|
+
let t = this.getAttribute("placeholder") || "Select…", n = this._allowCustom ? e.querySelector("[data-input]") : null, r = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${z(e)}" aria-label="Remove ${z(wt(this._labelFor(e)))}">${_("x")}</button></span>`).join("");
|
|
3360
3904
|
if (n) {
|
|
3361
3905
|
for (let t of [...e.querySelectorAll(":scope > .chip")]) t.remove();
|
|
3362
3906
|
n.insertAdjacentHTML("beforebegin", r), n.placeholder = this._values.length ? "" : t, this._collapseChips();
|
|
3363
3907
|
return;
|
|
3364
3908
|
}
|
|
3365
3909
|
if (!this._values.length) {
|
|
3366
|
-
e.innerHTML = `<span class="search-select-placeholder">${
|
|
3910
|
+
e.innerHTML = `<span class="search-select-placeholder">${b(t)}</span>`;
|
|
3367
3911
|
return;
|
|
3368
3912
|
}
|
|
3369
3913
|
e.innerHTML = r, this._collapseChips();
|
|
@@ -3387,11 +3931,11 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3387
3931
|
i.textContent = `+${t.length - o}`;
|
|
3388
3932
|
}
|
|
3389
3933
|
_matches(e, t) {
|
|
3390
|
-
return
|
|
3934
|
+
return wt(e.label).toLowerCase().includes(t) || String(e.description ?? "").toLowerCase().includes(t);
|
|
3391
3935
|
}
|
|
3392
3936
|
_optionNamed(e) {
|
|
3393
3937
|
let t = e.trim().toLowerCase();
|
|
3394
|
-
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t ||
|
|
3938
|
+
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t || wt(e.label).trim().toLowerCase() === t);
|
|
3395
3939
|
}
|
|
3396
3940
|
_renderOptions(e) {
|
|
3397
3941
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
@@ -3400,9 +3944,9 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3400
3944
|
i && (a = a.filter((e) => this._matches(e, i)));
|
|
3401
3945
|
let o = this._listboxId || `${this.id || "wui-multiselect"}-listbox`, s = this._allowCustom && r && !this._optionNamed(r), c = a.map((e, t) => {
|
|
3402
3946
|
let n = this._values.includes(String(e.value)), r = `${o}-opt-${t}`;
|
|
3403
|
-
return
|
|
3947
|
+
return vt(e) ? xt(e, r, n) : `<button type="button" role="option" id="${z(r)}" class="search-select-option${n ? " selected" : ""}" data-value="${z(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${C(e)}</span><span class="ms-check">${_("check")}</span></button>`;
|
|
3404
3948
|
});
|
|
3405
|
-
s && c.push(`<button type="button" role="option" id="${
|
|
3949
|
+
s && c.push(`<button type="button" role="option" id="${z(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${z(r)}" data-custom="true" aria-selected="false">Add “${b(r)}”</button>`), t.innerHTML = c.join(""), n && (n.hidden = a.length > 0), this._active = -1, this._combobox()?.removeAttribute("aria-activedescendant"), this._allowCustom && this._syncCustomMenu?.(), this._reanchor?.();
|
|
3406
3950
|
}
|
|
3407
3951
|
_combobox() {
|
|
3408
3952
|
return this._allowCustom ? this.querySelector("[data-input]") : this.querySelector(".search-select-control");
|
|
@@ -3415,7 +3959,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3415
3959
|
_customRefusal(e) {
|
|
3416
3960
|
let t = this.getAttribute("custom-invalid-message") || "Enter a valid value.", n = this.getAttribute("custom-pattern");
|
|
3417
3961
|
if (n) {
|
|
3418
|
-
let r =
|
|
3962
|
+
let r = Ct(n);
|
|
3419
3963
|
if (r && !r.test(e)) return t;
|
|
3420
3964
|
}
|
|
3421
3965
|
let r = this._validateCustom;
|
|
@@ -3444,95 +3988,95 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3444
3988
|
this._teardown();
|
|
3445
3989
|
let e = this.querySelector(".search-select-control"), t = this.querySelector(".search-select-menu"), n = this.querySelector(".search-select-input"), r = this.querySelector(".search-select-clear"), i = this.querySelector(".search-select-options"), a = this._allowCustom, o = a ? this.querySelector("[data-input]") : null, s = o || e;
|
|
3446
3990
|
if (!e || !t) return;
|
|
3447
|
-
let u = () => this.hasAttribute("disabled"), d = () => c(e, t, { matchWidth: !0 }),
|
|
3448
|
-
let t =
|
|
3991
|
+
let u = () => this.hasAttribute("disabled"), d = () => c(e, t, { matchWidth: !0 }), f = () => [...this.querySelectorAll(".search-select-option")], p = () => f().filter((e) => !e.hidden), m = (e) => {
|
|
3992
|
+
let t = p();
|
|
3449
3993
|
this._active = e;
|
|
3450
|
-
for (let e of
|
|
3994
|
+
for (let e of f()) e.classList.remove("is-active");
|
|
3451
3995
|
e >= 0 && t[e] ? (t[e].classList.add("is-active"), t[e].scrollIntoView({ block: "nearest" }), s.setAttribute("aria-activedescendant", t[e].id)) : s.removeAttribute("aria-activedescendant");
|
|
3452
|
-
},
|
|
3453
|
-
let n =
|
|
3996
|
+
}, g = !1, _ = () => a ? g : !t.hidden, y = () => {
|
|
3997
|
+
let n = g && f().length > 0, r = t.hidden;
|
|
3454
3998
|
t.hidden = !n, s.setAttribute("aria-expanded", String(n)), e.classList.toggle("open", n), n && r && d();
|
|
3455
3999
|
};
|
|
3456
4000
|
this._syncCustomMenu = a ? y : null;
|
|
3457
4001
|
let b = () => {
|
|
3458
4002
|
if (!u()) {
|
|
3459
4003
|
if (a) {
|
|
3460
|
-
|
|
4004
|
+
g = !0, y();
|
|
3461
4005
|
return;
|
|
3462
4006
|
}
|
|
3463
4007
|
t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), d(), n && (n.value = "", this._renderOptions(""), n.focus());
|
|
3464
4008
|
}
|
|
3465
4009
|
}, x = () => {
|
|
3466
|
-
a ? (
|
|
4010
|
+
a ? (g = !1, y()) : (t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open")), m(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
|
|
3467
4011
|
}, S = () => {
|
|
3468
|
-
|
|
3469
|
-
},
|
|
4012
|
+
h(this, this._values), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
4013
|
+
}, ee = (e) => {
|
|
3470
4014
|
let t = String(e);
|
|
3471
4015
|
if (this._values.includes(t)) this._values = this._values.filter((e) => e !== t);
|
|
3472
4016
|
else if (a && this._values.some((e) => e.toLowerCase() === t.toLowerCase())) return;
|
|
3473
4017
|
else this._values = [...this._values, t];
|
|
3474
4018
|
this._renderControl(), this._renderOptions(this._query()), S();
|
|
3475
|
-
},
|
|
4019
|
+
}, C = (e) => {
|
|
3476
4020
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(this._query()), S();
|
|
3477
|
-
},
|
|
3478
|
-
let n = this._values.length, r =
|
|
4021
|
+
}, w = (e, { quiet: t = !1 } = {}) => {
|
|
4022
|
+
let n = this._values.length, r = mt(e, gt) ? pt(e, gt) : [e], i = [], a = "";
|
|
3479
4023
|
for (let e of r) {
|
|
3480
4024
|
let t = this._commitTyped(e);
|
|
3481
4025
|
t && (i.push(e.trim()), a ||= t);
|
|
3482
4026
|
}
|
|
3483
4027
|
t && i.length || (o.value = i.join(", "), this._setCustomError(a), this._values.length !== n && (this._renderControl(), S()), this._renderOptions(o.value));
|
|
3484
|
-
},
|
|
4028
|
+
}, T = (e) => {
|
|
3485
4029
|
if (!(!e || e.getAttribute("aria-disabled") === "true")) {
|
|
3486
4030
|
if (e.dataset.custom === "true") {
|
|
3487
|
-
|
|
4031
|
+
w(e.dataset.value);
|
|
3488
4032
|
return;
|
|
3489
4033
|
}
|
|
3490
|
-
|
|
4034
|
+
ee(e.dataset.value), o?.value && (o.value = "", this._setCustomError(""), this._renderOptions(""));
|
|
3491
4035
|
}
|
|
3492
4036
|
};
|
|
3493
4037
|
e.addEventListener("click", (e) => {
|
|
3494
4038
|
if (u()) return;
|
|
3495
4039
|
let t = e.target.closest("[data-remove]");
|
|
3496
4040
|
if (t) {
|
|
3497
|
-
e.stopPropagation(),
|
|
4041
|
+
e.stopPropagation(), C(t.dataset.remove), o?.focus();
|
|
3498
4042
|
return;
|
|
3499
4043
|
}
|
|
3500
4044
|
if (o) {
|
|
3501
|
-
let t =
|
|
4045
|
+
let t = _();
|
|
3502
4046
|
e.target !== o && o.focus(), e.target === o || !t ? b() : x();
|
|
3503
4047
|
return;
|
|
3504
4048
|
}
|
|
3505
|
-
|
|
4049
|
+
_() ? x() : b();
|
|
3506
4050
|
}), i.addEventListener("click", (e) => {
|
|
3507
4051
|
let t = e.target.closest(".search-select-option");
|
|
3508
|
-
t && (
|
|
4052
|
+
t && (T(t), (o || n)?.focus());
|
|
3509
4053
|
}), i.addEventListener("mousemove", (e) => {
|
|
3510
4054
|
let t = e.target.closest(".search-select-option");
|
|
3511
|
-
t &&
|
|
3512
|
-
}), i.addEventListener("mouseleave", () =>
|
|
4055
|
+
t && m(p().indexOf(t));
|
|
4056
|
+
}), i.addEventListener("mouseleave", () => m(-1)), i.addEventListener("error", (e) => {
|
|
3513
4057
|
e.target?.classList?.contains("avatar-img") && e.target.remove();
|
|
3514
4058
|
}, !0), n?.addEventListener("input", () => {
|
|
3515
|
-
this._renderOptions(n.value), r && (r.hidden = !n.value),
|
|
3516
|
-
}), this._navHandler =
|
|
3517
|
-
getVisibleOptions:
|
|
4059
|
+
this._renderOptions(n.value), r && (r.hidden = !n.value), m(-1);
|
|
4060
|
+
}), this._navHandler = v({
|
|
4061
|
+
getVisibleOptions: p,
|
|
3518
4062
|
getActive: () => this._active,
|
|
3519
|
-
setActive: (e) =>
|
|
4063
|
+
setActive: (e) => m(e),
|
|
3520
4064
|
onEnter: (e) => {
|
|
3521
|
-
e ?
|
|
4065
|
+
e ? T(e) : o?.value.trim() && w(o.value);
|
|
3522
4066
|
},
|
|
3523
4067
|
onEscape: () => {
|
|
3524
4068
|
this._navHandler.clearTypeahead(), x(), o || e.focus();
|
|
3525
4069
|
}
|
|
3526
4070
|
});
|
|
3527
|
-
let
|
|
4071
|
+
let E = (e) => {
|
|
3528
4072
|
let t = o || n;
|
|
3529
4073
|
if (e.key === "Backspace" && !t?.value && this._values.length) {
|
|
3530
|
-
|
|
4074
|
+
C(this._values[this._values.length - 1]);
|
|
3531
4075
|
return;
|
|
3532
4076
|
}
|
|
3533
4077
|
this._navHandler.handler(e);
|
|
3534
4078
|
};
|
|
3535
|
-
if (n?.addEventListener("keydown",
|
|
4079
|
+
if (n?.addEventListener("keydown", E), r?.addEventListener("click", () => {
|
|
3536
4080
|
n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
|
|
3537
4081
|
}), o) {
|
|
3538
4082
|
let t = (e) => {
|
|
@@ -3542,7 +4086,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3542
4086
|
this._customError && this._setCustomError(""), this._renderOptions(o.value), b();
|
|
3543
4087
|
}), o.addEventListener("keydown", (e) => {
|
|
3544
4088
|
if (e.key === "," && o.value.trim()) {
|
|
3545
|
-
e.preventDefault(),
|
|
4089
|
+
e.preventDefault(), w(o.value);
|
|
3546
4090
|
return;
|
|
3547
4091
|
}
|
|
3548
4092
|
if (e.key === "Enter") {
|
|
@@ -3550,25 +4094,25 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3550
4094
|
this._navHandler.handler(e);
|
|
3551
4095
|
return;
|
|
3552
4096
|
}
|
|
3553
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && !
|
|
4097
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && !_() && b(), E(e);
|
|
3554
4098
|
}), o.addEventListener("paste", (e) => {
|
|
3555
4099
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
3556
|
-
|
|
4100
|
+
mt(t, gt) && (e.preventDefault(), w(`${o.value}${t}`));
|
|
3557
4101
|
}), o.addEventListener("blur", (e) => {
|
|
3558
|
-
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() &&
|
|
4102
|
+
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() && w(o.value, { quiet: !0 }), x());
|
|
3559
4103
|
});
|
|
3560
4104
|
} else e.addEventListener("keydown", (e) => {
|
|
3561
|
-
if (
|
|
3562
|
-
|
|
4105
|
+
if (_()) {
|
|
4106
|
+
E(e);
|
|
3563
4107
|
return;
|
|
3564
4108
|
}
|
|
3565
4109
|
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
3566
4110
|
});
|
|
3567
4111
|
this._bindGlobal = () => {
|
|
3568
4112
|
this._teardown(), !this._ro && typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(() => this._collapseChips()), this._ro.observe(this)), this._onDocClick = (e) => {
|
|
3569
|
-
|
|
4113
|
+
_() && !this.contains(e.target) && x();
|
|
3570
4114
|
}, document.addEventListener("click", this._onDocClick), l(this, () => {
|
|
3571
|
-
|
|
4115
|
+
_() && d();
|
|
3572
4116
|
});
|
|
3573
4117
|
}, this._bindGlobal();
|
|
3574
4118
|
}
|
|
@@ -3578,35 +4122,35 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3578
4122
|
disconnectedCallback() {
|
|
3579
4123
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
3580
4124
|
}
|
|
3581
|
-
},
|
|
4125
|
+
}, gt = [
|
|
3582
4126
|
",",
|
|
3583
4127
|
";",
|
|
3584
4128
|
"\n",
|
|
3585
4129
|
" "
|
|
3586
|
-
],
|
|
4130
|
+
], _t = [
|
|
3587
4131
|
["description", "description"],
|
|
3588
4132
|
["avatar", "avatar"],
|
|
3589
4133
|
["initials", "initials"],
|
|
3590
4134
|
["disabled-hint", "disabledHint"]
|
|
3591
|
-
],
|
|
4135
|
+
], vt = (e) => !!(e.description || e.avatar || e.initials || e.disabled || e.disabledHint), yt = (e) => {
|
|
3592
4136
|
let t = String(e ?? "").trim();
|
|
3593
4137
|
return /^(https?:)?\/\//i.test(t) || /^\/(?!\/)/.test(t) || /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t) ? t : "";
|
|
3594
|
-
},
|
|
3595
|
-
let t =
|
|
3596
|
-
return !t && !e.initials ? "" : `<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${
|
|
3597
|
-
},
|
|
3598
|
-
let r = !!e.disabled, i = e.description ? `<span class="wui-opt-desc">${
|
|
3599
|
-
return `<button type="button" role="option" id="${
|
|
3600
|
-
},
|
|
3601
|
-
if (
|
|
4138
|
+
}, bt = (e) => {
|
|
4139
|
+
let t = yt(e.avatar);
|
|
4140
|
+
return !t && !e.initials ? "" : `<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${b(e.initials ?? "")}</span>${t ? `<img class="avatar-img" src="${z(t)}" alt="" />` : ""}</span>`;
|
|
4141
|
+
}, xt = (e, t, n) => {
|
|
4142
|
+
let r = !!e.disabled, i = e.description ? `<span class="wui-opt-desc">${b(e.description)}</span>` : "", a = e.disabledHint && r ? `<span class="wui-opt-hint">${b(e.disabledHint)}</span>` : "";
|
|
4143
|
+
return `<button type="button" role="option" id="${z(t)}" class="search-select-option wui-opt-rich${n ? " selected" : ""}" data-value="${z(e.value)}" aria-selected="${n}"${r ? " aria-disabled=\"true\"" : ""}><span class="ms-opt-label"><span class="wui-opt-name">${C(e)}</span>${i}</span>${a}${bt(e)}<span class="ms-check">${_("check")}</span></button>`;
|
|
4144
|
+
}, St = /* @__PURE__ */ new Map(), Ct = (e) => {
|
|
4145
|
+
if (St.has(e)) return St.get(e);
|
|
3602
4146
|
let t = null;
|
|
3603
4147
|
try {
|
|
3604
4148
|
t = RegExp(`^(?:${e})$`, "u");
|
|
3605
4149
|
} catch {
|
|
3606
4150
|
console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`);
|
|
3607
4151
|
}
|
|
3608
|
-
return
|
|
3609
|
-
},
|
|
4152
|
+
return St.set(e, t), t;
|
|
4153
|
+
}, z = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), wt = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), Tt = /[^0-9]/g, Et = /[^0-9a-zA-Z]/g, Dt = class extends e {
|
|
3610
4154
|
static formAssociated = !0;
|
|
3611
4155
|
static get observedAttributes() {
|
|
3612
4156
|
return [
|
|
@@ -3634,10 +4178,10 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3634
4178
|
return this._value ?? "";
|
|
3635
4179
|
}
|
|
3636
4180
|
set value(e) {
|
|
3637
|
-
this._value = this._clean(e),
|
|
4181
|
+
this._value = this._clean(e), m(this, this._value), this._paint();
|
|
3638
4182
|
}
|
|
3639
4183
|
_clean(e) {
|
|
3640
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
4184
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? Et : Tt, "").slice(0, this.length);
|
|
3641
4185
|
}
|
|
3642
4186
|
constructor() {
|
|
3643
4187
|
super();
|
|
@@ -3651,10 +4195,10 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3651
4195
|
this._rendered ? this._onSelectionChange && document.addEventListener("selectionchange", this._onSelectionChange) : (this._defaultCaptured ||= (this._defaultValue = this._value, !0), this.render());
|
|
3652
4196
|
}
|
|
3653
4197
|
formResetCallback() {
|
|
3654
|
-
this._value = this._defaultValue || "",
|
|
4198
|
+
this._value = this._defaultValue || "", m(this, this._value), this._paint();
|
|
3655
4199
|
}
|
|
3656
4200
|
attributeChangedCallback(e, t, n) {
|
|
3657
|
-
this._rendered && (e === "value" ? (this._value = this._clean(n),
|
|
4201
|
+
this._rendered && (e === "value" ? (this._value = this._clean(n), m(this, this._value), this._paint()) : this.render());
|
|
3658
4202
|
}
|
|
3659
4203
|
render() {
|
|
3660
4204
|
this._value = this._clean(this.getAttribute("value") ?? this._value);
|
|
@@ -3672,7 +4216,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3672
4216
|
spellcheck="false"
|
|
3673
4217
|
${n ? "disabled" : ""} />
|
|
3674
4218
|
<div class="otp-slots" aria-hidden="true">${r}</div>
|
|
3675
|
-
</div>`, this._rendered = !0,
|
|
4219
|
+
</div>`, this._rendered = !0, m(this, this._value), this._wire(), this._paint();
|
|
3676
4220
|
}
|
|
3677
4221
|
_refs() {
|
|
3678
4222
|
return {
|
|
@@ -3694,7 +4238,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3694
4238
|
if (!e) return;
|
|
3695
4239
|
let t = (e) => {
|
|
3696
4240
|
let t = this._clean(e), n = t !== this._value;
|
|
3697
|
-
this._value = t,
|
|
4241
|
+
this._value = t, m(this, this._value), this._paint(), n && this.dispatchEvent(new Event("change", { bubbles: !0 })), n && t.length === this.length && this.dispatchEvent(new CustomEvent("complete", {
|
|
3698
4242
|
bubbles: !0,
|
|
3699
4243
|
detail: t
|
|
3700
4244
|
}));
|
|
@@ -3728,7 +4272,7 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
3728
4272
|
disconnectedCallback() {
|
|
3729
4273
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
3730
4274
|
}
|
|
3731
|
-
},
|
|
4275
|
+
}, Ot = {
|
|
3732
4276
|
AD: ["Europe/Andorra"],
|
|
3733
4277
|
AE: ["Asia/Dubai"],
|
|
3734
4278
|
AF: ["Asia/Kabul"],
|
|
@@ -4130,13 +4674,13 @@ var Ce = (e, t) => t.some((t) => String(e ?? "").includes(t)), we = class extend
|
|
|
4130
4674
|
ZA: ["Africa/Johannesburg"],
|
|
4131
4675
|
ZM: ["Africa/Lusaka"],
|
|
4132
4676
|
ZW: ["Africa/Harare"]
|
|
4133
|
-
},
|
|
4134
|
-
for (let [e, t] of Object.entries(
|
|
4135
|
-
function
|
|
4136
|
-
let t =
|
|
4137
|
-
return t &&
|
|
4677
|
+
}, kt = new Set(Ce.map(([e]) => e)), At = /* @__PURE__ */ new Map();
|
|
4678
|
+
for (let [e, t] of Object.entries(Ot)) for (let n of t) At.set(n, e);
|
|
4679
|
+
function jt(e) {
|
|
4680
|
+
let t = At.get(e);
|
|
4681
|
+
return t && kt.has(t) ? t : null;
|
|
4138
4682
|
}
|
|
4139
|
-
function
|
|
4683
|
+
function Mt(e) {
|
|
4140
4684
|
if (!e) return null;
|
|
4141
4685
|
let t;
|
|
4142
4686
|
try {
|
|
@@ -4144,9 +4688,9 @@ function Ve(e) {
|
|
|
4144
4688
|
} catch {
|
|
4145
4689
|
return null;
|
|
4146
4690
|
}
|
|
4147
|
-
return t &&
|
|
4691
|
+
return t && kt.has(t) ? t : null;
|
|
4148
4692
|
}
|
|
4149
|
-
function
|
|
4693
|
+
function Nt() {
|
|
4150
4694
|
let e;
|
|
4151
4695
|
try {
|
|
4152
4696
|
e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -4154,77 +4698,77 @@ function He() {
|
|
|
4154
4698
|
e = void 0;
|
|
4155
4699
|
}
|
|
4156
4700
|
let t = typeof navigator > "u" ? void 0 : navigator.language;
|
|
4157
|
-
return
|
|
4701
|
+
return jt(e) || Mt(t) || "IN";
|
|
4158
4702
|
}
|
|
4159
4703
|
//#endregion
|
|
4160
4704
|
//#region src/WuiPhone.js
|
|
4161
|
-
var
|
|
4162
|
-
function
|
|
4163
|
-
return
|
|
4705
|
+
var Pt = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, B = null, Ft = null;
|
|
4706
|
+
function It() {
|
|
4707
|
+
return B ? Promise.resolve(B) : (Ft ||= Promise.all([import("./max-BDKx469G.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (B = {
|
|
4164
4708
|
AsYouType: e.AsYouType,
|
|
4165
4709
|
getExampleNumber: e.getExampleNumber,
|
|
4166
4710
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
4167
4711
|
parsePhoneNumber: e.parsePhoneNumber,
|
|
4168
4712
|
examples: t.default || t
|
|
4169
|
-
},
|
|
4713
|
+
}, B)).catch(() => null), Ft);
|
|
4170
4714
|
}
|
|
4171
|
-
function
|
|
4715
|
+
function Lt(e, t) {
|
|
4172
4716
|
let n = `+${N(e)}`;
|
|
4173
4717
|
return t?.startsWith(n) ? t.slice(n.length).trimStart() : null;
|
|
4174
4718
|
}
|
|
4175
|
-
function
|
|
4176
|
-
if (!
|
|
4719
|
+
function Rt(e, t) {
|
|
4720
|
+
if (!B || !t) return t;
|
|
4177
4721
|
try {
|
|
4178
|
-
return
|
|
4722
|
+
return Lt(e, new B.AsYouType(e).input(`+${N(e)}${t}`)) || t;
|
|
4179
4723
|
} catch {
|
|
4180
4724
|
return t;
|
|
4181
4725
|
}
|
|
4182
4726
|
}
|
|
4183
|
-
function
|
|
4727
|
+
function zt(e, t) {
|
|
4184
4728
|
if (t <= 0) return 0;
|
|
4185
4729
|
let n = 0;
|
|
4186
4730
|
for (let r = 0; r < e.length; r++) if (/[0-9]/.test(e[r]) && (n += 1, n === t)) return r + 1;
|
|
4187
4731
|
return e.length;
|
|
4188
4732
|
}
|
|
4189
|
-
function
|
|
4190
|
-
if (!
|
|
4733
|
+
function Bt(e) {
|
|
4734
|
+
if (!B) return null;
|
|
4191
4735
|
try {
|
|
4192
|
-
return
|
|
4736
|
+
return Lt(e, B.getExampleNumber(e, B.examples)?.formatInternational()) || null;
|
|
4193
4737
|
} catch {
|
|
4194
4738
|
return null;
|
|
4195
4739
|
}
|
|
4196
4740
|
}
|
|
4197
|
-
function
|
|
4198
|
-
if (!
|
|
4741
|
+
function Vt(e) {
|
|
4742
|
+
if (!B || !e) return null;
|
|
4199
4743
|
try {
|
|
4200
|
-
if (!
|
|
4201
|
-
let t =
|
|
4744
|
+
if (!B.isValidPhoneNumber(e)) return !1;
|
|
4745
|
+
let t = B.parsePhoneNumber(e)?.getType?.();
|
|
4202
4746
|
return t === void 0 || t === "MOBILE" || t === "FIXED_LINE_OR_MOBILE";
|
|
4203
4747
|
} catch {
|
|
4204
4748
|
return null;
|
|
4205
4749
|
}
|
|
4206
4750
|
}
|
|
4207
|
-
function
|
|
4208
|
-
if (!
|
|
4751
|
+
function Ht(e) {
|
|
4752
|
+
if (!B) return null;
|
|
4209
4753
|
try {
|
|
4210
|
-
let t =
|
|
4754
|
+
let t = B.getExampleNumber(e, B.examples);
|
|
4211
4755
|
return t?.nationalNumber ? t.nationalNumber.length : null;
|
|
4212
4756
|
} catch {
|
|
4213
4757
|
return null;
|
|
4214
4758
|
}
|
|
4215
4759
|
}
|
|
4216
|
-
function
|
|
4760
|
+
function Ut(e, t, n) {
|
|
4217
4761
|
try {
|
|
4218
|
-
let r =
|
|
4762
|
+
let r = B.parsePhoneNumber(t, e), i = r?.nationalNumber;
|
|
4219
4763
|
return !i || r.country !== e || i.length > n || !t.endsWith(i) ? null : i;
|
|
4220
4764
|
} catch {
|
|
4221
4765
|
return null;
|
|
4222
4766
|
}
|
|
4223
4767
|
}
|
|
4224
|
-
function
|
|
4225
|
-
if (!
|
|
4768
|
+
function Wt(e) {
|
|
4769
|
+
if (!B || !e?.trim().startsWith("+")) return null;
|
|
4226
4770
|
try {
|
|
4227
|
-
let t = new
|
|
4771
|
+
let t = new B.AsYouType();
|
|
4228
4772
|
t.input(e.trim());
|
|
4229
4773
|
let n = t.getCountry();
|
|
4230
4774
|
return n ? {
|
|
@@ -4235,7 +4779,7 @@ function Ze(e) {
|
|
|
4235
4779
|
return null;
|
|
4236
4780
|
}
|
|
4237
4781
|
}
|
|
4238
|
-
var
|
|
4782
|
+
var Gt = class extends e {
|
|
4239
4783
|
static formAssociated = !0;
|
|
4240
4784
|
static get observedAttributes() {
|
|
4241
4785
|
return [
|
|
@@ -4255,7 +4799,7 @@ var Qe = class extends e {
|
|
|
4255
4799
|
} catch {
|
|
4256
4800
|
this._internals = null;
|
|
4257
4801
|
}
|
|
4258
|
-
this._defaultCountry =
|
|
4802
|
+
this._defaultCountry = Nt(), this._country = this._defaultCountry, this._national = "", this._active = -1, this._committedValue = "";
|
|
4259
4803
|
}
|
|
4260
4804
|
connectedCallback() {
|
|
4261
4805
|
if (!this._rendered) {
|
|
@@ -4285,7 +4829,7 @@ var Qe = class extends e {
|
|
|
4285
4829
|
return this._national ? `+${N(this._country)}${this._national}` : "";
|
|
4286
4830
|
}
|
|
4287
4831
|
set value(e) {
|
|
4288
|
-
let t = String(e ?? "").trim(), n =
|
|
4832
|
+
let t = String(e ?? "").trim(), n = Wt(t);
|
|
4289
4833
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
4290
4834
|
else if (t.startsWith("+")) {
|
|
4291
4835
|
let e = t.replace(/[^0-9]/g, ""), n = String(N(this._country));
|
|
@@ -4294,7 +4838,7 @@ var Qe = class extends e {
|
|
|
4294
4838
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
4295
4839
|
}
|
|
4296
4840
|
_syncMirror() {
|
|
4297
|
-
|
|
4841
|
+
m(this, this.value);
|
|
4298
4842
|
}
|
|
4299
4843
|
_emitInput() {
|
|
4300
4844
|
this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
@@ -4304,27 +4848,27 @@ var Qe = class extends e {
|
|
|
4304
4848
|
}
|
|
4305
4849
|
render() {
|
|
4306
4850
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
|
|
4307
|
-
let e = this.getAttribute("placeholder") ||
|
|
4851
|
+
let e = this.getAttribute("placeholder") || Bt(this._country) || "Enter phone number";
|
|
4308
4852
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
4309
4853
|
let t = `${this.id}-listbox`;
|
|
4310
4854
|
this._listboxId = t;
|
|
4311
|
-
let n =
|
|
4855
|
+
let n = Ce.map(([e, n, r], i) => `<button type="button" role="option" id="${V(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${Pt(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
4312
4856
|
this.innerHTML = `
|
|
4313
4857
|
<div class="phone-input-wrap">
|
|
4314
4858
|
<div class="phone-country-adornment">
|
|
4315
|
-
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
4316
|
-
<span class="${
|
|
4317
|
-
${
|
|
4859
|
+
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${V(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
4860
|
+
<span class="${Pt(this._country)}" data-flag aria-hidden="true"></span>
|
|
4861
|
+
${_("chevron-down", { className: "phone-chevron" })}
|
|
4318
4862
|
<span class="phone-dial" data-dial>+${N(this._country)}</span>
|
|
4319
4863
|
</button>
|
|
4320
|
-
<div class="country-dropdown-menu" role="listbox" id="${
|
|
4321
|
-
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${
|
|
4864
|
+
<div class="country-dropdown-menu" role="listbox" id="${V(t)}" tabindex="-1" hidden>
|
|
4865
|
+
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${_("search")}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${V(t)}" aria-autocomplete="list" /></div>
|
|
4322
4866
|
<div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
|
|
4323
4867
|
</div>
|
|
4324
4868
|
</div>
|
|
4325
|
-
<input type="tel" class="input" placeholder="${
|
|
4869
|
+
<input type="tel" class="input" placeholder="${V(e)}" value="${V(Rt(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${V(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${V(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
4326
4870
|
</div>
|
|
4327
|
-
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0,
|
|
4871
|
+
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, m(this, this.value), this._wire();
|
|
4328
4872
|
}
|
|
4329
4873
|
_itemEls() {
|
|
4330
4874
|
return [...this.querySelectorAll(".country-dropdown-item")];
|
|
@@ -4353,12 +4897,12 @@ var Qe = class extends e {
|
|
|
4353
4897
|
}
|
|
4354
4898
|
a && (a.hidden = n > 0);
|
|
4355
4899
|
}, v = (e) => {
|
|
4356
|
-
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), s && (s.className =
|
|
4900
|
+
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), s && (s.className = Pt(e)), d && (d.textContent = `+${N(e)}`);
|
|
4357
4901
|
for (let t of this._itemEls()) {
|
|
4358
4902
|
let n = t.dataset.iso === e;
|
|
4359
4903
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
4360
4904
|
}
|
|
4361
|
-
!this.getAttribute("placeholder") && o && (o.placeholder =
|
|
4905
|
+
!this.getAttribute("placeholder") && o && (o.placeholder = Bt(e) || "Enter phone number"), o && this._national && (o.value = Rt(e, this._national)), g(), this._syncMirror(), this._emitChange(), o?.focus();
|
|
4362
4906
|
}, y = (t) => {
|
|
4363
4907
|
let n = this._visibleItems();
|
|
4364
4908
|
if (t.key === "ArrowDown") {
|
|
@@ -4392,7 +4936,7 @@ var Qe = class extends e {
|
|
|
4392
4936
|
let b = this.querySelector("[data-phone-error]"), x = (e) => {
|
|
4393
4937
|
if (o.classList.toggle("is-invalid", e), e ? o.setAttribute("aria-invalid", "true") : o.removeAttribute("aria-invalid"), b) {
|
|
4394
4938
|
if (e) {
|
|
4395
|
-
let e =
|
|
4939
|
+
let e = Bt(this._country);
|
|
4396
4940
|
b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
|
|
4397
4941
|
}
|
|
4398
4942
|
b.hidden = !e;
|
|
@@ -4400,24 +4944,24 @@ var Qe = class extends e {
|
|
|
4400
4944
|
};
|
|
4401
4945
|
o.addEventListener("input", (e) => {
|
|
4402
4946
|
e.stopPropagation();
|
|
4403
|
-
let t = o.selectionStart ?? o.value.length, n = o.value.slice(0, t).replace(/[^0-9]/g, "").length, r = o.value.replace(/[^0-9]/g, ""), i =
|
|
4947
|
+
let t = o.selectionStart ?? o.value.length, n = o.value.slice(0, t).replace(/[^0-9]/g, "").length, r = o.value.replace(/[^0-9]/g, ""), i = Ht(this._country);
|
|
4404
4948
|
if (i && r.length > i) {
|
|
4405
|
-
let e =
|
|
4949
|
+
let e = Ut(this._country, r, i);
|
|
4406
4950
|
e ? (n = Math.max(0, n - (r.length - e.length)), r = e) : r = r.slice(0, i);
|
|
4407
4951
|
}
|
|
4408
4952
|
this._national = r;
|
|
4409
|
-
let a =
|
|
4953
|
+
let a = Rt(this._country, this._national);
|
|
4410
4954
|
if (o.value !== a) {
|
|
4411
4955
|
o.value = a;
|
|
4412
|
-
let e =
|
|
4956
|
+
let e = zt(a, Math.min(n, r.length));
|
|
4413
4957
|
o.setSelectionRange(e, e);
|
|
4414
4958
|
}
|
|
4415
|
-
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national ||
|
|
4959
|
+
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national || Vt(this.value) === !0) && x(!1);
|
|
4416
4960
|
}), o.addEventListener("change", (e) => e.stopPropagation()), o.addEventListener("blur", () => {
|
|
4417
|
-
x(this._national.length > 0 &&
|
|
4961
|
+
x(this._national.length > 0 && Vt(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
4418
4962
|
}), o.addEventListener("paste", (e) => {
|
|
4419
|
-
let t =
|
|
4420
|
-
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value =
|
|
4963
|
+
let t = Wt(e.clipboardData?.getData("text"));
|
|
4964
|
+
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value = Rt(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
|
|
4421
4965
|
}), this._bindGlobal = () => {
|
|
4422
4966
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
4423
4967
|
f() && !this.contains(e.target) && g();
|
|
@@ -4426,9 +4970,9 @@ var Qe = class extends e {
|
|
|
4426
4970
|
});
|
|
4427
4971
|
}, this._teardownGlobals = () => {
|
|
4428
4972
|
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), u(this);
|
|
4429
|
-
}, this._bindGlobal(),
|
|
4430
|
-
if (!(!e || !o.isConnected) && (this._national && (o.value =
|
|
4431
|
-
let e =
|
|
4973
|
+
}, this._bindGlobal(), It().then((e) => {
|
|
4974
|
+
if (!(!e || !o.isConnected) && (this._national && (o.value = Rt(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
4975
|
+
let e = Bt(this._country);
|
|
4432
4976
|
e && (o.placeholder = e);
|
|
4433
4977
|
}
|
|
4434
4978
|
}), this._syncMirror();
|
|
@@ -4439,7 +4983,7 @@ var Qe = class extends e {
|
|
|
4439
4983
|
disconnectedCallback() {
|
|
4440
4984
|
this._teardown();
|
|
4441
4985
|
}
|
|
4442
|
-
},
|
|
4986
|
+
}, V = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), Kt = class extends e {
|
|
4443
4987
|
static formAssociated = !0;
|
|
4444
4988
|
static get observedAttributes() {
|
|
4445
4989
|
return [
|
|
@@ -4479,19 +5023,19 @@ var Qe = class extends e {
|
|
|
4479
5023
|
return this._value;
|
|
4480
5024
|
}
|
|
4481
5025
|
set value(e) {
|
|
4482
|
-
this._value = this._snapToStep(this._clamp(
|
|
5026
|
+
this._value = this._snapToStep(this._clamp(H(e, this._value))), this._syncValue(), this._syncMirrors();
|
|
4483
5027
|
}
|
|
4484
5028
|
get start() {
|
|
4485
5029
|
return this._start;
|
|
4486
5030
|
}
|
|
4487
5031
|
set start(e) {
|
|
4488
|
-
this._start = Math.min(this._snapToStep(this._clamp(
|
|
5032
|
+
this._start = Math.min(this._snapToStep(this._clamp(H(e, this._start))), this._end), this._syncValue(), this._syncMirrors();
|
|
4489
5033
|
}
|
|
4490
5034
|
get end() {
|
|
4491
5035
|
return this._end;
|
|
4492
5036
|
}
|
|
4493
5037
|
set end(e) {
|
|
4494
|
-
this._end = Math.max(this._snapToStep(this._clamp(
|
|
5038
|
+
this._end = Math.max(this._snapToStep(this._clamp(H(e, this._end))), this._start), this._syncValue(), this._syncMirrors();
|
|
4495
5039
|
}
|
|
4496
5040
|
attributeChangedCallback(e, t, n) {
|
|
4497
5041
|
if (e === "value" || e === "start" || e === "end" || e === "min" || e === "max" || e === "step") {
|
|
@@ -4504,19 +5048,19 @@ var Qe = class extends e {
|
|
|
4504
5048
|
this._isRange() ? this._resetRange() : this._resetSingle();
|
|
4505
5049
|
}
|
|
4506
5050
|
_updateFromAttribute(e) {
|
|
4507
|
-
e === "value" ? this._value = this._snapToStep(this._clamp(
|
|
5051
|
+
e === "value" ? this._value = this._snapToStep(this._clamp(H(this.getAttribute("value"), this._value))) : e === "start" ? this._start = this._snapToStep(this._clamp(H(this.getAttribute("start"), this._start))) : e === "end" && (this._end = this._snapToStep(this._clamp(H(this.getAttribute("end"), this._end))));
|
|
4508
5052
|
}
|
|
4509
5053
|
_isRange() {
|
|
4510
5054
|
return this.hasAttribute("range");
|
|
4511
5055
|
}
|
|
4512
5056
|
_min() {
|
|
4513
|
-
return
|
|
5057
|
+
return H(this.getAttribute("min"), 0);
|
|
4514
5058
|
}
|
|
4515
5059
|
_max() {
|
|
4516
|
-
return
|
|
5060
|
+
return H(this.getAttribute("max"), 100);
|
|
4517
5061
|
}
|
|
4518
5062
|
_step() {
|
|
4519
|
-
return
|
|
5063
|
+
return H(this.getAttribute("step"), 1);
|
|
4520
5064
|
}
|
|
4521
5065
|
_clamp(e) {
|
|
4522
5066
|
return Math.max(this._min(), Math.min(e, this._max()));
|
|
@@ -4584,7 +5128,7 @@ var Qe = class extends e {
|
|
|
4584
5128
|
aria-valuenow="${this._value}"
|
|
4585
5129
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
4586
5130
|
${a ? "disabled" : ""}
|
|
4587
|
-
aria-label="${
|
|
5131
|
+
aria-label="${qt(this.getAttribute("aria-label") || "Value")}"
|
|
4588
5132
|
></button>
|
|
4589
5133
|
`}
|
|
4590
5134
|
${this.hasAttribute("show-value") ? n ? `<span class="slider-value">${this._formatValue(this._start)} to ${this._formatValue(this._end)}</span>` : `<span class="slider-value">${this._formatValue(this._value)}</span>` : ""}
|
|
@@ -4619,7 +5163,7 @@ var Qe = class extends e {
|
|
|
4619
5163
|
this._isRange() ? this._syncRangeMirrors() : this._syncSingleMirror();
|
|
4620
5164
|
}
|
|
4621
5165
|
_syncSingleMirror() {
|
|
4622
|
-
this.getAttribute("name") &&
|
|
5166
|
+
this.getAttribute("name") && m(this, String(this._value));
|
|
4623
5167
|
}
|
|
4624
5168
|
_syncRangeMirrors() {
|
|
4625
5169
|
let e = this.getAttribute("start-name") || this.getAttribute("name"), t = this.getAttribute("end-name");
|
|
@@ -4686,10 +5230,287 @@ var Qe = class extends e {
|
|
|
4686
5230
|
disconnectedCallback() {
|
|
4687
5231
|
this._teardown();
|
|
4688
5232
|
}
|
|
4689
|
-
},
|
|
5233
|
+
}, H = (e, t) => {
|
|
4690
5234
|
let n = Number.parseFloat(e);
|
|
4691
5235
|
return Number.isFinite(n) ? n : t;
|
|
4692
|
-
},
|
|
5236
|
+
}, qt = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Jt = /* @__PURE__ */ new Set(), Yt = ".wui-sortable-handle", Xt = "a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']", Zt = 4, Qt = 8, $t = 250, U = 48, en = 18, tn = class extends e {
|
|
5237
|
+
static get observedAttributes() {
|
|
5238
|
+
return ["name", "disabled"];
|
|
5239
|
+
}
|
|
5240
|
+
constructor() {
|
|
5241
|
+
super(), this._drag = null, this._kb = null, this._moving = !1, this.controlled = !1, this._observer = null, this._onPointerDown = this._onPointerDown.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onFocusOut = this._onFocusOut.bind(this), this._onDragStart = (e) => e.preventDefault(), this._onDocMove = this._onDocMove.bind(this), this._onDocUp = this._onDocUp.bind(this), this._onDocCancel = this._onDocCancel.bind(this), this._onDocKey = this._onDocKey.bind(this), this._onDocTouchMove = (e) => {
|
|
5242
|
+
this._drag?.started && e.preventDefault();
|
|
5243
|
+
}, this._onSelectStart = (e) => e.preventDefault(), this._scrollTick = this._scrollTick.bind(this);
|
|
5244
|
+
}
|
|
5245
|
+
connectedCallback() {
|
|
5246
|
+
Jt.add(this), this.addEventListener("pointerdown", this._onPointerDown), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("focusout", this._onFocusOut), this.addEventListener("dragstart", this._onDragStart), this._observer = new MutationObserver(() => this._syncMirrors()), this._observer.observe(this, { childList: !0 }), this._syncMirrors();
|
|
5247
|
+
}
|
|
5248
|
+
disconnectedCallback() {
|
|
5249
|
+
Jt.delete(this), this.removeEventListener("pointerdown", this._onPointerDown), this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("focusout", this._onFocusOut), this.removeEventListener("dragstart", this._onDragStart), this._observer?.disconnect(), this._observer = null, this._abort();
|
|
5250
|
+
}
|
|
5251
|
+
attributeChangedCallback(e) {
|
|
5252
|
+
e === "disabled" && this._abort(), this.isConnected && this._syncMirrors();
|
|
5253
|
+
}
|
|
5254
|
+
get order() {
|
|
5255
|
+
return this._items().map((e) => e.getAttribute("data-id"));
|
|
5256
|
+
}
|
|
5257
|
+
set order(e) {
|
|
5258
|
+
if (this._drag?.started || this._kb) return;
|
|
5259
|
+
let t = this._items(), n = new Map(t.map((e) => [e.getAttribute("data-id"), e])), r = [];
|
|
5260
|
+
for (let t of e ?? []) {
|
|
5261
|
+
let e = n.get(String(t));
|
|
5262
|
+
e && !r.includes(e) && r.push(e);
|
|
5263
|
+
}
|
|
5264
|
+
[...r, ...t.filter((e) => !r.includes(e))].forEach((e, t) => {
|
|
5265
|
+
let n = this._items()[t];
|
|
5266
|
+
n !== e && this.insertBefore(e, n);
|
|
5267
|
+
}), this._syncMirrors();
|
|
5268
|
+
}
|
|
5269
|
+
_items() {
|
|
5270
|
+
return [...this.querySelectorAll(":scope > [data-id]")];
|
|
5271
|
+
}
|
|
5272
|
+
_itemFrom(e) {
|
|
5273
|
+
let t = e;
|
|
5274
|
+
for (; t && t.parentElement !== this;) t = t.parentElement;
|
|
5275
|
+
return t?.hasAttribute("data-id") ? t : null;
|
|
5276
|
+
}
|
|
5277
|
+
_itemDisabled(e) {
|
|
5278
|
+
return e.hasAttribute("data-disabled");
|
|
5279
|
+
}
|
|
5280
|
+
_horizontal() {
|
|
5281
|
+
return this.getAttribute("orientation") === "horizontal";
|
|
5282
|
+
}
|
|
5283
|
+
_syncMirrors() {
|
|
5284
|
+
h(this, this.order);
|
|
5285
|
+
}
|
|
5286
|
+
_insertAt(e, t) {
|
|
5287
|
+
let n = this._items();
|
|
5288
|
+
if (n.indexOf(e) === t) return;
|
|
5289
|
+
let r = n.filter((t) => t !== e), i = r[t] ?? null;
|
|
5290
|
+
i ? this.insertBefore(e, i) : r.length > 0 ? r[r.length - 1].after(e) : this.appendChild(e);
|
|
5291
|
+
}
|
|
5292
|
+
_indexFor(e, t, n) {
|
|
5293
|
+
let r = this._items().filter((t) => t !== e), i = this._horizontal();
|
|
5294
|
+
for (let e = 0; e < r.length; e++) {
|
|
5295
|
+
let a = r[e].getBoundingClientRect();
|
|
5296
|
+
if (i ? n < a.top || n <= a.bottom && t < a.left + a.width / 2 : n < a.top + a.height / 2) return e;
|
|
5297
|
+
}
|
|
5298
|
+
return r.length;
|
|
5299
|
+
}
|
|
5300
|
+
_peers() {
|
|
5301
|
+
let e = this.getAttribute("group");
|
|
5302
|
+
return [...Jt].filter((t) => t === this || e && t.getAttribute("group") === e && !t.hasAttribute("disabled"));
|
|
5303
|
+
}
|
|
5304
|
+
_labelOf(e) {
|
|
5305
|
+
return e.getAttribute("data-label") || e.textContent.replace(/\s+/g, " ").trim() || e.getAttribute("data-id");
|
|
5306
|
+
}
|
|
5307
|
+
_announce(e) {
|
|
5308
|
+
let t = this.querySelector(":scope > .wui-sortable-live");
|
|
5309
|
+
t || (t = document.createElement("div"), t.className = "wui-sortable-live", t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "true"), this.appendChild(t)), t.textContent = e;
|
|
5310
|
+
}
|
|
5311
|
+
_position(e) {
|
|
5312
|
+
let t = this._items();
|
|
5313
|
+
return `position ${t.indexOf(e) + 1} of ${t.length}`;
|
|
5314
|
+
}
|
|
5315
|
+
_onPointerDown(e) {
|
|
5316
|
+
if (this._drag || this._kb || this.hasAttribute("disabled") || e.pointerType === "mouse" && e.button !== 0) return;
|
|
5317
|
+
let t = this._itemFrom(e.target);
|
|
5318
|
+
if (!t || this._itemDisabled(t)) return;
|
|
5319
|
+
let n = t.querySelector(`:scope > ${Yt}`), r = !!n && n.contains(e.target);
|
|
5320
|
+
if (this.hasAttribute("handle") && !r) return;
|
|
5321
|
+
if (!r) {
|
|
5322
|
+
let n = e.target.closest?.(Xt);
|
|
5323
|
+
if (n && n !== t && t.contains(n)) return;
|
|
5324
|
+
}
|
|
5325
|
+
let i = e.pointerType === "touch" && !r, a = {
|
|
5326
|
+
item: t,
|
|
5327
|
+
pointerId: e.pointerId,
|
|
5328
|
+
startX: e.clientX,
|
|
5329
|
+
startY: e.clientY,
|
|
5330
|
+
x: e.clientX,
|
|
5331
|
+
y: e.clientY,
|
|
5332
|
+
slop: e.pointerType === "touch" ? Qt : Zt,
|
|
5333
|
+
ready: !i,
|
|
5334
|
+
started: !1,
|
|
5335
|
+
timer: null,
|
|
5336
|
+
raf: 0,
|
|
5337
|
+
list: this,
|
|
5338
|
+
ghost: null
|
|
5339
|
+
};
|
|
5340
|
+
this._drag = a, i && (a.timer = setTimeout(() => {
|
|
5341
|
+
a.timer = null, a.ready = !0, this._begin();
|
|
5342
|
+
}, $t)), document.addEventListener("pointermove", this._onDocMove), document.addEventListener("pointerup", this._onDocUp), document.addEventListener("pointercancel", this._onDocCancel), document.addEventListener("keydown", this._onDocKey, !0), document.addEventListener("touchmove", this._onDocTouchMove, { passive: !1 });
|
|
5343
|
+
}
|
|
5344
|
+
_onDocMove(e) {
|
|
5345
|
+
let t = this._drag;
|
|
5346
|
+
if (!(!t || e.pointerId !== t.pointerId)) {
|
|
5347
|
+
if (t.x = e.clientX, t.y = e.clientY, !t.started) {
|
|
5348
|
+
let e = Math.hypot(t.x - t.startX, t.y - t.startY);
|
|
5349
|
+
if (!t.ready) {
|
|
5350
|
+
e > t.slop && this._finish(!0);
|
|
5351
|
+
return;
|
|
5352
|
+
}
|
|
5353
|
+
if (e < t.slop || (this._begin(), !this._drag?.started)) return;
|
|
5354
|
+
}
|
|
5355
|
+
e.preventDefault?.(), this._moveGhost(), this._update();
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
_onDocUp(e) {
|
|
5359
|
+
this._drag && e.pointerId === this._drag.pointerId && this._finish(!1);
|
|
5360
|
+
}
|
|
5361
|
+
_onDocCancel(e) {
|
|
5362
|
+
this._drag && e.pointerId === this._drag.pointerId && this._finish(!0);
|
|
5363
|
+
}
|
|
5364
|
+
_onDocKey(e) {
|
|
5365
|
+
e.key !== "Escape" || !this._drag || (e.preventDefault(), e.stopPropagation(), this._finish(!0));
|
|
5366
|
+
}
|
|
5367
|
+
_begin() {
|
|
5368
|
+
let e = this._drag;
|
|
5369
|
+
if (!e || e.started) return;
|
|
5370
|
+
e.started = !0;
|
|
5371
|
+
let t = e.item.getBoundingClientRect();
|
|
5372
|
+
e.offsetX = e.startX - t.left, e.offsetY = e.startY - t.top, e.fromIndex = this._items().indexOf(e.item);
|
|
5373
|
+
let n = e.item.cloneNode(!0);
|
|
5374
|
+
for (let e of [n, ...n.querySelectorAll("[id],[data-id]")]) e.removeAttribute("id"), e.removeAttribute("data-id");
|
|
5375
|
+
n.classList.add("wui-sortable-ghost"), n.setAttribute("aria-hidden", "true"), n.inert = !0, n.style.width = `${t.width}px`, n.style.height = `${t.height}px`, e.ghost = n, e.item.classList.add("wui-sortable-dragging"), document.body.appendChild(n), document.documentElement.classList.add("wui-sortable-active"), document.addEventListener("selectstart", this._onSelectStart), this._moveGhost(), e.raf = requestAnimationFrame(this._scrollTick), this._emit(this, "wui-sortable:start", { id: e.item.getAttribute("data-id") });
|
|
5376
|
+
}
|
|
5377
|
+
_moveGhost() {
|
|
5378
|
+
let e = this._drag;
|
|
5379
|
+
e?.ghost && (e.ghost.style.transform = `translate(${e.x - e.offsetX}px, ${e.y - e.offsetY}px)`);
|
|
5380
|
+
}
|
|
5381
|
+
_update() {
|
|
5382
|
+
let e = this._drag;
|
|
5383
|
+
if (!e?.started) return;
|
|
5384
|
+
let t = e.list;
|
|
5385
|
+
for (let n of this._peers()) {
|
|
5386
|
+
let r = n.getBoundingClientRect();
|
|
5387
|
+
if (e.x >= r.left && e.x <= r.right && e.y >= r.top && e.y <= r.bottom) {
|
|
5388
|
+
t = n;
|
|
5389
|
+
break;
|
|
5390
|
+
}
|
|
5391
|
+
}
|
|
5392
|
+
let n = t._indexFor(e.item, e.x, e.y);
|
|
5393
|
+
(t !== e.list || n !== t._items().indexOf(e.item)) && t._insertAt(e.item, n), e.list = t;
|
|
5394
|
+
}
|
|
5395
|
+
_scrollTick() {
|
|
5396
|
+
let e = this._drag;
|
|
5397
|
+
if (!e?.started) return;
|
|
5398
|
+
let t = rn(e.list), n = t ? t.getBoundingClientRect() : null, r = Math.max(n?.top ?? 0, 0), i = Math.min(n?.bottom ?? window.innerHeight, window.innerHeight), a = Math.max(n?.left ?? 0, 0), o = Math.min(n?.right ?? window.innerWidth, window.innerWidth), s = nn(e.y, r, i), c = nn(e.x, a, o);
|
|
5399
|
+
(c || s) && (t ? (t.scrollTop += s, t.scrollLeft += c) : window.scrollBy(c, s), this._update()), e.raf = requestAnimationFrame(this._scrollTick);
|
|
5400
|
+
}
|
|
5401
|
+
_finish(e) {
|
|
5402
|
+
let t = this._drag;
|
|
5403
|
+
if (!t || (this._drag = null, clearTimeout(t.timer), cancelAnimationFrame(t.raf), document.removeEventListener("pointermove", this._onDocMove), document.removeEventListener("pointerup", this._onDocUp), document.removeEventListener("pointercancel", this._onDocCancel), document.removeEventListener("keydown", this._onDocKey, !0), document.removeEventListener("touchmove", this._onDocTouchMove), document.removeEventListener("selectstart", this._onSelectStart), !t.started)) return;
|
|
5404
|
+
t.ghost?.remove(), document.documentElement.classList.remove("wui-sortable-active"), t.item.classList.remove("wui-sortable-dragging");
|
|
5405
|
+
let n = t.item.getAttribute("data-id");
|
|
5406
|
+
e ? (this._insertAt(t.item, t.fromIndex), this._syncMirrors(), t.list !== this && t.list._syncMirrors()) : this._settle(t.item, this, t.fromIndex, t.list), this._emit(this, "wui-sortable:end", {
|
|
5407
|
+
id: n,
|
|
5408
|
+
cancelled: e
|
|
5409
|
+
});
|
|
5410
|
+
}
|
|
5411
|
+
_settle(e, t, n, r) {
|
|
5412
|
+
let i = r._items().indexOf(e);
|
|
5413
|
+
if (r === t && i === n) return;
|
|
5414
|
+
let a = e.getAttribute("data-id"), o = r.order, s = r !== t, c = t.order;
|
|
5415
|
+
s && (t.controlled || r.controlled) && t._insertAt(e, n), t._syncMirrors(), r._syncMirrors();
|
|
5416
|
+
let l = r._labelOf(e), u = s && r.getAttribute("aria-label") ? ` to ${r.getAttribute("aria-label")}` : "", d = {
|
|
5417
|
+
id: a,
|
|
5418
|
+
fromIndex: n,
|
|
5419
|
+
toIndex: i,
|
|
5420
|
+
from: t,
|
|
5421
|
+
to: r
|
|
5422
|
+
};
|
|
5423
|
+
s && this._emit(t, "wui-sortable:change", {
|
|
5424
|
+
...d,
|
|
5425
|
+
ids: c
|
|
5426
|
+
}), this._emit(r, "wui-sortable:change", {
|
|
5427
|
+
...d,
|
|
5428
|
+
ids: o
|
|
5429
|
+
}), r._announce(`${l} moved${u}, position ${i + 1} of ${o.length}.`);
|
|
5430
|
+
}
|
|
5431
|
+
_emit(e, t, n) {
|
|
5432
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
5433
|
+
bubbles: !0,
|
|
5434
|
+
detail: n
|
|
5435
|
+
}));
|
|
5436
|
+
}
|
|
5437
|
+
_abort() {
|
|
5438
|
+
this._drag && this._finish(!0), this._kb && this._dropKeyboard(!0);
|
|
5439
|
+
}
|
|
5440
|
+
_onKeyDown(e) {
|
|
5441
|
+
if (this.hasAttribute("disabled")) return;
|
|
5442
|
+
let t = e.target.closest?.(Yt), n = t && t.parentElement?.parentElement === this ? t.parentElement : null;
|
|
5443
|
+
if (!n || this._itemDisabled(n) || this._drag) return;
|
|
5444
|
+
let r = e.key;
|
|
5445
|
+
if (!this._kb) {
|
|
5446
|
+
if (r !== " " && r !== "Enter") return;
|
|
5447
|
+
e.preventDefault(), this._liftKeyboard(n, t);
|
|
5448
|
+
return;
|
|
5449
|
+
}
|
|
5450
|
+
if (this._kb.item === n) {
|
|
5451
|
+
if (r === " " || r === "Enter") e.preventDefault(), this._dropKeyboard(!1);
|
|
5452
|
+
else if (r === "Escape") e.preventDefault(), e.stopPropagation(), this._dropKeyboard(!0);
|
|
5453
|
+
else if ([
|
|
5454
|
+
"ArrowUp",
|
|
5455
|
+
"ArrowLeft",
|
|
5456
|
+
"ArrowDown",
|
|
5457
|
+
"ArrowRight",
|
|
5458
|
+
"Home",
|
|
5459
|
+
"End"
|
|
5460
|
+
].includes(r)) {
|
|
5461
|
+
e.preventDefault();
|
|
5462
|
+
let i = this._items(), a = i.indexOf(n), o = i.length - 1, s = r === "Home" ? 0 : r === "End" ? o : Math.max(0, Math.min(o, a + (r === "ArrowUp" || r === "ArrowLeft" ? -1 : 1)));
|
|
5463
|
+
if (s === a) {
|
|
5464
|
+
this._announce(`${this._labelOf(n)} is already ${a === 0 ? "first" : "last"}, ${this._position(n)}.`);
|
|
5465
|
+
return;
|
|
5466
|
+
}
|
|
5467
|
+
this._moveFocused(() => this._insertAt(n, s), t), this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`);
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5471
|
+
_onFocusOut(e) {
|
|
5472
|
+
!this._kb || this._moving || e.relatedTarget && this._kb.handle.contains(e.relatedTarget) || this._dropKeyboard(!1);
|
|
5473
|
+
}
|
|
5474
|
+
_liftKeyboard(e, t) {
|
|
5475
|
+
this._kb = {
|
|
5476
|
+
item: e,
|
|
5477
|
+
handle: t,
|
|
5478
|
+
fromIndex: this._items().indexOf(e)
|
|
5479
|
+
}, t.setAttribute("aria-pressed", "true"), this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`);
|
|
5480
|
+
}
|
|
5481
|
+
_dropKeyboard(e) {
|
|
5482
|
+
let t = this._kb;
|
|
5483
|
+
if (t) {
|
|
5484
|
+
if (this._kb = null, t.handle.removeAttribute("aria-pressed"), e) {
|
|
5485
|
+
this._moveFocused(() => this._insertAt(t.item, t.fromIndex), t.handle), this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`);
|
|
5486
|
+
return;
|
|
5487
|
+
}
|
|
5488
|
+
if (this._items().indexOf(t.item) === t.fromIndex) {
|
|
5489
|
+
this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`);
|
|
5490
|
+
return;
|
|
5491
|
+
}
|
|
5492
|
+
this._settle(t.item, this, t.fromIndex, this);
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
_moveFocused(e, t) {
|
|
5496
|
+
this._moving = !0;
|
|
5497
|
+
let n = this.contains(document.activeElement);
|
|
5498
|
+
e(), n && document.activeElement !== t && t.focus(), this._moving = !1;
|
|
5499
|
+
}
|
|
5500
|
+
};
|
|
5501
|
+
function nn(e, t, n) {
|
|
5502
|
+
return e < t + U ? -Math.ceil(en * Math.min(1, (t + U - e) / U)) : e > n - U ? Math.ceil(en * Math.min(1, (e - (n - U)) / U)) : 0;
|
|
5503
|
+
}
|
|
5504
|
+
function rn(e) {
|
|
5505
|
+
for (let t = e.parentElement; t && t !== document.body && t !== document.documentElement; t = t.parentElement) {
|
|
5506
|
+
let e = getComputedStyle(t), n = /(auto|scroll)/.test(e.overflowY) && t.scrollHeight > t.clientHeight, r = /(auto|scroll)/.test(e.overflowX) && t.scrollWidth > t.clientWidth;
|
|
5507
|
+
if (n || r) return t;
|
|
5508
|
+
}
|
|
5509
|
+
return null;
|
|
5510
|
+
}
|
|
5511
|
+
//#endregion
|
|
5512
|
+
//#region src/WuiTagInput.js
|
|
5513
|
+
var an = class extends e {
|
|
4693
5514
|
static formAssociated = !0;
|
|
4694
5515
|
_accessibleName() {
|
|
4695
5516
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -4755,30 +5576,30 @@ var Qe = class extends e {
|
|
|
4755
5576
|
return this._values.slice();
|
|
4756
5577
|
}
|
|
4757
5578
|
set values(e) {
|
|
4758
|
-
this._values = Array.isArray(e) ? e.map(String) : [],
|
|
5579
|
+
this._values = Array.isArray(e) ? e.map(String) : [], h(this, this._values), this._rendered && this._renderControl();
|
|
4759
5580
|
}
|
|
4760
5581
|
render() {
|
|
4761
5582
|
let e = this.getAttribute("size"), t = e === "sm" ? " search-select-sm" : e === "lg" ? " search-select-lg" : "";
|
|
4762
|
-
|
|
5583
|
+
h(this, this._values), this.innerHTML = `
|
|
4763
5584
|
<div class="search-select${t}">
|
|
4764
5585
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
4765
|
-
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input aria-label="${
|
|
5586
|
+
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input aria-label="${sn(this._accessibleName())}" placeholder="${sn(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/></div>
|
|
4766
5587
|
</div>
|
|
4767
|
-
</div>`, this._rendered = !0,
|
|
5588
|
+
</div>`, this._rendered = !0, h(this, this._values), this._renderControl(), this._wire();
|
|
4768
5589
|
}
|
|
4769
5590
|
_renderControl() {
|
|
4770
5591
|
let e = this.querySelector("[data-chips]");
|
|
4771
5592
|
if (e) {
|
|
4772
5593
|
for (let t of e.querySelectorAll(":scope > .chip")) t.remove();
|
|
4773
|
-
this._values.length && e.querySelector("[data-input]").insertAdjacentHTML("beforebegin", this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
5594
|
+
this._values.length && e.querySelector("[data-input]").insertAdjacentHTML("beforebegin", this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${on(e)}</span><button type="button" class="chip-remove" data-remove="${sn(e)}" aria-label="Remove ${sn(e)}">${_("x")}</button></span>`).join(""));
|
|
4774
5595
|
}
|
|
4775
5596
|
}
|
|
4776
5597
|
_wire() {
|
|
4777
5598
|
this._teardown();
|
|
4778
5599
|
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
4779
5600
|
if (!e || !t) return;
|
|
4780
|
-
let n = () => this.hasAttribute("disabled"), r = (this.getAttribute("separators") || "enter,comma").split(",").map((e) => e.trim()), i = this.getAttribute("max-tags"), a = this.hasAttribute("allow-duplicates"), o = new Set(r.map(
|
|
4781
|
-
|
|
5601
|
+
let n = () => this.hasAttribute("disabled"), r = (this.getAttribute("separators") || "enter,comma").split(",").map((e) => e.trim()), i = this.getAttribute("max-tags"), a = this.hasAttribute("allow-duplicates"), o = new Set(r.map(dt).filter(Boolean)), s = () => {
|
|
5602
|
+
h(this, this._values), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
4782
5603
|
}, c = (e) => {
|
|
4783
5604
|
let t = e.trim();
|
|
4784
5605
|
if (!t || i && this._values.length >= parseInt(i, 10)) return;
|
|
@@ -4809,9 +5630,9 @@ var Qe = class extends e {
|
|
|
4809
5630
|
e.preventDefault();
|
|
4810
5631
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
4811
5632
|
for (let e of r) {
|
|
4812
|
-
let t =
|
|
4813
|
-
if (
|
|
4814
|
-
a.push(...
|
|
5633
|
+
let t = ft(e) ?? e;
|
|
5634
|
+
if (mt(n, [t])) {
|
|
5635
|
+
a.push(...pt(n, [t]));
|
|
4815
5636
|
break;
|
|
4816
5637
|
}
|
|
4817
5638
|
}
|
|
@@ -4839,18 +5660,18 @@ var Qe = class extends e {
|
|
|
4839
5660
|
disconnectedCallback() {
|
|
4840
5661
|
this._teardown();
|
|
4841
5662
|
}
|
|
4842
|
-
},
|
|
5663
|
+
}, on = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), sn = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), cn = (e) => String(e).padStart(2, "0"), ln = (e, t) => `${cn(e)}:${cn(t)}`, un = (e) => {
|
|
4843
5664
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
4844
5665
|
return t ? {
|
|
4845
5666
|
h: +t[1],
|
|
4846
5667
|
m: +t[2]
|
|
4847
5668
|
} : null;
|
|
4848
|
-
},
|
|
5669
|
+
}, dn = (e, t = "24") => {
|
|
4849
5670
|
if (!e) return "";
|
|
4850
|
-
if (t === "24") return
|
|
5671
|
+
if (t === "24") return ln(e.h, e.m);
|
|
4851
5672
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
4852
|
-
return `${n}:${
|
|
4853
|
-
},
|
|
5673
|
+
return `${n}:${cn(e.m)} ${r}`;
|
|
5674
|
+
}, fn = class extends e {
|
|
4854
5675
|
static formAssociated = !0;
|
|
4855
5676
|
static get observedAttributes() {
|
|
4856
5677
|
return [
|
|
@@ -4902,34 +5723,34 @@ var Qe = class extends e {
|
|
|
4902
5723
|
return this._value;
|
|
4903
5724
|
}
|
|
4904
5725
|
set value(e) {
|
|
4905
|
-
this._value = e || "",
|
|
5726
|
+
this._value = e || "", m(this, this._value), this._syncTrigger();
|
|
4906
5727
|
}
|
|
4907
5728
|
render() {
|
|
4908
5729
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
4909
|
-
let e = this.getAttribute("placeholder") || "Select time", t =
|
|
5730
|
+
let e = this.getAttribute("placeholder") || "Select time", t = un(this._value), n = this.getAttribute("format") || "24", r = this.getAttribute("size"), i = r === "sm" ? " input-sm" : r === "lg" ? " input-lg" : "", a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
|
|
4910
5731
|
this.innerHTML = `
|
|
4911
5732
|
<div class="timepicker">
|
|
4912
|
-
<button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${
|
|
4913
|
-
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ?
|
|
4914
|
-
${
|
|
5733
|
+
<button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${b(a)}"` : ""}${o ? ` aria-describedby="${b(o)}"` : ""}>
|
|
5734
|
+
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? dn(t, n) : b(e)}</span>
|
|
5735
|
+
${_("clock")}
|
|
4915
5736
|
</button>
|
|
4916
5737
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
4917
|
-
</div>`, this._rendered = !0,
|
|
5738
|
+
</div>`, this._rendered = !0, m(this, this._value), this._wire();
|
|
4918
5739
|
}
|
|
4919
5740
|
_syncFormValue() {
|
|
4920
|
-
|
|
5741
|
+
m(this, this._value);
|
|
4921
5742
|
}
|
|
4922
5743
|
_syncTrigger() {
|
|
4923
5744
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
4924
5745
|
if (!t) return;
|
|
4925
|
-
let n =
|
|
4926
|
-
t.textContent = n ?
|
|
5746
|
+
let n = un(this._value), r = this.getAttribute("format") || "24";
|
|
5747
|
+
t.textContent = n ? dn(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
4927
5748
|
}
|
|
4928
5749
|
_buildTimes() {
|
|
4929
|
-
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r =
|
|
5750
|
+
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r = un(t) || {
|
|
4930
5751
|
h: 0,
|
|
4931
5752
|
m: 0
|
|
4932
|
-
}, i =
|
|
5753
|
+
}, i = un(n) || {
|
|
4933
5754
|
h: 23,
|
|
4934
5755
|
m: 59
|
|
4935
5756
|
}, a = [], o = r.h, s = r.m;
|
|
@@ -4942,10 +5763,10 @@ var Qe = class extends e {
|
|
|
4942
5763
|
_renderOptions() {
|
|
4943
5764
|
let e = this.querySelector(".timepicker-pop");
|
|
4944
5765
|
if (!e) return;
|
|
4945
|
-
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r =
|
|
5766
|
+
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = un(this._value), i = this._focus, a = "";
|
|
4946
5767
|
for (let e = 0; e < n.length; e++) {
|
|
4947
|
-
let o = n[e], s =
|
|
4948
|
-
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${
|
|
5768
|
+
let o = n[e], s = ln(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
5769
|
+
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${dn(o, t)}</button>`;
|
|
4949
5770
|
}
|
|
4950
5771
|
e.innerHTML = a, this._focusActive();
|
|
4951
5772
|
}
|
|
@@ -5043,7 +5864,498 @@ var Qe = class extends e {
|
|
|
5043
5864
|
disconnectedCallback() {
|
|
5044
5865
|
this._teardown();
|
|
5045
5866
|
}
|
|
5046
|
-
},
|
|
5867
|
+
}, pn = "wui-csrf", mn = "RequestVerificationToken", W = Object.freeze({
|
|
5868
|
+
fragment: "X-Wui-Fragment",
|
|
5869
|
+
message: "X-Wui-Message",
|
|
5870
|
+
redirect: "X-Wui-Redirect",
|
|
5871
|
+
result: "X-Wui-Result",
|
|
5872
|
+
keepOpen: "X-Wui-Keep-Open"
|
|
5873
|
+
}), hn = Object.freeze([
|
|
5874
|
+
"ok",
|
|
5875
|
+
"validation",
|
|
5876
|
+
"forbidden",
|
|
5877
|
+
"client",
|
|
5878
|
+
"server",
|
|
5879
|
+
"network",
|
|
5880
|
+
"aborted",
|
|
5881
|
+
"stale",
|
|
5882
|
+
"session"
|
|
5883
|
+
]), gn = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
5884
|
+
function _n(e = document) {
|
|
5885
|
+
let t = e.querySelector(`meta[name="${pn}"]`), n = t?.getAttribute("content");
|
|
5886
|
+
return n ? {
|
|
5887
|
+
header: t.getAttribute("data-header") || "RequestVerificationToken",
|
|
5888
|
+
token: n
|
|
5889
|
+
} : null;
|
|
5890
|
+
}
|
|
5891
|
+
var vn = (e) => {
|
|
5892
|
+
try {
|
|
5893
|
+
return new URL(e, window.location.href).origin === window.location.origin;
|
|
5894
|
+
} catch {
|
|
5895
|
+
return !1;
|
|
5896
|
+
}
|
|
5897
|
+
};
|
|
5898
|
+
function yn(e) {
|
|
5899
|
+
return e >= 200 && e < 300 ? "ok" : e === 401 ? "session" : e === 403 ? "forbidden" : e === 422 ? "validation" : e >= 400 && e < 500 ? "client" : "server";
|
|
5900
|
+
}
|
|
5901
|
+
var bn = (e) => e?.name === "AbortError";
|
|
5902
|
+
async function xn(e, t = {}) {
|
|
5903
|
+
let n = (t.method || "GET").toUpperCase(), r = t.navigate || ((e) => window.location.assign(e)), i = {
|
|
5904
|
+
Accept: "text/html",
|
|
5905
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
5906
|
+
...t.headers
|
|
5907
|
+
};
|
|
5908
|
+
if (!gn.has(n) && vn(e)) {
|
|
5909
|
+
let e = _n();
|
|
5910
|
+
e && (i[e.header] = e.token);
|
|
5911
|
+
}
|
|
5912
|
+
let a = (e, t = null, n = "") => {
|
|
5913
|
+
let r = (e) => t?.headers.get(e) ?? null;
|
|
5914
|
+
return {
|
|
5915
|
+
kind: e,
|
|
5916
|
+
ok: e === "ok",
|
|
5917
|
+
status: t?.status ?? 0,
|
|
5918
|
+
html: n,
|
|
5919
|
+
response: t,
|
|
5920
|
+
message: r(W.message),
|
|
5921
|
+
redirect: r(W.redirect),
|
|
5922
|
+
result: r(W.result),
|
|
5923
|
+
keepOpen: r(W.keepOpen) === "1",
|
|
5924
|
+
fragment: r(W.fragment) === "1"
|
|
5925
|
+
};
|
|
5926
|
+
}, o;
|
|
5927
|
+
try {
|
|
5928
|
+
o = await fetch(e, {
|
|
5929
|
+
method: n,
|
|
5930
|
+
body: t.body,
|
|
5931
|
+
headers: i,
|
|
5932
|
+
signal: t.signal,
|
|
5933
|
+
credentials: "same-origin"
|
|
5934
|
+
});
|
|
5935
|
+
} catch (e) {
|
|
5936
|
+
return a(bn(e) || t.signal?.aborted ? "aborted" : "network");
|
|
5937
|
+
}
|
|
5938
|
+
let s = yn(o.status);
|
|
5939
|
+
if (s === "ok" && o.redirected && o.headers.get(W.fragment) !== "1" && (s = "session"), s === "session") return r(o.status === 401 ? o.headers.get("Location") || window.location.href : o.url), a(s, o);
|
|
5940
|
+
let c = "";
|
|
5941
|
+
if (s === "ok" || s === "validation") try {
|
|
5942
|
+
c = await o.text();
|
|
5943
|
+
} catch (e) {
|
|
5944
|
+
return a(bn(e) || t.signal?.aborted ? "aborted" : "network", o);
|
|
5945
|
+
}
|
|
5946
|
+
return a(s, o, c);
|
|
5947
|
+
}
|
|
5948
|
+
function Sn() {
|
|
5949
|
+
let e = null, t = 0;
|
|
5950
|
+
return {
|
|
5951
|
+
async run(n, r = {}) {
|
|
5952
|
+
e?.abort();
|
|
5953
|
+
let i = new AbortController();
|
|
5954
|
+
e = i;
|
|
5955
|
+
let a = ++t, o = r.signal;
|
|
5956
|
+
o && (o.aborted ? i.abort() : o.addEventListener("abort", () => i.abort(), { once: !0 }));
|
|
5957
|
+
let s = await xn(n, {
|
|
5958
|
+
...r,
|
|
5959
|
+
signal: i.signal
|
|
5960
|
+
});
|
|
5961
|
+
return e === i && (e = null), a !== t && s.kind !== "aborted" ? {
|
|
5962
|
+
...s,
|
|
5963
|
+
kind: "stale",
|
|
5964
|
+
ok: !1
|
|
5965
|
+
} : s;
|
|
5966
|
+
},
|
|
5967
|
+
abort() {
|
|
5968
|
+
e?.abort(), e = null;
|
|
5969
|
+
}
|
|
5970
|
+
};
|
|
5971
|
+
}
|
|
5972
|
+
//#endregion
|
|
5973
|
+
//#region src/WuiTree.js
|
|
5974
|
+
var Cn = [
|
|
5975
|
+
"none",
|
|
5976
|
+
"single",
|
|
5977
|
+
"multiple"
|
|
5978
|
+
], wn = "parentId", Tn = "Loading", En = "Could not load. Try again.", Dn = ":scope > input[data-wui-mirror]", On = [
|
|
5979
|
+
"nodes",
|
|
5980
|
+
"selection",
|
|
5981
|
+
"selected",
|
|
5982
|
+
"values",
|
|
5983
|
+
"loadChildren",
|
|
5984
|
+
"loadUrl",
|
|
5985
|
+
"name"
|
|
5986
|
+
], kn = 0;
|
|
5987
|
+
function G(e, t, n) {
|
|
5988
|
+
let r = document.createElement(e);
|
|
5989
|
+
t && (r.className = t);
|
|
5990
|
+
for (let [e, t] of Object.entries(n ?? {})) t != null && r.setAttribute(e, String(t));
|
|
5991
|
+
return r;
|
|
5992
|
+
}
|
|
5993
|
+
var An = class extends e {
|
|
5994
|
+
static get observedAttributes() {
|
|
5995
|
+
return [
|
|
5996
|
+
"selection",
|
|
5997
|
+
"selected",
|
|
5998
|
+
"name",
|
|
5999
|
+
"aria-label",
|
|
6000
|
+
"loading-text",
|
|
6001
|
+
"error-text"
|
|
6002
|
+
];
|
|
6003
|
+
}
|
|
6004
|
+
constructor() {
|
|
6005
|
+
super(), this._uid = `wui-tree-${++kn}`, this._seq = 0, this._roots = [], this._byId = /* @__PURE__ */ new Map(), this._prev = null, this._staged = null, this._els = /* @__PURE__ */ new Map(), this._checked = /* @__PURE__ */ new Set(), this._selected = null, this._focusId = null, this._loader = null, this._list = null, this._live = null, this._ready = !1, this._nav = v({
|
|
6006
|
+
getVisibleOptions: () => this._visible().map((e) => this._els.get(e.id)?.row),
|
|
6007
|
+
getActive: () => this._visible().findIndex((e) => e.id === this._focusId),
|
|
6008
|
+
setActive: (e) => this._focusNode(this._visible()[e]),
|
|
6009
|
+
onEnter: () => {
|
|
6010
|
+
let e = this._byId.get(this._focusId);
|
|
6011
|
+
e && this._activate(e);
|
|
6012
|
+
}
|
|
6013
|
+
}), this._onKeyDown = (e) => this._handleKeyDown(e), this._onClick = (e) => this._handleClick(e), this._onFocusIn = (e) => {
|
|
6014
|
+
let t = this._nodeFrom(e.target);
|
|
6015
|
+
t && t.id !== this._focusId && this._setRoving(t);
|
|
6016
|
+
};
|
|
6017
|
+
}
|
|
6018
|
+
connectedCallback() {
|
|
6019
|
+
let e = {};
|
|
6020
|
+
for (let t of On) Object.hasOwn(this, t) && (e[t] = this[t], delete this[t]);
|
|
6021
|
+
if (!this._ready) {
|
|
6022
|
+
this._ready = !0;
|
|
6023
|
+
let e = this._readScript();
|
|
6024
|
+
this.replaceChildren(), this._list = G("ul", "wui-tree"), this._list.setAttribute("role", "tree"), this._live = G("div", "visually-hidden", {
|
|
6025
|
+
role: "status",
|
|
6026
|
+
"aria-live": "polite"
|
|
6027
|
+
}), this.append(this._list, this._live), e && this._adoptAll(e);
|
|
6028
|
+
}
|
|
6029
|
+
for (let [t, n] of Object.entries(e)) this[t] = n;
|
|
6030
|
+
this.addEventListener("keydown", this._onKeyDown), this.addEventListener("click", this._onClick), this.addEventListener("focusin", this._onFocusIn), this._render(), this._loadOpenNodes();
|
|
6031
|
+
}
|
|
6032
|
+
disconnectedCallback() {
|
|
6033
|
+
this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("click", this._onClick), this.removeEventListener("focusin", this._onFocusIn), this._nav.teardown();
|
|
6034
|
+
}
|
|
6035
|
+
attributeChangedCallback(e, t, n) {
|
|
6036
|
+
e === "selected" && (this._selected = n), this._ready && this.isConnected && this._render();
|
|
6037
|
+
}
|
|
6038
|
+
get nodes() {
|
|
6039
|
+
return this._roots.map((e) => e.raw);
|
|
6040
|
+
}
|
|
6041
|
+
set nodes(e) {
|
|
6042
|
+
this._adoptAll(e ?? []), this._render(), this._loadOpenNodes();
|
|
6043
|
+
}
|
|
6044
|
+
get selection() {
|
|
6045
|
+
let e = this.getAttribute("selection");
|
|
6046
|
+
return Cn.includes(e) ? e : "none";
|
|
6047
|
+
}
|
|
6048
|
+
set selection(e) {
|
|
6049
|
+
this.setAttribute("selection", String(e));
|
|
6050
|
+
}
|
|
6051
|
+
get selected() {
|
|
6052
|
+
return this._selected;
|
|
6053
|
+
}
|
|
6054
|
+
set selected(e) {
|
|
6055
|
+
this._selected = e == null ? null : String(e), this._render();
|
|
6056
|
+
}
|
|
6057
|
+
get values() {
|
|
6058
|
+
let e = [], t = (n) => {
|
|
6059
|
+
for (let r of n) this._state(r) === "checked" && e.push(r.id), r.children && t(r.children);
|
|
6060
|
+
};
|
|
6061
|
+
return t(this._roots), [...e, ...[...this._checked].filter((e) => !this._byId.has(e))];
|
|
6062
|
+
}
|
|
6063
|
+
set values(e) {
|
|
6064
|
+
this._checked.clear();
|
|
6065
|
+
for (let t of e ?? []) {
|
|
6066
|
+
let e = this._byId.get(String(t));
|
|
6067
|
+
e ? this._setChecked(e, !0) : this._checked.add(String(t));
|
|
6068
|
+
}
|
|
6069
|
+
this._render();
|
|
6070
|
+
}
|
|
6071
|
+
get loadChildren() {
|
|
6072
|
+
return this._loader;
|
|
6073
|
+
}
|
|
6074
|
+
set loadChildren(e) {
|
|
6075
|
+
this._loader = typeof e == "function" ? e : null;
|
|
6076
|
+
}
|
|
6077
|
+
get loadUrl() {
|
|
6078
|
+
return this.getAttribute("load-url");
|
|
6079
|
+
}
|
|
6080
|
+
set loadUrl(e) {
|
|
6081
|
+
e == null ? this.removeAttribute("load-url") : this.setAttribute("load-url", String(e));
|
|
6082
|
+
}
|
|
6083
|
+
get name() {
|
|
6084
|
+
return this.getAttribute("name");
|
|
6085
|
+
}
|
|
6086
|
+
set name(e) {
|
|
6087
|
+
e == null ? this.removeAttribute("name") : this.setAttribute("name", String(e));
|
|
6088
|
+
}
|
|
6089
|
+
get loadingText() {
|
|
6090
|
+
return this.getAttribute("loading-text") ?? Tn;
|
|
6091
|
+
}
|
|
6092
|
+
set loadingText(e) {
|
|
6093
|
+
this.setAttribute("loading-text", String(e ?? ""));
|
|
6094
|
+
}
|
|
6095
|
+
get errorText() {
|
|
6096
|
+
return this.getAttribute("error-text") ?? En;
|
|
6097
|
+
}
|
|
6098
|
+
set errorText(e) {
|
|
6099
|
+
this.setAttribute("error-text", String(e ?? ""));
|
|
6100
|
+
}
|
|
6101
|
+
_readScript() {
|
|
6102
|
+
let e = this.querySelector(":scope > script[type='application/json']");
|
|
6103
|
+
if (!e) return null;
|
|
6104
|
+
try {
|
|
6105
|
+
return JSON.parse(e.textContent);
|
|
6106
|
+
} catch (e) {
|
|
6107
|
+
return console.error("[@webority/ui-elements] <wui-tree> could not read its JSON nodes:", e?.message), null;
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
_adoptAll(e) {
|
|
6111
|
+
let t = this._byId;
|
|
6112
|
+
this._prev = t, this._byId = /* @__PURE__ */ new Map();
|
|
6113
|
+
let n;
|
|
6114
|
+
try {
|
|
6115
|
+
n = this._adoptStaged(e, null, 1);
|
|
6116
|
+
} catch (e) {
|
|
6117
|
+
throw this._byId = t, e;
|
|
6118
|
+
} finally {
|
|
6119
|
+
this._prev = null;
|
|
6120
|
+
}
|
|
6121
|
+
this._roots = n;
|
|
6122
|
+
for (let e of t.keys()) this._byId.has(e) || this._checked.delete(e);
|
|
6123
|
+
for (let e of this._roots) this._passChecksDown(e);
|
|
6124
|
+
this._focusId && !this._byId.has(this._focusId) && (this._focusId = null);
|
|
6125
|
+
}
|
|
6126
|
+
_adoptStaged(e, t, n) {
|
|
6127
|
+
let r = [], i = [];
|
|
6128
|
+
this._staged = {
|
|
6129
|
+
ids: r,
|
|
6130
|
+
checks: i
|
|
6131
|
+
};
|
|
6132
|
+
try {
|
|
6133
|
+
let r = this._adopt(e, t, n);
|
|
6134
|
+
for (let e of i) this._checked.add(e);
|
|
6135
|
+
return r;
|
|
6136
|
+
} catch (e) {
|
|
6137
|
+
for (let e of r) this._byId.delete(e);
|
|
6138
|
+
throw e;
|
|
6139
|
+
} finally {
|
|
6140
|
+
this._staged = null;
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
_adopt(e, t, n) {
|
|
6144
|
+
if (!Array.isArray(e)) throw Error("<wui-tree> nodes must be an array.");
|
|
6145
|
+
return e.map((e) => {
|
|
6146
|
+
let r = e?.id == null ? "" : String(e.id);
|
|
6147
|
+
if (!r) throw Error("<wui-tree> every node needs an id.");
|
|
6148
|
+
if (this._byId.has(r)) throw Error(`<wui-tree> node id "${r}" is used twice.`);
|
|
6149
|
+
let i = this._prev?.get(r), a = {
|
|
6150
|
+
id: r,
|
|
6151
|
+
raw: e,
|
|
6152
|
+
parent: t,
|
|
6153
|
+
level: n,
|
|
6154
|
+
seq: ++this._seq,
|
|
6155
|
+
label: e.label == null ? r : String(e.label),
|
|
6156
|
+
icon: e.icon || null,
|
|
6157
|
+
badge: e.badge == null || e.badge === "" ? null : String(e.badge),
|
|
6158
|
+
badgeTone: e.badgeTone || null,
|
|
6159
|
+
disabled: !!e.disabled,
|
|
6160
|
+
hasChildren: !!e.hasChildren,
|
|
6161
|
+
children: null,
|
|
6162
|
+
expanded: i ? i.expanded : !!e.expanded,
|
|
6163
|
+
loading: !1,
|
|
6164
|
+
failed: !1
|
|
6165
|
+
};
|
|
6166
|
+
this._byId.set(r, a), this._staged.ids.push(r);
|
|
6167
|
+
let o = e.children ?? (e.hasChildren ? i?.children?.map((e) => e.raw) : void 0);
|
|
6168
|
+
return Array.isArray(o) && (a.children = this._adopt(o, a, n + 1)), a.loading = !!i?.loading && a.children === null && a.hasChildren, e.checked && !i && this._staged.checks.push(r), a;
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
6171
|
+
_passChecksDown(e) {
|
|
6172
|
+
e.children?.length && this._checked.has(e.id) && (this._checked.delete(e.id), this._setChecked(e, !0));
|
|
6173
|
+
for (let t of e.children ?? []) this._passChecksDown(t);
|
|
6174
|
+
}
|
|
6175
|
+
_loadOpenNodes() {
|
|
6176
|
+
queueMicrotask(() => {
|
|
6177
|
+
if (this.isConnected) for (let e of [...this._byId.values()]) e.expanded && e.children === null && e.hasChildren && !e.loading && this._load(e);
|
|
6178
|
+
});
|
|
6179
|
+
}
|
|
6180
|
+
_isBranch(e) {
|
|
6181
|
+
return e.children ? e.children.length > 0 : e.hasChildren;
|
|
6182
|
+
}
|
|
6183
|
+
_visible() {
|
|
6184
|
+
let e = [], t = (n) => {
|
|
6185
|
+
for (let r of n) e.push(r), r.expanded && r.children && t(r.children);
|
|
6186
|
+
};
|
|
6187
|
+
return t(this._roots), e;
|
|
6188
|
+
}
|
|
6189
|
+
_state(e) {
|
|
6190
|
+
if (e.children?.length) {
|
|
6191
|
+
let t = 0, n = 0;
|
|
6192
|
+
for (let r of e.children) {
|
|
6193
|
+
let e = this._state(r);
|
|
6194
|
+
e === "checked" ? t++ : e === "unchecked" && n++;
|
|
6195
|
+
}
|
|
6196
|
+
return t === e.children.length ? "checked" : n === e.children.length ? "unchecked" : "mixed";
|
|
6197
|
+
}
|
|
6198
|
+
return this._checked.has(e.id) ? "checked" : "unchecked";
|
|
6199
|
+
}
|
|
6200
|
+
_setChecked(e, t) {
|
|
6201
|
+
if (e.children?.length) for (let n of e.children) n.disabled || this._setChecked(n, t);
|
|
6202
|
+
else t ? this._checked.add(e.id) : this._checked.delete(e.id);
|
|
6203
|
+
}
|
|
6204
|
+
_nodeFrom(e) {
|
|
6205
|
+
let t = e?.closest?.("li.wui-tree-item");
|
|
6206
|
+
if (!t) return null;
|
|
6207
|
+
for (let [e, n] of this._els) if (n.li === t) return this._byId.get(e) ?? null;
|
|
6208
|
+
return null;
|
|
6209
|
+
}
|
|
6210
|
+
_emit(e, t) {
|
|
6211
|
+
this.dispatchEvent(new CustomEvent(`wui-tree:${e}`, {
|
|
6212
|
+
detail: t,
|
|
6213
|
+
bubbles: !0,
|
|
6214
|
+
composed: !0
|
|
6215
|
+
}));
|
|
6216
|
+
}
|
|
6217
|
+
_announce(e) {
|
|
6218
|
+
this._live && (this._live.textContent = e);
|
|
6219
|
+
}
|
|
6220
|
+
_setRoving(e) {
|
|
6221
|
+
let t = this._els.get(this._focusId);
|
|
6222
|
+
t && (t.li.tabIndex = -1), this._focusId = e.id;
|
|
6223
|
+
let n = this._els.get(e.id);
|
|
6224
|
+
n && (n.li.tabIndex = 0);
|
|
6225
|
+
}
|
|
6226
|
+
_focusNode(e) {
|
|
6227
|
+
e && (this._setRoving(e), this._els.get(e.id)?.li.focus());
|
|
6228
|
+
}
|
|
6229
|
+
_activate(e) {
|
|
6230
|
+
e.disabled || (this.selection === "single" && (this._selected = e.id, this._render(), this._syncForm()), this._emit("select", {
|
|
6231
|
+
id: e.id,
|
|
6232
|
+
node: e.raw
|
|
6233
|
+
}));
|
|
6234
|
+
}
|
|
6235
|
+
_enabledLeaves(e) {
|
|
6236
|
+
return e.disabled ? [] : e.children?.length ? e.children.flatMap((e) => this._enabledLeaves(e)) : [e];
|
|
6237
|
+
}
|
|
6238
|
+
_toggleCheck(e) {
|
|
6239
|
+
let t = this._enabledLeaves(e);
|
|
6240
|
+
if (!t.length) return;
|
|
6241
|
+
let n = !t.every((e) => this._checked.has(e.id));
|
|
6242
|
+
this._setChecked(e, n), this._render(), this._syncForm(), this._emit("check", {
|
|
6243
|
+
id: e.id,
|
|
6244
|
+
checked: n,
|
|
6245
|
+
values: this.values
|
|
6246
|
+
});
|
|
6247
|
+
}
|
|
6248
|
+
_toggleExpand(e) {
|
|
6249
|
+
e.disabled || !this._isBranch(e) || (e.expanded ? (e.expanded = !1, this._render()) : this._expand(e));
|
|
6250
|
+
}
|
|
6251
|
+
_expand(e) {
|
|
6252
|
+
e.expanded = !0, e.children === null ? this._load(e) : this._render();
|
|
6253
|
+
}
|
|
6254
|
+
async _load(e) {
|
|
6255
|
+
if (e.loading) return;
|
|
6256
|
+
e.loading = !0, e.failed = !1, this._announce(this.loadingText), this._render();
|
|
6257
|
+
let t, n = null;
|
|
6258
|
+
try {
|
|
6259
|
+
t = await this._fetchChildren(e);
|
|
6260
|
+
} catch (e) {
|
|
6261
|
+
n = e;
|
|
6262
|
+
}
|
|
6263
|
+
let r = this._byId.get(e.id);
|
|
6264
|
+
if (!r) {
|
|
6265
|
+
this._announce("");
|
|
6266
|
+
return;
|
|
6267
|
+
}
|
|
6268
|
+
if (r.loading) {
|
|
6269
|
+
if (r.loading = !1, !n) try {
|
|
6270
|
+
r.children = this._adoptStaged(t, r, r.level + 1), this._passChecksDown(r), this._announce("");
|
|
6271
|
+
} catch (e) {
|
|
6272
|
+
n = e;
|
|
6273
|
+
}
|
|
6274
|
+
n && (r.failed = !0, r.expanded = !1, this._announce(this.errorText), this._emit("error", {
|
|
6275
|
+
id: r.id,
|
|
6276
|
+
message: n?.message ?? String(n)
|
|
6277
|
+
})), this._render(), this._syncForm();
|
|
6278
|
+
}
|
|
6279
|
+
}
|
|
6280
|
+
async _fetchChildren(e) {
|
|
6281
|
+
if (this._loader) return this._loader(e.raw);
|
|
6282
|
+
let t = this.getAttribute("load-url");
|
|
6283
|
+
if (!t) throw Error("<wui-tree> has a node with children to load but no loadChildren or load-url.");
|
|
6284
|
+
let n = new URL(t, window.location.href);
|
|
6285
|
+
n.searchParams.set(wn, e.id);
|
|
6286
|
+
let r = await xn(n.href, { headers: { Accept: "application/json" } });
|
|
6287
|
+
if (!r.ok) throw Error(`Loading children answered ${r.kind}.`);
|
|
6288
|
+
return JSON.parse(r.html);
|
|
6289
|
+
}
|
|
6290
|
+
_handleClick(e) {
|
|
6291
|
+
let t = this._nodeFrom(e.target);
|
|
6292
|
+
!t || t.disabled || (this._focusNode(t), e.target.closest(".wui-tree-toggle") ? this._toggleExpand(t) : e.target.closest(".wui-tree-check") ? (e.preventDefault(), this._toggleCheck(t)) : this._activate(t));
|
|
6293
|
+
}
|
|
6294
|
+
_handleKeyDown(e) {
|
|
6295
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
6296
|
+
let t = this._nodeFrom(e.target);
|
|
6297
|
+
if (!(!t || e.target !== this._els.get(t.id)?.li)) if (e.key === "ArrowRight") {
|
|
6298
|
+
if (e.preventDefault(), !this._isBranch(t) || t.disabled) return;
|
|
6299
|
+
t.expanded ? t.children?.length && this._focusNode(t.children[0]) : this._expand(t);
|
|
6300
|
+
} else e.key === "ArrowLeft" ? (e.preventDefault(), t.expanded && this._isBranch(t) && !t.disabled ? this._toggleExpand(t) : t.parent && this._focusNode(t.parent)) : e.key === " " ? (e.preventDefault(), this.selection === "multiple" ? this._toggleCheck(t) : this.selection === "single" && this._activate(t)) : this._nav.handler(e);
|
|
6301
|
+
}
|
|
6302
|
+
_syncForm() {
|
|
6303
|
+
let e = this.selection;
|
|
6304
|
+
if (e === "multiple") h(this, this.values);
|
|
6305
|
+
else if (e === "single") m(this, this._selected ?? "");
|
|
6306
|
+
else for (let e of this.querySelectorAll(Dn)) e.remove();
|
|
6307
|
+
}
|
|
6308
|
+
_render() {
|
|
6309
|
+
if (!this._list) return;
|
|
6310
|
+
let e = document.activeElement, t = !!e && this._list.contains(e), n = this._visible();
|
|
6311
|
+
n.some((e) => e.id === this._focusId) || (this._focusId = (n.find((e) => e.id === this._selected) ?? n[0])?.id ?? null), this._els = /* @__PURE__ */ new Map();
|
|
6312
|
+
let r = this.getAttribute("aria-label");
|
|
6313
|
+
r ? this._list.setAttribute("aria-label", r) : this._list.removeAttribute("aria-label"), this._list.replaceChildren(...this._buildLevel(this._roots)), t && this._focusId && this._els.get(this._focusId)?.li.focus(), this._syncForm();
|
|
6314
|
+
}
|
|
6315
|
+
_buildLevel(e) {
|
|
6316
|
+
return e.map((t, n) => this._buildItem(t, n + 1, e.length));
|
|
6317
|
+
}
|
|
6318
|
+
_buildItem(e, t, n) {
|
|
6319
|
+
let r = this.selection, i = this._isBranch(e), a = this._state(e), o = G("li", "wui-tree-item", {
|
|
6320
|
+
role: "treeitem",
|
|
6321
|
+
tabindex: e.id === this._focusId ? 0 : -1,
|
|
6322
|
+
"aria-level": e.level,
|
|
6323
|
+
"aria-setsize": n,
|
|
6324
|
+
"aria-posinset": t,
|
|
6325
|
+
"aria-labelledby": `${this._uid}-${e.seq}`,
|
|
6326
|
+
"aria-describedby": e.badge ? `${this._uid}-${e.seq}-badge` : null
|
|
6327
|
+
});
|
|
6328
|
+
i && o.setAttribute("aria-expanded", String(e.expanded)), e.disabled && o.setAttribute("aria-disabled", "true"), e.loading && o.setAttribute("aria-busy", "true"), r === "single" && o.setAttribute("aria-selected", String(e.id === this._selected)), r === "multiple" && o.setAttribute("aria-checked", a === "mixed" ? "mixed" : String(a === "checked"));
|
|
6329
|
+
let s = G("div", "wui-tree-row", { role: "presentation" });
|
|
6330
|
+
s.style.setProperty("--wui-tree-level", String(e.level - 1)), r === "single" && e.id === this._selected && s.classList.add("wui-tree-row-selected"), e.failed && s.classList.add("wui-tree-row-error");
|
|
6331
|
+
let c = G("span", i ? "wui-tree-toggle" : "wui-tree-toggle wui-tree-toggle-leaf", { "aria-hidden": "true" });
|
|
6332
|
+
if (i && (c.innerHTML = _("chevron-right", { size: 16 })), s.append(c), r === "multiple") {
|
|
6333
|
+
let t = G("input", "form-check-input wui-tree-check", {
|
|
6334
|
+
type: "checkbox",
|
|
6335
|
+
tabindex: -1,
|
|
6336
|
+
"aria-hidden": "true"
|
|
6337
|
+
});
|
|
6338
|
+
t.checked = a === "checked", t.indeterminate = a === "mixed", t.disabled = e.disabled, t.addEventListener("mousedown", (e) => e.preventDefault()), s.append(t);
|
|
6339
|
+
}
|
|
6340
|
+
if (e.icon) {
|
|
6341
|
+
let t = G("span", "wui-tree-icon", { "aria-hidden": "true" });
|
|
6342
|
+
t.innerHTML = _(e.icon, { size: 16 }), s.append(t);
|
|
6343
|
+
}
|
|
6344
|
+
let l = G("span", "wui-tree-label", { id: `${this._uid}-${e.seq}` });
|
|
6345
|
+
if (l.textContent = e.label, s.append(l), e.badge) {
|
|
6346
|
+
let t = G("span", `badge wui-tree-badge${e.badgeTone && e.badgeTone !== "neutral" ? ` badge-${e.badgeTone}` : ""}`, { id: `${this._uid}-${e.seq}-badge` });
|
|
6347
|
+
t.textContent = e.badge, s.append(t);
|
|
6348
|
+
}
|
|
6349
|
+
if (e.loading && s.append(G("span", "wui-tree-spinner", { "aria-hidden": "true" })), o.append(s), e.expanded && e.children?.length) {
|
|
6350
|
+
let t = G("ul", "wui-tree-group", { role: "group" });
|
|
6351
|
+
t.append(...this._buildLevel(e.children)), o.append(t);
|
|
6352
|
+
}
|
|
6353
|
+
return this._els.set(e.id, {
|
|
6354
|
+
li: o,
|
|
6355
|
+
row: s
|
|
6356
|
+
}), o;
|
|
6357
|
+
}
|
|
6358
|
+
}, jn = "wui-wizard-step", Mn = class extends e {
|
|
5047
6359
|
static get observedAttributes() {
|
|
5048
6360
|
return [
|
|
5049
6361
|
"active",
|
|
@@ -5077,7 +6389,7 @@ var Qe = class extends e {
|
|
|
5077
6389
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
5078
6390
|
}
|
|
5079
6391
|
get _steps() {
|
|
5080
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
6392
|
+
return [...this.querySelectorAll(`:scope > ${jn}`)];
|
|
5081
6393
|
}
|
|
5082
6394
|
refresh() {
|
|
5083
6395
|
this._rendered && this._renderChrome();
|
|
@@ -5116,7 +6428,7 @@ var Qe = class extends e {
|
|
|
5116
6428
|
}
|
|
5117
6429
|
_reconcileSteps() {
|
|
5118
6430
|
let e = this._steps, t = this._known;
|
|
5119
|
-
if (this._known = e,
|
|
6431
|
+
if (this._known = e, Nn(e, t)) return e;
|
|
5120
6432
|
let n = (n) => new Set([...n].map((n) => e.indexOf(t[n])).filter((e) => e >= 0));
|
|
5121
6433
|
this._skipped = n(this._skipped), this._invalid = n(this._invalid);
|
|
5122
6434
|
let r = t[this._active];
|
|
@@ -5136,7 +6448,7 @@ var Qe = class extends e {
|
|
|
5136
6448
|
_onStepsMutated() {
|
|
5137
6449
|
if (!this._rendered) return;
|
|
5138
6450
|
let e = this._steps;
|
|
5139
|
-
(!e.length || this._header.nextElementSibling === e[0] && this._footer.previousElementSibling === e[e.length - 1]) &&
|
|
6451
|
+
(!e.length || this._header.nextElementSibling === e[0] && this._footer.previousElementSibling === e[e.length - 1]) && Nn(e, this._known) || (this._renderChrome(), this._observer?.takeRecords());
|
|
5140
6452
|
}
|
|
5141
6453
|
_syncPanels(e) {
|
|
5142
6454
|
e.forEach((e, t) => {
|
|
@@ -5159,14 +6471,14 @@ var Qe = class extends e {
|
|
|
5159
6471
|
let i = this.hasAttribute("non-linear");
|
|
5160
6472
|
return e.map((e, r) => {
|
|
5161
6473
|
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
|
|
5162
|
-
u = a === "done" ?
|
|
5163
|
-
let d = a === "pending" ? "step" : `step ${a}`, f = a === "active" ? " aria-current=\"step\"" : "", p = i || r < this._active,
|
|
5164
|
-
return
|
|
6474
|
+
u = a === "done" ? _("check") : a === "error" ? _("alert-triangle") : a === "skipped" ? _("minus") : c ? _(c) : String(l);
|
|
6475
|
+
let d = a === "pending" ? "step" : `step ${a}`, f = a === "active" ? " aria-current=\"step\"" : "", p = i || r < this._active, m = s ? `<span class="step-desc">${K(s)}</span>` : "", h;
|
|
6476
|
+
return h = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${K(o)}</span>${m}</span>` : n ? `<span class="step-circle">${u}</span><span class="step-index">Step ${l}</span><span class="step-label">${K(o)}</span>${m}` : `<span class="step-circle">${u}</span><span class="step-label">${K(o)}</span>${m}`, p ? `<button type="button" class="${d}" data-step="${r}"${f}>${h}</button>` : `<div class="${d}"${f}>${h}</div>`;
|
|
5165
6477
|
}).join("");
|
|
5166
6478
|
}
|
|
5167
6479
|
_footerHtml(e) {
|
|
5168
6480
|
let t = this._active, n = e.length - 1, r = this.hasAttribute("disabled") ? " disabled" : "", i = e[t]?.hasAttribute("optional") || this.hasAttribute("skippable"), a = this.getAttribute("back-label") || "Back", o = this.getAttribute("next-label") || "Next", s = this.getAttribute("skip-label") || "Skip", c = this.getAttribute("finish-label") || "Finish";
|
|
5169
|
-
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${
|
|
6481
|
+
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${_("arrow-left", { className: "me-2" })}${K(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${K(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${K(o)}${_("arrow-right", { className: "ms-2" })}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${K(c)}</button>`}</span>`;
|
|
5170
6482
|
}
|
|
5171
6483
|
_wire() {
|
|
5172
6484
|
this._teardown(), this._onHeaderClick = (e) => {
|
|
@@ -5240,7 +6552,7 @@ var Qe = class extends e {
|
|
|
5240
6552
|
_reflectActive(e) {
|
|
5241
6553
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
5242
6554
|
}
|
|
5243
|
-
},
|
|
6555
|
+
}, Nn = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), K = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Pn = class extends e {
|
|
5244
6556
|
static get observedAttributes() {
|
|
5245
6557
|
return [
|
|
5246
6558
|
"label",
|
|
@@ -5254,8 +6566,8 @@ var Qe = class extends e {
|
|
|
5254
6566
|
let e = this.closest("wui-wizard");
|
|
5255
6567
|
e && typeof e.refresh == "function" && e.refresh();
|
|
5256
6568
|
}
|
|
5257
|
-
},
|
|
5258
|
-
async function
|
|
6569
|
+
}, Fn = 2e3;
|
|
6570
|
+
async function In(e) {
|
|
5259
6571
|
try {
|
|
5260
6572
|
if (navigator.clipboard?.writeText) return await navigator.clipboard.writeText(e), !0;
|
|
5261
6573
|
} catch {}
|
|
@@ -5270,14 +6582,14 @@ async function ft(e) {
|
|
|
5270
6582
|
}
|
|
5271
6583
|
//#endregion
|
|
5272
6584
|
//#region src/fileValidation.js
|
|
5273
|
-
var
|
|
6585
|
+
var Ln = "image/png,image/jpeg,image/webp", Rn = 5, zn = {
|
|
5274
6586
|
"image/png": [".png"],
|
|
5275
6587
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
5276
6588
|
"image/webp": [".webp"],
|
|
5277
6589
|
"image/gif": [".gif"],
|
|
5278
6590
|
"image/svg+xml": [".svg"],
|
|
5279
6591
|
"application/pdf": [".pdf"]
|
|
5280
|
-
},
|
|
6592
|
+
}, Bn = {
|
|
5281
6593
|
"image/png": "PNG",
|
|
5282
6594
|
"image/jpeg": "JPG",
|
|
5283
6595
|
"image/webp": "WEBP",
|
|
@@ -5291,7 +6603,7 @@ var pt = "image/png,image/jpeg,image/webp", mt = 5, ht = {
|
|
|
5291
6603
|
".gif": "GIF",
|
|
5292
6604
|
".svg": "SVG",
|
|
5293
6605
|
".pdf": "PDF"
|
|
5294
|
-
},
|
|
6606
|
+
}, Vn = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), Hn = [
|
|
5295
6607
|
".png",
|
|
5296
6608
|
".jpg",
|
|
5297
6609
|
".jpeg",
|
|
@@ -5302,54 +6614,459 @@ var pt = "image/png,image/jpeg,image/webp", mt = 5, ht = {
|
|
|
5302
6614
|
".avif",
|
|
5303
6615
|
".heic"
|
|
5304
6616
|
];
|
|
5305
|
-
function
|
|
6617
|
+
function Un(e) {
|
|
5306
6618
|
if (!e) return !1;
|
|
5307
6619
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
5308
6620
|
if (t) return t.startsWith("image/");
|
|
5309
6621
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
5310
|
-
return
|
|
6622
|
+
return Hn.some((e) => r.endsWith(e));
|
|
5311
6623
|
}
|
|
5312
|
-
function
|
|
5313
|
-
let t =
|
|
5314
|
-
return t.length ? t.every((e) => e.startsWith(".") ?
|
|
6624
|
+
function Wn(e) {
|
|
6625
|
+
let t = Vn(e);
|
|
6626
|
+
return t.length ? t.every((e) => e.startsWith(".") ? Hn.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
5315
6627
|
}
|
|
5316
|
-
function
|
|
6628
|
+
function Gn(e) {
|
|
5317
6629
|
let t = [];
|
|
5318
|
-
for (let n of
|
|
5319
|
-
let e =
|
|
6630
|
+
for (let n of Vn(e)) {
|
|
6631
|
+
let e = Bn[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
5320
6632
|
t.includes(e) || t.push(e);
|
|
5321
6633
|
}
|
|
5322
6634
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
5323
6635
|
}
|
|
5324
|
-
function
|
|
5325
|
-
let n =
|
|
6636
|
+
function Kn(e, t) {
|
|
6637
|
+
let n = Vn(t);
|
|
5326
6638
|
if (!n.length) return !0;
|
|
5327
6639
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
5328
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
6640
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (zn[e] || []).some((e) => i.endsWith(e)));
|
|
5329
6641
|
}
|
|
5330
|
-
function
|
|
6642
|
+
function qn(e, t = {}) {
|
|
5331
6643
|
if (!e) return null;
|
|
5332
|
-
let n = t.accept === void 0 ?
|
|
5333
|
-
return
|
|
6644
|
+
let n = t.accept === void 0 ? Ln : t.accept, r = t.maxSizeMb === void 0 ? 5 : t.maxSizeMb;
|
|
6645
|
+
return Kn(e, n) ? r > 0 && e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${Gn(n)} file.`;
|
|
6646
|
+
}
|
|
6647
|
+
//#endregion
|
|
6648
|
+
//#region src/formatters.js
|
|
6649
|
+
var Jn = [
|
|
6650
|
+
"number",
|
|
6651
|
+
"currency",
|
|
6652
|
+
"percent",
|
|
6653
|
+
"compact",
|
|
6654
|
+
"duration",
|
|
6655
|
+
"date"
|
|
6656
|
+
], Yn = ["INR"], Xn = ["rupees", "paise"], Zn = [
|
|
6657
|
+
"ms",
|
|
6658
|
+
"s",
|
|
6659
|
+
"min",
|
|
6660
|
+
"h"
|
|
6661
|
+
], Qn = [
|
|
6662
|
+
"day",
|
|
6663
|
+
"month",
|
|
6664
|
+
"year",
|
|
6665
|
+
"datetime",
|
|
6666
|
+
"time"
|
|
6667
|
+
], $n = "Asia/Kolkata", er = "-", tr = "−", nr = "₹", rr = 330 * 60 * 1e3, ir = [
|
|
6668
|
+
"Jan",
|
|
6669
|
+
"Feb",
|
|
6670
|
+
"Mar",
|
|
6671
|
+
"Apr",
|
|
6672
|
+
"May",
|
|
6673
|
+
"Jun",
|
|
6674
|
+
"Jul",
|
|
6675
|
+
"Aug",
|
|
6676
|
+
"Sep",
|
|
6677
|
+
"Oct",
|
|
6678
|
+
"Nov",
|
|
6679
|
+
"Dec"
|
|
6680
|
+
], ar = [
|
|
6681
|
+
[1e7, "Cr"],
|
|
6682
|
+
[1e5, "L"],
|
|
6683
|
+
[1e3, "K"]
|
|
6684
|
+
], or = (e, t) => Number.isInteger(e) && e >= 0 && e <= 20 ? e : t, sr = /* @__PURE__ */ new Map(), q = (e) => (sr.has(e) || sr.set(e, new Intl.NumberFormat("en-IN", {
|
|
6685
|
+
minimumFractionDigits: 0,
|
|
6686
|
+
maximumFractionDigits: e
|
|
6687
|
+
})), sr.get(e)), cr = /* @__PURE__ */ new Map(), lr = (e) => (cr.has(e) || cr.set(e, new Intl.NumberFormat("en-IN", {
|
|
6688
|
+
minimumFractionDigits: e,
|
|
6689
|
+
maximumFractionDigits: e
|
|
6690
|
+
})), cr.get(e)), ur = (e) => typeof e == "number" && Number.isFinite(e), dr = (e) => e < 0 && !Object.is(Math.abs(e), 0) ? tr : "", fr = (e, t) => t === "paise" ? e / 100 : e;
|
|
6691
|
+
function pr(e, { decimals: t } = {}) {
|
|
6692
|
+
if (!ur(e)) return "-";
|
|
6693
|
+
let n = q(or(t, 2)).format(Math.abs(e));
|
|
6694
|
+
return n === "0" ? "0" : dr(e) + n;
|
|
6695
|
+
}
|
|
6696
|
+
function mr(e, { unit: t = "rupees", decimals: n } = {}) {
|
|
6697
|
+
if (!ur(e)) return "-";
|
|
6698
|
+
let r = fr(e, t), i = lr(or(n, 0)).format(Math.abs(r));
|
|
6699
|
+
return (Number(i.replace(/,/g, "")) === 0 ? "" : dr(r)) + nr + i;
|
|
6700
|
+
}
|
|
6701
|
+
var hr = (e) => e > 0 && e < .1 ? Math.min(20, 1 - Math.floor(Math.log10(e))) : 2;
|
|
6702
|
+
function gr(e, { currency: t, unit: n = "rupees" } = {}) {
|
|
6703
|
+
if (!ur(e)) return "-";
|
|
6704
|
+
let r = t ? fr(e, n) : e, i = t ? nr : "", a = Math.abs(r), o = ar.findIndex(([e]) => a >= e);
|
|
6705
|
+
if (o === -1) {
|
|
6706
|
+
let e = q(hr(a)).format(a);
|
|
6707
|
+
if (e !== "1,000") return (e === "0" ? "" : dr(r)) + i + e;
|
|
6708
|
+
o = ar.length - 1;
|
|
6709
|
+
}
|
|
6710
|
+
let [s, c] = ar[o], l = a / s, u = l >= 100 ? 0 : l >= 10 ? 1 : 2, d = Number(l.toFixed(u));
|
|
6711
|
+
return d >= 100 && o > 0 && (--o, [s, c] = ar[o], l = a / s, u = l >= 100 ? 0 : l >= 10 ? 1 : 2, d = Number(l.toFixed(u))), `${dr(r)}${i}${q(u).format(d)} ${c}`;
|
|
6712
|
+
}
|
|
6713
|
+
function _r(e, { decimals: t } = {}) {
|
|
6714
|
+
return ur(e) ? `${pr(e * 100, { decimals: or(t, 1) })}%` : "-";
|
|
6715
|
+
}
|
|
6716
|
+
function vr(e, { unit: t = "s" } = {}) {
|
|
6717
|
+
if (!ur(e)) return "-";
|
|
6718
|
+
let n = {
|
|
6719
|
+
ms: 1,
|
|
6720
|
+
s: 1e3,
|
|
6721
|
+
min: 6e4,
|
|
6722
|
+
h: 36e5
|
|
6723
|
+
}[t] ?? 1e3, r = Math.abs(e * n), i = dr(e);
|
|
6724
|
+
if (Math.round(r) < 1e3) return `${i}${q(0).format(r)} ms`;
|
|
6725
|
+
let a = r / 1e3;
|
|
6726
|
+
if (a < 10) return `${i}${q(1).format(a)}s`;
|
|
6727
|
+
let o = Math.round(a);
|
|
6728
|
+
if (o < 60) return `${i}${o}s`;
|
|
6729
|
+
let s = (e) => String(e).padStart(2, "0"), c = Math.floor(o / 60);
|
|
6730
|
+
if (c < 60) return `${i}${c}m ${s(o % 60)}s`;
|
|
6731
|
+
let l = Math.floor(c / 60);
|
|
6732
|
+
return `${i}${q(0).format(l)}h ${s(c % 60)}m`;
|
|
6733
|
+
}
|
|
6734
|
+
function yr(e) {
|
|
6735
|
+
if (e instanceof Date) return e.getTime();
|
|
6736
|
+
if (ur(e)) return e;
|
|
6737
|
+
if (typeof e != "string") return NaN;
|
|
6738
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());
|
|
6739
|
+
if (t) {
|
|
6740
|
+
let [e, n, r] = [
|
|
6741
|
+
Number(t[1]),
|
|
6742
|
+
Number(t[2]),
|
|
6743
|
+
Number(t[3])
|
|
6744
|
+
], i = new Date(Date.UTC(2e3, n - 1, r));
|
|
6745
|
+
return i.setUTCFullYear(e), i.getUTCFullYear() === e && i.getUTCMonth() === n - 1 && i.getUTCDate() === r ? i.getTime() - rr : NaN;
|
|
6746
|
+
}
|
|
6747
|
+
return Date.parse(e);
|
|
6748
|
+
}
|
|
6749
|
+
function br(e) {
|
|
6750
|
+
let t = new Date(e + rr);
|
|
6751
|
+
return {
|
|
6752
|
+
year: t.getUTCFullYear(),
|
|
6753
|
+
month: t.getUTCMonth(),
|
|
6754
|
+
day: t.getUTCDate(),
|
|
6755
|
+
hour: t.getUTCHours(),
|
|
6756
|
+
minute: t.getUTCMinutes()
|
|
6757
|
+
};
|
|
6758
|
+
}
|
|
6759
|
+
function xr(e, { pattern: t = "day" } = {}) {
|
|
6760
|
+
let n = yr(e);
|
|
6761
|
+
if (!Number.isFinite(n)) return "-";
|
|
6762
|
+
let r = br(n), i = (e) => String(e).padStart(2, "0"), a = `${i(r.day)}-${ir[r.month]}-${r.year}`, o = `${i(r.hour)}:${i(r.minute)}`;
|
|
6763
|
+
switch (t) {
|
|
6764
|
+
case "month": return `${ir[r.month]}-${r.year}`;
|
|
6765
|
+
case "year": return String(r.year);
|
|
6766
|
+
case "datetime": return `${a} ${o}`;
|
|
6767
|
+
case "time": return o;
|
|
6768
|
+
default: return a;
|
|
6769
|
+
}
|
|
6770
|
+
}
|
|
6771
|
+
function Sr(e, t) {
|
|
6772
|
+
if (e == null || e === "") return "-";
|
|
6773
|
+
let n = t?.style;
|
|
6774
|
+
if (n === "date") return xr(e, t);
|
|
6775
|
+
if (typeof e != "number") return String(e);
|
|
6776
|
+
switch (n) {
|
|
6777
|
+
case "currency": return mr(e, t);
|
|
6778
|
+
case "percent": return _r(e, t);
|
|
6779
|
+
case "compact": return gr(e, t);
|
|
6780
|
+
case "duration": return vr(e, t);
|
|
6781
|
+
default: return pr(e, t);
|
|
6782
|
+
}
|
|
6783
|
+
}
|
|
6784
|
+
//#endregion
|
|
6785
|
+
//#region src/inputMask.js
|
|
6786
|
+
var Cr = /[0-9]/, wr = {
|
|
6787
|
+
9: Cr,
|
|
6788
|
+
A: /[A-Za-z]/,
|
|
6789
|
+
"*": /[0-9A-Za-z]/
|
|
6790
|
+
}, Tr = /[9A*]/, Er = /* @__PURE__ */ new Set([
|
|
6791
|
+
"text",
|
|
6792
|
+
"tel",
|
|
6793
|
+
"search",
|
|
6794
|
+
"url",
|
|
6795
|
+
"password"
|
|
6796
|
+
]), Dr = (e) => {
|
|
6797
|
+
let t = e.replace(/\D/g, "");
|
|
6798
|
+
return t.length === 12 && t.startsWith("91") ? t.slice(2) : t.length === 11 && t.startsWith("0") ? t.slice(1) : e;
|
|
6799
|
+
}, Or = (e) => {
|
|
6800
|
+
let t = Number(e.slice(0, 2)), n = Number(e.slice(2, 4)), r = Number(e.slice(4, 8));
|
|
6801
|
+
if (r < 1) return !1;
|
|
6802
|
+
let i = new Date(Date.UTC(r, n - 1, t));
|
|
6803
|
+
return i.getUTCFullYear() === r && i.getUTCMonth() === n - 1 && i.getUTCDate() === t;
|
|
6804
|
+
}, kr = (e) => e.length <= 3 ? e : `${e.slice(0, -3).replace(/\B(?=(\d{2})+(?!\d))/g, ",")},${e.slice(-3)}`, Ar = (e) => {
|
|
6805
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());
|
|
6806
|
+
return t ? `${t[3]}-${t[2]}-${t[1]}` : e;
|
|
6807
|
+
};
|
|
6808
|
+
function J(e, { upper: t = !1, normalize: n, valid: r, post: i = (e) => e, message: a = "Enter the full value" } = {}) {
|
|
6809
|
+
let o = [...e].map((e) => wr[e] ? { re: wr[e] } : { lit: e }), s = o.filter((e) => e.re).length;
|
|
6810
|
+
return {
|
|
6811
|
+
inputMode: o.every((e) => !e.re || e.re === Cr) ? "numeric" : "text",
|
|
6812
|
+
normalize: n,
|
|
6813
|
+
post: i,
|
|
6814
|
+
message: a,
|
|
6815
|
+
extract(e) {
|
|
6816
|
+
let n = "", r = 0;
|
|
6817
|
+
for (let i of e) {
|
|
6818
|
+
for (; r < o.length && o[r].lit !== void 0 && o[r].lit !== i;) r++;
|
|
6819
|
+
if (r >= o.length) break;
|
|
6820
|
+
let e = o[r];
|
|
6821
|
+
e.lit === void 0 ? e.re.test(i) && (n += t ? i.toUpperCase() : i, r++) : r++;
|
|
6822
|
+
}
|
|
6823
|
+
return n;
|
|
6824
|
+
},
|
|
6825
|
+
layout(e) {
|
|
6826
|
+
let t = "", n = [], r = 0;
|
|
6827
|
+
for (let i = 0; i < o.length && r < e.length; i++) o[i].lit === void 0 ? (t += e[r++], n.push(!0)) : (t += o[i].lit, n.push(!1));
|
|
6828
|
+
return {
|
|
6829
|
+
text: t,
|
|
6830
|
+
isRaw: n
|
|
6831
|
+
};
|
|
6832
|
+
},
|
|
6833
|
+
isValid: (e) => e.length === s && (!r || r(e))
|
|
6834
|
+
};
|
|
6835
|
+
}
|
|
6836
|
+
function jr() {
|
|
6837
|
+
return {
|
|
6838
|
+
inputMode: "decimal",
|
|
6839
|
+
post: (e) => e,
|
|
6840
|
+
message: "Enter a valid amount",
|
|
6841
|
+
extract(e) {
|
|
6842
|
+
let t = "", n = !1, r = 0;
|
|
6843
|
+
for (let i of e) Cr.test(i) ? n ? r < 2 && (t += i, r++) : t += i : i === "." && !n && (n = !0, t += i);
|
|
6844
|
+
return t.startsWith(".") && (t = `0${t}`), t.replace(/^0+(?=\d)/, "");
|
|
6845
|
+
},
|
|
6846
|
+
layout(e) {
|
|
6847
|
+
let [t, n] = e.split("."), r = kr(t) + (e.includes(".") ? `.${n}` : "");
|
|
6848
|
+
return {
|
|
6849
|
+
text: r,
|
|
6850
|
+
isRaw: [...r].map((e) => e !== ",")
|
|
6851
|
+
};
|
|
6852
|
+
},
|
|
6853
|
+
isValid: (e) => /^\d+(\.\d{1,2})?$/.test(e)
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6856
|
+
var Mr = {
|
|
6857
|
+
"phone-in": () => J("99999 99999", {
|
|
6858
|
+
normalize: Dr,
|
|
6859
|
+
valid: (e) => /^[6-9]/.test(e),
|
|
6860
|
+
message: "Enter a 10-digit mobile number"
|
|
6861
|
+
}),
|
|
6862
|
+
pan: () => J("AAAAA9999A", {
|
|
6863
|
+
upper: !0,
|
|
6864
|
+
valid: (e) => /^[A-Z]{5}\d{4}[A-Z]$/.test(e),
|
|
6865
|
+
message: "Enter a valid PAN"
|
|
6866
|
+
}),
|
|
6867
|
+
gstin: () => J("99AAAAA9999A***", {
|
|
6868
|
+
upper: !0,
|
|
6869
|
+
valid: (e) => /^\d{2}[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/.test(e),
|
|
6870
|
+
message: "Enter a valid GSTIN"
|
|
6871
|
+
}),
|
|
6872
|
+
aadhaar: () => J("9999 9999 9999", {
|
|
6873
|
+
valid: (e) => /^[2-9]/.test(e),
|
|
6874
|
+
message: "Enter a valid 12-digit Aadhaar number"
|
|
6875
|
+
}),
|
|
6876
|
+
ifsc: () => J("AAAA*******", {
|
|
6877
|
+
upper: !0,
|
|
6878
|
+
valid: (e) => /^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),
|
|
6879
|
+
message: "Enter a valid IFSC"
|
|
6880
|
+
}),
|
|
6881
|
+
"pin-code": () => J("999999", {
|
|
6882
|
+
valid: (e) => /^[1-9]/.test(e),
|
|
6883
|
+
message: "Enter a valid 6-digit PIN code"
|
|
6884
|
+
}),
|
|
6885
|
+
date: () => J("99-99-9999", {
|
|
6886
|
+
normalize: Ar,
|
|
6887
|
+
valid: Or,
|
|
6888
|
+
post: (e, t) => e.length === 8 && Or(e) ? `${e.slice(4)}-${e.slice(2, 4)}-${e.slice(0, 2)}` : t,
|
|
6889
|
+
message: "Enter a valid date as DD-MM-YYYY"
|
|
6890
|
+
}),
|
|
6891
|
+
amount: jr
|
|
6892
|
+
}, Nr = Object.keys(Mr), Pr = (e) => {
|
|
6893
|
+
let t = String(e).toLowerCase();
|
|
6894
|
+
return Object.hasOwn(Mr, t) ? t : void 0;
|
|
6895
|
+
}, Fr = (e) => Tr.test(String(e)) && Pr(e) === void 0, Ir = /* @__PURE__ */ new Map();
|
|
6896
|
+
function Lr(e) {
|
|
6897
|
+
if (e == null || e === "") return null;
|
|
6898
|
+
let t = String(e);
|
|
6899
|
+
return Ir.has(t) || (Fr(t) ? Ir.set(t, J(t)) : Ir.set(t, Object.hasOwn(Mr, t) ? Mr[t]() : null)), Ir.get(t);
|
|
6900
|
+
}
|
|
6901
|
+
var Y = (e, t) => e.normalize ? e.normalize(t) : t;
|
|
6902
|
+
function Rr(e, t) {
|
|
6903
|
+
let n = Lr(e);
|
|
6904
|
+
return n ? n.extract(Y(n, String(t ?? ""))) : String(t ?? "");
|
|
6905
|
+
}
|
|
6906
|
+
function zr(e, t) {
|
|
6907
|
+
let n = Lr(e);
|
|
6908
|
+
if (!n) return String(t ?? "");
|
|
6909
|
+
let r = n.extract(Y(n, String(t ?? "")));
|
|
6910
|
+
return n.post(r, n.layout(r).text);
|
|
6911
|
+
}
|
|
6912
|
+
function Br(e, t) {
|
|
6913
|
+
let n = Lr(e);
|
|
6914
|
+
return n ? n.layout(n.extract(Y(n, String(t ?? "")))).text : String(t ?? "");
|
|
6915
|
+
}
|
|
6916
|
+
var Vr = (e, t) => {
|
|
6917
|
+
if (t <= 0) return 0;
|
|
6918
|
+
let n = 0;
|
|
6919
|
+
for (let r = 0; r < e.length; r++) if (e[r] && ++n === t) return r + 1;
|
|
6920
|
+
return e.length;
|
|
6921
|
+
}, Hr = /* @__PURE__ */ new WeakMap(), Ur = (e) => Hr.get(e)?.(), Wr = /* @__PURE__ */ new WeakMap();
|
|
6922
|
+
function Gr(e, t, n, r) {
|
|
6923
|
+
let i = e.getAll(t), a = Wr.get(e);
|
|
6924
|
+
a || Wr.set(e, a = /* @__PURE__ */ new Set());
|
|
6925
|
+
let o = i.findIndex((e, r) => e === n && !a.has(`${t}\u0000${r}`));
|
|
6926
|
+
if (!(o < 0)) {
|
|
6927
|
+
if (a.add(`${t}\u0000${o}`), i[o] = r, i.length === 1) {
|
|
6928
|
+
e.set(t, r);
|
|
6929
|
+
return;
|
|
6930
|
+
}
|
|
6931
|
+
e.delete(t);
|
|
6932
|
+
for (let n of i) e.append(t, n);
|
|
6933
|
+
}
|
|
6934
|
+
}
|
|
6935
|
+
function Kr(e) {
|
|
6936
|
+
let t = null, n = null, r = !1, i = (t, n) => n === null ? e.removeAttribute(t) : e.setAttribute(t, n), a, o, s = () => {
|
|
6937
|
+
t?.remove(), t = null, n && (n.hidden = !1), n = null, r && e.classList.remove("error"), r = !1, a !== void 0 && i("aria-invalid", a), o !== void 0 && i("aria-describedby", o), a = void 0, o = void 0;
|
|
6938
|
+
};
|
|
6939
|
+
return (i) => {
|
|
6940
|
+
if (!i) {
|
|
6941
|
+
s();
|
|
6942
|
+
return;
|
|
6943
|
+
}
|
|
6944
|
+
let c = e.closest(".field"), l = c?.querySelector(".field-error");
|
|
6945
|
+
l && l !== t && l.textContent.trim() || (t || (r = !e.classList.contains("error"), e.classList.add("error"), a = e.getAttribute("aria-invalid"), o = e.getAttribute("aria-describedby"), c && (t = document.createElement("div"), t.className = "field-error", e.id && (t.id = `${e.id}-error`), n = c.querySelector(".field-hint"), n && (n.hidden = !0), c.insertBefore(t, [...c.children].find((e) => e.classList.contains("field-count")) ?? null), t.id && e.setAttribute("aria-describedby", t.id)), e.setAttribute("aria-invalid", "true")), t && (t.textContent = i));
|
|
6946
|
+
};
|
|
6947
|
+
}
|
|
6948
|
+
function qr(e, { mask: t, postFormatted: n = !1, onChange: r, onInvalidChange: i } = {}) {
|
|
6949
|
+
let a = Lr(t);
|
|
6950
|
+
if (!a || !Er.has(e.type)) return () => {};
|
|
6951
|
+
let o = Object.getPrototypeOf(e), s = Object.getOwnPropertyDescriptor(o, "value").set, c = !e.hasAttribute("inputmode");
|
|
6952
|
+
c && e.setAttribute("inputmode", a.inputMode);
|
|
6953
|
+
let l = i ?? Kr(e), u = null, d = !1, f = !1, p = !1, m = "", h = "", g, _ = () => {
|
|
6954
|
+
let e = p ? m : "";
|
|
6955
|
+
e !== h && (h = e, l(h));
|
|
6956
|
+
}, v = (t, n, i) => {
|
|
6957
|
+
let o = a.extract(t.slice(0, n)).length, c = a.extract(t), { text: l, isRaw: d } = a.layout(c);
|
|
6958
|
+
if (e.value !== l && (s.call(e, l), document.activeElement === e && Er.has(e.type))) {
|
|
6959
|
+
let t = Vr(d, o);
|
|
6960
|
+
e.setSelectionRange(t, t);
|
|
6961
|
+
}
|
|
6962
|
+
e.dataset.maskRaw = c, m = c && !a.isValid(c) ? a.message : "", e.setCustomValidity(m), _(), i && c !== u && r?.(c, l), u = c;
|
|
6963
|
+
}, y = Object.getOwnPropertyDescriptor(e, "value"), b = y ?? Object.getOwnPropertyDescriptor(o, "value");
|
|
6964
|
+
Object.defineProperty(e, "value", {
|
|
6965
|
+
configurable: !0,
|
|
6966
|
+
enumerable: b.enumerable,
|
|
6967
|
+
get: () => b.get.call(e),
|
|
6968
|
+
set: (t) => {
|
|
6969
|
+
if (b.set.call(e, t), f) return;
|
|
6970
|
+
let n = Y(a, e.value);
|
|
6971
|
+
v(n, n.length, !0);
|
|
6972
|
+
}
|
|
6973
|
+
});
|
|
6974
|
+
let x = () => {
|
|
6975
|
+
d = !0, e.dispatchEvent(new Event("input", { bubbles: !0 })), d = !1;
|
|
6976
|
+
}, S = (t) => {
|
|
6977
|
+
if (d || f || t.isComposing) return;
|
|
6978
|
+
let n = t.inputType === "insertText" && (t.data?.length ?? 0) <= 1 || t.inputType?.startsWith("delete") ? e.value : Y(a, e.value);
|
|
6979
|
+
v(n, e.selectionStart ?? n.length, !0);
|
|
6980
|
+
}, ee = () => {
|
|
6981
|
+
f = !0;
|
|
6982
|
+
}, C = () => {
|
|
6983
|
+
f = !1;
|
|
6984
|
+
let t = Y(a, e.value);
|
|
6985
|
+
v(t, e.selectionStart ?? t.length, !0), x();
|
|
6986
|
+
}, w = (t) => {
|
|
6987
|
+
let n = t.inputType === "deleteContentBackward";
|
|
6988
|
+
if (!n && t.inputType !== "deleteContentForward" || t.isComposing) return;
|
|
6989
|
+
let r = e.selectionStart;
|
|
6990
|
+
if (r == null || r !== e.selectionEnd) return;
|
|
6991
|
+
let { isRaw: i } = a.layout(a.extract(e.value)), o = n ? r - 1 : r;
|
|
6992
|
+
for (; o >= 0 && o < i.length && !i[o];) o += n ? -1 : 1;
|
|
6993
|
+
o !== (n ? r - 1 : r) && (t.preventDefault(), !(o < 0 || o >= i.length) && (v(e.value.slice(0, o) + e.value.slice(o + 1), n ? o : r, !0), x()));
|
|
6994
|
+
}, T = (t) => {
|
|
6995
|
+
if (e.readOnly || e.disabled) return;
|
|
6996
|
+
let n = t.clipboardData?.getData("text");
|
|
6997
|
+
if (n == null) return;
|
|
6998
|
+
t.preventDefault();
|
|
6999
|
+
let r = Y(a, n), i = e.selectionStart ?? e.value.length, o = e.selectionEnd ?? i;
|
|
7000
|
+
v(e.value.slice(0, i) + r + e.value.slice(o), i + r.length, !0), x();
|
|
7001
|
+
}, E = () => {
|
|
7002
|
+
let t = a.extract(e.value);
|
|
7003
|
+
return a.post(t, a.layout(t).text);
|
|
7004
|
+
}, D = () => {
|
|
7005
|
+
p = !0, _();
|
|
7006
|
+
};
|
|
7007
|
+
e.addEventListener("input", S), e.addEventListener("beforeinput", w), e.addEventListener("paste", T), e.addEventListener("compositionstart", ee), e.addEventListener("compositionend", C), e.addEventListener("blur", D), e.addEventListener("invalid", D);
|
|
7008
|
+
let O = e.form, te = (t) => {
|
|
7009
|
+
e.name && !e.disabled && Gr(t.formData, e.name, e.value, E());
|
|
7010
|
+
}, ne = () => {
|
|
7011
|
+
clearTimeout(g), g = setTimeout(() => {
|
|
7012
|
+
p = !1, v(Y(a, e.value), e.value.length, !0);
|
|
7013
|
+
}, 0);
|
|
7014
|
+
};
|
|
7015
|
+
n || (O?.addEventListener("formdata", te), Hr.set(e, E)), O?.addEventListener("reset", ne), O?.addEventListener("submit", D);
|
|
7016
|
+
let re = Y(a, e.value);
|
|
7017
|
+
return v(re, re.length, !1), () => {
|
|
7018
|
+
clearTimeout(g), e.removeEventListener("input", S), e.removeEventListener("beforeinput", w), e.removeEventListener("paste", T), e.removeEventListener("compositionstart", ee), e.removeEventListener("compositionend", C), e.removeEventListener("blur", D), e.removeEventListener("invalid", D), O?.removeEventListener("formdata", te), O?.removeEventListener("reset", ne), O?.removeEventListener("submit", D), Hr.delete(e), y ? Object.defineProperty(e, "value", y) : delete e.value, p = !1, m = "", _(), e.setCustomValidity(""), delete e.dataset.maskRaw, c && e.removeAttribute("inputmode");
|
|
7019
|
+
};
|
|
7020
|
+
}
|
|
7021
|
+
function Jr() {
|
|
7022
|
+
let e = typeof window > "u" ? void 0 : window.jQuery?.validator?.prototype;
|
|
7023
|
+
if (!e || e.wuiMaskHook) return;
|
|
7024
|
+
let t = e.elementValue;
|
|
7025
|
+
e.elementValue = function(e) {
|
|
7026
|
+
let n = Ur(e);
|
|
7027
|
+
return n === void 0 ? t.call(this, e) : n;
|
|
7028
|
+
}, e.wuiMaskHook = !0;
|
|
7029
|
+
}
|
|
7030
|
+
var Yr = /* @__PURE__ */ new WeakMap(), Xr, Zr = (e) => {
|
|
7031
|
+
Yr.has(e) || Yr.set(e, qr(e, {
|
|
7032
|
+
mask: e.dataset.appMask,
|
|
7033
|
+
postFormatted: e.hasAttribute("data-mask-post-formatted")
|
|
7034
|
+
}));
|
|
7035
|
+
}, Qr = (e) => e.nodeType === 1 ? [...e.matches("input[data-app-mask]") ? [e] : [], ...e.querySelectorAll("input[data-app-mask]")] : [];
|
|
7036
|
+
function $r() {
|
|
7037
|
+
Xr || typeof MutationObserver > "u" || (Xr = new MutationObserver((e) => {
|
|
7038
|
+
for (let t of e) {
|
|
7039
|
+
for (let e of t.removedNodes) for (let t of Qr(e)) Yr.get(t)?.(), Yr.delete(t);
|
|
7040
|
+
for (let e of t.addedNodes) for (let t of Qr(e)) Zr(t);
|
|
7041
|
+
}
|
|
7042
|
+
}), Xr.observe(document.documentElement, {
|
|
7043
|
+
childList: !0,
|
|
7044
|
+
subtree: !0
|
|
7045
|
+
}));
|
|
7046
|
+
}
|
|
7047
|
+
function ei(e = document) {
|
|
7048
|
+
Jr();
|
|
7049
|
+
for (let t of e.querySelectorAll("input[data-app-mask]")) Zr(t);
|
|
7050
|
+
e === document && $r();
|
|
5334
7051
|
}
|
|
5335
7052
|
//#endregion
|
|
5336
7053
|
//#region src/passwordRules.js
|
|
5337
|
-
var
|
|
7054
|
+
var ti = {
|
|
5338
7055
|
minLength: 8,
|
|
5339
7056
|
uppercase: !0,
|
|
5340
7057
|
lowercase: !0,
|
|
5341
7058
|
digit: !0,
|
|
5342
7059
|
special: !0,
|
|
5343
7060
|
uniqueChars: 0
|
|
5344
|
-
},
|
|
5345
|
-
function
|
|
5346
|
-
return e === !0 || e == null ? { ...
|
|
5347
|
-
...
|
|
7061
|
+
}, ni = "Password requirements";
|
|
7062
|
+
function ri(e) {
|
|
7063
|
+
return e === !0 || e == null ? { ...ti } : {
|
|
7064
|
+
...ti,
|
|
5348
7065
|
...e
|
|
5349
7066
|
};
|
|
5350
7067
|
}
|
|
5351
|
-
function
|
|
5352
|
-
let t =
|
|
7068
|
+
function ii(e) {
|
|
7069
|
+
let t = ri(e), n = [];
|
|
5353
7070
|
if (t.minLength > 0 && n.push({
|
|
5354
7071
|
key: "length",
|
|
5355
7072
|
label: `At least ${t.minLength} characters long`,
|
|
@@ -5380,89 +7097,145 @@ function Dt(e) {
|
|
|
5380
7097
|
}
|
|
5381
7098
|
return n;
|
|
5382
7099
|
}
|
|
5383
|
-
function
|
|
7100
|
+
function ai(e, t) {
|
|
5384
7101
|
let n = e == null ? "" : String(e);
|
|
5385
|
-
return
|
|
7102
|
+
return ii(t).map((e) => ({
|
|
5386
7103
|
key: e.key,
|
|
5387
7104
|
label: e.label,
|
|
5388
7105
|
met: e.test(n)
|
|
5389
7106
|
}));
|
|
5390
7107
|
}
|
|
5391
|
-
function
|
|
5392
|
-
return
|
|
7108
|
+
function oi(e, t) {
|
|
7109
|
+
return ai(e, t).every((e) => e.met);
|
|
7110
|
+
}
|
|
7111
|
+
//#endregion
|
|
7112
|
+
//#region src/remoteModal.js
|
|
7113
|
+
function si(e = document) {}
|
|
7114
|
+
function ci(e, t = {}) {
|
|
7115
|
+
return Promise.reject(/* @__PURE__ */ Error(`WUI.modal.load(${String(e)}): server-loaded modals are not available in this build.`));
|
|
7116
|
+
}
|
|
7117
|
+
//#endregion
|
|
7118
|
+
//#region src/serverTable.js
|
|
7119
|
+
function li(e = document) {}
|
|
7120
|
+
function ui(e) {
|
|
7121
|
+
return null;
|
|
7122
|
+
}
|
|
7123
|
+
//#endregion
|
|
7124
|
+
//#region src/shellParts.js
|
|
7125
|
+
function di(e = document) {}
|
|
7126
|
+
function fi(e) {
|
|
7127
|
+
return null;
|
|
7128
|
+
}
|
|
7129
|
+
//#endregion
|
|
7130
|
+
//#region src/tableSelect.js
|
|
7131
|
+
var pi = "Select all rows", mi = "Select row", X = "wui-select-cell", hi = (e, t) => {
|
|
7132
|
+
let n = e.createElement("input");
|
|
7133
|
+
return n.type = "checkbox", n.className = "wui-check", n.setAttribute("aria-label", t), n;
|
|
7134
|
+
};
|
|
7135
|
+
function gi(e = document) {
|
|
7136
|
+
let t = e.createElement("th");
|
|
7137
|
+
return t.className = X, t.appendChild(hi(e, pi)), t;
|
|
7138
|
+
}
|
|
7139
|
+
function _i(e = document) {
|
|
7140
|
+
let t = e.createElement("td");
|
|
7141
|
+
return t.className = X, t.appendChild(hi(e, mi)), t;
|
|
7142
|
+
}
|
|
7143
|
+
function vi(e = document) {
|
|
7144
|
+
let t = e.createElement("td");
|
|
7145
|
+
return t.className = X, t;
|
|
7146
|
+
}
|
|
7147
|
+
var yi = (e) => e.firstElementChild?.classList.contains(X);
|
|
7148
|
+
function bi(e) {
|
|
7149
|
+
for (let t of e) yi(t) || t.insertBefore(_i(t.ownerDocument), t.firstChild);
|
|
7150
|
+
}
|
|
7151
|
+
function xi(e) {
|
|
7152
|
+
let t = e.querySelector("thead tr");
|
|
7153
|
+
if (!t) return null;
|
|
7154
|
+
yi(t) || t.insertBefore(gi(e.ownerDocument), t.firstChild), bi(e.querySelectorAll("tbody tr"));
|
|
7155
|
+
for (let t of e.querySelectorAll("tfoot tr")) yi(t) || t.insertBefore(vi(e.ownerDocument), t.firstChild);
|
|
7156
|
+
return t.querySelector(`.${X} .wui-check`);
|
|
7157
|
+
}
|
|
7158
|
+
function Si(e) {
|
|
7159
|
+
let t = e.querySelector(`thead .${X} .wui-check`), n = [...e.querySelectorAll("tbody tr .wui-check")], r = n.length, i = n.filter((e) => e.checked).length;
|
|
7160
|
+
t && (t.checked = r > 0 && i === r, t.indeterminate = i > 0 && i < r);
|
|
7161
|
+
for (let t of e.querySelectorAll("tbody tr")) t.classList.toggle("is-selected", !!t.querySelector(".wui-check")?.checked);
|
|
7162
|
+
return {
|
|
7163
|
+
selected: i,
|
|
7164
|
+
total: r
|
|
7165
|
+
};
|
|
5393
7166
|
}
|
|
5394
7167
|
//#endregion
|
|
5395
7168
|
//#region src/themeTransition.js
|
|
5396
|
-
var
|
|
7169
|
+
var Ci = [
|
|
5397
7170
|
"light",
|
|
5398
7171
|
"dark",
|
|
5399
7172
|
"auto"
|
|
5400
|
-
],
|
|
7173
|
+
], wi = [
|
|
5401
7174
|
"wave",
|
|
5402
7175
|
"circle",
|
|
5403
7176
|
"slide",
|
|
5404
7177
|
"blinds",
|
|
5405
7178
|
"fade",
|
|
5406
7179
|
"none"
|
|
5407
|
-
],
|
|
7180
|
+
], Ti = "wave", Ei = "theme", Di = {
|
|
5408
7181
|
wave: 1100,
|
|
5409
7182
|
circle: 700,
|
|
5410
7183
|
slide: 600,
|
|
5411
7184
|
blinds: 900,
|
|
5412
7185
|
fade: 350,
|
|
5413
7186
|
none: 0
|
|
5414
|
-
},
|
|
5415
|
-
function
|
|
5416
|
-
return e === "dark" || e === "auto" &&
|
|
7187
|
+
}, Oi = "wui-theme-switching", ki = "wui-theme-change", Ai = "wui-theme-toggle", ji = "(prefers-color-scheme: dark)", Mi = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, Ni = (e) => Ci.includes(e);
|
|
7188
|
+
function Pi(e) {
|
|
7189
|
+
return e === "dark" || e === "auto" && Mi(ji) ? "dark" : "light";
|
|
5417
7190
|
}
|
|
5418
|
-
function
|
|
7191
|
+
function Fi(e = Ei, { includeAuto: t = !1 } = {}) {
|
|
5419
7192
|
let n = null;
|
|
5420
7193
|
try {
|
|
5421
7194
|
n = window.localStorage.getItem(e);
|
|
5422
7195
|
} catch {}
|
|
5423
|
-
return !
|
|
7196
|
+
return !Ni(n) || n === "auto" && !t ? "light" : n;
|
|
5424
7197
|
}
|
|
5425
|
-
function
|
|
7198
|
+
function Ii(e, t = Ei) {
|
|
5426
7199
|
try {
|
|
5427
7200
|
window.localStorage.setItem(t, e);
|
|
5428
7201
|
} catch {}
|
|
5429
7202
|
}
|
|
5430
|
-
function
|
|
7203
|
+
function Li(e) {
|
|
5431
7204
|
let t = document.documentElement;
|
|
5432
|
-
t.setAttribute("data-theme", e), t.setAttribute("data-bs-theme",
|
|
7205
|
+
t.setAttribute("data-theme", e), t.setAttribute("data-bs-theme", Pi(e)), document.dispatchEvent(new CustomEvent(ki, { detail: { mode: e } }));
|
|
5433
7206
|
}
|
|
5434
|
-
function
|
|
7207
|
+
function Ri(e, { includeAuto: t = !1 } = {}) {
|
|
5435
7208
|
return e === "light" ? "dark" : e === "dark" && t ? "auto" : "light";
|
|
5436
7209
|
}
|
|
5437
|
-
function
|
|
7210
|
+
function zi(e) {
|
|
5438
7211
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
5439
|
-
let t = window.matchMedia(
|
|
7212
|
+
let t = window.matchMedia(ji), n = () => e(t.matches ? "dark" : "light");
|
|
5440
7213
|
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
5441
7214
|
}
|
|
5442
|
-
var
|
|
7215
|
+
var Bi = 60, Vi = (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2, Z = (e) => e.toFixed(1), Q = (e, t) => `${Z(e)}px ${Z(t)}px`, Hi = {
|
|
5443
7216
|
amplitude: 22,
|
|
5444
7217
|
segments: 36,
|
|
5445
7218
|
cycles: 1.5,
|
|
5446
7219
|
ripples: 2
|
|
5447
|
-
},
|
|
5448
|
-
let { amplitude: a, segments: o, cycles: s } =
|
|
7220
|
+
}, Ui = 6, Wi = (e, t, n, r, i) => {
|
|
7221
|
+
let { amplitude: a, segments: o, cycles: s } = Hi, c = n * (t + 2 * a), l = i ? t + a - c : c - a, u = i ? t + 2 * a : -2 * a, d = [Q(0, u)];
|
|
5449
7222
|
for (let t = 0; t <= o; t++) {
|
|
5450
7223
|
let n = e * t / o, i = l + a * Math.sin(2 * Math.PI * s * t / o + r);
|
|
5451
7224
|
d.push(Q(n, i));
|
|
5452
7225
|
}
|
|
5453
7226
|
return d.push(Q(e, u)), `polygon(${d.join(", ")})`;
|
|
5454
|
-
},
|
|
5455
|
-
let i = t /
|
|
5456
|
-
for (let t = 0; t <
|
|
7227
|
+
}, Gi = (e, t, n, r) => {
|
|
7228
|
+
let i = t / Ui, a = [];
|
|
7229
|
+
for (let t = 0; t < Ui; t++) {
|
|
5457
7230
|
let o = t * i, s = i * n, c = r ? o + i - s : o, l = r ? o + i : o + s;
|
|
5458
7231
|
a.push(Q(0, c), Q(e, c), Q(e, l), Q(0, l));
|
|
5459
7232
|
}
|
|
5460
7233
|
return `polygon(${a.join(", ")})`;
|
|
5461
7234
|
};
|
|
5462
|
-
function
|
|
7235
|
+
function Ki(e, { width: t, height: n, to: r = "dark", origin: i } = {}) {
|
|
5463
7236
|
let a = r === "dark", o = [];
|
|
5464
|
-
for (let r = 0; r <=
|
|
5465
|
-
let s = r /
|
|
7237
|
+
for (let r = 0; r <= Bi; r++) {
|
|
7238
|
+
let s = r / Bi, c = Vi(s);
|
|
5466
7239
|
switch (e) {
|
|
5467
7240
|
case "circle": {
|
|
5468
7241
|
let e = i?.x ?? t / 2, r = i?.y ?? n / 2, a = Math.hypot(Math.max(e, t - e), Math.max(r, n - r));
|
|
@@ -5475,7 +7248,7 @@ function $t(e, { width: t, height: n, to: r = "dark", origin: i } = {}) {
|
|
|
5475
7248
|
break;
|
|
5476
7249
|
}
|
|
5477
7250
|
case "blinds":
|
|
5478
|
-
o.push({ clipPath:
|
|
7251
|
+
o.push({ clipPath: Gi(t, n, c, a) });
|
|
5479
7252
|
break;
|
|
5480
7253
|
case "fade":
|
|
5481
7254
|
o.push({
|
|
@@ -5484,20 +7257,20 @@ function $t(e, { width: t, height: n, to: r = "dark", origin: i } = {}) {
|
|
|
5484
7257
|
});
|
|
5485
7258
|
break;
|
|
5486
7259
|
case "none": return [];
|
|
5487
|
-
default: o.push({ clipPath:
|
|
7260
|
+
default: o.push({ clipPath: Wi(t, n, c, s * Hi.ripples * 2 * Math.PI, a) });
|
|
5488
7261
|
}
|
|
5489
7262
|
}
|
|
5490
7263
|
return o;
|
|
5491
7264
|
}
|
|
5492
|
-
function
|
|
7265
|
+
function qi(e, { effect: t = Ti, to: n, origin: r, duration: i, live: a } = {}) {
|
|
5493
7266
|
let o = document.documentElement, s = n !== void 0 && o.getAttribute("data-bs-theme") === n;
|
|
5494
|
-
if (t === "none" || s ||
|
|
5495
|
-
o.classList.add(
|
|
7267
|
+
if (t === "none" || s || Mi("(prefers-reduced-motion: reduce)") || typeof document.startViewTransition != "function" || typeof o.animate != "function") return e(), Promise.resolve(!1);
|
|
7268
|
+
o.classList.add(Oi);
|
|
5496
7269
|
let c = a instanceof Element ? a : null;
|
|
5497
|
-
c && (c.style.viewTransitionName =
|
|
5498
|
-
let l = document.startViewTransition(e), u = i ??
|
|
7270
|
+
c && (c.style.viewTransitionName = Ai);
|
|
7271
|
+
let l = document.startViewTransition(e), u = i ?? Di[t] ?? Di.wave;
|
|
5499
7272
|
return l.ready.then(() => {
|
|
5500
|
-
let e =
|
|
7273
|
+
let e = Ki(t, {
|
|
5501
7274
|
width: window.innerWidth,
|
|
5502
7275
|
height: window.innerHeight,
|
|
5503
7276
|
to: n,
|
|
@@ -5509,16 +7282,16 @@ function en(e, { effect: t = Mt, to: n, origin: r, duration: i, live: a } = {})
|
|
|
5509
7282
|
fill: "both",
|
|
5510
7283
|
pseudoElement: "::view-transition-new(root)"
|
|
5511
7284
|
});
|
|
5512
|
-
}).catch(() => {}), l.finished.catch(() => {}).then(() => (o.classList.remove(
|
|
7285
|
+
}).catch(() => {}), l.finished.catch(() => {}).then(() => (o.classList.remove(Oi), c && (c.style.viewTransitionName = ""), !0));
|
|
5513
7286
|
}
|
|
5514
7287
|
//#endregion
|
|
5515
7288
|
//#region src/index.js
|
|
5516
7289
|
var $ = (e, t) => {
|
|
5517
7290
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
5518
7291
|
};
|
|
5519
|
-
function
|
|
5520
|
-
$("wui-select",
|
|
7292
|
+
function Ji() {
|
|
7293
|
+
$("wui-select", we), $("wui-country-select", De), $("wui-phone", Gt), $("wui-datepicker", Me), $("wui-date-range", Ne), $("wui-dock", Pe), $("wui-image-crop", ct), $("wui-consent-banner", le), $("wui-slider", Kt), $("wui-sortable", tn), $("wui-timepicker", fn), $("wui-tree", An), $("wui-autocomplete", w), $("wui-command-palette", ne), $("wui-context-menu", Se), $("wui-multiselect", ht), $("wui-taginput", an), $("wui-otp", Dt), $("wui-status-icon", i), $("wui-wizard-step", Pn), $("wui-wizard", Mn);
|
|
5521
7294
|
}
|
|
5522
|
-
|
|
7295
|
+
Ji();
|
|
5523
7296
|
//#endregion
|
|
5524
|
-
export {
|
|
7297
|
+
export { Fn as COPY_FEEDBACK_MS, pn as CSRF_META_NAME, Yn as CURRENCIES, Qn as DATE_PATTERNS, mn as DEFAULT_CSRF_HEADER, Ln as DEFAULT_IMAGE_ACCEPT, Rn as DEFAULT_MAX_SIZE_MB, ti as DEFAULT_PASSWORD_RULES, ni as DEFAULT_REQUIREMENTS_TITLE, Ti as DEFAULT_THEME_EFFECT, Ei as DEFAULT_THEME_STORAGE_KEY, Zn as DURATION_UNITS, er as EMPTY_VALUE, Jn as FORMAT_STYLES, hn as HTTP_KINDS, $n as IST_TIME_ZONE, Er as MASK_INPUT_TYPES, Nr as MASK_NAMES, Xn as MONEY_UNITS, pi as SELECT_ALL_LABEL, X as SELECT_CELL_CLASS, mi as SELECT_ROW_LABEL, r as STATUS_TONES, ki as THEME_CHANGE_EVENT, wi as THEME_EFFECTS, Di as THEME_EFFECT_DURATION, Ai as THEME_LIVE_NAME, Ci as THEME_MODES, Oi as THEME_SWITCHING_CLASS, W as WUI_HEADERS, w as WuiAutocomplete, ne as WuiCommandPalette, le as WuiConsentBanner, Se as WuiContextMenu, De as WuiCountrySelect, Me as WuiDatePicker, Ne as WuiDateRange, Pe as WuiDock, ht as WuiMultiSelect, Dt as WuiOtp, Gt as WuiPhone, we as WuiSelect, Kt as WuiSlider, tn as WuiSortable, i as WuiStatusIcon, an as WuiTagInput, fn as WuiTimePicker, An as WuiTree, Mn as WuiWizard, Pn as WuiWizardStep, Gn as acceptLabel, bi as addRowSelectCells, xi as addSelectColumn, Li as applyTheme, qr as attachInputMask, ii as buildPasswordRules, yn as classifyStatus, In as copyTextToClipboard, Sn as createRequestQueue, gi as createSelectHeaderCell, _i as createSelectRowCell, vi as createSelectSpacerCell, Ji as defineWeborityElements, ai as evaluatePassword, gr as formatCompact, mr as formatCurrency, xr as formatDate, vr as formatDuration, Br as formatMasked, pr as formatNumber, _r as formatPercent, Sr as formatValue, ui as getServerTable, fi as getShell, _ as glyphSvg, ei as initInputMasks, si as initRemoteModals, li as initServerTables, di as initShellParts, Un as isImageFile, Wn as isImageOnlyAccept, Fr as isMaskPattern, ci as loadRemoteModal, Ur as maskedPostValue, D as matchSegments, Kn as matchesAccept, Ri as nextTheme, oi as passwordSatisfies, zr as postedMasked, Rr as rawMasked, _n as readCsrf, Fi as readStoredTheme, Lr as resolveMask, Pi as resolveTheme, Ii as storeTheme, Si as syncSelectAll, Ki as themeKeyframes, yr as toInstant, qi as transitionTheme, qn as validateFile, zi as watchSystemTheme, xn as wuiFetch };
|