intl-tel-input 26.1.1 → 26.3.0
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 +1 -1
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +100 -51
- package/angular/build/IntlTelInputWithUtils.js +100 -51
- package/angular/build/types/intl-tel-input.d.ts +2 -0
- package/angular/build/types/modules/constants.d.ts +1 -0
- package/angular/build/types/modules/core/icons.d.ts +2 -0
- package/build/css/intlTelInput-no-assets.css +51 -4
- package/build/css/intlTelInput-no-assets.min.css +1 -1
- package/build/css/intlTelInput.css +51 -4
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +5 -0
- package/build/js/intlTelInput.js +98 -49
- package/build/js/intlTelInput.min.js +7 -4
- package/build/js/intlTelInputWithUtils.js +98 -49
- package/build/js/intlTelInputWithUtils.min.js +7 -4
- package/package.json +3 -2
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +97 -48
- package/react/build/IntlTelInput.d.ts +5 -0
- package/react/build/IntlTelInput.js +97 -48
- package/react/build/IntlTelInputWithUtils.cjs +97 -48
- package/react/build/IntlTelInputWithUtils.js +97 -48
- package/svelte/README.md +1 -1
- package/svelte/build/IntlTelInput.mjs +523 -499
- package/svelte/build/IntlTelInputWithUtils.mjs +660 -636
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.vue.d.ts +4 -0
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +4 -0
- package/vue/build/exports/IntlTelInput.mjs +1 -1
- package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
- package/vue/build/{intl-tel-input-DzmRuv-V.mjs → intl-tel-input-DvSNu44J.mjs} +169 -145
- package/vue/build/intl-tel-input.d.ts +2 -0
- package/vue/build/modules/constants.d.ts +1 -0
- package/vue/build/modules/core/icons.d.ts +2 -0
- package/angular/build/types/intl-tel-input/i18n/ar/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ar/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bg/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bg/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bn/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bn/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bs/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bs/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ca/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ca/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/cs/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/cs/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/da/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/da/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/de/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/de/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ee/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ee/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ee/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/el/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/el/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/en/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/en/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/es/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/es/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fa/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fa/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fi/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fi/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fr/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fr/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hi/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hi/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hr/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hr/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hu/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hu/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/id/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/id/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/it/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/it/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ja/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ja/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ko/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ko/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/lt/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/lt/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/mr/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/mr/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/nl/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/nl/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/no/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/no/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pl/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pl/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pt/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pt/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ro/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ro/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ru/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ru/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sk/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sk/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sl/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sl/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sq/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sq/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sr/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sr/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sv/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sv/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/te/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/te/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/th/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/th/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/tr/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/tr/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uk/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uk/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ur/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ur/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uz/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uz/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/vi/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/vi/interface.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh/countries.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh/interface.d.ts +0 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A JavaScript plugin for entering, formatting and validating international telephone numbers. React, Vue, Angular and Svelte components also included.
|
|
4
4
|
|
|
5
|
-
[Explore docs »](https://intl-tel-input.com/docs/getting-started
|
|
5
|
+
[Explore docs »](https://intl-tel-input.com/docs/getting-started)
|
|
6
6
|
|
|
7
7
|
<picture>
|
|
8
8
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/vanilla-dark.png">
|
package/angular/README.md
CHANGED
|
@@ -54,7 +54,7 @@ import "intl-tel-input/styles";
|
|
|
54
54
|
|
|
55
55
|
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, or check out the [form demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/form/form.component.ts) for an alternative approach using `ReactiveFormsModule`.
|
|
56
56
|
|
|
57
|
-
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 { IntlTelInputComponent } 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 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@26.
|
|
57
|
+
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 { IntlTelInputComponent } 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 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@26.3.0/build/js/utils.js"`.
|
|
58
58
|
|
|
59
59
|
## Props
|
|
60
60
|
|
|
@@ -1713,6 +1713,7 @@ var CLASSES = {
|
|
|
1713
1713
|
ARROW_UP: "iti__arrow--up",
|
|
1714
1714
|
GLOBE: "iti__globe",
|
|
1715
1715
|
FLAG: "iti__flag",
|
|
1716
|
+
LOADING: "iti__loading",
|
|
1716
1717
|
COUNTRY_ITEM: "iti__country",
|
|
1717
1718
|
HIGHLIGHT: "iti__highlight"
|
|
1718
1719
|
};
|
|
@@ -1832,6 +1833,8 @@ var computeDefaultUseFullscreenPopup = () => {
|
|
|
1832
1833
|
var defaults = {
|
|
1833
1834
|
//* Whether or not to allow the dropdown.
|
|
1834
1835
|
allowDropdown: true,
|
|
1836
|
+
//* The number type to enforce during validation.
|
|
1837
|
+
allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
|
|
1835
1838
|
//* Whether or not to allow extensions after the main number.
|
|
1836
1839
|
allowNumberExtensions: false,
|
|
1837
1840
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
@@ -1881,9 +1884,7 @@ var defaults = {
|
|
|
1881
1884
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1882
1885
|
strictMode: false,
|
|
1883
1886
|
//* Use full screen popup instead of dropdown for country list.
|
|
1884
|
-
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
1885
|
-
//* The number type to enforce during validation.
|
|
1886
|
-
allowedNumberTypes: ["MOBILE", "FIXED_LINE"]
|
|
1887
|
+
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
1887
1888
|
};
|
|
1888
1889
|
var applyOptionSideEffects = (o) => {
|
|
1889
1890
|
if (o.useFullscreenPopup) {
|
|
@@ -1986,6 +1987,10 @@ var buildClearIcon = (id2) => {
|
|
|
1986
1987
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
1987
1988
|
</svg>`;
|
|
1988
1989
|
};
|
|
1990
|
+
var buildCheckIcon = () => `
|
|
1991
|
+
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${ARIA.HIDDEN}="true">
|
|
1992
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
|
1993
|
+
</svg>`;
|
|
1989
1994
|
var buildGlobeIcon = () => `
|
|
1990
1995
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
1991
1996
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
@@ -2213,7 +2218,7 @@ var UI = class {
|
|
|
2213
2218
|
}
|
|
2214
2219
|
const nameEl = createEl("span", { class: "iti__country-name" }, listItem);
|
|
2215
2220
|
nameEl.textContent = c.name;
|
|
2216
|
-
const dialEl = createEl("span", { class: "iti__dial-code" },
|
|
2221
|
+
const dialEl = createEl("span", { class: "iti__dial-code" }, nameEl);
|
|
2217
2222
|
if (this.isRTL) {
|
|
2218
2223
|
dialEl.setAttribute("dir", "ltr");
|
|
2219
2224
|
}
|
|
@@ -2298,15 +2303,20 @@ var UI = class {
|
|
|
2298
2303
|
this.highlightedItem.focus();
|
|
2299
2304
|
}
|
|
2300
2305
|
}
|
|
2306
|
+
// Update the selected list item in the dropdown
|
|
2301
2307
|
updateSelectedItem(iso2) {
|
|
2308
|
+
var _a;
|
|
2302
2309
|
if (this.selectedItem && this.selectedItem.dataset.countryCode !== iso2) {
|
|
2303
2310
|
this.selectedItem.setAttribute(ARIA.SELECTED, "false");
|
|
2311
|
+
(_a = this.selectedItem.querySelector(".iti__country-check")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2304
2312
|
this.selectedItem = null;
|
|
2305
2313
|
}
|
|
2306
2314
|
if (iso2 && !this.selectedItem) {
|
|
2307
2315
|
const newListItem = this.countryList.querySelector(`[data-country-code="${iso2}"]`);
|
|
2308
2316
|
if (newListItem) {
|
|
2309
2317
|
newListItem.setAttribute(ARIA.SELECTED, "true");
|
|
2318
|
+
const checkIcon = createEl("span", { class: "iti__country-check", [ARIA.HIDDEN]: "true" }, newListItem);
|
|
2319
|
+
checkIcon.innerHTML = buildCheckIcon();
|
|
2310
2320
|
this.selectedItem = newListItem;
|
|
2311
2321
|
}
|
|
2312
2322
|
}
|
|
@@ -2558,7 +2568,7 @@ var Iti = class {
|
|
|
2558
2568
|
applyOptionSideEffects(this.options);
|
|
2559
2569
|
this.ui = new UI(input, this.options, this.id);
|
|
2560
2570
|
this.isAndroid = getIsAndroid();
|
|
2561
|
-
this.promise = this._createInitPromises();
|
|
2571
|
+
this.promise = this._createInitPromises(this.options);
|
|
2562
2572
|
this.countries = processAllCountries(this.options);
|
|
2563
2573
|
const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries);
|
|
2564
2574
|
this.dialCodes = dialCodes;
|
|
@@ -2606,15 +2616,36 @@ var Iti = class {
|
|
|
2606
2616
|
_setTelInputValue(asciiValue) {
|
|
2607
2617
|
this.ui.telInput.value = this._mapAsciiToUserNumerals(asciiValue);
|
|
2608
2618
|
}
|
|
2609
|
-
_createInitPromises() {
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2619
|
+
_createInitPromises(options) {
|
|
2620
|
+
const { initialCountry, geoIpLookup, loadUtils } = options;
|
|
2621
|
+
const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
|
|
2622
|
+
const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
|
|
2623
|
+
let autoCountryPromise;
|
|
2624
|
+
if (needsAutoCountryPromise) {
|
|
2625
|
+
autoCountryPromise = new Promise((resolve, reject) => {
|
|
2626
|
+
this.resolveAutoCountryPromise = resolve;
|
|
2627
|
+
this.rejectAutoCountryPromise = reject;
|
|
2628
|
+
});
|
|
2629
|
+
} else {
|
|
2630
|
+
autoCountryPromise = Promise.resolve(void 0);
|
|
2631
|
+
this.resolveAutoCountryPromise = () => {
|
|
2632
|
+
};
|
|
2633
|
+
this.rejectAutoCountryPromise = () => {
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2636
|
+
let utilsScriptPromise;
|
|
2637
|
+
if (needsUtilsScriptPromise) {
|
|
2638
|
+
utilsScriptPromise = new Promise((resolve, reject) => {
|
|
2639
|
+
this.resolveUtilsScriptPromise = resolve;
|
|
2640
|
+
this.rejectUtilsScriptPromise = reject;
|
|
2641
|
+
});
|
|
2642
|
+
} else {
|
|
2643
|
+
utilsScriptPromise = Promise.resolve(void 0);
|
|
2644
|
+
this.resolveUtilsScriptPromise = () => {
|
|
2645
|
+
};
|
|
2646
|
+
this.rejectUtilsScriptPromise = () => {
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2618
2649
|
return Promise.all([autoCountryPromise, utilsScriptPromise]);
|
|
2619
2650
|
}
|
|
2620
2651
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
@@ -2649,19 +2680,23 @@ var Iti = class {
|
|
|
2649
2680
|
const isRegionlessNanpNumber = isRegionlessNanp(val);
|
|
2650
2681
|
const { initialCountry, geoIpLookup } = this.options;
|
|
2651
2682
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
if (
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
if (
|
|
2683
|
+
const doingAutoCountryLookup = isAutoCountry && !overrideAutoCountry;
|
|
2684
|
+
const initialCountryLower = initialCountry.toLowerCase();
|
|
2685
|
+
const isValidInitialCountry = isIso2(initialCountryLower);
|
|
2686
|
+
if (dialCode) {
|
|
2687
|
+
if (isRegionlessNanpNumber) {
|
|
2688
|
+
if (isValidInitialCountry) {
|
|
2689
|
+
this._setCountry(initialCountryLower);
|
|
2690
|
+
} else if (!doingAutoCountryLookup) {
|
|
2660
2691
|
this._setCountry(US.ISO2);
|
|
2661
|
-
} else {
|
|
2662
|
-
this._setCountry("");
|
|
2663
2692
|
}
|
|
2693
|
+
} else {
|
|
2694
|
+
this._updateCountryFromNumber(val);
|
|
2664
2695
|
}
|
|
2696
|
+
} else if (isValidInitialCountry) {
|
|
2697
|
+
this._setCountry(initialCountryLower);
|
|
2698
|
+
} else if (!doingAutoCountryLookup) {
|
|
2699
|
+
this._setCountry("");
|
|
2665
2700
|
}
|
|
2666
2701
|
if (val) {
|
|
2667
2702
|
this._updateValFromNumber(val);
|
|
@@ -2728,7 +2763,7 @@ var Iti = class {
|
|
|
2728
2763
|
};
|
|
2729
2764
|
this.ui.countryContainer.addEventListener("keydown", handleCountryContainerKeydown, { signal });
|
|
2730
2765
|
}
|
|
2731
|
-
//* Init
|
|
2766
|
+
//* Init requests: utils script / geo ip lookup.
|
|
2732
2767
|
_initRequests() {
|
|
2733
2768
|
const { loadUtils, initialCountry, geoIpLookup } = this.options;
|
|
2734
2769
|
if (loadUtils && !intlTelInput.utils) {
|
|
@@ -2751,32 +2786,39 @@ var Iti = class {
|
|
|
2751
2786
|
this.resolveUtilsScriptPromise();
|
|
2752
2787
|
}
|
|
2753
2788
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
2754
|
-
if (isAutoCountry
|
|
2755
|
-
this.
|
|
2756
|
-
|
|
2757
|
-
|
|
2789
|
+
if (isAutoCountry) {
|
|
2790
|
+
if (this.selectedCountryData.iso2) {
|
|
2791
|
+
this.resolveAutoCountryPromise();
|
|
2792
|
+
} else {
|
|
2793
|
+
this._loadAutoCountry();
|
|
2794
|
+
}
|
|
2758
2795
|
}
|
|
2759
2796
|
}
|
|
2760
2797
|
//* Perform the geo ip lookup.
|
|
2761
2798
|
_loadAutoCountry() {
|
|
2762
2799
|
if (intlTelInput.autoCountry) {
|
|
2763
2800
|
this.handleAutoCountry();
|
|
2764
|
-
} else
|
|
2765
|
-
|
|
2766
|
-
if (
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2801
|
+
} else {
|
|
2802
|
+
this.ui.selectedCountryInner.classList.add(CLASSES.LOADING);
|
|
2803
|
+
if (!intlTelInput.startedLoadingAutoCountry) {
|
|
2804
|
+
intlTelInput.startedLoadingAutoCountry = true;
|
|
2805
|
+
if (typeof this.options.geoIpLookup === "function") {
|
|
2806
|
+
const successCallback = (iso2 = "") => {
|
|
2807
|
+
this.ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
|
|
2808
|
+
const iso2Lower = iso2.toLowerCase();
|
|
2809
|
+
if (isIso2(iso2Lower)) {
|
|
2810
|
+
intlTelInput.autoCountry = iso2Lower;
|
|
2811
|
+
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2812
|
+
} else {
|
|
2813
|
+
forEachInstance("handleAutoCountryFailure");
|
|
2814
|
+
}
|
|
2815
|
+
};
|
|
2816
|
+
const failureCallback = () => {
|
|
2817
|
+
this.ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
|
|
2818
|
+
forEachInstance("handleAutoCountryFailure");
|
|
2819
|
+
};
|
|
2820
|
+
this.options.geoIpLookup(successCallback, failureCallback);
|
|
2821
|
+
}
|
|
2780
2822
|
}
|
|
2781
2823
|
}
|
|
2782
2824
|
}
|
|
@@ -3175,9 +3217,7 @@ var Iti = class {
|
|
|
3175
3217
|
const cleanNumber = hasPrefix ? number.substring(1) : number;
|
|
3176
3218
|
return `+${dialCode}${cleanNumber}`;
|
|
3177
3219
|
}
|
|
3178
|
-
|
|
3179
|
-
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
3180
|
-
// NOTE: consider refactoring this to be more clear
|
|
3220
|
+
//* Get the new country based on the input number, or return null if no change, or empty string if should be empty (e.g. if they type an invalid dial code).
|
|
3181
3221
|
_getNewCountryFromNumber(fullNumber) {
|
|
3182
3222
|
const plusIndex = fullNumber.indexOf("+");
|
|
3183
3223
|
let number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
|
|
@@ -3224,7 +3264,7 @@ var Iti = class {
|
|
|
3224
3264
|
return null;
|
|
3225
3265
|
}
|
|
3226
3266
|
return "";
|
|
3227
|
-
} else if ((!number || number === "+") && !selectedIso2) {
|
|
3267
|
+
} else if ((!number || number === "+") && !selectedIso2 && this.defaultCountry) {
|
|
3228
3268
|
return this.defaultCountry;
|
|
3229
3269
|
}
|
|
3230
3270
|
return null;
|
|
@@ -3428,6 +3468,11 @@ var Iti = class {
|
|
|
3428
3468
|
this.resolveAutoCountryPromise();
|
|
3429
3469
|
}
|
|
3430
3470
|
}
|
|
3471
|
+
//* This is called when the geoip call fails or times out.
|
|
3472
|
+
handleAutoCountryFailure() {
|
|
3473
|
+
this._setInitialState(true);
|
|
3474
|
+
this.rejectAutoCountryPromise();
|
|
3475
|
+
}
|
|
3431
3476
|
//* This is called when the utils request completes.
|
|
3432
3477
|
handleUtils() {
|
|
3433
3478
|
if (intlTelInput.utils) {
|
|
@@ -3442,6 +3487,10 @@ var Iti = class {
|
|
|
3442
3487
|
}
|
|
3443
3488
|
this.resolveUtilsScriptPromise();
|
|
3444
3489
|
}
|
|
3490
|
+
//* This is called when the utils request fails or times out.
|
|
3491
|
+
handleUtilsFailure(error) {
|
|
3492
|
+
this.rejectUtilsScriptPromise(error);
|
|
3493
|
+
}
|
|
3445
3494
|
//********************
|
|
3446
3495
|
//* PUBLIC METHODS
|
|
3447
3496
|
//********************
|
|
@@ -3610,7 +3659,7 @@ var attachUtils = (source) => {
|
|
|
3610
3659
|
forEachInstance("handleUtils");
|
|
3611
3660
|
return true;
|
|
3612
3661
|
}).catch((error) => {
|
|
3613
|
-
forEachInstance("
|
|
3662
|
+
forEachInstance("handleUtilsFailure", error);
|
|
3614
3663
|
throw error;
|
|
3615
3664
|
});
|
|
3616
3665
|
}
|
|
@@ -3645,7 +3694,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3645
3694
|
attachUtils,
|
|
3646
3695
|
startedLoadingUtilsScript: false,
|
|
3647
3696
|
startedLoadingAutoCountry: false,
|
|
3648
|
-
version: "26.
|
|
3697
|
+
version: "26.3.0"
|
|
3649
3698
|
});
|
|
3650
3699
|
var intl_tel_input_default = intlTelInput;
|
|
3651
3700
|
|
|
@@ -1713,6 +1713,7 @@ var CLASSES = {
|
|
|
1713
1713
|
ARROW_UP: "iti__arrow--up",
|
|
1714
1714
|
GLOBE: "iti__globe",
|
|
1715
1715
|
FLAG: "iti__flag",
|
|
1716
|
+
LOADING: "iti__loading",
|
|
1716
1717
|
COUNTRY_ITEM: "iti__country",
|
|
1717
1718
|
HIGHLIGHT: "iti__highlight"
|
|
1718
1719
|
};
|
|
@@ -1832,6 +1833,8 @@ var computeDefaultUseFullscreenPopup = () => {
|
|
|
1832
1833
|
var defaults = {
|
|
1833
1834
|
//* Whether or not to allow the dropdown.
|
|
1834
1835
|
allowDropdown: true,
|
|
1836
|
+
//* The number type to enforce during validation.
|
|
1837
|
+
allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
|
|
1835
1838
|
//* Whether or not to allow extensions after the main number.
|
|
1836
1839
|
allowNumberExtensions: false,
|
|
1837
1840
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
@@ -1881,9 +1884,7 @@ var defaults = {
|
|
|
1881
1884
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1882
1885
|
strictMode: false,
|
|
1883
1886
|
//* Use full screen popup instead of dropdown for country list.
|
|
1884
|
-
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
1885
|
-
//* The number type to enforce during validation.
|
|
1886
|
-
allowedNumberTypes: ["MOBILE", "FIXED_LINE"]
|
|
1887
|
+
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
1887
1888
|
};
|
|
1888
1889
|
var applyOptionSideEffects = (o) => {
|
|
1889
1890
|
if (o.useFullscreenPopup) {
|
|
@@ -1986,6 +1987,10 @@ var buildClearIcon = (id2) => {
|
|
|
1986
1987
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
1987
1988
|
</svg>`;
|
|
1988
1989
|
};
|
|
1990
|
+
var buildCheckIcon = () => `
|
|
1991
|
+
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${ARIA.HIDDEN}="true">
|
|
1992
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
|
1993
|
+
</svg>`;
|
|
1989
1994
|
var buildGlobeIcon = () => `
|
|
1990
1995
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
1991
1996
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
@@ -2213,7 +2218,7 @@ var UI = class {
|
|
|
2213
2218
|
}
|
|
2214
2219
|
const nameEl = createEl("span", { class: "iti__country-name" }, listItem);
|
|
2215
2220
|
nameEl.textContent = c.name;
|
|
2216
|
-
const dialEl = createEl("span", { class: "iti__dial-code" },
|
|
2221
|
+
const dialEl = createEl("span", { class: "iti__dial-code" }, nameEl);
|
|
2217
2222
|
if (this.isRTL) {
|
|
2218
2223
|
dialEl.setAttribute("dir", "ltr");
|
|
2219
2224
|
}
|
|
@@ -2298,15 +2303,20 @@ var UI = class {
|
|
|
2298
2303
|
this.highlightedItem.focus();
|
|
2299
2304
|
}
|
|
2300
2305
|
}
|
|
2306
|
+
// Update the selected list item in the dropdown
|
|
2301
2307
|
updateSelectedItem(iso2) {
|
|
2308
|
+
var _a;
|
|
2302
2309
|
if (this.selectedItem && this.selectedItem.dataset.countryCode !== iso2) {
|
|
2303
2310
|
this.selectedItem.setAttribute(ARIA.SELECTED, "false");
|
|
2311
|
+
(_a = this.selectedItem.querySelector(".iti__country-check")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2304
2312
|
this.selectedItem = null;
|
|
2305
2313
|
}
|
|
2306
2314
|
if (iso2 && !this.selectedItem) {
|
|
2307
2315
|
const newListItem = this.countryList.querySelector(`[data-country-code="${iso2}"]`);
|
|
2308
2316
|
if (newListItem) {
|
|
2309
2317
|
newListItem.setAttribute(ARIA.SELECTED, "true");
|
|
2318
|
+
const checkIcon = createEl("span", { class: "iti__country-check", [ARIA.HIDDEN]: "true" }, newListItem);
|
|
2319
|
+
checkIcon.innerHTML = buildCheckIcon();
|
|
2310
2320
|
this.selectedItem = newListItem;
|
|
2311
2321
|
}
|
|
2312
2322
|
}
|
|
@@ -2558,7 +2568,7 @@ var Iti = class {
|
|
|
2558
2568
|
applyOptionSideEffects(this.options);
|
|
2559
2569
|
this.ui = new UI(input, this.options, this.id);
|
|
2560
2570
|
this.isAndroid = getIsAndroid();
|
|
2561
|
-
this.promise = this._createInitPromises();
|
|
2571
|
+
this.promise = this._createInitPromises(this.options);
|
|
2562
2572
|
this.countries = processAllCountries(this.options);
|
|
2563
2573
|
const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries);
|
|
2564
2574
|
this.dialCodes = dialCodes;
|
|
@@ -2606,15 +2616,36 @@ var Iti = class {
|
|
|
2606
2616
|
_setTelInputValue(asciiValue) {
|
|
2607
2617
|
this.ui.telInput.value = this._mapAsciiToUserNumerals(asciiValue);
|
|
2608
2618
|
}
|
|
2609
|
-
_createInitPromises() {
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2619
|
+
_createInitPromises(options) {
|
|
2620
|
+
const { initialCountry, geoIpLookup, loadUtils } = options;
|
|
2621
|
+
const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
|
|
2622
|
+
const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
|
|
2623
|
+
let autoCountryPromise;
|
|
2624
|
+
if (needsAutoCountryPromise) {
|
|
2625
|
+
autoCountryPromise = new Promise((resolve, reject) => {
|
|
2626
|
+
this.resolveAutoCountryPromise = resolve;
|
|
2627
|
+
this.rejectAutoCountryPromise = reject;
|
|
2628
|
+
});
|
|
2629
|
+
} else {
|
|
2630
|
+
autoCountryPromise = Promise.resolve(void 0);
|
|
2631
|
+
this.resolveAutoCountryPromise = () => {
|
|
2632
|
+
};
|
|
2633
|
+
this.rejectAutoCountryPromise = () => {
|
|
2634
|
+
};
|
|
2635
|
+
}
|
|
2636
|
+
let utilsScriptPromise;
|
|
2637
|
+
if (needsUtilsScriptPromise) {
|
|
2638
|
+
utilsScriptPromise = new Promise((resolve, reject) => {
|
|
2639
|
+
this.resolveUtilsScriptPromise = resolve;
|
|
2640
|
+
this.rejectUtilsScriptPromise = reject;
|
|
2641
|
+
});
|
|
2642
|
+
} else {
|
|
2643
|
+
utilsScriptPromise = Promise.resolve(void 0);
|
|
2644
|
+
this.resolveUtilsScriptPromise = () => {
|
|
2645
|
+
};
|
|
2646
|
+
this.rejectUtilsScriptPromise = () => {
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2618
2649
|
return Promise.all([autoCountryPromise, utilsScriptPromise]);
|
|
2619
2650
|
}
|
|
2620
2651
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
@@ -2649,19 +2680,23 @@ var Iti = class {
|
|
|
2649
2680
|
const isRegionlessNanpNumber = isRegionlessNanp(val);
|
|
2650
2681
|
const { initialCountry, geoIpLookup } = this.options;
|
|
2651
2682
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
if (
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
if (
|
|
2683
|
+
const doingAutoCountryLookup = isAutoCountry && !overrideAutoCountry;
|
|
2684
|
+
const initialCountryLower = initialCountry.toLowerCase();
|
|
2685
|
+
const isValidInitialCountry = isIso2(initialCountryLower);
|
|
2686
|
+
if (dialCode) {
|
|
2687
|
+
if (isRegionlessNanpNumber) {
|
|
2688
|
+
if (isValidInitialCountry) {
|
|
2689
|
+
this._setCountry(initialCountryLower);
|
|
2690
|
+
} else if (!doingAutoCountryLookup) {
|
|
2660
2691
|
this._setCountry(US.ISO2);
|
|
2661
|
-
} else {
|
|
2662
|
-
this._setCountry("");
|
|
2663
2692
|
}
|
|
2693
|
+
} else {
|
|
2694
|
+
this._updateCountryFromNumber(val);
|
|
2664
2695
|
}
|
|
2696
|
+
} else if (isValidInitialCountry) {
|
|
2697
|
+
this._setCountry(initialCountryLower);
|
|
2698
|
+
} else if (!doingAutoCountryLookup) {
|
|
2699
|
+
this._setCountry("");
|
|
2665
2700
|
}
|
|
2666
2701
|
if (val) {
|
|
2667
2702
|
this._updateValFromNumber(val);
|
|
@@ -2728,7 +2763,7 @@ var Iti = class {
|
|
|
2728
2763
|
};
|
|
2729
2764
|
this.ui.countryContainer.addEventListener("keydown", handleCountryContainerKeydown, { signal });
|
|
2730
2765
|
}
|
|
2731
|
-
//* Init
|
|
2766
|
+
//* Init requests: utils script / geo ip lookup.
|
|
2732
2767
|
_initRequests() {
|
|
2733
2768
|
const { loadUtils, initialCountry, geoIpLookup } = this.options;
|
|
2734
2769
|
if (loadUtils && !intlTelInput.utils) {
|
|
@@ -2751,32 +2786,39 @@ var Iti = class {
|
|
|
2751
2786
|
this.resolveUtilsScriptPromise();
|
|
2752
2787
|
}
|
|
2753
2788
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
2754
|
-
if (isAutoCountry
|
|
2755
|
-
this.
|
|
2756
|
-
|
|
2757
|
-
|
|
2789
|
+
if (isAutoCountry) {
|
|
2790
|
+
if (this.selectedCountryData.iso2) {
|
|
2791
|
+
this.resolveAutoCountryPromise();
|
|
2792
|
+
} else {
|
|
2793
|
+
this._loadAutoCountry();
|
|
2794
|
+
}
|
|
2758
2795
|
}
|
|
2759
2796
|
}
|
|
2760
2797
|
//* Perform the geo ip lookup.
|
|
2761
2798
|
_loadAutoCountry() {
|
|
2762
2799
|
if (intlTelInput.autoCountry) {
|
|
2763
2800
|
this.handleAutoCountry();
|
|
2764
|
-
} else
|
|
2765
|
-
|
|
2766
|
-
if (
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2801
|
+
} else {
|
|
2802
|
+
this.ui.selectedCountryInner.classList.add(CLASSES.LOADING);
|
|
2803
|
+
if (!intlTelInput.startedLoadingAutoCountry) {
|
|
2804
|
+
intlTelInput.startedLoadingAutoCountry = true;
|
|
2805
|
+
if (typeof this.options.geoIpLookup === "function") {
|
|
2806
|
+
const successCallback = (iso2 = "") => {
|
|
2807
|
+
this.ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
|
|
2808
|
+
const iso2Lower = iso2.toLowerCase();
|
|
2809
|
+
if (isIso2(iso2Lower)) {
|
|
2810
|
+
intlTelInput.autoCountry = iso2Lower;
|
|
2811
|
+
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2812
|
+
} else {
|
|
2813
|
+
forEachInstance("handleAutoCountryFailure");
|
|
2814
|
+
}
|
|
2815
|
+
};
|
|
2816
|
+
const failureCallback = () => {
|
|
2817
|
+
this.ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
|
|
2818
|
+
forEachInstance("handleAutoCountryFailure");
|
|
2819
|
+
};
|
|
2820
|
+
this.options.geoIpLookup(successCallback, failureCallback);
|
|
2821
|
+
}
|
|
2780
2822
|
}
|
|
2781
2823
|
}
|
|
2782
2824
|
}
|
|
@@ -3175,9 +3217,7 @@ var Iti = class {
|
|
|
3175
3217
|
const cleanNumber = hasPrefix ? number.substring(1) : number;
|
|
3176
3218
|
return `+${dialCode}${cleanNumber}`;
|
|
3177
3219
|
}
|
|
3178
|
-
|
|
3179
|
-
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
3180
|
-
// NOTE: consider refactoring this to be more clear
|
|
3220
|
+
//* Get the new country based on the input number, or return null if no change, or empty string if should be empty (e.g. if they type an invalid dial code).
|
|
3181
3221
|
_getNewCountryFromNumber(fullNumber) {
|
|
3182
3222
|
const plusIndex = fullNumber.indexOf("+");
|
|
3183
3223
|
let number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
|
|
@@ -3224,7 +3264,7 @@ var Iti = class {
|
|
|
3224
3264
|
return null;
|
|
3225
3265
|
}
|
|
3226
3266
|
return "";
|
|
3227
|
-
} else if ((!number || number === "+") && !selectedIso2) {
|
|
3267
|
+
} else if ((!number || number === "+") && !selectedIso2 && this.defaultCountry) {
|
|
3228
3268
|
return this.defaultCountry;
|
|
3229
3269
|
}
|
|
3230
3270
|
return null;
|
|
@@ -3428,6 +3468,11 @@ var Iti = class {
|
|
|
3428
3468
|
this.resolveAutoCountryPromise();
|
|
3429
3469
|
}
|
|
3430
3470
|
}
|
|
3471
|
+
//* This is called when the geoip call fails or times out.
|
|
3472
|
+
handleAutoCountryFailure() {
|
|
3473
|
+
this._setInitialState(true);
|
|
3474
|
+
this.rejectAutoCountryPromise();
|
|
3475
|
+
}
|
|
3431
3476
|
//* This is called when the utils request completes.
|
|
3432
3477
|
handleUtils() {
|
|
3433
3478
|
if (intlTelInput.utils) {
|
|
@@ -3442,6 +3487,10 @@ var Iti = class {
|
|
|
3442
3487
|
}
|
|
3443
3488
|
this.resolveUtilsScriptPromise();
|
|
3444
3489
|
}
|
|
3490
|
+
//* This is called when the utils request fails or times out.
|
|
3491
|
+
handleUtilsFailure(error) {
|
|
3492
|
+
this.rejectUtilsScriptPromise(error);
|
|
3493
|
+
}
|
|
3445
3494
|
//********************
|
|
3446
3495
|
//* PUBLIC METHODS
|
|
3447
3496
|
//********************
|
|
@@ -3610,7 +3659,7 @@ var attachUtils = (source) => {
|
|
|
3610
3659
|
forEachInstance("handleUtils");
|
|
3611
3660
|
return true;
|
|
3612
3661
|
}).catch((error) => {
|
|
3613
|
-
forEachInstance("
|
|
3662
|
+
forEachInstance("handleUtilsFailure", error);
|
|
3614
3663
|
throw error;
|
|
3615
3664
|
});
|
|
3616
3665
|
}
|
|
@@ -3645,7 +3694,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3645
3694
|
attachUtils,
|
|
3646
3695
|
startedLoadingUtilsScript: false,
|
|
3647
3696
|
startedLoadingAutoCountry: false,
|
|
3648
|
-
version: "26.
|
|
3697
|
+
version: "26.3.0"
|
|
3649
3698
|
});
|
|
3650
3699
|
var intl_tel_input_default = intlTelInput;
|
|
3651
3700
|
|
|
@@ -75,7 +75,9 @@ export declare class Iti {
|
|
|
75
75
|
private _beforeSetNumber;
|
|
76
76
|
private _triggerCountryChange;
|
|
77
77
|
handleAutoCountry(): void;
|
|
78
|
+
handleAutoCountryFailure(): void;
|
|
78
79
|
handleUtils(): void;
|
|
80
|
+
handleUtilsFailure(error: any): void;
|
|
79
81
|
destroy(): void;
|
|
80
82
|
getExtension(): string;
|
|
81
83
|
getNumber(format?: number): string;
|
|
@@ -5,5 +5,7 @@ export declare const buildSearchIcon: () => string;
|
|
|
5
5
|
* @param id Instance id used to create a unique mask id.
|
|
6
6
|
*/
|
|
7
7
|
export declare const buildClearIcon: (id: number) => string;
|
|
8
|
+
/** Check icon shown next to the selected country in the dropdown. */
|
|
9
|
+
export declare const buildCheckIcon: () => string;
|
|
8
10
|
/** Globe icon used when no country is selected */
|
|
9
11
|
export declare const buildGlobeIcon: () => string;
|