intl-tel-input 24.5.1 → 24.6.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 +51 -12
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +10 -5
- package/build/js/intlTelInput.js +78 -46
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +75 -47
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +6 -8
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +77 -45
- package/react/build/IntlTelInput.d.ts +10 -5
- package/react/build/IntlTelInput.js +77 -45
- package/react/build/IntlTelInputWithUtils.cjs +74 -46
- package/react/build/IntlTelInputWithUtils.js +74 -46
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +95 -74
- package/vue/build/IntlTelInputWithUtils.mjs +668 -651
|
@@ -1659,6 +1659,8 @@ var defaults = {
|
|
|
1659
1659
|
i18n: {},
|
|
1660
1660
|
//* Initial country.
|
|
1661
1661
|
initialCountry: "",
|
|
1662
|
+
//* Specify the path to the libphonenumber script to enable validation/formatting.
|
|
1663
|
+
loadUtilsOnInit: "",
|
|
1662
1664
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1663
1665
|
nationalMode: true,
|
|
1664
1666
|
//* Display only these countries.
|
|
@@ -1679,7 +1681,7 @@ var defaults = {
|
|
|
1679
1681
|
navigator.userAgent
|
|
1680
1682
|
) || window.innerWidth <= 500
|
|
1681
1683
|
) : false,
|
|
1682
|
-
//*
|
|
1684
|
+
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1683
1685
|
utilsScript: "",
|
|
1684
1686
|
//* The number type to enforce during validation.
|
|
1685
1687
|
validationNumberType: "MOBILE"
|
|
@@ -1741,9 +1743,9 @@ var createEl = (name, attrs, container) => {
|
|
|
1741
1743
|
}
|
|
1742
1744
|
return el;
|
|
1743
1745
|
};
|
|
1744
|
-
var forEachInstance = (method) => {
|
|
1746
|
+
var forEachInstance = (method, ...args) => {
|
|
1745
1747
|
const { instances } = intlTelInput;
|
|
1746
|
-
Object.values(instances).forEach((instance) => instance[method]());
|
|
1748
|
+
Object.values(instances).forEach((instance) => instance[method](...args));
|
|
1747
1749
|
};
|
|
1748
1750
|
var Iti = class {
|
|
1749
1751
|
constructor(input, customOptions = {}) {
|
|
@@ -2191,14 +2193,21 @@ var Iti = class {
|
|
|
2191
2193
|
}
|
|
2192
2194
|
//* Init many requests: utils script / geo ip lookup.
|
|
2193
2195
|
_initRequests() {
|
|
2194
|
-
|
|
2195
|
-
if (
|
|
2196
|
+
let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
|
|
2197
|
+
if (!loadUtilsOnInit && utilsScript) {
|
|
2198
|
+
console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
|
|
2199
|
+
loadUtilsOnInit = utilsScript;
|
|
2200
|
+
}
|
|
2201
|
+
if (loadUtilsOnInit && !intlTelInput.utils) {
|
|
2202
|
+
this._handlePageLoad = () => {
|
|
2203
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2204
|
+
intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
|
|
2205
|
+
});
|
|
2206
|
+
};
|
|
2196
2207
|
if (intlTelInput.documentReady()) {
|
|
2197
|
-
|
|
2208
|
+
this._handlePageLoad();
|
|
2198
2209
|
} else {
|
|
2199
|
-
window.addEventListener("load",
|
|
2200
|
-
intlTelInput.loadUtils(utilsScript);
|
|
2201
|
-
});
|
|
2210
|
+
window.addEventListener("load", this._handlePageLoad);
|
|
2202
2211
|
}
|
|
2203
2212
|
} else {
|
|
2204
2213
|
this.resolveUtilsScriptPromise();
|
|
@@ -2295,13 +2304,17 @@ var Iti = class {
|
|
|
2295
2304
|
const isInitialPlus = !alreadyHasPlus && this.telInput.selectionStart === 0 && e.key === "+";
|
|
2296
2305
|
const isNumeric = /^[0-9]$/.test(e.key);
|
|
2297
2306
|
const isAllowedChar = separateDialCode ? isNumeric : isInitialPlus || isNumeric;
|
|
2298
|
-
const
|
|
2299
|
-
const
|
|
2300
|
-
const
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2307
|
+
const newValue = value.slice(0, this.telInput.selectionStart) + e.key + value.slice(this.telInput.selectionEnd);
|
|
2308
|
+
const newFullNumber = this._getFullNumber(newValue);
|
|
2309
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(newFullNumber, this.selectedCountryData.iso2);
|
|
2310
|
+
const hasExceededMaxLength = this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength;
|
|
2311
|
+
let isChangingDialCode = false;
|
|
2312
|
+
if (alreadyHasPlus) {
|
|
2313
|
+
const currentCountry = this.selectedCountryData.iso2;
|
|
2314
|
+
const newCountry = this._getCountryFromNumber(newFullNumber);
|
|
2315
|
+
isChangingDialCode = newCountry !== currentCountry;
|
|
2316
|
+
}
|
|
2317
|
+
if (!isAllowedChar || hasExceededMaxLength && !isChangingDialCode && !isInitialPlus) {
|
|
2305
2318
|
e.preventDefault();
|
|
2306
2319
|
}
|
|
2307
2320
|
}
|
|
@@ -2310,17 +2323,6 @@ var Iti = class {
|
|
|
2310
2323
|
this.telInput.addEventListener("keydown", this._handleKeydownEvent);
|
|
2311
2324
|
}
|
|
2312
2325
|
}
|
|
2313
|
-
_isChangingDialCode(char) {
|
|
2314
|
-
const value = this.telInput.value;
|
|
2315
|
-
if (value.charAt(0) === "+") {
|
|
2316
|
-
const currentCountry = this.selectedCountryData.iso2;
|
|
2317
|
-
const newValue = value.slice(0, this.telInput.selectionStart) + char + value.slice(this.telInput.selectionEnd);
|
|
2318
|
-
const newFullNumber = this._getFullNumber(newValue);
|
|
2319
|
-
const newCountry = this._getCountryFromNumber(newFullNumber);
|
|
2320
|
-
return newCountry !== currentCountry;
|
|
2321
|
-
}
|
|
2322
|
-
return false;
|
|
2323
|
-
}
|
|
2324
2326
|
//* Adhere to the input's maxlength attr.
|
|
2325
2327
|
_cap(number) {
|
|
2326
2328
|
const max = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
@@ -2664,22 +2666,26 @@ var Iti = class {
|
|
|
2664
2666
|
//* Update the maximum valid number length for the currently selected country.
|
|
2665
2667
|
_updateMaxLength() {
|
|
2666
2668
|
const { strictMode, placeholderNumberType, validationNumberType } = this.options;
|
|
2669
|
+
const { iso2 } = this.selectedCountryData;
|
|
2667
2670
|
if (strictMode && intlTelInput.utils) {
|
|
2668
|
-
if (
|
|
2671
|
+
if (iso2) {
|
|
2669
2672
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2670
2673
|
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
2671
|
-
|
|
2674
|
+
iso2,
|
|
2672
2675
|
false,
|
|
2673
2676
|
numberType,
|
|
2674
2677
|
true
|
|
2675
2678
|
);
|
|
2676
2679
|
let validNumber = exampleNumber;
|
|
2677
|
-
while (intlTelInput.utils.isPossibleNumber(exampleNumber,
|
|
2680
|
+
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2, validationNumberType)) {
|
|
2678
2681
|
validNumber = exampleNumber;
|
|
2679
2682
|
exampleNumber += "0";
|
|
2680
2683
|
}
|
|
2681
|
-
const coreNumber = intlTelInput.utils.getCoreNumber(validNumber,
|
|
2684
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
|
|
2682
2685
|
this.maxCoreNumberLength = coreNumber.length;
|
|
2686
|
+
if (iso2 === "by") {
|
|
2687
|
+
this.maxCoreNumberLength = coreNumber.length + 1;
|
|
2688
|
+
}
|
|
2683
2689
|
} else {
|
|
2684
2690
|
this.maxCoreNumberLength = null;
|
|
2685
2691
|
}
|
|
@@ -2786,6 +2792,9 @@ var Iti = class {
|
|
|
2786
2792
|
this.dropdown.parentNode.removeChild(this.dropdown);
|
|
2787
2793
|
}
|
|
2788
2794
|
}
|
|
2795
|
+
if (this._handlePageLoad) {
|
|
2796
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2797
|
+
}
|
|
2789
2798
|
this._trigger("close:countrydropdown");
|
|
2790
2799
|
}
|
|
2791
2800
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
@@ -3074,22 +3083,39 @@ var Iti = class {
|
|
|
3074
3083
|
}
|
|
3075
3084
|
}
|
|
3076
3085
|
};
|
|
3077
|
-
var loadUtils = (
|
|
3086
|
+
var loadUtils = (source) => {
|
|
3078
3087
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
3088
|
+
let loadCall;
|
|
3089
|
+
if (typeof source === "string") {
|
|
3090
|
+
loadCall = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
|
|
3091
|
+
} else if (typeof source === "function") {
|
|
3092
|
+
try {
|
|
3093
|
+
loadCall = source();
|
|
3094
|
+
if (!(loadCall instanceof Promise)) {
|
|
3095
|
+
throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
|
|
3096
|
+
}
|
|
3097
|
+
} catch (error) {
|
|
3098
|
+
return Promise.reject(error);
|
|
3099
|
+
}
|
|
3100
|
+
} else {
|
|
3101
|
+
return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
|
|
3102
|
+
}
|
|
3079
3103
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3080
|
-
return
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3104
|
+
return loadCall.then((module2) => {
|
|
3105
|
+
const utils2 = module2?.default;
|
|
3106
|
+
if (!utils2 || typeof utils2 !== "object") {
|
|
3107
|
+
if (typeof source === "string") {
|
|
3108
|
+
throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
|
|
3109
|
+
} else {
|
|
3110
|
+
throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
intlTelInput.utils = utils2;
|
|
3114
|
+
forEachInstance("handleUtils");
|
|
3115
|
+
return true;
|
|
3116
|
+
}).catch((error) => {
|
|
3117
|
+
forEachInstance("rejectUtilsScriptPromise", error);
|
|
3118
|
+
throw error;
|
|
3093
3119
|
});
|
|
3094
3120
|
}
|
|
3095
3121
|
return null;
|
|
@@ -3116,7 +3142,9 @@ var intlTelInput = Object.assign(
|
|
|
3116
3142
|
//* A map from instance ID to instance object.
|
|
3117
3143
|
instances: {},
|
|
3118
3144
|
loadUtils,
|
|
3119
|
-
|
|
3145
|
+
startedLoadingUtilsScript: false,
|
|
3146
|
+
startedLoadingAutoCountry: false,
|
|
3147
|
+
version: "24.6.0"
|
|
3120
3148
|
}
|
|
3121
3149
|
);
|
|
3122
3150
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1623,6 +1623,8 @@ var defaults = {
|
|
|
1623
1623
|
i18n: {},
|
|
1624
1624
|
//* Initial country.
|
|
1625
1625
|
initialCountry: "",
|
|
1626
|
+
//* Specify the path to the libphonenumber script to enable validation/formatting.
|
|
1627
|
+
loadUtilsOnInit: "",
|
|
1626
1628
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1627
1629
|
nationalMode: true,
|
|
1628
1630
|
//* Display only these countries.
|
|
@@ -1643,7 +1645,7 @@ var defaults = {
|
|
|
1643
1645
|
navigator.userAgent
|
|
1644
1646
|
) || window.innerWidth <= 500
|
|
1645
1647
|
) : false,
|
|
1646
|
-
//*
|
|
1648
|
+
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1647
1649
|
utilsScript: "",
|
|
1648
1650
|
//* The number type to enforce during validation.
|
|
1649
1651
|
validationNumberType: "MOBILE"
|
|
@@ -1705,9 +1707,9 @@ var createEl = (name, attrs, container) => {
|
|
|
1705
1707
|
}
|
|
1706
1708
|
return el;
|
|
1707
1709
|
};
|
|
1708
|
-
var forEachInstance = (method) => {
|
|
1710
|
+
var forEachInstance = (method, ...args) => {
|
|
1709
1711
|
const { instances } = intlTelInput;
|
|
1710
|
-
Object.values(instances).forEach((instance) => instance[method]());
|
|
1712
|
+
Object.values(instances).forEach((instance) => instance[method](...args));
|
|
1711
1713
|
};
|
|
1712
1714
|
var Iti = class {
|
|
1713
1715
|
constructor(input, customOptions = {}) {
|
|
@@ -2155,14 +2157,21 @@ var Iti = class {
|
|
|
2155
2157
|
}
|
|
2156
2158
|
//* Init many requests: utils script / geo ip lookup.
|
|
2157
2159
|
_initRequests() {
|
|
2158
|
-
|
|
2159
|
-
if (
|
|
2160
|
+
let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
|
|
2161
|
+
if (!loadUtilsOnInit && utilsScript) {
|
|
2162
|
+
console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
|
|
2163
|
+
loadUtilsOnInit = utilsScript;
|
|
2164
|
+
}
|
|
2165
|
+
if (loadUtilsOnInit && !intlTelInput.utils) {
|
|
2166
|
+
this._handlePageLoad = () => {
|
|
2167
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2168
|
+
intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
|
|
2169
|
+
});
|
|
2170
|
+
};
|
|
2160
2171
|
if (intlTelInput.documentReady()) {
|
|
2161
|
-
|
|
2172
|
+
this._handlePageLoad();
|
|
2162
2173
|
} else {
|
|
2163
|
-
window.addEventListener("load",
|
|
2164
|
-
intlTelInput.loadUtils(utilsScript);
|
|
2165
|
-
});
|
|
2174
|
+
window.addEventListener("load", this._handlePageLoad);
|
|
2166
2175
|
}
|
|
2167
2176
|
} else {
|
|
2168
2177
|
this.resolveUtilsScriptPromise();
|
|
@@ -2259,13 +2268,17 @@ var Iti = class {
|
|
|
2259
2268
|
const isInitialPlus = !alreadyHasPlus && this.telInput.selectionStart === 0 && e.key === "+";
|
|
2260
2269
|
const isNumeric = /^[0-9]$/.test(e.key);
|
|
2261
2270
|
const isAllowedChar = separateDialCode ? isNumeric : isInitialPlus || isNumeric;
|
|
2262
|
-
const
|
|
2263
|
-
const
|
|
2264
|
-
const
|
|
2265
|
-
const
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2271
|
+
const newValue = value.slice(0, this.telInput.selectionStart) + e.key + value.slice(this.telInput.selectionEnd);
|
|
2272
|
+
const newFullNumber = this._getFullNumber(newValue);
|
|
2273
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(newFullNumber, this.selectedCountryData.iso2);
|
|
2274
|
+
const hasExceededMaxLength = this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength;
|
|
2275
|
+
let isChangingDialCode = false;
|
|
2276
|
+
if (alreadyHasPlus) {
|
|
2277
|
+
const currentCountry = this.selectedCountryData.iso2;
|
|
2278
|
+
const newCountry = this._getCountryFromNumber(newFullNumber);
|
|
2279
|
+
isChangingDialCode = newCountry !== currentCountry;
|
|
2280
|
+
}
|
|
2281
|
+
if (!isAllowedChar || hasExceededMaxLength && !isChangingDialCode && !isInitialPlus) {
|
|
2269
2282
|
e.preventDefault();
|
|
2270
2283
|
}
|
|
2271
2284
|
}
|
|
@@ -2274,17 +2287,6 @@ var Iti = class {
|
|
|
2274
2287
|
this.telInput.addEventListener("keydown", this._handleKeydownEvent);
|
|
2275
2288
|
}
|
|
2276
2289
|
}
|
|
2277
|
-
_isChangingDialCode(char) {
|
|
2278
|
-
const value = this.telInput.value;
|
|
2279
|
-
if (value.charAt(0) === "+") {
|
|
2280
|
-
const currentCountry = this.selectedCountryData.iso2;
|
|
2281
|
-
const newValue = value.slice(0, this.telInput.selectionStart) + char + value.slice(this.telInput.selectionEnd);
|
|
2282
|
-
const newFullNumber = this._getFullNumber(newValue);
|
|
2283
|
-
const newCountry = this._getCountryFromNumber(newFullNumber);
|
|
2284
|
-
return newCountry !== currentCountry;
|
|
2285
|
-
}
|
|
2286
|
-
return false;
|
|
2287
|
-
}
|
|
2288
2290
|
//* Adhere to the input's maxlength attr.
|
|
2289
2291
|
_cap(number) {
|
|
2290
2292
|
const max = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
@@ -2628,22 +2630,26 @@ var Iti = class {
|
|
|
2628
2630
|
//* Update the maximum valid number length for the currently selected country.
|
|
2629
2631
|
_updateMaxLength() {
|
|
2630
2632
|
const { strictMode, placeholderNumberType, validationNumberType } = this.options;
|
|
2633
|
+
const { iso2 } = this.selectedCountryData;
|
|
2631
2634
|
if (strictMode && intlTelInput.utils) {
|
|
2632
|
-
if (
|
|
2635
|
+
if (iso2) {
|
|
2633
2636
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2634
2637
|
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
2635
|
-
|
|
2638
|
+
iso2,
|
|
2636
2639
|
false,
|
|
2637
2640
|
numberType,
|
|
2638
2641
|
true
|
|
2639
2642
|
);
|
|
2640
2643
|
let validNumber = exampleNumber;
|
|
2641
|
-
while (intlTelInput.utils.isPossibleNumber(exampleNumber,
|
|
2644
|
+
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2, validationNumberType)) {
|
|
2642
2645
|
validNumber = exampleNumber;
|
|
2643
2646
|
exampleNumber += "0";
|
|
2644
2647
|
}
|
|
2645
|
-
const coreNumber = intlTelInput.utils.getCoreNumber(validNumber,
|
|
2648
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
|
|
2646
2649
|
this.maxCoreNumberLength = coreNumber.length;
|
|
2650
|
+
if (iso2 === "by") {
|
|
2651
|
+
this.maxCoreNumberLength = coreNumber.length + 1;
|
|
2652
|
+
}
|
|
2647
2653
|
} else {
|
|
2648
2654
|
this.maxCoreNumberLength = null;
|
|
2649
2655
|
}
|
|
@@ -2750,6 +2756,9 @@ var Iti = class {
|
|
|
2750
2756
|
this.dropdown.parentNode.removeChild(this.dropdown);
|
|
2751
2757
|
}
|
|
2752
2758
|
}
|
|
2759
|
+
if (this._handlePageLoad) {
|
|
2760
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2761
|
+
}
|
|
2753
2762
|
this._trigger("close:countrydropdown");
|
|
2754
2763
|
}
|
|
2755
2764
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
@@ -3038,22 +3047,39 @@ var Iti = class {
|
|
|
3038
3047
|
}
|
|
3039
3048
|
}
|
|
3040
3049
|
};
|
|
3041
|
-
var loadUtils = (
|
|
3050
|
+
var loadUtils = (source) => {
|
|
3042
3051
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
3052
|
+
let loadCall;
|
|
3053
|
+
if (typeof source === "string") {
|
|
3054
|
+
loadCall = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
|
|
3055
|
+
} else if (typeof source === "function") {
|
|
3056
|
+
try {
|
|
3057
|
+
loadCall = source();
|
|
3058
|
+
if (!(loadCall instanceof Promise)) {
|
|
3059
|
+
throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
|
|
3060
|
+
}
|
|
3061
|
+
} catch (error) {
|
|
3062
|
+
return Promise.reject(error);
|
|
3063
|
+
}
|
|
3064
|
+
} else {
|
|
3065
|
+
return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
|
|
3066
|
+
}
|
|
3043
3067
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3044
|
-
return
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3068
|
+
return loadCall.then((module) => {
|
|
3069
|
+
const utils2 = module?.default;
|
|
3070
|
+
if (!utils2 || typeof utils2 !== "object") {
|
|
3071
|
+
if (typeof source === "string") {
|
|
3072
|
+
throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
|
|
3073
|
+
} else {
|
|
3074
|
+
throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
intlTelInput.utils = utils2;
|
|
3078
|
+
forEachInstance("handleUtils");
|
|
3079
|
+
return true;
|
|
3080
|
+
}).catch((error) => {
|
|
3081
|
+
forEachInstance("rejectUtilsScriptPromise", error);
|
|
3082
|
+
throw error;
|
|
3057
3083
|
});
|
|
3058
3084
|
}
|
|
3059
3085
|
return null;
|
|
@@ -3080,7 +3106,9 @@ var intlTelInput = Object.assign(
|
|
|
3080
3106
|
//* A map from instance ID to instance object.
|
|
3081
3107
|
instances: {},
|
|
3082
3108
|
loadUtils,
|
|
3083
|
-
|
|
3109
|
+
startedLoadingUtilsScript: false,
|
|
3110
|
+
startedLoadingAutoCountry: false,
|
|
3111
|
+
version: "24.6.0"
|
|
3084
3112
|
}
|
|
3085
3113
|
);
|
|
3086
3114
|
var intl_tel_input_default = intlTelInput;
|
package/vue/README.md
CHANGED
|
@@ -34,7 +34,7 @@ See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master
|
|
|
34
34
|
"vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
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/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `utilsScript` 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 `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.
|
|
37
|
+
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/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `utilsScript` 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 `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/js/utils.js"`.
|
|
38
38
|
|
|
39
39
|
## Props
|
|
40
40
|
Here's a list of all of the current props you can pass to the IntlTelInput Vue component.
|