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
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# International Telephone Input [](https://github.com/jackocnr/intl-tel-input/actions/workflows/ci.yml) <img src="https://img.shields.io/github/package-json/v/jackocnr/intl-tel-input.svg" alt="version"/> <img src="https://img.shields.io/npm/dm/intl-tel-input.svg" alt="downloads"/>
|
|
2
2
|
|
|
3
3
|
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/vue-icon.png" alt="Vue logo" width="16px" /> NEWS: we now have our own <a href="https://github.com/jackocnr/intl-tel-input/tree/master/vue">Vue component</a>!
|
|
4
4
|
|
|
@@ -77,16 +77,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
77
77
|
## Getting Started (Using a CDN)
|
|
78
78
|
1. Add the CSS
|
|
79
79
|
```html
|
|
80
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
80
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/css/intlTelInput.css">
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
2. Add the plugin script and initialise it on your input element
|
|
84
84
|
```html
|
|
85
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
85
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/js/intlTelInput.min.js"></script>
|
|
86
86
|
<script>
|
|
87
87
|
const input = document.querySelector("#phone");
|
|
88
88
|
window.intlTelInput(input, {
|
|
89
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
89
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/js/utils.js"),
|
|
90
90
|
});
|
|
91
91
|
</script>
|
|
92
92
|
```
|
|
@@ -287,24 +287,25 @@ intlTelInput(input, {
|
|
|
287
287
|
as: "American Samoa",
|
|
288
288
|
ad: "Andorra",
|
|
289
289
|
...
|
|
290
|
-
// Aria label for the selected country element
|
|
290
|
+
// Aria label for the selected country element, when there is a country selected
|
|
291
291
|
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
292
|
-
//
|
|
292
|
+
// Aria label and title text for the selected country element, when no country is selected
|
|
293
293
|
noCountrySelected: "Select country",
|
|
294
294
|
// Aria label for the country list element
|
|
295
295
|
countryListAriaLabel: "List of countries",
|
|
296
296
|
// Placeholder for the search input in the dropdown
|
|
297
297
|
searchPlaceholder: "Search",
|
|
298
|
-
//
|
|
298
|
+
// Aria label for the clear search button
|
|
299
|
+
clearSearchAriaLabel: "Clear search",
|
|
300
|
+
// Visible text and screen reader message for when the search produces no results
|
|
299
301
|
zeroSearchResults: "No results found",
|
|
300
|
-
// Screen reader
|
|
302
|
+
// Screen reader message for when the search produces 1 result
|
|
301
303
|
oneSearchResult: "1 result found",
|
|
302
|
-
// Screen reader
|
|
304
|
+
// Screen reader message for when the search produces multiple results
|
|
303
305
|
multipleSearchResults: "${count} results found",
|
|
304
|
-
// For more complex pluralisation cases, e.g. Polish or Arabic, you can implement your own logic
|
|
305
|
-
// Note that if this function is defined, the plugin will ignore the "zero", "one" and "multiple" keys listed above
|
|
306
|
+
// OPTIONAL: For more complex pluralisation cases, e.g. Polish or Arabic, you can implement your own logic, like below. In this case, you can omit the "one" and "multiple" keys above.
|
|
306
307
|
searchResultsText(count) {
|
|
307
|
-
|
|
308
|
+
// NOTE: zero results is always handled by "zeroSearchResults" above
|
|
308
309
|
if (count === 1) return "1 result found";
|
|
309
310
|
return `${count} results found`;
|
|
310
311
|
}
|
|
@@ -326,7 +327,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
|
|
|
326
327
|
```js
|
|
327
328
|
// (A) import utils module from a CDN
|
|
328
329
|
intlTelInput(htmlInputElement, {
|
|
329
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
330
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/js/utils.js"),
|
|
330
331
|
});
|
|
331
332
|
|
|
332
333
|
// (B) import utils module from your own hosted version of utils.js
|
|
@@ -610,7 +611,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
|
|
|
610
611
|
```js
|
|
611
612
|
// (A) import utils module from a CDN
|
|
612
613
|
intlTelInput(htmlInputElement, {
|
|
613
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
614
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/js/utils.js"),
|
|
614
615
|
});
|
|
615
616
|
|
|
616
617
|
// (B) import utils module from your own hosted version of utils.js
|
package/angular/README.md
CHANGED
|
@@ -29,7 +29,7 @@ import "intl-tel-input/styles";
|
|
|
29
29
|
|
|
30
30
|
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation.
|
|
31
31
|
|
|
32
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
32
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.6/build/js/utils.js"`.
|
|
33
33
|
|
|
34
34
|
## Props
|
|
35
35
|
Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
|
|
@@ -1226,6 +1226,13 @@ var rawCountryData = [
|
|
|
1226
1226
|
// Tuvalu
|
|
1227
1227
|
"688"
|
|
1228
1228
|
],
|
|
1229
|
+
[
|
|
1230
|
+
"vi",
|
|
1231
|
+
// U.S. Virgin Islands
|
|
1232
|
+
"1",
|
|
1233
|
+
24,
|
|
1234
|
+
["340"]
|
|
1235
|
+
],
|
|
1229
1236
|
[
|
|
1230
1237
|
"ug",
|
|
1231
1238
|
// Uganda
|
|
@@ -1260,13 +1267,6 @@ var rawCountryData = [
|
|
|
1260
1267
|
// Uruguay
|
|
1261
1268
|
"598"
|
|
1262
1269
|
],
|
|
1263
|
-
[
|
|
1264
|
-
"vi",
|
|
1265
|
-
// U.S. Virgin Islands
|
|
1266
|
-
"1",
|
|
1267
|
-
24,
|
|
1268
|
-
["340"]
|
|
1269
|
-
],
|
|
1270
1270
|
[
|
|
1271
1271
|
"uz",
|
|
1272
1272
|
// Uzbekistan
|
|
@@ -1842,6 +1842,9 @@ var Iti = class _Iti {
|
|
|
1842
1842
|
}
|
|
1843
1843
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1844
1844
|
_addToDialCodeMap(iso2, dialCode, priority) {
|
|
1845
|
+
if (!iso2 || !dialCode) {
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1845
1848
|
if (dialCode.length > this.dialCodeMaxLen) {
|
|
1846
1849
|
this.dialCodeMaxLen = dialCode.length;
|
|
1847
1850
|
}
|
|
@@ -1888,6 +1891,11 @@ var Iti = class _Iti {
|
|
|
1888
1891
|
}
|
|
1889
1892
|
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1890
1893
|
}
|
|
1894
|
+
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1895
|
+
this.dialCodes.forEach((dialCode) => {
|
|
1896
|
+
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1891
1899
|
for (const c of this.countries) {
|
|
1892
1900
|
if (c.areaCodes) {
|
|
1893
1901
|
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
@@ -2233,7 +2241,7 @@ var Iti = class _Iti {
|
|
|
2233
2241
|
_openDropdownWithPlus() {
|
|
2234
2242
|
this._openDropdown();
|
|
2235
2243
|
this.searchInput.value = "+";
|
|
2236
|
-
this._filterCountries(""
|
|
2244
|
+
this._filterCountries("");
|
|
2237
2245
|
}
|
|
2238
2246
|
//* Initialize the tel input listeners.
|
|
2239
2247
|
_initTelInputListeners() {
|
|
@@ -2412,11 +2420,7 @@ var Iti = class _Iti {
|
|
|
2412
2420
|
if (this.options.countrySearch) {
|
|
2413
2421
|
const doFilter = () => {
|
|
2414
2422
|
const inputQuery = this.searchInput.value.trim();
|
|
2415
|
-
|
|
2416
|
-
this._filterCountries(inputQuery);
|
|
2417
|
-
} else {
|
|
2418
|
-
this._filterCountries("", true);
|
|
2419
|
-
}
|
|
2423
|
+
this._filterCountries(inputQuery);
|
|
2420
2424
|
if (this.searchInput.value) {
|
|
2421
2425
|
this.searchClearButton.classList.remove("iti__hide");
|
|
2422
2426
|
} else {
|
|
@@ -2455,42 +2459,44 @@ var Iti = class _Iti {
|
|
|
2455
2459
|
}
|
|
2456
2460
|
}
|
|
2457
2461
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2458
|
-
_filterCountries(query
|
|
2462
|
+
_filterCountries(query) {
|
|
2459
2463
|
let noCountriesAddedYet = true;
|
|
2460
2464
|
this.countryList.innerHTML = "";
|
|
2461
2465
|
const normalisedQuery = normaliseString(query);
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2466
|
+
let matchedCountries;
|
|
2467
|
+
if (query === "") {
|
|
2468
|
+
matchedCountries = this.countries;
|
|
2469
|
+
} else {
|
|
2470
|
+
const iso2Matches = [];
|
|
2471
|
+
const nameStartWith = [];
|
|
2472
|
+
const nameContains = [];
|
|
2473
|
+
const dialCodeMatches = [];
|
|
2474
|
+
const dialCodeContains = [];
|
|
2475
|
+
const initialsMatches = [];
|
|
2476
|
+
for (const c of this.countries) {
|
|
2477
|
+
if (c.iso2 === normalisedQuery) {
|
|
2478
|
+
iso2Matches.push(c);
|
|
2479
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2480
|
+
nameStartWith.push(c);
|
|
2481
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2482
|
+
nameContains.push(c);
|
|
2483
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2484
|
+
dialCodeMatches.push(c);
|
|
2485
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2486
|
+
dialCodeContains.push(c);
|
|
2487
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2488
|
+
initialsMatches.push(c);
|
|
2489
|
+
}
|
|
2484
2490
|
}
|
|
2491
|
+
matchedCountries = [
|
|
2492
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2493
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2494
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2495
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2496
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2497
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2498
|
+
];
|
|
2485
2499
|
}
|
|
2486
|
-
const matchedCountries = [
|
|
2487
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2488
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2489
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2490
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2491
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2492
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2493
|
-
];
|
|
2494
2500
|
for (const c of matchedCountries) {
|
|
2495
2501
|
const listItem = c.nodeById[this.id];
|
|
2496
2502
|
if (listItem) {
|
|
@@ -2517,11 +2523,11 @@ var Iti = class _Iti {
|
|
|
2517
2523
|
const { i18n } = this.options;
|
|
2518
2524
|
const count = this.countryList.childElementCount;
|
|
2519
2525
|
let searchText;
|
|
2520
|
-
if (
|
|
2521
|
-
searchText = i18n.
|
|
2526
|
+
if (count === 0) {
|
|
2527
|
+
searchText = i18n.zeroSearchResults;
|
|
2522
2528
|
} else {
|
|
2523
|
-
if (
|
|
2524
|
-
searchText = i18n.
|
|
2529
|
+
if (i18n.searchResultsText) {
|
|
2530
|
+
searchText = i18n.searchResultsText(count);
|
|
2525
2531
|
} else if (count === 1) {
|
|
2526
2532
|
searchText = i18n.oneSearchResult;
|
|
2527
2533
|
} else {
|
|
@@ -2594,22 +2600,27 @@ var Iti = class _Iti {
|
|
|
2594
2600
|
if (dialCodeMatch) {
|
|
2595
2601
|
const dialCodeMatchNumeric = getNumeric(dialCodeMatch);
|
|
2596
2602
|
const iso2Codes = this.dialCodeToIso2Map[dialCodeMatchNumeric];
|
|
2603
|
+
if (iso2Codes.length === 1) {
|
|
2604
|
+
if (iso2Codes[0] === selectedIso2) {
|
|
2605
|
+
return null;
|
|
2606
|
+
}
|
|
2607
|
+
return iso2Codes[0];
|
|
2608
|
+
}
|
|
2597
2609
|
if (!selectedIso2 && this.defaultCountry && iso2Codes.includes(this.defaultCountry)) {
|
|
2598
2610
|
return this.defaultCountry;
|
|
2599
2611
|
}
|
|
2612
|
+
const isRegionlessNanpNumber = selectedDialCode === "1" && isRegionlessNanp(numeric);
|
|
2613
|
+
if (isRegionlessNanpNumber) {
|
|
2614
|
+
return null;
|
|
2615
|
+
}
|
|
2600
2616
|
const hasAreaCodesButNoneMatched = this.selectedCountryData.areaCodes && numeric.length > dialCodeMatchNumeric.length;
|
|
2601
2617
|
const alreadySelected = selectedIso2 && iso2Codes.includes(selectedIso2) && !hasAreaCodesButNoneMatched;
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
for (const iso2 of iso2Codes) {
|
|
2605
|
-
if (iso2) {
|
|
2606
|
-
return iso2;
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2618
|
+
if (!alreadySelected) {
|
|
2619
|
+
return iso2Codes[0];
|
|
2609
2620
|
}
|
|
2610
2621
|
} else if (number.charAt(0) === "+" && numeric.length) {
|
|
2611
2622
|
return "";
|
|
2612
|
-
} else if ((!number || number === "+") && !
|
|
2623
|
+
} else if ((!number || number === "+") && !selectedIso2) {
|
|
2613
2624
|
return this.defaultCountry;
|
|
2614
2625
|
}
|
|
2615
2626
|
return null;
|
|
@@ -3119,7 +3130,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3119
3130
|
attachUtils,
|
|
3120
3131
|
startedLoadingUtilsScript: false,
|
|
3121
3132
|
startedLoadingAutoCountry: false,
|
|
3122
|
-
version: "25.10.
|
|
3133
|
+
version: "25.10.6"
|
|
3123
3134
|
});
|
|
3124
3135
|
var intl_tel_input_default = intlTelInput;
|
|
3125
3136
|
|
|
@@ -1226,6 +1226,13 @@ var rawCountryData = [
|
|
|
1226
1226
|
// Tuvalu
|
|
1227
1227
|
"688"
|
|
1228
1228
|
],
|
|
1229
|
+
[
|
|
1230
|
+
"vi",
|
|
1231
|
+
// U.S. Virgin Islands
|
|
1232
|
+
"1",
|
|
1233
|
+
24,
|
|
1234
|
+
["340"]
|
|
1235
|
+
],
|
|
1229
1236
|
[
|
|
1230
1237
|
"ug",
|
|
1231
1238
|
// Uganda
|
|
@@ -1260,13 +1267,6 @@ var rawCountryData = [
|
|
|
1260
1267
|
// Uruguay
|
|
1261
1268
|
"598"
|
|
1262
1269
|
],
|
|
1263
|
-
[
|
|
1264
|
-
"vi",
|
|
1265
|
-
// U.S. Virgin Islands
|
|
1266
|
-
"1",
|
|
1267
|
-
24,
|
|
1268
|
-
["340"]
|
|
1269
|
-
],
|
|
1270
1270
|
[
|
|
1271
1271
|
"uz",
|
|
1272
1272
|
// Uzbekistan
|
|
@@ -1842,6 +1842,9 @@ var Iti = class _Iti {
|
|
|
1842
1842
|
}
|
|
1843
1843
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1844
1844
|
_addToDialCodeMap(iso2, dialCode, priority) {
|
|
1845
|
+
if (!iso2 || !dialCode) {
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1845
1848
|
if (dialCode.length > this.dialCodeMaxLen) {
|
|
1846
1849
|
this.dialCodeMaxLen = dialCode.length;
|
|
1847
1850
|
}
|
|
@@ -1888,6 +1891,11 @@ var Iti = class _Iti {
|
|
|
1888
1891
|
}
|
|
1889
1892
|
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1890
1893
|
}
|
|
1894
|
+
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1895
|
+
this.dialCodes.forEach((dialCode) => {
|
|
1896
|
+
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1891
1899
|
for (const c of this.countries) {
|
|
1892
1900
|
if (c.areaCodes) {
|
|
1893
1901
|
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
@@ -2233,7 +2241,7 @@ var Iti = class _Iti {
|
|
|
2233
2241
|
_openDropdownWithPlus() {
|
|
2234
2242
|
this._openDropdown();
|
|
2235
2243
|
this.searchInput.value = "+";
|
|
2236
|
-
this._filterCountries(""
|
|
2244
|
+
this._filterCountries("");
|
|
2237
2245
|
}
|
|
2238
2246
|
//* Initialize the tel input listeners.
|
|
2239
2247
|
_initTelInputListeners() {
|
|
@@ -2412,11 +2420,7 @@ var Iti = class _Iti {
|
|
|
2412
2420
|
if (this.options.countrySearch) {
|
|
2413
2421
|
const doFilter = () => {
|
|
2414
2422
|
const inputQuery = this.searchInput.value.trim();
|
|
2415
|
-
|
|
2416
|
-
this._filterCountries(inputQuery);
|
|
2417
|
-
} else {
|
|
2418
|
-
this._filterCountries("", true);
|
|
2419
|
-
}
|
|
2423
|
+
this._filterCountries(inputQuery);
|
|
2420
2424
|
if (this.searchInput.value) {
|
|
2421
2425
|
this.searchClearButton.classList.remove("iti__hide");
|
|
2422
2426
|
} else {
|
|
@@ -2455,42 +2459,44 @@ var Iti = class _Iti {
|
|
|
2455
2459
|
}
|
|
2456
2460
|
}
|
|
2457
2461
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2458
|
-
_filterCountries(query
|
|
2462
|
+
_filterCountries(query) {
|
|
2459
2463
|
let noCountriesAddedYet = true;
|
|
2460
2464
|
this.countryList.innerHTML = "";
|
|
2461
2465
|
const normalisedQuery = normaliseString(query);
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2466
|
+
let matchedCountries;
|
|
2467
|
+
if (query === "") {
|
|
2468
|
+
matchedCountries = this.countries;
|
|
2469
|
+
} else {
|
|
2470
|
+
const iso2Matches = [];
|
|
2471
|
+
const nameStartWith = [];
|
|
2472
|
+
const nameContains = [];
|
|
2473
|
+
const dialCodeMatches = [];
|
|
2474
|
+
const dialCodeContains = [];
|
|
2475
|
+
const initialsMatches = [];
|
|
2476
|
+
for (const c of this.countries) {
|
|
2477
|
+
if (c.iso2 === normalisedQuery) {
|
|
2478
|
+
iso2Matches.push(c);
|
|
2479
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2480
|
+
nameStartWith.push(c);
|
|
2481
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2482
|
+
nameContains.push(c);
|
|
2483
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2484
|
+
dialCodeMatches.push(c);
|
|
2485
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2486
|
+
dialCodeContains.push(c);
|
|
2487
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2488
|
+
initialsMatches.push(c);
|
|
2489
|
+
}
|
|
2484
2490
|
}
|
|
2491
|
+
matchedCountries = [
|
|
2492
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2493
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2494
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2495
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2496
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2497
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2498
|
+
];
|
|
2485
2499
|
}
|
|
2486
|
-
const matchedCountries = [
|
|
2487
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2488
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2489
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2490
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2491
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2492
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2493
|
-
];
|
|
2494
2500
|
for (const c of matchedCountries) {
|
|
2495
2501
|
const listItem = c.nodeById[this.id];
|
|
2496
2502
|
if (listItem) {
|
|
@@ -2517,11 +2523,11 @@ var Iti = class _Iti {
|
|
|
2517
2523
|
const { i18n } = this.options;
|
|
2518
2524
|
const count = this.countryList.childElementCount;
|
|
2519
2525
|
let searchText;
|
|
2520
|
-
if (
|
|
2521
|
-
searchText = i18n.
|
|
2526
|
+
if (count === 0) {
|
|
2527
|
+
searchText = i18n.zeroSearchResults;
|
|
2522
2528
|
} else {
|
|
2523
|
-
if (
|
|
2524
|
-
searchText = i18n.
|
|
2529
|
+
if (i18n.searchResultsText) {
|
|
2530
|
+
searchText = i18n.searchResultsText(count);
|
|
2525
2531
|
} else if (count === 1) {
|
|
2526
2532
|
searchText = i18n.oneSearchResult;
|
|
2527
2533
|
} else {
|
|
@@ -2594,22 +2600,27 @@ var Iti = class _Iti {
|
|
|
2594
2600
|
if (dialCodeMatch) {
|
|
2595
2601
|
const dialCodeMatchNumeric = getNumeric(dialCodeMatch);
|
|
2596
2602
|
const iso2Codes = this.dialCodeToIso2Map[dialCodeMatchNumeric];
|
|
2603
|
+
if (iso2Codes.length === 1) {
|
|
2604
|
+
if (iso2Codes[0] === selectedIso2) {
|
|
2605
|
+
return null;
|
|
2606
|
+
}
|
|
2607
|
+
return iso2Codes[0];
|
|
2608
|
+
}
|
|
2597
2609
|
if (!selectedIso2 && this.defaultCountry && iso2Codes.includes(this.defaultCountry)) {
|
|
2598
2610
|
return this.defaultCountry;
|
|
2599
2611
|
}
|
|
2612
|
+
const isRegionlessNanpNumber = selectedDialCode === "1" && isRegionlessNanp(numeric);
|
|
2613
|
+
if (isRegionlessNanpNumber) {
|
|
2614
|
+
return null;
|
|
2615
|
+
}
|
|
2600
2616
|
const hasAreaCodesButNoneMatched = this.selectedCountryData.areaCodes && numeric.length > dialCodeMatchNumeric.length;
|
|
2601
2617
|
const alreadySelected = selectedIso2 && iso2Codes.includes(selectedIso2) && !hasAreaCodesButNoneMatched;
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
for (const iso2 of iso2Codes) {
|
|
2605
|
-
if (iso2) {
|
|
2606
|
-
return iso2;
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2618
|
+
if (!alreadySelected) {
|
|
2619
|
+
return iso2Codes[0];
|
|
2609
2620
|
}
|
|
2610
2621
|
} else if (number.charAt(0) === "+" && numeric.length) {
|
|
2611
2622
|
return "";
|
|
2612
|
-
} else if ((!number || number === "+") && !
|
|
2623
|
+
} else if ((!number || number === "+") && !selectedIso2) {
|
|
2613
2624
|
return this.defaultCountry;
|
|
2614
2625
|
}
|
|
2615
2626
|
return null;
|
|
@@ -3119,7 +3130,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3119
3130
|
attachUtils,
|
|
3120
3131
|
startedLoadingUtilsScript: false,
|
|
3121
3132
|
startedLoadingAutoCountry: false,
|
|
3122
|
-
version: "25.10.
|
|
3133
|
+
version: "25.10.6"
|
|
3123
3134
|
});
|
|
3124
3135
|
var intl_tel_input_default = intlTelInput;
|
|
3125
3136
|
|
package/build/js/data.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -1264,6 +1264,13 @@ var factoryOutput = (() => {
|
|
|
1264
1264
|
// Tuvalu
|
|
1265
1265
|
"688"
|
|
1266
1266
|
],
|
|
1267
|
+
[
|
|
1268
|
+
"vi",
|
|
1269
|
+
// U.S. Virgin Islands
|
|
1270
|
+
"1",
|
|
1271
|
+
24,
|
|
1272
|
+
["340"]
|
|
1273
|
+
],
|
|
1267
1274
|
[
|
|
1268
1275
|
"ug",
|
|
1269
1276
|
// Uganda
|
|
@@ -1298,13 +1305,6 @@ var factoryOutput = (() => {
|
|
|
1298
1305
|
// Uruguay
|
|
1299
1306
|
"598"
|
|
1300
1307
|
],
|
|
1301
|
-
[
|
|
1302
|
-
"vi",
|
|
1303
|
-
// U.S. Virgin Islands
|
|
1304
|
-
"1",
|
|
1305
|
-
24,
|
|
1306
|
-
["340"]
|
|
1307
|
-
],
|
|
1308
1308
|
[
|
|
1309
1309
|
"uz",
|
|
1310
1310
|
// Uzbekistan
|
package/build/js/data.min.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}(() => {
|
|
15
15
|
|
|
16
|
-
var factoryOutput=(()=>{var a=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(n,t)=>{for(var r in t)a(n,r,{get:t[r],enumerable:!0})},u=(n,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m(t))!g.call(n,s)&&s!==r&&a(n,s,{get:()=>t[s],enumerable:!(i=e(t,s))||i.enumerable});return n};var c=n=>u(a({},"__esModule",{value:!0}),n);var p={};o(p,{default:()=>b});var d=[["af","93"],["ax","358",1],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0,null,"0"],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"],"0"],["cc","61",1,["89162"],"0"],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"],"0"],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962"],["kz","7",1,["33","7"],"8"],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0,null,"0"],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0,null,"0"],["ro","40"],["ru","7",0,null,"8"],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0,null,"0"],["us","1",0],["uy","598"],["
|
|
16
|
+
var factoryOutput=(()=>{var a=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(n,t)=>{for(var r in t)a(n,r,{get:t[r],enumerable:!0})},u=(n,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m(t))!g.call(n,s)&&s!==r&&a(n,s,{get:()=>t[s],enumerable:!(i=e(t,s))||i.enumerable});return n};var c=n=>u(a({},"__esModule",{value:!0}),n);var p={};o(p,{default:()=>b});var d=[["af","93"],["ax","358",1],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0,null,"0"],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"],"0"],["cc","61",1,["89162"],"0"],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"],"0"],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962"],["kz","7",1,["33","7"],"8"],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0,null,"0"],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0,null,"0"],["ro","40"],["ru","7",0,null,"8"],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["vi","1",24,["340"]],["ug","256"],["ua","380"],["ae","971"],["gb","44",0,null,"0"],["us","1",0],["uy","598"],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"],"0"],["ye","967"],["zm","260"],["zw","263"]],l=[];for(let n of d)l.push({name:"",iso2:n[0],dialCode:n[1],priority:n[2]||0,areaCodes:n[3]||null,nodeById:{},nationalPrefix:n[4]||null});var b=l;return c(p);})();
|
|
17
17
|
|
|
18
18
|
// UMD
|
|
19
19
|
return factoryOutput.default;
|
|
@@ -3,10 +3,8 @@ const interfaceTranslations = {
|
|
|
3
3
|
noCountrySelected: "Nie wybrano kraju",
|
|
4
4
|
countryListAriaLabel: "Lista krajów",
|
|
5
5
|
searchPlaceholder: "Szukaj",
|
|
6
|
+
zeroSearchResults: "Nie znaleziono wyników",
|
|
6
7
|
searchResultsText(count) {
|
|
7
|
-
if (count === 0) {
|
|
8
|
-
return "Nie znaleziono wyników";
|
|
9
|
-
}
|
|
10
8
|
if (count === 1) {
|
|
11
9
|
return "Znaleziono 1 wynik";
|
|
12
10
|
}
|