intl-tel-input 25.10.4 → 25.10.6
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 +15 -14
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +68 -57
- package/angular/build/IntlTelInputWithUtils.js +68 -57
- package/build/js/data.js +8 -8
- package/build/js/data.min.js +2 -2
- package/build/js/i18n/pl/interface.js +1 -3
- package/build/js/intlTelInput.js +69 -58
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +69 -58
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +11 -6
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +68 -57
- package/react/build/IntlTelInput.js +68 -57
- package/react/build/IntlTelInputWithUtils.cjs +68 -57
- package/react/build/IntlTelInputWithUtils.js +68 -57
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +143 -131
- package/vue/build/IntlTelInputWithUtils.mjs +204 -192
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v25.10.
|
|
2
|
+
* International Telephone Input v25.10.6
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1266,6 +1266,13 @@ var factoryOutput = (() => {
|
|
|
1266
1266
|
// Tuvalu
|
|
1267
1267
|
"688"
|
|
1268
1268
|
],
|
|
1269
|
+
[
|
|
1270
|
+
"vi",
|
|
1271
|
+
// U.S. Virgin Islands
|
|
1272
|
+
"1",
|
|
1273
|
+
24,
|
|
1274
|
+
["340"]
|
|
1275
|
+
],
|
|
1269
1276
|
[
|
|
1270
1277
|
"ug",
|
|
1271
1278
|
// Uganda
|
|
@@ -1300,13 +1307,6 @@ var factoryOutput = (() => {
|
|
|
1300
1307
|
// Uruguay
|
|
1301
1308
|
"598"
|
|
1302
1309
|
],
|
|
1303
|
-
[
|
|
1304
|
-
"vi",
|
|
1305
|
-
// U.S. Virgin Islands
|
|
1306
|
-
"1",
|
|
1307
|
-
24,
|
|
1308
|
-
["340"]
|
|
1309
|
-
],
|
|
1310
1310
|
[
|
|
1311
1311
|
"uz",
|
|
1312
1312
|
// Uzbekistan
|
|
@@ -1882,6 +1882,9 @@ var factoryOutput = (() => {
|
|
|
1882
1882
|
}
|
|
1883
1883
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1884
1884
|
_addToDialCodeMap(iso2, dialCode, priority) {
|
|
1885
|
+
if (!iso2 || !dialCode) {
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1885
1888
|
if (dialCode.length > this.dialCodeMaxLen) {
|
|
1886
1889
|
this.dialCodeMaxLen = dialCode.length;
|
|
1887
1890
|
}
|
|
@@ -1936,6 +1939,11 @@ var factoryOutput = (() => {
|
|
|
1936
1939
|
}
|
|
1937
1940
|
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1938
1941
|
}
|
|
1942
|
+
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1943
|
+
this.dialCodes.forEach((dialCode) => {
|
|
1944
|
+
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1939
1947
|
for (const c of this.countries) {
|
|
1940
1948
|
if (c.areaCodes) {
|
|
1941
1949
|
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
@@ -2354,7 +2362,7 @@ var factoryOutput = (() => {
|
|
|
2354
2362
|
_openDropdownWithPlus() {
|
|
2355
2363
|
this._openDropdown();
|
|
2356
2364
|
this.searchInput.value = "+";
|
|
2357
|
-
this._filterCountries(""
|
|
2365
|
+
this._filterCountries("");
|
|
2358
2366
|
}
|
|
2359
2367
|
//* Initialize the tel input listeners.
|
|
2360
2368
|
_initTelInputListeners() {
|
|
@@ -2537,11 +2545,7 @@ var factoryOutput = (() => {
|
|
|
2537
2545
|
if (this.options.countrySearch) {
|
|
2538
2546
|
const doFilter = () => {
|
|
2539
2547
|
const inputQuery = this.searchInput.value.trim();
|
|
2540
|
-
|
|
2541
|
-
this._filterCountries(inputQuery);
|
|
2542
|
-
} else {
|
|
2543
|
-
this._filterCountries("", true);
|
|
2544
|
-
}
|
|
2548
|
+
this._filterCountries(inputQuery);
|
|
2545
2549
|
if (this.searchInput.value) {
|
|
2546
2550
|
this.searchClearButton.classList.remove("iti__hide");
|
|
2547
2551
|
} else {
|
|
@@ -2580,42 +2584,44 @@ var factoryOutput = (() => {
|
|
|
2580
2584
|
}
|
|
2581
2585
|
}
|
|
2582
2586
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2583
|
-
_filterCountries(query
|
|
2587
|
+
_filterCountries(query) {
|
|
2584
2588
|
let noCountriesAddedYet = true;
|
|
2585
2589
|
this.countryList.innerHTML = "";
|
|
2586
2590
|
const normalisedQuery = normaliseString(query);
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2591
|
+
let matchedCountries;
|
|
2592
|
+
if (query === "") {
|
|
2593
|
+
matchedCountries = this.countries;
|
|
2594
|
+
} else {
|
|
2595
|
+
const iso2Matches = [];
|
|
2596
|
+
const nameStartWith = [];
|
|
2597
|
+
const nameContains = [];
|
|
2598
|
+
const dialCodeMatches = [];
|
|
2599
|
+
const dialCodeContains = [];
|
|
2600
|
+
const initialsMatches = [];
|
|
2601
|
+
for (const c of this.countries) {
|
|
2602
|
+
if (c.iso2 === normalisedQuery) {
|
|
2603
|
+
iso2Matches.push(c);
|
|
2604
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2605
|
+
nameStartWith.push(c);
|
|
2606
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2607
|
+
nameContains.push(c);
|
|
2608
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2609
|
+
dialCodeMatches.push(c);
|
|
2610
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2611
|
+
dialCodeContains.push(c);
|
|
2612
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2613
|
+
initialsMatches.push(c);
|
|
2614
|
+
}
|
|
2609
2615
|
}
|
|
2616
|
+
matchedCountries = [
|
|
2617
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2618
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2619
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2620
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2621
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2622
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2623
|
+
];
|
|
2610
2624
|
}
|
|
2611
|
-
const matchedCountries = [
|
|
2612
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2613
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2614
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2615
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2616
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2617
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2618
|
-
];
|
|
2619
2625
|
for (const c of matchedCountries) {
|
|
2620
2626
|
const listItem = c.nodeById[this.id];
|
|
2621
2627
|
if (listItem) {
|
|
@@ -2642,11 +2648,11 @@ var factoryOutput = (() => {
|
|
|
2642
2648
|
const { i18n } = this.options;
|
|
2643
2649
|
const count = this.countryList.childElementCount;
|
|
2644
2650
|
let searchText;
|
|
2645
|
-
if (
|
|
2646
|
-
searchText = i18n.
|
|
2651
|
+
if (count === 0) {
|
|
2652
|
+
searchText = i18n.zeroSearchResults;
|
|
2647
2653
|
} else {
|
|
2648
|
-
if (
|
|
2649
|
-
searchText = i18n.
|
|
2654
|
+
if (i18n.searchResultsText) {
|
|
2655
|
+
searchText = i18n.searchResultsText(count);
|
|
2650
2656
|
} else if (count === 1) {
|
|
2651
2657
|
searchText = i18n.oneSearchResult;
|
|
2652
2658
|
} else {
|
|
@@ -2722,22 +2728,27 @@ var factoryOutput = (() => {
|
|
|
2722
2728
|
if (dialCodeMatch) {
|
|
2723
2729
|
const dialCodeMatchNumeric = getNumeric(dialCodeMatch);
|
|
2724
2730
|
const iso2Codes = this.dialCodeToIso2Map[dialCodeMatchNumeric];
|
|
2731
|
+
if (iso2Codes.length === 1) {
|
|
2732
|
+
if (iso2Codes[0] === selectedIso2) {
|
|
2733
|
+
return null;
|
|
2734
|
+
}
|
|
2735
|
+
return iso2Codes[0];
|
|
2736
|
+
}
|
|
2725
2737
|
if (!selectedIso2 && this.defaultCountry && iso2Codes.includes(this.defaultCountry)) {
|
|
2726
2738
|
return this.defaultCountry;
|
|
2727
2739
|
}
|
|
2740
|
+
const isRegionlessNanpNumber = selectedDialCode === "1" && isRegionlessNanp(numeric);
|
|
2741
|
+
if (isRegionlessNanpNumber) {
|
|
2742
|
+
return null;
|
|
2743
|
+
}
|
|
2728
2744
|
const hasAreaCodesButNoneMatched = this.selectedCountryData.areaCodes && numeric.length > dialCodeMatchNumeric.length;
|
|
2729
2745
|
const alreadySelected = selectedIso2 && iso2Codes.includes(selectedIso2) && !hasAreaCodesButNoneMatched;
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
for (const iso2 of iso2Codes) {
|
|
2733
|
-
if (iso2) {
|
|
2734
|
-
return iso2;
|
|
2735
|
-
}
|
|
2736
|
-
}
|
|
2746
|
+
if (!alreadySelected) {
|
|
2747
|
+
return iso2Codes[0];
|
|
2737
2748
|
}
|
|
2738
2749
|
} else if (number.charAt(0) === "+" && numeric.length) {
|
|
2739
2750
|
return "";
|
|
2740
|
-
} else if ((!number || number === "+") && !
|
|
2751
|
+
} else if ((!number || number === "+") && !selectedIso2) {
|
|
2741
2752
|
return this.defaultCountry;
|
|
2742
2753
|
}
|
|
2743
2754
|
return null;
|
|
@@ -3286,7 +3297,7 @@ var factoryOutput = (() => {
|
|
|
3286
3297
|
attachUtils,
|
|
3287
3298
|
startedLoadingUtilsScript: false,
|
|
3288
3299
|
startedLoadingAutoCountry: false,
|
|
3289
|
-
version: "25.10.
|
|
3300
|
+
version: "25.10.6"
|
|
3290
3301
|
}
|
|
3291
3302
|
);
|
|
3292
3303
|
var intl_tel_input_default = intlTelInput;
|