@webority/ui-elements 0.12.2 → 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 +201 -0
- package/dist/ui-elements.global.js +252 -74
- package/dist/ui-elements.js +498 -300
- package/package.json +3 -2
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,12 +748,12 @@ 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
|
|
567
755
|
}, this._settings = !1, this._onDocumentClick = (e) => {
|
|
568
|
-
e.target instanceof Element && e.target.closest(
|
|
756
|
+
e.target instanceof Element && e.target.closest(te) && (e.preventDefault(), this.open({
|
|
569
757
|
settings: !0,
|
|
570
758
|
focus: !0
|
|
571
759
|
}));
|
|
@@ -577,14 +765,20 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
577
765
|
set position(e) {
|
|
578
766
|
this.setAttribute("position", String(e ?? "bottom-left"));
|
|
579
767
|
}
|
|
768
|
+
get standalone() {
|
|
769
|
+
return this.hasAttribute("standalone");
|
|
770
|
+
}
|
|
771
|
+
set standalone(e) {
|
|
772
|
+
this.toggleAttribute("standalone", e === !0 || e === "" || e === "true");
|
|
773
|
+
}
|
|
580
774
|
get heading() {
|
|
581
|
-
return this.getAttribute("heading") ||
|
|
775
|
+
return this.getAttribute("heading") || T.heading;
|
|
582
776
|
}
|
|
583
777
|
set heading(e) {
|
|
584
778
|
this.setAttribute("heading", String(e ?? ""));
|
|
585
779
|
}
|
|
586
780
|
get description() {
|
|
587
|
-
return this.getAttribute("description") ||
|
|
781
|
+
return this.getAttribute("description") || T.description;
|
|
588
782
|
}
|
|
589
783
|
set description(e) {
|
|
590
784
|
this.setAttribute("description", String(e ?? ""));
|
|
@@ -596,25 +790,25 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
596
790
|
this.setAttribute("policy-href", String(e ?? ""));
|
|
597
791
|
}
|
|
598
792
|
get policyLabel() {
|
|
599
|
-
return this.getAttribute("policy-label") ||
|
|
793
|
+
return this.getAttribute("policy-label") || T.policyLabel;
|
|
600
794
|
}
|
|
601
795
|
set policyLabel(e) {
|
|
602
796
|
this.setAttribute("policy-label", String(e ?? ""));
|
|
603
797
|
}
|
|
604
798
|
get analyticsDescription() {
|
|
605
|
-
return this.getAttribute("analytics-description") ||
|
|
799
|
+
return this.getAttribute("analytics-description") || T.analyticsDescription;
|
|
606
800
|
}
|
|
607
801
|
set analyticsDescription(e) {
|
|
608
802
|
this.setAttribute("analytics-description", String(e ?? ""));
|
|
609
803
|
}
|
|
610
804
|
get functionalDescription() {
|
|
611
|
-
return this.getAttribute("functional-description") ||
|
|
805
|
+
return this.getAttribute("functional-description") || T.functionalDescription;
|
|
612
806
|
}
|
|
613
807
|
set functionalDescription(e) {
|
|
614
808
|
this.setAttribute("functional-description", String(e ?? ""));
|
|
615
809
|
}
|
|
616
810
|
get marketingDescription() {
|
|
617
|
-
return this.getAttribute("marketing-description") ||
|
|
811
|
+
return this.getAttribute("marketing-description") || T.marketingDescription;
|
|
618
812
|
}
|
|
619
813
|
set marketingDescription(e) {
|
|
620
814
|
this.setAttribute("marketing-description", String(e ?? ""));
|
|
@@ -642,48 +836,52 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
642
836
|
this._rendered && this.render();
|
|
643
837
|
}
|
|
644
838
|
render() {
|
|
645
|
-
let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${
|
|
646
|
-
|
|
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>`}
|
|
647
841
|
<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">${
|
|
842
|
+
<h2 class="wui-consent-banner-heading" id="${t}-heading">${D(this.heading)}</h2>
|
|
843
|
+
<p class="wui-consent-banner-description" id="${t}-description">${D(this.description)}${n}</p>
|
|
650
844
|
<div class="wui-consent-banner-settings" hidden>
|
|
651
|
-
${
|
|
652
|
-
${
|
|
653
|
-
${
|
|
654
|
-
${
|
|
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)}
|
|
655
849
|
</div>
|
|
656
850
|
<div class="wui-consent-banner-actions">
|
|
657
|
-
<button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${
|
|
658
|
-
<button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${
|
|
659
|
-
<button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${
|
|
660
|
-
<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>
|
|
661
855
|
</div>
|
|
662
856
|
</div>`, this._rendered = !0, this._wire(), this._applyPreferences(), this._showSettings(this._settings), e && (this._panel().hidden = !1);
|
|
663
857
|
}
|
|
664
858
|
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();
|
|
859
|
+
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
860
|
}
|
|
667
861
|
close() {
|
|
668
862
|
let e = this._panel();
|
|
669
863
|
e && (e.hidden = !0), this.removeAttribute("open"), this._showSettings(!1);
|
|
670
864
|
}
|
|
865
|
+
_root() {
|
|
866
|
+
return this.shadowRoot ? this.shadowRoot : this.standalone ? this.attachShadow({ mode: "open" }) : this;
|
|
867
|
+
}
|
|
671
868
|
_panel() {
|
|
672
|
-
return this.querySelector(".wui-consent-banner-panel");
|
|
869
|
+
return this._root().querySelector(".wui-consent-banner-panel");
|
|
673
870
|
}
|
|
674
871
|
_wire() {
|
|
675
|
-
|
|
872
|
+
let e = this._root();
|
|
873
|
+
e.querySelector(".wui-consent-banner-accept")?.addEventListener("click", () => this._save({
|
|
676
874
|
analytics: !0,
|
|
677
875
|
functional: !0,
|
|
678
876
|
marketing: !0
|
|
679
|
-
})),
|
|
877
|
+
})), e.querySelector(".wui-consent-banner-reject")?.addEventListener("click", () => this._save({
|
|
680
878
|
analytics: !1,
|
|
681
879
|
functional: !1,
|
|
682
880
|
marketing: !1
|
|
683
|
-
})),
|
|
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));
|
|
684
882
|
}
|
|
685
883
|
_save(e) {
|
|
686
|
-
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(
|
|
884
|
+
this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(w, {
|
|
687
885
|
bubbles: !0,
|
|
688
886
|
composed: !0,
|
|
689
887
|
detail: { ...e }
|
|
@@ -691,39 +889,39 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
691
889
|
}
|
|
692
890
|
_switchValues() {
|
|
693
891
|
let e = {};
|
|
694
|
-
for (let t of
|
|
892
|
+
for (let t of ne) e[t] = this._root().querySelector(`input[data-category="${t}"]`)?.checked === !0;
|
|
695
893
|
return e;
|
|
696
894
|
}
|
|
697
895
|
_applyPreferences() {
|
|
698
|
-
for (let e of
|
|
699
|
-
let t = this.querySelector(`input[data-category="${e}"]`);
|
|
896
|
+
for (let e of ne) {
|
|
897
|
+
let t = this._root().querySelector(`input[data-category="${e}"]`);
|
|
700
898
|
t && (t.checked = this._preferences[e]);
|
|
701
899
|
}
|
|
702
900
|
}
|
|
703
901
|
_showSettings(e) {
|
|
704
902
|
this._settings = e;
|
|
705
|
-
let t = this.querySelector(".wui-consent-banner-settings");
|
|
706
|
-
if (!
|
|
707
|
-
|
|
708
|
-
let
|
|
709
|
-
|
|
710
|
-
for (let
|
|
711
|
-
let
|
|
712
|
-
|
|
903
|
+
let t = this._root(), n = t.querySelector(".wui-consent-banner-settings");
|
|
904
|
+
if (!n) return;
|
|
905
|
+
n.hidden = !e, t.querySelector(".wui-consent-banner-settings-toggle")?.setAttribute("aria-expanded", e ? "true" : "false");
|
|
906
|
+
let r = t.querySelector(".wui-consent-banner-save");
|
|
907
|
+
r && (r.hidden = !e);
|
|
908
|
+
for (let n of [".wui-consent-banner-reject", ".wui-consent-banner-accept"]) {
|
|
909
|
+
let r = t.querySelector(n);
|
|
910
|
+
r && (r.hidden = e);
|
|
713
911
|
}
|
|
714
912
|
}
|
|
715
913
|
};
|
|
716
|
-
function
|
|
914
|
+
function E(e, t, n, r, i) {
|
|
717
915
|
let a = `${e}-${t}`;
|
|
718
916
|
return `<div class="wui-consent-banner-category">
|
|
719
917
|
<div class="form-check form-switch">
|
|
720
918
|
<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}">${
|
|
919
|
+
<label class="form-check-label" for="${a}">${D(n)}</label>
|
|
722
920
|
</div>
|
|
723
|
-
<p class="wui-consent-banner-category-description">${
|
|
921
|
+
<p class="wui-consent-banner-category-description">${D(r)}</p>
|
|
724
922
|
</div>`;
|
|
725
923
|
}
|
|
726
|
-
var
|
|
924
|
+
var D = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ae = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), O = [
|
|
727
925
|
"January",
|
|
728
926
|
"February",
|
|
729
927
|
"March",
|
|
@@ -736,7 +934,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
736
934
|
"October",
|
|
737
935
|
"November",
|
|
738
936
|
"December"
|
|
739
|
-
],
|
|
937
|
+
], k = [
|
|
740
938
|
"Su",
|
|
741
939
|
"Mo",
|
|
742
940
|
"Tu",
|
|
@@ -744,24 +942,24 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
744
942
|
"Th",
|
|
745
943
|
"Fr",
|
|
746
944
|
"Sa"
|
|
747
|
-
],
|
|
945
|
+
], oe = (e) => String(e).padStart(2, "0"), A = (e, t, n) => `${e}-${oe(t + 1)}-${oe(n)}`, j = (e) => {
|
|
748
946
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
749
947
|
return t ? {
|
|
750
948
|
y: +t[1],
|
|
751
949
|
m: t[2] - 1,
|
|
752
950
|
d: +t[3]
|
|
753
951
|
} : null;
|
|
754
|
-
},
|
|
755
|
-
let t =
|
|
756
|
-
return t ? `${
|
|
757
|
-
},
|
|
952
|
+
}, M = (e) => {
|
|
953
|
+
let t = j(e);
|
|
954
|
+
return t ? `${oe(t.d)} ${O[t.m].slice(0, 3)} ${t.y}` : "";
|
|
955
|
+
}, N = (e, t) => new Date(e, t + 1, 0).getDate(), P = (e, t) => {
|
|
758
956
|
for (; t < 0;) t += 12, --e;
|
|
759
957
|
for (; t > 11;) t -= 12, e += 1;
|
|
760
958
|
return {
|
|
761
959
|
y: e,
|
|
762
960
|
m: t
|
|
763
961
|
};
|
|
764
|
-
},
|
|
962
|
+
}, se = class extends e {
|
|
765
963
|
static formAssociated = !0;
|
|
766
964
|
static get observedAttributes() {
|
|
767
965
|
return [
|
|
@@ -812,13 +1010,13 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
812
1010
|
}
|
|
813
1011
|
render() {
|
|
814
1012
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
815
|
-
let e = this.getAttribute("placeholder") || "Enter Date", t =
|
|
1013
|
+
let e = this.getAttribute("placeholder") || "Enter Date", t = j(this._value);
|
|
816
1014
|
t && (this._viewY = t.y, this._viewM = t.m);
|
|
817
1015
|
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
1016
|
this.innerHTML = `
|
|
819
1017
|
<div class="datepicker">
|
|
820
1018
|
<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 ?
|
|
1019
|
+
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? M(this._value) : g(e)}</span>
|
|
822
1020
|
${p("calendar-dots")}
|
|
823
1021
|
</button>
|
|
824
1022
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
@@ -830,11 +1028,11 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
830
1028
|
_syncTrigger() {
|
|
831
1029
|
let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
832
1030
|
if (!t) return;
|
|
833
|
-
let n =
|
|
834
|
-
t.textContent = n ?
|
|
1031
|
+
let n = j(this._value);
|
|
1032
|
+
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
1033
|
}
|
|
836
1034
|
_limits() {
|
|
837
|
-
let e =
|
|
1035
|
+
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
1036
|
return {
|
|
839
1037
|
dayDisabled: (e, t, i) => {
|
|
840
1038
|
let a = new Date(e, t, i).getTime();
|
|
@@ -842,7 +1040,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
842
1040
|
},
|
|
843
1041
|
monthDisabled: (e, t) => {
|
|
844
1042
|
let i = new Date(e, t, 1).getTime();
|
|
845
|
-
return new Date(e, t,
|
|
1043
|
+
return new Date(e, t, N(e, t)).getTime() < n || i > r;
|
|
846
1044
|
},
|
|
847
1045
|
yearDisabled: (e) => {
|
|
848
1046
|
let t = new Date(e, 0, 1).getTime();
|
|
@@ -855,28 +1053,28 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
855
1053
|
e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
|
|
856
1054
|
}
|
|
857
1055
|
_daysHtml() {
|
|
858
|
-
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n =
|
|
1056
|
+
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
1057
|
y: this._viewY,
|
|
860
1058
|
m: this._viewM,
|
|
861
1059
|
d: 1
|
|
862
1060
|
}, s = (e, t, n, s) => {
|
|
863
|
-
let c =
|
|
1061
|
+
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
1062
|
return `<button type="button" class="${[
|
|
865
1063
|
"datepicker-day",
|
|
866
1064
|
s ? "is-outside" : "",
|
|
867
1065
|
u ? "is-today" : "",
|
|
868
1066
|
l ? "is-selected" : ""
|
|
869
1067
|
].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 =
|
|
1068
|
+
}, c = "", l = P(this._viewY, this._viewM - 1), u = N(l.y, l.m);
|
|
871
1069
|
for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
872
1070
|
for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
|
|
873
|
-
let d =
|
|
1071
|
+
let d = P(this._viewY, this._viewM + 1), f = (7 - (t + n) % 7) % 7;
|
|
874
1072
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
875
|
-
let m =
|
|
1073
|
+
let m = k.map((t, n) => k[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
|
|
876
1074
|
return `
|
|
877
1075
|
<div class="datepicker-head">
|
|
878
1076
|
<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">${
|
|
1077
|
+
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${O[this._viewM]} ${this._viewY}</button>
|
|
880
1078
|
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${p("chevron-right")}</button>
|
|
881
1079
|
</div>
|
|
882
1080
|
<div class="datepicker-weekdays">${m}</div>
|
|
@@ -887,14 +1085,14 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
887
1085
|
</div>`;
|
|
888
1086
|
}
|
|
889
1087
|
_monthsHtml() {
|
|
890
|
-
let e =
|
|
1088
|
+
let e = j(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
|
|
891
1089
|
for (let i = 0; i < 12; i++) {
|
|
892
1090
|
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
1091
|
"datepicker-cell",
|
|
894
1092
|
o ? "is-today" : "",
|
|
895
1093
|
a ? "is-selected" : ""
|
|
896
1094
|
].filter(Boolean).join(" ");
|
|
897
|
-
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${
|
|
1095
|
+
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${O[i].slice(0, 3)}</button>`;
|
|
898
1096
|
}
|
|
899
1097
|
return `
|
|
900
1098
|
<div class="datepicker-head">
|
|
@@ -905,7 +1103,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
905
1103
|
<div class="datepicker-cells">${r}</div>`;
|
|
906
1104
|
}
|
|
907
1105
|
_yearsHtml() {
|
|
908
|
-
let e =
|
|
1106
|
+
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
1107
|
for (let a = 0; a < 12; a++) {
|
|
910
1108
|
let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
|
|
911
1109
|
"datepicker-cell",
|
|
@@ -930,21 +1128,21 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
930
1128
|
s(e, t, { clampHeight: !0 });
|
|
931
1129
|
}
|
|
932
1130
|
_setFocus(e, t, n, r) {
|
|
933
|
-
let { y: i, m: a } =
|
|
1131
|
+
let { y: i, m: a } = P(e, t);
|
|
934
1132
|
this._focus = {
|
|
935
1133
|
y: i,
|
|
936
1134
|
m: a,
|
|
937
1135
|
d: n
|
|
938
1136
|
};
|
|
939
1137
|
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="${
|
|
1138
|
+
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
1139
|
}
|
|
942
1140
|
_onKey(e) {
|
|
943
1141
|
if (this._mode !== "days") {
|
|
944
1142
|
e.key === "Escape" && this._close();
|
|
945
1143
|
return;
|
|
946
1144
|
}
|
|
947
|
-
let t = this._focus ||
|
|
1145
|
+
let t = this._focus || j(this._value) || {
|
|
948
1146
|
y: this._viewY,
|
|
949
1147
|
m: this._viewM,
|
|
950
1148
|
d: 1
|
|
@@ -962,17 +1160,17 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
962
1160
|
case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
|
|
963
1161
|
case "PageUp": {
|
|
964
1162
|
e.preventDefault();
|
|
965
|
-
let n =
|
|
966
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
1163
|
+
let n = P(t.y, t.m - (e.shiftKey ? 12 : 1));
|
|
1164
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, N(n.y, n.m)), "slide-prev");
|
|
967
1165
|
}
|
|
968
1166
|
case "PageDown": {
|
|
969
1167
|
e.preventDefault();
|
|
970
|
-
let n =
|
|
971
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
1168
|
+
let n = P(t.y, t.m + (e.shiftKey ? 12 : 1));
|
|
1169
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, N(n.y, n.m)), "slide-next");
|
|
972
1170
|
}
|
|
973
1171
|
case "Enter":
|
|
974
1172
|
case " ":
|
|
975
|
-
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value =
|
|
1173
|
+
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
1174
|
return;
|
|
977
1175
|
case "Escape": return this._close();
|
|
978
1176
|
default:
|
|
@@ -984,7 +1182,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
984
1182
|
if (!e || !t) return;
|
|
985
1183
|
let r = () => !t.hidden;
|
|
986
1184
|
this._open = () => {
|
|
987
|
-
let r = /* @__PURE__ */ new Date(), i =
|
|
1185
|
+
let r = /* @__PURE__ */ new Date(), i = j(this._value);
|
|
988
1186
|
(i || !this._viewNavigated) && (this._viewY = r.getFullYear(), this._viewM = r.getMonth()), this._mode = "days";
|
|
989
1187
|
let a = r.getFullYear() === this._viewY && r.getMonth() === this._viewM, o = i && i.y === this._viewY && i.m === this._viewM;
|
|
990
1188
|
this._focus = o ? i : {
|
|
@@ -999,7 +1197,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
999
1197
|
let t = e.target.closest("[data-nav]");
|
|
1000
1198
|
if (t) {
|
|
1001
1199
|
this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
|
|
1002
|
-
let e =
|
|
1200
|
+
let e = P(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
1003
1201
|
this._viewY = e.y, this._viewM = e.m, this._focus = {
|
|
1004
1202
|
y: e.y,
|
|
1005
1203
|
m: e.m,
|
|
@@ -1038,7 +1236,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1038
1236
|
}
|
|
1039
1237
|
if (e.target.closest("[data-today]")) {
|
|
1040
1238
|
let e = /* @__PURE__ */ new Date();
|
|
1041
|
-
this.value =
|
|
1239
|
+
this.value = A(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
|
|
1042
1240
|
return;
|
|
1043
1241
|
}
|
|
1044
1242
|
if (e.target.closest("[data-clear]")) {
|
|
@@ -1066,7 +1264,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1066
1264
|
disconnectedCallback() {
|
|
1067
1265
|
this._teardown();
|
|
1068
1266
|
}
|
|
1069
|
-
},
|
|
1267
|
+
}, ce = class extends e {
|
|
1070
1268
|
static formAssociated = !0;
|
|
1071
1269
|
static get observedAttributes() {
|
|
1072
1270
|
return [
|
|
@@ -1125,13 +1323,13 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1125
1323
|
text: e,
|
|
1126
1324
|
empty: !0
|
|
1127
1325
|
} : {
|
|
1128
|
-
text: `${
|
|
1326
|
+
text: `${M(this._start) || "Start"} – ${M(this._end) || "End"}`,
|
|
1129
1327
|
empty: !1
|
|
1130
1328
|
};
|
|
1131
1329
|
}
|
|
1132
1330
|
render() {
|
|
1133
1331
|
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 =
|
|
1332
|
+
let e = j(this._start);
|
|
1135
1333
|
e && (this._viewY = e.y, this._viewM = e.m);
|
|
1136
1334
|
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
1335
|
this.innerHTML = `
|
|
@@ -1165,24 +1363,24 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1165
1363
|
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
1364
|
}
|
|
1167
1365
|
_limits() {
|
|
1168
|
-
let e =
|
|
1366
|
+
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
1367
|
return (e, t, i) => {
|
|
1170
1368
|
let a = new Date(e, t, i).getTime();
|
|
1171
1369
|
return a < n || a > r;
|
|
1172
1370
|
};
|
|
1173
1371
|
}
|
|
1174
1372
|
_monthHtml(e, t) {
|
|
1175
|
-
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i =
|
|
1176
|
-
let i =
|
|
1373
|
+
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) => {
|
|
1374
|
+
let i = A(e, t, n), o = a(e, t, n);
|
|
1177
1375
|
return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
|
|
1178
|
-
}, c = "", l =
|
|
1376
|
+
}, c = "", l = P(e, t - 1), u = N(l.y, l.m);
|
|
1179
1377
|
for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
1180
1378
|
for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
|
|
1181
|
-
let d =
|
|
1379
|
+
let d = P(e, t + 1), f = (7 - (r + i) % 7) % 7;
|
|
1182
1380
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
1183
1381
|
return `
|
|
1184
1382
|
<div class="daterange-cal">
|
|
1185
|
-
<div class="datepicker-month-label">${
|
|
1383
|
+
<div class="datepicker-month-label">${O[t]} ${e}</div>
|
|
1186
1384
|
<div class="datepicker-weekdays">${o}</div>
|
|
1187
1385
|
<div class="datepicker-grid" role="grid">${c}</div>
|
|
1188
1386
|
</div>`;
|
|
@@ -1190,7 +1388,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1190
1388
|
_renderView() {
|
|
1191
1389
|
let e = this.querySelector(".daterange-pop");
|
|
1192
1390
|
if (!e) return;
|
|
1193
|
-
let t =
|
|
1391
|
+
let t = P(this._viewY, this._viewM + 1);
|
|
1194
1392
|
e.innerHTML = `
|
|
1195
1393
|
<div class="daterange-head">
|
|
1196
1394
|
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${p("chevron-left")}</button>
|
|
@@ -1216,7 +1414,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1216
1414
|
n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
|
|
1217
1415
|
}
|
|
1218
1416
|
let i = e.querySelector("[data-range-hint]");
|
|
1219
|
-
i && (i.textContent = this._start ? this._end ? `${
|
|
1417
|
+
i && (i.textContent = this._start ? this._end ? `${M(this._start)} – ${M(this._end)}` : "Pick an end date" : "Pick a start date");
|
|
1220
1418
|
}
|
|
1221
1419
|
_position(e, t) {
|
|
1222
1420
|
s(e, t, { clampHeight: !0 });
|
|
@@ -1238,7 +1436,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1238
1436
|
if (!e || !t) return;
|
|
1239
1437
|
let r = () => !t.hidden;
|
|
1240
1438
|
this._open = () => {
|
|
1241
|
-
let r =
|
|
1439
|
+
let r = j(this._start);
|
|
1242
1440
|
if (r) this._viewY = r.y, this._viewM = r.m;
|
|
1243
1441
|
else {
|
|
1244
1442
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -1251,7 +1449,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1251
1449
|
this._popClick = !0;
|
|
1252
1450
|
let t = e.target.closest("[data-nav]");
|
|
1253
1451
|
if (t) {
|
|
1254
|
-
let e =
|
|
1452
|
+
let e = P(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
1255
1453
|
this._viewY = e.y, this._viewM = e.m, this._renderView();
|
|
1256
1454
|
return;
|
|
1257
1455
|
}
|
|
@@ -1281,7 +1479,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1281
1479
|
disconnectedCallback() {
|
|
1282
1480
|
this._teardown();
|
|
1283
1481
|
}
|
|
1284
|
-
},
|
|
1482
|
+
}, le = class extends e {
|
|
1285
1483
|
static get observedAttributes() {
|
|
1286
1484
|
return [
|
|
1287
1485
|
"static",
|
|
@@ -1302,10 +1500,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1302
1500
|
e === "static" && this.isConnected && this._wire();
|
|
1303
1501
|
}
|
|
1304
1502
|
_maxScale() {
|
|
1305
|
-
return
|
|
1503
|
+
return ue(this.getAttribute("max-scale"), 1.6);
|
|
1306
1504
|
}
|
|
1307
1505
|
_radius() {
|
|
1308
|
-
return
|
|
1506
|
+
return ue(this.getAttribute("radius"), 100);
|
|
1309
1507
|
}
|
|
1310
1508
|
_magnifyEnabled() {
|
|
1311
1509
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -1330,10 +1528,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1330
1528
|
_teardown() {
|
|
1331
1529
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
1332
1530
|
}
|
|
1333
|
-
},
|
|
1531
|
+
}, ue = (e, t) => {
|
|
1334
1532
|
let n = Number.parseFloat(e);
|
|
1335
1533
|
return Number.isFinite(n) ? n : t;
|
|
1336
|
-
},
|
|
1534
|
+
}, de = "wui-feedback-submit", F = {
|
|
1337
1535
|
label: "Feedback",
|
|
1338
1536
|
heading: "Share feedback",
|
|
1339
1537
|
placeholder: "What's working, what isn't?",
|
|
@@ -1344,7 +1542,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1344
1542
|
emptyError: "Please write a message before sending.",
|
|
1345
1543
|
failedError: "That didn't send. Please try again.",
|
|
1346
1544
|
thanks: "Thanks — we've got it."
|
|
1347
|
-
},
|
|
1545
|
+
}, fe = 1e4, pe = 1600, me = class extends e {
|
|
1348
1546
|
static get observedAttributes() {
|
|
1349
1547
|
return [
|
|
1350
1548
|
"position",
|
|
@@ -1366,19 +1564,19 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1366
1564
|
this.setAttribute("position", String(e ?? "bottom-right"));
|
|
1367
1565
|
}
|
|
1368
1566
|
get label() {
|
|
1369
|
-
return this.getAttribute("label") ||
|
|
1567
|
+
return this.getAttribute("label") || F.label;
|
|
1370
1568
|
}
|
|
1371
1569
|
set label(e) {
|
|
1372
1570
|
this.setAttribute("label", String(e ?? ""));
|
|
1373
1571
|
}
|
|
1374
1572
|
get heading() {
|
|
1375
|
-
return this.getAttribute("heading") ||
|
|
1573
|
+
return this.getAttribute("heading") || F.heading;
|
|
1376
1574
|
}
|
|
1377
1575
|
set heading(e) {
|
|
1378
1576
|
this.setAttribute("heading", String(e ?? ""));
|
|
1379
1577
|
}
|
|
1380
1578
|
get placeholder() {
|
|
1381
|
-
return this.getAttribute("placeholder") ||
|
|
1579
|
+
return this.getAttribute("placeholder") || F.placeholder;
|
|
1382
1580
|
}
|
|
1383
1581
|
set placeholder(e) {
|
|
1384
1582
|
this.setAttribute("placeholder", String(e ?? ""));
|
|
@@ -1393,10 +1591,10 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1393
1591
|
return this._open === !0;
|
|
1394
1592
|
}
|
|
1395
1593
|
addEventListener(e, t, n) {
|
|
1396
|
-
e ===
|
|
1594
|
+
e === de && (this._submitListeners += 1), super.addEventListener(e, t, n);
|
|
1397
1595
|
}
|
|
1398
1596
|
removeEventListener(e, t, n) {
|
|
1399
|
-
e ===
|
|
1597
|
+
e === de && this._submitListeners > 0 && --this._submitListeners, super.removeEventListener(e, t, n);
|
|
1400
1598
|
}
|
|
1401
1599
|
connectedCallback() {
|
|
1402
1600
|
this._rendered || this.render();
|
|
@@ -1412,31 +1610,31 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1412
1610
|
this.innerHTML = `
|
|
1413
1611
|
<button type="button" class="feedback-trigger" aria-expanded="false" aria-haspopup="dialog">
|
|
1414
1612
|
<span class="feedback-trigger-icon" aria-hidden="true">${p("message-square", { size: 18 })}</span>
|
|
1415
|
-
<span class="feedback-trigger-label">${
|
|
1613
|
+
<span class="feedback-trigger-label">${he(this.label)}</span>
|
|
1416
1614
|
</button>
|
|
1417
|
-
<div class="feedback-panel" role="dialog" aria-label="${
|
|
1615
|
+
<div class="feedback-panel" role="dialog" aria-label="${ge(this.heading)}" hidden>
|
|
1418
1616
|
<div class="feedback-head">
|
|
1419
|
-
<h2 class="feedback-heading">${
|
|
1617
|
+
<h2 class="feedback-heading">${he(this.heading)}</h2>
|
|
1420
1618
|
<button type="button" class="feedback-close" aria-label="Close">${p("x", { size: 16 })}</button>
|
|
1421
1619
|
</div>
|
|
1422
1620
|
<div class="feedback-body">
|
|
1423
1621
|
<label class="feedback-field">
|
|
1424
|
-
<span class="feedback-field-label">${
|
|
1425
|
-
<textarea class="feedback-message" rows="4" required placeholder="${
|
|
1622
|
+
<span class="feedback-field-label">${F.messageLabel}</span>
|
|
1623
|
+
<textarea class="feedback-message" rows="4" required placeholder="${ge(this.placeholder)}"></textarea>
|
|
1426
1624
|
</label>
|
|
1427
1625
|
${this.collectEmail ? `<label class="feedback-field">
|
|
1428
|
-
<span class="feedback-field-label">${
|
|
1626
|
+
<span class="feedback-field-label">${F.emailLabel}</span>
|
|
1429
1627
|
<input type="email" class="feedback-email" autocomplete="email" placeholder="you@example.com" />
|
|
1430
1628
|
</label>` : ""}
|
|
1431
1629
|
<p class="feedback-error" role="alert" hidden></p>
|
|
1432
1630
|
</div>
|
|
1433
1631
|
<div class="feedback-actions">
|
|
1434
1632
|
<button type="button" class="feedback-cancel">Cancel</button>
|
|
1435
|
-
<button type="button" class="feedback-submit">${
|
|
1633
|
+
<button type="button" class="feedback-submit">${F.submitLabel}</button>
|
|
1436
1634
|
</div>
|
|
1437
1635
|
<div class="feedback-thanks" hidden>
|
|
1438
1636
|
<span class="feedback-thanks-icon" aria-hidden="true">${p("check-circle", { size: 20 })}</span>
|
|
1439
|
-
<span class="feedback-thanks-text">${
|
|
1637
|
+
<span class="feedback-thanks-text">${F.thanks}</span>
|
|
1440
1638
|
</div>
|
|
1441
1639
|
</div>`, this._rendered = !0, this._wire();
|
|
1442
1640
|
let r = this._refs();
|
|
@@ -1474,18 +1672,18 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1474
1672
|
let { thanks: e, error: t, submit: n, message: r, email: i } = this._refs();
|
|
1475
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(() => {
|
|
1476
1674
|
r && (r.value = ""), i && (i.value = ""), this._reset(), this.close();
|
|
1477
|
-
},
|
|
1675
|
+
}, pe);
|
|
1478
1676
|
}
|
|
1479
1677
|
failed(e) {
|
|
1480
1678
|
this._clearTimers(), this._state = "error", this._setBusy(!1);
|
|
1481
1679
|
let { error: t, message: n } = this._refs();
|
|
1482
|
-
t && (t.textContent = e ||
|
|
1680
|
+
t && (t.textContent = e || F.failedError, t.hidden = !1), n?.focus();
|
|
1483
1681
|
}
|
|
1484
1682
|
_submit() {
|
|
1485
1683
|
if (this._state === "submitting") return;
|
|
1486
1684
|
let { message: e, email: t, error: n } = this._refs(), r = (e?.value ?? "").trim();
|
|
1487
1685
|
if (!r) {
|
|
1488
|
-
n && (n.textContent =
|
|
1686
|
+
n && (n.textContent = F.emptyError, n.hidden = !1), e?.focus();
|
|
1489
1687
|
return;
|
|
1490
1688
|
}
|
|
1491
1689
|
n && (n.hidden = !0, n.textContent = ""), this._state = "submitting", this._setBusy(!0);
|
|
@@ -1495,7 +1693,7 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1495
1693
|
surface: this.getAttribute("surface") || "",
|
|
1496
1694
|
screen: this.getAttribute("screen") || ""
|
|
1497
1695
|
};
|
|
1498
|
-
if (this.dispatchEvent(new CustomEvent(
|
|
1696
|
+
if (this.dispatchEvent(new CustomEvent(de, {
|
|
1499
1697
|
bubbles: !0,
|
|
1500
1698
|
composed: !0,
|
|
1501
1699
|
detail: i
|
|
@@ -1505,11 +1703,11 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1505
1703
|
}
|
|
1506
1704
|
this._timer = setTimeout(() => {
|
|
1507
1705
|
this._state === "submitting" && this.failed();
|
|
1508
|
-
},
|
|
1706
|
+
}, fe);
|
|
1509
1707
|
}
|
|
1510
1708
|
_setBusy(e) {
|
|
1511
1709
|
let { submit: t } = this._refs();
|
|
1512
|
-
t && (t.disabled = e, t.textContent = e ?
|
|
1710
|
+
t && (t.disabled = e, t.textContent = e ? F.sendingLabel : F.submitLabel, this.toggleAttribute("busy", e));
|
|
1513
1711
|
}
|
|
1514
1712
|
_reset() {
|
|
1515
1713
|
this._clearTimers(), this._state = "idle", this._setBusy(!1);
|
|
@@ -1519,23 +1717,23 @@ var O = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").repl
|
|
|
1519
1717
|
_clearTimers() {
|
|
1520
1718
|
this._timer &&= (clearTimeout(this._timer), 0), this._thanksTimer &&= (clearTimeout(this._thanksTimer), 0);
|
|
1521
1719
|
}
|
|
1522
|
-
},
|
|
1720
|
+
}, he = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ge = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), _e = {
|
|
1523
1721
|
enter: "Enter",
|
|
1524
1722
|
comma: ",",
|
|
1525
1723
|
space: " ",
|
|
1526
1724
|
tab: "Tab"
|
|
1527
|
-
},
|
|
1725
|
+
}, ve = {
|
|
1528
1726
|
enter: "\n",
|
|
1529
1727
|
comma: ",",
|
|
1530
1728
|
space: " ",
|
|
1531
1729
|
tab: " "
|
|
1532
|
-
},
|
|
1533
|
-
function
|
|
1730
|
+
}, ye = (e) => _e[e], be = (e) => ve[e];
|
|
1731
|
+
function xe(e, t) {
|
|
1534
1732
|
let n = [String(e ?? "")];
|
|
1535
1733
|
for (let e of t) n = n.flatMap((t) => t.split(e));
|
|
1536
1734
|
return n.map((e) => e.trim()).filter(Boolean);
|
|
1537
1735
|
}
|
|
1538
|
-
var
|
|
1736
|
+
var I = (e, t) => t.some((t) => String(e ?? "").includes(t)), Se = class extends e {
|
|
1539
1737
|
static formAssociated = !0;
|
|
1540
1738
|
_accessibleName() {
|
|
1541
1739
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1635,7 +1833,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1635
1833
|
[h]: !0,
|
|
1636
1834
|
selected: e.hasAttribute("selected")
|
|
1637
1835
|
};
|
|
1638
|
-
for (let [n, r] of
|
|
1836
|
+
for (let [n, r] of Ce) {
|
|
1639
1837
|
let i = e.getAttribute(n);
|
|
1640
1838
|
i && (t[r] = i);
|
|
1641
1839
|
}
|
|
@@ -1666,23 +1864,23 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1666
1864
|
<div class="search-select${a}">
|
|
1667
1865
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : ""}>
|
|
1668
1866
|
${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="${
|
|
1867
|
+
<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
1868
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
1671
1869
|
</div>
|
|
1672
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1870
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1673
1871
|
<div class="search-select-options"></div>
|
|
1674
1872
|
</div>
|
|
1675
1873
|
</div>
|
|
1676
|
-
<div class="field-error wui-ms-custom-error" id="${
|
|
1874
|
+
<div class="field-error wui-ms-custom-error" id="${z(e)}" aria-live="polite" hidden></div>`;
|
|
1677
1875
|
} else this.innerHTML = `
|
|
1678
1876
|
<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="${
|
|
1877
|
+
<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
1878
|
${r ? p(r, { className: "search-select-icon" }) : ""}
|
|
1681
1879
|
<div class="ms-chips" data-chips></div>
|
|
1682
1880
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
1683
1881
|
</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="${
|
|
1882
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${z(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1883
|
+
${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
1884
|
<div class="search-select-options"></div>
|
|
1687
1885
|
<div class="search-select-empty" hidden>No matches</div>
|
|
1688
1886
|
</div>
|
|
@@ -1692,7 +1890,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1692
1890
|
_renderControl() {
|
|
1693
1891
|
let e = this.querySelector("[data-chips]");
|
|
1694
1892
|
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="${
|
|
1893
|
+
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
1894
|
if (n) {
|
|
1697
1895
|
for (let t of [...e.querySelectorAll(":scope > .chip")]) t.remove();
|
|
1698
1896
|
n.insertAdjacentHTML("beforebegin", r), n.placeholder = this._values.length ? "" : t, this._collapseChips();
|
|
@@ -1723,11 +1921,11 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1723
1921
|
i.textContent = `+${t.length - o}`;
|
|
1724
1922
|
}
|
|
1725
1923
|
_matches(e, t) {
|
|
1726
|
-
return
|
|
1924
|
+
return B(e.label).toLowerCase().includes(t) || String(e.description ?? "").toLowerCase().includes(t);
|
|
1727
1925
|
}
|
|
1728
1926
|
_optionNamed(e) {
|
|
1729
1927
|
let t = e.trim().toLowerCase();
|
|
1730
|
-
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t ||
|
|
1928
|
+
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t || B(e.label).trim().toLowerCase() === t);
|
|
1731
1929
|
}
|
|
1732
1930
|
_renderOptions(e) {
|
|
1733
1931
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
@@ -1736,9 +1934,9 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1736
1934
|
i && (a = a.filter((e) => this._matches(e, i)));
|
|
1737
1935
|
let o = this._listboxId || `${this.id || "wui-multiselect"}-listbox`, s = this._allowCustom && r && !this._optionNamed(r), c = a.map((e, t) => {
|
|
1738
1936
|
let n = this._values.includes(String(e.value)), r = `${o}-opt-${t}`;
|
|
1739
|
-
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>`;
|
|
1740
1938
|
});
|
|
1741
|
-
s && c.push(`<button type="button" role="option" id="${
|
|
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?.();
|
|
1742
1940
|
}
|
|
1743
1941
|
_combobox() {
|
|
1744
1942
|
return this._allowCustom ? this.querySelector("[data-input]") : this.querySelector(".search-select-control");
|
|
@@ -1751,7 +1949,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1751
1949
|
_customRefusal(e) {
|
|
1752
1950
|
let t = this.getAttribute("custom-invalid-message") || "Enter a valid value.", n = this.getAttribute("custom-pattern");
|
|
1753
1951
|
if (n) {
|
|
1754
|
-
let r =
|
|
1952
|
+
let r = Oe(n);
|
|
1755
1953
|
if (r && !r.test(e)) return t;
|
|
1756
1954
|
}
|
|
1757
1955
|
let r = this._validateCustom;
|
|
@@ -1802,35 +2000,35 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1802
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 = "";
|
|
1803
2001
|
}, S = () => {
|
|
1804
2002
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1805
|
-
},
|
|
2003
|
+
}, C = (e) => {
|
|
1806
2004
|
let t = String(e);
|
|
1807
2005
|
if (this._values.includes(t)) this._values = this._values.filter((e) => e !== t);
|
|
1808
2006
|
else if (a && this._values.some((e) => e.toLowerCase() === t.toLowerCase())) return;
|
|
1809
2007
|
else this._values = [...this._values, t];
|
|
1810
2008
|
this._renderControl(), this._renderOptions(this._query()), S();
|
|
1811
|
-
},
|
|
2009
|
+
}, ee = (e) => {
|
|
1812
2010
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(this._query()), S();
|
|
1813
2011
|
}, w = (e, { quiet: t = !1 } = {}) => {
|
|
1814
|
-
let n = this._values.length, r =
|
|
2012
|
+
let n = this._values.length, r = I(e, L) ? xe(e, L) : [e], i = [], a = "";
|
|
1815
2013
|
for (let e of r) {
|
|
1816
2014
|
let t = this._commitTyped(e);
|
|
1817
2015
|
t && (i.push(e.trim()), a ||= t);
|
|
1818
2016
|
}
|
|
1819
2017
|
t && i.length || (o.value = i.join(", "), this._setCustomError(a), this._values.length !== n && (this._renderControl(), S()), this._renderOptions(o.value));
|
|
1820
|
-
},
|
|
2018
|
+
}, te = (e) => {
|
|
1821
2019
|
if (!(!e || e.getAttribute("aria-disabled") === "true")) {
|
|
1822
2020
|
if (e.dataset.custom === "true") {
|
|
1823
2021
|
w(e.dataset.value);
|
|
1824
2022
|
return;
|
|
1825
2023
|
}
|
|
1826
|
-
|
|
2024
|
+
C(e.dataset.value), o?.value && (o.value = "", this._setCustomError(""), this._renderOptions(""));
|
|
1827
2025
|
}
|
|
1828
2026
|
};
|
|
1829
2027
|
e.addEventListener("click", (e) => {
|
|
1830
2028
|
if (u()) return;
|
|
1831
2029
|
let t = e.target.closest("[data-remove]");
|
|
1832
2030
|
if (t) {
|
|
1833
|
-
e.stopPropagation(),
|
|
2031
|
+
e.stopPropagation(), ee(t.dataset.remove), o?.focus();
|
|
1834
2032
|
return;
|
|
1835
2033
|
}
|
|
1836
2034
|
if (o) {
|
|
@@ -1841,7 +2039,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1841
2039
|
v() ? x() : b();
|
|
1842
2040
|
}), i.addEventListener("click", (e) => {
|
|
1843
2041
|
let t = e.target.closest(".search-select-option");
|
|
1844
|
-
t && (
|
|
2042
|
+
t && (te(t), (o || n)?.focus());
|
|
1845
2043
|
}), i.addEventListener("mousemove", (e) => {
|
|
1846
2044
|
let t = e.target.closest(".search-select-option");
|
|
1847
2045
|
t && g(h().indexOf(t));
|
|
@@ -1854,21 +2052,21 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1854
2052
|
getActive: () => this._active,
|
|
1855
2053
|
setActive: (e) => g(e),
|
|
1856
2054
|
onEnter: (e) => {
|
|
1857
|
-
e ?
|
|
2055
|
+
e ? te(e) : o?.value.trim() && w(o.value);
|
|
1858
2056
|
},
|
|
1859
2057
|
onEscape: () => {
|
|
1860
2058
|
this._navHandler.clearTypeahead(), x(), o || e.focus();
|
|
1861
2059
|
}
|
|
1862
2060
|
});
|
|
1863
|
-
let
|
|
2061
|
+
let T = (e) => {
|
|
1864
2062
|
let t = o || n;
|
|
1865
2063
|
if (e.key === "Backspace" && !t?.value && this._values.length) {
|
|
1866
|
-
|
|
2064
|
+
ee(this._values[this._values.length - 1]);
|
|
1867
2065
|
return;
|
|
1868
2066
|
}
|
|
1869
2067
|
this._navHandler.handler(e);
|
|
1870
2068
|
};
|
|
1871
|
-
if (n?.addEventListener("keydown",
|
|
2069
|
+
if (n?.addEventListener("keydown", T), r?.addEventListener("click", () => {
|
|
1872
2070
|
n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
|
|
1873
2071
|
}), o) {
|
|
1874
2072
|
let t = (e) => {
|
|
@@ -1886,16 +2084,16 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1886
2084
|
this._navHandler.handler(e);
|
|
1887
2085
|
return;
|
|
1888
2086
|
}
|
|
1889
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(),
|
|
2087
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(), T(e);
|
|
1890
2088
|
}), o.addEventListener("paste", (e) => {
|
|
1891
2089
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1892
|
-
|
|
2090
|
+
I(t, L) && (e.preventDefault(), w(`${o.value}${t}`));
|
|
1893
2091
|
}), o.addEventListener("blur", (e) => {
|
|
1894
2092
|
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() && w(o.value, { quiet: !0 }), x());
|
|
1895
2093
|
});
|
|
1896
2094
|
} else e.addEventListener("keydown", (e) => {
|
|
1897
2095
|
if (v()) {
|
|
1898
|
-
|
|
2096
|
+
T(e);
|
|
1899
2097
|
return;
|
|
1900
2098
|
}
|
|
1901
2099
|
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
@@ -1914,35 +2112,35 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1914
2112
|
disconnectedCallback() {
|
|
1915
2113
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
1916
2114
|
}
|
|
1917
|
-
},
|
|
2115
|
+
}, L = [
|
|
1918
2116
|
",",
|
|
1919
2117
|
";",
|
|
1920
2118
|
"\n",
|
|
1921
2119
|
" "
|
|
1922
|
-
],
|
|
2120
|
+
], Ce = [
|
|
1923
2121
|
["description", "description"],
|
|
1924
2122
|
["avatar", "avatar"],
|
|
1925
2123
|
["initials", "initials"],
|
|
1926
2124
|
["disabled-hint", "disabledHint"]
|
|
1927
|
-
],
|
|
2125
|
+
], we = (e) => !!(e.description || e.avatar || e.initials || e.disabled || e.disabledHint), Te = (e) => {
|
|
1928
2126
|
let t = String(e ?? "").trim();
|
|
1929
2127
|
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
|
-
},
|
|
2128
|
+
}, Ee = (e) => {
|
|
2129
|
+
let t = Te(e.avatar);
|
|
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>`;
|
|
2131
|
+
}, De = (e, t, n) => {
|
|
1934
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>` : "";
|
|
1935
|
-
return `<button type="button" role="option" id="${
|
|
1936
|
-
},
|
|
1937
|
-
if (
|
|
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) => {
|
|
2135
|
+
if (R.has(e)) return R.get(e);
|
|
1938
2136
|
let t = null;
|
|
1939
2137
|
try {
|
|
1940
2138
|
t = RegExp(`^(?:${e})$`, "u");
|
|
1941
2139
|
} catch {
|
|
1942
2140
|
console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`);
|
|
1943
2141
|
}
|
|
1944
|
-
return
|
|
1945
|
-
},
|
|
2142
|
+
return R.set(e, t), t;
|
|
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 {
|
|
1946
2144
|
static formAssociated = !0;
|
|
1947
2145
|
static get observedAttributes() {
|
|
1948
2146
|
return [
|
|
@@ -1973,7 +2171,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
1973
2171
|
this._value = this._clean(e), d(this, this._value), this._paint();
|
|
1974
2172
|
}
|
|
1975
2173
|
_clean(e) {
|
|
1976
|
-
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);
|
|
1977
2175
|
}
|
|
1978
2176
|
constructor() {
|
|
1979
2177
|
super();
|
|
@@ -2064,7 +2262,7 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
2064
2262
|
disconnectedCallback() {
|
|
2065
2263
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
2066
2264
|
}
|
|
2067
|
-
},
|
|
2265
|
+
}, V = [
|
|
2068
2266
|
[
|
|
2069
2267
|
"AF",
|
|
2070
2268
|
"Afghanistan",
|
|
@@ -3290,11 +3488,11 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
3290
3488
|
"Zimbabwe",
|
|
3291
3489
|
"263"
|
|
3292
3490
|
]
|
|
3293
|
-
],
|
|
3491
|
+
], H = (e) => (V.find((t) => t[0] === e) || [
|
|
3294
3492
|
"",
|
|
3295
3493
|
"",
|
|
3296
3494
|
""
|
|
3297
|
-
])[2],
|
|
3495
|
+
])[2], Me = {
|
|
3298
3496
|
AD: ["Europe/Andorra"],
|
|
3299
3497
|
AE: ["Asia/Dubai"],
|
|
3300
3498
|
AF: ["Asia/Kabul"],
|
|
@@ -3696,13 +3894,13 @@ var z = (e, t) => t.some((t) => String(e ?? "").includes(t)), ge = class extends
|
|
|
3696
3894
|
ZA: ["Africa/Johannesburg"],
|
|
3697
3895
|
ZM: ["Africa/Lusaka"],
|
|
3698
3896
|
ZW: ["Africa/Harare"]
|
|
3699
|
-
},
|
|
3700
|
-
for (let [e, t] of Object.entries(
|
|
3701
|
-
function
|
|
3702
|
-
let t =
|
|
3703
|
-
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;
|
|
3704
3902
|
}
|
|
3705
|
-
function
|
|
3903
|
+
function Ie(e) {
|
|
3706
3904
|
if (!e) return null;
|
|
3707
3905
|
let t;
|
|
3708
3906
|
try {
|
|
@@ -3710,9 +3908,9 @@ function Me(e) {
|
|
|
3710
3908
|
} catch {
|
|
3711
3909
|
return null;
|
|
3712
3910
|
}
|
|
3713
|
-
return t &&
|
|
3911
|
+
return t && Ne.has(t) ? t : null;
|
|
3714
3912
|
}
|
|
3715
|
-
function
|
|
3913
|
+
function Le() {
|
|
3716
3914
|
let e;
|
|
3717
3915
|
try {
|
|
3718
3916
|
e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -3720,77 +3918,77 @@ function Ne() {
|
|
|
3720
3918
|
e = void 0;
|
|
3721
3919
|
}
|
|
3722
3920
|
let t = typeof navigator > "u" ? void 0 : navigator.language;
|
|
3723
|
-
return
|
|
3921
|
+
return Fe(e) || Ie(t) || "IN";
|
|
3724
3922
|
}
|
|
3725
3923
|
//#endregion
|
|
3726
3924
|
//#region src/WuiPhone.js
|
|
3727
|
-
var
|
|
3728
|
-
function
|
|
3729
|
-
return
|
|
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 = {
|
|
3730
3928
|
AsYouType: e.AsYouType,
|
|
3731
3929
|
getExampleNumber: e.getExampleNumber,
|
|
3732
3930
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
3733
3931
|
parsePhoneNumber: e.parsePhoneNumber,
|
|
3734
3932
|
examples: t.default || t
|
|
3735
|
-
},
|
|
3933
|
+
}, U)).catch(() => null), ze);
|
|
3736
3934
|
}
|
|
3737
|
-
function
|
|
3738
|
-
let n = `+${
|
|
3935
|
+
function Ve(e, t) {
|
|
3936
|
+
let n = `+${H(e)}`;
|
|
3739
3937
|
return t?.startsWith(n) ? t.slice(n.length).trimStart() : null;
|
|
3740
3938
|
}
|
|
3741
|
-
function
|
|
3742
|
-
if (!
|
|
3939
|
+
function W(e, t) {
|
|
3940
|
+
if (!U || !t) return t;
|
|
3743
3941
|
try {
|
|
3744
|
-
return
|
|
3942
|
+
return Ve(e, new U.AsYouType(e).input(`+${H(e)}${t}`)) || t;
|
|
3745
3943
|
} catch {
|
|
3746
3944
|
return t;
|
|
3747
3945
|
}
|
|
3748
3946
|
}
|
|
3749
|
-
function
|
|
3947
|
+
function He(e, t) {
|
|
3750
3948
|
if (t <= 0) return 0;
|
|
3751
3949
|
let n = 0;
|
|
3752
3950
|
for (let r = 0; r < e.length; r++) if (/[0-9]/.test(e[r]) && (n += 1, n === t)) return r + 1;
|
|
3753
3951
|
return e.length;
|
|
3754
3952
|
}
|
|
3755
|
-
function
|
|
3756
|
-
if (!
|
|
3953
|
+
function G(e) {
|
|
3954
|
+
if (!U) return null;
|
|
3757
3955
|
try {
|
|
3758
|
-
return
|
|
3956
|
+
return Ve(e, U.getExampleNumber(e, U.examples)?.formatInternational()) || null;
|
|
3759
3957
|
} catch {
|
|
3760
3958
|
return null;
|
|
3761
3959
|
}
|
|
3762
3960
|
}
|
|
3763
|
-
function
|
|
3764
|
-
if (!
|
|
3961
|
+
function Ue(e) {
|
|
3962
|
+
if (!U || !e) return null;
|
|
3765
3963
|
try {
|
|
3766
|
-
if (!
|
|
3767
|
-
let t =
|
|
3964
|
+
if (!U.isValidPhoneNumber(e)) return !1;
|
|
3965
|
+
let t = U.parsePhoneNumber(e)?.getType?.();
|
|
3768
3966
|
return t === void 0 || t === "MOBILE" || t === "FIXED_LINE_OR_MOBILE";
|
|
3769
3967
|
} catch {
|
|
3770
3968
|
return null;
|
|
3771
3969
|
}
|
|
3772
3970
|
}
|
|
3773
|
-
function
|
|
3774
|
-
if (!
|
|
3971
|
+
function We(e) {
|
|
3972
|
+
if (!U) return null;
|
|
3775
3973
|
try {
|
|
3776
|
-
let t =
|
|
3974
|
+
let t = U.getExampleNumber(e, U.examples);
|
|
3777
3975
|
return t?.nationalNumber ? t.nationalNumber.length : null;
|
|
3778
3976
|
} catch {
|
|
3779
3977
|
return null;
|
|
3780
3978
|
}
|
|
3781
3979
|
}
|
|
3782
|
-
function
|
|
3980
|
+
function Ge(e, t, n) {
|
|
3783
3981
|
try {
|
|
3784
|
-
let r =
|
|
3982
|
+
let r = U.parsePhoneNumber(t, e), i = r?.nationalNumber;
|
|
3785
3983
|
return !i || r.country !== e || i.length > n || !t.endsWith(i) ? null : i;
|
|
3786
3984
|
} catch {
|
|
3787
3985
|
return null;
|
|
3788
3986
|
}
|
|
3789
3987
|
}
|
|
3790
|
-
function
|
|
3791
|
-
if (!
|
|
3988
|
+
function Ke(e) {
|
|
3989
|
+
if (!U || !e?.trim().startsWith("+")) return null;
|
|
3792
3990
|
try {
|
|
3793
|
-
let t = new
|
|
3991
|
+
let t = new U.AsYouType();
|
|
3794
3992
|
t.input(e.trim());
|
|
3795
3993
|
let n = t.getCountry();
|
|
3796
3994
|
return n ? {
|
|
@@ -3801,7 +3999,7 @@ function He(e) {
|
|
|
3801
3999
|
return null;
|
|
3802
4000
|
}
|
|
3803
4001
|
}
|
|
3804
|
-
var
|
|
4002
|
+
var qe = class extends e {
|
|
3805
4003
|
static formAssociated = !0;
|
|
3806
4004
|
static get observedAttributes() {
|
|
3807
4005
|
return [
|
|
@@ -3821,7 +4019,7 @@ var Ue = class extends e {
|
|
|
3821
4019
|
} catch {
|
|
3822
4020
|
this._internals = null;
|
|
3823
4021
|
}
|
|
3824
|
-
this._defaultCountry =
|
|
4022
|
+
this._defaultCountry = Le(), this._country = this._defaultCountry, this._national = "", this._active = -1, this._committedValue = "";
|
|
3825
4023
|
}
|
|
3826
4024
|
connectedCallback() {
|
|
3827
4025
|
if (!this._rendered) {
|
|
@@ -3848,13 +4046,13 @@ var Ue = class extends e {
|
|
|
3848
4046
|
this.value = this._defaultValue || "";
|
|
3849
4047
|
}
|
|
3850
4048
|
get value() {
|
|
3851
|
-
return this._national ? `+${
|
|
4049
|
+
return this._national ? `+${H(this._country)}${this._national}` : "";
|
|
3852
4050
|
}
|
|
3853
4051
|
set value(e) {
|
|
3854
|
-
let t = String(e ?? "").trim(), n =
|
|
4052
|
+
let t = String(e ?? "").trim(), n = Ke(t);
|
|
3855
4053
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
3856
4054
|
else if (t.startsWith("+")) {
|
|
3857
|
-
let e = t.replace(/[^0-9]/g, ""), n = String(
|
|
4055
|
+
let e = t.replace(/[^0-9]/g, ""), n = String(H(this._country));
|
|
3858
4056
|
n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
|
|
3859
4057
|
} else this._national = t.replace(/[^0-9]/g, "");
|
|
3860
4058
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
@@ -3870,25 +4068,25 @@ var Ue = class extends e {
|
|
|
3870
4068
|
}
|
|
3871
4069
|
render() {
|
|
3872
4070
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
|
|
3873
|
-
let e = this.getAttribute("placeholder") ||
|
|
4071
|
+
let e = this.getAttribute("placeholder") || G(this._country) || "Enter phone number";
|
|
3874
4072
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
3875
4073
|
let t = `${this.id}-listbox`;
|
|
3876
4074
|
this._listboxId = t;
|
|
3877
|
-
let n =
|
|
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("");
|
|
3878
4076
|
this.innerHTML = `
|
|
3879
4077
|
<div class="phone-input-wrap">
|
|
3880
4078
|
<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="${
|
|
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" : ""}>
|
|
4080
|
+
<span class="${Re(this._country)}" data-flag aria-hidden="true"></span>
|
|
3883
4081
|
${p("chevron-down", { className: "phone-chevron" })}
|
|
3884
|
-
<span class="phone-dial" data-dial>+${
|
|
4082
|
+
<span class="phone-dial" data-dial>+${H(this._country)}</span>
|
|
3885
4083
|
</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="${
|
|
4084
|
+
<div class="country-dropdown-menu" role="listbox" id="${K(t)}" tabindex="-1" hidden>
|
|
4085
|
+
<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
4086
|
<div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
|
|
3889
4087
|
</div>
|
|
3890
4088
|
</div>
|
|
3891
|
-
<input type="tel" class="input" placeholder="${
|
|
4089
|
+
<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
4090
|
</div>
|
|
3893
4091
|
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, d(this, this.value), this._wire();
|
|
3894
4092
|
}
|
|
@@ -3919,12 +4117,12 @@ var Ue = class extends e {
|
|
|
3919
4117
|
}
|
|
3920
4118
|
a && (a.hidden = n > 0);
|
|
3921
4119
|
}, v = (e) => {
|
|
3922
|
-
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)}`);
|
|
3923
4121
|
for (let t of this._itemEls()) {
|
|
3924
4122
|
let n = t.dataset.iso === e;
|
|
3925
4123
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
3926
4124
|
}
|
|
3927
|
-
!this.getAttribute("placeholder") && o && (o.placeholder =
|
|
4125
|
+
!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
4126
|
}, y = (t) => {
|
|
3929
4127
|
let n = this._visibleItems();
|
|
3930
4128
|
if (t.key === "ArrowDown") {
|
|
@@ -3958,7 +4156,7 @@ var Ue = class extends e {
|
|
|
3958
4156
|
let b = this.querySelector("[data-phone-error]"), x = (e) => {
|
|
3959
4157
|
if (o.classList.toggle("is-invalid", e), e ? o.setAttribute("aria-invalid", "true") : o.removeAttribute("aria-invalid"), b) {
|
|
3960
4158
|
if (e) {
|
|
3961
|
-
let e =
|
|
4159
|
+
let e = G(this._country);
|
|
3962
4160
|
b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
|
|
3963
4161
|
}
|
|
3964
4162
|
b.hidden = !e;
|
|
@@ -3966,24 +4164,24 @@ var Ue = class extends e {
|
|
|
3966
4164
|
};
|
|
3967
4165
|
o.addEventListener("input", (e) => {
|
|
3968
4166
|
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 =
|
|
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);
|
|
3970
4168
|
if (i && r.length > i) {
|
|
3971
|
-
let e =
|
|
4169
|
+
let e = Ge(this._country, r, i);
|
|
3972
4170
|
e ? (n = Math.max(0, n - (r.length - e.length)), r = e) : r = r.slice(0, i);
|
|
3973
4171
|
}
|
|
3974
4172
|
this._national = r;
|
|
3975
|
-
let a =
|
|
4173
|
+
let a = W(this._country, this._national);
|
|
3976
4174
|
if (o.value !== a) {
|
|
3977
4175
|
o.value = a;
|
|
3978
|
-
let e =
|
|
4176
|
+
let e = He(a, Math.min(n, r.length));
|
|
3979
4177
|
o.setSelectionRange(e, e);
|
|
3980
4178
|
}
|
|
3981
|
-
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);
|
|
3982
4180
|
}), o.addEventListener("change", (e) => e.stopPropagation()), o.addEventListener("blur", () => {
|
|
3983
|
-
x(this._national.length > 0 &&
|
|
4181
|
+
x(this._national.length > 0 && Ue(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
3984
4182
|
}), 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 =
|
|
4183
|
+
let t = Ke(e.clipboardData?.getData("text"));
|
|
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());
|
|
3987
4185
|
}), this._bindGlobal = () => {
|
|
3988
4186
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
3989
4187
|
f() && !this.contains(e.target) && g();
|
|
@@ -3992,9 +4190,9 @@ var Ue = class extends e {
|
|
|
3992
4190
|
});
|
|
3993
4191
|
}, this._teardownGlobals = () => {
|
|
3994
4192
|
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 =
|
|
4193
|
+
}, this._bindGlobal(), Be().then((e) => {
|
|
4194
|
+
if (!(!e || !o.isConnected) && (this._national && (o.value = W(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
4195
|
+
let e = G(this._country);
|
|
3998
4196
|
e && (o.placeholder = e);
|
|
3999
4197
|
}
|
|
4000
4198
|
}), this._syncMirror();
|
|
@@ -4005,7 +4203,7 @@ var Ue = class extends e {
|
|
|
4005
4203
|
disconnectedCallback() {
|
|
4006
4204
|
this._teardown();
|
|
4007
4205
|
}
|
|
4008
|
-
},
|
|
4206
|
+
}, K = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), Je = class extends e {
|
|
4009
4207
|
static formAssociated = !0;
|
|
4010
4208
|
static get observedAttributes() {
|
|
4011
4209
|
return [
|
|
@@ -4094,19 +4292,19 @@ var Ue = class extends e {
|
|
|
4094
4292
|
this._listboxId = u;
|
|
4095
4293
|
let f = e.map((e, t) => {
|
|
4096
4294
|
let n = String(e.value) === String(this._value);
|
|
4097
|
-
return `<button type="button" role="option" id="${
|
|
4295
|
+
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
4296
|
}).join("");
|
|
4099
4297
|
this.innerHTML = `
|
|
4100
4298
|
<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="${
|
|
4299
|
+
<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
4300
|
${a ? p(a, { className: "search-select-icon" }) : ""}
|
|
4103
4301
|
${o ? `<span class="search-select-prefix">${g(o)}</span>` : ""}
|
|
4104
4302
|
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? v(l) : g(s)}</span>
|
|
4105
4303
|
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${p("x")}</span>` : ""}
|
|
4106
4304
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
4107
4305
|
</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="${
|
|
4306
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${q(u)}" tabindex="-1" hidden>
|
|
4307
|
+
${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
4308
|
<div class="search-select-options">${f}<div class="search-select-empty" hidden>No matches</div></div>
|
|
4111
4309
|
</div>
|
|
4112
4310
|
</div>`, this._rendered = !0, d(this, this._value), this._wire(), this._syncReset();
|
|
@@ -4211,7 +4409,7 @@ var Ue = class extends e {
|
|
|
4211
4409
|
disconnectedCallback() {
|
|
4212
4410
|
this._teardown();
|
|
4213
4411
|
}
|
|
4214
|
-
},
|
|
4412
|
+
}, q = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ye = class extends e {
|
|
4215
4413
|
static formAssociated = !0;
|
|
4216
4414
|
static get observedAttributes() {
|
|
4217
4415
|
return [
|
|
@@ -4251,19 +4449,19 @@ var Ue = class extends e {
|
|
|
4251
4449
|
return this._value;
|
|
4252
4450
|
}
|
|
4253
4451
|
set value(e) {
|
|
4254
|
-
this._value = this._snapToStep(this._clamp(
|
|
4452
|
+
this._value = this._snapToStep(this._clamp(J(e, this._value))), this._syncValue(), this._syncMirrors();
|
|
4255
4453
|
}
|
|
4256
4454
|
get start() {
|
|
4257
4455
|
return this._start;
|
|
4258
4456
|
}
|
|
4259
4457
|
set start(e) {
|
|
4260
|
-
this._start = Math.min(this._snapToStep(this._clamp(
|
|
4458
|
+
this._start = Math.min(this._snapToStep(this._clamp(J(e, this._start))), this._end), this._syncValue(), this._syncMirrors();
|
|
4261
4459
|
}
|
|
4262
4460
|
get end() {
|
|
4263
4461
|
return this._end;
|
|
4264
4462
|
}
|
|
4265
4463
|
set end(e) {
|
|
4266
|
-
this._end = Math.max(this._snapToStep(this._clamp(
|
|
4464
|
+
this._end = Math.max(this._snapToStep(this._clamp(J(e, this._end))), this._start), this._syncValue(), this._syncMirrors();
|
|
4267
4465
|
}
|
|
4268
4466
|
attributeChangedCallback(e, t, n) {
|
|
4269
4467
|
if (e === "value" || e === "start" || e === "end" || e === "min" || e === "max" || e === "step") {
|
|
@@ -4276,19 +4474,19 @@ var Ue = class extends e {
|
|
|
4276
4474
|
this._isRange() ? this._resetRange() : this._resetSingle();
|
|
4277
4475
|
}
|
|
4278
4476
|
_updateFromAttribute(e) {
|
|
4279
|
-
e === "value" ? this._value = this._snapToStep(this._clamp(
|
|
4477
|
+
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
4478
|
}
|
|
4281
4479
|
_isRange() {
|
|
4282
4480
|
return this.hasAttribute("range");
|
|
4283
4481
|
}
|
|
4284
4482
|
_min() {
|
|
4285
|
-
return
|
|
4483
|
+
return J(this.getAttribute("min"), 0);
|
|
4286
4484
|
}
|
|
4287
4485
|
_max() {
|
|
4288
|
-
return
|
|
4486
|
+
return J(this.getAttribute("max"), 100);
|
|
4289
4487
|
}
|
|
4290
4488
|
_step() {
|
|
4291
|
-
return
|
|
4489
|
+
return J(this.getAttribute("step"), 1);
|
|
4292
4490
|
}
|
|
4293
4491
|
_clamp(e) {
|
|
4294
4492
|
return Math.max(this._min(), Math.min(e, this._max()));
|
|
@@ -4353,7 +4551,7 @@ var Ue = class extends e {
|
|
|
4353
4551
|
aria-valuenow="${this._value}"
|
|
4354
4552
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
4355
4553
|
${a ? "disabled" : ""}
|
|
4356
|
-
aria-label="${
|
|
4554
|
+
aria-label="${Xe(this.getAttribute("aria-label") || "Value")}"
|
|
4357
4555
|
></button>
|
|
4358
4556
|
`}
|
|
4359
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>` : ""}
|
|
@@ -4453,10 +4651,10 @@ var Ue = class extends e {
|
|
|
4453
4651
|
disconnectedCallback() {
|
|
4454
4652
|
this._teardown();
|
|
4455
4653
|
}
|
|
4456
|
-
},
|
|
4654
|
+
}, J = (e, t) => {
|
|
4457
4655
|
let n = Number.parseFloat(e);
|
|
4458
4656
|
return Number.isFinite(n) ? n : t;
|
|
4459
|
-
},
|
|
4657
|
+
}, Xe = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Ze = class extends e {
|
|
4460
4658
|
static formAssociated = !0;
|
|
4461
4659
|
_accessibleName() {
|
|
4462
4660
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -4529,7 +4727,7 @@ var Ue = class extends e {
|
|
|
4529
4727
|
d(this, this._values.join(",")), this.innerHTML = `
|
|
4530
4728
|
<div class="search-select${t}">
|
|
4531
4729
|
<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="${
|
|
4730
|
+
<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
4731
|
<div class="ms-chips" data-chips></div>
|
|
4534
4732
|
</div>
|
|
4535
4733
|
</div>`, this._rendered = !0, d(this, this._values.join(",")), this._renderControl(), this._wire();
|
|
@@ -4541,14 +4739,14 @@ var Ue = class extends e {
|
|
|
4541
4739
|
e.innerHTML = "";
|
|
4542
4740
|
return;
|
|
4543
4741
|
}
|
|
4544
|
-
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("");
|
|
4545
4743
|
}
|
|
4546
4744
|
}
|
|
4547
4745
|
_wire() {
|
|
4548
4746
|
this._teardown();
|
|
4549
4747
|
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
4550
4748
|
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(
|
|
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 = () => {
|
|
4552
4750
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
4553
4751
|
}, c = (e) => {
|
|
4554
4752
|
let t = e.trim();
|
|
@@ -4580,9 +4778,9 @@ var Ue = class extends e {
|
|
|
4580
4778
|
e.preventDefault();
|
|
4581
4779
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
4582
4780
|
for (let e of r) {
|
|
4583
|
-
let t =
|
|
4584
|
-
if (
|
|
4585
|
-
a.push(...
|
|
4781
|
+
let t = be(e) ?? e;
|
|
4782
|
+
if (I(n, [t])) {
|
|
4783
|
+
a.push(...xe(n, [t]));
|
|
4586
4784
|
break;
|
|
4587
4785
|
}
|
|
4588
4786
|
}
|
|
@@ -4610,18 +4808,18 @@ var Ue = class extends e {
|
|
|
4610
4808
|
disconnectedCallback() {
|
|
4611
4809
|
this._teardown();
|
|
4612
4810
|
}
|
|
4613
|
-
},
|
|
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) => {
|
|
4614
4812
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
4615
4813
|
return t ? {
|
|
4616
4814
|
h: +t[1],
|
|
4617
4815
|
m: +t[2]
|
|
4618
4816
|
} : null;
|
|
4619
|
-
},
|
|
4817
|
+
}, tt = (e, t = "24") => {
|
|
4620
4818
|
if (!e) return "";
|
|
4621
|
-
if (t === "24") return
|
|
4819
|
+
if (t === "24") return et(e.h, e.m);
|
|
4622
4820
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
4623
|
-
return `${n}:${
|
|
4624
|
-
},
|
|
4821
|
+
return `${n}:${$e(e.m)} ${r}`;
|
|
4822
|
+
}, nt = class extends e {
|
|
4625
4823
|
static formAssociated = !0;
|
|
4626
4824
|
static get observedAttributes() {
|
|
4627
4825
|
return [
|
|
@@ -4668,11 +4866,11 @@ var Ue = class extends e {
|
|
|
4668
4866
|
}
|
|
4669
4867
|
render() {
|
|
4670
4868
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
4671
|
-
let e = this.getAttribute("placeholder") || "Select time", t =
|
|
4869
|
+
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
4870
|
this.innerHTML = `
|
|
4673
4871
|
<div class="timepicker">
|
|
4674
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)}"` : ""}>
|
|
4675
|
-
<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>
|
|
4676
4874
|
${p("clock")}
|
|
4677
4875
|
</button>
|
|
4678
4876
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
@@ -4684,14 +4882,14 @@ var Ue = class extends e {
|
|
|
4684
4882
|
_syncTrigger() {
|
|
4685
4883
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
4686
4884
|
if (!t) return;
|
|
4687
|
-
let n =
|
|
4688
|
-
t.textContent = n ?
|
|
4885
|
+
let n = X(this._value), r = this.getAttribute("format") || "24";
|
|
4886
|
+
t.textContent = n ? tt(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
4689
4887
|
}
|
|
4690
4888
|
_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 =
|
|
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) || {
|
|
4692
4890
|
h: 0,
|
|
4693
4891
|
m: 0
|
|
4694
|
-
}, i =
|
|
4892
|
+
}, i = X(n) || {
|
|
4695
4893
|
h: 23,
|
|
4696
4894
|
m: 59
|
|
4697
4895
|
}, a = [], o = r.h, s = r.m;
|
|
@@ -4704,10 +4902,10 @@ var Ue = class extends e {
|
|
|
4704
4902
|
_renderOptions() {
|
|
4705
4903
|
let e = this.querySelector(".timepicker-pop");
|
|
4706
4904
|
if (!e) return;
|
|
4707
|
-
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r =
|
|
4905
|
+
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = X(this._value), i = this._focus, a = "";
|
|
4708
4906
|
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\"" : ""}>${
|
|
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>`;
|
|
4711
4909
|
}
|
|
4712
4910
|
e.innerHTML = a, this._focusActive();
|
|
4713
4911
|
}
|
|
@@ -4805,7 +5003,7 @@ var Ue = class extends e {
|
|
|
4805
5003
|
disconnectedCallback() {
|
|
4806
5004
|
this._teardown();
|
|
4807
5005
|
}
|
|
4808
|
-
},
|
|
5006
|
+
}, rt = "wui-wizard-step", it = class extends e {
|
|
4809
5007
|
static get observedAttributes() {
|
|
4810
5008
|
return [
|
|
4811
5009
|
"active",
|
|
@@ -4839,7 +5037,7 @@ var Ue = class extends e {
|
|
|
4839
5037
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
4840
5038
|
}
|
|
4841
5039
|
get _steps() {
|
|
4842
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
5040
|
+
return [...this.querySelectorAll(`:scope > ${rt}`)];
|
|
4843
5041
|
}
|
|
4844
5042
|
refresh() {
|
|
4845
5043
|
this._rendered && this._renderChrome();
|
|
@@ -4898,13 +5096,13 @@ var Ue = class extends e {
|
|
|
4898
5096
|
return e.map((e, r) => {
|
|
4899
5097
|
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
|
|
4900
5098
|
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">${
|
|
5099
|
+
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;
|
|
5100
|
+
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
5101
|
}).join("");
|
|
4904
5102
|
}
|
|
4905
5103
|
_footerHtml(e) {
|
|
4906
5104
|
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" })}${
|
|
5105
|
+
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
5106
|
}
|
|
4909
5107
|
_wire() {
|
|
4910
5108
|
this._teardown(), this._onHeaderClick = (e) => {
|
|
@@ -4976,7 +5174,7 @@ var Ue = class extends e {
|
|
|
4976
5174
|
_reflectActive(e) {
|
|
4977
5175
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
4978
5176
|
}
|
|
4979
|
-
},
|
|
5177
|
+
}, Z = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), at = class extends e {
|
|
4980
5178
|
static get observedAttributes() {
|
|
4981
5179
|
return [
|
|
4982
5180
|
"label",
|
|
@@ -4990,8 +5188,8 @@ var Ue = class extends e {
|
|
|
4990
5188
|
let e = this.closest("wui-wizard");
|
|
4991
5189
|
e && typeof e.refresh == "function" && e.refresh();
|
|
4992
5190
|
}
|
|
4993
|
-
},
|
|
4994
|
-
async function
|
|
5191
|
+
}, ot = 2e3;
|
|
5192
|
+
async function st(e) {
|
|
4995
5193
|
try {
|
|
4996
5194
|
if (navigator.clipboard?.writeText) return await navigator.clipboard.writeText(e), !0;
|
|
4997
5195
|
} catch {}
|
|
@@ -5006,14 +5204,14 @@ async function rt(e) {
|
|
|
5006
5204
|
}
|
|
5007
5205
|
//#endregion
|
|
5008
5206
|
//#region src/fileValidation.js
|
|
5009
|
-
var
|
|
5207
|
+
var ct = "image/png,image/jpeg,image/webp", lt = 5, ut = {
|
|
5010
5208
|
"image/png": [".png"],
|
|
5011
5209
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
5012
5210
|
"image/webp": [".webp"],
|
|
5013
5211
|
"image/gif": [".gif"],
|
|
5014
5212
|
"image/svg+xml": [".svg"],
|
|
5015
5213
|
"application/pdf": [".pdf"]
|
|
5016
|
-
},
|
|
5214
|
+
}, dt = {
|
|
5017
5215
|
"image/png": "PNG",
|
|
5018
5216
|
"image/jpeg": "JPG",
|
|
5019
5217
|
"image/webp": "WEBP",
|
|
@@ -5027,7 +5225,7 @@ var it = "image/png,image/jpeg,image/webp", at = 5, ot = {
|
|
|
5027
5225
|
".gif": "GIF",
|
|
5028
5226
|
".svg": "SVG",
|
|
5029
5227
|
".pdf": "PDF"
|
|
5030
|
-
},
|
|
5228
|
+
}, ft = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), pt = [
|
|
5031
5229
|
".png",
|
|
5032
5230
|
".jpg",
|
|
5033
5231
|
".jpeg",
|
|
@@ -5038,54 +5236,54 @@ var it = "image/png,image/jpeg,image/webp", at = 5, ot = {
|
|
|
5038
5236
|
".avif",
|
|
5039
5237
|
".heic"
|
|
5040
5238
|
];
|
|
5041
|
-
function
|
|
5239
|
+
function mt(e) {
|
|
5042
5240
|
if (!e) return !1;
|
|
5043
5241
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
5044
5242
|
if (t) return t.startsWith("image/");
|
|
5045
5243
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
5046
|
-
return
|
|
5244
|
+
return pt.some((e) => r.endsWith(e));
|
|
5047
5245
|
}
|
|
5048
|
-
function
|
|
5049
|
-
let t =
|
|
5050
|
-
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;
|
|
5051
5249
|
}
|
|
5052
|
-
function
|
|
5250
|
+
function gt(e) {
|
|
5053
5251
|
let t = [];
|
|
5054
|
-
for (let n of
|
|
5055
|
-
let e =
|
|
5252
|
+
for (let n of ft(e)) {
|
|
5253
|
+
let e = dt[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
5056
5254
|
t.includes(e) || t.push(e);
|
|
5057
5255
|
}
|
|
5058
5256
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
5059
5257
|
}
|
|
5060
|
-
function
|
|
5061
|
-
let n =
|
|
5258
|
+
function _t(e, t) {
|
|
5259
|
+
let n = ft(t);
|
|
5062
5260
|
if (!n.length) return !0;
|
|
5063
5261
|
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 && (
|
|
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)));
|
|
5065
5263
|
}
|
|
5066
|
-
function
|
|
5264
|
+
function vt(e, t = {}) {
|
|
5067
5265
|
if (!e) return null;
|
|
5068
|
-
let n = t.accept === void 0 ?
|
|
5069
|
-
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.`;
|
|
5070
5268
|
}
|
|
5071
5269
|
//#endregion
|
|
5072
5270
|
//#region src/passwordRules.js
|
|
5073
|
-
var
|
|
5271
|
+
var Q = {
|
|
5074
5272
|
minLength: 8,
|
|
5075
5273
|
uppercase: !0,
|
|
5076
5274
|
lowercase: !0,
|
|
5077
5275
|
digit: !0,
|
|
5078
5276
|
special: !0,
|
|
5079
5277
|
uniqueChars: 0
|
|
5080
|
-
},
|
|
5081
|
-
function
|
|
5082
|
-
return e === !0 || e == null ? { ...
|
|
5083
|
-
...
|
|
5278
|
+
}, yt = "Password Requirements";
|
|
5279
|
+
function bt(e) {
|
|
5280
|
+
return e === !0 || e == null ? { ...Q } : {
|
|
5281
|
+
...Q,
|
|
5084
5282
|
...e
|
|
5085
5283
|
};
|
|
5086
5284
|
}
|
|
5087
|
-
function
|
|
5088
|
-
let t =
|
|
5285
|
+
function xt(e) {
|
|
5286
|
+
let t = bt(e), n = [];
|
|
5089
5287
|
if (t.minLength > 0 && n.push({
|
|
5090
5288
|
key: "length",
|
|
5091
5289
|
label: `At least ${t.minLength} characters long`,
|
|
@@ -5116,25 +5314,25 @@ function vt(e) {
|
|
|
5116
5314
|
}
|
|
5117
5315
|
return n;
|
|
5118
5316
|
}
|
|
5119
|
-
function
|
|
5317
|
+
function St(e, t) {
|
|
5120
5318
|
let n = e == null ? "" : String(e);
|
|
5121
|
-
return
|
|
5319
|
+
return xt(t).map((e) => ({
|
|
5122
5320
|
key: e.key,
|
|
5123
5321
|
label: e.label,
|
|
5124
5322
|
met: e.test(n)
|
|
5125
5323
|
}));
|
|
5126
5324
|
}
|
|
5127
|
-
function
|
|
5128
|
-
return
|
|
5325
|
+
function Ct(e, t) {
|
|
5326
|
+
return St(e, t).every((e) => e.met);
|
|
5129
5327
|
}
|
|
5130
5328
|
//#endregion
|
|
5131
5329
|
//#region src/index.js
|
|
5132
5330
|
var $ = (e, t) => {
|
|
5133
5331
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
5134
5332
|
};
|
|
5135
|
-
function
|
|
5136
|
-
$("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);
|
|
5137
5335
|
}
|
|
5138
|
-
|
|
5336
|
+
wt();
|
|
5139
5337
|
//#endregion
|
|
5140
|
-
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 };
|