intl-tel-input 19.5.5 → 19.5.7
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/README.md +20 -14
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +18 -12
- package/build/js/intlTelInput-jquery.min.js +3 -3
- package/build/js/intlTelInput.js +18 -12
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/utils.js +28 -28
- package/composer.json +1 -1
- package/package.json +1 -1
- package/react/build/IntlTelInput.cjs.js +2 -2
- package/react/build/IntlTelInput.cjs.js.map +3 -3
- package/react/build/IntlTelInput.esm.js +2 -2
- package/react/build/IntlTelInput.esm.js.map +3 -3
- package/react/demo/simple-bundle.js +52 -50
- package/react/demo/validation-bundle.js +52 -50
- package/src/js/intlTelInput.js +23 -16
- package/src/js/utils.js +8 -1
|
@@ -24297,22 +24297,22 @@ var et = Object.getOwnPropertyNames;
|
|
|
24297
24297
|
var it = Object.getPrototypeOf;
|
|
24298
24298
|
var nt = Object.prototype.hasOwnProperty;
|
|
24299
24299
|
var ot = (c, p) => () => (p || c((p = { exports: {} }).exports, p), p.exports);
|
|
24300
|
-
var rt = (c, p,
|
|
24300
|
+
var rt = (c, p, y, m) => {
|
|
24301
24301
|
if (p && typeof p == "object" || typeof p == "function")
|
|
24302
24302
|
for (let _ of et(p))
|
|
24303
|
-
!nt.call(c, _) && _ !==
|
|
24303
|
+
!nt.call(c, _) && _ !== y && V(c, _, { get: () => p[_], enumerable: !(m = tt(p, _)) || m.enumerable });
|
|
24304
24304
|
return c;
|
|
24305
24305
|
};
|
|
24306
|
-
var at = (c, p,
|
|
24306
|
+
var at = (c, p, y) => (y = c != null ? X(it(c)) : {}, rt(p || !c || !c.__esModule ? V(y, "default", { value: c, enumerable: true }) : y, c));
|
|
24307
24307
|
var H = ot((dt, N) => {
|
|
24308
24308
|
(function(c) {
|
|
24309
24309
|
typeof N == "object" && N.exports ? N.exports = c() : window.intlTelInput = c();
|
|
24310
24310
|
})(function(c) {
|
|
24311
24311
|
"use strict";
|
|
24312
24312
|
return function() {
|
|
24313
|
-
for (var p = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua & Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria", "at", "43"], ["Azerbaijan", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus", "by", "375"], ["Belgium", "be", "32"], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia & Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "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", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "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 - Brazzaville", "cg", "242"], ["Congo - Kinshasa", "cd", "243"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus", "cy", "357"], ["Czech Republic", "cz", "420"], ["Denmark", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands", "fk", "500"], ["Faroe Islands", "fo", "298"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49"], ["Ghana", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece", "gr", "30"], ["Greenland", "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", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852"], ["Hungary", "hu", "36"], ["Iceland", "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", "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", "lv", "371"], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Madagascar", "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", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco", "ma", "212", 0], ["Mozambique", "mz", "258"], ["Myanmar (Burma)", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31"], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea", "kp", "850"], ["North Macedonia", "mk", "389"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway", "no", "47", 0], ["Oman", "om", "968"], ["Pakistan", "pk", "92"], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63"], ["Poland", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["R\xE9union", "re", "262", 0], ["Romania", "ro", "40"], ["Russia", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 & Pr\xEDncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82"], ["South Sudan", "ss", "211"], ["Spain", "es", "34"], ["Sri Lanka", "lk", "94"], ["St Barth\xE9lemy", "bl", "590", 1], ["St Helena", "sh", "290"], ["St Kitts & Nevis", "kn", "1", 18, ["869"]], ["St Lucia", "lc", "1", 19, ["758"]], ["St Martin", "mf", "590", 2], ["St Pierre & Miquelon", "pm", "508"], ["St Vincent & Grenadines", "vc", "1", 20, ["784"]], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard & Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden", "se", "46"], ["Switzerland", "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 & Tobago", "tt", "1", 22, ["868"]], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks & Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380"], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["US Virgin Islands", "vi", "1", 24, ["340"]], ["Uzbekistan", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Wallis & Futuna", "wf", "681"], ["Western Sahara", "eh", "212", 1, ["5288", "5289"]], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]],
|
|
24314
|
-
var m = p[
|
|
24315
|
-
p[
|
|
24313
|
+
for (var p = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua & Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria", "at", "43"], ["Azerbaijan", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus", "by", "375"], ["Belgium", "be", "32"], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia & Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "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", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "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 - Brazzaville", "cg", "242"], ["Congo - Kinshasa", "cd", "243"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus", "cy", "357"], ["Czech Republic", "cz", "420"], ["Denmark", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands", "fk", "500"], ["Faroe Islands", "fo", "298"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49"], ["Ghana", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece", "gr", "30"], ["Greenland", "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", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852"], ["Hungary", "hu", "36"], ["Iceland", "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", "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", "lv", "371"], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Madagascar", "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", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco", "ma", "212", 0], ["Mozambique", "mz", "258"], ["Myanmar (Burma)", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31"], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea", "kp", "850"], ["North Macedonia", "mk", "389"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway", "no", "47", 0], ["Oman", "om", "968"], ["Pakistan", "pk", "92"], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63"], ["Poland", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["R\xE9union", "re", "262", 0], ["Romania", "ro", "40"], ["Russia", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 & Pr\xEDncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82"], ["South Sudan", "ss", "211"], ["Spain", "es", "34"], ["Sri Lanka", "lk", "94"], ["St Barth\xE9lemy", "bl", "590", 1], ["St Helena", "sh", "290"], ["St Kitts & Nevis", "kn", "1", 18, ["869"]], ["St Lucia", "lc", "1", 19, ["758"]], ["St Martin", "mf", "590", 2], ["St Pierre & Miquelon", "pm", "508"], ["St Vincent & Grenadines", "vc", "1", 20, ["784"]], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard & Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden", "se", "46"], ["Switzerland", "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 & Tobago", "tt", "1", 22, ["868"]], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks & Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380"], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["US Virgin Islands", "vi", "1", 24, ["340"]], ["Uzbekistan", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Wallis & Futuna", "wf", "681"], ["Western Sahara", "eh", "212", 1, ["5288", "5289"]], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]], y = 0; y < p.length; y++) {
|
|
24314
|
+
var m = p[y];
|
|
24315
|
+
p[y] = { name: m[0], iso2: m[1], dialCode: m[2], priority: m[3] || 0, areaCodes: m[4] || null, nodeById: {} };
|
|
24316
24316
|
}
|
|
24317
24317
|
function _(a) {
|
|
24318
24318
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -24423,7 +24423,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24423
24423
|
Object.values(t).forEach(function(e) {
|
|
24424
24424
|
return e[n]();
|
|
24425
24425
|
});
|
|
24426
|
-
},
|
|
24426
|
+
}, $ = function() {
|
|
24427
24427
|
function a(n) {
|
|
24428
24428
|
var t = arguments.length > 1 && arguments[1] !== c ? arguments[1] : {};
|
|
24429
24429
|
C(this, a), this.id = Y++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, K, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
|
|
@@ -24508,17 +24508,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24508
24508
|
}), i && i.appendChild(o), o;
|
|
24509
24509
|
} }, { key: "_generateMarkup", value: function() {
|
|
24510
24510
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
24511
|
-
var t = this.options, e = t.allowDropdown, i = t.showSelectedDialCode, o = t.showFlags, r = t.containerClass, s = t.hiddenInput, l = t.dropdownContainer, u = t.fixDropdownWidth, h = t.useFullscreenPopup,
|
|
24512
|
-
e && (
|
|
24513
|
-
var
|
|
24514
|
-
this.telInput.parentNode.insertBefore(
|
|
24511
|
+
var t = this.options, e = t.allowDropdown, i = t.showSelectedDialCode, o = t.showFlags, r = t.containerClass, s = t.hiddenInput, l = t.dropdownContainer, u = t.fixDropdownWidth, h = t.useFullscreenPopup, g = t.countrySearch, f = "iti";
|
|
24512
|
+
e && (f += " iti--allow-dropdown"), i && (f += " iti--show-selected-dial-code"), o && (f += " iti--show-flags"), r && (f += " ".concat(r)), h || (f += " iti--inline-dropdown");
|
|
24513
|
+
var v = this._createEl("div", { class: f });
|
|
24514
|
+
this.telInput.parentNode.insertBefore(v, this.telInput);
|
|
24515
24515
|
var I = e || o || i;
|
|
24516
|
-
if (I && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" },
|
|
24516
|
+
if (I && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, v)), v.appendChild(this.telInput), I && (this.selectedFlag = this._createEl("div", _({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
|
|
24517
24517
|
this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
|
|
24518
|
-
var
|
|
24519
|
-
if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(
|
|
24518
|
+
var Z = u ? "" : "iti--flexible-dropdown-width";
|
|
24519
|
+
if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(Z) }), g && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !g && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
|
|
24520
24520
|
var F = "iti iti--container";
|
|
24521
|
-
h ? F += " iti--fullscreen-popup" : F += " iti--inline-dropdown",
|
|
24521
|
+
h ? F += " iti--fullscreen-popup" : F += " iti--inline-dropdown", g && (F += " iti--country-search"), this.dropdown = this._createEl("div", { class: F }), this.dropdown.appendChild(this.dropdownContent);
|
|
24522
24522
|
} else
|
|
24523
24523
|
this.flagsContainer.appendChild(this.dropdownContent);
|
|
24524
24524
|
}
|
|
@@ -24526,7 +24526,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24526
24526
|
var j = this.telInput.getAttribute("name"), T = s(j), Q = T !== null && typeof T == "object", L, G;
|
|
24527
24527
|
if (Q ? (L = T.phone || j, G = T.country || "".concat(L, "_country")) : (L = T || j, G = "".concat(L, "_country")), !L)
|
|
24528
24528
|
return;
|
|
24529
|
-
this.hiddenInput = this._createEl("input", { type: "hidden", name: L }), this.hiddenInputCountry = this._createEl("input", { type: "hidden", name: G }),
|
|
24529
|
+
this.hiddenInput = this._createEl("input", { type: "hidden", name: L }), this.hiddenInputCountry = this._createEl("input", { type: "hidden", name: G }), v.appendChild(this.hiddenInput), v.appendChild(this.hiddenInputCountry);
|
|
24530
24530
|
}
|
|
24531
24531
|
} }, { key: "_appendListItems", value: function(t, e, i) {
|
|
24532
24532
|
for (var o = 0; o < t.length; o++) {
|
|
@@ -24536,12 +24536,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24536
24536
|
this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
|
|
24537
24537
|
}
|
|
24538
24538
|
} }, { key: "_setInitialState", value: function() {
|
|
24539
|
-
var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, s = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry,
|
|
24539
|
+
var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, s = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry, g = u.autoInsertDialCode, f = u.defaultToFirstCountry;
|
|
24540
24540
|
if (s && !l)
|
|
24541
24541
|
this._updateFlagFromNumber(r);
|
|
24542
24542
|
else if (h !== "auto" || t) {
|
|
24543
|
-
var
|
|
24544
|
-
I ? this._setFlag(
|
|
24543
|
+
var v = h ? h.toLowerCase() : "", I = v && this._getCountryData(v, true);
|
|
24544
|
+
I ? this._setFlag(v) : s && l ? this._setFlag("us") : f && !r ? (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, this._setFlag(this.defaultCountry)) : this._setFlag(), !r && g && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
|
|
24545
24545
|
}
|
|
24546
24546
|
r && this._updateValFromNumber(r);
|
|
24547
24547
|
} }, { key: "_initListeners", value: function() {
|
|
@@ -24581,9 +24581,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24581
24581
|
} }, { key: "_initKeyListeners", value: function() {
|
|
24582
24582
|
var t = this, e = false;
|
|
24583
24583
|
this._handleKeyEvent = function(i) {
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24584
|
+
t._updateFlagFromNumber(t.telInput.value) && t._triggerCountryChange();
|
|
24585
|
+
var o = i && i.data && /[^+0-9]/.test(i.data), r = i && i.inputType === "insertFromPaste" && t.telInput.value;
|
|
24586
|
+
if (o || r ? e = true : /[^+0-9]/.test(t.telInput.value) || (e = false), t.options.formatAsYouType && !e && i.inputType !== "insertFromPaste") {
|
|
24587
|
+
var s = t.telInput.selectionStart, l = t.telInput.value.substring(0, s), u = l.replace(/[^+0-9]/g, "").length, h = i && i.inputType === "deleteContentForward", g = t._formatNumberAsYouType(), f = t._translateCursorPosition(u, g, s, h);
|
|
24588
|
+
t.telInput.value = g, t.telInput.setSelectionRange(f, f);
|
|
24587
24589
|
}
|
|
24588
24590
|
}, this.telInput.addEventListener("input", this._handleKeyEvent), this._handleClipboardEvent = function() {
|
|
24589
24591
|
setTimeout(t._handleKeyEvent);
|
|
@@ -24706,11 +24708,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24706
24708
|
i && r && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = "1".concat(i)), i = "+".concat(i)), this.options.showSelectedDialCode && o && i.charAt(0) !== "+" && (i = "+".concat(o).concat(i));
|
|
24707
24709
|
var s = this._getDialCode(i, true), l = this._getNumeric(i), u = null;
|
|
24708
24710
|
if (s) {
|
|
24709
|
-
var h = this.dialCodeToIso2Map[this._getNumeric(s)],
|
|
24710
|
-
if (!
|
|
24711
|
-
for (var
|
|
24712
|
-
if (h[
|
|
24713
|
-
u = h[
|
|
24711
|
+
var h = this.dialCodeToIso2Map[this._getNumeric(s)], g = h.indexOf(this.selectedCountryData.iso2) !== -1 && l.length <= s.length - 1, f = o === "1" && this._isRegionlessNanp(l);
|
|
24712
|
+
if (!f && !g) {
|
|
24713
|
+
for (var v = 0; v < h.length; v++)
|
|
24714
|
+
if (h[v]) {
|
|
24715
|
+
u = h[v];
|
|
24714
24716
|
break;
|
|
24715
24717
|
}
|
|
24716
24718
|
}
|
|
@@ -24743,14 +24745,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24743
24745
|
if (this._setSelectedCountryFlagTitleAttribute(t, o), o) {
|
|
24744
24746
|
var h = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
|
|
24745
24747
|
this.selectedDialCode.innerHTML = h;
|
|
24746
|
-
var
|
|
24747
|
-
this.isRTL ? this.telInput.style.paddingRight = "".concat(
|
|
24748
|
+
var g = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
|
|
24749
|
+
this.isRTL ? this.telInput.style.paddingRight = "".concat(g + 6, "px") : this.telInput.style.paddingLeft = "".concat(g + 6, "px");
|
|
24748
24750
|
}
|
|
24749
24751
|
if (this._updatePlaceholder(), i && !s) {
|
|
24750
|
-
var
|
|
24751
|
-
if (
|
|
24752
|
-
var
|
|
24753
|
-
|
|
24752
|
+
var f = this.activeItem;
|
|
24753
|
+
if (f && (f.classList.remove("iti__active"), f.setAttribute("aria-selected", "false")), t) {
|
|
24754
|
+
var v = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t));
|
|
24755
|
+
v.setAttribute("aria-selected", "true"), v.classList.add("iti__active"), this.activeItem = v;
|
|
24754
24756
|
}
|
|
24755
24757
|
}
|
|
24756
24758
|
return l.iso2 !== t;
|
|
@@ -24769,10 +24771,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24769
24771
|
var o = i.offsetWidth;
|
|
24770
24772
|
return t.parentNode.removeChild(t), o;
|
|
24771
24773
|
} }, { key: "_updatePlaceholder", value: function() {
|
|
24772
|
-
var t = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder &&
|
|
24773
|
-
if (window.intlTelInputUtils &&
|
|
24774
|
-
var
|
|
24775
|
-
|
|
24774
|
+
var t = this.options, e = t.autoPlaceholder, i = t.placeholderNumberType, o = t.nationalMode, r = t.customPlaceholder, s = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
24775
|
+
if (window.intlTelInputUtils && s) {
|
|
24776
|
+
var l = intlTelInputUtils.numberType[i], u = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, o, l) : "";
|
|
24777
|
+
u = this._beforeSetNumber(u), typeof r == "function" && (u = r(u, this.selectedCountryData)), this.telInput.setAttribute("placeholder", u);
|
|
24776
24778
|
}
|
|
24777
24779
|
} }, { key: "_selectListItem", value: function(t) {
|
|
24778
24780
|
var e = this._setFlag(t.getAttribute("data-country-code"));
|
|
@@ -24780,13 +24782,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24780
24782
|
} }, { key: "_closeDropdown", value: function() {
|
|
24781
24783
|
this.dropdownContent.classList.add("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "false"), this.selectedFlag.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), document.removeEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch && this.searchInput.removeEventListener("input", this._handleSearchChange), document.documentElement.removeEventListener("click", this._handleClickOffToClose), this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
|
|
24782
24784
|
} }, { key: "_scrollTo", value: function(t, e) {
|
|
24783
|
-
var i = this.countryList, o = document.documentElement.scrollTop, r = i.offsetHeight, s = i.getBoundingClientRect().top + o, l = s + r, u = t.offsetHeight, h = t.getBoundingClientRect().top + o,
|
|
24785
|
+
var i = this.countryList, o = document.documentElement.scrollTop, r = i.offsetHeight, s = i.getBoundingClientRect().top + o, l = s + r, u = t.offsetHeight, h = t.getBoundingClientRect().top + o, g = h + u, f = h - s + i.scrollTop, v = r / 2 - u / 2;
|
|
24784
24786
|
if (h < s)
|
|
24785
|
-
e && (
|
|
24786
|
-
else if (
|
|
24787
|
-
e && (
|
|
24787
|
+
e && (f -= v), i.scrollTop = f;
|
|
24788
|
+
else if (g > l) {
|
|
24789
|
+
e && (f += v);
|
|
24788
24790
|
var I = r - u;
|
|
24789
|
-
i.scrollTop =
|
|
24791
|
+
i.scrollTop = f - I;
|
|
24790
24792
|
}
|
|
24791
24793
|
} }, { key: "_updateDialCode", value: function(t) {
|
|
24792
24794
|
var e = this.telInput.value, i = "+".concat(t), o;
|
|
@@ -24838,7 +24840,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24838
24840
|
} }, { key: "handleAutoCountry", value: function() {
|
|
24839
24841
|
this.options.initialCountry === "auto" && (this.defaultCountry = window.intlTelInputGlobals.autoCountry, this.telInput.value || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
24840
24842
|
} }, { key: "handleUtils", value: function() {
|
|
24841
|
-
window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this._updatePlaceholder()), this.resolveUtilsScriptPromise();
|
|
24843
|
+
window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && this._updatePlaceholder()), this.resolveUtilsScriptPromise();
|
|
24842
24844
|
} }, { key: "destroy", value: function() {
|
|
24843
24845
|
var t = this.telInput.form;
|
|
24844
24846
|
if (this.options.allowDropdown) {
|
|
@@ -24867,9 +24869,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24867
24869
|
return intlTelInputUtils.getValidationError(this._getFullNumber(), t);
|
|
24868
24870
|
}
|
|
24869
24871
|
return -99;
|
|
24870
|
-
} }, { key: "isValidNumber", value: function() {
|
|
24871
|
-
var
|
|
24872
|
-
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(
|
|
24872
|
+
} }, { key: "isValidNumber", value: function(t) {
|
|
24873
|
+
var e = this._getFullNumber();
|
|
24874
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(e, this.selectedCountryData.iso2, t) : null;
|
|
24873
24875
|
} }, { key: "isValidNumberPrecise", value: function() {
|
|
24874
24876
|
var t = this._getFullNumber();
|
|
24875
24877
|
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
|
|
@@ -24903,18 +24905,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24903
24905
|
z(a);
|
|
24904
24906
|
}
|
|
24905
24907
|
return null;
|
|
24906
|
-
}, S.defaults = K, S.version = "19.5.
|
|
24907
|
-
var t = new
|
|
24908
|
+
}, S.defaults = K, S.version = "19.5.7", function(a, n) {
|
|
24909
|
+
var t = new $(a, n);
|
|
24908
24910
|
return t._init(), a.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
|
|
24909
24911
|
};
|
|
24910
24912
|
}();
|
|
24911
24913
|
});
|
|
24912
24914
|
});
|
|
24913
24915
|
var q = at(H());
|
|
24914
|
-
var R = ({ initialValue: c, onChangeNumber: p, onChangeCountry:
|
|
24916
|
+
var R = ({ initialValue: c, onChangeNumber: p, onChangeCountry: y, onChangeValidity: m, onChangeErrorCode: _, initOptions: P, className: M, disabled: x, onFocus: O, onBlur: A, placeholder: U }) => {
|
|
24915
24917
|
let D = (0, import_react.useRef)(null), C = (0, import_react.useRef)(null), b = () => {
|
|
24916
24918
|
let w = C.current.getNumber(), E = C.current.getSelectedCountryData().iso2;
|
|
24917
|
-
if (p(w),
|
|
24919
|
+
if (p(w), y(E), C.current.isValidNumber())
|
|
24918
24920
|
m(true), _(null);
|
|
24919
24921
|
else {
|
|
24920
24922
|
let B = C.current.getValidationError();
|
package/src/js/intlTelInput.js
CHANGED
|
@@ -816,7 +816,9 @@ class Iti {
|
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
// if user types their own formatting char (not a plus or a numeric), then set the override
|
|
819
|
-
|
|
819
|
+
const isFormattingChar = e && e.data && /[^+0-9]/.test(e.data);
|
|
820
|
+
const isPaste = e && e.inputType === "insertFromPaste" && this.telInput.value;
|
|
821
|
+
if (isFormattingChar || isPaste) {
|
|
820
822
|
userOverrideFormatting = true;
|
|
821
823
|
}
|
|
822
824
|
// if user removes all formatting chars, then reset the override
|
|
@@ -824,7 +826,8 @@ class Iti {
|
|
|
824
826
|
userOverrideFormatting = false;
|
|
825
827
|
}
|
|
826
828
|
|
|
827
|
-
|
|
829
|
+
// handle FAYT, unless userOverrideFormatting or it's a paste event
|
|
830
|
+
if (this.options.formatAsYouType && !userOverrideFormatting && e.inputType !== "insertFromPaste") {
|
|
828
831
|
// maintain caret position after reformatting
|
|
829
832
|
const currentCaretPos = this.telInput.selectionStart;
|
|
830
833
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
@@ -1474,27 +1477,29 @@ class Iti {
|
|
|
1474
1477
|
|
|
1475
1478
|
// update the input placeholder to an example number from the currently selected country
|
|
1476
1479
|
_updatePlaceholder() {
|
|
1480
|
+
const {
|
|
1481
|
+
autoPlaceholder,
|
|
1482
|
+
placeholderNumberType,
|
|
1483
|
+
nationalMode,
|
|
1484
|
+
customPlaceholder
|
|
1485
|
+
} = this.options;
|
|
1477
1486
|
const shouldSetPlaceholder =
|
|
1478
|
-
|
|
1479
|
-
(!this.hadInitialPlaceholder &&
|
|
1480
|
-
|
|
1487
|
+
autoPlaceholder === "aggressive" ||
|
|
1488
|
+
(!this.hadInitialPlaceholder && autoPlaceholder === "polite");
|
|
1489
|
+
|
|
1481
1490
|
if (window.intlTelInputUtils && shouldSetPlaceholder) {
|
|
1482
|
-
const numberType =
|
|
1483
|
-
intlTelInputUtils.numberType[this.options.placeholderNumberType];
|
|
1491
|
+
const numberType = intlTelInputUtils.numberType[placeholderNumberType];
|
|
1484
1492
|
let placeholder = this.selectedCountryData.iso2
|
|
1485
1493
|
? intlTelInputUtils.getExampleNumber(
|
|
1486
1494
|
this.selectedCountryData.iso2,
|
|
1487
|
-
|
|
1495
|
+
nationalMode,
|
|
1488
1496
|
numberType
|
|
1489
1497
|
)
|
|
1490
1498
|
: "";
|
|
1491
1499
|
|
|
1492
1500
|
placeholder = this._beforeSetNumber(placeholder);
|
|
1493
|
-
if (typeof
|
|
1494
|
-
placeholder = this.
|
|
1495
|
-
placeholder,
|
|
1496
|
-
this.selectedCountryData
|
|
1497
|
-
);
|
|
1501
|
+
if (typeof customPlaceholder === "function") {
|
|
1502
|
+
placeholder = customPlaceholder(placeholder, this.selectedCountryData);
|
|
1498
1503
|
}
|
|
1499
1504
|
this.telInput.setAttribute("placeholder", placeholder);
|
|
1500
1505
|
}
|
|
@@ -1750,7 +1755,9 @@ class Iti {
|
|
|
1750
1755
|
if (this.telInput.value) {
|
|
1751
1756
|
this._updateValFromNumber(this.telInput.value);
|
|
1752
1757
|
}
|
|
1753
|
-
this.
|
|
1758
|
+
if (this.selectedCountryData.iso2) {
|
|
1759
|
+
this._updatePlaceholder();
|
|
1760
|
+
}
|
|
1754
1761
|
}
|
|
1755
1762
|
this.resolveUtilsScriptPromise();
|
|
1756
1763
|
}
|
|
@@ -1860,10 +1867,10 @@ class Iti {
|
|
|
1860
1867
|
}
|
|
1861
1868
|
|
|
1862
1869
|
// validate the input val - assumes the global function isPossibleNumber (from utilsScript)
|
|
1863
|
-
isValidNumber() {
|
|
1870
|
+
isValidNumber(mobileOnly) {
|
|
1864
1871
|
const val = this._getFullNumber();
|
|
1865
1872
|
return window.intlTelInputUtils
|
|
1866
|
-
? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2)
|
|
1873
|
+
? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2, mobileOnly)
|
|
1867
1874
|
: null;
|
|
1868
1875
|
}
|
|
1869
1876
|
|
package/src/js/utils.js
CHANGED
|
@@ -123,10 +123,17 @@ const isValidNumber = (number, countryCode) => {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// check if given number is possible
|
|
126
|
-
const isPossibleNumber = (number, countryCode) => {
|
|
126
|
+
const isPossibleNumber = (number, countryCode, mobileOnly) => {
|
|
127
127
|
try {
|
|
128
128
|
const phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
|
|
129
129
|
const numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode);
|
|
130
|
+
|
|
131
|
+
if (mobileOnly) {
|
|
132
|
+
const resultMobile = phoneUtil.isPossibleNumberForTypeWithReason(numberObj, i18n.phonenumbers.PhoneNumberType.MOBILE);
|
|
133
|
+
const isPossibleMobile = resultMobile === i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE;
|
|
134
|
+
return isPossibleMobile;
|
|
135
|
+
}
|
|
136
|
+
|
|
130
137
|
// can't use phoneUtil.isPossibleNumber directly as it accepts IS_POSSIBLE_LOCAL_ONLY numbers e.g. local numbers that are much shorter
|
|
131
138
|
const result = phoneUtil.isPossibleNumberWithReason(numberObj);
|
|
132
139
|
const isPossible = result === i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE;
|