@webority/ui-elements 0.0.10 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,13 +50,20 @@ var e = class extends HTMLElement {
50
50
  let e = Number(this.getAttribute("debounce"));
51
51
  return Number.isFinite(e) && e >= 0 ? e : 250;
52
52
  }
53
- _readOptions() {
54
- return this._optionsProp ? this._optionsProp : [...this.querySelectorAll(":scope > wui-option")].map((e) => ({
53
+ _snapshotDeclared() {
54
+ if (this._declared) return;
55
+ let e = [...this.querySelectorAll(":scope > wui-option")];
56
+ e.length && (this._declared = e.map((e) => ({
55
57
  value: e.getAttribute("value") ?? e.textContent.trim(),
56
- label: e.innerHTML
57
- }));
58
+ label: e.innerHTML,
59
+ selected: e.hasAttribute("selected")
60
+ })));
61
+ }
62
+ _readOptions() {
63
+ return this._optionsProp ? this._optionsProp : (this._snapshotDeclared(), this._declared || []);
58
64
  }
59
65
  render() {
66
+ this._snapshotDeclared();
60
67
  let e = this.getAttribute("placeholder") || "Search…";
61
68
  this.innerHTML = `
62
69
  <div class="search-select">
@@ -321,17 +328,24 @@ var e = class extends HTMLElement {
321
328
  get options() {
322
329
  return this._readOptions();
323
330
  }
324
- _readOptions() {
325
- return this._optionsProp ? this._optionsProp : [...this.querySelectorAll(":scope > wui-option")].map((e) => ({
331
+ _snapshotDeclared() {
332
+ if (this._declared) return;
333
+ let e = [...this.querySelectorAll(":scope > wui-option")];
334
+ e.length && (this._declared = e.map((e) => ({
326
335
  value: e.getAttribute("value") ?? e.textContent.trim(),
327
- label: e.innerHTML
328
- }));
336
+ label: e.innerHTML,
337
+ selected: e.hasAttribute("selected")
338
+ })));
339
+ }
340
+ _readOptions() {
341
+ return this._optionsProp ? this._optionsProp : (this._snapshotDeclared(), this._declared || []);
329
342
  }
330
343
  _labelFor(e) {
331
344
  let t = this._readOptions().find((t) => String(t.value) === String(e));
332
345
  return t ? t.label : e;
333
346
  }
334
347
  render() {
348
+ this._snapshotDeclared();
335
349
  let e = this.hasAttribute("searchable"), t = this.getAttribute("search-placeholder") || "Search…";
336
350
  this._internals?.setFormValue(this._values.join(",")), this.innerHTML = `
337
351
  <div class="search-select">
@@ -421,29 +435,69 @@ var e = class extends HTMLElement {
421
435
  }
422
436
  }, d = (e) => String(e ?? "").replace(/"/g, "&quot;").replace(/</g, "&lt;"), f = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;"), p = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), m = [
423
437
  [
424
- "IN",
425
- "India",
426
- "91"
438
+ "AF",
439
+ "Afghanistan",
440
+ "93"
427
441
  ],
428
442
  [
429
- "US",
430
- "United States",
443
+ "AX",
444
+ "Åland Islands",
445
+ "358"
446
+ ],
447
+ [
448
+ "AL",
449
+ "Albania",
450
+ "355"
451
+ ],
452
+ [
453
+ "DZ",
454
+ "Algeria",
455
+ "213"
456
+ ],
457
+ [
458
+ "AS",
459
+ "American Samoa",
431
460
  "1"
432
461
  ],
433
462
  [
434
- "GB",
435
- "United Kingdom",
436
- "44"
463
+ "AD",
464
+ "Andorra",
465
+ "376"
437
466
  ],
438
467
  [
439
- "AE",
440
- "United Arab Emirates",
441
- "971"
468
+ "AO",
469
+ "Angola",
470
+ "244"
442
471
  ],
443
472
  [
444
- "SG",
445
- "Singapore",
446
- "65"
473
+ "AI",
474
+ "Anguilla",
475
+ "1"
476
+ ],
477
+ [
478
+ "AG",
479
+ "Antigua & Barbuda",
480
+ "1"
481
+ ],
482
+ [
483
+ "AR",
484
+ "Argentina",
485
+ "54"
486
+ ],
487
+ [
488
+ "AM",
489
+ "Armenia",
490
+ "374"
491
+ ],
492
+ [
493
+ "AW",
494
+ "Aruba",
495
+ "297"
496
+ ],
497
+ [
498
+ "AC",
499
+ "Ascension Island",
500
+ "247"
447
501
  ],
448
502
  [
449
503
  "AU",
@@ -451,69 +505,159 @@ var e = class extends HTMLElement {
451
505
  "61"
452
506
  ],
453
507
  [
454
- "CA",
455
- "Canada",
508
+ "AT",
509
+ "Austria",
510
+ "43"
511
+ ],
512
+ [
513
+ "AZ",
514
+ "Azerbaijan",
515
+ "994"
516
+ ],
517
+ [
518
+ "BS",
519
+ "Bahamas",
456
520
  "1"
457
521
  ],
458
522
  [
459
- "DE",
460
- "Germany",
461
- "49"
523
+ "BH",
524
+ "Bahrain",
525
+ "973"
462
526
  ],
463
527
  [
464
- "FR",
465
- "France",
466
- "33"
528
+ "BD",
529
+ "Bangladesh",
530
+ "880"
467
531
  ],
468
532
  [
469
- "IT",
470
- "Italy",
471
- "39"
533
+ "BB",
534
+ "Barbados",
535
+ "1"
472
536
  ],
473
537
  [
474
- "ES",
475
- "Spain",
476
- "34"
538
+ "BY",
539
+ "Belarus",
540
+ "375"
477
541
  ],
478
542
  [
479
- "NL",
480
- "Netherlands",
481
- "31"
543
+ "BE",
544
+ "Belgium",
545
+ "32"
482
546
  ],
483
547
  [
484
- "CH",
485
- "Switzerland",
486
- "41"
548
+ "BZ",
549
+ "Belize",
550
+ "501"
487
551
  ],
488
552
  [
489
- "SE",
490
- "Sweden",
491
- "46"
553
+ "BJ",
554
+ "Benin",
555
+ "229"
492
556
  ],
493
557
  [
494
- "NO",
495
- "Norway",
496
- "47"
558
+ "BM",
559
+ "Bermuda",
560
+ "1"
497
561
  ],
498
562
  [
499
- "DK",
500
- "Denmark",
501
- "45"
563
+ "BT",
564
+ "Bhutan",
565
+ "975"
502
566
  ],
503
567
  [
504
- "IE",
505
- "Ireland",
506
- "353"
568
+ "BO",
569
+ "Bolivia",
570
+ "591"
507
571
  ],
508
572
  [
509
- "NZ",
510
- "New Zealand",
511
- "64"
573
+ "BA",
574
+ "Bosnia & Herzegovina",
575
+ "387"
512
576
  ],
513
577
  [
514
- "JP",
515
- "Japan",
516
- "81"
578
+ "BW",
579
+ "Botswana",
580
+ "267"
581
+ ],
582
+ [
583
+ "BR",
584
+ "Brazil",
585
+ "55"
586
+ ],
587
+ [
588
+ "IO",
589
+ "British Indian Ocean Territory",
590
+ "246"
591
+ ],
592
+ [
593
+ "VG",
594
+ "British Virgin Islands",
595
+ "1"
596
+ ],
597
+ [
598
+ "BN",
599
+ "Brunei",
600
+ "673"
601
+ ],
602
+ [
603
+ "BG",
604
+ "Bulgaria",
605
+ "359"
606
+ ],
607
+ [
608
+ "BF",
609
+ "Burkina Faso",
610
+ "226"
611
+ ],
612
+ [
613
+ "BI",
614
+ "Burundi",
615
+ "257"
616
+ ],
617
+ [
618
+ "KH",
619
+ "Cambodia",
620
+ "855"
621
+ ],
622
+ [
623
+ "CM",
624
+ "Cameroon",
625
+ "237"
626
+ ],
627
+ [
628
+ "CA",
629
+ "Canada",
630
+ "1"
631
+ ],
632
+ [
633
+ "CV",
634
+ "Cape Verde",
635
+ "238"
636
+ ],
637
+ [
638
+ "BQ",
639
+ "Caribbean Netherlands",
640
+ "599"
641
+ ],
642
+ [
643
+ "KY",
644
+ "Cayman Islands",
645
+ "1"
646
+ ],
647
+ [
648
+ "CF",
649
+ "Central African Republic",
650
+ "236"
651
+ ],
652
+ [
653
+ "TD",
654
+ "Chad",
655
+ "235"
656
+ ],
657
+ [
658
+ "CL",
659
+ "Chile",
660
+ "56"
517
661
  ],
518
662
  [
519
663
  "CN",
@@ -521,79 +665,99 @@ var e = class extends HTMLElement {
521
665
  "86"
522
666
  ],
523
667
  [
524
- "HK",
525
- "Hong Kong",
526
- "852"
668
+ "CX",
669
+ "Christmas Island",
670
+ "61"
527
671
  ],
528
672
  [
529
- "MY",
530
- "Malaysia",
531
- "60"
673
+ "CC",
674
+ "Cocos (Keeling) Islands",
675
+ "61"
532
676
  ],
533
677
  [
534
- "ID",
535
- "Indonesia",
536
- "62"
678
+ "CO",
679
+ "Colombia",
680
+ "57"
537
681
  ],
538
682
  [
539
- "TH",
540
- "Thailand",
541
- "66"
683
+ "KM",
684
+ "Comoros",
685
+ "269"
542
686
  ],
543
687
  [
544
- "PH",
545
- "Philippines",
546
- "63"
688
+ "CG",
689
+ "Congo - Brazzaville",
690
+ "242"
547
691
  ],
548
692
  [
549
- "VN",
550
- "Vietnam",
551
- "84"
693
+ "CD",
694
+ "Congo - Kinshasa",
695
+ "243"
552
696
  ],
553
697
  [
554
- "KR",
555
- "South Korea",
556
- "82"
698
+ "CK",
699
+ "Cook Islands",
700
+ "682"
557
701
  ],
558
702
  [
559
- "SA",
560
- "Saudi Arabia",
561
- "966"
703
+ "CR",
704
+ "Costa Rica",
705
+ "506"
562
706
  ],
563
707
  [
564
- "QA",
565
- "Qatar",
566
- "974"
708
+ "CI",
709
+ "Côte d’Ivoire",
710
+ "225"
567
711
  ],
568
712
  [
569
- "KW",
570
- "Kuwait",
571
- "965"
713
+ "HR",
714
+ "Croatia",
715
+ "385"
572
716
  ],
573
717
  [
574
- "BH",
575
- "Bahrain",
576
- "973"
718
+ "CU",
719
+ "Cuba",
720
+ "53"
577
721
  ],
578
722
  [
579
- "OM",
580
- "Oman",
581
- "968"
723
+ "CW",
724
+ "Curaçao",
725
+ "599"
582
726
  ],
583
727
  [
584
- "ZA",
585
- "South Africa",
586
- "27"
728
+ "CY",
729
+ "Cyprus",
730
+ "357"
587
731
  ],
588
732
  [
589
- "NG",
590
- "Nigeria",
591
- "234"
733
+ "CZ",
734
+ "Czechia",
735
+ "420"
592
736
  ],
593
737
  [
594
- "KE",
595
- "Kenya",
596
- "254"
738
+ "DK",
739
+ "Denmark",
740
+ "45"
741
+ ],
742
+ [
743
+ "DJ",
744
+ "Djibouti",
745
+ "253"
746
+ ],
747
+ [
748
+ "DM",
749
+ "Dominica",
750
+ "1"
751
+ ],
752
+ [
753
+ "DO",
754
+ "Dominican Republic",
755
+ "1"
756
+ ],
757
+ [
758
+ "EC",
759
+ "Ecuador",
760
+ "593"
597
761
  ],
598
762
  [
599
763
  "EG",
@@ -601,86 +765,946 @@ var e = class extends HTMLElement {
601
765
  "20"
602
766
  ],
603
767
  [
604
- "BR",
605
- "Brazil",
606
- "55"
768
+ "SV",
769
+ "El Salvador",
770
+ "503"
607
771
  ],
608
772
  [
609
- "MX",
610
- "Mexico",
611
- "52"
773
+ "GQ",
774
+ "Equatorial Guinea",
775
+ "240"
612
776
  ],
613
777
  [
614
- "AR",
615
- "Argentina",
616
- "54"
778
+ "ER",
779
+ "Eritrea",
780
+ "291"
617
781
  ],
618
782
  [
619
- "BD",
620
- "Bangladesh",
621
- "880"
783
+ "EE",
784
+ "Estonia",
785
+ "372"
622
786
  ],
623
787
  [
624
- "PK",
625
- "Pakistan",
626
- "92"
788
+ "SZ",
789
+ "Eswatini",
790
+ "268"
627
791
  ],
628
792
  [
629
- "LK",
630
- "Sri Lanka",
631
- "94"
793
+ "ET",
794
+ "Ethiopia",
795
+ "251"
632
796
  ],
633
797
  [
634
- "NP",
635
- "Nepal",
636
- "977"
637
- ]
638
- ], h = (e) => e.toUpperCase().replace(/./g, (e) => String.fromCodePoint(127397 + e.charCodeAt(0))), g = (e) => (m.find((t) => t[0] === e) || [
639
- "",
640
- "",
641
- ""
642
- ])[2], _ = class extends HTMLElement {
643
- static formAssociated = !0;
644
- static get observedAttributes() {
645
- return [
646
- "value",
647
- "country",
648
- "placeholder",
649
- "disabled"
650
- ];
651
- }
652
- constructor() {
653
- super(), this._internals = this.attachInternals ? this.attachInternals() : null, this._country = "IN", this._national = "";
654
- }
655
- connectedCallback() {
656
- this._rendered || this.render();
657
- }
658
- attributeChangedCallback(e, t, n) {
659
- this._rendered && (e === "country" && (this._country = n || "IN"), this.render());
660
- }
661
- get value() {
662
- return `+${g(this._country)}${this._national}`;
663
- }
664
- set value(e) {
665
- this._national = String(e ?? "").replace(/[^0-9]/g, ""), this._commit();
666
- }
667
- _commit() {
668
- this._internals?.setFormValue(this.value), this.dispatchEvent(new Event("change", { bubbles: !0 }));
669
- }
670
- render() {
671
- let e = this.getAttribute("placeholder") || "Enter phone number";
672
- this._country = this.getAttribute("country") || this._country;
673
- let t = m.map(([e, t, n]) => `<button type="button" role="option" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}"><span class="phone-flag-lg">${h(e)}</span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join("");
674
- this.innerHTML = `
675
- <div class="phone-input-wrap">
676
- <div class="phone-country-adornment">
677
- <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
678
- <span class="phone-flag" data-flag>${h(this._country)}</span>
679
- <i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
680
- <span class="phone-dial" data-dial>+${g(this._country)}</span>
681
- </button>
682
- <div class="country-dropdown-menu" role="listbox" hidden>
683
- <div class="dropdown-search-wrapper"><span class="dropdown-search-icon"><i class="bi bi-search" aria-hidden="true"></i></span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" /></div>
798
+ "FK",
799
+ "Falkland Islands",
800
+ "500"
801
+ ],
802
+ [
803
+ "FO",
804
+ "Faroe Islands",
805
+ "298"
806
+ ],
807
+ [
808
+ "FJ",
809
+ "Fiji",
810
+ "679"
811
+ ],
812
+ [
813
+ "FI",
814
+ "Finland",
815
+ "358"
816
+ ],
817
+ [
818
+ "FR",
819
+ "France",
820
+ "33"
821
+ ],
822
+ [
823
+ "GF",
824
+ "French Guiana",
825
+ "594"
826
+ ],
827
+ [
828
+ "PF",
829
+ "French Polynesia",
830
+ "689"
831
+ ],
832
+ [
833
+ "GA",
834
+ "Gabon",
835
+ "241"
836
+ ],
837
+ [
838
+ "GM",
839
+ "Gambia",
840
+ "220"
841
+ ],
842
+ [
843
+ "GE",
844
+ "Georgia",
845
+ "995"
846
+ ],
847
+ [
848
+ "DE",
849
+ "Germany",
850
+ "49"
851
+ ],
852
+ [
853
+ "GH",
854
+ "Ghana",
855
+ "233"
856
+ ],
857
+ [
858
+ "GI",
859
+ "Gibraltar",
860
+ "350"
861
+ ],
862
+ [
863
+ "GR",
864
+ "Greece",
865
+ "30"
866
+ ],
867
+ [
868
+ "GL",
869
+ "Greenland",
870
+ "299"
871
+ ],
872
+ [
873
+ "GD",
874
+ "Grenada",
875
+ "1"
876
+ ],
877
+ [
878
+ "GP",
879
+ "Guadeloupe",
880
+ "590"
881
+ ],
882
+ [
883
+ "GU",
884
+ "Guam",
885
+ "1"
886
+ ],
887
+ [
888
+ "GT",
889
+ "Guatemala",
890
+ "502"
891
+ ],
892
+ [
893
+ "GG",
894
+ "Guernsey",
895
+ "44"
896
+ ],
897
+ [
898
+ "GN",
899
+ "Guinea",
900
+ "224"
901
+ ],
902
+ [
903
+ "GW",
904
+ "Guinea-Bissau",
905
+ "245"
906
+ ],
907
+ [
908
+ "GY",
909
+ "Guyana",
910
+ "592"
911
+ ],
912
+ [
913
+ "HT",
914
+ "Haiti",
915
+ "509"
916
+ ],
917
+ [
918
+ "HN",
919
+ "Honduras",
920
+ "504"
921
+ ],
922
+ [
923
+ "HK",
924
+ "Hong Kong SAR China",
925
+ "852"
926
+ ],
927
+ [
928
+ "HU",
929
+ "Hungary",
930
+ "36"
931
+ ],
932
+ [
933
+ "IS",
934
+ "Iceland",
935
+ "354"
936
+ ],
937
+ [
938
+ "IN",
939
+ "India",
940
+ "91"
941
+ ],
942
+ [
943
+ "ID",
944
+ "Indonesia",
945
+ "62"
946
+ ],
947
+ [
948
+ "IR",
949
+ "Iran",
950
+ "98"
951
+ ],
952
+ [
953
+ "IQ",
954
+ "Iraq",
955
+ "964"
956
+ ],
957
+ [
958
+ "IE",
959
+ "Ireland",
960
+ "353"
961
+ ],
962
+ [
963
+ "IM",
964
+ "Isle of Man",
965
+ "44"
966
+ ],
967
+ [
968
+ "IL",
969
+ "Israel",
970
+ "972"
971
+ ],
972
+ [
973
+ "IT",
974
+ "Italy",
975
+ "39"
976
+ ],
977
+ [
978
+ "JM",
979
+ "Jamaica",
980
+ "1"
981
+ ],
982
+ [
983
+ "JP",
984
+ "Japan",
985
+ "81"
986
+ ],
987
+ [
988
+ "JE",
989
+ "Jersey",
990
+ "44"
991
+ ],
992
+ [
993
+ "JO",
994
+ "Jordan",
995
+ "962"
996
+ ],
997
+ [
998
+ "KZ",
999
+ "Kazakhstan",
1000
+ "7"
1001
+ ],
1002
+ [
1003
+ "KE",
1004
+ "Kenya",
1005
+ "254"
1006
+ ],
1007
+ [
1008
+ "KI",
1009
+ "Kiribati",
1010
+ "686"
1011
+ ],
1012
+ [
1013
+ "XK",
1014
+ "Kosovo",
1015
+ "383"
1016
+ ],
1017
+ [
1018
+ "KW",
1019
+ "Kuwait",
1020
+ "965"
1021
+ ],
1022
+ [
1023
+ "KG",
1024
+ "Kyrgyzstan",
1025
+ "996"
1026
+ ],
1027
+ [
1028
+ "LA",
1029
+ "Laos",
1030
+ "856"
1031
+ ],
1032
+ [
1033
+ "LV",
1034
+ "Latvia",
1035
+ "371"
1036
+ ],
1037
+ [
1038
+ "LB",
1039
+ "Lebanon",
1040
+ "961"
1041
+ ],
1042
+ [
1043
+ "LS",
1044
+ "Lesotho",
1045
+ "266"
1046
+ ],
1047
+ [
1048
+ "LR",
1049
+ "Liberia",
1050
+ "231"
1051
+ ],
1052
+ [
1053
+ "LY",
1054
+ "Libya",
1055
+ "218"
1056
+ ],
1057
+ [
1058
+ "LI",
1059
+ "Liechtenstein",
1060
+ "423"
1061
+ ],
1062
+ [
1063
+ "LT",
1064
+ "Lithuania",
1065
+ "370"
1066
+ ],
1067
+ [
1068
+ "LU",
1069
+ "Luxembourg",
1070
+ "352"
1071
+ ],
1072
+ [
1073
+ "MO",
1074
+ "Macao SAR China",
1075
+ "853"
1076
+ ],
1077
+ [
1078
+ "MG",
1079
+ "Madagascar",
1080
+ "261"
1081
+ ],
1082
+ [
1083
+ "MW",
1084
+ "Malawi",
1085
+ "265"
1086
+ ],
1087
+ [
1088
+ "MY",
1089
+ "Malaysia",
1090
+ "60"
1091
+ ],
1092
+ [
1093
+ "MV",
1094
+ "Maldives",
1095
+ "960"
1096
+ ],
1097
+ [
1098
+ "ML",
1099
+ "Mali",
1100
+ "223"
1101
+ ],
1102
+ [
1103
+ "MT",
1104
+ "Malta",
1105
+ "356"
1106
+ ],
1107
+ [
1108
+ "MH",
1109
+ "Marshall Islands",
1110
+ "692"
1111
+ ],
1112
+ [
1113
+ "MQ",
1114
+ "Martinique",
1115
+ "596"
1116
+ ],
1117
+ [
1118
+ "MR",
1119
+ "Mauritania",
1120
+ "222"
1121
+ ],
1122
+ [
1123
+ "MU",
1124
+ "Mauritius",
1125
+ "230"
1126
+ ],
1127
+ [
1128
+ "YT",
1129
+ "Mayotte",
1130
+ "262"
1131
+ ],
1132
+ [
1133
+ "MX",
1134
+ "Mexico",
1135
+ "52"
1136
+ ],
1137
+ [
1138
+ "FM",
1139
+ "Micronesia",
1140
+ "691"
1141
+ ],
1142
+ [
1143
+ "MD",
1144
+ "Moldova",
1145
+ "373"
1146
+ ],
1147
+ [
1148
+ "MC",
1149
+ "Monaco",
1150
+ "377"
1151
+ ],
1152
+ [
1153
+ "MN",
1154
+ "Mongolia",
1155
+ "976"
1156
+ ],
1157
+ [
1158
+ "ME",
1159
+ "Montenegro",
1160
+ "382"
1161
+ ],
1162
+ [
1163
+ "MS",
1164
+ "Montserrat",
1165
+ "1"
1166
+ ],
1167
+ [
1168
+ "MA",
1169
+ "Morocco",
1170
+ "212"
1171
+ ],
1172
+ [
1173
+ "MZ",
1174
+ "Mozambique",
1175
+ "258"
1176
+ ],
1177
+ [
1178
+ "MM",
1179
+ "Myanmar (Burma)",
1180
+ "95"
1181
+ ],
1182
+ [
1183
+ "NA",
1184
+ "Namibia",
1185
+ "264"
1186
+ ],
1187
+ [
1188
+ "NR",
1189
+ "Nauru",
1190
+ "674"
1191
+ ],
1192
+ [
1193
+ "NP",
1194
+ "Nepal",
1195
+ "977"
1196
+ ],
1197
+ [
1198
+ "NL",
1199
+ "Netherlands",
1200
+ "31"
1201
+ ],
1202
+ [
1203
+ "NC",
1204
+ "New Caledonia",
1205
+ "687"
1206
+ ],
1207
+ [
1208
+ "NZ",
1209
+ "New Zealand",
1210
+ "64"
1211
+ ],
1212
+ [
1213
+ "NI",
1214
+ "Nicaragua",
1215
+ "505"
1216
+ ],
1217
+ [
1218
+ "NE",
1219
+ "Niger",
1220
+ "227"
1221
+ ],
1222
+ [
1223
+ "NG",
1224
+ "Nigeria",
1225
+ "234"
1226
+ ],
1227
+ [
1228
+ "NU",
1229
+ "Niue",
1230
+ "683"
1231
+ ],
1232
+ [
1233
+ "NF",
1234
+ "Norfolk Island",
1235
+ "672"
1236
+ ],
1237
+ [
1238
+ "KP",
1239
+ "North Korea",
1240
+ "850"
1241
+ ],
1242
+ [
1243
+ "MK",
1244
+ "North Macedonia",
1245
+ "389"
1246
+ ],
1247
+ [
1248
+ "MP",
1249
+ "Northern Mariana Islands",
1250
+ "1"
1251
+ ],
1252
+ [
1253
+ "NO",
1254
+ "Norway",
1255
+ "47"
1256
+ ],
1257
+ [
1258
+ "OM",
1259
+ "Oman",
1260
+ "968"
1261
+ ],
1262
+ [
1263
+ "PK",
1264
+ "Pakistan",
1265
+ "92"
1266
+ ],
1267
+ [
1268
+ "PW",
1269
+ "Palau",
1270
+ "680"
1271
+ ],
1272
+ [
1273
+ "PS",
1274
+ "Palestinian Territories",
1275
+ "970"
1276
+ ],
1277
+ [
1278
+ "PA",
1279
+ "Panama",
1280
+ "507"
1281
+ ],
1282
+ [
1283
+ "PG",
1284
+ "Papua New Guinea",
1285
+ "675"
1286
+ ],
1287
+ [
1288
+ "PY",
1289
+ "Paraguay",
1290
+ "595"
1291
+ ],
1292
+ [
1293
+ "PE",
1294
+ "Peru",
1295
+ "51"
1296
+ ],
1297
+ [
1298
+ "PH",
1299
+ "Philippines",
1300
+ "63"
1301
+ ],
1302
+ [
1303
+ "PL",
1304
+ "Poland",
1305
+ "48"
1306
+ ],
1307
+ [
1308
+ "PT",
1309
+ "Portugal",
1310
+ "351"
1311
+ ],
1312
+ [
1313
+ "PR",
1314
+ "Puerto Rico",
1315
+ "1"
1316
+ ],
1317
+ [
1318
+ "QA",
1319
+ "Qatar",
1320
+ "974"
1321
+ ],
1322
+ [
1323
+ "RE",
1324
+ "Réunion",
1325
+ "262"
1326
+ ],
1327
+ [
1328
+ "RO",
1329
+ "Romania",
1330
+ "40"
1331
+ ],
1332
+ [
1333
+ "RU",
1334
+ "Russia",
1335
+ "7"
1336
+ ],
1337
+ [
1338
+ "RW",
1339
+ "Rwanda",
1340
+ "250"
1341
+ ],
1342
+ [
1343
+ "WS",
1344
+ "Samoa",
1345
+ "685"
1346
+ ],
1347
+ [
1348
+ "SM",
1349
+ "San Marino",
1350
+ "378"
1351
+ ],
1352
+ [
1353
+ "ST",
1354
+ "São Tomé & Príncipe",
1355
+ "239"
1356
+ ],
1357
+ [
1358
+ "SA",
1359
+ "Saudi Arabia",
1360
+ "966"
1361
+ ],
1362
+ [
1363
+ "SN",
1364
+ "Senegal",
1365
+ "221"
1366
+ ],
1367
+ [
1368
+ "RS",
1369
+ "Serbia",
1370
+ "381"
1371
+ ],
1372
+ [
1373
+ "SC",
1374
+ "Seychelles",
1375
+ "248"
1376
+ ],
1377
+ [
1378
+ "SL",
1379
+ "Sierra Leone",
1380
+ "232"
1381
+ ],
1382
+ [
1383
+ "SG",
1384
+ "Singapore",
1385
+ "65"
1386
+ ],
1387
+ [
1388
+ "SX",
1389
+ "Sint Maarten",
1390
+ "1"
1391
+ ],
1392
+ [
1393
+ "SK",
1394
+ "Slovakia",
1395
+ "421"
1396
+ ],
1397
+ [
1398
+ "SI",
1399
+ "Slovenia",
1400
+ "386"
1401
+ ],
1402
+ [
1403
+ "SB",
1404
+ "Solomon Islands",
1405
+ "677"
1406
+ ],
1407
+ [
1408
+ "SO",
1409
+ "Somalia",
1410
+ "252"
1411
+ ],
1412
+ [
1413
+ "ZA",
1414
+ "South Africa",
1415
+ "27"
1416
+ ],
1417
+ [
1418
+ "KR",
1419
+ "South Korea",
1420
+ "82"
1421
+ ],
1422
+ [
1423
+ "SS",
1424
+ "South Sudan",
1425
+ "211"
1426
+ ],
1427
+ [
1428
+ "ES",
1429
+ "Spain",
1430
+ "34"
1431
+ ],
1432
+ [
1433
+ "LK",
1434
+ "Sri Lanka",
1435
+ "94"
1436
+ ],
1437
+ [
1438
+ "BL",
1439
+ "St. Barthélemy",
1440
+ "590"
1441
+ ],
1442
+ [
1443
+ "SH",
1444
+ "St. Helena",
1445
+ "290"
1446
+ ],
1447
+ [
1448
+ "KN",
1449
+ "St. Kitts & Nevis",
1450
+ "1"
1451
+ ],
1452
+ [
1453
+ "LC",
1454
+ "St. Lucia",
1455
+ "1"
1456
+ ],
1457
+ [
1458
+ "MF",
1459
+ "St. Martin",
1460
+ "590"
1461
+ ],
1462
+ [
1463
+ "PM",
1464
+ "St. Pierre & Miquelon",
1465
+ "508"
1466
+ ],
1467
+ [
1468
+ "VC",
1469
+ "St. Vincent & Grenadines",
1470
+ "1"
1471
+ ],
1472
+ [
1473
+ "SD",
1474
+ "Sudan",
1475
+ "249"
1476
+ ],
1477
+ [
1478
+ "SR",
1479
+ "Suriname",
1480
+ "597"
1481
+ ],
1482
+ [
1483
+ "SJ",
1484
+ "Svalbard & Jan Mayen",
1485
+ "47"
1486
+ ],
1487
+ [
1488
+ "SE",
1489
+ "Sweden",
1490
+ "46"
1491
+ ],
1492
+ [
1493
+ "CH",
1494
+ "Switzerland",
1495
+ "41"
1496
+ ],
1497
+ [
1498
+ "SY",
1499
+ "Syria",
1500
+ "963"
1501
+ ],
1502
+ [
1503
+ "TW",
1504
+ "Taiwan",
1505
+ "886"
1506
+ ],
1507
+ [
1508
+ "TJ",
1509
+ "Tajikistan",
1510
+ "992"
1511
+ ],
1512
+ [
1513
+ "TZ",
1514
+ "Tanzania",
1515
+ "255"
1516
+ ],
1517
+ [
1518
+ "TH",
1519
+ "Thailand",
1520
+ "66"
1521
+ ],
1522
+ [
1523
+ "TL",
1524
+ "Timor-Leste",
1525
+ "670"
1526
+ ],
1527
+ [
1528
+ "TG",
1529
+ "Togo",
1530
+ "228"
1531
+ ],
1532
+ [
1533
+ "TK",
1534
+ "Tokelau",
1535
+ "690"
1536
+ ],
1537
+ [
1538
+ "TO",
1539
+ "Tonga",
1540
+ "676"
1541
+ ],
1542
+ [
1543
+ "TT",
1544
+ "Trinidad & Tobago",
1545
+ "1"
1546
+ ],
1547
+ [
1548
+ "TA",
1549
+ "Tristan da Cunha",
1550
+ "290"
1551
+ ],
1552
+ [
1553
+ "TN",
1554
+ "Tunisia",
1555
+ "216"
1556
+ ],
1557
+ [
1558
+ "TR",
1559
+ "Türkiye",
1560
+ "90"
1561
+ ],
1562
+ [
1563
+ "TM",
1564
+ "Turkmenistan",
1565
+ "993"
1566
+ ],
1567
+ [
1568
+ "TC",
1569
+ "Turks & Caicos Islands",
1570
+ "1"
1571
+ ],
1572
+ [
1573
+ "TV",
1574
+ "Tuvalu",
1575
+ "688"
1576
+ ],
1577
+ [
1578
+ "VI",
1579
+ "U.S. Virgin Islands",
1580
+ "1"
1581
+ ],
1582
+ [
1583
+ "UG",
1584
+ "Uganda",
1585
+ "256"
1586
+ ],
1587
+ [
1588
+ "UA",
1589
+ "Ukraine",
1590
+ "380"
1591
+ ],
1592
+ [
1593
+ "AE",
1594
+ "United Arab Emirates",
1595
+ "971"
1596
+ ],
1597
+ [
1598
+ "GB",
1599
+ "United Kingdom",
1600
+ "44"
1601
+ ],
1602
+ [
1603
+ "US",
1604
+ "United States",
1605
+ "1"
1606
+ ],
1607
+ [
1608
+ "UY",
1609
+ "Uruguay",
1610
+ "598"
1611
+ ],
1612
+ [
1613
+ "UZ",
1614
+ "Uzbekistan",
1615
+ "998"
1616
+ ],
1617
+ [
1618
+ "VU",
1619
+ "Vanuatu",
1620
+ "678"
1621
+ ],
1622
+ [
1623
+ "VA",
1624
+ "Vatican City",
1625
+ "39"
1626
+ ],
1627
+ [
1628
+ "VE",
1629
+ "Venezuela",
1630
+ "58"
1631
+ ],
1632
+ [
1633
+ "VN",
1634
+ "Vietnam",
1635
+ "84"
1636
+ ],
1637
+ [
1638
+ "WF",
1639
+ "Wallis & Futuna",
1640
+ "681"
1641
+ ],
1642
+ [
1643
+ "EH",
1644
+ "Western Sahara",
1645
+ "212"
1646
+ ],
1647
+ [
1648
+ "YE",
1649
+ "Yemen",
1650
+ "967"
1651
+ ],
1652
+ [
1653
+ "ZM",
1654
+ "Zambia",
1655
+ "260"
1656
+ ],
1657
+ [
1658
+ "ZW",
1659
+ "Zimbabwe",
1660
+ "263"
1661
+ ]
1662
+ ], h = (e) => (m.find((t) => t[0] === e) || [
1663
+ "",
1664
+ "",
1665
+ ""
1666
+ ])[2], g = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, _ = class extends HTMLElement {
1667
+ static formAssociated = !0;
1668
+ static get observedAttributes() {
1669
+ return [
1670
+ "value",
1671
+ "country",
1672
+ "placeholder",
1673
+ "disabled"
1674
+ ];
1675
+ }
1676
+ constructor() {
1677
+ super(), this._internals = this.attachInternals ? this.attachInternals() : null, this._country = "IN", this._national = "";
1678
+ }
1679
+ connectedCallback() {
1680
+ this._rendered || this.render();
1681
+ }
1682
+ attributeChangedCallback(e, t, n) {
1683
+ this._rendered && (e === "country" && (this._country = n || "IN"), this.render());
1684
+ }
1685
+ get value() {
1686
+ return `+${h(this._country)}${this._national}`;
1687
+ }
1688
+ set value(e) {
1689
+ this._national = String(e ?? "").replace(/[^0-9]/g, ""), this._commit();
1690
+ }
1691
+ _commit() {
1692
+ this._internals?.setFormValue(this.value), this.dispatchEvent(new Event("change", { bubbles: !0 }));
1693
+ }
1694
+ render() {
1695
+ let e = this.getAttribute("placeholder") || "Enter phone number";
1696
+ this._country = this.getAttribute("country") || this._country;
1697
+ let t = m.map(([e, t, n]) => `<button type="button" role="option" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}"><span class="${g(e)}" aria-hidden="true"></span><span class="country-name-text">${t}<span class="country-code-text">+${n}</span></span></button>`).join("");
1698
+ this.innerHTML = `
1699
+ <div class="phone-input-wrap">
1700
+ <div class="phone-country-adornment">
1701
+ <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}>
1702
+ <span class="${g(this._country)}" data-flag aria-hidden="true"></span>
1703
+ <i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
1704
+ <span class="phone-dial" data-dial>+${h(this._country)}</span>
1705
+ </button>
1706
+ <div class="country-dropdown-menu" role="listbox" hidden>
1707
+ <div class="dropdown-search-wrapper"><span class="dropdown-search-icon"><i class="bi bi-search" aria-hidden="true"></i></span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" /></div>
684
1708
  <div class="country-list-scroll">${t}<div class="country-empty" hidden>No countries found</div></div>
685
1709
  </div>
686
1710
  </div>
@@ -691,32 +1715,39 @@ var e = class extends HTMLElement {
691
1715
  let e = this.querySelector(".country-toggle"), t = this.querySelector(".country-dropdown-menu"), n = this.querySelector(".dropdown-search-input"), r = this.querySelector(".country-list-scroll"), i = this.querySelector(".country-empty"), a = this.querySelector("input[type=tel]"), o = this.querySelector("[data-flag]"), s = this.querySelector("[data-dial]");
692
1716
  if (!e || !t) return;
693
1717
  let c = () => !t.hidden, l = () => {
694
- t.hidden = !1, e.setAttribute("aria-expanded", "true"), n.value = "", d(""), n.focus();
1718
+ let n = e.getBoundingClientRect(), r = t.offsetWidth || 320, i = t.offsetHeight || 320, a = window.innerHeight - n.bottom, o = a < i + 6 && n.top > a ? n.top - i - 6 : n.bottom + 6, s = Math.min(Math.max(8, n.left), Math.max(8, window.innerWidth - r - 8));
1719
+ t.style.top = `${Math.max(8, o)}px`, t.style.left = `${s}px`;
695
1720
  }, u = () => {
1721
+ t.hidden = !1, e.setAttribute("aria-expanded", "true"), n.value = "", f(""), l(), n.focus();
1722
+ }, d = () => {
696
1723
  t.hidden = !0, e.setAttribute("aria-expanded", "false");
697
- }, d = (e) => {
1724
+ };
1725
+ this._reposition = () => {
1726
+ c() && l();
1727
+ }, window.addEventListener("scroll", this._reposition, !0), window.addEventListener("resize", this._reposition);
1728
+ let f = (e) => {
698
1729
  let t = e.trim().toLowerCase(), n = 0;
699
1730
  for (let e of r.querySelectorAll(".country-dropdown-item")) {
700
1731
  let r = !t || e.textContent.toLowerCase().includes(t);
701
1732
  e.hidden = !r, r && (n += 1);
702
1733
  }
703
1734
  i && (i.hidden = n > 0);
704
- }, f = (e) => {
705
- this._country = e, this.setAttribute("country", e), o && (o.textContent = h(e)), s && (s.textContent = `+${g(e)}`);
1735
+ }, p = (e) => {
1736
+ this._country = e, this.setAttribute("country", e), o && (o.className = g(e)), s && (s.textContent = `+${h(e)}`);
706
1737
  for (let t of r.querySelectorAll(".country-dropdown-item")) t.classList.toggle("selected", t.dataset.iso === e);
707
- u(), this._commit();
1738
+ d(), this._commit();
708
1739
  };
709
- e.addEventListener("click", () => c() ? u() : l()), n.addEventListener("input", () => d(n.value)), r.addEventListener("click", (e) => {
1740
+ e.addEventListener("click", () => c() ? d() : u()), n.addEventListener("input", () => f(n.value)), r.addEventListener("click", (e) => {
710
1741
  let t = e.target.closest(".country-dropdown-item");
711
- t && f(t.dataset.iso);
1742
+ t && p(t.dataset.iso);
712
1743
  }), a.addEventListener("input", () => {
713
1744
  this._national = a.value.replace(/[^0-9]/g, ""), this._commit();
714
1745
  }), this._onDocClick = (e) => {
715
- c() && !this.contains(e.target) && u();
1746
+ c() && !this.contains(e.target) && d();
716
1747
  }, document.addEventListener("click", this._onDocClick), this._internals?.setFormValue(this.value);
717
1748
  }
718
1749
  disconnectedCallback() {
719
- this._onDocClick && document.removeEventListener("click", this._onDocClick);
1750
+ this._reposition && (window.removeEventListener("scroll", this._reposition, !0), window.removeEventListener("resize", this._reposition)), this._onDocClick && document.removeEventListener("click", this._onDocClick);
720
1751
  }
721
1752
  }, v = (e) => String(e ?? "").replace(/"/g, "&quot;").replace(/</g, "&lt;"), y = class extends HTMLElement {
722
1753
  static formAssociated = !0;
@@ -751,14 +1782,20 @@ var e = class extends HTMLElement {
751
1782
  get options() {
752
1783
  return this._readOptions();
753
1784
  }
754
- _readOptions() {
755
- return this._optionsProp ? this._optionsProp : [...this.querySelectorAll(":scope > wui-option")].map((e) => ({
1785
+ _snapshotDeclared() {
1786
+ if (this._declared) return;
1787
+ let e = [...this.querySelectorAll(":scope > wui-option")];
1788
+ e.length && (this._declared = e.map((e) => ({
756
1789
  value: e.getAttribute("value") ?? e.textContent.trim(),
757
1790
  label: e.innerHTML,
758
1791
  selected: e.hasAttribute("selected")
759
- }));
1792
+ })));
1793
+ }
1794
+ _readOptions() {
1795
+ return this._optionsProp ? this._optionsProp : (this._snapshotDeclared(), this._declared || []);
760
1796
  }
761
1797
  render() {
1798
+ this._snapshotDeclared();
762
1799
  let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.getAttribute("placeholder") || "Select...", r = this.getAttribute("search-placeholder") || "Search...", i = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
763
1800
  i && (this._value = String(i.value)), this._internals?.setFormValue(this._value);
764
1801
  let a = e.map((e) => {