@salla.sa/twilight-components 2.12.41 → 2.12.42
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/cjs/app-globals-fe89d834.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_41.cjs.entry.js +135 -333
- package/dist/cjs/salla-add-product-button_41.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-count-down/salla-count-down.js +12 -12
- package/dist/collection/components/salla-count-down/salla-count-down.js.map +1 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +22 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-count-down2.js +12 -12
- package/dist/components/salla-count-down2.js.map +1 -1
- package/dist/components/salla-products-slider.js +3 -1
- package/dist/components/salla-products-slider.js.map +1 -1
- package/dist/components/salla-tel-input2.js +123 -321
- package/dist/components/salla-tel-input2.js.map +1 -1
- package/dist/esm/app-globals-4359b023.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_41.entry.js +135 -333
- package/dist/esm/salla-add-product-button_41.entry.js.map +1 -1
- package/dist/esm/salla-products-slider.entry.js +2 -1
- package/dist/esm/salla-products-slider.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/app-globals-4359b023.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_41.entry.js +4 -4
- package/dist/esm-es5/salla-add-product-button_41.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/{p-25fc9949.system.entry.js → p-270897bc.system.entry.js} +6 -6
- package/dist/twilight/p-270897bc.system.entry.js.map +1 -0
- package/dist/twilight/p-539cf1d8.system.entry.js +5 -0
- package/dist/twilight/p-539cf1d8.system.entry.js.map +1 -0
- package/dist/twilight/p-a04e6e5e.system.js +1 -1
- package/dist/twilight/p-a04e6e5e.system.js.map +1 -1
- package/dist/twilight/p-a527f060.system.js.map +1 -1
- package/dist/twilight/p-ab4c6cc3.js.map +1 -1
- package/dist/twilight/{p-e23a4e3f.entry.js → p-d2437066.entry.js} +8 -8
- package/dist/twilight/p-d2437066.entry.js.map +1 -0
- package/dist/twilight/p-ff5cfed5.entry.js +5 -0
- package/dist/twilight/p-ff5cfed5.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +12 -0
- package/dist/types/components.d.ts +10 -0
- package/package.json +2 -2
- package/dist/twilight/p-17869512.system.entry.js +0 -5
- package/dist/twilight/p-17869512.system.entry.js.map +0 -1
- package/dist/twilight/p-25fc9949.system.entry.js.map +0 -1
- package/dist/twilight/p-d7b6c544.entry.js +0 -5
- package/dist/twilight/p-d7b6c544.entry.js.map +0 -1
- package/dist/twilight/p-e23a4e3f.entry.js.map +0 -1
|
@@ -1603,12 +1603,12 @@ const SallaCountDown = class {
|
|
|
1603
1603
|
this.endText = undefined;
|
|
1604
1604
|
this.digits = 'auto';
|
|
1605
1605
|
this.endOfDay = undefined;
|
|
1606
|
-
this.daysLabel =
|
|
1607
|
-
this.hoursLabel =
|
|
1608
|
-
this.minutesLabel =
|
|
1609
|
-
this.secondsLabel =
|
|
1610
|
-
this.endLabel =
|
|
1611
|
-
this.invalidDate =
|
|
1606
|
+
this.daysLabel = salla.lang.getWithDefault('pages.checkout.day', 'يوم');
|
|
1607
|
+
this.hoursLabel = salla.lang.getWithDefault('pages.checkout.hour', 'ساعة');
|
|
1608
|
+
this.minutesLabel = salla.lang.getWithDefault('pages.checkout.minute', 'دقيقة');
|
|
1609
|
+
this.secondsLabel = salla.lang.getWithDefault('pages.checkout.second', 'ثانية');
|
|
1610
|
+
this.endLabel = salla.lang.getWithDefault('pages.checkout.offer_ended', 'انتهت مدة العرض');
|
|
1611
|
+
this.invalidDate = salla.lang.getWithDefault('blocks.buy_as_gift.incorrect_date', 'الرجاء إدخال الموعد بشكل صحيح');
|
|
1612
1612
|
this.offerEnded = false;
|
|
1613
1613
|
this.countInterval = undefined;
|
|
1614
1614
|
this.days = undefined;
|
|
@@ -1620,12 +1620,12 @@ const SallaCountDown = class {
|
|
|
1620
1620
|
this.minutes = this.number(0);
|
|
1621
1621
|
this.seconds = this.number(0);
|
|
1622
1622
|
salla.lang.onLoaded(() => {
|
|
1623
|
-
this.daysLabel = salla.lang.
|
|
1624
|
-
this.hoursLabel = salla.lang.
|
|
1625
|
-
this.minutesLabel = salla.lang.
|
|
1626
|
-
this.invalidDate = salla.lang.
|
|
1627
|
-
this.secondsLabel = salla.lang.
|
|
1628
|
-
this.endLabel = salla.lang.
|
|
1623
|
+
this.daysLabel = salla.lang.getWithDefault('pages.checkout.day', 'يوم');
|
|
1624
|
+
this.hoursLabel = salla.lang.getWithDefault('pages.checkout.hour', 'ساعة');
|
|
1625
|
+
this.minutesLabel = salla.lang.getWithDefault('pages.checkout.minute', 'دقيقة');
|
|
1626
|
+
this.invalidDate = salla.lang.getWithDefault('blocks.buy_as_gift.incorrect_date', 'الرجاء إدخال الموعد بشكل صحيح');
|
|
1627
|
+
this.secondsLabel = salla.lang.getWithDefault('pages.checkout.second', 'ثانية');
|
|
1628
|
+
this.endLabel = salla.lang.getWithDefault('pages.checkout.offer_ended', 'انتهت مدة العرض');
|
|
1629
1629
|
});
|
|
1630
1630
|
if (this.date && this.isValidDate(this.date)) {
|
|
1631
1631
|
this.startCountDown();
|
|
@@ -26552,7 +26552,7 @@ SallaTabs.style = sallaTabsCss;
|
|
|
26552
26552
|
|
|
26553
26553
|
var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
26554
26554
|
/*
|
|
26555
|
-
* International Telephone Input
|
|
26555
|
+
* International Telephone Input v17.0.13
|
|
26556
26556
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
26557
26557
|
* Licensed under the MIT license
|
|
26558
26558
|
*/
|
|
@@ -26576,7 +26576,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26576
26576
|
// Order (if >1 country with same dial code),
|
|
26577
26577
|
// Area codes
|
|
26578
26578
|
// ]
|
|
26579
|
-
var allCountries = [ [ "Afghanistan (افغانستان)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (الجزائر)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (البحرين)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "
|
|
26579
|
+
var allCountries = [ [ "Afghanistan (افغانستان)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (الجزائر)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (البحرين)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (جزر القمر)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (مصر)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (ایران)", "ir", "98" ], [ "Iraq (العراق)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (ישראל)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (الأردن)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (الكويت)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (لبنان)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (ليبيا)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (موريتانيا)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (المغرب)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (عُمان)", "om", "968" ], [ "Pakistan (پاکستان)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (فلسطين)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (قطر)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (المملكة العربية السعودية)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (جنوب السودان)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්රී ලංකාව)", "lk", "94" ], [ "Sudan (السودان)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (سوريا)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (تونس)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (الإمارات العربية المتحدة)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (الصحراء الغربية)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (اليمن)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ];
|
|
26580
26580
|
// loop over all of the countries above, restructuring the data to be objects with named keys
|
|
26581
26581
|
for (var i = 0; i < allCountries.length; i++) {
|
|
26582
26582
|
var c = allCountries[i];
|
|
@@ -26588,35 +26588,6 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26588
26588
|
areaCodes: c[4] || null
|
|
26589
26589
|
};
|
|
26590
26590
|
}
|
|
26591
|
-
function _objectSpread(target) {
|
|
26592
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
26593
|
-
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
26594
|
-
var ownKeys = Object.keys(source);
|
|
26595
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
26596
|
-
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
26597
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
26598
|
-
}));
|
|
26599
|
-
}
|
|
26600
|
-
ownKeys.forEach(function(key) {
|
|
26601
|
-
_defineProperty(target, key, source[key]);
|
|
26602
|
-
});
|
|
26603
|
-
}
|
|
26604
|
-
return target;
|
|
26605
|
-
}
|
|
26606
|
-
function _defineProperty(obj, key, value) {
|
|
26607
|
-
key = _toPropertyKey(key);
|
|
26608
|
-
if (key in obj) {
|
|
26609
|
-
Object.defineProperty(obj, key, {
|
|
26610
|
-
value: value,
|
|
26611
|
-
enumerable: true,
|
|
26612
|
-
configurable: true,
|
|
26613
|
-
writable: true
|
|
26614
|
-
});
|
|
26615
|
-
} else {
|
|
26616
|
-
obj[key] = value;
|
|
26617
|
-
}
|
|
26618
|
-
return obj;
|
|
26619
|
-
}
|
|
26620
26591
|
function _classCallCheck(instance, Constructor) {
|
|
26621
26592
|
if (!(instance instanceof Constructor)) {
|
|
26622
26593
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -26628,31 +26599,14 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26628
26599
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
26629
26600
|
descriptor.configurable = true;
|
|
26630
26601
|
if ("value" in descriptor) descriptor.writable = true;
|
|
26631
|
-
Object.defineProperty(target,
|
|
26602
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
26632
26603
|
}
|
|
26633
26604
|
}
|
|
26634
26605
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
26635
26606
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
26636
26607
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26637
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
26638
|
-
writable: false
|
|
26639
|
-
});
|
|
26640
26608
|
return Constructor;
|
|
26641
26609
|
}
|
|
26642
|
-
function _toPropertyKey(arg) {
|
|
26643
|
-
var key = _toPrimitive(arg, "string");
|
|
26644
|
-
return typeof key === "symbol" ? key : String(key);
|
|
26645
|
-
}
|
|
26646
|
-
function _toPrimitive(input, hint) {
|
|
26647
|
-
if (typeof input !== "object" || input === null) return input;
|
|
26648
|
-
var prim = input[Symbol.toPrimitive];
|
|
26649
|
-
if (prim !== undefined$1) {
|
|
26650
|
-
var res = prim.call(input, hint || "default");
|
|
26651
|
-
if (typeof res !== "object") return res;
|
|
26652
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
26653
|
-
}
|
|
26654
|
-
return (hint === "string" ? String : Number)(input);
|
|
26655
|
-
}
|
|
26656
26610
|
var intlTelInputGlobals = {
|
|
26657
26611
|
getInstance: function getInstance(input) {
|
|
26658
26612
|
var id = input.getAttribute("data-intl-tel-input-id");
|
|
@@ -26664,17 +26618,14 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26664
26618
|
return document.readyState === "complete";
|
|
26665
26619
|
}
|
|
26666
26620
|
};
|
|
26667
|
-
if (typeof window === "object")
|
|
26668
|
-
window.intlTelInputGlobals = intlTelInputGlobals;
|
|
26669
|
-
}
|
|
26621
|
+
if (typeof window === "object") window.intlTelInputGlobals = intlTelInputGlobals;
|
|
26670
26622
|
// these vars persist through all instances of the plugin
|
|
26671
26623
|
var id = 0;
|
|
26672
26624
|
var defaults = {
|
|
26673
26625
|
// whether or not to allow the dropdown
|
|
26674
26626
|
allowDropdown: true,
|
|
26675
|
-
//
|
|
26676
|
-
|
|
26677
|
-
autoInsertDialCode: false,
|
|
26627
|
+
// if there is just a dial code in the input: remove it on blur
|
|
26628
|
+
autoHideDialCode: true,
|
|
26678
26629
|
// add a placeholder in the input with an example number for the selected country
|
|
26679
26630
|
autoPlaceholder: "polite",
|
|
26680
26631
|
// modify the parentClass
|
|
@@ -26695,7 +26646,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26695
26646
|
initialCountry: "",
|
|
26696
26647
|
// localized country names e.g. { 'de': 'Deutschland' }
|
|
26697
26648
|
localizedCountries: null,
|
|
26698
|
-
//
|
|
26649
|
+
// don't insert international dial codes
|
|
26699
26650
|
nationalMode: true,
|
|
26700
26651
|
// display only these countries
|
|
26701
26652
|
onlyCountries: [],
|
|
@@ -26703,10 +26654,8 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26703
26654
|
placeholderNumberType: "MOBILE",
|
|
26704
26655
|
// the countries at the top of the list. defaults to united states and united kingdom
|
|
26705
26656
|
preferredCountries: [ "us", "gb" ],
|
|
26706
|
-
// display the country dial code next to the selected flag
|
|
26657
|
+
// display the country dial code next to the selected flag so it's not part of the typed number
|
|
26707
26658
|
separateDialCode: false,
|
|
26708
|
-
// option to hide the flags - must be used with separateDialCode, or allowDropdown=false
|
|
26709
|
-
showFlags: true,
|
|
26710
26659
|
// specify the path to the libphonenumber script to enable validation/formatting
|
|
26711
26660
|
utilsScript: ""
|
|
26712
26661
|
};
|
|
@@ -26728,7 +26677,8 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26728
26677
|
};
|
|
26729
26678
|
// this is our plugin class that we will create an instance of
|
|
26730
26679
|
// eslint-disable-next-line no-unused-vars
|
|
26731
|
-
var Iti = /*#__PURE__*/
|
|
26680
|
+
var Iti = /*#__PURE__*/
|
|
26681
|
+
function() {
|
|
26732
26682
|
function Iti(input, options) {
|
|
26733
26683
|
var _this = this;
|
|
26734
26684
|
_classCallCheck(this, Iti);
|
|
@@ -26749,19 +26699,13 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26749
26699
|
key: "_init",
|
|
26750
26700
|
value: function _init() {
|
|
26751
26701
|
var _this2 = this;
|
|
26752
|
-
// if in nationalMode,
|
|
26753
|
-
if (this.options.nationalMode)
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
//
|
|
26702
|
+
// if in nationalMode, disable options relating to dial codes
|
|
26703
|
+
if (this.options.nationalMode) this.options.autoHideDialCode = false;
|
|
26704
|
+
// if separateDialCode then doesn't make sense to A) insert dial code into input
|
|
26705
|
+
// (autoHideDialCode), and B) display national numbers (because we're displaying the country
|
|
26706
|
+
// dial code next to them)
|
|
26757
26707
|
if (this.options.separateDialCode) {
|
|
26758
|
-
this.options.
|
|
26759
|
-
}
|
|
26760
|
-
// force showFlags=true if there's a dropdown and we're not displaying the dial code,
|
|
26761
|
-
// as otherwise you just have a down arrow on it's own which doesn't make sense
|
|
26762
|
-
var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode;
|
|
26763
|
-
if (!this.options.showFlags && forceShowFlags) {
|
|
26764
|
-
this.options.showFlags = true;
|
|
26708
|
+
this.options.autoHideDialCode = this.options.nationalMode = false;
|
|
26765
26709
|
}
|
|
26766
26710
|
// we cannot just test screen size as some smartphones/website meta tags will report desktop
|
|
26767
26711
|
// resolutions
|
|
@@ -26773,12 +26717,8 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26773
26717
|
// trigger the mobile dropdown css
|
|
26774
26718
|
document.body.classList.add("iti-mobile");
|
|
26775
26719
|
// on mobile, we want a full screen dropdown, so we must append it to the body
|
|
26776
|
-
if (!this.options.dropdownContainer)
|
|
26777
|
-
this.options.dropdownContainer = document.body;
|
|
26778
|
-
}
|
|
26720
|
+
if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body;
|
|
26779
26721
|
}
|
|
26780
|
-
// check if input has one parent with RTL
|
|
26781
|
-
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
26782
26722
|
// these promises get resolved when their individual requests complete
|
|
26783
26723
|
// this way the dev can do something like iti.promise.then(...) to know when all requests are
|
|
26784
26724
|
// complete
|
|
@@ -26806,7 +26746,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26806
26746
|
this._generateMarkup();
|
|
26807
26747
|
// set the initial state of the input value and the selected flag
|
|
26808
26748
|
this._setInitialState();
|
|
26809
|
-
// start all of the event listeners:
|
|
26749
|
+
// start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
|
|
26810
26750
|
this._initListeners();
|
|
26811
26751
|
// utils script, and auto country
|
|
26812
26752
|
this._initRequests();
|
|
@@ -26821,9 +26761,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26821
26761
|
// process the preferredCountries
|
|
26822
26762
|
this._processPreferredCountries();
|
|
26823
26763
|
// translate countries according to localizedCountries option
|
|
26824
|
-
if (this.options.localizedCountries)
|
|
26825
|
-
this._translateCountriesByLocale();
|
|
26826
|
-
}
|
|
26764
|
+
if (this.options.localizedCountries) this._translateCountriesByLocale();
|
|
26827
26765
|
// sort countries by name
|
|
26828
26766
|
if (this.options.onlyCountries.length || this.options.localizedCountries) {
|
|
26829
26767
|
this.countries.sort(this._countryNameSort);
|
|
@@ -26840,9 +26778,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26840
26778
|
}
|
|
26841
26779
|
// bail if we already have this country for this countryCode
|
|
26842
26780
|
for (var i = 0; i < this.countryCodes[countryCode].length; i++) {
|
|
26843
|
-
if (this.countryCodes[countryCode][i] === iso2)
|
|
26844
|
-
return;
|
|
26845
|
-
}
|
|
26781
|
+
if (this.countryCodes[countryCode][i] === iso2) return;
|
|
26846
26782
|
}
|
|
26847
26783
|
// check for undefined as 0 is falsy
|
|
26848
26784
|
var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;
|
|
@@ -26882,13 +26818,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26882
26818
|
}, {
|
|
26883
26819
|
key: "_countryNameSort",
|
|
26884
26820
|
value: function _countryNameSort(a, b) {
|
|
26885
|
-
|
|
26886
|
-
return -1;
|
|
26887
|
-
}
|
|
26888
|
-
if (a.name > b.name) {
|
|
26889
|
-
return 1;
|
|
26890
|
-
}
|
|
26891
|
-
return 0;
|
|
26821
|
+
return a.name.localeCompare(b.name);
|
|
26892
26822
|
}
|
|
26893
26823
|
}, {
|
|
26894
26824
|
key: "_processCountryCodes",
|
|
@@ -26901,9 +26831,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26901
26831
|
// first: add dial codes
|
|
26902
26832
|
for (var i = 0; i < this.countries.length; i++) {
|
|
26903
26833
|
var c = this.countries[i];
|
|
26904
|
-
if (!this.dialCodes[c.dialCode])
|
|
26905
|
-
this.dialCodes[c.dialCode] = true;
|
|
26906
|
-
}
|
|
26834
|
+
if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true;
|
|
26907
26835
|
this._addCountryCode(c.iso2, c.dialCode, c.priority);
|
|
26908
26836
|
}
|
|
26909
26837
|
// next: add area codes
|
|
@@ -26938,23 +26866,17 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26938
26866
|
for (var i = 0; i < this.options.preferredCountries.length; i++) {
|
|
26939
26867
|
var countryCode = this.options.preferredCountries[i].toLowerCase();
|
|
26940
26868
|
var countryData = this._getCountryData(countryCode, false, true);
|
|
26941
|
-
if (countryData)
|
|
26942
|
-
this.preferredCountries.push(countryData);
|
|
26943
|
-
}
|
|
26869
|
+
if (countryData) this.preferredCountries.push(countryData);
|
|
26944
26870
|
}
|
|
26945
26871
|
}
|
|
26946
26872
|
}, {
|
|
26947
26873
|
key: "_createEl",
|
|
26948
26874
|
value: function _createEl(name, attrs, container) {
|
|
26949
26875
|
var el = document.createElement(name);
|
|
26950
|
-
if (attrs) {
|
|
26951
|
-
|
|
26952
|
-
|
|
26953
|
-
|
|
26954
|
-
}
|
|
26955
|
-
if (container) {
|
|
26956
|
-
container.appendChild(el);
|
|
26957
|
-
}
|
|
26876
|
+
if (attrs) forEachProp(attrs, function(key, value) {
|
|
26877
|
+
return el.setAttribute(key, value);
|
|
26878
|
+
});
|
|
26879
|
+
if (container) container.appendChild(el);
|
|
26958
26880
|
return el;
|
|
26959
26881
|
}
|
|
26960
26882
|
}, {
|
|
@@ -26963,69 +26885,45 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
26963
26885
|
// if autocomplete does not exist on the element and its form, then
|
|
26964
26886
|
// prevent autocomplete as there's no safe, cross-browser event we can react to, so it can
|
|
26965
26887
|
// easily put the plugin in an inconsistent state e.g. the wrong flag selected for the
|
|
26966
|
-
// autocompleted number, which on submit could mean wrong number is saved
|
|
26888
|
+
// autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode)
|
|
26967
26889
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
26968
26890
|
this.telInput.setAttribute("autocomplete", "off");
|
|
26969
26891
|
}
|
|
26970
|
-
var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer;
|
|
26971
26892
|
// containers (mostly for positioning)
|
|
26972
26893
|
var parentClass = "iti";
|
|
26973
|
-
if (allowDropdown)
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
|
|
26977
|
-
parentClass +=
|
|
26978
|
-
}
|
|
26979
|
-
if (showFlags) {
|
|
26980
|
-
parentClass += " iti--show-flags";
|
|
26981
|
-
}
|
|
26982
|
-
if (customContainer) {
|
|
26983
|
-
parentClass += " ".concat(customContainer);
|
|
26894
|
+
if (this.options.allowDropdown) parentClass += " iti--allow-dropdown";
|
|
26895
|
+
if (this.options.separateDialCode) parentClass += " iti--separate-dial-code";
|
|
26896
|
+
if (this.options.customContainer) {
|
|
26897
|
+
parentClass += " ";
|
|
26898
|
+
parentClass += this.options.customContainer;
|
|
26984
26899
|
}
|
|
26985
26900
|
var wrapper = this._createEl("div", {
|
|
26986
26901
|
"class": parentClass
|
|
26987
26902
|
});
|
|
26988
26903
|
this.telInput.parentNode.insertBefore(wrapper, this.telInput);
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
26992
|
-
this.flagsContainer = this._createEl("div", {
|
|
26993
|
-
"class": "iti__flag-container"
|
|
26994
|
-
}, wrapper);
|
|
26995
|
-
}
|
|
26904
|
+
this.flagsContainer = this._createEl("div", {
|
|
26905
|
+
"class": "iti__flag-container"
|
|
26906
|
+
}, wrapper);
|
|
26996
26907
|
wrapper.appendChild(this.telInput);
|
|
26997
26908
|
// selected flag (displayed to left of input)
|
|
26998
|
-
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
this.
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
|
|
27008
|
-
|
|
27009
|
-
}), this.flagsContainer);
|
|
27010
|
-
}
|
|
27011
|
-
if (showFlags) {
|
|
27012
|
-
this.selectedFlagInner = this._createEl("div", {
|
|
27013
|
-
"class": "iti__flag"
|
|
27014
|
-
}, this.selectedFlag);
|
|
27015
|
-
}
|
|
27016
|
-
if (this.selectedFlag && this.telInput.disabled) {
|
|
27017
|
-
this.selectedFlag.setAttribute("aria-disabled", "true");
|
|
27018
|
-
}
|
|
27019
|
-
if (separateDialCode) {
|
|
26909
|
+
this.selectedFlag = this._createEl("div", {
|
|
26910
|
+
"class": "iti__selected-flag",
|
|
26911
|
+
role: "combobox",
|
|
26912
|
+
"aria-controls": "iti-".concat(this.id, "__country-listbox"),
|
|
26913
|
+
"aria-owns": "iti-".concat(this.id, "__country-listbox"),
|
|
26914
|
+
"aria-expanded": "false"
|
|
26915
|
+
}, this.flagsContainer);
|
|
26916
|
+
this.selectedFlagInner = this._createEl("div", {
|
|
26917
|
+
"class": "iti__flag"
|
|
26918
|
+
}, this.selectedFlag);
|
|
26919
|
+
if (this.options.separateDialCode) {
|
|
27020
26920
|
this.selectedDialCode = this._createEl("div", {
|
|
27021
26921
|
"class": "iti__selected-dial-code"
|
|
27022
26922
|
}, this.selectedFlag);
|
|
27023
26923
|
}
|
|
27024
|
-
if (allowDropdown) {
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
this.selectedFlag.setAttribute("tabindex", "0");
|
|
27028
|
-
}
|
|
26924
|
+
if (this.options.allowDropdown) {
|
|
26925
|
+
// make element focusable and tab navigable
|
|
26926
|
+
this.selectedFlag.setAttribute("tabindex", "0");
|
|
27029
26927
|
this.dropdownArrow = this._createEl("div", {
|
|
27030
26928
|
"class": "iti__arrow"
|
|
27031
26929
|
}, this.selectedFlag);
|
|
@@ -27046,7 +26944,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27046
26944
|
}
|
|
27047
26945
|
this._appendListItems(this.countries, "iti__standard");
|
|
27048
26946
|
// create dropdownContainer markup
|
|
27049
|
-
if (dropdownContainer) {
|
|
26947
|
+
if (this.options.dropdownContainer) {
|
|
27050
26948
|
this.dropdown = this._createEl("div", {
|
|
27051
26949
|
"class": "iti iti--container"
|
|
27052
26950
|
});
|
|
@@ -27055,16 +26953,14 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27055
26953
|
this.flagsContainer.appendChild(this.countryList);
|
|
27056
26954
|
}
|
|
27057
26955
|
}
|
|
27058
|
-
if (hiddenInput) {
|
|
27059
|
-
var hiddenInputName = hiddenInput;
|
|
26956
|
+
if (this.options.hiddenInput) {
|
|
26957
|
+
var hiddenInputName = this.options.hiddenInput;
|
|
27060
26958
|
var name = this.telInput.getAttribute("name");
|
|
27061
26959
|
if (name) {
|
|
27062
26960
|
var i = name.lastIndexOf("[");
|
|
27063
26961
|
// if input name contains square brackets, then give the hidden input the same name,
|
|
27064
26962
|
// replacing the contents of the last set of brackets with the given hiddenInput name
|
|
27065
|
-
if (i !== -1)
|
|
27066
|
-
hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
|
|
27067
|
-
}
|
|
26963
|
+
if (i !== -1) hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
|
|
27068
26964
|
}
|
|
27069
26965
|
this.hiddenInput = this._createEl("input", {
|
|
27070
26966
|
type: "hidden",
|
|
@@ -27086,9 +26982,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27086
26982
|
// open the list item
|
|
27087
26983
|
tmp += "<li class='iti__country ".concat(className, "' tabIndex='-1' id='iti-").concat(this.id, "__item-").concat(c.iso2).concat(idSuffix, "' role='option' data-dial-code='").concat(c.dialCode, "' data-country-code='").concat(c.iso2, "' aria-selected='false'>");
|
|
27088
26984
|
// add the flag
|
|
27089
|
-
|
|
27090
|
-
tmp += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
|
|
27091
|
-
}
|
|
26985
|
+
tmp += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
|
|
27092
26986
|
// and the country name and dial code
|
|
27093
26987
|
tmp += "<span class='iti__country-name'>".concat(c.name, "</span>");
|
|
27094
26988
|
tmp += "<span class='iti__dial-code'>+".concat(c.dialCode, "</span>");
|
|
@@ -27109,7 +27003,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27109
27003
|
var val = useAttribute ? attributeValue : inputValue;
|
|
27110
27004
|
var dialCode = this._getDialCode(val);
|
|
27111
27005
|
var isRegionlessNanp = this._isRegionlessNanp(val);
|
|
27112
|
-
var _this$
|
|
27006
|
+
var _this$options = this.options, initialCountry = _this$options.initialCountry, nationalMode = _this$options.nationalMode, autoHideDialCode = _this$options.autoHideDialCode, separateDialCode = _this$options.separateDialCode;
|
|
27113
27007
|
// if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
|
|
27114
27008
|
// flag, else fall back to the default country
|
|
27115
27009
|
if (dialCode && !isRegionlessNanp) {
|
|
@@ -27130,30 +27024,22 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27130
27024
|
}
|
|
27131
27025
|
}
|
|
27132
27026
|
}
|
|
27133
|
-
// if empty and
|
|
27134
|
-
if (!val &&
|
|
27027
|
+
// if empty and no nationalMode and no autoHideDialCode then insert the default dial code
|
|
27028
|
+
if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) {
|
|
27135
27029
|
this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
|
|
27136
27030
|
}
|
|
27137
27031
|
}
|
|
27138
27032
|
// NOTE: if initialCountry is set to auto, that will be handled separately
|
|
27139
27033
|
// format - note this wont be run after _updateDialCode as that's only called if no val
|
|
27140
|
-
if (val)
|
|
27141
|
-
this._updateValFromNumber(val);
|
|
27142
|
-
}
|
|
27034
|
+
if (val) this._updateValFromNumber(val);
|
|
27143
27035
|
}
|
|
27144
27036
|
}, {
|
|
27145
27037
|
key: "_initListeners",
|
|
27146
27038
|
value: function _initListeners() {
|
|
27147
27039
|
this._initKeyListeners();
|
|
27148
|
-
if (this.options.
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
if (this.options.allowDropdown) {
|
|
27152
|
-
this._initDropdownListeners();
|
|
27153
|
-
}
|
|
27154
|
-
if (this.hiddenInput) {
|
|
27155
|
-
this._initHiddenInputListener();
|
|
27156
|
-
}
|
|
27040
|
+
if (this.options.autoHideDialCode) this._initBlurListeners();
|
|
27041
|
+
if (this.options.allowDropdown) this._initDropdownListeners();
|
|
27042
|
+
if (this.hiddenInput) this._initHiddenInputListener();
|
|
27157
27043
|
}
|
|
27158
27044
|
}, {
|
|
27159
27045
|
key: "_initHiddenInputListener",
|
|
@@ -27162,9 +27048,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27162
27048
|
this._handleHiddenInputSubmit = function() {
|
|
27163
27049
|
_this3.hiddenInput.value = _this3.getNumber();
|
|
27164
27050
|
};
|
|
27165
|
-
if (this.telInput.form)
|
|
27166
|
-
this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
27167
|
-
}
|
|
27051
|
+
if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
27168
27052
|
}
|
|
27169
27053
|
}, {
|
|
27170
27054
|
key: "_getClosestLabel",
|
|
@@ -27184,16 +27068,10 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27184
27068
|
// close it again
|
|
27185
27069
|
this._handleLabelClick = function(e) {
|
|
27186
27070
|
// if the dropdown is closed, then focus the input, else ignore the click
|
|
27187
|
-
if (_this4.countryList.classList.contains("iti__hide"))
|
|
27188
|
-
_this4.telInput.focus();
|
|
27189
|
-
} else {
|
|
27190
|
-
e.preventDefault();
|
|
27191
|
-
}
|
|
27071
|
+
if (_this4.countryList.classList.contains("iti__hide")) _this4.telInput.focus(); else e.preventDefault();
|
|
27192
27072
|
};
|
|
27193
27073
|
var label = this._getClosestLabel();
|
|
27194
|
-
if (label)
|
|
27195
|
-
label.addEventListener("click", this._handleLabelClick);
|
|
27196
|
-
}
|
|
27074
|
+
if (label) label.addEventListener("click", this._handleLabelClick);
|
|
27197
27075
|
// toggle country dropdown on click
|
|
27198
27076
|
this._handleClickSelectedFlag = function() {
|
|
27199
27077
|
// only intercept this event if we're opening the dropdown
|
|
@@ -27215,9 +27093,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27215
27093
|
_this4._showDropdown();
|
|
27216
27094
|
}
|
|
27217
27095
|
// allow navigation from dropdown to input on TAB
|
|
27218
|
-
if (e.key === "Tab")
|
|
27219
|
-
_this4._closeDropdown();
|
|
27220
|
-
}
|
|
27096
|
+
if (e.key === "Tab") _this4._closeDropdown();
|
|
27221
27097
|
};
|
|
27222
27098
|
this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
27223
27099
|
}
|
|
@@ -27236,14 +27112,8 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27236
27112
|
window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);
|
|
27237
27113
|
});
|
|
27238
27114
|
}
|
|
27239
|
-
} else
|
|
27240
|
-
|
|
27241
|
-
}
|
|
27242
|
-
if (this.options.initialCountry === "auto") {
|
|
27243
|
-
this._loadAutoCountry();
|
|
27244
|
-
} else {
|
|
27245
|
-
this.resolveAutoCountryPromise();
|
|
27246
|
-
}
|
|
27115
|
+
} else this.resolveUtilsScriptPromise();
|
|
27116
|
+
if (this.options.initialCountry === "auto") this._loadAutoCountry(); else this.resolveAutoCountryPromise();
|
|
27247
27117
|
}
|
|
27248
27118
|
}, {
|
|
27249
27119
|
key: "_loadAutoCountry",
|
|
@@ -27308,9 +27178,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27308
27178
|
this._handleSubmitOrBlurEvent = function() {
|
|
27309
27179
|
_this7._removeEmptyDialCode();
|
|
27310
27180
|
};
|
|
27311
|
-
if (this.telInput.form)
|
|
27312
|
-
this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
|
|
27313
|
-
}
|
|
27181
|
+
if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
|
|
27314
27182
|
this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
|
|
27315
27183
|
}
|
|
27316
27184
|
}, {
|
|
@@ -27358,11 +27226,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27358
27226
|
}, {
|
|
27359
27227
|
key: "_toggleClass",
|
|
27360
27228
|
value: function _toggleClass(el, className, shouldHaveClass) {
|
|
27361
|
-
if (shouldHaveClass && !el.classList.contains(className))
|
|
27362
|
-
el.classList.add(className);
|
|
27363
|
-
} else if (!shouldHaveClass && el.classList.contains(className)) {
|
|
27364
|
-
el.classList.remove(className);
|
|
27365
|
-
}
|
|
27229
|
+
if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className); else if (!shouldHaveClass && el.classList.contains(className)) el.classList.remove(className);
|
|
27366
27230
|
}
|
|
27367
27231
|
}, {
|
|
27368
27232
|
key: "_setDropdownPosition",
|
|
@@ -27418,17 +27282,13 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27418
27282
|
this._handleMouseoverCountryList = function(e) {
|
|
27419
27283
|
// handle event delegation, as we're listening for this event on the countryList
|
|
27420
27284
|
var listItem = _this9._getClosestListItem(e.target);
|
|
27421
|
-
if (listItem)
|
|
27422
|
-
_this9._highlightListItem(listItem, false);
|
|
27423
|
-
}
|
|
27285
|
+
if (listItem) _this9._highlightListItem(listItem, false);
|
|
27424
27286
|
};
|
|
27425
27287
|
this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
|
|
27426
27288
|
// listen for country selection
|
|
27427
27289
|
this._handleClickCountryList = function(e) {
|
|
27428
27290
|
var listItem = _this9._getClosestListItem(e.target);
|
|
27429
|
-
if (listItem)
|
|
27430
|
-
_this9._selectListItem(listItem);
|
|
27431
|
-
}
|
|
27291
|
+
if (listItem) _this9._selectListItem(listItem);
|
|
27432
27292
|
};
|
|
27433
27293
|
this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
27434
27294
|
// click off to close
|
|
@@ -27436,9 +27296,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27436
27296
|
// we cannot just stopPropagation as it may be needed to close another instance
|
|
27437
27297
|
var isOpening = true;
|
|
27438
27298
|
this._handleClickOffToClose = function() {
|
|
27439
|
-
if (!isOpening)
|
|
27440
|
-
_this9._closeDropdown();
|
|
27441
|
-
}
|
|
27299
|
+
if (!isOpening) _this9._closeDropdown();
|
|
27442
27300
|
isOpening = false;
|
|
27443
27301
|
};
|
|
27444
27302
|
document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
@@ -27453,17 +27311,9 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27453
27311
|
// and enter key from submitting a form etc
|
|
27454
27312
|
e.preventDefault();
|
|
27455
27313
|
// up and down to navigate
|
|
27456
|
-
if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") {
|
|
27457
|
-
_this9._handleUpDownKey(e.key);
|
|
27458
|
-
} else if (e.key === "Enter") {
|
|
27459
|
-
_this9._handleEnterKey();
|
|
27460
|
-
} else if (e.key === "Escape") {
|
|
27461
|
-
_this9._closeDropdown();
|
|
27462
|
-
} else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
|
|
27314
|
+
if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") _this9._handleUpDownKey(e.key); else if (e.key === "Enter") _this9._handleEnterKey(); else if (e.key === "Escape") _this9._closeDropdown(); else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
|
|
27463
27315
|
// jump to countries that start with the query string
|
|
27464
|
-
if (queryTimer)
|
|
27465
|
-
clearTimeout(queryTimer);
|
|
27466
|
-
}
|
|
27316
|
+
if (queryTimer) clearTimeout(queryTimer);
|
|
27467
27317
|
query += e.key.toLowerCase();
|
|
27468
27318
|
_this9._searchForCountry(query);
|
|
27469
27319
|
// if the timer hits 1 second, reset the query
|
|
@@ -27489,9 +27339,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27489
27339
|
}, {
|
|
27490
27340
|
key: "_handleEnterKey",
|
|
27491
27341
|
value: function _handleEnterKey() {
|
|
27492
|
-
if (this.highlightedItem)
|
|
27493
|
-
this._selectListItem(this.highlightedItem);
|
|
27494
|
-
}
|
|
27342
|
+
if (this.highlightedItem) this._selectListItem(this.highlightedItem);
|
|
27495
27343
|
}
|
|
27496
27344
|
}, {
|
|
27497
27345
|
key: "_searchForCountry",
|
|
@@ -27516,7 +27364,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27516
27364
|
value: function _updateValFromNumber(originalNumber) {
|
|
27517
27365
|
var number = originalNumber;
|
|
27518
27366
|
if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
|
|
27519
|
-
var useNational = this.options.nationalMode || number.charAt(0) !== "+"
|
|
27367
|
+
var useNational = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) !== "+");
|
|
27520
27368
|
var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
|
|
27521
27369
|
var format = useNational ? NATIONAL : INTERNATIONAL;
|
|
27522
27370
|
number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
|
|
@@ -27527,7 +27375,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27527
27375
|
}, {
|
|
27528
27376
|
key: "_updateFlagFromNumber",
|
|
27529
27377
|
value: function _updateFlagFromNumber(originalNumber) {
|
|
27530
|
-
// if we already have US/Canada selected, make sure the number starts
|
|
27378
|
+
// if we're in nationalMode and we already have US/Canada selected, make sure the number starts
|
|
27531
27379
|
// with a +1 so _getDialCode will be able to extract the area code
|
|
27532
27380
|
// update: if we dont yet have selectedCountryData, but we're here (trying to update the flag
|
|
27533
27381
|
// from the number), that means we're initialising the plugin with a number that already has a
|
|
@@ -27535,13 +27383,11 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27535
27383
|
var number = originalNumber;
|
|
27536
27384
|
var selectedDialCode = this.selectedCountryData.dialCode;
|
|
27537
27385
|
var isNanp = selectedDialCode === "1";
|
|
27538
|
-
if (number && isNanp && number.charAt(0) !== "+") {
|
|
27539
|
-
if (number.charAt(0) !== "1")
|
|
27540
|
-
number = "1".concat(number);
|
|
27541
|
-
}
|
|
27386
|
+
if (number && this.options.nationalMode && isNanp && number.charAt(0) !== "+") {
|
|
27387
|
+
if (number.charAt(0) !== "1") number = "1".concat(number);
|
|
27542
27388
|
number = "+".concat(number);
|
|
27543
27389
|
}
|
|
27544
|
-
//
|
|
27390
|
+
// update flag if user types area code for another country
|
|
27545
27391
|
if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") {
|
|
27546
27392
|
number = "+".concat(selectedDialCode).concat(number);
|
|
27547
27393
|
}
|
|
@@ -27599,15 +27445,10 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27599
27445
|
key: "_highlightListItem",
|
|
27600
27446
|
value: function _highlightListItem(listItem, shouldFocus) {
|
|
27601
27447
|
var prevItem = this.highlightedItem;
|
|
27602
|
-
if (prevItem)
|
|
27603
|
-
prevItem.classList.remove("iti__highlight");
|
|
27604
|
-
}
|
|
27448
|
+
if (prevItem) prevItem.classList.remove("iti__highlight");
|
|
27605
27449
|
this.highlightedItem = listItem;
|
|
27606
27450
|
this.highlightedItem.classList.add("iti__highlight");
|
|
27607
|
-
this.
|
|
27608
|
-
if (shouldFocus) {
|
|
27609
|
-
this.highlightedItem.focus();
|
|
27610
|
-
}
|
|
27451
|
+
if (shouldFocus) this.highlightedItem.focus();
|
|
27611
27452
|
}
|
|
27612
27453
|
}, {
|
|
27613
27454
|
key: "_getCountryData",
|
|
@@ -27626,7 +27467,6 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27626
27467
|
}, {
|
|
27627
27468
|
key: "_setFlag",
|
|
27628
27469
|
value: function _setFlag(countryCode) {
|
|
27629
|
-
var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags;
|
|
27630
27470
|
var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
27631
27471
|
// do this first as it will throw an error and stop if countryCode is invalid
|
|
27632
27472
|
this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
|
|
@@ -27634,26 +27474,22 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27634
27474
|
if (this.selectedCountryData.iso2) {
|
|
27635
27475
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
27636
27476
|
}
|
|
27637
|
-
|
|
27638
|
-
|
|
27639
|
-
|
|
27640
|
-
this.
|
|
27641
|
-
if (separateDialCode) {
|
|
27477
|
+
this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
|
|
27478
|
+
// update the selected country's title attribute
|
|
27479
|
+
var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown";
|
|
27480
|
+
this.selectedFlag.setAttribute("title", title);
|
|
27481
|
+
if (this.options.separateDialCode) {
|
|
27642
27482
|
var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
|
|
27643
27483
|
this.selectedDialCode.innerHTML = dialCode;
|
|
27644
27484
|
// offsetWidth is zero if input is in a hidden container during initialisation
|
|
27645
27485
|
var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
|
|
27646
27486
|
// add 6px of padding after the grey selected-dial-code box, as this is what we use in the css
|
|
27647
|
-
|
|
27648
|
-
this.telInput.style.paddingRight = "".concat(selectedFlagWidth + 6, "px");
|
|
27649
|
-
} else {
|
|
27650
|
-
this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
|
|
27651
|
-
}
|
|
27487
|
+
this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
|
|
27652
27488
|
}
|
|
27653
27489
|
// and the input's placeholder
|
|
27654
27490
|
this._updatePlaceholder();
|
|
27655
27491
|
// update the active list item
|
|
27656
|
-
if (allowDropdown) {
|
|
27492
|
+
if (this.options.allowDropdown) {
|
|
27657
27493
|
var prevItem = this.activeItem;
|
|
27658
27494
|
if (prevItem) {
|
|
27659
27495
|
prevItem.classList.remove("iti__active");
|
|
@@ -27665,29 +27501,12 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27665
27501
|
nextItem.setAttribute("aria-selected", "true");
|
|
27666
27502
|
nextItem.classList.add("iti__active");
|
|
27667
27503
|
this.activeItem = nextItem;
|
|
27504
|
+
this.selectedFlag.setAttribute("aria-activedescendant", nextItem.getAttribute("id"));
|
|
27668
27505
|
}
|
|
27669
27506
|
}
|
|
27670
27507
|
// return if the flag has changed or not
|
|
27671
27508
|
return prevCountry.iso2 !== countryCode;
|
|
27672
27509
|
}
|
|
27673
|
-
}, {
|
|
27674
|
-
key: "_setSelectedCountryFlagTitleAttribute",
|
|
27675
|
-
value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) {
|
|
27676
|
-
if (!this.selectedFlag) {
|
|
27677
|
-
return;
|
|
27678
|
-
}
|
|
27679
|
-
var title;
|
|
27680
|
-
if (countryCode && !separateDialCode) {
|
|
27681
|
-
title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode);
|
|
27682
|
-
} else if (countryCode) {
|
|
27683
|
-
// For screen reader output, we don't want to include the dial code in the reader output twice
|
|
27684
|
-
// so just use the selected country name here:
|
|
27685
|
-
title = this.selectedCountryData.name;
|
|
27686
|
-
} else {
|
|
27687
|
-
title = "Unknown";
|
|
27688
|
-
}
|
|
27689
|
-
this.selectedFlag.setAttribute("title", title);
|
|
27690
|
-
}
|
|
27691
27510
|
}, {
|
|
27692
27511
|
key: "_getHiddenSelectedFlagWidth",
|
|
27693
27512
|
value: function _getHiddenSelectedFlagWidth() {
|
|
@@ -27724,11 +27543,11 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27724
27543
|
// update selected flag and active list item
|
|
27725
27544
|
var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
|
|
27726
27545
|
this._closeDropdown();
|
|
27727
|
-
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
27546
|
+
this._updateDialCode(listItem.getAttribute("data-dial-code"), true);
|
|
27728
27547
|
// focus the input
|
|
27729
27548
|
this.telInput.focus();
|
|
27730
|
-
// put cursor at end - this fix is required for FF and IE11 (with
|
|
27731
|
-
// who try to put the cursor at the beginning the first time
|
|
27549
|
+
// put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto
|
|
27550
|
+
// inserting dial code), who try to put the cursor at the beginning the first time
|
|
27732
27551
|
var len = this.telInput.value.length;
|
|
27733
27552
|
this.telInput.setSelectionRange(len, len);
|
|
27734
27553
|
if (flagChanged) {
|
|
@@ -27740,7 +27559,6 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27740
27559
|
value: function _closeDropdown() {
|
|
27741
27560
|
this.countryList.classList.add("iti__hide");
|
|
27742
27561
|
this.selectedFlag.setAttribute("aria-expanded", "false");
|
|
27743
|
-
this.selectedFlag.removeAttribute("aria-activedescendant");
|
|
27744
27562
|
// update the arrow
|
|
27745
27563
|
this.dropdownArrow.classList.remove("iti__arrow--up");
|
|
27746
27564
|
// unbind key events
|
|
@@ -27750,12 +27568,8 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27750
27568
|
this.countryList.removeEventListener("click", this._handleClickCountryList);
|
|
27751
27569
|
// remove menu from container
|
|
27752
27570
|
if (this.options.dropdownContainer) {
|
|
27753
|
-
if (!this.isMobile)
|
|
27754
|
-
|
|
27755
|
-
}
|
|
27756
|
-
if (this.dropdown.parentNode) {
|
|
27757
|
-
this.dropdown.parentNode.removeChild(this.dropdown);
|
|
27758
|
-
}
|
|
27571
|
+
if (!this.isMobile) window.removeEventListener("scroll", this._handleWindowScroll);
|
|
27572
|
+
if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown);
|
|
27759
27573
|
}
|
|
27760
27574
|
this._trigger("close:countrydropdown");
|
|
27761
27575
|
}
|
|
@@ -27775,28 +27589,24 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27775
27589
|
var middleOffset = containerHeight / 2 - elementHeight / 2;
|
|
27776
27590
|
if (elementTop < containerTop) {
|
|
27777
27591
|
// scroll up
|
|
27778
|
-
if (middle)
|
|
27779
|
-
newScrollTop -= middleOffset;
|
|
27780
|
-
}
|
|
27592
|
+
if (middle) newScrollTop -= middleOffset;
|
|
27781
27593
|
container.scrollTop = newScrollTop;
|
|
27782
27594
|
} else if (elementBottom > containerBottom) {
|
|
27783
27595
|
// scroll down
|
|
27784
|
-
if (middle)
|
|
27785
|
-
newScrollTop += middleOffset;
|
|
27786
|
-
}
|
|
27596
|
+
if (middle) newScrollTop += middleOffset;
|
|
27787
27597
|
var heightDifference = containerHeight - elementHeight;
|
|
27788
27598
|
container.scrollTop = newScrollTop - heightDifference;
|
|
27789
27599
|
}
|
|
27790
27600
|
}
|
|
27791
27601
|
}, {
|
|
27792
27602
|
key: "_updateDialCode",
|
|
27793
|
-
value: function _updateDialCode(newDialCodeBare) {
|
|
27603
|
+
value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) {
|
|
27794
27604
|
var inputVal = this.telInput.value;
|
|
27795
27605
|
// save having to pass this every time
|
|
27796
27606
|
var newDialCode = "+".concat(newDialCodeBare);
|
|
27797
27607
|
var newNumber;
|
|
27798
27608
|
if (inputVal.charAt(0) === "+") {
|
|
27799
|
-
// there's a plus so we're dealing with a replacement
|
|
27609
|
+
// there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)
|
|
27800
27610
|
var prevDialCode = this._getDialCode(inputVal);
|
|
27801
27611
|
if (prevDialCode) {
|
|
27802
27612
|
// current number contains a valid dial code, so replace it
|
|
@@ -27806,16 +27616,23 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27806
27616
|
// (no way to determine where the invalid dial code ends and the rest of the number begins)
|
|
27807
27617
|
newNumber = newDialCode;
|
|
27808
27618
|
}
|
|
27809
|
-
|
|
27810
|
-
|
|
27619
|
+
} else if (this.options.nationalMode || this.options.separateDialCode) {
|
|
27620
|
+
// don't do anything
|
|
27621
|
+
return;
|
|
27622
|
+
} else {
|
|
27623
|
+
// nationalMode is disabled
|
|
27811
27624
|
if (inputVal) {
|
|
27812
27625
|
// there is an existing value with no dial code: prefix the new dial code
|
|
27813
27626
|
newNumber = newDialCode + inputVal;
|
|
27814
|
-
} else {
|
|
27627
|
+
} else if (hasSelectedListItem || !this.options.autoHideDialCode) {
|
|
27628
|
+
// no existing value and either they've just selected a list item, or autoHideDialCode is
|
|
27629
|
+
// disabled: insert new dial code
|
|
27815
27630
|
newNumber = newDialCode;
|
|
27631
|
+
} else {
|
|
27632
|
+
return;
|
|
27816
27633
|
}
|
|
27817
|
-
this.telInput.value = newNumber;
|
|
27818
27634
|
}
|
|
27635
|
+
this.telInput.value = newNumber;
|
|
27819
27636
|
}
|
|
27820
27637
|
}, {
|
|
27821
27638
|
key: "_getDialCode",
|
|
@@ -27930,19 +27747,13 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
27930
27747
|
this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
27931
27748
|
// label click hack
|
|
27932
27749
|
var label = this._getClosestLabel();
|
|
27933
|
-
if (label)
|
|
27934
|
-
label.removeEventListener("click", this._handleLabelClick);
|
|
27935
|
-
}
|
|
27750
|
+
if (label) label.removeEventListener("click", this._handleLabelClick);
|
|
27936
27751
|
}
|
|
27937
27752
|
// unbind hiddenInput listeners
|
|
27938
|
-
if (this.hiddenInput && form)
|
|
27939
|
-
|
|
27940
|
-
|
|
27941
|
-
|
|
27942
|
-
if (this.options.autoInsertDialCode) {
|
|
27943
|
-
if (form) {
|
|
27944
|
-
form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
|
|
27945
|
-
}
|
|
27753
|
+
if (this.hiddenInput && form) form.removeEventListener("submit", this._handleHiddenInputSubmit);
|
|
27754
|
+
// unbind autoHideDialCode listeners
|
|
27755
|
+
if (this.options.autoHideDialCode) {
|
|
27756
|
+
if (form) form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
|
|
27946
27757
|
this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
|
|
27947
27758
|
}
|
|
27948
27759
|
// unbind key events, and cut/paste events
|
|
@@ -28000,22 +27811,17 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
28000
27811
|
key: "isValidNumber",
|
|
28001
27812
|
value: function isValidNumber() {
|
|
28002
27813
|
var val = this._getFullNumber().trim();
|
|
28003
|
-
|
|
28004
|
-
|
|
28005
|
-
}, {
|
|
28006
|
-
key: "isPossibleNumber",
|
|
28007
|
-
value: function isPossibleNumber() {
|
|
28008
|
-
var val = this._getFullNumber().trim();
|
|
28009
|
-
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
|
|
27814
|
+
var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
|
|
27815
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;
|
|
28010
27816
|
}
|
|
28011
27817
|
}, {
|
|
28012
27818
|
key: "setCountry",
|
|
28013
27819
|
value: function setCountry(originalCountryCode) {
|
|
28014
27820
|
var countryCode = originalCountryCode.toLowerCase();
|
|
28015
27821
|
// check if already selected
|
|
28016
|
-
if (this.
|
|
27822
|
+
if (!this.selectedFlagInner.classList.contains("iti__".concat(countryCode))) {
|
|
28017
27823
|
this._setFlag(countryCode);
|
|
28018
|
-
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
27824
|
+
this._updateDialCode(this.selectedCountryData.dialCode, false);
|
|
28019
27825
|
this._triggerCountryChange();
|
|
28020
27826
|
}
|
|
28021
27827
|
}
|
|
@@ -28052,15 +27858,11 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
28052
27858
|
var script = document.createElement("script");
|
|
28053
27859
|
script.onload = function() {
|
|
28054
27860
|
forEachInstance("handleUtils");
|
|
28055
|
-
if (handleSuccess)
|
|
28056
|
-
handleSuccess();
|
|
28057
|
-
}
|
|
27861
|
+
if (handleSuccess) handleSuccess();
|
|
28058
27862
|
};
|
|
28059
27863
|
script.onerror = function() {
|
|
28060
27864
|
forEachInstance("rejectUtilsScriptPromise");
|
|
28061
|
-
if (handleFailure)
|
|
28062
|
-
handleFailure();
|
|
28063
|
-
}
|
|
27865
|
+
if (handleFailure) handleFailure();
|
|
28064
27866
|
};
|
|
28065
27867
|
script.className = "iti-load-utils";
|
|
28066
27868
|
script.async = true;
|
|
@@ -28089,7 +27891,7 @@ var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
|
28089
27891
|
// default options
|
|
28090
27892
|
intlTelInputGlobals.defaults = defaults;
|
|
28091
27893
|
// version
|
|
28092
|
-
intlTelInputGlobals.version = "
|
|
27894
|
+
intlTelInputGlobals.version = "17.0.13";
|
|
28093
27895
|
// convenience wrapper
|
|
28094
27896
|
return function(input, options) {
|
|
28095
27897
|
var iti = new Iti(input, options);
|