intl-tel-input 24.5.2 → 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 -4
- package/build/js/intlTelInput.js +59 -24
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +56 -25
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +6 -8
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +58 -23
- package/react/build/IntlTelInput.d.ts +10 -4
- package/react/build/IntlTelInput.js +58 -23
- package/react/build/IntlTelInputWithUtils.cjs +55 -24
- package/react/build/IntlTelInputWithUtils.js +55 -24
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +64 -40
- package/vue/build/IntlTelInputWithUtils.mjs +448 -428
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v24.
|
|
2
|
+
* International Telephone Input v24.6.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1663,6 +1663,8 @@ var factoryOutput = (() => {
|
|
|
1663
1663
|
i18n: {},
|
|
1664
1664
|
//* Initial country.
|
|
1665
1665
|
initialCountry: "",
|
|
1666
|
+
//* Specify the path to the libphonenumber script to enable validation/formatting.
|
|
1667
|
+
loadUtilsOnInit: "",
|
|
1666
1668
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1667
1669
|
nationalMode: true,
|
|
1668
1670
|
//* Display only these countries.
|
|
@@ -1683,7 +1685,7 @@ var factoryOutput = (() => {
|
|
|
1683
1685
|
navigator.userAgent
|
|
1684
1686
|
) || window.innerWidth <= 500
|
|
1685
1687
|
) : false,
|
|
1686
|
-
//*
|
|
1688
|
+
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1687
1689
|
utilsScript: "",
|
|
1688
1690
|
//* The number type to enforce during validation.
|
|
1689
1691
|
validationNumberType: "MOBILE"
|
|
@@ -1745,9 +1747,9 @@ var factoryOutput = (() => {
|
|
|
1745
1747
|
}
|
|
1746
1748
|
return el;
|
|
1747
1749
|
};
|
|
1748
|
-
var forEachInstance = (method) => {
|
|
1750
|
+
var forEachInstance = (method, ...args) => {
|
|
1749
1751
|
const { instances } = intlTelInput;
|
|
1750
|
-
Object.values(instances).forEach((instance) => instance[method]());
|
|
1752
|
+
Object.values(instances).forEach((instance) => instance[method](...args));
|
|
1751
1753
|
};
|
|
1752
1754
|
var Iti = class {
|
|
1753
1755
|
constructor(input, customOptions = {}) {
|
|
@@ -2195,14 +2197,21 @@ var factoryOutput = (() => {
|
|
|
2195
2197
|
}
|
|
2196
2198
|
//* Init many requests: utils script / geo ip lookup.
|
|
2197
2199
|
_initRequests() {
|
|
2198
|
-
|
|
2199
|
-
if (
|
|
2200
|
+
let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
|
|
2201
|
+
if (!loadUtilsOnInit && utilsScript) {
|
|
2202
|
+
console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
|
|
2203
|
+
loadUtilsOnInit = utilsScript;
|
|
2204
|
+
}
|
|
2205
|
+
if (loadUtilsOnInit && !intlTelInput.utils) {
|
|
2206
|
+
this._handlePageLoad = () => {
|
|
2207
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2208
|
+
intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
|
|
2209
|
+
});
|
|
2210
|
+
};
|
|
2200
2211
|
if (intlTelInput.documentReady()) {
|
|
2201
|
-
|
|
2212
|
+
this._handlePageLoad();
|
|
2202
2213
|
} else {
|
|
2203
|
-
window.addEventListener("load",
|
|
2204
|
-
intlTelInput.loadUtils(utilsScript);
|
|
2205
|
-
});
|
|
2214
|
+
window.addEventListener("load", this._handlePageLoad);
|
|
2206
2215
|
}
|
|
2207
2216
|
} else {
|
|
2208
2217
|
this.resolveUtilsScriptPromise();
|
|
@@ -2787,6 +2796,9 @@ var factoryOutput = (() => {
|
|
|
2787
2796
|
this.dropdown.parentNode.removeChild(this.dropdown);
|
|
2788
2797
|
}
|
|
2789
2798
|
}
|
|
2799
|
+
if (this._handlePageLoad) {
|
|
2800
|
+
window.removeEventListener("load", this._handlePageLoad);
|
|
2801
|
+
}
|
|
2790
2802
|
this._trigger("close:countrydropdown");
|
|
2791
2803
|
}
|
|
2792
2804
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
@@ -3075,22 +3087,39 @@ var factoryOutput = (() => {
|
|
|
3075
3087
|
}
|
|
3076
3088
|
}
|
|
3077
3089
|
};
|
|
3078
|
-
var loadUtils = (
|
|
3090
|
+
var loadUtils = (source) => {
|
|
3079
3091
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
3092
|
+
let loadCall;
|
|
3093
|
+
if (typeof source === "string") {
|
|
3094
|
+
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!"));
|
|
3095
|
+
} else if (typeof source === "function") {
|
|
3096
|
+
try {
|
|
3097
|
+
loadCall = source();
|
|
3098
|
+
if (!(loadCall instanceof Promise)) {
|
|
3099
|
+
throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
|
|
3100
|
+
}
|
|
3101
|
+
} catch (error) {
|
|
3102
|
+
return Promise.reject(error);
|
|
3103
|
+
}
|
|
3104
|
+
} else {
|
|
3105
|
+
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}`));
|
|
3106
|
+
}
|
|
3080
3107
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3081
|
-
return
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3108
|
+
return loadCall.then((module) => {
|
|
3109
|
+
const utils2 = module?.default;
|
|
3110
|
+
if (!utils2 || typeof utils2 !== "object") {
|
|
3111
|
+
if (typeof source === "string") {
|
|
3112
|
+
throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
|
|
3113
|
+
} else {
|
|
3114
|
+
throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
intlTelInput.utils = utils2;
|
|
3118
|
+
forEachInstance("handleUtils");
|
|
3119
|
+
return true;
|
|
3120
|
+
}).catch((error) => {
|
|
3121
|
+
forEachInstance("rejectUtilsScriptPromise", error);
|
|
3122
|
+
throw error;
|
|
3094
3123
|
});
|
|
3095
3124
|
}
|
|
3096
3125
|
return null;
|
|
@@ -3117,7 +3146,9 @@ var factoryOutput = (() => {
|
|
|
3117
3146
|
//* A map from instance ID to instance object.
|
|
3118
3147
|
instances: {},
|
|
3119
3148
|
loadUtils,
|
|
3120
|
-
|
|
3149
|
+
startedLoadingUtilsScript: false,
|
|
3150
|
+
startedLoadingAutoCountry: false,
|
|
3151
|
+
version: "24.6.0"
|
|
3121
3152
|
}
|
|
3122
3153
|
);
|
|
3123
3154
|
var intl_tel_input_default = intlTelInput;
|