@webority/ui-elements 0.12.3 → 0.12.4
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 +50 -45
- package/dist/ui-elements.global.js +103 -98
- package/dist/ui-elements.js +348 -160
- package/package.json +1 -1
package/dist/ui-elements.js
CHANGED
|
@@ -527,7 +527,195 @@ 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 =
|
|
530
|
+
}, b = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), x = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), S = {
|
|
531
|
+
"--color-primary": "#4F46E5",
|
|
532
|
+
"--color-primary-hover": "#4338CA",
|
|
533
|
+
"--color-text": "#071437",
|
|
534
|
+
"--color-text-muted": "#4B5675",
|
|
535
|
+
"--color-border": "#EBEDF3",
|
|
536
|
+
"--color-surface": "#FFFFFF",
|
|
537
|
+
"--wui-radius-lg": "14px",
|
|
538
|
+
"--wui-shadow-overlay-lg": "0 24px 60px -16px rgba(7, 20, 55, 0.28)",
|
|
539
|
+
"--wui-z-fixed": "1030"
|
|
540
|
+
}, C = (e) => `var(${e}, ${S[e]})`, ee = `
|
|
541
|
+
:host {
|
|
542
|
+
all: initial;
|
|
543
|
+
position: fixed;
|
|
544
|
+
bottom: 20px;
|
|
545
|
+
left: 20px;
|
|
546
|
+
right: auto;
|
|
547
|
+
z-index: ${C("--wui-z-fixed")};
|
|
548
|
+
display: block;
|
|
549
|
+
width: 420px;
|
|
550
|
+
max-width: calc(100vw - 40px);
|
|
551
|
+
font-family: inherit;
|
|
552
|
+
font-size: 16px;
|
|
553
|
+
line-height: 1.5;
|
|
554
|
+
color: ${C("--color-text")};
|
|
555
|
+
}
|
|
556
|
+
:host([position="bottom-right"]) {
|
|
557
|
+
right: 20px;
|
|
558
|
+
left: auto;
|
|
559
|
+
}
|
|
560
|
+
:host(:not([open])) {
|
|
561
|
+
pointer-events: none;
|
|
562
|
+
}
|
|
563
|
+
*, *::before, *::after {
|
|
564
|
+
box-sizing: border-box;
|
|
565
|
+
}
|
|
566
|
+
[hidden] {
|
|
567
|
+
display: none !important;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.wui-consent-banner-panel {
|
|
571
|
+
padding: 20px;
|
|
572
|
+
background: ${C("--color-surface")};
|
|
573
|
+
border: 1px solid ${C("--color-border")};
|
|
574
|
+
border-radius: ${C("--wui-radius-lg")};
|
|
575
|
+
box-shadow: ${C("--wui-shadow-overlay-lg")};
|
|
576
|
+
text-align: start;
|
|
577
|
+
pointer-events: auto;
|
|
578
|
+
}
|
|
579
|
+
.wui-consent-banner-heading {
|
|
580
|
+
margin: 0 0 8px;
|
|
581
|
+
font-size: 18px;
|
|
582
|
+
font-weight: 600;
|
|
583
|
+
line-height: 1.3;
|
|
584
|
+
color: ${C("--color-text")};
|
|
585
|
+
}
|
|
586
|
+
.wui-consent-banner-description {
|
|
587
|
+
margin: 0 0 16px;
|
|
588
|
+
font-size: 14px;
|
|
589
|
+
line-height: 1.5;
|
|
590
|
+
color: ${C("--color-text-muted")};
|
|
591
|
+
}
|
|
592
|
+
.wui-consent-banner-policy {
|
|
593
|
+
color: ${C("--color-primary")};
|
|
594
|
+
font-weight: 500;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.wui-consent-banner-settings {
|
|
598
|
+
display: grid;
|
|
599
|
+
gap: 12px;
|
|
600
|
+
max-height: 50vh;
|
|
601
|
+
margin: 0 0 16px;
|
|
602
|
+
padding: 12px 0;
|
|
603
|
+
overflow-y: auto;
|
|
604
|
+
border-top: 1px solid ${C("--color-border")};
|
|
605
|
+
border-bottom: 1px solid ${C("--color-border")};
|
|
606
|
+
}
|
|
607
|
+
.wui-consent-banner-category-description {
|
|
608
|
+
margin: 2px 0 0;
|
|
609
|
+
padding-inline-start: 2.5em;
|
|
610
|
+
font-size: 12px;
|
|
611
|
+
line-height: 1.4;
|
|
612
|
+
color: ${C("--color-text-muted")};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.form-check {
|
|
616
|
+
display: flex;
|
|
617
|
+
align-items: center;
|
|
618
|
+
gap: 0.5em;
|
|
619
|
+
margin: 0;
|
|
620
|
+
font-size: 14px;
|
|
621
|
+
}
|
|
622
|
+
.form-check-input {
|
|
623
|
+
appearance: none;
|
|
624
|
+
flex: none;
|
|
625
|
+
width: 2em;
|
|
626
|
+
height: 1em;
|
|
627
|
+
margin: 0;
|
|
628
|
+
border: 1px solid rgba(0, 0, 0, 0.25);
|
|
629
|
+
border-radius: 2em;
|
|
630
|
+
background: ${C("--color-surface")} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat;
|
|
631
|
+
cursor: pointer;
|
|
632
|
+
transition: background-position 0.15s ease-in-out;
|
|
633
|
+
}
|
|
634
|
+
.form-check-input:checked {
|
|
635
|
+
border-color: ${C("--color-primary")};
|
|
636
|
+
background: ${C("--color-primary")} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat;
|
|
637
|
+
}
|
|
638
|
+
.form-check-input:disabled {
|
|
639
|
+
opacity: 0.5;
|
|
640
|
+
cursor: default;
|
|
641
|
+
}
|
|
642
|
+
.form-check-input:focus-visible {
|
|
643
|
+
outline: 2px solid ${C("--color-primary")};
|
|
644
|
+
outline-offset: 2px;
|
|
645
|
+
}
|
|
646
|
+
.form-check-label {
|
|
647
|
+
cursor: pointer;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.wui-consent-banner-actions {
|
|
651
|
+
display: flex;
|
|
652
|
+
flex-wrap: wrap;
|
|
653
|
+
align-items: center;
|
|
654
|
+
justify-content: flex-end;
|
|
655
|
+
gap: 8px;
|
|
656
|
+
}
|
|
657
|
+
.btn {
|
|
658
|
+
display: inline-block;
|
|
659
|
+
padding: 0.25rem 0.5rem;
|
|
660
|
+
border: 1px solid transparent;
|
|
661
|
+
border-radius: 0.375rem;
|
|
662
|
+
background: transparent;
|
|
663
|
+
font: inherit;
|
|
664
|
+
font-size: 0.875rem;
|
|
665
|
+
font-weight: 500;
|
|
666
|
+
line-height: 1.5;
|
|
667
|
+
text-align: center;
|
|
668
|
+
white-space: nowrap;
|
|
669
|
+
cursor: pointer;
|
|
670
|
+
}
|
|
671
|
+
.btn:focus-visible {
|
|
672
|
+
outline: 2px solid ${C("--color-primary")};
|
|
673
|
+
outline-offset: 2px;
|
|
674
|
+
}
|
|
675
|
+
.btn-primary {
|
|
676
|
+
background: ${C("--color-primary")};
|
|
677
|
+
border-color: ${C("--color-primary")};
|
|
678
|
+
color: #fff;
|
|
679
|
+
}
|
|
680
|
+
.btn-primary:hover {
|
|
681
|
+
background: ${C("--color-primary-hover")};
|
|
682
|
+
border-color: ${C("--color-primary-hover")};
|
|
683
|
+
}
|
|
684
|
+
.btn-outline-secondary {
|
|
685
|
+
border-color: ${C("--color-text-muted")};
|
|
686
|
+
color: ${C("--color-text-muted")};
|
|
687
|
+
}
|
|
688
|
+
.btn-outline-secondary:hover {
|
|
689
|
+
background: ${C("--color-text-muted")};
|
|
690
|
+
color: #fff;
|
|
691
|
+
}
|
|
692
|
+
.btn-link {
|
|
693
|
+
font-weight: 400;
|
|
694
|
+
color: ${C("--color-primary")};
|
|
695
|
+
text-decoration: underline;
|
|
696
|
+
}
|
|
697
|
+
.btn-link:hover {
|
|
698
|
+
color: ${C("--color-primary-hover")};
|
|
699
|
+
}
|
|
700
|
+
.wui-consent-banner-settings-toggle {
|
|
701
|
+
margin-inline-end: auto;
|
|
702
|
+
padding-inline: 0;
|
|
703
|
+
}
|
|
704
|
+
.wui-consent-banner-save {
|
|
705
|
+
flex: 1 1 100%;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
@media (max-width: 480px) {
|
|
709
|
+
:host,
|
|
710
|
+
:host([position="bottom-right"]) {
|
|
711
|
+
left: 12px;
|
|
712
|
+
right: 12px;
|
|
713
|
+
bottom: 12px;
|
|
714
|
+
width: auto;
|
|
715
|
+
max-width: none;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
`, w = "wui-consent-save", te = "[data-consent-settings]", T = {
|
|
531
719
|
heading: "Cookies on this site",
|
|
532
720
|
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
721
|
policyLabel: "Cookie policy",
|
|
@@ -543,11 +731,11 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
543
731
|
rejectLabel: "Reject all",
|
|
544
732
|
acceptLabel: "Accept all",
|
|
545
733
|
saveLabel: "Save preferences"
|
|
546
|
-
},
|
|
734
|
+
}, ne = [
|
|
547
735
|
"analytics",
|
|
548
736
|
"functional",
|
|
549
737
|
"marketing"
|
|
550
|
-
],
|
|
738
|
+
], re = 0, ie = class extends e {
|
|
551
739
|
static get observedAttributes() {
|
|
552
740
|
return [
|
|
553
741
|
"heading",
|
|
@@ -560,7 +748,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
560
748
|
];
|
|
561
749
|
}
|
|
562
750
|
constructor() {
|
|
563
|
-
super(),
|
|
751
|
+
super(), re += 1, this._uid = `wui-consent-${re}`, this._preferences = {
|
|
564
752
|
analytics: !1,
|
|
565
753
|
functional: !1,
|
|
566
754
|
marketing: !1
|
|
@@ -584,13 +772,13 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
584
772
|
this.toggleAttribute("standalone", e === !0 || e === "" || e === "true");
|
|
585
773
|
}
|
|
586
774
|
get heading() {
|
|
587
|
-
return this.getAttribute("heading") ||
|
|
775
|
+
return this.getAttribute("heading") || T.heading;
|
|
588
776
|
}
|
|
589
777
|
set heading(e) {
|
|
590
778
|
this.setAttribute("heading", String(e ?? ""));
|
|
591
779
|
}
|
|
592
780
|
get description() {
|
|
593
|
-
return this.getAttribute("description") ||
|
|
781
|
+
return this.getAttribute("description") || T.description;
|
|
594
782
|
}
|
|
595
783
|
set description(e) {
|
|
596
784
|
this.setAttribute("description", String(e ?? ""));
|
|
@@ -602,25 +790,25 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
602
790
|
this.setAttribute("policy-href", String(e ?? ""));
|
|
603
791
|
}
|
|
604
792
|
get policyLabel() {
|
|
605
|
-
return this.getAttribute("policy-label") ||
|
|
793
|
+
return this.getAttribute("policy-label") || T.policyLabel;
|
|
606
794
|
}
|
|
607
795
|
set policyLabel(e) {
|
|
608
796
|
this.setAttribute("policy-label", String(e ?? ""));
|
|
609
797
|
}
|
|
610
798
|
get analyticsDescription() {
|
|
611
|
-
return this.getAttribute("analytics-description") ||
|
|
799
|
+
return this.getAttribute("analytics-description") || T.analyticsDescription;
|
|
612
800
|
}
|
|
613
801
|
set analyticsDescription(e) {
|
|
614
802
|
this.setAttribute("analytics-description", String(e ?? ""));
|
|
615
803
|
}
|
|
616
804
|
get functionalDescription() {
|
|
617
|
-
return this.getAttribute("functional-description") ||
|
|
805
|
+
return this.getAttribute("functional-description") || T.functionalDescription;
|
|
618
806
|
}
|
|
619
807
|
set functionalDescription(e) {
|
|
620
808
|
this.setAttribute("functional-description", String(e ?? ""));
|
|
621
809
|
}
|
|
622
810
|
get marketingDescription() {
|
|
623
|
-
return this.getAttribute("marketing-description") ||
|
|
811
|
+
return this.getAttribute("marketing-description") || T.marketingDescription;
|
|
624
812
|
}
|
|
625
813
|
set marketingDescription(e) {
|
|
626
814
|
this.setAttribute("marketing-description", String(e ?? ""));
|
|
@@ -648,22 +836,22 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
648
836
|
this._rendered && this.render();
|
|
649
837
|
}
|
|
650
838
|
render() {
|
|
651
|
-
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${
|
|
652
|
-
r.innerHTML = `${r === this ? "" : `<style>${
|
|
839
|
+
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${ae(this.policyHref)}">${D(this.policyLabel)}</a>` : "", r = this._root();
|
|
840
|
+
r.innerHTML = `${r === this ? "" : `<style>${ee}</style>`}
|
|
653
841
|
<div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden>
|
|
654
842
|
<h2 class="wui-consent-banner-heading" id="${t}-heading">${D(this.heading)}</h2>
|
|
655
843
|
<p class="wui-consent-banner-description" id="${t}-description">${D(this.description)}${n}</p>
|
|
656
844
|
<div class="wui-consent-banner-settings" hidden>
|
|
657
|
-
${E(t, "essential",
|
|
658
|
-
${E(t, "analytics",
|
|
659
|
-
${E(t, "functional",
|
|
660
|
-
${E(t, "marketing",
|
|
845
|
+
${E(t, "essential", T.essentialLabel, T.essentialDescription, !0)}
|
|
846
|
+
${E(t, "analytics", T.analyticsLabel, this.analyticsDescription, !1)}
|
|
847
|
+
${E(t, "functional", T.functionalLabel, this.functionalDescription, !1)}
|
|
848
|
+
${E(t, "marketing", T.marketingLabel, this.marketingDescription, !1)}
|
|
661
849
|
</div>
|
|
662
850
|
<div class="wui-consent-banner-actions">
|
|
663
|
-
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${
|
|
664
|
-
<button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${
|
|
665
|
-
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${
|
|
666
|
-
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${
|
|
851
|
+
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${T.settingsLabel}</button>
|
|
852
|
+
<button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${T.rejectLabel}</button>
|
|
853
|
+
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${T.acceptLabel}</button>
|
|
854
|
+
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${T.saveLabel}</button>
|
|
667
855
|
</div>
|
|
668
856
|
</div>`, this._rendered = !0, this._wire(), this._applyPreferences(), this._showSettings(this._settings), e && (this._panel().hidden = !1);
|
|
669
857
|
}
|
|
@@ -693,7 +881,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
693
881
|
})), 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));
|
|
694
882
|
}
|
|
695
883
|
_save(e) {
|
|
696
|
-
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(
|
|
884
|
+
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(w, {
|
|
697
885
|
bubbles: !0,
|
|
698
886
|
composed: !0,
|
|
699
887
|
detail: { ...e }
|
|
@@ -701,11 +889,11 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
701
889
|
}
|
|
702
890
|
_switchValues() {
|
|
703
891
|
let e = {};
|
|
704
|
-
for (let t of
|
|
892
|
+
for (let t of ne) e[t] = this._root().querySelector(`input[data-category="${t}"]`)?.checked === !0;
|
|
705
893
|
return e;
|
|
706
894
|
}
|
|
707
895
|
_applyPreferences() {
|
|
708
|
-
for (let e of
|
|
896
|
+
for (let e of ne) {
|
|
709
897
|
let t = this._root().querySelector(`input[data-category="${e}"]`);
|
|
710
898
|
t && (t.checked = this._preferences[e]);
|
|
711
899
|
}
|
|
@@ -733,7 +921,7 @@ function E(e, t, n, r, i) {
|
|
|
733
921
|
<p class="wui-consent-banner-category-description">${D(r)}</p>
|
|
734
922
|
</div>`;
|
|
735
923
|
}
|
|
736
|
-
var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
|
|
924
|
+
var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ae = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), O = [
|
|
737
925
|
"January",
|
|
738
926
|
"February",
|
|
739
927
|
"March",
|
|
@@ -754,7 +942,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
754
942
|
"Th",
|
|
755
943
|
"Fr",
|
|
756
944
|
"Sa"
|
|
757
|
-
],
|
|
945
|
+
], oe = (e) => String(e).padStart(2, "0"), A = (e, t, n) => `${e}-${oe(t + 1)}-${oe(n)}`, j = (e) => {
|
|
758
946
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
759
947
|
return t ? {
|
|
760
948
|
y: +t[1],
|
|
@@ -763,7 +951,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
763
951
|
} : null;
|
|
764
952
|
}, M = (e) => {
|
|
765
953
|
let t = j(e);
|
|
766
|
-
return t ? `${
|
|
954
|
+
return t ? `${oe(t.d)} ${O[t.m].slice(0, 3)} ${t.y}` : "";
|
|
767
955
|
}, N = (e, t) => new Date(e, t + 1, 0).getDate(), P = (e, t) => {
|
|
768
956
|
for (; t < 0;) t += 12, --e;
|
|
769
957
|
for (; t > 11;) t -= 12, e += 1;
|
|
@@ -771,7 +959,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
771
959
|
y: e,
|
|
772
960
|
m: t
|
|
773
961
|
};
|
|
774
|
-
},
|
|
962
|
+
}, se = class extends e {
|
|
775
963
|
static formAssociated = !0;
|
|
776
964
|
static get observedAttributes() {
|
|
777
965
|
return [
|
|
@@ -1076,7 +1264,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1076
1264
|
disconnectedCallback() {
|
|
1077
1265
|
this._teardown();
|
|
1078
1266
|
}
|
|
1079
|
-
},
|
|
1267
|
+
}, ce = class extends e {
|
|
1080
1268
|
static formAssociated = !0;
|
|
1081
1269
|
static get observedAttributes() {
|
|
1082
1270
|
return [
|
|
@@ -1291,7 +1479,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1291
1479
|
disconnectedCallback() {
|
|
1292
1480
|
this._teardown();
|
|
1293
1481
|
}
|
|
1294
|
-
},
|
|
1482
|
+
}, le = class extends e {
|
|
1295
1483
|
static get observedAttributes() {
|
|
1296
1484
|
return [
|
|
1297
1485
|
"static",
|
|
@@ -1312,10 +1500,10 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1312
1500
|
e === "static" && this.isConnected && this._wire();
|
|
1313
1501
|
}
|
|
1314
1502
|
_maxScale() {
|
|
1315
|
-
return
|
|
1503
|
+
return ue(this.getAttribute("max-scale"), 1.6);
|
|
1316
1504
|
}
|
|
1317
1505
|
_radius() {
|
|
1318
|
-
return
|
|
1506
|
+
return ue(this.getAttribute("radius"), 100);
|
|
1319
1507
|
}
|
|
1320
1508
|
_magnifyEnabled() {
|
|
1321
1509
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -1340,10 +1528,10 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1340
1528
|
_teardown() {
|
|
1341
1529
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
1342
1530
|
}
|
|
1343
|
-
},
|
|
1531
|
+
}, ue = (e, t) => {
|
|
1344
1532
|
let n = Number.parseFloat(e);
|
|
1345
1533
|
return Number.isFinite(n) ? n : t;
|
|
1346
|
-
},
|
|
1534
|
+
}, de = "wui-feedback-submit", F = {
|
|
1347
1535
|
label: "Feedback",
|
|
1348
1536
|
heading: "Share feedback",
|
|
1349
1537
|
placeholder: "What's working, what isn't?",
|
|
@@ -1354,7 +1542,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1354
1542
|
emptyError: "Please write a message before sending.",
|
|
1355
1543
|
failedError: "That didn't send. Please try again.",
|
|
1356
1544
|
thanks: "Thanks — we've got it."
|
|
1357
|
-
},
|
|
1545
|
+
}, fe = 1e4, pe = 1600, me = class extends e {
|
|
1358
1546
|
static get observedAttributes() {
|
|
1359
1547
|
return [
|
|
1360
1548
|
"position",
|
|
@@ -1403,10 +1591,10 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1403
1591
|
return this._open === !0;
|
|
1404
1592
|
}
|
|
1405
1593
|
addEventListener(e, t, n) {
|
|
1406
|
-
e ===
|
|
1594
|
+
e === de && (this._submitListeners += 1), super.addEventListener(e, t, n);
|
|
1407
1595
|
}
|
|
1408
1596
|
removeEventListener(e, t, n) {
|
|
1409
|
-
e ===
|
|
1597
|
+
e === de && this._submitListeners > 0 && --this._submitListeners, super.removeEventListener(e, t, n);
|
|
1410
1598
|
}
|
|
1411
1599
|
connectedCallback() {
|
|
1412
1600
|
this._rendered || this.render();
|
|
@@ -1422,17 +1610,17 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1422
1610
|
this.innerHTML = `
|
|
1423
1611
|
<button type="button" class="feedback-trigger" aria-expanded="false" aria-haspopup="dialog">
|
|
1424
1612
|
<span class="feedback-trigger-icon" aria-hidden="true">${p("message-square", { size: 18 })}</span>
|
|
1425
|
-
<span class="feedback-trigger-label">${
|
|
1613
|
+
<span class="feedback-trigger-label">${he(this.label)}</span>
|
|
1426
1614
|
</button>
|
|
1427
|
-
<div class="feedback-panel" role="dialog" aria-label="${
|
|
1615
|
+
<div class="feedback-panel" role="dialog" aria-label="${ge(this.heading)}" hidden>
|
|
1428
1616
|
<div class="feedback-head">
|
|
1429
|
-
<h2 class="feedback-heading">${
|
|
1617
|
+
<h2 class="feedback-heading">${he(this.heading)}</h2>
|
|
1430
1618
|
<button type="button" class="feedback-close" aria-label="Close">${p("x", { size: 16 })}</button>
|
|
1431
1619
|
</div>
|
|
1432
1620
|
<div class="feedback-body">
|
|
1433
1621
|
<label class="feedback-field">
|
|
1434
1622
|
<span class="feedback-field-label">${F.messageLabel}</span>
|
|
1435
|
-
<textarea class="feedback-message" rows="4" required placeholder="${
|
|
1623
|
+
<textarea class="feedback-message" rows="4" required placeholder="${ge(this.placeholder)}"></textarea>
|
|
1436
1624
|
</label>
|
|
1437
1625
|
${this.collectEmail ? `<label class="feedback-field">
|
|
1438
1626
|
<span class="feedback-field-label">${F.emailLabel}</span>
|
|
@@ -1484,7 +1672,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1484
1672
|
let { thanks: e, error: t, submit: n, message: r, email: i } = this._refs();
|
|
1485
1673
|
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(() => {
|
|
1486
1674
|
r && (r.value = ""), i && (i.value = ""), this._reset(), this.close();
|
|
1487
|
-
},
|
|
1675
|
+
}, pe);
|
|
1488
1676
|
}
|
|
1489
1677
|
failed(e) {
|
|
1490
1678
|
this._clearTimers(), this._state = "error", this._setBusy(!1);
|
|
@@ -1505,7 +1693,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1505
1693
|
surface: this.getAttribute("surface") || "",
|
|
1506
1694
|
screen: this.getAttribute("screen") || ""
|
|
1507
1695
|
};
|
|
1508
|
-
if (this.dispatchEvent(new CustomEvent(
|
|
1696
|
+
if (this.dispatchEvent(new CustomEvent(de, {
|
|
1509
1697
|
bubbles: !0,
|
|
1510
1698
|
composed: !0,
|
|
1511
1699
|
detail: i
|
|
@@ -1515,7 +1703,7 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1515
1703
|
}
|
|
1516
1704
|
this._timer = setTimeout(() => {
|
|
1517
1705
|
this._state === "submitting" && this.failed();
|
|
1518
|
-
},
|
|
1706
|
+
}, fe);
|
|
1519
1707
|
}
|
|
1520
1708
|
_setBusy(e) {
|
|
1521
1709
|
let { submit: t } = this._refs();
|
|
@@ -1529,23 +1717,23 @@ var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1529
1717
|
_clearTimers() {
|
|
1530
1718
|
this._timer &&= (clearTimeout(this._timer), 0), this._thanksTimer &&= (clearTimeout(this._thanksTimer), 0);
|
|
1531
1719
|
}
|
|
1532
|
-
},
|
|
1720
|
+
}, he = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ge = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), _e = {
|
|
1533
1721
|
enter: "Enter",
|
|
1534
1722
|
comma: ",",
|
|
1535
1723
|
space: " ",
|
|
1536
1724
|
tab: "Tab"
|
|
1537
|
-
},
|
|
1725
|
+
}, ve = {
|
|
1538
1726
|
enter: "\n",
|
|
1539
1727
|
comma: ",",
|
|
1540
1728
|
space: " ",
|
|
1541
1729
|
tab: " "
|
|
1542
|
-
},
|
|
1543
|
-
function
|
|
1730
|
+
}, ye = (e) => _e[e], be = (e) => ve[e];
|
|
1731
|
+
function xe(e, t) {
|
|
1544
1732
|
let n = [String(e ?? "")];
|
|
1545
1733
|
for (let e of t) n = n.flatMap((t) => t.split(e));
|
|
1546
1734
|
return n.map((e) => e.trim()).filter(Boolean);
|
|
1547
1735
|
}
|
|
1548
|
-
var I = (e, t) => t.some((t) => String(e ?? "").includes(t)),
|
|
1736
|
+
var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), Se = class extends e {
|
|
1549
1737
|
static formAssociated = !0;
|
|
1550
1738
|
_accessibleName() {
|
|
1551
1739
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1645,7 +1833,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1645
1833
|
[h]: !0,
|
|
1646
1834
|
selected: e.hasAttribute("selected")
|
|
1647
1835
|
};
|
|
1648
|
-
for (let [n, r] of
|
|
1836
|
+
for (let [n, r] of Ce) {
|
|
1649
1837
|
let i = e.getAttribute(n);
|
|
1650
1838
|
i && (t[r] = i);
|
|
1651
1839
|
}
|
|
@@ -1746,7 +1934,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1746
1934
|
i && (a = a.filter((e) => this._matches(e, i)));
|
|
1747
1935
|
let o = this._listboxId || `${this.id || "wui-multiselect"}-listbox`, s = this._allowCustom && r && !this._optionNamed(r), c = a.map((e, t) => {
|
|
1748
1936
|
let n = this._values.includes(String(e.value)), r = `${o}-opt-${t}`;
|
|
1749
|
-
return
|
|
1937
|
+
return we(e) ? De(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>`;
|
|
1750
1938
|
});
|
|
1751
1939
|
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?.();
|
|
1752
1940
|
}
|
|
@@ -1761,7 +1949,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1761
1949
|
_customRefusal(e) {
|
|
1762
1950
|
let t = this.getAttribute("custom-invalid-message") || "Enter a valid value.", n = this.getAttribute("custom-pattern");
|
|
1763
1951
|
if (n) {
|
|
1764
|
-
let r =
|
|
1952
|
+
let r = Oe(n);
|
|
1765
1953
|
if (r && !r.test(e)) return t;
|
|
1766
1954
|
}
|
|
1767
1955
|
let r = this._validateCustom;
|
|
@@ -1812,35 +2000,35 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1812
2000
|
a ? (_ = !1, y()) : (t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open")), g(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
|
|
1813
2001
|
}, S = () => {
|
|
1814
2002
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1815
|
-
},
|
|
2003
|
+
}, C = (e) => {
|
|
1816
2004
|
let t = String(e);
|
|
1817
2005
|
if (this._values.includes(t)) this._values = this._values.filter((e) => e !== t);
|
|
1818
2006
|
else if (a && this._values.some((e) => e.toLowerCase() === t.toLowerCase())) return;
|
|
1819
2007
|
else this._values = [...this._values, t];
|
|
1820
2008
|
this._renderControl(), this._renderOptions(this._query()), S();
|
|
1821
|
-
},
|
|
2009
|
+
}, ee = (e) => {
|
|
1822
2010
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(this._query()), S();
|
|
1823
|
-
},
|
|
1824
|
-
let n = this._values.length, r = I(e, L) ?
|
|
2011
|
+
}, w = (e, { quiet: t = !1 } = {}) => {
|
|
2012
|
+
let n = this._values.length, r = I(e, L) ? xe(e, L) : [e], i = [], a = "";
|
|
1825
2013
|
for (let e of r) {
|
|
1826
2014
|
let t = this._commitTyped(e);
|
|
1827
2015
|
t && (i.push(e.trim()), a ||= t);
|
|
1828
2016
|
}
|
|
1829
2017
|
t && i.length || (o.value = i.join(", "), this._setCustomError(a), this._values.length !== n && (this._renderControl(), S()), this._renderOptions(o.value));
|
|
1830
|
-
},
|
|
2018
|
+
}, te = (e) => {
|
|
1831
2019
|
if (!(!e || e.getAttribute("aria-disabled") === "true")) {
|
|
1832
2020
|
if (e.dataset.custom === "true") {
|
|
1833
|
-
|
|
2021
|
+
w(e.dataset.value);
|
|
1834
2022
|
return;
|
|
1835
2023
|
}
|
|
1836
|
-
|
|
2024
|
+
C(e.dataset.value), o?.value && (o.value = "", this._setCustomError(""), this._renderOptions(""));
|
|
1837
2025
|
}
|
|
1838
2026
|
};
|
|
1839
2027
|
e.addEventListener("click", (e) => {
|
|
1840
2028
|
if (u()) return;
|
|
1841
2029
|
let t = e.target.closest("[data-remove]");
|
|
1842
2030
|
if (t) {
|
|
1843
|
-
e.stopPropagation(),
|
|
2031
|
+
e.stopPropagation(), ee(t.dataset.remove), o?.focus();
|
|
1844
2032
|
return;
|
|
1845
2033
|
}
|
|
1846
2034
|
if (o) {
|
|
@@ -1851,7 +2039,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1851
2039
|
v() ? x() : b();
|
|
1852
2040
|
}), i.addEventListener("click", (e) => {
|
|
1853
2041
|
let t = e.target.closest(".search-select-option");
|
|
1854
|
-
t && (
|
|
2042
|
+
t && (te(t), (o || n)?.focus());
|
|
1855
2043
|
}), i.addEventListener("mousemove", (e) => {
|
|
1856
2044
|
let t = e.target.closest(".search-select-option");
|
|
1857
2045
|
t && g(h().indexOf(t));
|
|
@@ -1864,7 +2052,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1864
2052
|
getActive: () => this._active,
|
|
1865
2053
|
setActive: (e) => g(e),
|
|
1866
2054
|
onEnter: (e) => {
|
|
1867
|
-
e ?
|
|
2055
|
+
e ? te(e) : o?.value.trim() && w(o.value);
|
|
1868
2056
|
},
|
|
1869
2057
|
onEscape: () => {
|
|
1870
2058
|
this._navHandler.clearTypeahead(), x(), o || e.focus();
|
|
@@ -1873,7 +2061,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1873
2061
|
let T = (e) => {
|
|
1874
2062
|
let t = o || n;
|
|
1875
2063
|
if (e.key === "Backspace" && !t?.value && this._values.length) {
|
|
1876
|
-
|
|
2064
|
+
ee(this._values[this._values.length - 1]);
|
|
1877
2065
|
return;
|
|
1878
2066
|
}
|
|
1879
2067
|
this._navHandler.handler(e);
|
|
@@ -1888,7 +2076,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1888
2076
|
this._customError && this._setCustomError(""), this._renderOptions(o.value), b();
|
|
1889
2077
|
}), o.addEventListener("keydown", (e) => {
|
|
1890
2078
|
if (e.key === "," && o.value.trim()) {
|
|
1891
|
-
e.preventDefault(),
|
|
2079
|
+
e.preventDefault(), w(o.value);
|
|
1892
2080
|
return;
|
|
1893
2081
|
}
|
|
1894
2082
|
if (e.key === "Enter") {
|
|
@@ -1899,9 +2087,9 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1899
2087
|
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(), T(e);
|
|
1900
2088
|
}), o.addEventListener("paste", (e) => {
|
|
1901
2089
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1902
|
-
I(t, L) && (e.preventDefault(),
|
|
2090
|
+
I(t, L) && (e.preventDefault(), w(`${o.value}${t}`));
|
|
1903
2091
|
}), o.addEventListener("blur", (e) => {
|
|
1904
|
-
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() &&
|
|
2092
|
+
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() && w(o.value, { quiet: !0 }), x());
|
|
1905
2093
|
});
|
|
1906
2094
|
} else e.addEventListener("keydown", (e) => {
|
|
1907
2095
|
if (v()) {
|
|
@@ -1929,21 +2117,21 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1929
2117
|
";",
|
|
1930
2118
|
"\n",
|
|
1931
2119
|
" "
|
|
1932
|
-
],
|
|
2120
|
+
], Ce = [
|
|
1933
2121
|
["description", "description"],
|
|
1934
2122
|
["avatar", "avatar"],
|
|
1935
2123
|
["initials", "initials"],
|
|
1936
2124
|
["disabled-hint", "disabledHint"]
|
|
1937
|
-
],
|
|
2125
|
+
], we = (e) => !!(e.description || e.avatar || e.initials || e.disabled || e.disabledHint), Te = (e) => {
|
|
1938
2126
|
let t = String(e ?? "").trim();
|
|
1939
2127
|
return /^(https?:)?\/\//i.test(t) || /^\/(?!\/)/.test(t) || /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t) ? t : "";
|
|
1940
|
-
},
|
|
1941
|
-
let t =
|
|
2128
|
+
}, Ee = (e) => {
|
|
2129
|
+
let t = Te(e.avatar);
|
|
1942
2130
|
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
|
-
},
|
|
2131
|
+
}, De = (e, t, n) => {
|
|
1944
2132
|
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>` : "";
|
|
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}${
|
|
1946
|
-
}, R = /* @__PURE__ */ new Map(),
|
|
2133
|
+
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}${Ee(e)}<span class="ms-check">${p("check")}</span></button>`;
|
|
2134
|
+
}, R = /* @__PURE__ */ new Map(), Oe = (e) => {
|
|
1947
2135
|
if (R.has(e)) return R.get(e);
|
|
1948
2136
|
let t = null;
|
|
1949
2137
|
try {
|
|
@@ -1952,7 +2140,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1952
2140
|
console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`);
|
|
1953
2141
|
}
|
|
1954
2142
|
return R.set(e, t), t;
|
|
1955
|
-
}, z = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), B = (e) => String(e ?? "").replace(/<[^>]*>/g, ""),
|
|
2143
|
+
}, z = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), B = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), ke = /[^0-9]/g, Ae = /[^0-9a-zA-Z]/g, je = class extends e {
|
|
1956
2144
|
static formAssociated = !0;
|
|
1957
2145
|
static get observedAttributes() {
|
|
1958
2146
|
return [
|
|
@@ -1983,7 +2171,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
1983
2171
|
this._value = this._clean(e), d(this, this._value), this._paint();
|
|
1984
2172
|
}
|
|
1985
2173
|
_clean(e) {
|
|
1986
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
2174
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? Ae : ke, "").slice(0, this.length);
|
|
1987
2175
|
}
|
|
1988
2176
|
constructor() {
|
|
1989
2177
|
super();
|
|
@@ -3304,7 +3492,7 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
3304
3492
|
"",
|
|
3305
3493
|
"",
|
|
3306
3494
|
""
|
|
3307
|
-
])[2],
|
|
3495
|
+
])[2], Me = {
|
|
3308
3496
|
AD: ["Europe/Andorra"],
|
|
3309
3497
|
AE: ["Asia/Dubai"],
|
|
3310
3498
|
AF: ["Asia/Kabul"],
|
|
@@ -3706,13 +3894,13 @@ var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), be = class extends
|
|
|
3706
3894
|
ZA: ["Africa/Johannesburg"],
|
|
3707
3895
|
ZM: ["Africa/Lusaka"],
|
|
3708
3896
|
ZW: ["Africa/Harare"]
|
|
3709
|
-
},
|
|
3710
|
-
for (let [e, t] of Object.entries(
|
|
3711
|
-
function
|
|
3712
|
-
let t =
|
|
3713
|
-
return t &&
|
|
3897
|
+
}, Ne = new Set(V.map(([e]) => e)), Pe = /* @__PURE__ */ new Map();
|
|
3898
|
+
for (let [e, t] of Object.entries(Me)) for (let n of t) Pe.set(n, e);
|
|
3899
|
+
function Fe(e) {
|
|
3900
|
+
let t = Pe.get(e);
|
|
3901
|
+
return t && Ne.has(t) ? t : null;
|
|
3714
3902
|
}
|
|
3715
|
-
function
|
|
3903
|
+
function Ie(e) {
|
|
3716
3904
|
if (!e) return null;
|
|
3717
3905
|
let t;
|
|
3718
3906
|
try {
|
|
@@ -3720,9 +3908,9 @@ function Pe(e) {
|
|
|
3720
3908
|
} catch {
|
|
3721
3909
|
return null;
|
|
3722
3910
|
}
|
|
3723
|
-
return t &&
|
|
3911
|
+
return t && Ne.has(t) ? t : null;
|
|
3724
3912
|
}
|
|
3725
|
-
function
|
|
3913
|
+
function Le() {
|
|
3726
3914
|
let e;
|
|
3727
3915
|
try {
|
|
3728
3916
|
e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -3730,33 +3918,33 @@ function Fe() {
|
|
|
3730
3918
|
e = void 0;
|
|
3731
3919
|
}
|
|
3732
3920
|
let t = typeof navigator > "u" ? void 0 : navigator.language;
|
|
3733
|
-
return
|
|
3921
|
+
return Fe(e) || Ie(t) || "IN";
|
|
3734
3922
|
}
|
|
3735
3923
|
//#endregion
|
|
3736
3924
|
//#region src/WuiPhone.js
|
|
3737
|
-
var
|
|
3738
|
-
function
|
|
3739
|
-
return U ? Promise.resolve(U) : (
|
|
3925
|
+
var Re = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, U = null, ze = null;
|
|
3926
|
+
function Be() {
|
|
3927
|
+
return U ? Promise.resolve(U) : (ze ||= Promise.all([import("./max-BDKx469G.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (U = {
|
|
3740
3928
|
AsYouType: e.AsYouType,
|
|
3741
3929
|
getExampleNumber: e.getExampleNumber,
|
|
3742
3930
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
3743
3931
|
parsePhoneNumber: e.parsePhoneNumber,
|
|
3744
3932
|
examples: t.default || t
|
|
3745
|
-
}, U)).catch(() => null),
|
|
3933
|
+
}, U)).catch(() => null), ze);
|
|
3746
3934
|
}
|
|
3747
|
-
function
|
|
3935
|
+
function Ve(e, t) {
|
|
3748
3936
|
let n = `+${H(e)}`;
|
|
3749
3937
|
return t?.startsWith(n) ? t.slice(n.length).trimStart() : null;
|
|
3750
3938
|
}
|
|
3751
3939
|
function W(e, t) {
|
|
3752
3940
|
if (!U || !t) return t;
|
|
3753
3941
|
try {
|
|
3754
|
-
return
|
|
3942
|
+
return Ve(e, new U.AsYouType(e).input(`+${H(e)}${t}`)) || t;
|
|
3755
3943
|
} catch {
|
|
3756
3944
|
return t;
|
|
3757
3945
|
}
|
|
3758
3946
|
}
|
|
3759
|
-
function
|
|
3947
|
+
function He(e, t) {
|
|
3760
3948
|
if (t <= 0) return 0;
|
|
3761
3949
|
let n = 0;
|
|
3762
3950
|
for (let r = 0; r < e.length; r++) if (/[0-9]/.test(e[r]) && (n += 1, n === t)) return r + 1;
|
|
@@ -3765,12 +3953,12 @@ function Be(e, t) {
|
|
|
3765
3953
|
function G(e) {
|
|
3766
3954
|
if (!U) return null;
|
|
3767
3955
|
try {
|
|
3768
|
-
return
|
|
3956
|
+
return Ve(e, U.getExampleNumber(e, U.examples)?.formatInternational()) || null;
|
|
3769
3957
|
} catch {
|
|
3770
3958
|
return null;
|
|
3771
3959
|
}
|
|
3772
3960
|
}
|
|
3773
|
-
function
|
|
3961
|
+
function Ue(e) {
|
|
3774
3962
|
if (!U || !e) return null;
|
|
3775
3963
|
try {
|
|
3776
3964
|
if (!U.isValidPhoneNumber(e)) return !1;
|
|
@@ -3780,7 +3968,7 @@ function Ve(e) {
|
|
|
3780
3968
|
return null;
|
|
3781
3969
|
}
|
|
3782
3970
|
}
|
|
3783
|
-
function
|
|
3971
|
+
function We(e) {
|
|
3784
3972
|
if (!U) return null;
|
|
3785
3973
|
try {
|
|
3786
3974
|
let t = U.getExampleNumber(e, U.examples);
|
|
@@ -3789,7 +3977,7 @@ function He(e) {
|
|
|
3789
3977
|
return null;
|
|
3790
3978
|
}
|
|
3791
3979
|
}
|
|
3792
|
-
function
|
|
3980
|
+
function Ge(e, t, n) {
|
|
3793
3981
|
try {
|
|
3794
3982
|
let r = U.parsePhoneNumber(t, e), i = r?.nationalNumber;
|
|
3795
3983
|
return !i || r.country !== e || i.length > n || !t.endsWith(i) ? null : i;
|
|
@@ -3797,7 +3985,7 @@ function Ue(e, t, n) {
|
|
|
3797
3985
|
return null;
|
|
3798
3986
|
}
|
|
3799
3987
|
}
|
|
3800
|
-
function
|
|
3988
|
+
function Ke(e) {
|
|
3801
3989
|
if (!U || !e?.trim().startsWith("+")) return null;
|
|
3802
3990
|
try {
|
|
3803
3991
|
let t = new U.AsYouType();
|
|
@@ -3811,7 +3999,7 @@ function We(e) {
|
|
|
3811
3999
|
return null;
|
|
3812
4000
|
}
|
|
3813
4001
|
}
|
|
3814
|
-
var
|
|
4002
|
+
var qe = class extends e {
|
|
3815
4003
|
static formAssociated = !0;
|
|
3816
4004
|
static get observedAttributes() {
|
|
3817
4005
|
return [
|
|
@@ -3831,7 +4019,7 @@ var Ge = class extends e {
|
|
|
3831
4019
|
} catch {
|
|
3832
4020
|
this._internals = null;
|
|
3833
4021
|
}
|
|
3834
|
-
this._defaultCountry =
|
|
4022
|
+
this._defaultCountry = Le(), this._country = this._defaultCountry, this._national = "", this._active = -1, this._committedValue = "";
|
|
3835
4023
|
}
|
|
3836
4024
|
connectedCallback() {
|
|
3837
4025
|
if (!this._rendered) {
|
|
@@ -3861,7 +4049,7 @@ var Ge = class extends e {
|
|
|
3861
4049
|
return this._national ? `+${H(this._country)}${this._national}` : "";
|
|
3862
4050
|
}
|
|
3863
4051
|
set value(e) {
|
|
3864
|
-
let t = String(e ?? "").trim(), n =
|
|
4052
|
+
let t = String(e ?? "").trim(), n = Ke(t);
|
|
3865
4053
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
3866
4054
|
else if (t.startsWith("+")) {
|
|
3867
4055
|
let e = t.replace(/[^0-9]/g, ""), n = String(H(this._country));
|
|
@@ -3884,12 +4072,12 @@ var Ge = class extends e {
|
|
|
3884
4072
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
3885
4073
|
let t = `${this.id}-listbox`;
|
|
3886
4074
|
this._listboxId = t;
|
|
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="${
|
|
4075
|
+
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="${Re(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
3888
4076
|
this.innerHTML = `
|
|
3889
4077
|
<div class="phone-input-wrap">
|
|
3890
4078
|
<div class="phone-country-adornment">
|
|
3891
4079
|
<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="${
|
|
4080
|
+
<span class="${Re(this._country)}" data-flag aria-hidden="true"></span>
|
|
3893
4081
|
${p("chevron-down", { className: "phone-chevron" })}
|
|
3894
4082
|
<span class="phone-dial" data-dial>+${H(this._country)}</span>
|
|
3895
4083
|
</button>
|
|
@@ -3929,7 +4117,7 @@ var Ge = class extends e {
|
|
|
3929
4117
|
}
|
|
3930
4118
|
a && (a.hidden = n > 0);
|
|
3931
4119
|
}, v = (e) => {
|
|
3932
|
-
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className =
|
|
4120
|
+
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = Re(e)), d && (d.textContent = `+${H(e)}`);
|
|
3933
4121
|
for (let t of this._itemEls()) {
|
|
3934
4122
|
let n = t.dataset.iso === e;
|
|
3935
4123
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
@@ -3976,23 +4164,23 @@ var Ge = class extends e {
|
|
|
3976
4164
|
};
|
|
3977
4165
|
o.addEventListener("input", (e) => {
|
|
3978
4166
|
e.stopPropagation();
|
|
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 =
|
|
4167
|
+
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 = We(this._country);
|
|
3980
4168
|
if (i && r.length > i) {
|
|
3981
|
-
let e =
|
|
4169
|
+
let e = Ge(this._country, r, i);
|
|
3982
4170
|
e ? (n = Math.max(0, n - (r.length - e.length)), r = e) : r = r.slice(0, i);
|
|
3983
4171
|
}
|
|
3984
4172
|
this._national = r;
|
|
3985
4173
|
let a = W(this._country, this._national);
|
|
3986
4174
|
if (o.value !== a) {
|
|
3987
4175
|
o.value = a;
|
|
3988
|
-
let e =
|
|
4176
|
+
let e = He(a, Math.min(n, r.length));
|
|
3989
4177
|
o.setSelectionRange(e, e);
|
|
3990
4178
|
}
|
|
3991
|
-
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national ||
|
|
4179
|
+
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national || Ue(this.value) === !0) && x(!1);
|
|
3992
4180
|
}), o.addEventListener("change", (e) => e.stopPropagation()), o.addEventListener("blur", () => {
|
|
3993
|
-
x(this._national.length > 0 &&
|
|
4181
|
+
x(this._national.length > 0 && Ue(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
3994
4182
|
}), o.addEventListener("paste", (e) => {
|
|
3995
|
-
let t =
|
|
4183
|
+
let t = Ke(e.clipboardData?.getData("text"));
|
|
3996
4184
|
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());
|
|
3997
4185
|
}), this._bindGlobal = () => {
|
|
3998
4186
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
@@ -4002,7 +4190,7 @@ var Ge = class extends e {
|
|
|
4002
4190
|
});
|
|
4003
4191
|
}, this._teardownGlobals = () => {
|
|
4004
4192
|
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), l(this);
|
|
4005
|
-
}, this._bindGlobal(),
|
|
4193
|
+
}, this._bindGlobal(), Be().then((e) => {
|
|
4006
4194
|
if (!(!e || !o.isConnected) && (this._national && (o.value = W(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
4007
4195
|
let e = G(this._country);
|
|
4008
4196
|
e && (o.placeholder = e);
|
|
@@ -4015,7 +4203,7 @@ var Ge = class extends e {
|
|
|
4015
4203
|
disconnectedCallback() {
|
|
4016
4204
|
this._teardown();
|
|
4017
4205
|
}
|
|
4018
|
-
}, K = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"),
|
|
4206
|
+
}, K = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), Je = class extends e {
|
|
4019
4207
|
static formAssociated = !0;
|
|
4020
4208
|
static get observedAttributes() {
|
|
4021
4209
|
return [
|
|
@@ -4221,7 +4409,7 @@ var Ge = class extends e {
|
|
|
4221
4409
|
disconnectedCallback() {
|
|
4222
4410
|
this._teardown();
|
|
4223
4411
|
}
|
|
4224
|
-
}, q = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"),
|
|
4412
|
+
}, q = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ye = class extends e {
|
|
4225
4413
|
static formAssociated = !0;
|
|
4226
4414
|
static get observedAttributes() {
|
|
4227
4415
|
return [
|
|
@@ -4363,7 +4551,7 @@ var Ge = class extends e {
|
|
|
4363
4551
|
aria-valuenow="${this._value}"
|
|
4364
4552
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
4365
4553
|
${a ? "disabled" : ""}
|
|
4366
|
-
aria-label="${
|
|
4554
|
+
aria-label="${Xe(this.getAttribute("aria-label") || "Value")}"
|
|
4367
4555
|
></button>
|
|
4368
4556
|
`}
|
|
4369
4557
|
${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>` : ""}
|
|
@@ -4466,7 +4654,7 @@ var Ge = class extends e {
|
|
|
4466
4654
|
}, J = (e, t) => {
|
|
4467
4655
|
let n = Number.parseFloat(e);
|
|
4468
4656
|
return Number.isFinite(n) ? n : t;
|
|
4469
|
-
},
|
|
4657
|
+
}, Xe = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ze = class extends e {
|
|
4470
4658
|
static formAssociated = !0;
|
|
4471
4659
|
_accessibleName() {
|
|
4472
4660
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -4551,14 +4739,14 @@ var Ge = class extends e {
|
|
|
4551
4739
|
e.innerHTML = "";
|
|
4552
4740
|
return;
|
|
4553
4741
|
}
|
|
4554
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
4742
|
+
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${Qe(e)}</span><button type="button" class="chip-remove" data-remove="${Y(e)}" aria-label="Remove ${Y(e)}">${p("x")}</button></span>`).join("");
|
|
4555
4743
|
}
|
|
4556
4744
|
}
|
|
4557
4745
|
_wire() {
|
|
4558
4746
|
this._teardown();
|
|
4559
4747
|
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
4560
4748
|
if (!e || !t) return;
|
|
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(
|
|
4749
|
+
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(ye).filter(Boolean)), s = () => {
|
|
4562
4750
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
4563
4751
|
}, c = (e) => {
|
|
4564
4752
|
let t = e.trim();
|
|
@@ -4590,9 +4778,9 @@ var Ge = class extends e {
|
|
|
4590
4778
|
e.preventDefault();
|
|
4591
4779
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
4592
4780
|
for (let e of r) {
|
|
4593
|
-
let t =
|
|
4781
|
+
let t = be(e) ?? e;
|
|
4594
4782
|
if (I(n, [t])) {
|
|
4595
|
-
a.push(...
|
|
4783
|
+
a.push(...xe(n, [t]));
|
|
4596
4784
|
break;
|
|
4597
4785
|
}
|
|
4598
4786
|
}
|
|
@@ -4620,18 +4808,18 @@ var Ge = class extends e {
|
|
|
4620
4808
|
disconnectedCallback() {
|
|
4621
4809
|
this._teardown();
|
|
4622
4810
|
}
|
|
4623
|
-
},
|
|
4811
|
+
}, Qe = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Y = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), $e = (e) => String(e).padStart(2, "0"), et = (e, t) => `${$e(e)}:${$e(t)}`, X = (e) => {
|
|
4624
4812
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
4625
4813
|
return t ? {
|
|
4626
4814
|
h: +t[1],
|
|
4627
4815
|
m: +t[2]
|
|
4628
4816
|
} : null;
|
|
4629
|
-
},
|
|
4817
|
+
}, tt = (e, t = "24") => {
|
|
4630
4818
|
if (!e) return "";
|
|
4631
|
-
if (t === "24") return
|
|
4819
|
+
if (t === "24") return et(e.h, e.m);
|
|
4632
4820
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
4633
|
-
return `${n}:${
|
|
4634
|
-
},
|
|
4821
|
+
return `${n}:${$e(e.m)} ${r}`;
|
|
4822
|
+
}, nt = class extends e {
|
|
4635
4823
|
static formAssociated = !0;
|
|
4636
4824
|
static get observedAttributes() {
|
|
4637
4825
|
return [
|
|
@@ -4682,7 +4870,7 @@ var Ge = class extends e {
|
|
|
4682
4870
|
this.innerHTML = `
|
|
4683
4871
|
<div class="timepicker">
|
|
4684
4872
|
<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)}"` : ""}>
|
|
4685
|
-
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ?
|
|
4873
|
+
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? tt(t, n) : g(e)}</span>
|
|
4686
4874
|
${p("clock")}
|
|
4687
4875
|
</button>
|
|
4688
4876
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
@@ -4695,7 +4883,7 @@ var Ge = class extends e {
|
|
|
4695
4883
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
4696
4884
|
if (!t) return;
|
|
4697
4885
|
let n = X(this._value), r = this.getAttribute("format") || "24";
|
|
4698
|
-
t.textContent = n ?
|
|
4886
|
+
t.textContent = n ? tt(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
4699
4887
|
}
|
|
4700
4888
|
_buildTimes() {
|
|
4701
4889
|
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) || {
|
|
@@ -4716,8 +4904,8 @@ var Ge = class extends e {
|
|
|
4716
4904
|
if (!e) return;
|
|
4717
4905
|
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = X(this._value), i = this._focus, a = "";
|
|
4718
4906
|
for (let e = 0; e < n.length; e++) {
|
|
4719
|
-
let o = n[e], s =
|
|
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\"" : ""}>${
|
|
4907
|
+
let o = n[e], s = et(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
4908
|
+
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${tt(o, t)}</button>`;
|
|
4721
4909
|
}
|
|
4722
4910
|
e.innerHTML = a, this._focusActive();
|
|
4723
4911
|
}
|
|
@@ -4815,7 +5003,7 @@ var Ge = class extends e {
|
|
|
4815
5003
|
disconnectedCallback() {
|
|
4816
5004
|
this._teardown();
|
|
4817
5005
|
}
|
|
4818
|
-
},
|
|
5006
|
+
}, rt = "wui-wizard-step", it = class extends e {
|
|
4819
5007
|
static get observedAttributes() {
|
|
4820
5008
|
return [
|
|
4821
5009
|
"active",
|
|
@@ -4849,7 +5037,7 @@ var Ge = class extends e {
|
|
|
4849
5037
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
4850
5038
|
}
|
|
4851
5039
|
get _steps() {
|
|
4852
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
5040
|
+
return [...this.querySelectorAll(`:scope > ${rt}`)];
|
|
4853
5041
|
}
|
|
4854
5042
|
refresh() {
|
|
4855
5043
|
this._rendered && this._renderChrome();
|
|
@@ -4986,7 +5174,7 @@ var Ge = class extends e {
|
|
|
4986
5174
|
_reflectActive(e) {
|
|
4987
5175
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
4988
5176
|
}
|
|
4989
|
-
}, Z = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
|
|
5177
|
+
}, Z = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), at = class extends e {
|
|
4990
5178
|
static get observedAttributes() {
|
|
4991
5179
|
return [
|
|
4992
5180
|
"label",
|
|
@@ -5000,8 +5188,8 @@ var Ge = class extends e {
|
|
|
5000
5188
|
let e = this.closest("wui-wizard");
|
|
5001
5189
|
e && typeof e.refresh == "function" && e.refresh();
|
|
5002
5190
|
}
|
|
5003
|
-
},
|
|
5004
|
-
async function
|
|
5191
|
+
}, ot = 2e3;
|
|
5192
|
+
async function st(e) {
|
|
5005
5193
|
try {
|
|
5006
5194
|
if (navigator.clipboard?.writeText) return await navigator.clipboard.writeText(e), !0;
|
|
5007
5195
|
} catch {}
|
|
@@ -5016,14 +5204,14 @@ async function at(e) {
|
|
|
5016
5204
|
}
|
|
5017
5205
|
//#endregion
|
|
5018
5206
|
//#region src/fileValidation.js
|
|
5019
|
-
var
|
|
5207
|
+
var ct = "image/png,image/jpeg,image/webp", lt = 5, ut = {
|
|
5020
5208
|
"image/png": [".png"],
|
|
5021
5209
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
5022
5210
|
"image/webp": [".webp"],
|
|
5023
5211
|
"image/gif": [".gif"],
|
|
5024
5212
|
"image/svg+xml": [".svg"],
|
|
5025
5213
|
"application/pdf": [".pdf"]
|
|
5026
|
-
},
|
|
5214
|
+
}, dt = {
|
|
5027
5215
|
"image/png": "PNG",
|
|
5028
5216
|
"image/jpeg": "JPG",
|
|
5029
5217
|
"image/webp": "WEBP",
|
|
@@ -5037,7 +5225,7 @@ var ot = "image/png,image/jpeg,image/webp", st = 5, ct = {
|
|
|
5037
5225
|
".gif": "GIF",
|
|
5038
5226
|
".svg": "SVG",
|
|
5039
5227
|
".pdf": "PDF"
|
|
5040
|
-
},
|
|
5228
|
+
}, ft = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), pt = [
|
|
5041
5229
|
".png",
|
|
5042
5230
|
".jpg",
|
|
5043
5231
|
".jpeg",
|
|
@@ -5048,35 +5236,35 @@ var ot = "image/png,image/jpeg,image/webp", st = 5, ct = {
|
|
|
5048
5236
|
".avif",
|
|
5049
5237
|
".heic"
|
|
5050
5238
|
];
|
|
5051
|
-
function
|
|
5239
|
+
function mt(e) {
|
|
5052
5240
|
if (!e) return !1;
|
|
5053
5241
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
5054
5242
|
if (t) return t.startsWith("image/");
|
|
5055
5243
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
5056
|
-
return
|
|
5244
|
+
return pt.some((e) => r.endsWith(e));
|
|
5057
5245
|
}
|
|
5058
|
-
function
|
|
5059
|
-
let t =
|
|
5060
|
-
return t.length ? t.every((e) => e.startsWith(".") ?
|
|
5246
|
+
function ht(e) {
|
|
5247
|
+
let t = ft(e);
|
|
5248
|
+
return t.length ? t.every((e) => e.startsWith(".") ? pt.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
5061
5249
|
}
|
|
5062
|
-
function
|
|
5250
|
+
function gt(e) {
|
|
5063
5251
|
let t = [];
|
|
5064
|
-
for (let n of
|
|
5065
|
-
let e =
|
|
5252
|
+
for (let n of ft(e)) {
|
|
5253
|
+
let e = dt[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
5066
5254
|
t.includes(e) || t.push(e);
|
|
5067
5255
|
}
|
|
5068
5256
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
5069
5257
|
}
|
|
5070
|
-
function
|
|
5071
|
-
let n =
|
|
5258
|
+
function _t(e, t) {
|
|
5259
|
+
let n = ft(t);
|
|
5072
5260
|
if (!n.length) return !0;
|
|
5073
5261
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
5074
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
5262
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (ut[e] || []).some((e) => i.endsWith(e)));
|
|
5075
5263
|
}
|
|
5076
|
-
function
|
|
5264
|
+
function vt(e, t = {}) {
|
|
5077
5265
|
if (!e) return null;
|
|
5078
|
-
let n = t.accept === void 0 ?
|
|
5079
|
-
return
|
|
5266
|
+
let n = t.accept === void 0 ? ct : t.accept, r = t.maxSizeMb || 5;
|
|
5267
|
+
return _t(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${gt(n)} file.`;
|
|
5080
5268
|
}
|
|
5081
5269
|
//#endregion
|
|
5082
5270
|
//#region src/passwordRules.js
|
|
@@ -5087,15 +5275,15 @@ var Q = {
|
|
|
5087
5275
|
digit: !0,
|
|
5088
5276
|
special: !0,
|
|
5089
5277
|
uniqueChars: 0
|
|
5090
|
-
},
|
|
5091
|
-
function
|
|
5278
|
+
}, yt = "Password Requirements";
|
|
5279
|
+
function bt(e) {
|
|
5092
5280
|
return e === !0 || e == null ? { ...Q } : {
|
|
5093
5281
|
...Q,
|
|
5094
5282
|
...e
|
|
5095
5283
|
};
|
|
5096
5284
|
}
|
|
5097
|
-
function
|
|
5098
|
-
let t =
|
|
5285
|
+
function xt(e) {
|
|
5286
|
+
let t = bt(e), n = [];
|
|
5099
5287
|
if (t.minLength > 0 && n.push({
|
|
5100
5288
|
key: "length",
|
|
5101
5289
|
label: `At least ${t.minLength} characters long`,
|
|
@@ -5126,25 +5314,25 @@ function yt(e) {
|
|
|
5126
5314
|
}
|
|
5127
5315
|
return n;
|
|
5128
5316
|
}
|
|
5129
|
-
function
|
|
5317
|
+
function St(e, t) {
|
|
5130
5318
|
let n = e == null ? "" : String(e);
|
|
5131
|
-
return
|
|
5319
|
+
return xt(t).map((e) => ({
|
|
5132
5320
|
key: e.key,
|
|
5133
5321
|
label: e.label,
|
|
5134
5322
|
met: e.test(n)
|
|
5135
5323
|
}));
|
|
5136
5324
|
}
|
|
5137
|
-
function
|
|
5138
|
-
return
|
|
5325
|
+
function Ct(e, t) {
|
|
5326
|
+
return St(e, t).every((e) => e.met);
|
|
5139
5327
|
}
|
|
5140
5328
|
//#endregion
|
|
5141
5329
|
//#region src/index.js
|
|
5142
5330
|
var $ = (e, t) => {
|
|
5143
5331
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
5144
5332
|
};
|
|
5145
|
-
function
|
|
5146
|
-
$("wui-select",
|
|
5333
|
+
function wt() {
|
|
5334
|
+
$("wui-select", Je), $("wui-phone", qe), $("wui-datepicker", se), $("wui-date-range", ce), $("wui-dock", le), $("wui-feedback", me), $("wui-consent-banner", ie), $("wui-slider", Ye), $("wui-timepicker", nt), $("wui-autocomplete", y), $("wui-multiselect", Se), $("wui-taginput", Ze), $("wui-otp", je), $("wui-status-icon", r), $("wui-wizard-step", at), $("wui-wizard", it);
|
|
5147
5335
|
}
|
|
5148
|
-
|
|
5336
|
+
wt();
|
|
5149
5337
|
//#endregion
|
|
5150
|
-
export {
|
|
5338
|
+
export { ot as COPY_FEEDBACK_MS, ct as DEFAULT_IMAGE_ACCEPT, lt as DEFAULT_MAX_SIZE_MB, Q as DEFAULT_PASSWORD_RULES, yt as DEFAULT_REQUIREMENTS_TITLE, n as STATUS_TONES, y as WuiAutocomplete, ie as WuiConsentBanner, se as WuiDatePicker, ce as WuiDateRange, le as WuiDock, me as WuiFeedback, Se as WuiMultiSelect, je as WuiOtp, qe as WuiPhone, Je as WuiSelect, Ye as WuiSlider, r as WuiStatusIcon, Ze as WuiTagInput, nt as WuiTimePicker, it as WuiWizard, at as WuiWizardStep, gt as acceptLabel, xt as buildPasswordRules, st as copyTextToClipboard, wt as defineWeborityElements, St as evaluatePassword, p as glyphSvg, mt as isImageFile, ht as isImageOnlyAccept, _t as matchesAccept, Ct as passwordSatisfies, vt as validateFile };
|