intl-tel-input 19.2.12 → 19.2.14
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/Gruntfile.js +2 -0
- package/README.md +3 -3
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +13 -6
- package/build/js/intlTelInput-jquery.min.js +3 -3
- package/build/js/intlTelInput.js +13 -6
- package/build/js/intlTelInput.min.js +3 -3
- package/composer.json +1 -1
- package/grunt/replace.js +21 -3
- package/package.json +2 -2
- 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/SimpleApp.js +5 -2
- package/react/demo/simple-bundle.js +64 -60
- package/react/demo/validation-bundle.js +58 -55
- package/src/js/intlTelInput.js +13 -6
|
@@ -24287,35 +24287,35 @@ var require_prop_types = __commonJS({
|
|
|
24287
24287
|
var require_IntlTelInput_cjs = __commonJS({
|
|
24288
24288
|
"react/build/IntlTelInput.cjs.js"(exports, module2) {
|
|
24289
24289
|
var Q = Object.create;
|
|
24290
|
-
var
|
|
24290
|
+
var T = Object.defineProperty;
|
|
24291
24291
|
var X = Object.getOwnPropertyDescriptor;
|
|
24292
24292
|
var tt = Object.getOwnPropertyNames;
|
|
24293
24293
|
var et = Object.getPrototypeOf;
|
|
24294
24294
|
var it = Object.prototype.hasOwnProperty;
|
|
24295
|
-
var nt = (
|
|
24296
|
-
var ot = (
|
|
24297
|
-
for (var v in
|
|
24298
|
-
|
|
24295
|
+
var nt = (h, c) => () => (c || h((c = { exports: {} }).exports, c), c.exports);
|
|
24296
|
+
var ot = (h, c) => {
|
|
24297
|
+
for (var v in c)
|
|
24298
|
+
T(h, v, { get: c[v], enumerable: true });
|
|
24299
24299
|
};
|
|
24300
|
-
var K = (
|
|
24301
|
-
if (
|
|
24302
|
-
for (let
|
|
24303
|
-
!it.call(
|
|
24304
|
-
return
|
|
24300
|
+
var K = (h, c, v, m) => {
|
|
24301
|
+
if (c && typeof c == "object" || typeof c == "function")
|
|
24302
|
+
for (let _ of tt(c))
|
|
24303
|
+
!it.call(h, _) && _ !== v && T(h, _, { get: () => c[_], enumerable: !(m = X(c, _)) || m.enumerable });
|
|
24304
|
+
return h;
|
|
24305
24305
|
};
|
|
24306
|
-
var B = (
|
|
24307
|
-
var rt = (
|
|
24306
|
+
var B = (h, c, v) => (v = h != null ? Q(et(h)) : {}, K(c || !h || !h.__esModule ? T(v, "default", { value: h, enumerable: true }) : v, h));
|
|
24307
|
+
var rt = (h) => K(T({}, "__esModule", { value: true }), h);
|
|
24308
24308
|
var z = nt((ut, F) => {
|
|
24309
|
-
(function(
|
|
24310
|
-
typeof F == "object" && F.exports ? F.exports =
|
|
24311
|
-
})(function(
|
|
24309
|
+
(function(h) {
|
|
24310
|
+
typeof F == "object" && F.exports ? F.exports = h() : window.intlTelInput = h();
|
|
24311
|
+
})(function(h) {
|
|
24312
24312
|
"use strict";
|
|
24313
24313
|
return function() {
|
|
24314
|
-
for (var
|
|
24315
|
-
var m =
|
|
24316
|
-
|
|
24314
|
+
for (var c = [["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"]]], v = 0; v < c.length; v++) {
|
|
24315
|
+
var m = c[v];
|
|
24316
|
+
c[v] = { name: m[0], iso2: m[1], dialCode: m[2], priority: m[3] || 0, areaCodes: m[4] || null, nodeById: {} };
|
|
24317
24317
|
}
|
|
24318
|
-
function
|
|
24318
|
+
function _(s) {
|
|
24319
24319
|
for (var n = 1; n < arguments.length; n++) {
|
|
24320
24320
|
var t = arguments[n] != null ? Object(arguments[n]) : {}, e = Object.keys(t);
|
|
24321
24321
|
typeof Object.getOwnPropertySymbols == "function" && e.push.apply(e, Object.getOwnPropertySymbols(t).filter(function(i) {
|
|
@@ -24330,7 +24330,7 @@ var require_IntlTelInput_cjs = __commonJS({
|
|
|
24330
24330
|
return n = D(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
|
|
24331
24331
|
}
|
|
24332
24332
|
function x(s, n) {
|
|
24333
|
-
return
|
|
24333
|
+
return C(s) || I(s, n) || U(s, n) || O();
|
|
24334
24334
|
}
|
|
24335
24335
|
function O() {
|
|
24336
24336
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -24339,15 +24339,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24339
24339
|
function U(s, n) {
|
|
24340
24340
|
if (s) {
|
|
24341
24341
|
if (typeof s == "string")
|
|
24342
|
-
return
|
|
24342
|
+
return k(s, n);
|
|
24343
24343
|
var t = Object.prototype.toString.call(s).slice(8, -1);
|
|
24344
24344
|
if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
|
|
24345
24345
|
return Array.from(s);
|
|
24346
24346
|
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
|
|
24347
|
-
return
|
|
24347
|
+
return k(s, n);
|
|
24348
24348
|
}
|
|
24349
24349
|
}
|
|
24350
|
-
function
|
|
24350
|
+
function k(s, n) {
|
|
24351
24351
|
(n == null || n > s.length) && (n = s.length);
|
|
24352
24352
|
for (var t = 0, e = new Array(n); t < n; t++)
|
|
24353
24353
|
e[t] = s[t];
|
|
@@ -24379,7 +24379,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24379
24379
|
return a;
|
|
24380
24380
|
}
|
|
24381
24381
|
}
|
|
24382
|
-
function
|
|
24382
|
+
function C(s) {
|
|
24383
24383
|
if (Array.isArray(s))
|
|
24384
24384
|
return s;
|
|
24385
24385
|
}
|
|
@@ -24404,7 +24404,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24404
24404
|
if (typeof s != "object" || s === null)
|
|
24405
24405
|
return s;
|
|
24406
24406
|
var t = s[Symbol.toPrimitive];
|
|
24407
|
-
if (t !==
|
|
24407
|
+
if (t !== h) {
|
|
24408
24408
|
var e = t.call(s, n || "default");
|
|
24409
24409
|
if (typeof e != "object")
|
|
24410
24410
|
return e;
|
|
@@ -24412,13 +24412,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24412
24412
|
}
|
|
24413
24413
|
return (n === "string" ? String : Number)(s);
|
|
24414
24414
|
}
|
|
24415
|
-
var
|
|
24415
|
+
var S = { getInstance: function(n) {
|
|
24416
24416
|
var t = n.getAttribute("data-intl-tel-input-id");
|
|
24417
24417
|
return window.intlTelInputGlobals.instances[t];
|
|
24418
24418
|
}, instances: {}, documentReady: function() {
|
|
24419
24419
|
return document.readyState === "complete";
|
|
24420
24420
|
} };
|
|
24421
|
-
typeof window == "object" && (window.intlTelInputGlobals =
|
|
24421
|
+
typeof window == "object" && (window.intlTelInputGlobals = S);
|
|
24422
24422
|
var W = 0, G = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, q = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], E = function(n) {
|
|
24423
24423
|
var t = window.intlTelInputGlobals.instances;
|
|
24424
24424
|
Object.values(t).forEach(function(e) {
|
|
@@ -24426,7 +24426,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24426
24426
|
});
|
|
24427
24427
|
}, Y = function() {
|
|
24428
24428
|
function s(n) {
|
|
24429
|
-
var t = arguments.length > 1 && arguments[1] !==
|
|
24429
|
+
var t = arguments.length > 1 && arguments[1] !== h ? arguments[1] : {};
|
|
24430
24430
|
L(this, s), this.id = W++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, G, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
|
|
24431
24431
|
}
|
|
24432
24432
|
return M(s, [{ key: "_init", value: function() {
|
|
@@ -24452,25 +24452,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24452
24452
|
for (var o = 0; o < this.countryCodes[e].length; o++)
|
|
24453
24453
|
if (this.countryCodes[e][o] === t)
|
|
24454
24454
|
return;
|
|
24455
|
-
var r = i !==
|
|
24455
|
+
var r = i !== h ? i : this.countryCodes[e].length;
|
|
24456
24456
|
this.countryCodes[e][r] = t;
|
|
24457
24457
|
} }, { key: "_processAllCountries", value: function() {
|
|
24458
24458
|
if (this.options.onlyCountries.length) {
|
|
24459
24459
|
var t = this.options.onlyCountries.map(function(i) {
|
|
24460
24460
|
return i.toLowerCase();
|
|
24461
24461
|
});
|
|
24462
|
-
this.countries =
|
|
24462
|
+
this.countries = c.filter(function(i) {
|
|
24463
24463
|
return t.indexOf(i.iso2) > -1;
|
|
24464
24464
|
});
|
|
24465
24465
|
} else if (this.options.excludeCountries.length) {
|
|
24466
24466
|
var e = this.options.excludeCountries.map(function(i) {
|
|
24467
24467
|
return i.toLowerCase();
|
|
24468
24468
|
});
|
|
24469
|
-
this.countries =
|
|
24469
|
+
this.countries = c.filter(function(i) {
|
|
24470
24470
|
return e.indexOf(i.iso2) === -1;
|
|
24471
24471
|
});
|
|
24472
24472
|
} else
|
|
24473
|
-
this.countries =
|
|
24473
|
+
this.countries = c;
|
|
24474
24474
|
} }, { key: "_translateCountryNames", value: function() {
|
|
24475
24475
|
for (var t = 0; t < this.countries.length; t++) {
|
|
24476
24476
|
var e = this.countries[t].iso2.toLowerCase();
|
|
@@ -24514,12 +24514,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24514
24514
|
var y = this._createEl("div", { class: f });
|
|
24515
24515
|
this.telInput.parentNode.insertBefore(y, this.telInput);
|
|
24516
24516
|
var A = e || o || i;
|
|
24517
|
-
if (A && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, y)), y.appendChild(this.telInput), A && (this.selectedFlag = this._createEl("div",
|
|
24517
|
+
if (A && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, y)), y.appendChild(this.telInput), A && (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) {
|
|
24518
24518
|
this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
|
|
24519
24519
|
var J = u ? "" : "iti--flexible-dropdown-width";
|
|
24520
24520
|
if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(J) }), 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) {
|
|
24521
|
-
var
|
|
24522
|
-
p ?
|
|
24521
|
+
var N = "iti iti--container";
|
|
24522
|
+
p ? N += " iti--fullscreen-popup" : N += " iti--inline-dropdown", g && (N += " iti--country-search"), this.dropdown = this._createEl("div", { class: N }), this.dropdown.appendChild(this.dropdownContent);
|
|
24523
24523
|
} else
|
|
24524
24524
|
this.flagsContainer.appendChild(this.dropdownContent);
|
|
24525
24525
|
}
|
|
@@ -24654,7 +24654,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24654
24654
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
24655
24655
|
var r = function() {
|
|
24656
24656
|
var u = t.searchInput.value.trim();
|
|
24657
|
-
u ? t._filterCountries(u
|
|
24657
|
+
u ? t._filterCountries(u) : t._filterCountries("", true);
|
|
24658
24658
|
}, a = null;
|
|
24659
24659
|
this._handleSearchChange = function() {
|
|
24660
24660
|
a && clearTimeout(a), a = setTimeout(function() {
|
|
@@ -24664,12 +24664,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24664
24664
|
return l.stopPropagation();
|
|
24665
24665
|
});
|
|
24666
24666
|
}
|
|
24667
|
+
} }, { key: "_normaliseString", value: function() {
|
|
24668
|
+
var t = arguments.length > 0 && arguments[0] !== h ? arguments[0] : "";
|
|
24669
|
+
return t.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
24667
24670
|
} }, { key: "_filterCountries", value: function(t) {
|
|
24668
|
-
var e = arguments.length > 1 && arguments[1] !==
|
|
24671
|
+
var e = arguments.length > 1 && arguments[1] !== h ? arguments[1] : false, i = true;
|
|
24669
24672
|
this.countryList.innerHTML = "";
|
|
24670
|
-
for (var o = 0;
|
|
24671
|
-
var
|
|
24672
|
-
(e ||
|
|
24673
|
+
for (var o = this._normaliseString(t), r = 0; r < this.countries.length; r++) {
|
|
24674
|
+
var a = this.countries[r], l = this._normaliseString(a.name), u = "+".concat(a.dialCode);
|
|
24675
|
+
(e || l.includes(o) || u.includes(o) || a.iso2.includes(o)) && (this.countryList.appendChild(a.nodeById[this.id]), i && (this._highlightListItem(a.nodeById[this.id], false), i = false));
|
|
24673
24676
|
}
|
|
24674
24677
|
} }, { key: "_handleUpDownKey", value: function(t) {
|
|
24675
24678
|
var e = t === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
|
|
@@ -24722,7 +24725,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24722
24725
|
var i = this.highlightedItem;
|
|
24723
24726
|
i && i.classList.remove("iti__highlight"), this.highlightedItem = t, this.highlightedItem.classList.add("iti__highlight"), this.selectedFlag.setAttribute("aria-activedescendant", t.getAttribute("id")), e && this.highlightedItem.focus();
|
|
24724
24727
|
} }, { key: "_getCountryData", value: function(t, e, i) {
|
|
24725
|
-
for (var o = e ?
|
|
24728
|
+
for (var o = e ? c : this.countries, r = 0; r < o.length; r++)
|
|
24726
24729
|
if (o[r].iso2 === t)
|
|
24727
24730
|
return o[r];
|
|
24728
24731
|
if (i)
|
|
@@ -24873,8 +24876,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24873
24876
|
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
24874
24877
|
} }]), s;
|
|
24875
24878
|
}();
|
|
24876
|
-
|
|
24877
|
-
return
|
|
24879
|
+
S.getCountryData = function() {
|
|
24880
|
+
return c;
|
|
24878
24881
|
};
|
|
24879
24882
|
var R = function(n, t, e) {
|
|
24880
24883
|
var i = document.createElement("script");
|
|
@@ -24884,7 +24887,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24884
24887
|
E("rejectUtilsScriptPromise"), e && e();
|
|
24885
24888
|
}, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
|
|
24886
24889
|
};
|
|
24887
|
-
return
|
|
24890
|
+
return S.loadUtils = function(s) {
|
|
24888
24891
|
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
24889
24892
|
if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
|
|
24890
24893
|
return new Promise(function(n, t) {
|
|
@@ -24893,7 +24896,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24893
24896
|
R(s);
|
|
24894
24897
|
}
|
|
24895
24898
|
return null;
|
|
24896
|
-
},
|
|
24899
|
+
}, S.defaults = G, S.version = "19.2.14", function(s, n) {
|
|
24897
24900
|
var t = new Y(s, n);
|
|
24898
24901
|
return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
|
|
24899
24902
|
};
|
|
@@ -24906,22 +24909,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24906
24909
|
var w = B(require_react());
|
|
24907
24910
|
var d = B(require_prop_types());
|
|
24908
24911
|
var V = B(z());
|
|
24909
|
-
var j = ({ initialValue:
|
|
24910
|
-
let I = (0, w.useRef)(null),
|
|
24911
|
-
let b =
|
|
24912
|
-
if (
|
|
24913
|
-
m(true),
|
|
24912
|
+
var j = ({ initialValue: h, onChangeNumber: c, onChangeCountry: v, onChangeValidity: m, onChangeErrorCode: _, initOptions: P, className: x, disabled: O, onFocus: U, onBlur: k }) => {
|
|
24913
|
+
let I = (0, w.useRef)(null), C = (0, w.useRef)(null), L = () => {
|
|
24914
|
+
let b = C.current.getNumber(), M = C.current.getSelectedCountryData().iso2;
|
|
24915
|
+
if (c(b), v(M), C.current.isValidNumber())
|
|
24916
|
+
m(true), _(null);
|
|
24914
24917
|
else {
|
|
24915
|
-
let D =
|
|
24916
|
-
m(false),
|
|
24918
|
+
let D = C.current.getValidationError();
|
|
24919
|
+
m(false), _(D);
|
|
24917
24920
|
}
|
|
24918
24921
|
};
|
|
24919
24922
|
return (0, w.useEffect)(() => {
|
|
24920
24923
|
let b = I.current;
|
|
24921
|
-
return
|
|
24922
|
-
b.removeEventListener("countrychange", L),
|
|
24924
|
+
return C.current = (0, V.default)(I.current, P), b.addEventListener("countrychange", L), () => {
|
|
24925
|
+
b.removeEventListener("countrychange", L), C.current.destroy();
|
|
24923
24926
|
};
|
|
24924
|
-
}, []), w.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue:
|
|
24927
|
+
}, []), w.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: h, className: x, disabled: O, onFocus: U, onBlur: k });
|
|
24925
24928
|
};
|
|
24926
24929
|
j.propTypes = { initialValue: d.default.string, onChangeNumber: d.default.func, onChangeCountry: d.default.func, onChangeValidity: d.default.func, onChangeErrorCode: d.default.func, initOptions: d.default.shape({ allowDropdown: d.default.bool, autoInsertDialCode: d.default.bool, autoPlaceholder: d.default.string, containerClass: d.default.string, countrySearch: d.default.bool, customPlaceholder: d.default.func, dropdownContainer: d.default.node, excludeCountries: d.default.arrayOf(d.default.string), fixDropdownWidth: d.default.bool, formatAsYouType: d.default.bool, formatOnDisplay: d.default.bool, geoIpLookup: d.default.func, hiddenInput: d.default.func, i18n: d.default.objectOf(d.default.string), initialCountry: d.default.string, nationalMode: d.default.bool, onlyCountries: d.default.arrayOf(d.default.string), placeholderNumberType: d.default.string, preferredCountries: d.default.arrayOf(d.default.string), showFlags: d.default.bool, showSelectedDialCode: d.default.bool, useFullscreenPopup: d.default.bool, utilsScript: d.default.string }), className: d.default.string, disabled: d.default.bool, onFocus: d.default.func, onBlur: d.default.func };
|
|
24927
24930
|
j.defaultProps = { initialValue: "", onChangeNumber: () => {
|
package/src/js/intlTelInput.js
CHANGED
|
@@ -1052,9 +1052,9 @@ class Iti {
|
|
|
1052
1052
|
const doFilter = () => {
|
|
1053
1053
|
const inputQuery = this.searchInput.value.trim();
|
|
1054
1054
|
if (inputQuery) {
|
|
1055
|
-
this._filterCountries(inputQuery
|
|
1055
|
+
this._filterCountries(inputQuery);
|
|
1056
1056
|
} else {
|
|
1057
|
-
this._filterCountries(
|
|
1057
|
+
this._filterCountries("", true);
|
|
1058
1058
|
}
|
|
1059
1059
|
};
|
|
1060
1060
|
|
|
@@ -1076,18 +1076,25 @@ class Iti {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
|
+
// turns "Réunion" into "Reunion"
|
|
1080
|
+
// from https://stackoverflow.com/a/37511463
|
|
1081
|
+
_normaliseString(s = "") {
|
|
1082
|
+
return s.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1079
1085
|
_filterCountries(query, isReset = false) {
|
|
1080
1086
|
let isFirst = true;
|
|
1081
1087
|
this.countryList.innerHTML = "";
|
|
1088
|
+
const normalisedQuery = this._normaliseString(query);
|
|
1082
1089
|
for (let i = 0; i < this.countries.length; i++) {
|
|
1083
1090
|
const c = this.countries[i];
|
|
1084
|
-
const
|
|
1091
|
+
const normalisedCountryName = this._normaliseString(c.name);
|
|
1085
1092
|
const fullDialCode = `+${c.dialCode}`;
|
|
1086
1093
|
if (
|
|
1087
1094
|
isReset ||
|
|
1088
|
-
|
|
1089
|
-
fullDialCode.includes(
|
|
1090
|
-
c.iso2.includes(
|
|
1095
|
+
normalisedCountryName.includes(normalisedQuery) ||
|
|
1096
|
+
fullDialCode.includes(normalisedQuery) ||
|
|
1097
|
+
c.iso2.includes(normalisedQuery)
|
|
1091
1098
|
) {
|
|
1092
1099
|
this.countryList.appendChild(c.nodeById[this.id]);
|
|
1093
1100
|
// highlight the first item
|