@webority/ui-elements 0.12.2 → 0.12.3
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/dist/ui-consent-banner.global.js +196 -0
- package/dist/ui-elements.global.js +246 -73
- package/dist/ui-elements.js +299 -289
- package/package.json +3 -2
package/dist/ui-elements.js
CHANGED
|
@@ -527,7 +527,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
527
527
|
disconnectedCallback() {
|
|
528
528
|
this._teardown();
|
|
529
529
|
}
|
|
530
|
-
}, b = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), x = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), S = "wui-consent-save", ee = "[data-consent-settings]", C = {
|
|
530
|
+
}, b = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), x = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), S = "\n:host {\n all: initial;\n position: fixed;\n bottom: 20px;\n left: 20px;\n right: auto;\n z-index: var(--wui-z-fixed, 1030);\n display: block;\n width: 420px;\n max-width: calc(100vw - 40px);\n font-family: inherit;\n font-size: 16px;\n line-height: 1.5;\n color: var(--color-text, #212529);\n}\n:host([position=\"bottom-right\"]) {\n right: 20px;\n left: auto;\n}\n:host(:not([open])) {\n pointer-events: none;\n}\n*, *::before, *::after {\n box-sizing: border-box;\n}\n[hidden] {\n display: none !important;\n}\n\n.wui-consent-banner-panel {\n padding: 20px;\n background: var(--color-surface, #fff);\n border: 1px solid var(--color-border, #dee2e6);\n border-radius: var(--wui-radius-lg, 12px);\n box-shadow: var(--wui-shadow-overlay-lg, 0 12px 32px rgba(0, 0, 0, 0.16));\n text-align: start;\n pointer-events: auto;\n}\n.wui-consent-banner-heading {\n margin: 0 0 8px;\n font-size: 18px;\n font-weight: 600;\n line-height: 1.3;\n color: var(--color-text, #212529);\n}\n.wui-consent-banner-description {\n margin: 0 0 16px;\n font-size: 14px;\n line-height: 1.5;\n color: var(--color-text-muted, #6c757d);\n}\n.wui-consent-banner-policy {\n color: var(--color-primary, #0d6efd);\n font-weight: 500;\n}\n\n.wui-consent-banner-settings {\n display: grid;\n gap: 12px;\n max-height: 50vh;\n margin: 0 0 16px;\n padding: 12px 0;\n overflow-y: auto;\n border-top: 1px solid var(--color-border, #dee2e6);\n border-bottom: 1px solid var(--color-border, #dee2e6);\n}\n.wui-consent-banner-category-description {\n margin: 2px 0 0;\n padding-inline-start: 2.5em;\n font-size: 12px;\n line-height: 1.4;\n color: var(--color-text-muted, #6c757d);\n}\n\n.form-check {\n display: flex;\n align-items: center;\n gap: 0.5em;\n margin: 0;\n font-size: 14px;\n}\n.form-check-input {\n appearance: none;\n flex: none;\n width: 2em;\n height: 1em;\n margin: 0;\n border: 1px solid var(--color-border, #adb5bd);\n border-radius: 2em;\n background: var(--color-surface, #fff) radial-gradient(circle, var(--color-border, #adb5bd) 0.35em, transparent 0.4em) left / 1em 1em no-repeat;\n cursor: pointer;\n transition: background-position 0.15s ease-in-out;\n}\n.form-check-input:checked {\n border-color: var(--color-primary, #0d6efd);\n background: var(--color-primary, #0d6efd) radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat;\n}\n.form-check-input:disabled {\n opacity: 0.5;\n cursor: default;\n}\n.form-check-input:focus-visible {\n outline: 2px solid var(--color-primary, #0d6efd);\n outline-offset: 2px;\n}\n.form-check-label {\n cursor: pointer;\n}\n\n.wui-consent-banner-actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n}\n.btn {\n display: inline-block;\n padding: 4px 12px;\n border: 1px solid transparent;\n border-radius: var(--wui-radius, 6px);\n background: transparent;\n font: inherit;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.5;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n}\n.btn:focus-visible {\n outline: 2px solid var(--color-primary, #0d6efd);\n outline-offset: 2px;\n}\n.btn-primary {\n background: var(--color-primary, #0d6efd);\n border-color: var(--color-primary, #0d6efd);\n color: #fff;\n}\n.btn-primary:hover {\n background: var(--color-primary-hover, #0b5ed7);\n border-color: var(--color-primary-hover, #0b5ed7);\n}\n.btn-outline-secondary {\n border-color: var(--color-border, #6c757d);\n color: var(--color-text, #212529);\n}\n.btn-outline-secondary:hover {\n background: var(--color-bg-muted, #f1f3f5);\n}\n.btn-link {\n color: var(--color-primary, #0d6efd);\n text-decoration: underline;\n}\n.wui-consent-banner-settings-toggle {\n margin-inline-end: auto;\n padding-inline: 0;\n}\n.wui-consent-banner-save {\n flex: 1 1 100%;\n}\n\n@media (max-width: 480px) {\n :host,\n :host([position=\"bottom-right\"]) {\n left: 12px;\n right: 12px;\n bottom: 12px;\n width: auto;\n max-width: none;\n }\n}\n", ee = "wui-consent-save", te = "[data-consent-settings]", C = {
|
|
531
531
|
heading: "Cookies on this site",
|
|
532
532
|
description: "We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.",
|
|
533
533
|
policyLabel: "Cookie policy",
|
|
@@ -547,7 +547,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
547
547
|
"analytics",
|
|
548
548
|
"functional",
|
|
549
549
|
"marketing"
|
|
550
|
-
], T = 0,
|
|
550
|
+
], T = 0, ne = class extends e {
|
|
551
551
|
static get observedAttributes() {
|
|
552
552
|
return [
|
|
553
553
|
"heading",
|
|
@@ -565,7 +565,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
565
565
|
functional: !1,
|
|
566
566
|
marketing: !1
|
|
567
567
|
}, this._settings = !1, this._onDocumentClick = (e) => {
|
|
568
|
-
e.target instanceof Element && e.target.closest(
|
|
568
|
+
e.target instanceof Element && e.target.closest(te) && (e.preventDefault(), this.open({
|
|
569
569
|
settings: !0,
|
|
570
570
|
focus: !0
|
|
571
571
|
}));
|
|
@@ -577,6 +577,12 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
577
577
|
set position(e) {
|
|
578
578
|
this.setAttribute("position", String(e ?? "bottom-left"));
|
|
579
579
|
}
|
|
580
|
+
get standalone() {
|
|
581
|
+
return this.hasAttribute("standalone");
|
|
582
|
+
}
|
|
583
|
+
set standalone(e) {
|
|
584
|
+
this.toggleAttribute("standalone", e === !0 || e === "" || e === "true");
|
|
585
|
+
}
|
|
580
586
|
get heading() {
|
|
581
587
|
return this.getAttribute("heading") || C.heading;
|
|
582
588
|
}
|
|
@@ -642,16 +648,16 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
642
648
|
this._rendered && this.render();
|
|
643
649
|
}
|
|
644
650
|
render() {
|
|
645
|
-
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${
|
|
646
|
-
|
|
651
|
+
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${re(this.policyHref)}">${D(this.policyLabel)}</a>` : "", r = this._root();
|
|
652
|
+
r.innerHTML = `${r === this ? "" : `<style>${S}</style>`}
|
|
647
653
|
<div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden>
|
|
648
|
-
<h2 class="wui-consent-banner-heading" id="${t}-heading">${
|
|
649
|
-
<p class="wui-consent-banner-description" id="${t}-description">${
|
|
654
|
+
<h2 class="wui-consent-banner-heading" id="${t}-heading">${D(this.heading)}</h2>
|
|
655
|
+
<p class="wui-consent-banner-description" id="${t}-description">${D(this.description)}${n}</p>
|
|
650
656
|
<div class="wui-consent-banner-settings" hidden>
|
|
651
|
-
${
|
|
652
|
-
${
|
|
653
|
-
${
|
|
654
|
-
${
|
|
657
|
+
${E(t, "essential", C.essentialLabel, C.essentialDescription, !0)}
|
|
658
|
+
${E(t, "analytics", C.analyticsLabel, this.analyticsDescription, !1)}
|
|
659
|
+
${E(t, "functional", C.functionalLabel, this.functionalDescription, !1)}
|
|
660
|
+
${E(t, "marketing", C.marketingLabel, this.marketingDescription, !1)}
|
|
655
661
|
</div>
|
|
656
662
|
<div class="wui-consent-banner-actions">
|
|
657
663
|
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${C.settingsLabel}</button>
|
|
@@ -662,28 +668,32 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
662
668
|
</div>`, this._rendered = !0, this._wire(), this._applyPreferences(), this._showSettings(this._settings), e && (this._panel().hidden = !1);
|
|
663
669
|
}
|
|
664
670
|
open({ settings: e = !1, focus: t = !1 } = {}) {
|
|
665
|
-
this._rendered || this.render(), this._applyPreferences(), this._showSettings(e), this._panel().hidden = !1, this.setAttribute("open", ""), t && (e ? this.querySelector(".wui-consent-banner-category input:not([disabled])") : this.querySelector(".wui-consent-banner-accept"))?.focus();
|
|
671
|
+
this._rendered || this.render(), this._applyPreferences(), this._showSettings(e), this._panel().hidden = !1, this.setAttribute("open", ""), t && (e ? this._root().querySelector(".wui-consent-banner-category input:not([disabled])") : this._root().querySelector(".wui-consent-banner-accept"))?.focus();
|
|
666
672
|
}
|
|
667
673
|
close() {
|
|
668
674
|
let e = this._panel();
|
|
669
675
|
e && (e.hidden = !0), this.removeAttribute("open"), this._showSettings(!1);
|
|
670
676
|
}
|
|
677
|
+
_root() {
|
|
678
|
+
return this.shadowRoot ? this.shadowRoot : this.standalone ? this.attachShadow({ mode: "open" }) : this;
|
|
679
|
+
}
|
|
671
680
|
_panel() {
|
|
672
|
-
return this.querySelector(".wui-consent-banner-panel");
|
|
681
|
+
return this._root().querySelector(".wui-consent-banner-panel");
|
|
673
682
|
}
|
|
674
683
|
_wire() {
|
|
675
|
-
|
|
684
|
+
let e = this._root();
|
|
685
|
+
e.querySelector(".wui-consent-banner-accept")?.addEventListener("click", () => this._save({
|
|
676
686
|
analytics: !0,
|
|
677
687
|
functional: !0,
|
|
678
688
|
marketing: !0
|
|
679
|
-
})),
|
|
689
|
+
})), e.querySelector(".wui-consent-banner-reject")?.addEventListener("click", () => this._save({
|
|
680
690
|
analytics: !1,
|
|
681
691
|
functional: !1,
|
|
682
692
|
marketing: !1
|
|
683
|
-
})),
|
|
693
|
+
})), 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));
|
|
684
694
|
}
|
|
685
695
|
_save(e) {
|
|
686
|
-
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(
|
|
696
|
+
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(ee, {
|
|
687
697
|
bubbles: !0,
|
|
688
698
|
composed: !0,
|
|
689
699
|
detail: { ...e }
|
|
@@ -691,39 +701,39 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
691
701
|
}
|
|
692
702
|
_switchValues() {
|
|
693
703
|
let e = {};
|
|
694
|
-
for (let t of w) e[t] = this.querySelector(`input[data-category="${t}"]`)?.checked === !0;
|
|
704
|
+
for (let t of w) e[t] = this._root().querySelector(`input[data-category="${t}"]`)?.checked === !0;
|
|
695
705
|
return e;
|
|
696
706
|
}
|
|
697
707
|
_applyPreferences() {
|
|
698
708
|
for (let e of w) {
|
|
699
|
-
let t = this.querySelector(`input[data-category="${e}"]`);
|
|
709
|
+
let t = this._root().querySelector(`input[data-category="${e}"]`);
|
|
700
710
|
t && (t.checked = this._preferences[e]);
|
|
701
711
|
}
|
|
702
712
|
}
|
|
703
713
|
_showSettings(e) {
|
|
704
714
|
this._settings = e;
|
|
705
|
-
let t = this.querySelector(".wui-consent-banner-settings");
|
|
706
|
-
if (!
|
|
707
|
-
|
|
708
|
-
let
|
|
709
|
-
|
|
710
|
-
for (let
|
|
711
|
-
let
|
|
712
|
-
|
|
715
|
+
let t = this._root(), n = t.querySelector(".wui-consent-banner-settings");
|
|
716
|
+
if (!n) return;
|
|
717
|
+
n.hidden = !e, t.querySelector(".wui-consent-banner-settings-toggle")?.setAttribute("aria-expanded", e ? "true" : "false");
|
|
718
|
+
let r = t.querySelector(".wui-consent-banner-save");
|
|
719
|
+
r && (r.hidden = !e);
|
|
720
|
+
for (let n of [".wui-consent-banner-reject", ".wui-consent-banner-accept"]) {
|
|
721
|
+
let r = t.querySelector(n);
|
|
722
|
+
r && (r.hidden = e);
|
|
713
723
|
}
|
|
714
724
|
}
|
|
715
725
|
};
|
|
716
|
-
function
|
|
726
|
+
function E(e, t, n, r, i) {
|
|
717
727
|
let a = `${e}-${t}`;
|
|
718
728
|
return `<div class="wui-consent-banner-category">
|
|
719
729
|
<div class="form-check form-switch">
|
|
720
730
|
<input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i ? " checked disabled" : ""} />
|
|
721
|
-
<label class="form-check-label" for="${a}">${
|
|
731
|
+
<label class="form-check-label" for="${a}">${D(n)}</label>
|
|
722
732
|
</div>
|
|
723
|
-
<p class="wui-consent-banner-category-description">${
|
|
733
|
+
<p class="wui-consent-banner-category-description">${D(r)}</p>
|
|
724
734
|
</div>`;
|
|
725
735
|
}
|
|
726
|
-
var
|
|
736
|
+
var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), re = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), O = [
|
|
727
737
|
"January",
|
|
728
738
|
"February",
|
|
729
739
|
"March",
|
|
@@ -736,7 +746,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
736
746
|
"October",
|
|
737
747
|
"November",
|
|
738
748
|
"December"
|
|
739
|
-
],
|
|
749
|
+
], k = [
|
|
740
750
|
"Su",
|
|
741
751
|
"Mo",
|
|
742
752
|
"Tu",
|
|
@@ -744,24 +754,24 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
744
754
|
"Th",
|
|
745
755
|
"Fr",
|
|
746
756
|
"Sa"
|
|
747
|
-
],
|
|
757
|
+
], ie = (e) => String(e).padStart(2, "0"), A = (e, t, n) => `${e}-${ie(t + 1)}-${ie(n)}`, j = (e) => {
|
|
748
758
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
749
759
|
return t ? {
|
|
750
760
|
y: +t[1],
|
|
751
761
|
m: t[2] - 1,
|
|
752
762
|
d: +t[3]
|
|
753
763
|
} : null;
|
|
754
|
-
},
|
|
755
|
-
let t =
|
|
756
|
-
return t ? `${
|
|
757
|
-
},
|
|
764
|
+
}, M = (e) => {
|
|
765
|
+
let t = j(e);
|
|
766
|
+
return t ? `${ie(t.d)} ${O[t.m].slice(0, 3)} ${t.y}` : "";
|
|
767
|
+
}, N = (e, t) => new Date(e, t + 1, 0).getDate(), P = (e, t) => {
|
|
758
768
|
for (; t < 0;) t += 12, --e;
|
|
759
769
|
for (; t > 11;) t -= 12, e += 1;
|
|
760
770
|
return {
|
|
761
771
|
y: e,
|
|
762
772
|
m: t
|
|
763
773
|
};
|
|
764
|
-
},
|
|
774
|
+
}, ae = class extends e {
|
|
765
775
|
static formAssociated = !0;
|
|
766
776
|
static get observedAttributes() {
|
|
767
777
|
return [
|
|
@@ -812,13 +822,13 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
812
822
|
}
|
|
813
823
|
render() {
|
|
814
824
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
815
|
-
let e = this.getAttribute("placeholder") || "Enter Date", t =
|
|
825
|
+
let e = this.getAttribute("placeholder") || "Enter Date", t = j(this._value);
|
|
816
826
|
t && (this._viewY = t.y, this._viewM = t.m);
|
|
817
827
|
let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "", i = this.getAttribute("aria-label"), a = this.getAttribute("aria-describedby");
|
|
818
828
|
this.innerHTML = `
|
|
819
829
|
<div class="datepicker">
|
|
820
830
|
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${g(i)}"` : ""}${a ? ` aria-describedby="${g(a)}"` : ""}>
|
|
821
|
-
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ?
|
|
831
|
+
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? M(this._value) : g(e)}</span>
|
|
822
832
|
${p("calendar-dots")}
|
|
823
833
|
</button>
|
|
824
834
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
@@ -830,11 +840,11 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
830
840
|
_syncTrigger() {
|
|
831
841
|
let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
832
842
|
if (!t) return;
|
|
833
|
-
let n =
|
|
834
|
-
t.textContent = n ?
|
|
843
|
+
let n = j(this._value);
|
|
844
|
+
t.textContent = n ? M(this._value) : this.getAttribute("placeholder") || "Enter Date", t.classList.toggle("search-select-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
835
845
|
}
|
|
836
846
|
_limits() {
|
|
837
|
-
let e =
|
|
847
|
+
let e = j(this.getAttribute("min")), t = j(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;
|
|
838
848
|
return {
|
|
839
849
|
dayDisabled: (e, t, i) => {
|
|
840
850
|
let a = new Date(e, t, i).getTime();
|
|
@@ -842,7 +852,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
842
852
|
},
|
|
843
853
|
monthDisabled: (e, t) => {
|
|
844
854
|
let i = new Date(e, t, 1).getTime();
|
|
845
|
-
return new Date(e, t,
|
|
855
|
+
return new Date(e, t, N(e, t)).getTime() < n || i > r;
|
|
846
856
|
},
|
|
847
857
|
yearDisabled: (e) => {
|
|
848
858
|
let t = new Date(e, 0, 1).getTime();
|
|
@@ -855,28 +865,28 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
855
865
|
e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
|
|
856
866
|
}
|
|
857
867
|
_daysHtml() {
|
|
858
|
-
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n =
|
|
868
|
+
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n = N(this._viewY, this._viewM), r = j(this._value), i = /* @__PURE__ */ new Date(), { dayDisabled: a } = this._limits(), o = this._focus || r || {
|
|
859
869
|
y: this._viewY,
|
|
860
870
|
m: this._viewM,
|
|
861
871
|
d: 1
|
|
862
872
|
}, s = (e, t, n, s) => {
|
|
863
|
-
let c =
|
|
873
|
+
let c = A(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);
|
|
864
874
|
return `<button type="button" class="${[
|
|
865
875
|
"datepicker-day",
|
|
866
876
|
s ? "is-outside" : "",
|
|
867
877
|
u ? "is-today" : "",
|
|
868
878
|
l ? "is-selected" : ""
|
|
869
879
|
].filter(Boolean).join(" ")}" data-iso="${c}" role="gridcell" tabindex="${d && !f ? "0" : "-1"}"${l ? " aria-selected=\"true\"" : ""}${f ? " disabled aria-disabled=\"true\"" : ""}>${n}</button>`;
|
|
870
|
-
}, c = "", l =
|
|
880
|
+
}, c = "", l = P(this._viewY, this._viewM - 1), u = N(l.y, l.m);
|
|
871
881
|
for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
872
882
|
for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
|
|
873
|
-
let d =
|
|
883
|
+
let d = P(this._viewY, this._viewM + 1), f = (7 - (t + n) % 7) % 7;
|
|
874
884
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
875
|
-
let m =
|
|
885
|
+
let m = k.map((t, n) => k[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
|
|
876
886
|
return `
|
|
877
887
|
<div class="datepicker-head">
|
|
878
888
|
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p("chevron-left")}</button>
|
|
879
|
-
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${
|
|
889
|
+
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${O[this._viewM]} ${this._viewY}</button>
|
|
880
890
|
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${p("chevron-right")}</button>
|
|
881
891
|
</div>
|
|
882
892
|
<div class="datepicker-weekdays">${m}</div>
|
|
@@ -887,14 +897,14 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
887
897
|
</div>`;
|
|
888
898
|
}
|
|
889
899
|
_monthsHtml() {
|
|
890
|
-
let e =
|
|
900
|
+
let e = j(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
|
|
891
901
|
for (let i = 0; i < 12; i++) {
|
|
892
902
|
let a = e && e.y === this._viewY && e.m === i, o = t.getFullYear() === this._viewY && t.getMonth() === i, s = n(this._viewY, i), c = [
|
|
893
903
|
"datepicker-cell",
|
|
894
904
|
o ? "is-today" : "",
|
|
895
905
|
a ? "is-selected" : ""
|
|
896
906
|
].filter(Boolean).join(" ");
|
|
897
|
-
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${
|
|
907
|
+
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${O[i].slice(0, 3)}</button>`;
|
|
898
908
|
}
|
|
899
909
|
return `
|
|
900
910
|
<div class="datepicker-head">
|
|
@@ -905,7 +915,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
905
915
|
<div class="datepicker-cells">${r}</div>`;
|
|
906
916
|
}
|
|
907
917
|
_yearsHtml() {
|
|
908
|
-
let e =
|
|
918
|
+
let e = j(this._value), t = (/* @__PURE__ */ new Date()).getFullYear(), { yearDisabled: n } = this._limits(), r = this._viewY - (this._viewY % 10 + 10) % 10 - 1, i = "";
|
|
909
919
|
for (let a = 0; a < 12; a++) {
|
|
910
920
|
let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
|
|
911
921
|
"datepicker-cell",
|
|
@@ -930,21 +940,21 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
930
940
|
s(e, t, { clampHeight: !0 });
|
|
931
941
|
}
|
|
932
942
|
_setFocus(e, t, n, r) {
|
|
933
|
-
let { y: i, m: a } =
|
|
943
|
+
let { y: i, m: a } = P(e, t);
|
|
934
944
|
this._focus = {
|
|
935
945
|
y: i,
|
|
936
946
|
m: a,
|
|
937
947
|
d: n
|
|
938
948
|
};
|
|
939
949
|
let o = i !== this._viewY || a !== this._viewM;
|
|
940
|
-
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${
|
|
950
|
+
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${A(i, a, n)}"]`)?.focus();
|
|
941
951
|
}
|
|
942
952
|
_onKey(e) {
|
|
943
953
|
if (this._mode !== "days") {
|
|
944
954
|
e.key === "Escape" && this._close();
|
|
945
955
|
return;
|
|
946
956
|
}
|
|
947
|
-
let t = this._focus ||
|
|
957
|
+
let t = this._focus || j(this._value) || {
|
|
948
958
|
y: this._viewY,
|
|
949
959
|
m: this._viewM,
|
|
950
960
|
d: 1
|
|
@@ -962,17 +972,17 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
962
972
|
case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
|
|
963
973
|
case "PageUp": {
|
|
964
974
|
e.preventDefault();
|
|
965
|
-
let n =
|
|
966
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
975
|
+
let n = P(t.y, t.m - (e.shiftKey ? 12 : 1));
|
|
976
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, N(n.y, n.m)), "slide-prev");
|
|
967
977
|
}
|
|
968
978
|
case "PageDown": {
|
|
969
979
|
e.preventDefault();
|
|
970
|
-
let n =
|
|
971
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
980
|
+
let n = P(t.y, t.m + (e.shiftKey ? 12 : 1));
|
|
981
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, N(n.y, n.m)), "slide-next");
|
|
972
982
|
}
|
|
973
983
|
case "Enter":
|
|
974
984
|
case " ":
|
|
975
|
-
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value =
|
|
985
|
+
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value = A(t.y, t.m, t.d), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
|
|
976
986
|
return;
|
|
977
987
|
case "Escape": return this._close();
|
|
978
988
|
default:
|
|
@@ -984,7 +994,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
984
994
|
if (!e || !t) return;
|
|
985
995
|
let r = () => !t.hidden;
|
|
986
996
|
this._open = () => {
|
|
987
|
-
let r = /* @__PURE__ */ new Date(), i =
|
|
997
|
+
let r = /* @__PURE__ */ new Date(), i = j(this._value);
|
|
988
998
|
(i || !this._viewNavigated) && (this._viewY = r.getFullYear(), this._viewM = r.getMonth()), this._mode = "days";
|
|
989
999
|
let a = r.getFullYear() === this._viewY && r.getMonth() === this._viewM, o = i && i.y === this._viewY && i.m === this._viewM;
|
|
990
1000
|
this._focus = o ? i : {
|
|
@@ -999,7 +1009,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
999
1009
|
let t = e.target.closest("[data-nav]");
|
|
1000
1010
|
if (t) {
|
|
1001
1011
|
this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
|
|
1002
|
-
let e =
|
|
1012
|
+
let e = P(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
1003
1013
|
this._viewY = e.y, this._viewM = e.m, this._focus = {
|
|
1004
1014
|
y: e.y,
|
|
1005
1015
|
m: e.m,
|
|
@@ -1038,7 +1048,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1038
1048
|
}
|
|
1039
1049
|
if (e.target.closest("[data-today]")) {
|
|
1040
1050
|
let e = /* @__PURE__ */ new Date();
|
|
1041
|
-
this.value =
|
|
1051
|
+
this.value = A(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
|
|
1042
1052
|
return;
|
|
1043
1053
|
}
|
|
1044
1054
|
if (e.target.closest("[data-clear]")) {
|
|
@@ -1066,7 +1076,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1066
1076
|
disconnectedCallback() {
|
|
1067
1077
|
this._teardown();
|
|
1068
1078
|
}
|
|
1069
|
-
},
|
|
1079
|
+
}, oe = class extends e {
|
|
1070
1080
|
static formAssociated = !0;
|
|
1071
1081
|
static get observedAttributes() {
|
|
1072
1082
|
return [
|
|
@@ -1125,13 +1135,13 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1125
1135
|
text: e,
|
|
1126
1136
|
empty: !0
|
|
1127
1137
|
} : {
|
|
1128
|
-
text: `${
|
|
1138
|
+
text: `${M(this._start) || "Start"} – ${M(this._end) || "End"}`,
|
|
1129
1139
|
empty: !1
|
|
1130
1140
|
};
|
|
1131
1141
|
}
|
|
1132
1142
|
render() {
|
|
1133
1143
|
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);
|
|
1134
|
-
let e =
|
|
1144
|
+
let e = j(this._start);
|
|
1135
1145
|
e && (this._viewY = e.y, this._viewM = e.m);
|
|
1136
1146
|
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");
|
|
1137
1147
|
this.innerHTML = `
|
|
@@ -1165,24 +1175,24 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1165
1175
|
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");
|
|
1166
1176
|
}
|
|
1167
1177
|
_limits() {
|
|
1168
|
-
let e =
|
|
1178
|
+
let e = j(this.getAttribute("min")), t = j(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;
|
|
1169
1179
|
return (e, t, i) => {
|
|
1170
1180
|
let a = new Date(e, t, i).getTime();
|
|
1171
1181
|
return a < n || a > r;
|
|
1172
1182
|
};
|
|
1173
1183
|
}
|
|
1174
1184
|
_monthHtml(e, t) {
|
|
1175
|
-
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i =
|
|
1176
|
-
let i =
|
|
1185
|
+
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = N(e, t), a = this._limits(), o = k.map((e, t) => k[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
|
|
1186
|
+
let i = A(e, t, n), o = a(e, t, n);
|
|
1177
1187
|
return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
|
|
1178
|
-
}, c = "", l =
|
|
1188
|
+
}, c = "", l = P(e, t - 1), u = N(l.y, l.m);
|
|
1179
1189
|
for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
1180
1190
|
for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
|
|
1181
|
-
let d =
|
|
1191
|
+
let d = P(e, t + 1), f = (7 - (r + i) % 7) % 7;
|
|
1182
1192
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
1183
1193
|
return `
|
|
1184
1194
|
<div class="daterange-cal">
|
|
1185
|
-
<div class="datepicker-month-label">${
|
|
1195
|
+
<div class="datepicker-month-label">${O[t]} ${e}</div>
|
|
1186
1196
|
<div class="datepicker-weekdays">${o}</div>
|
|
1187
1197
|
<div class="datepicker-grid" role="grid">${c}</div>
|
|
1188
1198
|
</div>`;
|
|
@@ -1190,7 +1200,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1190
1200
|
_renderView() {
|
|
1191
1201
|
let e = this.querySelector(".daterange-pop");
|
|
1192
1202
|
if (!e) return;
|
|
1193
|
-
let t =
|
|
1203
|
+
let t = P(this._viewY, this._viewM + 1);
|
|
1194
1204
|
e.innerHTML = `
|
|
1195
1205
|
<div class="daterange-head">
|
|
1196
1206
|
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p("chevron-left")}</button>
|
|
@@ -1216,7 +1226,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1216
1226
|
n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
|
|
1217
1227
|
}
|
|
1218
1228
|
let i = e.querySelector("[data-range-hint]");
|
|
1219
|
-
i && (i.textContent = this._start ? this._end ? `${
|
|
1229
|
+
i && (i.textContent = this._start ? this._end ? `${M(this._start)} – ${M(this._end)}` : "Pick an end date" : "Pick a start date");
|
|
1220
1230
|
}
|
|
1221
1231
|
_position(e, t) {
|
|
1222
1232
|
s(e, t, { clampHeight: !0 });
|
|
@@ -1238,7 +1248,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1238
1248
|
if (!e || !t) return;
|
|
1239
1249
|
let r = () => !t.hidden;
|
|
1240
1250
|
this._open = () => {
|
|
1241
|
-
let r =
|
|
1251
|
+
let r = j(this._start);
|
|
1242
1252
|
if (r) this._viewY = r.y, this._viewM = r.m;
|
|
1243
1253
|
else {
|
|
1244
1254
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -1251,7 +1261,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1251
1261
|
this._popClick = !0;
|
|
1252
1262
|
let t = e.target.closest("[data-nav]");
|
|
1253
1263
|
if (t) {
|
|
1254
|
-
let e =
|
|
1264
|
+
let e = P(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
1255
1265
|
this._viewY = e.y, this._viewM = e.m, this._renderView();
|
|
1256
1266
|
return;
|
|
1257
1267
|
}
|
|
@@ -1281,7 +1291,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1281
1291
|
disconnectedCallback() {
|
|
1282
1292
|
this._teardown();
|
|
1283
1293
|
}
|
|
1284
|
-
},
|
|
1294
|
+
}, se = class extends e {
|
|
1285
1295
|
static get observedAttributes() {
|
|
1286
1296
|
return [
|
|
1287
1297
|
"static",
|
|
@@ -1302,10 +1312,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1302
1312
|
e === "static" && this.isConnected && this._wire();
|
|
1303
1313
|
}
|
|
1304
1314
|
_maxScale() {
|
|
1305
|
-
return
|
|
1315
|
+
return ce(this.getAttribute("max-scale"), 1.6);
|
|
1306
1316
|
}
|
|
1307
1317
|
_radius() {
|
|
1308
|
-
return
|
|
1318
|
+
return ce(this.getAttribute("radius"), 100);
|
|
1309
1319
|
}
|
|
1310
1320
|
_magnifyEnabled() {
|
|
1311
1321
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -1330,10 +1340,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1330
1340
|
_teardown() {
|
|
1331
1341
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
1332
1342
|
}
|
|
1333
|
-
},
|
|
1343
|
+
}, ce = (e, t) => {
|
|
1334
1344
|
let n = Number.parseFloat(e);
|
|
1335
1345
|
return Number.isFinite(n) ? n : t;
|
|
1336
|
-
},
|
|
1346
|
+
}, le = "wui-feedback-submit", F = {
|
|
1337
1347
|
label: "Feedback",
|
|
1338
1348
|
heading: "Share feedback",
|
|
1339
1349
|
placeholder: "What's working, what isn't?",
|
|
@@ -1344,7 +1354,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1344
1354
|
emptyError: "Please write a message before sending.",
|
|
1345
1355
|
failedError: "That didn't send. Please try again.",
|
|
1346
1356
|
thanks: "Thanks — we've got it."
|
|
1347
|
-
},
|
|
1357
|
+
}, ue = 1e4, de = 1600, fe = class extends e {
|
|
1348
1358
|
static get observedAttributes() {
|
|
1349
1359
|
return [
|
|
1350
1360
|
"position",
|
|
@@ -1366,19 +1376,19 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1366
1376
|
this.setAttribute("position", String(e ?? "bottom-right"));
|
|
1367
1377
|
}
|
|
1368
1378
|
get label() {
|
|
1369
|
-
return this.getAttribute("label") ||
|
|
1379
|
+
return this.getAttribute("label") || F.label;
|
|
1370
1380
|
}
|
|
1371
1381
|
set label(e) {
|
|
1372
1382
|
this.setAttribute("label", String(e ?? ""));
|
|
1373
1383
|
}
|
|
1374
1384
|
get heading() {
|
|
1375
|
-
return this.getAttribute("heading") ||
|
|
1385
|
+
return this.getAttribute("heading") || F.heading;
|
|
1376
1386
|
}
|
|
1377
1387
|
set heading(e) {
|
|
1378
1388
|
this.setAttribute("heading", String(e ?? ""));
|
|
1379
1389
|
}
|
|
1380
1390
|
get placeholder() {
|
|
1381
|
-
return this.getAttribute("placeholder") ||
|
|
1391
|
+
return this.getAttribute("placeholder") || F.placeholder;
|
|
1382
1392
|
}
|
|
1383
1393
|
set placeholder(e) {
|
|
1384
1394
|
this.setAttribute("placeholder", String(e ?? ""));
|
|
@@ -1393,10 +1403,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1393
1403
|
return this._open === !0;
|
|
1394
1404
|
}
|
|
1395
1405
|
addEventListener(e, t, n) {
|
|
1396
|
-
e ===
|
|
1406
|
+
e === le && (this._submitListeners += 1), super.addEventListener(e, t, n);
|
|
1397
1407
|
}
|
|
1398
1408
|
removeEventListener(e, t, n) {
|
|
1399
|
-
e ===
|
|
1409
|
+
e === le && this._submitListeners > 0 && --this._submitListeners, super.removeEventListener(e, t, n);
|
|
1400
1410
|
}
|
|
1401
1411
|
connectedCallback() {
|
|
1402
1412
|
this._rendered || this.render();
|
|
@@ -1412,31 +1422,31 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1412
1422
|
this.innerHTML = `
|
|
1413
1423
|
<button type="button" class="feedback-trigger" aria-expanded="false" aria-haspopup="dialog">
|
|
1414
1424
|
<span class="feedback-trigger-icon" aria-hidden="true">${p("message-square", { size: 18 })}</span>
|
|
1415
|
-
<span class="feedback-trigger-label">${
|
|
1425
|
+
<span class="feedback-trigger-label">${pe(this.label)}</span>
|
|
1416
1426
|
</button>
|
|
1417
|
-
<div class="feedback-panel" role="dialog" aria-label="${
|
|
1427
|
+
<div class="feedback-panel" role="dialog" aria-label="${me(this.heading)}" hidden>
|
|
1418
1428
|
<div class="feedback-head">
|
|
1419
|
-
<h2 class="feedback-heading">${
|
|
1429
|
+
<h2 class="feedback-heading">${pe(this.heading)}</h2>
|
|
1420
1430
|
<button type="button" class="feedback-close" aria-label="Close">${p("x", { size: 16 })}</button>
|
|
1421
1431
|
</div>
|
|
1422
1432
|
<div class="feedback-body">
|
|
1423
1433
|
<label class="feedback-field">
|
|
1424
|
-
<span class="feedback-field-label">${
|
|
1425
|
-
<textarea class="feedback-message" rows="4" required placeholder="${
|
|
1434
|
+
<span class="feedback-field-label">${F.messageLabel}</span>
|
|
1435
|
+
<textarea class="feedback-message" rows="4" required placeholder="${me(this.placeholder)}"></textarea>
|
|
1426
1436
|
</label>
|
|
1427
1437
|
${this.collectEmail ? `<label class="feedback-field">
|
|
1428
|
-
<span class="feedback-field-label">${
|
|
1438
|
+
<span class="feedback-field-label">${F.emailLabel}</span>
|
|
1429
1439
|
<input type="email" class="feedback-email" autocomplete="email" placeholder="you@example.com" />
|
|
1430
1440
|
</label>` : ""}
|
|
1431
1441
|
<p class="feedback-error" role="alert" hidden></p>
|
|
1432
1442
|
</div>
|
|
1433
1443
|
<div class="feedback-actions">
|
|
1434
1444
|
<button type="button" class="feedback-cancel">Cancel</button>
|
|
1435
|
-
<button type="button" class="feedback-submit">${
|
|
1445
|
+
<button type="button" class="feedback-submit">${F.submitLabel}</button>
|
|
1436
1446
|
</div>
|
|
1437
1447
|
<div class="feedback-thanks" hidden>
|
|
1438
1448
|
<span class="feedback-thanks-icon" aria-hidden="true">${p("check-circle", { size: 20 })}</span>
|
|
1439
|
-
<span class="feedback-thanks-text">${
|
|
1449
|
+
<span class="feedback-thanks-text">${F.thanks}</span>
|
|
1440
1450
|
</div>
|
|
1441
1451
|
</div>`, this._rendered = !0, this._wire();
|
|
1442
1452
|
let r = this._refs();
|
|
@@ -1474,18 +1484,18 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1474
1484
|
let { thanks: e, error: t, submit: n, message: r, email: i } = this._refs();
|
|
1475
1485
|
this._setBusy(!1), t && (t.hidden = !0, t.textContent = ""), e && (e.hidden = !1), this.querySelector(".feedback-body")?.setAttribute("hidden", ""), this.querySelector(".feedback-actions")?.setAttribute("hidden", ""), n && (n.disabled = !0), this._thanksTimer = setTimeout(() => {
|
|
1476
1486
|
r && (r.value = ""), i && (i.value = ""), this._reset(), this.close();
|
|
1477
|
-
},
|
|
1487
|
+
}, de);
|
|
1478
1488
|
}
|
|
1479
1489
|
failed(e) {
|
|
1480
1490
|
this._clearTimers(), this._state = "error", this._setBusy(!1);
|
|
1481
1491
|
let { error: t, message: n } = this._refs();
|
|
1482
|
-
t && (t.textContent = e ||
|
|
1492
|
+
t && (t.textContent = e || F.failedError, t.hidden = !1), n?.focus();
|
|
1483
1493
|
}
|
|
1484
1494
|
_submit() {
|
|
1485
1495
|
if (this._state === "submitting") return;
|
|
1486
1496
|
let { message: e, email: t, error: n } = this._refs(), r = (e?.value ?? "").trim();
|
|
1487
1497
|
if (!r) {
|
|
1488
|
-
n && (n.textContent =
|
|
1498
|
+
n && (n.textContent = F.emptyError, n.hidden = !1), e?.focus();
|
|
1489
1499
|
return;
|
|
1490
1500
|
}
|
|
1491
1501
|
n && (n.hidden = !0, n.textContent = ""), this._state = "submitting", this._setBusy(!0);
|
|
@@ -1495,7 +1505,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1495
1505
|
surface: this.getAttribute("surface") || "",
|
|
1496
1506
|
screen: this.getAttribute("screen") || ""
|
|
1497
1507
|
};
|
|
1498
|
-
if (this.dispatchEvent(new CustomEvent(
|
|
1508
|
+
if (this.dispatchEvent(new CustomEvent(le, {
|
|
1499
1509
|
bubbles: !0,
|
|
1500
1510
|
composed: !0,
|
|
1501
1511
|
detail: i
|
|
@@ -1505,11 +1515,11 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1505
1515
|
}
|
|
1506
1516
|
this._timer = setTimeout(() => {
|
|
1507
1517
|
this._state === "submitting" && this.failed();
|
|
1508
|
-
},
|
|
1518
|
+
}, ue);
|
|
1509
1519
|
}
|
|
1510
1520
|
_setBusy(e) {
|
|
1511
1521
|
let { submit: t } = this._refs();
|
|
1512
|
-
t && (t.disabled = e, t.textContent = e ?
|
|
1522
|
+
t && (t.disabled = e, t.textContent = e ? F.sendingLabel : F.submitLabel, this.toggleAttribute("busy", e));
|
|
1513
1523
|
}
|
|
1514
1524
|
_reset() {
|
|
1515
1525
|
this._clearTimers(), this._state = "idle", this._setBusy(!1);
|
|
@@ -1519,23 +1529,23 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1519
1529
|
_clearTimers() {
|
|
1520
1530
|
this._timer &&= (clearTimeout(this._timer), 0), this._thanksTimer &&= (clearTimeout(this._thanksTimer), 0);
|
|
1521
1531
|
}
|
|
1522
|
-
},
|
|
1532
|
+
}, pe = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), me = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), he = {
|
|
1523
1533
|
enter: "Enter",
|
|
1524
1534
|
comma: ",",
|
|
1525
1535
|
space: " ",
|
|
1526
1536
|
tab: "Tab"
|
|
1527
|
-
},
|
|
1537
|
+
}, ge = {
|
|
1528
1538
|
enter: "\n",
|
|
1529
1539
|
comma: ",",
|
|
1530
1540
|
space: " ",
|
|
1531
1541
|
tab: " "
|
|
1532
|
-
},
|
|
1533
|
-
function
|
|
1542
|
+
}, _e = (e) => he[e], ve = (e) => ge[e];
|
|
1543
|
+
function ye(e, t) {
|
|
1534
1544
|
let n = [String(e ?? "")];
|
|
1535
1545
|
for (let e of t) n = n.flatMap((t) => t.split(e));
|
|
1536
1546
|
return n.map((e) => e.trim()).filter(Boolean);
|
|
1537
1547
|
}
|
|
1538
|
-
var
|
|
1548
|
+
var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends e {
|
|
1539
1549
|
static formAssociated = !0;
|
|
1540
1550
|
_accessibleName() {
|
|
1541
1551
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1635,7 +1645,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1635
1645
|
[h]: !0,
|
|
1636
1646
|
selected: e.hasAttribute("selected")
|
|
1637
1647
|
};
|
|
1638
|
-
for (let [n, r] of
|
|
1648
|
+
for (let [n, r] of xe) {
|
|
1639
1649
|
let i = e.getAttribute(n);
|
|
1640
1650
|
i && (t[r] = i);
|
|
1641
1651
|
}
|
|
@@ -1666,23 +1676,23 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1666
1676
|
<div class="search-select${a}">
|
|
1667
1677
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : ""}>
|
|
1668
1678
|
${r ? p(r, { className: "search-select-icon" }) : ""}
|
|
1669
|
-
<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="${
|
|
1679
|
+
<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>
|
|
1670
1680
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
1671
1681
|
</div>
|
|
1672
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1682
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1673
1683
|
<div class="search-select-options"></div>
|
|
1674
1684
|
</div>
|
|
1675
1685
|
</div>
|
|
1676
|
-
<div class="field-error wui-ms-custom-error" id="${
|
|
1686
|
+
<div class="field-error wui-ms-custom-error" id="${z(e)}" aria-live="polite" hidden></div>`;
|
|
1677
1687
|
} else this.innerHTML = `
|
|
1678
1688
|
<div class="search-select${a}">
|
|
1679
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
1689
|
+
<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\""}>
|
|
1680
1690
|
${r ? p(r, { className: "search-select-icon" }) : ""}
|
|
1681
1691
|
<div class="ms-chips" data-chips></div>
|
|
1682
1692
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
1683
1693
|
</div>
|
|
1684
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1685
|
-
${t ? `<div class="search-select-search">${p("search")}<input class="search-select-input" placeholder="${
|
|
1694
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1695
|
+
${t ? `<div class="search-select-search">${p("search")}<input class="search-select-input" placeholder="${z(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${p("x")}</button></div>` : ""}
|
|
1686
1696
|
<div class="search-select-options"></div>
|
|
1687
1697
|
<div class="search-select-empty" hidden>No matches</div>
|
|
1688
1698
|
</div>
|
|
@@ -1692,7 +1702,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1692
1702
|
_renderControl() {
|
|
1693
1703
|
let e = this.querySelector("[data-chips]");
|
|
1694
1704
|
if (!e) return;
|
|
1695
|
-
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="${
|
|
1705
|
+
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(B(this._labelFor(e)))}">${p("x")}</button></span>`).join("");
|
|
1696
1706
|
if (n) {
|
|
1697
1707
|
for (let t of [...e.querySelectorAll(":scope > .chip")]) t.remove();
|
|
1698
1708
|
n.insertAdjacentHTML("beforebegin", r), n.placeholder = this._values.length ? "" : t, this._collapseChips();
|
|
@@ -1723,11 +1733,11 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1723
1733
|
i.textContent = `+${t.length - o}`;
|
|
1724
1734
|
}
|
|
1725
1735
|
_matches(e, t) {
|
|
1726
|
-
return
|
|
1736
|
+
return B(e.label).toLowerCase().includes(t) || String(e.description ?? "").toLowerCase().includes(t);
|
|
1727
1737
|
}
|
|
1728
1738
|
_optionNamed(e) {
|
|
1729
1739
|
let t = e.trim().toLowerCase();
|
|
1730
|
-
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t ||
|
|
1740
|
+
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t || B(e.label).trim().toLowerCase() === t);
|
|
1731
1741
|
}
|
|
1732
1742
|
_renderOptions(e) {
|
|
1733
1743
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
@@ -1736,9 +1746,9 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1736
1746
|
i && (a = a.filter((e) => this._matches(e, i)));
|
|
1737
1747
|
let o = this._listboxId || `${this.id || "wui-multiselect"}-listbox`, s = this._allowCustom && r && !this._optionNamed(r), c = a.map((e, t) => {
|
|
1738
1748
|
let n = this._values.includes(String(e.value)), r = `${o}-opt-${t}`;
|
|
1739
|
-
return
|
|
1749
|
+
return Se(e) ? Te(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">${v(e)}</span><span class="ms-check">${p("check")}</span></button>`;
|
|
1740
1750
|
});
|
|
1741
|
-
s && c.push(`<button type="button" role="option" id="${
|
|
1751
|
+
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 “${g(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?.();
|
|
1742
1752
|
}
|
|
1743
1753
|
_combobox() {
|
|
1744
1754
|
return this._allowCustom ? this.querySelector("[data-input]") : this.querySelector(".search-select-control");
|
|
@@ -1751,7 +1761,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1751
1761
|
_customRefusal(e) {
|
|
1752
1762
|
let t = this.getAttribute("custom-invalid-message") || "Enter a valid value.", n = this.getAttribute("custom-pattern");
|
|
1753
1763
|
if (n) {
|
|
1754
|
-
let r =
|
|
1764
|
+
let r = Ee(n);
|
|
1755
1765
|
if (r && !r.test(e)) return t;
|
|
1756
1766
|
}
|
|
1757
1767
|
let r = this._validateCustom;
|
|
@@ -1808,19 +1818,19 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1808
1818
|
else if (a && this._values.some((e) => e.toLowerCase() === t.toLowerCase())) return;
|
|
1809
1819
|
else this._values = [...this._values, t];
|
|
1810
1820
|
this._renderControl(), this._renderOptions(this._query()), S();
|
|
1811
|
-
},
|
|
1821
|
+
}, te = (e) => {
|
|
1812
1822
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(this._query()), S();
|
|
1813
|
-
},
|
|
1814
|
-
let n = this._values.length, r =
|
|
1823
|
+
}, C = (e, { quiet: t = !1 } = {}) => {
|
|
1824
|
+
let n = this._values.length, r = I(e, L) ? ye(e, L) : [e], i = [], a = "";
|
|
1815
1825
|
for (let e of r) {
|
|
1816
1826
|
let t = this._commitTyped(e);
|
|
1817
1827
|
t && (i.push(e.trim()), a ||= t);
|
|
1818
1828
|
}
|
|
1819
1829
|
t && i.length || (o.value = i.join(", "), this._setCustomError(a), this._values.length !== n && (this._renderControl(), S()), this._renderOptions(o.value));
|
|
1820
|
-
},
|
|
1830
|
+
}, w = (e) => {
|
|
1821
1831
|
if (!(!e || e.getAttribute("aria-disabled") === "true")) {
|
|
1822
1832
|
if (e.dataset.custom === "true") {
|
|
1823
|
-
|
|
1833
|
+
C(e.dataset.value);
|
|
1824
1834
|
return;
|
|
1825
1835
|
}
|
|
1826
1836
|
ee(e.dataset.value), o?.value && (o.value = "", this._setCustomError(""), this._renderOptions(""));
|
|
@@ -1830,7 +1840,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1830
1840
|
if (u()) return;
|
|
1831
1841
|
let t = e.target.closest("[data-remove]");
|
|
1832
1842
|
if (t) {
|
|
1833
|
-
e.stopPropagation(),
|
|
1843
|
+
e.stopPropagation(), te(t.dataset.remove), o?.focus();
|
|
1834
1844
|
return;
|
|
1835
1845
|
}
|
|
1836
1846
|
if (o) {
|
|
@@ -1841,7 +1851,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1841
1851
|
v() ? x() : b();
|
|
1842
1852
|
}), i.addEventListener("click", (e) => {
|
|
1843
1853
|
let t = e.target.closest(".search-select-option");
|
|
1844
|
-
t && (
|
|
1854
|
+
t && (w(t), (o || n)?.focus());
|
|
1845
1855
|
}), i.addEventListener("mousemove", (e) => {
|
|
1846
1856
|
let t = e.target.closest(".search-select-option");
|
|
1847
1857
|
t && g(h().indexOf(t));
|
|
@@ -1854,21 +1864,21 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1854
1864
|
getActive: () => this._active,
|
|
1855
1865
|
setActive: (e) => g(e),
|
|
1856
1866
|
onEnter: (e) => {
|
|
1857
|
-
e ?
|
|
1867
|
+
e ? w(e) : o?.value.trim() && C(o.value);
|
|
1858
1868
|
},
|
|
1859
1869
|
onEscape: () => {
|
|
1860
1870
|
this._navHandler.clearTypeahead(), x(), o || e.focus();
|
|
1861
1871
|
}
|
|
1862
1872
|
});
|
|
1863
|
-
let
|
|
1873
|
+
let T = (e) => {
|
|
1864
1874
|
let t = o || n;
|
|
1865
1875
|
if (e.key === "Backspace" && !t?.value && this._values.length) {
|
|
1866
|
-
|
|
1876
|
+
te(this._values[this._values.length - 1]);
|
|
1867
1877
|
return;
|
|
1868
1878
|
}
|
|
1869
1879
|
this._navHandler.handler(e);
|
|
1870
1880
|
};
|
|
1871
|
-
if (n?.addEventListener("keydown",
|
|
1881
|
+
if (n?.addEventListener("keydown", T), r?.addEventListener("click", () => {
|
|
1872
1882
|
n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
|
|
1873
1883
|
}), o) {
|
|
1874
1884
|
let t = (e) => {
|
|
@@ -1878,7 +1888,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1878
1888
|
this._customError && this._setCustomError(""), this._renderOptions(o.value), b();
|
|
1879
1889
|
}), o.addEventListener("keydown", (e) => {
|
|
1880
1890
|
if (e.key === "," && o.value.trim()) {
|
|
1881
|
-
e.preventDefault(),
|
|
1891
|
+
e.preventDefault(), C(o.value);
|
|
1882
1892
|
return;
|
|
1883
1893
|
}
|
|
1884
1894
|
if (e.key === "Enter") {
|
|
@@ -1886,16 +1896,16 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1886
1896
|
this._navHandler.handler(e);
|
|
1887
1897
|
return;
|
|
1888
1898
|
}
|
|
1889
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(),
|
|
1899
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(), T(e);
|
|
1890
1900
|
}), o.addEventListener("paste", (e) => {
|
|
1891
1901
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1892
|
-
|
|
1902
|
+
I(t, L) && (e.preventDefault(), C(`${o.value}${t}`));
|
|
1893
1903
|
}), o.addEventListener("blur", (e) => {
|
|
1894
|
-
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() &&
|
|
1904
|
+
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() && C(o.value, { quiet: !0 }), x());
|
|
1895
1905
|
});
|
|
1896
1906
|
} else e.addEventListener("keydown", (e) => {
|
|
1897
1907
|
if (v()) {
|
|
1898
|
-
|
|
1908
|
+
T(e);
|
|
1899
1909
|
return;
|
|
1900
1910
|
}
|
|
1901
1911
|
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
@@ -1914,35 +1924,35 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1914
1924
|
disconnectedCallback() {
|
|
1915
1925
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
1916
1926
|
}
|
|
1917
|
-
},
|
|
1927
|
+
}, L = [
|
|
1918
1928
|
",",
|
|
1919
1929
|
";",
|
|
1920
1930
|
"\n",
|
|
1921
1931
|
" "
|
|
1922
|
-
],
|
|
1932
|
+
], xe = [
|
|
1923
1933
|
["description", "description"],
|
|
1924
1934
|
["avatar", "avatar"],
|
|
1925
1935
|
["initials", "initials"],
|
|
1926
1936
|
["disabled-hint", "disabledHint"]
|
|
1927
|
-
],
|
|
1937
|
+
], Se = (e) => !!(e.description || e.avatar || e.initials || e.disabled || e.disabledHint), Ce = (e) => {
|
|
1928
1938
|
let t = String(e ?? "").trim();
|
|
1929
1939
|
return /^(https?:)?\/\//i.test(t) || /^\/(?!\/)/.test(t) || /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t) ? t : "";
|
|
1930
|
-
},
|
|
1931
|
-
let t =
|
|
1932
|
-
return !t && !e.initials ? "" : `<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${g(e.initials ?? "")}</span>${t ? `<img class="avatar-img" src="${
|
|
1933
|
-
},
|
|
1940
|
+
}, we = (e) => {
|
|
1941
|
+
let t = Ce(e.avatar);
|
|
1942
|
+
return !t && !e.initials ? "" : `<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${g(e.initials ?? "")}</span>${t ? `<img class="avatar-img" src="${z(t)}" alt="" />` : ""}</span>`;
|
|
1943
|
+
}, Te = (e, t, n) => {
|
|
1934
1944
|
let r = !!e.disabled, i = e.description ? `<span class="wui-opt-desc">${g(e.description)}</span>` : "", a = e.disabledHint && r ? `<span class="wui-opt-hint">${g(e.disabledHint)}</span>` : "";
|
|
1935
|
-
return `<button type="button" role="option" id="${
|
|
1936
|
-
},
|
|
1937
|
-
if (
|
|
1945
|
+
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">${v(e)}</span>${i}</span>${a}${we(e)}<span class="ms-check">${p("check")}</span></button>`;
|
|
1946
|
+
}, R = /* @__PURE__ */ new Map(), Ee = (e) => {
|
|
1947
|
+
if (R.has(e)) return R.get(e);
|
|
1938
1948
|
let t = null;
|
|
1939
1949
|
try {
|
|
1940
1950
|
t = RegExp(`^(?:${e})$`, "u");
|
|
1941
1951
|
} catch {
|
|
1942
1952
|
console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`);
|
|
1943
1953
|
}
|
|
1944
|
-
return
|
|
1945
|
-
},
|
|
1954
|
+
return R.set(e, t), t;
|
|
1955
|
+
}, z = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), B = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), De = /[^0-9]/g, Oe = /[^0-9a-zA-Z]/g, ke = class extends e {
|
|
1946
1956
|
static formAssociated = !0;
|
|
1947
1957
|
static get observedAttributes() {
|
|
1948
1958
|
return [
|
|
@@ -1973,7 +1983,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1973
1983
|
this._value = this._clean(e), d(this, this._value), this._paint();
|
|
1974
1984
|
}
|
|
1975
1985
|
_clean(e) {
|
|
1976
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
1986
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? Oe : De, "").slice(0, this.length);
|
|
1977
1987
|
}
|
|
1978
1988
|
constructor() {
|
|
1979
1989
|
super();
|
|
@@ -2064,7 +2074,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
2064
2074
|
disconnectedCallback() {
|
|
2065
2075
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
2066
2076
|
}
|
|
2067
|
-
},
|
|
2077
|
+
}, V = [
|
|
2068
2078
|
[
|
|
2069
2079
|
"AF",
|
|
2070
2080
|
"Afghanistan",
|
|
@@ -3290,11 +3300,11 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
3290
3300
|
"Zimbabwe",
|
|
3291
3301
|
"263"
|
|
3292
3302
|
]
|
|
3293
|
-
],
|
|
3303
|
+
], H = (e) => (V.find((t) => t[0] === e) || [
|
|
3294
3304
|
"",
|
|
3295
3305
|
"",
|
|
3296
3306
|
""
|
|
3297
|
-
])[2],
|
|
3307
|
+
])[2], Ae = {
|
|
3298
3308
|
AD: ["Europe/Andorra"],
|
|
3299
3309
|
AE: ["Asia/Dubai"],
|
|
3300
3310
|
AF: ["Asia/Kabul"],
|
|
@@ -3696,13 +3706,13 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
3696
3706
|
ZA: ["Africa/Johannesburg"],
|
|
3697
3707
|
ZM: ["Africa/Lusaka"],
|
|
3698
3708
|
ZW: ["Africa/Harare"]
|
|
3699
|
-
},
|
|
3700
|
-
for (let [e, t] of Object.entries(
|
|
3701
|
-
function
|
|
3702
|
-
let t =
|
|
3703
|
-
return t &&
|
|
3709
|
+
}, je = new Set(V.map(([e]) => e)), Me = /* @__PURE__ */ new Map();
|
|
3710
|
+
for (let [e, t] of Object.entries(Ae)) for (let n of t) Me.set(n, e);
|
|
3711
|
+
function Ne(e) {
|
|
3712
|
+
let t = Me.get(e);
|
|
3713
|
+
return t && je.has(t) ? t : null;
|
|
3704
3714
|
}
|
|
3705
|
-
function
|
|
3715
|
+
function Pe(e) {
|
|
3706
3716
|
if (!e) return null;
|
|
3707
3717
|
let t;
|
|
3708
3718
|
try {
|
|
@@ -3710,9 +3720,9 @@ function Me(e) {
|
|
|
3710
3720
|
} catch {
|
|
3711
3721
|
return null;
|
|
3712
3722
|
}
|
|
3713
|
-
return t &&
|
|
3723
|
+
return t && je.has(t) ? t : null;
|
|
3714
3724
|
}
|
|
3715
|
-
function
|
|
3725
|
+
function Fe() {
|
|
3716
3726
|
let e;
|
|
3717
3727
|
try {
|
|
3718
3728
|
e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -3720,77 +3730,77 @@ function Ne() {
|
|
|
3720
3730
|
e = void 0;
|
|
3721
3731
|
}
|
|
3722
3732
|
let t = typeof navigator > "u" ? void 0 : navigator.language;
|
|
3723
|
-
return
|
|
3733
|
+
return Ne(e) || Pe(t) || "IN";
|
|
3724
3734
|
}
|
|
3725
3735
|
//#endregion
|
|
3726
3736
|
//#region src/WuiPhone.js
|
|
3727
|
-
var
|
|
3728
|
-
function
|
|
3729
|
-
return
|
|
3737
|
+
var Ie = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, U = null, Le = null;
|
|
3738
|
+
function Re() {
|
|
3739
|
+
return U ? Promise.resolve(U) : (Le ||= Promise.all([import("./max-BDKx469G.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (U = {
|
|
3730
3740
|
AsYouType: e.AsYouType,
|
|
3731
3741
|
getExampleNumber: e.getExampleNumber,
|
|
3732
3742
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
3733
3743
|
parsePhoneNumber: e.parsePhoneNumber,
|
|
3734
3744
|
examples: t.default || t
|
|
3735
|
-
},
|
|
3745
|
+
}, U)).catch(() => null), Le);
|
|
3736
3746
|
}
|
|
3737
|
-
function
|
|
3738
|
-
let n = `+${
|
|
3747
|
+
function ze(e, t) {
|
|
3748
|
+
let n = `+${H(e)}`;
|
|
3739
3749
|
return t?.startsWith(n) ? t.slice(n.length).trimStart() : null;
|
|
3740
3750
|
}
|
|
3741
|
-
function
|
|
3742
|
-
if (!
|
|
3751
|
+
function W(e, t) {
|
|
3752
|
+
if (!U || !t) return t;
|
|
3743
3753
|
try {
|
|
3744
|
-
return
|
|
3754
|
+
return ze(e, new U.AsYouType(e).input(`+${H(e)}${t}`)) || t;
|
|
3745
3755
|
} catch {
|
|
3746
3756
|
return t;
|
|
3747
3757
|
}
|
|
3748
3758
|
}
|
|
3749
|
-
function
|
|
3759
|
+
function Be(e, t) {
|
|
3750
3760
|
if (t <= 0) return 0;
|
|
3751
3761
|
let n = 0;
|
|
3752
3762
|
for (let r = 0; r < e.length; r++) if (/[0-9]/.test(e[r]) && (n += 1, n === t)) return r + 1;
|
|
3753
3763
|
return e.length;
|
|
3754
3764
|
}
|
|
3755
|
-
function
|
|
3756
|
-
if (!
|
|
3765
|
+
function G(e) {
|
|
3766
|
+
if (!U) return null;
|
|
3757
3767
|
try {
|
|
3758
|
-
return
|
|
3768
|
+
return ze(e, U.getExampleNumber(e, U.examples)?.formatInternational()) || null;
|
|
3759
3769
|
} catch {
|
|
3760
3770
|
return null;
|
|
3761
3771
|
}
|
|
3762
3772
|
}
|
|
3763
|
-
function
|
|
3764
|
-
if (!
|
|
3773
|
+
function Ve(e) {
|
|
3774
|
+
if (!U || !e) return null;
|
|
3765
3775
|
try {
|
|
3766
|
-
if (!
|
|
3767
|
-
let t =
|
|
3776
|
+
if (!U.isValidPhoneNumber(e)) return !1;
|
|
3777
|
+
let t = U.parsePhoneNumber(e)?.getType?.();
|
|
3768
3778
|
return t === void 0 || t === "MOBILE" || t === "FIXED_LINE_OR_MOBILE";
|
|
3769
3779
|
} catch {
|
|
3770
3780
|
return null;
|
|
3771
3781
|
}
|
|
3772
3782
|
}
|
|
3773
|
-
function
|
|
3774
|
-
if (!
|
|
3783
|
+
function He(e) {
|
|
3784
|
+
if (!U) return null;
|
|
3775
3785
|
try {
|
|
3776
|
-
let t =
|
|
3786
|
+
let t = U.getExampleNumber(e, U.examples);
|
|
3777
3787
|
return t?.nationalNumber ? t.nationalNumber.length : null;
|
|
3778
3788
|
} catch {
|
|
3779
3789
|
return null;
|
|
3780
3790
|
}
|
|
3781
3791
|
}
|
|
3782
|
-
function
|
|
3792
|
+
function Ue(e, t, n) {
|
|
3783
3793
|
try {
|
|
3784
|
-
let r =
|
|
3794
|
+
let r = U.parsePhoneNumber(t, e), i = r?.nationalNumber;
|
|
3785
3795
|
return !i || r.country !== e || i.length > n || !t.endsWith(i) ? null : i;
|
|
3786
3796
|
} catch {
|
|
3787
3797
|
return null;
|
|
3788
3798
|
}
|
|
3789
3799
|
}
|
|
3790
|
-
function
|
|
3791
|
-
if (!
|
|
3800
|
+
function We(e) {
|
|
3801
|
+
if (!U || !e?.trim().startsWith("+")) return null;
|
|
3792
3802
|
try {
|
|
3793
|
-
let t = new
|
|
3803
|
+
let t = new U.AsYouType();
|
|
3794
3804
|
t.input(e.trim());
|
|
3795
3805
|
let n = t.getCountry();
|
|
3796
3806
|
return n ? {
|
|
@@ -3801,7 +3811,7 @@ function He(e) {
|
|
|
3801
3811
|
return null;
|
|
3802
3812
|
}
|
|
3803
3813
|
}
|
|
3804
|
-
var
|
|
3814
|
+
var Ge = class extends e {
|
|
3805
3815
|
static formAssociated = !0;
|
|
3806
3816
|
static get observedAttributes() {
|
|
3807
3817
|
return [
|
|
@@ -3821,7 +3831,7 @@ var Ue = class extends e {
|
|
|
3821
3831
|
} catch {
|
|
3822
3832
|
this._internals = null;
|
|
3823
3833
|
}
|
|
3824
|
-
this._defaultCountry =
|
|
3834
|
+
this._defaultCountry = Fe(), this._country = this._defaultCountry, this._national = "", this._active = -1, this._committedValue = "";
|
|
3825
3835
|
}
|
|
3826
3836
|
connectedCallback() {
|
|
3827
3837
|
if (!this._rendered) {
|
|
@@ -3848,13 +3858,13 @@ var Ue = class extends e {
|
|
|
3848
3858
|
this.value = this._defaultValue || "";
|
|
3849
3859
|
}
|
|
3850
3860
|
get value() {
|
|
3851
|
-
return this._national ? `+${
|
|
3861
|
+
return this._national ? `+${H(this._country)}${this._national}` : "";
|
|
3852
3862
|
}
|
|
3853
3863
|
set value(e) {
|
|
3854
|
-
let t = String(e ?? "").trim(), n =
|
|
3864
|
+
let t = String(e ?? "").trim(), n = We(t);
|
|
3855
3865
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
3856
3866
|
else if (t.startsWith("+")) {
|
|
3857
|
-
let e = t.replace(/[^0-9]/g, ""), n = String(
|
|
3867
|
+
let e = t.replace(/[^0-9]/g, ""), n = String(H(this._country));
|
|
3858
3868
|
n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
|
|
3859
3869
|
} else this._national = t.replace(/[^0-9]/g, "");
|
|
3860
3870
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
@@ -3870,25 +3880,25 @@ var Ue = class extends e {
|
|
|
3870
3880
|
}
|
|
3871
3881
|
render() {
|
|
3872
3882
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
|
|
3873
|
-
let e = this.getAttribute("placeholder") ||
|
|
3883
|
+
let e = this.getAttribute("placeholder") || G(this._country) || "Enter phone number";
|
|
3874
3884
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
3875
3885
|
let t = `${this.id}-listbox`;
|
|
3876
3886
|
this._listboxId = t;
|
|
3877
|
-
let n =
|
|
3887
|
+
let n = V.map(([e, n, r], i) => `<button type="button" role="option" id="${K(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${Ie(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
3878
3888
|
this.innerHTML = `
|
|
3879
3889
|
<div class="phone-input-wrap">
|
|
3880
3890
|
<div class="phone-country-adornment">
|
|
3881
|
-
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
3882
|
-
<span class="${
|
|
3891
|
+
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${K(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
3892
|
+
<span class="${Ie(this._country)}" data-flag aria-hidden="true"></span>
|
|
3883
3893
|
${p("chevron-down", { className: "phone-chevron" })}
|
|
3884
|
-
<span class="phone-dial" data-dial>+${
|
|
3894
|
+
<span class="phone-dial" data-dial>+${H(this._country)}</span>
|
|
3885
3895
|
</button>
|
|
3886
|
-
<div class="country-dropdown-menu" role="listbox" id="${
|
|
3887
|
-
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${p("search")}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${
|
|
3896
|
+
<div class="country-dropdown-menu" role="listbox" id="${K(t)}" tabindex="-1" hidden>
|
|
3897
|
+
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${p("search")}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${K(t)}" aria-autocomplete="list" /></div>
|
|
3888
3898
|
<div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
|
|
3889
3899
|
</div>
|
|
3890
3900
|
</div>
|
|
3891
|
-
<input type="tel" class="input" placeholder="${
|
|
3901
|
+
<input type="tel" class="input" placeholder="${K(e)}" value="${K(W(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${K(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${K(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
3892
3902
|
</div>
|
|
3893
3903
|
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, d(this, this.value), this._wire();
|
|
3894
3904
|
}
|
|
@@ -3919,12 +3929,12 @@ var Ue = class extends e {
|
|
|
3919
3929
|
}
|
|
3920
3930
|
a && (a.hidden = n > 0);
|
|
3921
3931
|
}, v = (e) => {
|
|
3922
|
-
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className =
|
|
3932
|
+
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = Ie(e)), d && (d.textContent = `+${H(e)}`);
|
|
3923
3933
|
for (let t of this._itemEls()) {
|
|
3924
3934
|
let n = t.dataset.iso === e;
|
|
3925
3935
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
3926
3936
|
}
|
|
3927
|
-
!this.getAttribute("placeholder") && o && (o.placeholder =
|
|
3937
|
+
!this.getAttribute("placeholder") && o && (o.placeholder = G(e) || "Enter phone number"), o && this._national && (o.value = W(e, this._national)), g(), this._syncMirror(), this._emitChange(), o?.focus();
|
|
3928
3938
|
}, y = (t) => {
|
|
3929
3939
|
let n = this._visibleItems();
|
|
3930
3940
|
if (t.key === "ArrowDown") {
|
|
@@ -3958,7 +3968,7 @@ var Ue = class extends e {
|
|
|
3958
3968
|
let b = this.querySelector("[data-phone-error]"), x = (e) => {
|
|
3959
3969
|
if (o.classList.toggle("is-invalid", e), e ? o.setAttribute("aria-invalid", "true") : o.removeAttribute("aria-invalid"), b) {
|
|
3960
3970
|
if (e) {
|
|
3961
|
-
let e =
|
|
3971
|
+
let e = G(this._country);
|
|
3962
3972
|
b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
|
|
3963
3973
|
}
|
|
3964
3974
|
b.hidden = !e;
|
|
@@ -3966,24 +3976,24 @@ var Ue = class extends e {
|
|
|
3966
3976
|
};
|
|
3967
3977
|
o.addEventListener("input", (e) => {
|
|
3968
3978
|
e.stopPropagation();
|
|
3969
|
-
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 =
|
|
3979
|
+
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 = He(this._country);
|
|
3970
3980
|
if (i && r.length > i) {
|
|
3971
|
-
let e =
|
|
3981
|
+
let e = Ue(this._country, r, i);
|
|
3972
3982
|
e ? (n = Math.max(0, n - (r.length - e.length)), r = e) : r = r.slice(0, i);
|
|
3973
3983
|
}
|
|
3974
3984
|
this._national = r;
|
|
3975
|
-
let a =
|
|
3985
|
+
let a = W(this._country, this._national);
|
|
3976
3986
|
if (o.value !== a) {
|
|
3977
3987
|
o.value = a;
|
|
3978
|
-
let e =
|
|
3988
|
+
let e = Be(a, Math.min(n, r.length));
|
|
3979
3989
|
o.setSelectionRange(e, e);
|
|
3980
3990
|
}
|
|
3981
|
-
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national ||
|
|
3991
|
+
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national || Ve(this.value) === !0) && x(!1);
|
|
3982
3992
|
}), o.addEventListener("change", (e) => e.stopPropagation()), o.addEventListener("blur", () => {
|
|
3983
|
-
x(this._national.length > 0 &&
|
|
3993
|
+
x(this._national.length > 0 && Ve(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
3984
3994
|
}), o.addEventListener("paste", (e) => {
|
|
3985
|
-
let t =
|
|
3986
|
-
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value =
|
|
3995
|
+
let t = We(e.clipboardData?.getData("text"));
|
|
3996
|
+
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value = W(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
|
|
3987
3997
|
}), this._bindGlobal = () => {
|
|
3988
3998
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
3989
3999
|
f() && !this.contains(e.target) && g();
|
|
@@ -3992,9 +4002,9 @@ var Ue = class extends e {
|
|
|
3992
4002
|
});
|
|
3993
4003
|
}, this._teardownGlobals = () => {
|
|
3994
4004
|
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), l(this);
|
|
3995
|
-
}, this._bindGlobal(),
|
|
3996
|
-
if (!(!e || !o.isConnected) && (this._national && (o.value =
|
|
3997
|
-
let e =
|
|
4005
|
+
}, this._bindGlobal(), Re().then((e) => {
|
|
4006
|
+
if (!(!e || !o.isConnected) && (this._national && (o.value = W(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
4007
|
+
let e = G(this._country);
|
|
3998
4008
|
e && (o.placeholder = e);
|
|
3999
4009
|
}
|
|
4000
4010
|
}), this._syncMirror();
|
|
@@ -4005,7 +4015,7 @@ var Ue = class extends e {
|
|
|
4005
4015
|
disconnectedCallback() {
|
|
4006
4016
|
this._teardown();
|
|
4007
4017
|
}
|
|
4008
|
-
},
|
|
4018
|
+
}, K = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), Ke = class extends e {
|
|
4009
4019
|
static formAssociated = !0;
|
|
4010
4020
|
static get observedAttributes() {
|
|
4011
4021
|
return [
|
|
@@ -4094,19 +4104,19 @@ var Ue = class extends e {
|
|
|
4094
4104
|
this._listboxId = u;
|
|
4095
4105
|
let f = e.map((e, t) => {
|
|
4096
4106
|
let n = String(e.value) === String(this._value);
|
|
4097
|
-
return `<button type="button" role="option" id="${
|
|
4107
|
+
return `<button type="button" role="option" id="${q(`${u}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${q(e.value)}" aria-selected="${n}">${v(e)}</button>`;
|
|
4098
4108
|
}).join("");
|
|
4099
4109
|
this.innerHTML = `
|
|
4100
4110
|
<div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
|
|
4101
|
-
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
4111
|
+
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${q(u)}" aria-label="${q(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
4102
4112
|
${a ? p(a, { className: "search-select-icon" }) : ""}
|
|
4103
4113
|
${o ? `<span class="search-select-prefix">${g(o)}</span>` : ""}
|
|
4104
4114
|
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? v(l) : g(s)}</span>
|
|
4105
4115
|
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${p("x")}</span>` : ""}
|
|
4106
4116
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
4107
4117
|
</button>
|
|
4108
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
4109
|
-
${t ? `<div class="search-select-search">${p("search")}<input class="search-select-input" placeholder="${
|
|
4118
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${q(u)}" tabindex="-1" hidden>
|
|
4119
|
+
${t ? `<div class="search-select-search">${p("search")}<input class="search-select-input" placeholder="${q(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${p("x")}</button></div>` : ""}
|
|
4110
4120
|
<div class="search-select-options">${f}<div class="search-select-empty" hidden>No matches</div></div>
|
|
4111
4121
|
</div>
|
|
4112
4122
|
</div>`, this._rendered = !0, d(this, this._value), this._wire(), this._syncReset();
|
|
@@ -4211,7 +4221,7 @@ var Ue = class extends e {
|
|
|
4211
4221
|
disconnectedCallback() {
|
|
4212
4222
|
this._teardown();
|
|
4213
4223
|
}
|
|
4214
|
-
},
|
|
4224
|
+
}, q = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), qe = class extends e {
|
|
4215
4225
|
static formAssociated = !0;
|
|
4216
4226
|
static get observedAttributes() {
|
|
4217
4227
|
return [
|
|
@@ -4251,19 +4261,19 @@ var Ue = class extends e {
|
|
|
4251
4261
|
return this._value;
|
|
4252
4262
|
}
|
|
4253
4263
|
set value(e) {
|
|
4254
|
-
this._value = this._snapToStep(this._clamp(
|
|
4264
|
+
this._value = this._snapToStep(this._clamp(J(e, this._value))), this._syncValue(), this._syncMirrors();
|
|
4255
4265
|
}
|
|
4256
4266
|
get start() {
|
|
4257
4267
|
return this._start;
|
|
4258
4268
|
}
|
|
4259
4269
|
set start(e) {
|
|
4260
|
-
this._start = Math.min(this._snapToStep(this._clamp(
|
|
4270
|
+
this._start = Math.min(this._snapToStep(this._clamp(J(e, this._start))), this._end), this._syncValue(), this._syncMirrors();
|
|
4261
4271
|
}
|
|
4262
4272
|
get end() {
|
|
4263
4273
|
return this._end;
|
|
4264
4274
|
}
|
|
4265
4275
|
set end(e) {
|
|
4266
|
-
this._end = Math.max(this._snapToStep(this._clamp(
|
|
4276
|
+
this._end = Math.max(this._snapToStep(this._clamp(J(e, this._end))), this._start), this._syncValue(), this._syncMirrors();
|
|
4267
4277
|
}
|
|
4268
4278
|
attributeChangedCallback(e, t, n) {
|
|
4269
4279
|
if (e === "value" || e === "start" || e === "end" || e === "min" || e === "max" || e === "step") {
|
|
@@ -4276,19 +4286,19 @@ var Ue = class extends e {
|
|
|
4276
4286
|
this._isRange() ? this._resetRange() : this._resetSingle();
|
|
4277
4287
|
}
|
|
4278
4288
|
_updateFromAttribute(e) {
|
|
4279
|
-
e === "value" ? this._value = this._snapToStep(this._clamp(
|
|
4289
|
+
e === "value" ? this._value = this._snapToStep(this._clamp(J(this.getAttribute("value"), this._value))) : e === "start" ? this._start = this._snapToStep(this._clamp(J(this.getAttribute("start"), this._start))) : e === "end" && (this._end = this._snapToStep(this._clamp(J(this.getAttribute("end"), this._end))));
|
|
4280
4290
|
}
|
|
4281
4291
|
_isRange() {
|
|
4282
4292
|
return this.hasAttribute("range");
|
|
4283
4293
|
}
|
|
4284
4294
|
_min() {
|
|
4285
|
-
return
|
|
4295
|
+
return J(this.getAttribute("min"), 0);
|
|
4286
4296
|
}
|
|
4287
4297
|
_max() {
|
|
4288
|
-
return
|
|
4298
|
+
return J(this.getAttribute("max"), 100);
|
|
4289
4299
|
}
|
|
4290
4300
|
_step() {
|
|
4291
|
-
return
|
|
4301
|
+
return J(this.getAttribute("step"), 1);
|
|
4292
4302
|
}
|
|
4293
4303
|
_clamp(e) {
|
|
4294
4304
|
return Math.max(this._min(), Math.min(e, this._max()));
|
|
@@ -4353,7 +4363,7 @@ var Ue = class extends e {
|
|
|
4353
4363
|
aria-valuenow="${this._value}"
|
|
4354
4364
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
4355
4365
|
${a ? "disabled" : ""}
|
|
4356
|
-
aria-label="${
|
|
4366
|
+
aria-label="${Je(this.getAttribute("aria-label") || "Value")}"
|
|
4357
4367
|
></button>
|
|
4358
4368
|
`}
|
|
4359
4369
|
${this.hasAttribute("show-value") ? n ? `<span class="slider-value">${this._formatValue(this._start)} – ${this._formatValue(this._end)}</span>` : `<span class="slider-value">${this._formatValue(this._value)}</span>` : ""}
|
|
@@ -4453,10 +4463,10 @@ var Ue = class extends e {
|
|
|
4453
4463
|
disconnectedCallback() {
|
|
4454
4464
|
this._teardown();
|
|
4455
4465
|
}
|
|
4456
|
-
},
|
|
4466
|
+
}, J = (e, t) => {
|
|
4457
4467
|
let n = Number.parseFloat(e);
|
|
4458
4468
|
return Number.isFinite(n) ? n : t;
|
|
4459
|
-
},
|
|
4469
|
+
}, Je = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ye = class extends e {
|
|
4460
4470
|
static formAssociated = !0;
|
|
4461
4471
|
_accessibleName() {
|
|
4462
4472
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -4529,7 +4539,7 @@ var Ue = class extends e {
|
|
|
4529
4539
|
d(this, this._values.join(",")), this.innerHTML = `
|
|
4530
4540
|
<div class="search-select${t}">
|
|
4531
4541
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
4532
|
-
<input type="text" class="ms-input" data-input aria-label="${
|
|
4542
|
+
<input type="text" class="ms-input" data-input aria-label="${Y(this._accessibleName())}" placeholder="${Y(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
|
|
4533
4543
|
<div class="ms-chips" data-chips></div>
|
|
4534
4544
|
</div>
|
|
4535
4545
|
</div>`, this._rendered = !0, d(this, this._values.join(",")), this._renderControl(), this._wire();
|
|
@@ -4541,14 +4551,14 @@ var Ue = class extends e {
|
|
|
4541
4551
|
e.innerHTML = "";
|
|
4542
4552
|
return;
|
|
4543
4553
|
}
|
|
4544
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
4554
|
+
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${Xe(e)}</span><button type="button" class="chip-remove" data-remove="${Y(e)}" aria-label="Remove ${Y(e)}">${p("x")}</button></span>`).join("");
|
|
4545
4555
|
}
|
|
4546
4556
|
}
|
|
4547
4557
|
_wire() {
|
|
4548
4558
|
this._teardown();
|
|
4549
4559
|
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
4550
4560
|
if (!e || !t) return;
|
|
4551
|
-
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(
|
|
4561
|
+
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(_e).filter(Boolean)), s = () => {
|
|
4552
4562
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
4553
4563
|
}, c = (e) => {
|
|
4554
4564
|
let t = e.trim();
|
|
@@ -4580,9 +4590,9 @@ var Ue = class extends e {
|
|
|
4580
4590
|
e.preventDefault();
|
|
4581
4591
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
4582
4592
|
for (let e of r) {
|
|
4583
|
-
let t =
|
|
4584
|
-
if (
|
|
4585
|
-
a.push(...
|
|
4593
|
+
let t = ve(e) ?? e;
|
|
4594
|
+
if (I(n, [t])) {
|
|
4595
|
+
a.push(...ye(n, [t]));
|
|
4586
4596
|
break;
|
|
4587
4597
|
}
|
|
4588
4598
|
}
|
|
@@ -4610,18 +4620,18 @@ var Ue = class extends e {
|
|
|
4610
4620
|
disconnectedCallback() {
|
|
4611
4621
|
this._teardown();
|
|
4612
4622
|
}
|
|
4613
|
-
},
|
|
4623
|
+
}, Xe = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Y = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ze = (e) => String(e).padStart(2, "0"), Qe = (e, t) => `${Ze(e)}:${Ze(t)}`, X = (e) => {
|
|
4614
4624
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
4615
4625
|
return t ? {
|
|
4616
4626
|
h: +t[1],
|
|
4617
4627
|
m: +t[2]
|
|
4618
4628
|
} : null;
|
|
4619
|
-
},
|
|
4629
|
+
}, $e = (e, t = "24") => {
|
|
4620
4630
|
if (!e) return "";
|
|
4621
|
-
if (t === "24") return
|
|
4631
|
+
if (t === "24") return Qe(e.h, e.m);
|
|
4622
4632
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
4623
|
-
return `${n}:${
|
|
4624
|
-
},
|
|
4633
|
+
return `${n}:${Ze(e.m)} ${r}`;
|
|
4634
|
+
}, et = class extends e {
|
|
4625
4635
|
static formAssociated = !0;
|
|
4626
4636
|
static get observedAttributes() {
|
|
4627
4637
|
return [
|
|
@@ -4668,11 +4678,11 @@ var Ue = class extends e {
|
|
|
4668
4678
|
}
|
|
4669
4679
|
render() {
|
|
4670
4680
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
4671
|
-
let e = this.getAttribute("placeholder") || "Select time", t =
|
|
4681
|
+
let e = this.getAttribute("placeholder") || "Select time", t = X(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");
|
|
4672
4682
|
this.innerHTML = `
|
|
4673
4683
|
<div class="timepicker">
|
|
4674
4684
|
<button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${g(a)}"` : ""}${o ? ` aria-describedby="${g(o)}"` : ""}>
|
|
4675
|
-
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ?
|
|
4685
|
+
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? $e(t, n) : g(e)}</span>
|
|
4676
4686
|
${p("clock")}
|
|
4677
4687
|
</button>
|
|
4678
4688
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
@@ -4684,14 +4694,14 @@ var Ue = class extends e {
|
|
|
4684
4694
|
_syncTrigger() {
|
|
4685
4695
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
4686
4696
|
if (!t) return;
|
|
4687
|
-
let n =
|
|
4688
|
-
t.textContent = n ?
|
|
4697
|
+
let n = X(this._value), r = this.getAttribute("format") || "24";
|
|
4698
|
+
t.textContent = n ? $e(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
4689
4699
|
}
|
|
4690
4700
|
_buildTimes() {
|
|
4691
|
-
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r =
|
|
4701
|
+
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r = X(t) || {
|
|
4692
4702
|
h: 0,
|
|
4693
4703
|
m: 0
|
|
4694
|
-
}, i =
|
|
4704
|
+
}, i = X(n) || {
|
|
4695
4705
|
h: 23,
|
|
4696
4706
|
m: 59
|
|
4697
4707
|
}, a = [], o = r.h, s = r.m;
|
|
@@ -4704,10 +4714,10 @@ var Ue = class extends e {
|
|
|
4704
4714
|
_renderOptions() {
|
|
4705
4715
|
let e = this.querySelector(".timepicker-pop");
|
|
4706
4716
|
if (!e) return;
|
|
4707
|
-
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r =
|
|
4717
|
+
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = X(this._value), i = this._focus, a = "";
|
|
4708
4718
|
for (let e = 0; e < n.length; e++) {
|
|
4709
|
-
let o = n[e], s =
|
|
4710
|
-
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${
|
|
4719
|
+
let o = n[e], s = Qe(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
4720
|
+
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${$e(o, t)}</button>`;
|
|
4711
4721
|
}
|
|
4712
4722
|
e.innerHTML = a, this._focusActive();
|
|
4713
4723
|
}
|
|
@@ -4805,7 +4815,7 @@ var Ue = class extends e {
|
|
|
4805
4815
|
disconnectedCallback() {
|
|
4806
4816
|
this._teardown();
|
|
4807
4817
|
}
|
|
4808
|
-
},
|
|
4818
|
+
}, tt = "wui-wizard-step", nt = class extends e {
|
|
4809
4819
|
static get observedAttributes() {
|
|
4810
4820
|
return [
|
|
4811
4821
|
"active",
|
|
@@ -4839,7 +4849,7 @@ var Ue = class extends e {
|
|
|
4839
4849
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
4840
4850
|
}
|
|
4841
4851
|
get _steps() {
|
|
4842
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
4852
|
+
return [...this.querySelectorAll(`:scope > ${tt}`)];
|
|
4843
4853
|
}
|
|
4844
4854
|
refresh() {
|
|
4845
4855
|
this._rendered && this._renderChrome();
|
|
@@ -4898,13 +4908,13 @@ var Ue = class extends e {
|
|
|
4898
4908
|
return e.map((e, r) => {
|
|
4899
4909
|
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
|
|
4900
4910
|
u = a === "done" ? p("check") : a === "error" ? p("alert-triangle") : a === "skipped" ? p("minus") : c ? p(c) : String(l);
|
|
4901
|
-
let d = a === "pending" ? "step" : `step ${a}`, f = a === "active" ? " aria-current=\"step\"" : "", m = i || r < this._active, h = s ? `<span class="step-desc">${
|
|
4902
|
-
return g = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${
|
|
4911
|
+
let d = a === "pending" ? "step" : `step ${a}`, f = a === "active" ? " aria-current=\"step\"" : "", m = i || r < this._active, h = s ? `<span class="step-desc">${Z(s)}</span>` : "", g;
|
|
4912
|
+
return g = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${Z(o)}</span>${h}</span>` : n ? `<span class="step-circle">${u}</span><span class="step-index">Step ${l}</span><span class="step-label">${Z(o)}</span>${h}` : `<span class="step-circle">${u}</span><span class="step-label">${Z(o)}</span>${h}`, m ? `<button type="button" class="${d}" data-step="${r}"${f}>${g}</button>` : `<div class="${d}"${f}>${g}</div>`;
|
|
4903
4913
|
}).join("");
|
|
4904
4914
|
}
|
|
4905
4915
|
_footerHtml(e) {
|
|
4906
4916
|
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";
|
|
4907
|
-
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${p("arrow-left", { className: "me-2" })}${
|
|
4917
|
+
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${p("arrow-left", { className: "me-2" })}${Z(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${Z(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${Z(o)}${p("arrow-right", { className: "ms-2" })}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${Z(c)}</button>`}</span>`;
|
|
4908
4918
|
}
|
|
4909
4919
|
_wire() {
|
|
4910
4920
|
this._teardown(), this._onHeaderClick = (e) => {
|
|
@@ -4976,7 +4986,7 @@ var Ue = class extends e {
|
|
|
4976
4986
|
_reflectActive(e) {
|
|
4977
4987
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
4978
4988
|
}
|
|
4979
|
-
},
|
|
4989
|
+
}, Z = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), rt = class extends e {
|
|
4980
4990
|
static get observedAttributes() {
|
|
4981
4991
|
return [
|
|
4982
4992
|
"label",
|
|
@@ -4990,8 +5000,8 @@ var Ue = class extends e {
|
|
|
4990
5000
|
let e = this.closest("wui-wizard");
|
|
4991
5001
|
e && typeof e.refresh == "function" && e.refresh();
|
|
4992
5002
|
}
|
|
4993
|
-
},
|
|
4994
|
-
async function
|
|
5003
|
+
}, it = 2e3;
|
|
5004
|
+
async function at(e) {
|
|
4995
5005
|
try {
|
|
4996
5006
|
if (navigator.clipboard?.writeText) return await navigator.clipboard.writeText(e), !0;
|
|
4997
5007
|
} catch {}
|
|
@@ -5006,14 +5016,14 @@ async function rt(e) {
|
|
|
5006
5016
|
}
|
|
5007
5017
|
//#endregion
|
|
5008
5018
|
//#region src/fileValidation.js
|
|
5009
|
-
var
|
|
5019
|
+
var ot = "image/png,image/jpeg,image/webp", st = 5, ct = {
|
|
5010
5020
|
"image/png": [".png"],
|
|
5011
5021
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
5012
5022
|
"image/webp": [".webp"],
|
|
5013
5023
|
"image/gif": [".gif"],
|
|
5014
5024
|
"image/svg+xml": [".svg"],
|
|
5015
5025
|
"application/pdf": [".pdf"]
|
|
5016
|
-
},
|
|
5026
|
+
}, lt = {
|
|
5017
5027
|
"image/png": "PNG",
|
|
5018
5028
|
"image/jpeg": "JPG",
|
|
5019
5029
|
"image/webp": "WEBP",
|
|
@@ -5027,7 +5037,7 @@ var it = "image/png,image/jpeg,image/webp", at = 5, ot = {
|
|
|
5027
5037
|
".gif": "GIF",
|
|
5028
5038
|
".svg": "SVG",
|
|
5029
5039
|
".pdf": "PDF"
|
|
5030
|
-
},
|
|
5040
|
+
}, ut = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), dt = [
|
|
5031
5041
|
".png",
|
|
5032
5042
|
".jpg",
|
|
5033
5043
|
".jpeg",
|
|
@@ -5038,54 +5048,54 @@ var it = "image/png,image/jpeg,image/webp", at = 5, ot = {
|
|
|
5038
5048
|
".avif",
|
|
5039
5049
|
".heic"
|
|
5040
5050
|
];
|
|
5041
|
-
function
|
|
5051
|
+
function ft(e) {
|
|
5042
5052
|
if (!e) return !1;
|
|
5043
5053
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
5044
5054
|
if (t) return t.startsWith("image/");
|
|
5045
5055
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
5046
|
-
return
|
|
5056
|
+
return dt.some((e) => r.endsWith(e));
|
|
5047
5057
|
}
|
|
5048
|
-
function
|
|
5049
|
-
let t =
|
|
5050
|
-
return t.length ? t.every((e) => e.startsWith(".") ?
|
|
5058
|
+
function pt(e) {
|
|
5059
|
+
let t = ut(e);
|
|
5060
|
+
return t.length ? t.every((e) => e.startsWith(".") ? dt.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
5051
5061
|
}
|
|
5052
|
-
function
|
|
5062
|
+
function mt(e) {
|
|
5053
5063
|
let t = [];
|
|
5054
|
-
for (let n of
|
|
5055
|
-
let e =
|
|
5064
|
+
for (let n of ut(e)) {
|
|
5065
|
+
let e = lt[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
5056
5066
|
t.includes(e) || t.push(e);
|
|
5057
5067
|
}
|
|
5058
5068
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
5059
5069
|
}
|
|
5060
|
-
function
|
|
5061
|
-
let n =
|
|
5070
|
+
function ht(e, t) {
|
|
5071
|
+
let n = ut(t);
|
|
5062
5072
|
if (!n.length) return !0;
|
|
5063
5073
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
5064
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
5074
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (ct[e] || []).some((e) => i.endsWith(e)));
|
|
5065
5075
|
}
|
|
5066
|
-
function
|
|
5076
|
+
function gt(e, t = {}) {
|
|
5067
5077
|
if (!e) return null;
|
|
5068
|
-
let n = t.accept === void 0 ?
|
|
5069
|
-
return
|
|
5078
|
+
let n = t.accept === void 0 ? ot : t.accept, r = t.maxSizeMb || 5;
|
|
5079
|
+
return ht(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${mt(n)} file.`;
|
|
5070
5080
|
}
|
|
5071
5081
|
//#endregion
|
|
5072
5082
|
//#region src/passwordRules.js
|
|
5073
|
-
var
|
|
5083
|
+
var Q = {
|
|
5074
5084
|
minLength: 8,
|
|
5075
5085
|
uppercase: !0,
|
|
5076
5086
|
lowercase: !0,
|
|
5077
5087
|
digit: !0,
|
|
5078
5088
|
special: !0,
|
|
5079
5089
|
uniqueChars: 0
|
|
5080
|
-
},
|
|
5081
|
-
function
|
|
5082
|
-
return e === !0 || e == null ? { ...
|
|
5083
|
-
...
|
|
5090
|
+
}, _t = "Password Requirements";
|
|
5091
|
+
function vt(e) {
|
|
5092
|
+
return e === !0 || e == null ? { ...Q } : {
|
|
5093
|
+
...Q,
|
|
5084
5094
|
...e
|
|
5085
5095
|
};
|
|
5086
5096
|
}
|
|
5087
|
-
function
|
|
5088
|
-
let t =
|
|
5097
|
+
function yt(e) {
|
|
5098
|
+
let t = vt(e), n = [];
|
|
5089
5099
|
if (t.minLength > 0 && n.push({
|
|
5090
5100
|
key: "length",
|
|
5091
5101
|
label: `At least ${t.minLength} characters long`,
|
|
@@ -5116,25 +5126,25 @@ function vt(e) {
|
|
|
5116
5126
|
}
|
|
5117
5127
|
return n;
|
|
5118
5128
|
}
|
|
5119
|
-
function
|
|
5129
|
+
function bt(e, t) {
|
|
5120
5130
|
let n = e == null ? "" : String(e);
|
|
5121
|
-
return
|
|
5131
|
+
return yt(t).map((e) => ({
|
|
5122
5132
|
key: e.key,
|
|
5123
5133
|
label: e.label,
|
|
5124
5134
|
met: e.test(n)
|
|
5125
5135
|
}));
|
|
5126
5136
|
}
|
|
5127
|
-
function
|
|
5128
|
-
return
|
|
5137
|
+
function xt(e, t) {
|
|
5138
|
+
return bt(e, t).every((e) => e.met);
|
|
5129
5139
|
}
|
|
5130
5140
|
//#endregion
|
|
5131
5141
|
//#region src/index.js
|
|
5132
5142
|
var $ = (e, t) => {
|
|
5133
5143
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
5134
5144
|
};
|
|
5135
|
-
function
|
|
5136
|
-
$("wui-select",
|
|
5145
|
+
function St() {
|
|
5146
|
+
$("wui-select", Ke), $("wui-phone", Ge), $("wui-datepicker", ae), $("wui-date-range", oe), $("wui-dock", se), $("wui-feedback", fe), $("wui-consent-banner", ne), $("wui-slider", qe), $("wui-timepicker", et), $("wui-autocomplete", y), $("wui-multiselect", be), $("wui-taginput", Ye), $("wui-otp", ke), $("wui-status-icon", r), $("wui-wizard-step", rt), $("wui-wizard", nt);
|
|
5137
5147
|
}
|
|
5138
|
-
|
|
5148
|
+
St();
|
|
5139
5149
|
//#endregion
|
|
5140
|
-
export {
|
|
5150
|
+
export { it as COPY_FEEDBACK_MS, ot as DEFAULT_IMAGE_ACCEPT, st as DEFAULT_MAX_SIZE_MB, Q as DEFAULT_PASSWORD_RULES, _t as DEFAULT_REQUIREMENTS_TITLE, n as STATUS_TONES, y as WuiAutocomplete, ne as WuiConsentBanner, ae as WuiDatePicker, oe as WuiDateRange, se as WuiDock, fe as WuiFeedback, be as WuiMultiSelect, ke as WuiOtp, Ge as WuiPhone, Ke as WuiSelect, qe as WuiSlider, r as WuiStatusIcon, Ye as WuiTagInput, et as WuiTimePicker, nt as WuiWizard, rt as WuiWizardStep, mt as acceptLabel, yt as buildPasswordRules, at as copyTextToClipboard, St as defineWeborityElements, bt as evaluatePassword, p as glyphSvg, ft as isImageFile, pt as isImageOnlyAccept, ht as matchesAccept, xt as passwordSatisfies, gt as validateFile };
|