intl-tel-input 27.3.1 → 28.0.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/dist/css/intlTelInput-no-assets.css +2 -2
- package/dist/css/intlTelInput.css +3 -3
- package/dist/js/data.js +2 -2
- package/dist/js/data.min.js +1 -1
- package/dist/js/data.mjs +1 -1
- package/dist/js/i18n.d.ts +1 -1592
- package/dist/js/intlTelInput.d.ts +61 -45
- package/dist/js/intlTelInput.js +109 -104
- package/dist/js/intlTelInput.min.js +6 -6
- package/dist/js/intlTelInput.mjs +107 -102
- package/dist/js/intlTelInputWithUtils.js +510 -490
- package/dist/js/intlTelInputWithUtils.min.js +9 -9
- package/dist/js/intlTelInputWithUtils.mjs +508 -488
- package/dist/js/utils.js +56 -55
- package/package.json +14 -181
- package/CHANGELOG.md +0 -33
- package/angular/README.md +0 -13
- package/angular/dist/IntlTelInput.d.ts +0 -110
- package/angular/dist/IntlTelInput.js +0 -5130
- package/angular/dist/IntlTelInputWithUtils.d.ts +0 -3
- package/angular/dist/IntlTelInputWithUtils.js +0 -11469
- package/react/README.md +0 -13
- package/react/dist/IntlTelInput.d.ts +0 -25
- package/react/dist/IntlTelInput.js +0 -4822
- package/react/dist/IntlTelInputWithUtils.d.ts +0 -4
- package/react/dist/IntlTelInputWithUtils.js +0 -11161
- package/svelte/README.md +0 -14
- package/svelte/src/IntlTelInput.svelte +0 -233
- package/svelte/src/IntlTelInput.svelte.d.ts +0 -36
- package/svelte/src/IntlTelInputWithUtils.svelte +0 -24
- package/vue/README.md +0 -14
- package/vue/dist/IntlTelInput-DWpqqgvZ.js +0 -2684
- package/vue/dist/IntlTelInput.js +0 -5
- package/vue/dist/IntlTelInput.vue.d.ts +0 -43
- package/vue/dist/IntlTelInputWithUtils.js +0 -49403
- package/vue/dist/index.d.ts +0 -4
- package/vue/dist/indexWithUtils.d.ts +0 -3
package/dist/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input
|
|
2
|
+
* International Telephone Input v28.0.0
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -23,14 +23,17 @@ var _factory = (() => {
|
|
|
23
23
|
};
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
|
|
26
|
-
// src/js/intlTelInput.ts
|
|
26
|
+
// packages/core/src/js/intlTelInput.ts
|
|
27
27
|
var intlTelInput_exports = {};
|
|
28
28
|
__export(intlTelInput_exports, {
|
|
29
29
|
Iti: () => Iti,
|
|
30
|
+
NUMBER_FORMAT: () => NUMBER_FORMAT,
|
|
31
|
+
NUMBER_TYPE: () => NUMBER_TYPE,
|
|
32
|
+
VALIDATION_ERROR: () => VALIDATION_ERROR,
|
|
30
33
|
default: () => intlTelInput_default
|
|
31
34
|
});
|
|
32
35
|
|
|
33
|
-
// src/js/data.ts
|
|
36
|
+
// packages/core/src/js/data.ts
|
|
34
37
|
var rawCountryData = [
|
|
35
38
|
[
|
|
36
39
|
"af",
|
|
@@ -1782,7 +1785,7 @@ var _factory = (() => {
|
|
|
1782
1785
|
var isIso2 = (val) => iso2Set.has(val);
|
|
1783
1786
|
var data_default = allCountries;
|
|
1784
1787
|
|
|
1785
|
-
// src/js/constants.ts
|
|
1788
|
+
// packages/core/src/js/constants.ts
|
|
1786
1789
|
var EVENTS = {
|
|
1787
1790
|
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
1788
1791
|
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
@@ -1828,10 +1831,6 @@ var _factory = (() => {
|
|
|
1828
1831
|
HIDDEN_SEARCH_RESET_MS: 1e3,
|
|
1829
1832
|
NEXT_TICK: 0
|
|
1830
1833
|
};
|
|
1831
|
-
var SENTINELS = {
|
|
1832
|
-
UNKNOWN_NUMBER_TYPE: -99,
|
|
1833
|
-
UNKNOWN_VALIDATION_ERROR: -99
|
|
1834
|
-
};
|
|
1835
1834
|
var LAYOUT = {
|
|
1836
1835
|
NARROW_VIEWPORT_WIDTH: 500,
|
|
1837
1836
|
// keep in sync with .iti__country-list CSS media query
|
|
@@ -1873,6 +1872,12 @@ var _factory = (() => {
|
|
|
1873
1872
|
var INITIAL_COUNTRY = {
|
|
1874
1873
|
AUTO: "auto"
|
|
1875
1874
|
};
|
|
1875
|
+
var NUMBER_FORMATS = [
|
|
1876
|
+
"E164",
|
|
1877
|
+
"INTERNATIONAL",
|
|
1878
|
+
"NATIONAL",
|
|
1879
|
+
"RFC3966"
|
|
1880
|
+
];
|
|
1876
1881
|
var NUMBER_TYPES = [
|
|
1877
1882
|
"FIXED_LINE",
|
|
1878
1883
|
"MOBILE",
|
|
@@ -1887,11 +1892,21 @@ var _factory = (() => {
|
|
|
1887
1892
|
"VOICEMAIL",
|
|
1888
1893
|
"UNKNOWN"
|
|
1889
1894
|
];
|
|
1890
|
-
var
|
|
1895
|
+
var VALIDATION_ERRORS = [
|
|
1896
|
+
"IS_POSSIBLE",
|
|
1897
|
+
"INVALID_COUNTRY_CODE",
|
|
1898
|
+
"TOO_SHORT",
|
|
1899
|
+
"TOO_LONG",
|
|
1900
|
+
"IS_POSSIBLE_LOCAL_ONLY",
|
|
1901
|
+
"INVALID_LENGTH"
|
|
1902
|
+
];
|
|
1903
|
+
var toEnumObject = (arr) => Object.fromEntries(arr.map((v) => [v, v]));
|
|
1904
|
+
var NUMBER_FORMAT = toEnumObject(NUMBER_FORMATS);
|
|
1905
|
+
var NUMBER_TYPE = toEnumObject(NUMBER_TYPES);
|
|
1906
|
+
var VALIDATION_ERROR = toEnumObject(VALIDATION_ERRORS);
|
|
1891
1907
|
var DATA_KEYS = {
|
|
1892
|
-
// e.g. <li data-
|
|
1893
|
-
|
|
1894
|
-
ISO2: "countryCode",
|
|
1908
|
+
// e.g. <li data-iso2="us"> for country items in dropdown
|
|
1909
|
+
ISO2: "iso2",
|
|
1895
1910
|
DIAL_CODE: "dialCode",
|
|
1896
1911
|
// e.g. <input data-intl-tel-input-id="0"> on the input element
|
|
1897
1912
|
INSTANCE_ID: "intlTelInputId"
|
|
@@ -1908,7 +1923,7 @@ var _factory = (() => {
|
|
|
1908
1923
|
MODAL: "aria-modal"
|
|
1909
1924
|
};
|
|
1910
1925
|
|
|
1911
|
-
// src/js/i18n/en.ts
|
|
1926
|
+
// packages/core/src/js/i18n/en.ts
|
|
1912
1927
|
var interfaceTranslations = {
|
|
1913
1928
|
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1914
1929
|
noCountrySelected: "Select country for phone number",
|
|
@@ -1928,7 +1943,7 @@ var _factory = (() => {
|
|
|
1928
1943
|
};
|
|
1929
1944
|
var en_default = interfaceTranslations;
|
|
1930
1945
|
|
|
1931
|
-
// src/js/core/options.ts
|
|
1946
|
+
// packages/core/src/js/core/options.ts
|
|
1932
1947
|
var mediaQuery = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1933
1948
|
var isNarrowViewport = () => mediaQuery(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
|
|
1934
1949
|
var computeDefaultUseFullscreenPopup = () => {
|
|
@@ -1943,7 +1958,7 @@ var _factory = (() => {
|
|
|
1943
1958
|
//* Whether or not to allow the dropdown.
|
|
1944
1959
|
allowDropdown: true,
|
|
1945
1960
|
//* The number type to enforce during validation.
|
|
1946
|
-
allowedNumberTypes: [
|
|
1961
|
+
allowedNumberTypes: [NUMBER_TYPE.MOBILE, NUMBER_TYPE.FIXED_LINE],
|
|
1947
1962
|
//* Whether or not to allow extensions after the main number.
|
|
1948
1963
|
allowNumberExtensions: false,
|
|
1949
1964
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
@@ -1954,6 +1969,8 @@ var _factory = (() => {
|
|
|
1954
1969
|
containerClass: "",
|
|
1955
1970
|
//* Locale for localising country names via Intl.DisplayNames.
|
|
1956
1971
|
countryNameLocale: "en",
|
|
1972
|
+
//* Override individual country names by iso2 code.
|
|
1973
|
+
countryNameOverrides: {},
|
|
1957
1974
|
//* The order of the countries in the dropdown. Defaults to alphabetical.
|
|
1958
1975
|
countryOrder: null,
|
|
1959
1976
|
//* Add a country search input at the top of the dropdown.
|
|
@@ -1987,17 +2004,17 @@ var _factory = (() => {
|
|
|
1987
2004
|
//* Display only these countries.
|
|
1988
2005
|
onlyCountries: null,
|
|
1989
2006
|
//* Number type to use for placeholders.
|
|
1990
|
-
placeholderNumberType:
|
|
2007
|
+
placeholderNumberType: NUMBER_TYPE.MOBILE,
|
|
1991
2008
|
//* Add custom classes to the search input element.
|
|
1992
2009
|
searchInputClass: "",
|
|
1993
2010
|
//* Display the international dial code next to the selected flag.
|
|
1994
|
-
separateDialCode:
|
|
2011
|
+
separateDialCode: true,
|
|
1995
2012
|
//* When strictMode rejects a key (etc), play a short feedback animation
|
|
1996
|
-
strictRejectAnimation:
|
|
2013
|
+
strictRejectAnimation: true,
|
|
1997
2014
|
//* Show flags - for both the selected country, and in the country dropdown
|
|
1998
2015
|
showFlags: true,
|
|
1999
2016
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
2000
|
-
strictMode:
|
|
2017
|
+
strictMode: true,
|
|
2001
2018
|
//* Use full screen popup instead of dropdown for country list.
|
|
2002
2019
|
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
2003
2020
|
};
|
|
@@ -2141,6 +2158,13 @@ var _factory = (() => {
|
|
|
2141
2158
|
}
|
|
2142
2159
|
validatedOptions[key] = value;
|
|
2143
2160
|
break;
|
|
2161
|
+
case "countryNameOverrides":
|
|
2162
|
+
if (value && !isPlainObject(value)) {
|
|
2163
|
+
warnOption("countryNameOverrides", "an object", value);
|
|
2164
|
+
break;
|
|
2165
|
+
}
|
|
2166
|
+
validatedOptions[key] = value;
|
|
2167
|
+
break;
|
|
2144
2168
|
case "initialCountry": {
|
|
2145
2169
|
if (typeof value !== "string") {
|
|
2146
2170
|
warnOption("initialCountry", "a string", value);
|
|
@@ -2159,8 +2183,8 @@ var _factory = (() => {
|
|
|
2159
2183
|
break;
|
|
2160
2184
|
}
|
|
2161
2185
|
case "placeholderNumberType":
|
|
2162
|
-
if (typeof value !== "string" || !
|
|
2163
|
-
const validTypes =
|
|
2186
|
+
if (typeof value !== "string" || !NUMBER_TYPES.includes(value)) {
|
|
2187
|
+
const validTypes = NUMBER_TYPES.join(", ");
|
|
2164
2188
|
warnOption("placeholderNumberType", `one of ${validTypes}`, value);
|
|
2165
2189
|
break;
|
|
2166
2190
|
}
|
|
@@ -2178,8 +2202,8 @@ var _factory = (() => {
|
|
|
2178
2202
|
}
|
|
2179
2203
|
let allValid = true;
|
|
2180
2204
|
for (const v of value) {
|
|
2181
|
-
if (typeof v !== "string" || !
|
|
2182
|
-
const validTypes =
|
|
2205
|
+
if (typeof v !== "string" || !NUMBER_TYPES.includes(v)) {
|
|
2206
|
+
const validTypes = NUMBER_TYPES.join(", ");
|
|
2183
2207
|
warnOption(
|
|
2184
2208
|
"allowedNumberTypes",
|
|
2185
2209
|
`an array of valid number types (${validTypes})`,
|
|
@@ -2241,11 +2265,11 @@ var _factory = (() => {
|
|
|
2241
2265
|
o.i18n = { ...en_default, ...o.i18n };
|
|
2242
2266
|
};
|
|
2243
2267
|
|
|
2244
|
-
// src/js/helpers/string.ts
|
|
2268
|
+
// packages/core/src/js/helpers/string.ts
|
|
2245
2269
|
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
2246
2270
|
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
2247
2271
|
|
|
2248
|
-
// src/js/helpers/dom.ts
|
|
2272
|
+
// packages/core/src/js/helpers/dom.ts
|
|
2249
2273
|
var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
|
|
2250
2274
|
var createEl = (tagName, attrs, container) => {
|
|
2251
2275
|
const el = document.createElement(tagName);
|
|
@@ -2260,7 +2284,7 @@ var _factory = (() => {
|
|
|
2260
2284
|
return el;
|
|
2261
2285
|
};
|
|
2262
2286
|
|
|
2263
|
-
// src/js/core/icons.ts
|
|
2287
|
+
// packages/core/src/js/core/icons.ts
|
|
2264
2288
|
var buildSearchIcon = () => `
|
|
2265
2289
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
|
|
2266
2290
|
<circle cx="11" cy="11" r="7" />
|
|
@@ -2287,7 +2311,7 @@ var _factory = (() => {
|
|
|
2287
2311
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
2288
2312
|
</svg>`;
|
|
2289
2313
|
|
|
2290
|
-
// src/js/core/countrySearch.ts
|
|
2314
|
+
// packages/core/src/js/core/countrySearch.ts
|
|
2291
2315
|
var buildSearchTokens = (countries) => {
|
|
2292
2316
|
const tokens = /* @__PURE__ */ new Map();
|
|
2293
2317
|
for (const c of countries) {
|
|
@@ -2347,7 +2371,7 @@ var _factory = (() => {
|
|
|
2347
2371
|
return null;
|
|
2348
2372
|
};
|
|
2349
2373
|
|
|
2350
|
-
// src/js/core/numerals.ts
|
|
2374
|
+
// packages/core/src/js/core/numerals.ts
|
|
2351
2375
|
var Numerals = class _Numerals {
|
|
2352
2376
|
#userNumeralSet;
|
|
2353
2377
|
//* Stateless conversion of any Arabic-Indic / Persian digits to ASCII 0-9.
|
|
@@ -2405,7 +2429,7 @@ var _factory = (() => {
|
|
|
2405
2429
|
}
|
|
2406
2430
|
};
|
|
2407
2431
|
|
|
2408
|
-
// src/js/core/ui.ts
|
|
2432
|
+
// packages/core/src/js/core/ui.ts
|
|
2409
2433
|
var UI = class _UI {
|
|
2410
2434
|
// private
|
|
2411
2435
|
#options;
|
|
@@ -3158,7 +3182,7 @@ var _factory = (() => {
|
|
|
3158
3182
|
}
|
|
3159
3183
|
if (iso2 && !this.#selectedListItemEl) {
|
|
3160
3184
|
const newListItem = this.#countryListEl.querySelector(
|
|
3161
|
-
`[data-
|
|
3185
|
+
`[data-iso2="${iso2}"]`
|
|
3162
3186
|
);
|
|
3163
3187
|
if (newListItem) {
|
|
3164
3188
|
newListItem.setAttribute(ARIA.SELECTED, "true");
|
|
@@ -3346,7 +3370,7 @@ var _factory = (() => {
|
|
|
3346
3370
|
}
|
|
3347
3371
|
};
|
|
3348
3372
|
|
|
3349
|
-
// src/js/data/country-data.ts
|
|
3373
|
+
// packages/core/src/js/data/country-data.ts
|
|
3350
3374
|
var processAllCountries = (options) => {
|
|
3351
3375
|
const { onlyCountries, excludeCountries } = options;
|
|
3352
3376
|
if (onlyCountries?.length) {
|
|
@@ -3361,7 +3385,7 @@ var _factory = (() => {
|
|
|
3361
3385
|
return [...data_default];
|
|
3362
3386
|
};
|
|
3363
3387
|
var generateCountryNames = (countries, options) => {
|
|
3364
|
-
const { countryNameLocale,
|
|
3388
|
+
const { countryNameLocale, countryNameOverrides } = options;
|
|
3365
3389
|
let displayNames;
|
|
3366
3390
|
try {
|
|
3367
3391
|
const hasDisplayNames = typeof Intl !== "undefined" && typeof Intl.DisplayNames === "function";
|
|
@@ -3377,7 +3401,7 @@ var _factory = (() => {
|
|
|
3377
3401
|
displayNames = null;
|
|
3378
3402
|
}
|
|
3379
3403
|
for (const c of countries) {
|
|
3380
|
-
c.name =
|
|
3404
|
+
c.name = countryNameOverrides[c.iso2] || displayNames?.of(c.iso2.toUpperCase()) || "";
|
|
3381
3405
|
}
|
|
3382
3406
|
};
|
|
3383
3407
|
var processDialCodes = (countries) => {
|
|
@@ -3446,7 +3470,7 @@ var _factory = (() => {
|
|
|
3446
3470
|
});
|
|
3447
3471
|
};
|
|
3448
3472
|
|
|
3449
|
-
// src/js/data/intl-regionless.ts
|
|
3473
|
+
// packages/core/src/js/data/intl-regionless.ts
|
|
3450
3474
|
var regionlessDialCodes = /* @__PURE__ */ new Set([
|
|
3451
3475
|
"800",
|
|
3452
3476
|
"808",
|
|
@@ -3462,7 +3486,7 @@ var _factory = (() => {
|
|
|
3462
3486
|
return number.startsWith("+") && regionlessDialCodes.has(dialCode);
|
|
3463
3487
|
};
|
|
3464
3488
|
|
|
3465
|
-
// src/js/format/formatting.ts
|
|
3489
|
+
// packages/core/src/js/format/formatting.ts
|
|
3466
3490
|
var stripSeparateDialCode = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
|
|
3467
3491
|
if (!separateDialCode || !hasValidDialCode) {
|
|
3468
3492
|
return fullNumber;
|
|
@@ -3481,7 +3505,7 @@ var _factory = (() => {
|
|
|
3481
3505
|
return result;
|
|
3482
3506
|
};
|
|
3483
3507
|
|
|
3484
|
-
// src/js/format/caret.ts
|
|
3508
|
+
// packages/core/src/js/format/caret.ts
|
|
3485
3509
|
var computeNewCaretPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
|
|
3486
3510
|
if (prevCaretPos === 0 && !isDeleteForwards) {
|
|
3487
3511
|
return 0;
|
|
@@ -3501,7 +3525,7 @@ var _factory = (() => {
|
|
|
3501
3525
|
return formattedValue.length;
|
|
3502
3526
|
};
|
|
3503
3527
|
|
|
3504
|
-
// src/js/data/nanp-regionless.ts
|
|
3528
|
+
// packages/core/src/js/data/nanp-regionless.ts
|
|
3505
3529
|
var regionlessNanpAreaCodes = /* @__PURE__ */ new Set([
|
|
3506
3530
|
"800",
|
|
3507
3531
|
"822",
|
|
@@ -3530,7 +3554,7 @@ var _factory = (() => {
|
|
|
3530
3554
|
return false;
|
|
3531
3555
|
};
|
|
3532
3556
|
|
|
3533
|
-
// src/js/intlTelInput.ts
|
|
3557
|
+
// packages/core/src/js/intlTelInput.ts
|
|
3534
3558
|
var nextId = 0;
|
|
3535
3559
|
var ensureUtils = (methodName) => {
|
|
3536
3560
|
if (!intlTelInput.utils) {
|
|
@@ -3697,7 +3721,7 @@ var _factory = (() => {
|
|
|
3697
3721
|
if (this.#utilsDeferred) {
|
|
3698
3722
|
const { loadUtils } = this.#options;
|
|
3699
3723
|
const doAttachUtils = () => {
|
|
3700
|
-
intlTelInput.attachUtils(loadUtils)
|
|
3724
|
+
intlTelInput.attachUtils(loadUtils).catch(() => {
|
|
3701
3725
|
});
|
|
3702
3726
|
};
|
|
3703
3727
|
if (intlTelInput.documentReady()) {
|
|
@@ -3717,7 +3741,7 @@ var _factory = (() => {
|
|
|
3717
3741
|
}
|
|
3718
3742
|
}
|
|
3719
3743
|
//* Perform the geo ip lookup.
|
|
3720
|
-
#loadAutoCountry() {
|
|
3744
|
+
async #loadAutoCountry() {
|
|
3721
3745
|
if (intlTelInput.autoCountry) {
|
|
3722
3746
|
this.#handleAutoCountryLoaded();
|
|
3723
3747
|
return;
|
|
@@ -3728,19 +3752,18 @@ var _factory = (() => {
|
|
|
3728
3752
|
}
|
|
3729
3753
|
intlTelInput.startedLoadingAutoCountry = true;
|
|
3730
3754
|
if (typeof this.#options.geoIpLookup === "function") {
|
|
3731
|
-
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
setTimeout(() => _Iti.forEachInstance("handleAutoCountryLoaded"));
|
|
3736
|
-
} else {
|
|
3755
|
+
try {
|
|
3756
|
+
const iso2 = await this.#options.geoIpLookup();
|
|
3757
|
+
const iso2Lower = typeof iso2 === "string" ? iso2.toLowerCase() : "";
|
|
3758
|
+
if (!isIso2(iso2Lower)) {
|
|
3737
3759
|
_Iti.forEachInstance("handleAutoCountryFailure");
|
|
3760
|
+
return;
|
|
3738
3761
|
}
|
|
3739
|
-
|
|
3740
|
-
|
|
3762
|
+
intlTelInput.autoCountry = iso2Lower;
|
|
3763
|
+
setTimeout(() => _Iti.forEachInstance("handleAutoCountryLoaded"));
|
|
3764
|
+
} catch {
|
|
3741
3765
|
_Iti.forEachInstance("handleAutoCountryFailure");
|
|
3742
|
-
}
|
|
3743
|
-
this.#options.geoIpLookup(successCallback, failureCallback);
|
|
3766
|
+
}
|
|
3744
3767
|
}
|
|
3745
3768
|
}
|
|
3746
3769
|
#openDropdownWithPlus() {
|
|
@@ -4055,8 +4078,7 @@ var _factory = (() => {
|
|
|
4055
4078
|
if (formatOnDisplay && intlTelInput.utils && this.#selectedCountry) {
|
|
4056
4079
|
const isRegionless = hasRegionlessDialCode(fullNumber);
|
|
4057
4080
|
const useNational = nationalMode && !isRegionless || !number.startsWith("+") && !separateDialCode;
|
|
4058
|
-
const
|
|
4059
|
-
const format = useNational ? NATIONAL : INTERNATIONAL;
|
|
4081
|
+
const format = useNational ? NUMBER_FORMAT.NATIONAL : NUMBER_FORMAT.INTERNATIONAL;
|
|
4060
4082
|
number = intlTelInput.utils.formatNumber(
|
|
4061
4083
|
number,
|
|
4062
4084
|
this.#selectedCountry?.iso2,
|
|
@@ -4176,11 +4198,10 @@ var _factory = (() => {
|
|
|
4176
4198
|
this.#maxCoreNumberLength = null;
|
|
4177
4199
|
return;
|
|
4178
4200
|
}
|
|
4179
|
-
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
4180
4201
|
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
4181
4202
|
iso2,
|
|
4182
4203
|
false,
|
|
4183
|
-
|
|
4204
|
+
placeholderNumberType,
|
|
4184
4205
|
true
|
|
4185
4206
|
);
|
|
4186
4207
|
let validNumber = exampleNumber;
|
|
@@ -4210,11 +4231,10 @@ var _factory = (() => {
|
|
|
4210
4231
|
if (!intlTelInput.utils || !shouldSetPlaceholder) {
|
|
4211
4232
|
return;
|
|
4212
4233
|
}
|
|
4213
|
-
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
4214
4234
|
let placeholder = this.#selectedCountry ? intlTelInput.utils.getExampleNumber(
|
|
4215
4235
|
this.#selectedCountry.iso2,
|
|
4216
4236
|
nationalMode,
|
|
4217
|
-
|
|
4237
|
+
placeholderNumberType
|
|
4218
4238
|
) : "";
|
|
4219
4239
|
placeholder = this.#prepareNumberForInput(placeholder);
|
|
4220
4240
|
if (typeof customPlaceholder === "function") {
|
|
@@ -4324,19 +4344,9 @@ var _factory = (() => {
|
|
|
4324
4344
|
);
|
|
4325
4345
|
return this.#truncateToMaxLength(number);
|
|
4326
4346
|
}
|
|
4327
|
-
//* Return only the public-facing subset of the selected country data.
|
|
4328
|
-
#getPublicCountryData() {
|
|
4329
|
-
const d = this.#selectedCountry;
|
|
4330
|
-
if (!d) {
|
|
4331
|
-
return null;
|
|
4332
|
-
}
|
|
4333
|
-
const { iso2, dialCode, name } = d;
|
|
4334
|
-
return { iso2, dialCode, name };
|
|
4335
|
-
}
|
|
4336
4347
|
//* Dispatch the 'countrychange' event.
|
|
4337
4348
|
#dispatchCountryChangeEvent() {
|
|
4338
|
-
|
|
4339
|
-
this.#dispatchEvent(EVENTS.COUNTRY_CHANGE, countryData);
|
|
4349
|
+
this.#dispatchEvent(EVENTS.COUNTRY_CHANGE, this.#selectedCountry ?? null);
|
|
4340
4350
|
}
|
|
4341
4351
|
//**************************
|
|
4342
4352
|
//* INTERNAL METHODS
|
|
@@ -4427,7 +4437,7 @@ var _factory = (() => {
|
|
|
4427
4437
|
this.#selectedCountry?.iso2
|
|
4428
4438
|
);
|
|
4429
4439
|
}
|
|
4430
|
-
//* Format the number to the given format.
|
|
4440
|
+
//* Format the number to the given format (defaults to "E164").
|
|
4431
4441
|
getNumber(format) {
|
|
4432
4442
|
if (!this.#isActive) {
|
|
4433
4443
|
return "";
|
|
@@ -4442,10 +4452,10 @@ var _factory = (() => {
|
|
|
4442
4452
|
);
|
|
4443
4453
|
return this.#numerals.denormalise(formattedNumber);
|
|
4444
4454
|
}
|
|
4445
|
-
//* Get the type of the entered number e.g.
|
|
4455
|
+
//* Get the type of the entered number e.g. "FIXED_LINE" / "MOBILE", or null if it can't be determined / instance is destroyed.
|
|
4446
4456
|
getNumberType() {
|
|
4447
4457
|
if (!this.#isActive) {
|
|
4448
|
-
return
|
|
4458
|
+
return null;
|
|
4449
4459
|
}
|
|
4450
4460
|
ensureUtils("getNumberType");
|
|
4451
4461
|
return intlTelInput.utils.getNumberType(
|
|
@@ -4455,12 +4465,12 @@ var _factory = (() => {
|
|
|
4455
4465
|
}
|
|
4456
4466
|
//* Get the country data for the currently selected country.
|
|
4457
4467
|
getSelectedCountryData() {
|
|
4458
|
-
return this.#
|
|
4468
|
+
return this.#selectedCountry ?? null;
|
|
4459
4469
|
}
|
|
4460
|
-
//* Get the validation error.
|
|
4470
|
+
//* Get the validation error e.g. "TOO_SHORT" / "TOO_LONG", or null if it can't be determined / instance is destroyed.
|
|
4461
4471
|
getValidationError() {
|
|
4462
4472
|
if (!this.#isActive) {
|
|
4463
|
-
return
|
|
4473
|
+
return null;
|
|
4464
4474
|
}
|
|
4465
4475
|
ensureUtils("getValidationError");
|
|
4466
4476
|
const iso2 = this.#selectedCountry?.iso2;
|
|
@@ -4609,39 +4619,31 @@ var _factory = (() => {
|
|
|
4609
4619
|
});
|
|
4610
4620
|
}
|
|
4611
4621
|
};
|
|
4612
|
-
var attachUtils = (source) => {
|
|
4613
|
-
if (
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4622
|
+
var attachUtils = async (source) => {
|
|
4623
|
+
if (intlTelInput.utils || intlTelInput.startedLoadingUtils) {
|
|
4624
|
+
return null;
|
|
4625
|
+
}
|
|
4626
|
+
if (typeof source !== "function") {
|
|
4627
|
+
throw new TypeError(
|
|
4628
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utils module, not ${typeof source}`
|
|
4629
|
+
);
|
|
4630
|
+
}
|
|
4631
|
+
intlTelInput.startedLoadingUtils = true;
|
|
4632
|
+
try {
|
|
4633
|
+
const module = await source();
|
|
4634
|
+
const utils = module?.default;
|
|
4635
|
+
if (!utils || typeof utils !== "object") {
|
|
4636
|
+
throw new TypeError(
|
|
4637
|
+
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
4626
4638
|
);
|
|
4627
4639
|
}
|
|
4628
|
-
intlTelInput.
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
);
|
|
4635
|
-
}
|
|
4636
|
-
intlTelInput.utils = utils;
|
|
4637
|
-
Iti.forEachInstance("handleUtilsLoaded");
|
|
4638
|
-
return true;
|
|
4639
|
-
}).catch((error) => {
|
|
4640
|
-
Iti.forEachInstance("handleUtilsFailure", error);
|
|
4641
|
-
throw error;
|
|
4642
|
-
});
|
|
4640
|
+
intlTelInput.utils = utils;
|
|
4641
|
+
Iti.forEachInstance("handleUtilsLoaded");
|
|
4642
|
+
return true;
|
|
4643
|
+
} catch (error) {
|
|
4644
|
+
Iti.forEachInstance("handleUtilsFailure", error);
|
|
4645
|
+
throw error;
|
|
4643
4646
|
}
|
|
4644
|
-
return null;
|
|
4645
4647
|
};
|
|
4646
4648
|
var intlTelInput = Object.assign(
|
|
4647
4649
|
(input, options) => {
|
|
@@ -4666,7 +4668,10 @@ var _factory = (() => {
|
|
|
4666
4668
|
attachUtils,
|
|
4667
4669
|
startedLoadingUtils: false,
|
|
4668
4670
|
startedLoadingAutoCountry: false,
|
|
4669
|
-
version: "
|
|
4671
|
+
version: "28.0.0",
|
|
4672
|
+
NUMBER_FORMAT,
|
|
4673
|
+
NUMBER_TYPE,
|
|
4674
|
+
VALIDATION_ERROR
|
|
4670
4675
|
}
|
|
4671
4676
|
);
|
|
4672
4677
|
var intlTelInput_default = intlTelInput;
|