intl-tel-input 26.9.2 → 27.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/angular/README.md +1 -1
- package/angular/dist/IntlTelInput.d.ts +97 -0
- package/angular/dist/IntlTelInput.js +4812 -0
- package/angular/dist/IntlTelInputWithUtils.d.ts +3 -0
- package/angular/{build → dist}/IntlTelInputWithUtils.js +2342 -2096
- package/{build → dist}/css/demo.css +1 -1
- package/dist/css/intlTelInput-no-assets.css +1 -0
- package/dist/css/intlTelInput-no-assets.min.css +1 -0
- package/dist/css/intlTelInput.css +1 -0
- package/dist/css/intlTelInput.min.css +1 -0
- package/dist/img/flags.png +0 -0
- package/dist/img/flags.webp +0 -0
- package/dist/img/flags@2x.png +0 -0
- package/dist/img/flags@2x.webp +0 -0
- package/dist/js/data.d.ts +1616 -0
- package/{build → dist}/js/data.js +5 -17
- package/dist/js/data.min.js +7 -0
- package/dist/js/data.mjs +1708 -0
- package/{build/js/i18n/ar/index.js → dist/js/i18n/ar.js} +1 -0
- package/{build/js/i18n/bg/index.js → dist/js/i18n/bg.js} +1 -0
- package/{build/js/i18n/bn/index.js → dist/js/i18n/bn.js} +1 -0
- package/{build/js/i18n/bs/index.js → dist/js/i18n/bs.js} +1 -0
- package/{build/js/i18n/ca/index.js → dist/js/i18n/ca.js} +1 -0
- package/{build/js/i18n/cs/index.js → dist/js/i18n/cs.js} +1 -0
- package/{build/js/i18n/da/index.js → dist/js/i18n/da.js} +1 -0
- package/{build/js/i18n/de/index.js → dist/js/i18n/de.js} +1 -0
- package/{build/js/i18n/el/index.js → dist/js/i18n/el.js} +1 -0
- package/{build/js/i18n/en/index.js → dist/js/i18n/en.js} +3 -2
- package/{build/js/i18n/es/index.js → dist/js/i18n/es.js} +1 -0
- package/{build/js/i18n/et/index.js → dist/js/i18n/et.js} +1 -0
- package/{build/js/i18n/fa/index.js → dist/js/i18n/fa.js} +1 -0
- package/{build/js/i18n/fi/index.js → dist/js/i18n/fi.js} +1 -0
- package/{build/js/i18n/fr/index.js → dist/js/i18n/fr.js} +1 -0
- package/{build/js/i18n/hi/index.js → dist/js/i18n/hi.js} +1 -0
- package/{build/js/i18n/hr/index.js → dist/js/i18n/hr.js} +1 -0
- package/{build/js/i18n/hu/index.js → dist/js/i18n/hu.js} +1 -0
- package/{build/js/i18n/id/index.js → dist/js/i18n/id.js} +1 -0
- package/{build → dist}/js/i18n/index.js +1 -0
- package/{build/js/i18n/it/index.js → dist/js/i18n/it.js} +1 -0
- package/{build/js/i18n/ja/index.js → dist/js/i18n/ja.js} +1 -0
- package/{build/js/i18n/kn/index.js → dist/js/i18n/kn.js} +1 -0
- package/{build/js/i18n/ko/index.js → dist/js/i18n/ko.js} +1 -0
- package/{build/js/i18n/lt/index.js → dist/js/i18n/lt.js} +1 -0
- package/{build/js/i18n/mr/index.js → dist/js/i18n/mr.js} +1 -0
- package/{build/js/i18n/nl/index.js → dist/js/i18n/nl.js} +1 -0
- package/{build/js/i18n/no/index.js → dist/js/i18n/no.js} +1 -0
- package/{build/js/i18n/pl/index.js → dist/js/i18n/pl.js} +1 -0
- package/{build/js/i18n/pt/index.js → dist/js/i18n/pt.js} +1 -0
- package/{build/js/i18n/ro/index.js → dist/js/i18n/ro.js} +1 -0
- package/{build/js/i18n/ru/index.js → dist/js/i18n/ru.js} +1 -0
- package/{build/js/i18n/sk/index.js → dist/js/i18n/sk.js} +1 -0
- package/{build/js/i18n/sl/index.js → dist/js/i18n/sl.js} +1 -0
- package/{build/js/i18n/sq/index.js → dist/js/i18n/sq.js} +1 -0
- package/{build/js/i18n/sr/index.js → dist/js/i18n/sr.js} +1 -0
- package/{build/js/i18n/sv/index.js → dist/js/i18n/sv.js} +1 -0
- package/{build/js/i18n/te/index.js → dist/js/i18n/te.js} +1 -0
- package/{build/js/i18n/th/index.js → dist/js/i18n/th.js} +1 -0
- package/{build/js/i18n/tr/index.js → dist/js/i18n/tr.js} +1 -0
- package/dist/js/i18n/types.js +1 -0
- package/{build/js/i18n/uk/index.js → dist/js/i18n/uk.js} +1 -0
- package/{build/js/i18n/ur/index.js → dist/js/i18n/ur.js} +1 -0
- package/{build/js/i18n/uz/index.js → dist/js/i18n/uz.js} +1 -0
- package/{build/js/i18n/vi/index.js → dist/js/i18n/vi.js} +1 -0
- package/{build/js/i18n/zh-hk/index.js → dist/js/i18n/zh-hk.js} +1 -0
- package/{build/js/i18n/zh/index.js → dist/js/i18n/zh.js} +1 -0
- package/dist/js/i18n.d.ts +1697 -0
- package/dist/js/intlTelInput.d.ts +1773 -0
- package/{build → dist}/js/intlTelInput.js +228 -215
- package/dist/js/intlTelInput.min.js +25 -0
- package/{react/build/IntlTelInput.cjs → dist/js/intlTelInput.mjs} +230 -340
- package/{build → dist}/js/intlTelInputWithUtils.js +531 -498
- package/dist/js/intlTelInputWithUtils.min.js +25 -0
- package/{react/build/IntlTelInputWithUtils.cjs → dist/js/intlTelInputWithUtils.mjs} +530 -621
- package/{build → dist}/js/utils.js +46 -47
- package/package.json +122 -122
- package/react/README.md +1 -1
- package/react/dist/IntlTelInput.d.ts +20 -0
- package/react/{build → dist}/IntlTelInput.js +274 -255
- package/react/dist/IntlTelInputWithUtils.d.ts +4 -0
- package/react/{build → dist}/IntlTelInputWithUtils.js +580 -542
- package/svelte/README.md +1 -1
- package/svelte/src/IntlTelInput.svelte +199 -0
- package/svelte/src/IntlTelInputWithUtils.svelte +15 -0
- package/svelte/src/shims.d.ts +4 -0
- package/vue/README.md +1 -1
- package/vue/dist/IntlTelInput-D7r449B2.js +2577 -0
- package/vue/dist/IntlTelInput.js +5 -0
- package/vue/dist/IntlTelInputWithUtils.js +49385 -0
- package/vue/dist/src/IntlTelInput.vue.d.ts +35 -0
- package/vue/dist/src/index.d.ts +4 -0
- package/vue/dist/src/indexWithUtils.d.ts +3 -0
- package/angular/build/IntlTelInput.js +0 -4501
- package/angular/build/types/intl-tel-input/angular.d.ts +0 -65
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +0 -65
- package/angular/build/types/intl-tel-input/data.d.ts +0 -20
- package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/et/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +0 -45
- package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/kn/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/lt/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sq/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +0 -10
- package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
- package/angular/build/types/intl-tel-input/utils.d.ts +0 -2
- package/angular/build/types/intl-tel-input.d.ts +0 -46
- package/angular/build/types/modules/constants.d.ts +0 -94
- package/angular/build/types/modules/core/countrySearch.d.ts +0 -17
- package/angular/build/types/modules/core/icons.d.ts +0 -11
- package/angular/build/types/modules/core/numerals.d.ts +0 -7
- package/angular/build/types/modules/core/options.d.ts +0 -8
- package/angular/build/types/modules/core/ui.d.ts +0 -30
- package/angular/build/types/modules/data/country-data.d.ts +0 -12
- package/angular/build/types/modules/data/intl-regionless.d.ts +0 -2
- package/angular/build/types/modules/data/nanp-regionless.d.ts +0 -2
- package/angular/build/types/modules/format/caret.d.ts +0 -1
- package/angular/build/types/modules/format/formatting.d.ts +0 -3
- package/angular/build/types/modules/types/events.d.ts +0 -10
- package/angular/build/types/modules/types/forEachInstanceArgsMap.d.ts +0 -6
- package/angular/build/types/modules/types/public-api.d.ts +0 -65
- package/angular/build/types/modules/utils/dom.d.ts +0 -6
- package/angular/build/types/modules/utils/isAndroid.d.ts +0 -1
- package/angular/build/types/modules/utils/string.d.ts +0 -2
- package/build/css/intlTelInput-no-assets.css +0 -1323
- package/build/css/intlTelInput-no-assets.min.css +0 -1
- package/build/css/intlTelInput.css +0 -1327
- package/build/css/intlTelInput.min.css +0 -1
- package/build/img/flags.png +0 -0
- package/build/img/flags.webp +0 -0
- package/build/img/flags@2x.png +0 -0
- package/build/img/flags@2x.webp +0 -0
- package/build/js/data.min.js +0 -20
- package/build/js/i18n/types.js +0 -0
- package/build/js/intlTelInput.d.ts +0 -671
- package/build/js/intlTelInput.min.js +0 -38
- package/build/js/intlTelInputWithUtils.min.js +0 -38
- package/index.js +0 -1
- package/react/build/IntlTelInput.d.ts +0 -721
- package/svelte/build/IntlTelInput.mjs +0 -5294
- package/svelte/build/IntlTelInputWithUtils.mjs +0 -11381
- package/vue/build/IntlTelInput.vue.d.ts +0 -34
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +0 -34
- package/vue/build/exports/IntlTelInput.d.ts +0 -3
- package/vue/build/exports/IntlTelInput.mjs +0 -86
- package/vue/build/exports/IntlTelInputWithUtils.d.ts +0 -3
- package/vue/build/exports/IntlTelInputWithUtils.mjs +0 -6173
- package/vue/build/intl-tel-input/data.d.ts +0 -20
- package/vue/build/intl-tel-input/i18n/ar/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bg/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bn/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bs/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ca/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/cs/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/da/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/de/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/el/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/en/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/es/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/et/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fa/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hu/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/id/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/index.d.ts +0 -45
- package/vue/build/intl-tel-input/i18n/it/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ja/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/kn/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ko/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/lt/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/mr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/nl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/no/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/pl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/pt/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ro/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ru/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sq/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sv/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/te/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/th/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/tr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/types.d.ts +0 -10
- package/vue/build/intl-tel-input/i18n/uk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ur/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/uz/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/vi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/zh/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
- package/vue/build/intl-tel-input-MeSkUgHd.mjs +0 -3438
- package/vue/build/intl-tel-input.d.ts +0 -46
- package/vue/build/modules/constants.d.ts +0 -94
- package/vue/build/modules/core/countrySearch.d.ts +0 -17
- package/vue/build/modules/core/icons.d.ts +0 -11
- package/vue/build/modules/core/numerals.d.ts +0 -7
- package/vue/build/modules/core/options.d.ts +0 -8
- package/vue/build/modules/core/ui.d.ts +0 -30
- package/vue/build/modules/data/country-data.d.ts +0 -12
- package/vue/build/modules/data/intl-regionless.d.ts +0 -2
- package/vue/build/modules/data/nanp-regionless.d.ts +0 -2
- package/vue/build/modules/format/caret.d.ts +0 -1
- package/vue/build/modules/format/formatting.d.ts +0 -3
- package/vue/build/modules/types/events.d.ts +0 -10
- package/vue/build/modules/types/forEachInstanceArgsMap.d.ts +0 -6
- package/vue/build/modules/types/public-api.d.ts +0 -65
- package/vue/build/modules/utils/dom.d.ts +0 -6
- package/vue/build/modules/utils/isAndroid.d.ts +0 -1
- package/vue/build/modules/utils/string.d.ts +0 -2
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// react/src/intl-tel-input/react.tsx
|
|
30
|
-
var react_exports = {};
|
|
31
|
-
__export(react_exports, {
|
|
32
|
-
default: () => react_default,
|
|
33
|
-
intlTelInput: () => intl_tel_input_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(react_exports);
|
|
36
|
-
|
|
37
|
-
// src/js/intl-tel-input/data.ts
|
|
1
|
+
// src/js/data.ts
|
|
38
2
|
var rawCountryData = [
|
|
39
3
|
[
|
|
40
4
|
"af",
|
|
@@ -1737,7 +1701,7 @@ var iso2Set = new Set(allCountries.map((c) => c.iso2));
|
|
|
1737
1701
|
var isIso2 = (val) => iso2Set.has(val);
|
|
1738
1702
|
var data_default = allCountries;
|
|
1739
1703
|
|
|
1740
|
-
// src/js/
|
|
1704
|
+
// src/js/constants.ts
|
|
1741
1705
|
var EVENTS = {
|
|
1742
1706
|
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
1743
1707
|
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
@@ -1858,10 +1822,10 @@ var ARIA = {
|
|
|
1858
1822
|
MODAL: "aria-modal"
|
|
1859
1823
|
};
|
|
1860
1824
|
|
|
1861
|
-
// src/js/
|
|
1825
|
+
// src/js/i18n/en.ts
|
|
1862
1826
|
var interfaceTranslations = {
|
|
1863
|
-
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1864
|
-
noCountrySelected: "Select country",
|
|
1827
|
+
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1828
|
+
noCountrySelected: "Select country for phone number",
|
|
1865
1829
|
countryListAriaLabel: "List of countries",
|
|
1866
1830
|
searchPlaceholder: "Search",
|
|
1867
1831
|
clearSearchAriaLabel: "Clear search",
|
|
@@ -1878,7 +1842,7 @@ var interfaceTranslations = {
|
|
|
1878
1842
|
};
|
|
1879
1843
|
var en_default = interfaceTranslations;
|
|
1880
1844
|
|
|
1881
|
-
// src/js/
|
|
1845
|
+
// src/js/core/options.ts
|
|
1882
1846
|
var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1883
1847
|
var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
|
|
1884
1848
|
var computeDefaultUseFullscreenPopup = () => {
|
|
@@ -1915,7 +1879,7 @@ var defaults = {
|
|
|
1915
1879
|
//* Append menu to specified element.
|
|
1916
1880
|
dropdownContainer: null,
|
|
1917
1881
|
//* Don't display these countries.
|
|
1918
|
-
excludeCountries:
|
|
1882
|
+
excludeCountries: null,
|
|
1919
1883
|
//* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
|
|
1920
1884
|
fixDropdownWidth: true,
|
|
1921
1885
|
//* Format the number as the user types
|
|
@@ -1935,7 +1899,7 @@ var defaults = {
|
|
|
1935
1899
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1936
1900
|
nationalMode: true,
|
|
1937
1901
|
//* Display only these countries.
|
|
1938
|
-
onlyCountries:
|
|
1902
|
+
onlyCountries: null,
|
|
1939
1903
|
//* Number type to use for placeholders.
|
|
1940
1904
|
placeholderNumberType: "MOBILE",
|
|
1941
1905
|
//* Add custom classes to the search input element.
|
|
@@ -1953,7 +1917,9 @@ var toString = (val) => JSON.stringify(val);
|
|
|
1953
1917
|
var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
|
|
1954
1918
|
var isFn = (val) => typeof val === "function";
|
|
1955
1919
|
var isElLike = (val) => {
|
|
1956
|
-
if (!val || typeof val !== "object")
|
|
1920
|
+
if (!val || typeof val !== "object") {
|
|
1921
|
+
return false;
|
|
1922
|
+
}
|
|
1957
1923
|
const v = val;
|
|
1958
1924
|
return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
|
|
1959
1925
|
};
|
|
@@ -2068,9 +2034,13 @@ var validateOptions = (customOptions) => {
|
|
|
2068
2034
|
break;
|
|
2069
2035
|
case "excludeCountries":
|
|
2070
2036
|
case "onlyCountries": {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2037
|
+
if (value === null) {
|
|
2038
|
+
validatedOptions[key] = value;
|
|
2039
|
+
} else {
|
|
2040
|
+
const filtered = validateIso2Array(key, value);
|
|
2041
|
+
if (filtered !== false) {
|
|
2042
|
+
validatedOptions[key] = filtered;
|
|
2043
|
+
}
|
|
2074
2044
|
}
|
|
2075
2045
|
break;
|
|
2076
2046
|
}
|
|
@@ -2154,7 +2124,7 @@ var applyOptionSideEffects = (o) => {
|
|
|
2154
2124
|
o.fixDropdownWidth = true;
|
|
2155
2125
|
}
|
|
2156
2126
|
}
|
|
2157
|
-
if (o.onlyCountries
|
|
2127
|
+
if (o.onlyCountries?.length === 1) {
|
|
2158
2128
|
o.initialCountry = o.onlyCountries[0];
|
|
2159
2129
|
}
|
|
2160
2130
|
if (o.separateDialCode) {
|
|
@@ -2169,14 +2139,14 @@ var applyOptionSideEffects = (o) => {
|
|
|
2169
2139
|
o.i18n = { ...en_default, ...o.i18n };
|
|
2170
2140
|
};
|
|
2171
2141
|
|
|
2172
|
-
// src/js/
|
|
2142
|
+
// src/js/helpers/string.ts
|
|
2173
2143
|
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
2174
2144
|
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
2175
2145
|
|
|
2176
|
-
// src/js/
|
|
2146
|
+
// src/js/helpers/isAndroid.ts
|
|
2177
2147
|
var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2178
2148
|
|
|
2179
|
-
// src/js/
|
|
2149
|
+
// src/js/core/countrySearch.ts
|
|
2180
2150
|
var getMatchedCountries = (countries, query) => {
|
|
2181
2151
|
const normalisedQuery = normaliseString(query);
|
|
2182
2152
|
const iso2Matches = [];
|
|
@@ -2221,7 +2191,7 @@ var findFirstCountryStartingWith = (countries, query) => {
|
|
|
2221
2191
|
return null;
|
|
2222
2192
|
};
|
|
2223
2193
|
|
|
2224
|
-
// src/js/
|
|
2194
|
+
// src/js/helpers/dom.ts
|
|
2225
2195
|
var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
|
|
2226
2196
|
var createEl = (tagName, attrs, container) => {
|
|
2227
2197
|
const el = document.createElement(tagName);
|
|
@@ -2236,7 +2206,7 @@ var createEl = (tagName, attrs, container) => {
|
|
|
2236
2206
|
return el;
|
|
2237
2207
|
};
|
|
2238
2208
|
|
|
2239
|
-
// src/js/
|
|
2209
|
+
// src/js/core/icons.ts
|
|
2240
2210
|
var buildSearchIcon = () => `
|
|
2241
2211
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
|
|
2242
2212
|
<circle cx="11" cy="11" r="7" />
|
|
@@ -2263,31 +2233,15 @@ var buildGlobeIcon = () => `
|
|
|
2263
2233
|
<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"/>
|
|
2264
2234
|
</svg>`;
|
|
2265
2235
|
|
|
2266
|
-
// src/js/
|
|
2236
|
+
// src/js/core/ui.ts
|
|
2267
2237
|
var UI = class _UI {
|
|
2268
|
-
constructor(input, options, id2) {
|
|
2269
|
-
this.#searchKeyupTimer = null;
|
|
2270
|
-
this.#inlineDropdownHeight = null;
|
|
2271
|
-
this.#dropdownForContainer = null;
|
|
2272
|
-
this.#selectedItem = null;
|
|
2273
|
-
this.highlightedItem = null;
|
|
2274
|
-
input.dataset.intlTelInputId = id2.toString();
|
|
2275
|
-
this.telInput = input;
|
|
2276
|
-
this.#options = options;
|
|
2277
|
-
this.#id = id2;
|
|
2278
|
-
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
2279
|
-
this.#isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2280
|
-
if (this.#options.separateDialCode) {
|
|
2281
|
-
this.#originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
2238
|
// private
|
|
2285
2239
|
#options;
|
|
2286
2240
|
#id;
|
|
2287
2241
|
#isRTL;
|
|
2288
|
-
#originalPaddingLeft;
|
|
2242
|
+
#originalPaddingLeft = "";
|
|
2289
2243
|
#countries;
|
|
2290
|
-
#searchKeyupTimer;
|
|
2244
|
+
#searchKeyupTimer = null;
|
|
2291
2245
|
#inlineDropdownHeight;
|
|
2292
2246
|
#selectedDialCode;
|
|
2293
2247
|
#dropdownArrow;
|
|
@@ -2296,7 +2250,30 @@ var UI = class _UI {
|
|
|
2296
2250
|
#searchNoResults;
|
|
2297
2251
|
#searchResultsA11yText;
|
|
2298
2252
|
#dropdownForContainer;
|
|
2299
|
-
#selectedItem;
|
|
2253
|
+
#selectedItem = null;
|
|
2254
|
+
// public
|
|
2255
|
+
telInput;
|
|
2256
|
+
countryContainer;
|
|
2257
|
+
selectedCountry;
|
|
2258
|
+
selectedCountryInner;
|
|
2259
|
+
searchInput;
|
|
2260
|
+
searchClearButton;
|
|
2261
|
+
countryList;
|
|
2262
|
+
hiddenInputPhone;
|
|
2263
|
+
hiddenInputCountry;
|
|
2264
|
+
highlightedItem = null;
|
|
2265
|
+
hadInitialPlaceholder;
|
|
2266
|
+
constructor(input, options, id2) {
|
|
2267
|
+
input.dataset.intlTelInputId = id2.toString();
|
|
2268
|
+
this.telInput = input;
|
|
2269
|
+
this.#options = options;
|
|
2270
|
+
this.#id = id2;
|
|
2271
|
+
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
2272
|
+
this.#isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2273
|
+
if (this.#options.separateDialCode) {
|
|
2274
|
+
this.#originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2300
2277
|
// Validate that the provided element is an HTMLInputElement.
|
|
2301
2278
|
static validateInput(input) {
|
|
2302
2279
|
const tagName = input?.tagName;
|
|
@@ -2312,6 +2289,9 @@ var UI = class _UI {
|
|
|
2312
2289
|
generateMarkup(countries) {
|
|
2313
2290
|
this.#countries = countries;
|
|
2314
2291
|
this.telInput.classList.add("iti__tel-input");
|
|
2292
|
+
if (!this.telInput.hasAttribute("type")) {
|
|
2293
|
+
this.telInput.setAttribute("type", "tel");
|
|
2294
|
+
}
|
|
2315
2295
|
if (!this.telInput.hasAttribute("autocomplete")) {
|
|
2316
2296
|
this.telInput.setAttribute("autocomplete", "tel");
|
|
2317
2297
|
}
|
|
@@ -2531,7 +2511,7 @@ var UI = class _UI {
|
|
|
2531
2511
|
},
|
|
2532
2512
|
this.#dropdownContent
|
|
2533
2513
|
);
|
|
2534
|
-
this.#searchNoResults.textContent = i18n.searchEmptyState;
|
|
2514
|
+
this.#searchNoResults.textContent = i18n.searchEmptyState ?? null;
|
|
2535
2515
|
}
|
|
2536
2516
|
#maybeUpdateInputPaddingAndReveal() {
|
|
2537
2517
|
if (this.countryContainer) {
|
|
@@ -2549,13 +2529,13 @@ var UI = class _UI {
|
|
|
2549
2529
|
`input[name="${names.phone}"]`
|
|
2550
2530
|
);
|
|
2551
2531
|
if (existingInput) {
|
|
2552
|
-
this.
|
|
2532
|
+
this.hiddenInputPhone = existingInput;
|
|
2553
2533
|
} else {
|
|
2554
|
-
this.
|
|
2534
|
+
this.hiddenInputPhone = createEl("input", {
|
|
2555
2535
|
type: "hidden",
|
|
2556
2536
|
name: names.phone
|
|
2557
2537
|
});
|
|
2558
|
-
wrapper.appendChild(this.
|
|
2538
|
+
wrapper.appendChild(this.hiddenInputPhone);
|
|
2559
2539
|
}
|
|
2560
2540
|
}
|
|
2561
2541
|
if (names.country) {
|
|
@@ -2800,28 +2780,9 @@ var UI = class _UI {
|
|
|
2800
2780
|
const wrapper = this.telInput.parentNode;
|
|
2801
2781
|
wrapper.before(this.telInput);
|
|
2802
2782
|
wrapper.remove();
|
|
2803
|
-
this.telInput = null;
|
|
2804
|
-
this.countryContainer = null;
|
|
2805
|
-
this.selectedCountry = null;
|
|
2806
|
-
this.selectedCountryInner = null;
|
|
2807
|
-
this.searchInput = null;
|
|
2808
|
-
this.searchClearButton = null;
|
|
2809
|
-
this.countryList = null;
|
|
2810
|
-
this.hiddenInput = null;
|
|
2811
|
-
this.hiddenInputCountry = null;
|
|
2812
|
-
this.highlightedItem = null;
|
|
2813
|
-
this.#selectedDialCode = null;
|
|
2814
|
-
this.#dropdownArrow = null;
|
|
2815
|
-
this.#dropdownContent = null;
|
|
2816
|
-
this.#searchIcon = null;
|
|
2817
|
-
this.#searchNoResults = null;
|
|
2818
|
-
this.#searchResultsA11yText = null;
|
|
2819
|
-
this.#dropdownForContainer = null;
|
|
2820
|
-
this.#selectedItem = null;
|
|
2821
2783
|
for (const c of this.#countries) {
|
|
2822
2784
|
delete c.nodeById[this.#id];
|
|
2823
2785
|
}
|
|
2824
|
-
this.#countries = null;
|
|
2825
2786
|
}
|
|
2826
2787
|
// UI: Open the dropdown (DOM only).
|
|
2827
2788
|
openDropdown() {
|
|
@@ -2845,10 +2806,10 @@ var UI = class _UI {
|
|
|
2845
2806
|
this.#dropdownContent.classList.remove(CLASSES.HIDE);
|
|
2846
2807
|
this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
|
|
2847
2808
|
if (countrySearch) {
|
|
2848
|
-
const
|
|
2849
|
-
if (
|
|
2850
|
-
this.highlightListItem(
|
|
2851
|
-
this.
|
|
2809
|
+
const itemToHighlight = this.#selectedItem ?? this.countryList.firstElementChild;
|
|
2810
|
+
if (itemToHighlight) {
|
|
2811
|
+
this.highlightListItem(itemToHighlight, false);
|
|
2812
|
+
this.scrollCountryListToItem(itemToHighlight);
|
|
2852
2813
|
}
|
|
2853
2814
|
if (!dropdownAlwaysOpen) {
|
|
2854
2815
|
this.searchInput.focus();
|
|
@@ -2863,6 +2824,8 @@ var UI = class _UI {
|
|
|
2863
2824
|
this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
|
|
2864
2825
|
if (countrySearch) {
|
|
2865
2826
|
this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
|
|
2827
|
+
this.searchInput.value = "";
|
|
2828
|
+
this.#doFilter();
|
|
2866
2829
|
if (this.highlightedItem) {
|
|
2867
2830
|
this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
|
|
2868
2831
|
this.highlightedItem = null;
|
|
@@ -2917,7 +2880,9 @@ var UI = class _UI {
|
|
|
2917
2880
|
}
|
|
2918
2881
|
setCountry(selectedCountryData) {
|
|
2919
2882
|
const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
|
|
2920
|
-
const
|
|
2883
|
+
const name = selectedCountryData?.name;
|
|
2884
|
+
const dialCode = selectedCountryData?.dialCode;
|
|
2885
|
+
const iso2 = selectedCountryData?.iso2 ?? "";
|
|
2921
2886
|
if (allowDropdown) {
|
|
2922
2887
|
this.#updateSelectedItem(iso2);
|
|
2923
2888
|
}
|
|
@@ -2946,7 +2911,7 @@ var UI = class _UI {
|
|
|
2946
2911
|
}
|
|
2947
2912
|
};
|
|
2948
2913
|
|
|
2949
|
-
// src/js/
|
|
2914
|
+
// src/js/data/country-data.ts
|
|
2950
2915
|
var processAllCountries = (options) => {
|
|
2951
2916
|
const { onlyCountries, excludeCountries } = options;
|
|
2952
2917
|
if (onlyCountries?.length) {
|
|
@@ -3051,7 +3016,7 @@ var cacheSearchTokens = (countries) => {
|
|
|
3051
3016
|
}
|
|
3052
3017
|
};
|
|
3053
3018
|
|
|
3054
|
-
// src/js/
|
|
3019
|
+
// src/js/data/intl-regionless.ts
|
|
3055
3020
|
var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
|
|
3056
3021
|
"800",
|
|
3057
3022
|
"808",
|
|
@@ -3067,7 +3032,7 @@ var hasRegionlessDialCode = (number) => {
|
|
|
3067
3032
|
return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
|
|
3068
3033
|
};
|
|
3069
3034
|
|
|
3070
|
-
// src/js/
|
|
3035
|
+
// src/js/format/formatting.ts
|
|
3071
3036
|
var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
|
|
3072
3037
|
let number = fullNumber;
|
|
3073
3038
|
if (separateDialCode) {
|
|
@@ -3080,8 +3045,8 @@ var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedC
|
|
|
3080
3045
|
return number;
|
|
3081
3046
|
};
|
|
3082
3047
|
var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
|
|
3083
|
-
const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData
|
|
3084
|
-
const
|
|
3048
|
+
const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData?.iso2) : fullNumber;
|
|
3049
|
+
const dialCode = selectedCountryData?.dialCode;
|
|
3085
3050
|
if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
3086
3051
|
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
3087
3052
|
return afterDialCode.trim();
|
|
@@ -3089,7 +3054,7 @@ var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryDa
|
|
|
3089
3054
|
return result;
|
|
3090
3055
|
};
|
|
3091
3056
|
|
|
3092
|
-
// src/js/
|
|
3057
|
+
// src/js/format/caret.ts
|
|
3093
3058
|
var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
|
|
3094
3059
|
if (prevCaretPos === 0 && !isDeleteForwards) {
|
|
3095
3060
|
return 0;
|
|
@@ -3109,7 +3074,7 @@ var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDe
|
|
|
3109
3074
|
return formattedValue.length;
|
|
3110
3075
|
};
|
|
3111
3076
|
|
|
3112
|
-
// src/js/
|
|
3077
|
+
// src/js/data/nanp-regionless.ts
|
|
3113
3078
|
var regionlessNanpNumbers = /* @__PURE__ */ new Set([
|
|
3114
3079
|
"800",
|
|
3115
3080
|
"822",
|
|
@@ -3138,7 +3103,7 @@ var isRegionlessNanp = (number) => {
|
|
|
3138
3103
|
return false;
|
|
3139
3104
|
};
|
|
3140
3105
|
|
|
3141
|
-
// src/js/
|
|
3106
|
+
// src/js/core/numerals.ts
|
|
3142
3107
|
var Numerals = class {
|
|
3143
3108
|
#userNumeralSet;
|
|
3144
3109
|
constructor(initialValue) {
|
|
@@ -3185,7 +3150,26 @@ var Numerals = class {
|
|
|
3185
3150
|
|
|
3186
3151
|
// src/js/intl-tel-input.ts
|
|
3187
3152
|
var id = 0;
|
|
3153
|
+
var ensureUtils = (methodName) => {
|
|
3154
|
+
if (!intlTelInput.utils) {
|
|
3155
|
+
throw new Error(`intlTelInput.utils is required for ${methodName}(). See: https://intl-tel-input.com/docs/utils`);
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
var createDeferred = () => {
|
|
3159
|
+
let resolve;
|
|
3160
|
+
let reject;
|
|
3161
|
+
const promise = new Promise((res, rej) => {
|
|
3162
|
+
resolve = res;
|
|
3163
|
+
reject = rej;
|
|
3164
|
+
});
|
|
3165
|
+
return { promise, resolve, reject };
|
|
3166
|
+
};
|
|
3188
3167
|
var Iti = class _Iti {
|
|
3168
|
+
//* PUBLIC FIELDS - READONLY
|
|
3169
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
3170
|
+
id;
|
|
3171
|
+
// accessed externally via iti.promise.then(...)
|
|
3172
|
+
promise;
|
|
3189
3173
|
//* PRIVATE FIELDS
|
|
3190
3174
|
#ui;
|
|
3191
3175
|
#options;
|
|
@@ -3196,16 +3180,15 @@ var Iti = class _Iti {
|
|
|
3196
3180
|
#dialCodeToIso2Map;
|
|
3197
3181
|
#dialCodes;
|
|
3198
3182
|
#countryByIso2;
|
|
3199
|
-
#selectedCountryData;
|
|
3200
|
-
#maxCoreNumberLength;
|
|
3183
|
+
#selectedCountryData = null;
|
|
3184
|
+
#maxCoreNumberLength = null;
|
|
3201
3185
|
#defaultCountry;
|
|
3186
|
+
#destroyed = false;
|
|
3202
3187
|
#abortController;
|
|
3203
|
-
#dropdownAbortController;
|
|
3188
|
+
#dropdownAbortController = null;
|
|
3204
3189
|
#numerals;
|
|
3205
|
-
#
|
|
3206
|
-
#
|
|
3207
|
-
#resolveUtilsScriptPromise;
|
|
3208
|
-
#rejectUtilsScriptPromise;
|
|
3190
|
+
#autoCountryDeferred;
|
|
3191
|
+
#utilsScriptDeferred;
|
|
3209
3192
|
constructor(input, customOptions = {}) {
|
|
3210
3193
|
this.id = id++;
|
|
3211
3194
|
UI.validateInput(input);
|
|
@@ -3238,37 +3221,19 @@ var Iti = class _Iti {
|
|
|
3238
3221
|
const { initialCountry, geoIpLookup, loadUtils } = options;
|
|
3239
3222
|
const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
|
|
3240
3223
|
const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
|
|
3241
|
-
let autoCountryPromise;
|
|
3242
3224
|
if (needsAutoCountryPromise) {
|
|
3243
|
-
|
|
3244
|
-
this.#resolveAutoCountryPromise = resolve;
|
|
3245
|
-
this.#rejectAutoCountryPromise = reject;
|
|
3246
|
-
});
|
|
3247
|
-
} else {
|
|
3248
|
-
autoCountryPromise = Promise.resolve(void 0);
|
|
3249
|
-
this.#resolveAutoCountryPromise = () => {
|
|
3250
|
-
};
|
|
3251
|
-
this.#rejectAutoCountryPromise = () => {
|
|
3252
|
-
};
|
|
3225
|
+
this.#autoCountryDeferred = createDeferred();
|
|
3253
3226
|
}
|
|
3254
|
-
let utilsScriptPromise;
|
|
3255
3227
|
if (needsUtilsScriptPromise) {
|
|
3256
|
-
|
|
3257
|
-
this.#resolveUtilsScriptPromise = resolve;
|
|
3258
|
-
this.#rejectUtilsScriptPromise = reject;
|
|
3259
|
-
});
|
|
3260
|
-
} else {
|
|
3261
|
-
utilsScriptPromise = Promise.resolve(void 0);
|
|
3262
|
-
this.#resolveUtilsScriptPromise = () => {
|
|
3263
|
-
};
|
|
3264
|
-
this.#rejectUtilsScriptPromise = () => {
|
|
3265
|
-
};
|
|
3228
|
+
this.#utilsScriptDeferred = createDeferred();
|
|
3266
3229
|
}
|
|
3267
|
-
return Promise.all([
|
|
3230
|
+
return Promise.all([
|
|
3231
|
+
this.#autoCountryDeferred?.promise,
|
|
3232
|
+
this.#utilsScriptDeferred?.promise
|
|
3233
|
+
]).then(() => {
|
|
3268
3234
|
});
|
|
3269
3235
|
}
|
|
3270
3236
|
#init() {
|
|
3271
|
-
this.#selectedCountryData = null;
|
|
3272
3237
|
this.#abortController = new AbortController();
|
|
3273
3238
|
this.#processCountryData();
|
|
3274
3239
|
this.#ui.generateMarkup(this.#countries);
|
|
@@ -3293,7 +3258,7 @@ var Iti = class _Iti {
|
|
|
3293
3258
|
//* 2. Using explicit initialCountry
|
|
3294
3259
|
#setInitialState(overrideAutoCountry = false) {
|
|
3295
3260
|
const attributeValueRaw = this.#ui.telInput.getAttribute("value");
|
|
3296
|
-
const attributeValue = this.#numerals.normalise(attributeValueRaw);
|
|
3261
|
+
const attributeValue = this.#numerals.normalise(attributeValueRaw ?? "");
|
|
3297
3262
|
const inputValue = this.#getTelInputValue();
|
|
3298
3263
|
const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
|
|
3299
3264
|
const val = useAttribute ? attributeValue : inputValue;
|
|
@@ -3328,15 +3293,15 @@ var Iti = class _Iti {
|
|
|
3328
3293
|
if (this.#options.allowDropdown) {
|
|
3329
3294
|
this.#initDropdownListeners();
|
|
3330
3295
|
}
|
|
3331
|
-
if ((this.#ui.
|
|
3296
|
+
if ((this.#ui.hiddenInputPhone || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
|
|
3332
3297
|
this.#initHiddenInputListener();
|
|
3333
3298
|
}
|
|
3334
3299
|
}
|
|
3335
3300
|
//* Update hidden input on form submit.
|
|
3336
3301
|
#initHiddenInputListener() {
|
|
3337
3302
|
const handleHiddenInputSubmit = () => {
|
|
3338
|
-
if (this.#ui.
|
|
3339
|
-
this.#ui.
|
|
3303
|
+
if (this.#ui.hiddenInputPhone) {
|
|
3304
|
+
this.#ui.hiddenInputPhone.value = this.getNumber();
|
|
3340
3305
|
}
|
|
3341
3306
|
if (this.#ui.hiddenInputCountry) {
|
|
3342
3307
|
this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
|
|
@@ -3405,12 +3370,12 @@ var Iti = class _Iti {
|
|
|
3405
3370
|
});
|
|
3406
3371
|
}
|
|
3407
3372
|
} else {
|
|
3408
|
-
this.#
|
|
3373
|
+
this.#utilsScriptDeferred?.resolve();
|
|
3409
3374
|
}
|
|
3410
3375
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
3411
3376
|
if (isAutoCountry) {
|
|
3412
|
-
if (this.#selectedCountryData
|
|
3413
|
-
this.#
|
|
3377
|
+
if (this.#selectedCountryData) {
|
|
3378
|
+
this.#autoCountryDeferred?.resolve();
|
|
3414
3379
|
} else {
|
|
3415
3380
|
this.#loadAutoCountry();
|
|
3416
3381
|
}
|
|
@@ -3505,7 +3470,7 @@ var Iti = class _Iti {
|
|
|
3505
3470
|
fullNumber,
|
|
3506
3471
|
inputValue,
|
|
3507
3472
|
intlTelInput.utils,
|
|
3508
|
-
this.#selectedCountryData
|
|
3473
|
+
this.#selectedCountryData,
|
|
3509
3474
|
separateDialCode
|
|
3510
3475
|
);
|
|
3511
3476
|
const newCaretPos = translateCursorPosition(
|
|
@@ -3522,7 +3487,7 @@ var Iti = class _Iti {
|
|
|
3522
3487
|
inputValue,
|
|
3523
3488
|
true,
|
|
3524
3489
|
separateDialCode,
|
|
3525
|
-
this.#selectedCountryData
|
|
3490
|
+
this.#selectedCountryData
|
|
3526
3491
|
);
|
|
3527
3492
|
this.#setTelInputValue(cleanNumber);
|
|
3528
3493
|
}
|
|
@@ -3555,8 +3520,8 @@ var Iti = class _Iti {
|
|
|
3555
3520
|
const input = this.#ui.telInput;
|
|
3556
3521
|
const selStart = input.selectionStart;
|
|
3557
3522
|
const selEnd = input.selectionEnd;
|
|
3558
|
-
const before = inputValue.slice(0, selStart);
|
|
3559
|
-
const after = inputValue.slice(selEnd);
|
|
3523
|
+
const before = inputValue.slice(0, selStart ?? void 0);
|
|
3524
|
+
const after = inputValue.slice(selEnd ?? void 0);
|
|
3560
3525
|
const newValue = before + e.key + after;
|
|
3561
3526
|
const newFullNumber = this.#getFullNumber(newValue);
|
|
3562
3527
|
let hasExceededMaxLength = false;
|
|
@@ -3588,8 +3553,8 @@ var Iti = class _Iti {
|
|
|
3588
3553
|
const selStart = input.selectionStart;
|
|
3589
3554
|
const selEnd = input.selectionEnd;
|
|
3590
3555
|
const inputValue = this.#getTelInputValue();
|
|
3591
|
-
const before = inputValue.slice(0, selStart);
|
|
3592
|
-
const after = inputValue.slice(selEnd);
|
|
3556
|
+
const before = inputValue.slice(0, selStart ?? void 0);
|
|
3557
|
+
const after = inputValue.slice(selEnd ?? void 0);
|
|
3593
3558
|
const iso2 = this.#selectedCountryData?.iso2;
|
|
3594
3559
|
const pastedRaw = e.clipboardData.getData("text");
|
|
3595
3560
|
const pasted = this.#numerals.normalise(pastedRaw);
|
|
@@ -3600,7 +3565,7 @@ var Iti = class _Iti {
|
|
|
3600
3565
|
const numerics = allowedChars.replace(/\+/g, "");
|
|
3601
3566
|
const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
|
|
3602
3567
|
let newVal = before + sanitised + after;
|
|
3603
|
-
if (newVal.length > 5) {
|
|
3568
|
+
if (newVal.length > 5 && intlTelInput.utils) {
|
|
3604
3569
|
let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
3605
3570
|
while (coreNumber.length === 0 && newVal.length > 0) {
|
|
3606
3571
|
newVal = newVal.slice(0, -1);
|
|
@@ -3890,10 +3855,10 @@ var Iti = class _Iti {
|
|
|
3890
3855
|
#setCountry(iso2) {
|
|
3891
3856
|
const prevIso2 = this.#selectedCountryData?.iso2 || "";
|
|
3892
3857
|
this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
|
|
3893
|
-
if (this.#selectedCountryData
|
|
3858
|
+
if (this.#selectedCountryData) {
|
|
3894
3859
|
this.#defaultCountry = this.#selectedCountryData.iso2;
|
|
3895
3860
|
}
|
|
3896
|
-
this.#ui.setCountry(this.#selectedCountryData
|
|
3861
|
+
this.#ui.setCountry(this.#selectedCountryData);
|
|
3897
3862
|
this.#updatePlaceholder();
|
|
3898
3863
|
this.#updateMaxLength();
|
|
3899
3864
|
return prevIso2 !== iso2;
|
|
@@ -3941,14 +3906,14 @@ var Iti = class _Iti {
|
|
|
3941
3906
|
const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
|
|
3942
3907
|
if (intlTelInput.utils && shouldSetPlaceholder) {
|
|
3943
3908
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
3944
|
-
let placeholder = this.#selectedCountryData
|
|
3909
|
+
let placeholder = this.#selectedCountryData ? intlTelInput.utils.getExampleNumber(
|
|
3945
3910
|
this.#selectedCountryData.iso2,
|
|
3946
3911
|
nationalMode,
|
|
3947
3912
|
numberType
|
|
3948
3913
|
) : "";
|
|
3949
3914
|
placeholder = this.#beforeSetNumber(placeholder);
|
|
3950
3915
|
if (typeof customPlaceholder === "function") {
|
|
3951
|
-
placeholder = customPlaceholder(placeholder, this.#selectedCountryData
|
|
3916
|
+
placeholder = customPlaceholder(placeholder, this.#selectedCountryData);
|
|
3952
3917
|
}
|
|
3953
3918
|
this.#ui.telInput.setAttribute("placeholder", placeholder);
|
|
3954
3919
|
}
|
|
@@ -4047,14 +4012,16 @@ var Iti = class _Iti {
|
|
|
4047
4012
|
fullNumber,
|
|
4048
4013
|
hasValidDialCode,
|
|
4049
4014
|
this.#options.separateDialCode,
|
|
4050
|
-
this.#selectedCountryData
|
|
4015
|
+
this.#selectedCountryData
|
|
4051
4016
|
);
|
|
4052
4017
|
return this.#cap(number);
|
|
4053
4018
|
}
|
|
4054
4019
|
//* Return only the public-facing subset of the selected country data.
|
|
4055
4020
|
#getPublicCountryData() {
|
|
4056
4021
|
const d = this.#selectedCountryData;
|
|
4057
|
-
if (!d)
|
|
4022
|
+
if (!d) {
|
|
4023
|
+
return null;
|
|
4024
|
+
}
|
|
4058
4025
|
const { iso2, dialCode, name } = d;
|
|
4059
4026
|
return { iso2, dialCode, name };
|
|
4060
4027
|
}
|
|
@@ -4068,32 +4035,32 @@ var Iti = class _Iti {
|
|
|
4068
4035
|
//**************************
|
|
4069
4036
|
//* Called when the geoip call returns.
|
|
4070
4037
|
#handleAutoCountry() {
|
|
4071
|
-
if (
|
|
4072
|
-
this.#
|
|
4038
|
+
if (this.#destroyed) {
|
|
4039
|
+
this.#autoCountryDeferred?.resolve();
|
|
4073
4040
|
return;
|
|
4074
4041
|
}
|
|
4075
4042
|
if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
|
|
4076
4043
|
this.#defaultCountry = intlTelInput.autoCountry;
|
|
4077
|
-
const hasSelectedCountryOrGlobe = this.#selectedCountryData
|
|
4044
|
+
const hasSelectedCountryOrGlobe = this.#selectedCountryData || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
|
|
4078
4045
|
if (!hasSelectedCountryOrGlobe) {
|
|
4079
4046
|
this.setCountry(this.#defaultCountry);
|
|
4080
4047
|
}
|
|
4081
|
-
this.#
|
|
4048
|
+
this.#autoCountryDeferred?.resolve();
|
|
4082
4049
|
}
|
|
4083
4050
|
}
|
|
4084
4051
|
//* Called when the geoip call fails or times out.
|
|
4085
4052
|
#handleAutoCountryFailure() {
|
|
4086
|
-
if (
|
|
4087
|
-
this.#
|
|
4053
|
+
if (this.#destroyed) {
|
|
4054
|
+
this.#autoCountryDeferred?.reject();
|
|
4088
4055
|
return;
|
|
4089
4056
|
}
|
|
4090
4057
|
this.#setInitialState(true);
|
|
4091
|
-
this.#
|
|
4058
|
+
this.#autoCountryDeferred?.reject();
|
|
4092
4059
|
}
|
|
4093
4060
|
//* Called when the utils request completes.
|
|
4094
4061
|
#handleUtils() {
|
|
4095
|
-
if (
|
|
4096
|
-
this.#
|
|
4062
|
+
if (this.#destroyed) {
|
|
4063
|
+
this.#utilsScriptDeferred?.resolve();
|
|
4097
4064
|
return;
|
|
4098
4065
|
}
|
|
4099
4066
|
if (intlTelInput.utils) {
|
|
@@ -4101,74 +4068,77 @@ var Iti = class _Iti {
|
|
|
4101
4068
|
if (inputValue) {
|
|
4102
4069
|
this.#updateValFromNumber(inputValue);
|
|
4103
4070
|
}
|
|
4104
|
-
if (this.#selectedCountryData
|
|
4071
|
+
if (this.#selectedCountryData) {
|
|
4105
4072
|
this.#updatePlaceholder();
|
|
4106
4073
|
this.#updateMaxLength();
|
|
4107
4074
|
}
|
|
4108
4075
|
}
|
|
4109
|
-
this.#
|
|
4076
|
+
this.#utilsScriptDeferred?.resolve();
|
|
4110
4077
|
}
|
|
4111
4078
|
//* Called when the utils request fails or times out.
|
|
4112
4079
|
#handleUtilsFailure(error) {
|
|
4113
|
-
if (
|
|
4114
|
-
this.#
|
|
4080
|
+
if (this.#destroyed) {
|
|
4081
|
+
this.#utilsScriptDeferred?.reject(error);
|
|
4115
4082
|
return;
|
|
4116
4083
|
}
|
|
4117
|
-
this.#
|
|
4084
|
+
this.#utilsScriptDeferred?.reject(error);
|
|
4118
4085
|
}
|
|
4119
4086
|
//********************
|
|
4120
4087
|
//* PUBLIC METHODS
|
|
4121
4088
|
//********************
|
|
4122
4089
|
//* Remove plugin.
|
|
4123
4090
|
destroy() {
|
|
4124
|
-
if (
|
|
4091
|
+
if (this.#destroyed) {
|
|
4125
4092
|
return;
|
|
4126
4093
|
}
|
|
4094
|
+
this.#destroyed = true;
|
|
4127
4095
|
if (this.#options.allowDropdown) {
|
|
4128
4096
|
this.#closeDropdown(true);
|
|
4129
4097
|
}
|
|
4130
4098
|
this.#abortController.abort();
|
|
4131
|
-
this.#abortController = null;
|
|
4132
4099
|
this.#ui.destroy();
|
|
4133
|
-
|
|
4100
|
+
intlTelInput.instances.delete(String(this.id));
|
|
4134
4101
|
}
|
|
4135
|
-
// check if the instance is still valid (not destroyed
|
|
4102
|
+
// check if the instance is still valid (not destroyed)
|
|
4136
4103
|
isActive() {
|
|
4137
|
-
return
|
|
4104
|
+
return !this.#destroyed;
|
|
4138
4105
|
}
|
|
4139
4106
|
//* Get the extension from the current number.
|
|
4140
4107
|
getExtension() {
|
|
4141
|
-
if (
|
|
4142
|
-
return
|
|
4143
|
-
this.#getFullNumber(),
|
|
4144
|
-
this.#selectedCountryData?.iso2
|
|
4145
|
-
);
|
|
4108
|
+
if (this.#destroyed) {
|
|
4109
|
+
return "";
|
|
4146
4110
|
}
|
|
4147
|
-
|
|
4111
|
+
ensureUtils("getExtension");
|
|
4112
|
+
return intlTelInput.utils.getExtension(
|
|
4113
|
+
this.#getFullNumber(),
|
|
4114
|
+
this.#selectedCountryData?.iso2
|
|
4115
|
+
);
|
|
4148
4116
|
}
|
|
4149
4117
|
//* Format the number to the given format.
|
|
4150
4118
|
getNumber(format) {
|
|
4151
|
-
if (
|
|
4152
|
-
|
|
4153
|
-
const fullNumber = this.#getFullNumber();
|
|
4154
|
-
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
4155
|
-
fullNumber,
|
|
4156
|
-
iso2,
|
|
4157
|
-
format
|
|
4158
|
-
);
|
|
4159
|
-
return this.#numerals.denormalise(formattedNumber);
|
|
4119
|
+
if (this.#destroyed) {
|
|
4120
|
+
return "";
|
|
4160
4121
|
}
|
|
4161
|
-
|
|
4122
|
+
ensureUtils("getNumber");
|
|
4123
|
+
const iso2 = this.#selectedCountryData?.iso2;
|
|
4124
|
+
const fullNumber = this.#getFullNumber();
|
|
4125
|
+
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
4126
|
+
fullNumber,
|
|
4127
|
+
iso2,
|
|
4128
|
+
format
|
|
4129
|
+
);
|
|
4130
|
+
return this.#numerals.denormalise(formattedNumber);
|
|
4162
4131
|
}
|
|
4163
4132
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
4164
4133
|
getNumberType() {
|
|
4165
|
-
if (
|
|
4166
|
-
return
|
|
4167
|
-
this.#getFullNumber(),
|
|
4168
|
-
this.#selectedCountryData?.iso2
|
|
4169
|
-
);
|
|
4134
|
+
if (this.#destroyed) {
|
|
4135
|
+
return SENTINELS.UNKNOWN_NUMBER_TYPE;
|
|
4170
4136
|
}
|
|
4171
|
-
|
|
4137
|
+
ensureUtils("getNumberType");
|
|
4138
|
+
return intlTelInput.utils.getNumberType(
|
|
4139
|
+
this.#getFullNumber(),
|
|
4140
|
+
this.#selectedCountryData?.iso2
|
|
4141
|
+
);
|
|
4172
4142
|
}
|
|
4173
4143
|
//* Get the country data for the currently selected country.
|
|
4174
4144
|
getSelectedCountryData() {
|
|
@@ -4176,32 +4146,35 @@ var Iti = class _Iti {
|
|
|
4176
4146
|
}
|
|
4177
4147
|
//* Get the validation error.
|
|
4178
4148
|
getValidationError() {
|
|
4179
|
-
if (
|
|
4180
|
-
|
|
4181
|
-
return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
|
|
4149
|
+
if (this.#destroyed) {
|
|
4150
|
+
return SENTINELS.UNKNOWN_VALIDATION_ERROR;
|
|
4182
4151
|
}
|
|
4183
|
-
|
|
4152
|
+
ensureUtils("getValidationError");
|
|
4153
|
+
const iso2 = this.#selectedCountryData?.iso2;
|
|
4154
|
+
return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
|
|
4184
4155
|
}
|
|
4185
4156
|
//* Validate the input val using number length only
|
|
4186
4157
|
isValidNumber() {
|
|
4158
|
+
if (this.#destroyed) {
|
|
4159
|
+
return null;
|
|
4160
|
+
}
|
|
4161
|
+
ensureUtils("isValidNumber");
|
|
4187
4162
|
const dialCode = this.#selectedCountryData?.dialCode;
|
|
4188
4163
|
const iso2 = this.#selectedCountryData?.iso2;
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
if (
|
|
4193
|
-
if (
|
|
4194
|
-
|
|
4195
|
-
return false;
|
|
4196
|
-
}
|
|
4164
|
+
const number = this.#getFullNumber();
|
|
4165
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
4166
|
+
if (coreNumber) {
|
|
4167
|
+
if (dialCode === UK.DIAL_CODE) {
|
|
4168
|
+
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4169
|
+
return false;
|
|
4197
4170
|
}
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4171
|
+
}
|
|
4172
|
+
const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
|
|
4173
|
+
if (!hasAlphaChar && dialCode) {
|
|
4174
|
+
const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
|
|
4175
|
+
const nationalDigitCount = getNumeric(nationalPortion).length;
|
|
4176
|
+
if (coreNumber.length > nationalDigitCount) {
|
|
4177
|
+
return false;
|
|
4205
4178
|
}
|
|
4206
4179
|
}
|
|
4207
4180
|
}
|
|
@@ -4209,6 +4182,10 @@ var Iti = class _Iti {
|
|
|
4209
4182
|
}
|
|
4210
4183
|
//* Validate the input val with precise validation
|
|
4211
4184
|
isValidNumberPrecise() {
|
|
4185
|
+
if (this.#destroyed) {
|
|
4186
|
+
return null;
|
|
4187
|
+
}
|
|
4188
|
+
ensureUtils("isValidNumberPrecise");
|
|
4212
4189
|
return this.#validateNumber(true);
|
|
4213
4190
|
}
|
|
4214
4191
|
#utilsIsPossibleNumber(val) {
|
|
@@ -4220,13 +4197,10 @@ var Iti = class _Iti {
|
|
|
4220
4197
|
}
|
|
4221
4198
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
4222
4199
|
#validateNumber(precise) {
|
|
4223
|
-
if (!intlTelInput.utils || !this.#ui.telInput) {
|
|
4224
|
-
return null;
|
|
4225
|
-
}
|
|
4226
4200
|
const { allowNumberExtensions, allowPhonewords } = this.#options;
|
|
4227
4201
|
const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
|
|
4228
4202
|
const val = this.#getFullNumber();
|
|
4229
|
-
if (!this.#selectedCountryData
|
|
4203
|
+
if (!this.#selectedCountryData) {
|
|
4230
4204
|
const isRegionlessDialCode = hasRegionlessDialCode(val);
|
|
4231
4205
|
if (!isRegionlessDialCode) {
|
|
4232
4206
|
return false;
|
|
@@ -4256,7 +4230,7 @@ var Iti = class _Iti {
|
|
|
4256
4230
|
}
|
|
4257
4231
|
//* Update the selected country, and update the input val accordingly.
|
|
4258
4232
|
setCountry(iso2) {
|
|
4259
|
-
if (
|
|
4233
|
+
if (this.#destroyed) {
|
|
4260
4234
|
return;
|
|
4261
4235
|
}
|
|
4262
4236
|
const iso2Lower = iso2?.toLowerCase();
|
|
@@ -4277,7 +4251,7 @@ var Iti = class _Iti {
|
|
|
4277
4251
|
}
|
|
4278
4252
|
//* Set the input value and update the country.
|
|
4279
4253
|
setNumber(number) {
|
|
4280
|
-
if (
|
|
4254
|
+
if (this.#destroyed) {
|
|
4281
4255
|
return;
|
|
4282
4256
|
}
|
|
4283
4257
|
const normalisedNumber = this.#numerals.normalise(number);
|
|
@@ -4288,16 +4262,17 @@ var Iti = class _Iti {
|
|
|
4288
4262
|
}
|
|
4289
4263
|
this.#trigger(EVENTS.INPUT, { isSetNumber: true });
|
|
4290
4264
|
}
|
|
4291
|
-
//* Set the placeholder number
|
|
4265
|
+
//* Set the placeholder number type
|
|
4292
4266
|
setPlaceholderNumberType(type) {
|
|
4293
|
-
if (
|
|
4267
|
+
if (this.#destroyed) {
|
|
4294
4268
|
return;
|
|
4295
4269
|
}
|
|
4296
4270
|
this.#options.placeholderNumberType = type;
|
|
4297
4271
|
this.#updatePlaceholder();
|
|
4298
4272
|
}
|
|
4273
|
+
// Set the disabled state of the input and dropdown.
|
|
4299
4274
|
setDisabled(disabled) {
|
|
4300
|
-
if (
|
|
4275
|
+
if (this.#destroyed) {
|
|
4301
4276
|
return;
|
|
4302
4277
|
}
|
|
4303
4278
|
this.#ui.telInput.disabled = disabled;
|
|
@@ -4309,6 +4284,20 @@ var Iti = class _Iti {
|
|
|
4309
4284
|
}
|
|
4310
4285
|
}
|
|
4311
4286
|
}
|
|
4287
|
+
// Set the readonly state of the input and dropdown.
|
|
4288
|
+
setReadonly(readonly) {
|
|
4289
|
+
if (!this.#ui.telInput) {
|
|
4290
|
+
return;
|
|
4291
|
+
}
|
|
4292
|
+
this.#ui.telInput.readOnly = readonly;
|
|
4293
|
+
if (this.#ui.selectedCountry) {
|
|
4294
|
+
if (readonly) {
|
|
4295
|
+
this.#ui.selectedCountry.setAttribute("disabled", "true");
|
|
4296
|
+
} else {
|
|
4297
|
+
this.#ui.selectedCountry.removeAttribute("disabled");
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4312
4301
|
//********************
|
|
4313
4302
|
//* STATIC METHODS
|
|
4314
4303
|
//********************
|
|
@@ -4316,7 +4305,7 @@ var Iti = class _Iti {
|
|
|
4316
4305
|
// Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
|
|
4317
4306
|
// access to private instance methods.
|
|
4318
4307
|
static forEachInstance(method, ...args) {
|
|
4319
|
-
const values =
|
|
4308
|
+
const values = [...intlTelInput.instances.values()];
|
|
4320
4309
|
const arg = args[0];
|
|
4321
4310
|
values.forEach((instance) => {
|
|
4322
4311
|
if (!(instance instanceof _Iti)) {
|
|
@@ -4356,8 +4345,8 @@ var attachUtils = (source) => {
|
|
|
4356
4345
|
);
|
|
4357
4346
|
}
|
|
4358
4347
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
4359
|
-
return loadCall.then((
|
|
4360
|
-
const utils =
|
|
4348
|
+
return loadCall.then((module) => {
|
|
4349
|
+
const utils = module?.default;
|
|
4361
4350
|
if (!utils || typeof utils !== "object") {
|
|
4362
4351
|
throw new TypeError(
|
|
4363
4352
|
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
@@ -4376,7 +4365,7 @@ var attachUtils = (source) => {
|
|
|
4376
4365
|
var intlTelInput = Object.assign(
|
|
4377
4366
|
(input, options) => {
|
|
4378
4367
|
const iti = new Iti(input, options);
|
|
4379
|
-
intlTelInput.instances
|
|
4368
|
+
intlTelInput.instances.set(String(iti.id), iti);
|
|
4380
4369
|
input.iti = iti;
|
|
4381
4370
|
return iti;
|
|
4382
4371
|
},
|
|
@@ -4389,117 +4378,18 @@ var intlTelInput = Object.assign(
|
|
|
4389
4378
|
//* A getter for the plugin instance.
|
|
4390
4379
|
getInstance: (input) => {
|
|
4391
4380
|
const id2 = input.dataset.intlTelInputId;
|
|
4392
|
-
return id2 ? intlTelInput.instances
|
|
4381
|
+
return id2 ? intlTelInput.instances.get(id2) ?? null : null;
|
|
4393
4382
|
},
|
|
4394
4383
|
//* A map from instance ID to instance object.
|
|
4395
|
-
instances:
|
|
4384
|
+
instances: /* @__PURE__ */ new Map(),
|
|
4396
4385
|
attachUtils,
|
|
4397
4386
|
startedLoadingUtilsScript: false,
|
|
4398
4387
|
startedLoadingAutoCountry: false,
|
|
4399
|
-
version: "
|
|
4388
|
+
version: "27.0.0"
|
|
4400
4389
|
}
|
|
4401
4390
|
);
|
|
4402
4391
|
var intl_tel_input_default = intlTelInput;
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
initialValue = "",
|
|
4408
|
-
onChangeNumber = () => {
|
|
4409
|
-
},
|
|
4410
|
-
onChangeCountry = () => {
|
|
4411
|
-
},
|
|
4412
|
-
onChangeValidity = () => {
|
|
4413
|
-
},
|
|
4414
|
-
onChangeErrorCode = () => {
|
|
4415
|
-
},
|
|
4416
|
-
usePreciseValidation = false,
|
|
4417
|
-
initOptions = {},
|
|
4418
|
-
inputProps = {},
|
|
4419
|
-
disabled = void 0
|
|
4420
|
-
}, ref) {
|
|
4421
|
-
const inputRef = (0, import_react.useRef)(null);
|
|
4422
|
-
const itiRef = (0, import_react.useRef)(null);
|
|
4423
|
-
const lastEmittedNumberRef = (0, import_react.useRef)();
|
|
4424
|
-
const lastEmittedCountryRef = (0, import_react.useRef)();
|
|
4425
|
-
const lastEmittedValidityRef = (0, import_react.useRef)();
|
|
4426
|
-
const lastEmittedErrorCodeRef = (0, import_react.useRef)();
|
|
4427
|
-
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
4428
|
-
getInstance: () => itiRef.current,
|
|
4429
|
-
getInput: () => inputRef.current
|
|
4430
|
-
}));
|
|
4431
|
-
const update = (0, import_react.useCallback)(() => {
|
|
4432
|
-
if (!itiRef.current?.isActive()) {
|
|
4433
|
-
return;
|
|
4434
|
-
}
|
|
4435
|
-
const num = itiRef.current?.getNumber() || "";
|
|
4436
|
-
const countryIso = itiRef.current?.getSelectedCountryData().iso2 || "";
|
|
4437
|
-
if (num !== lastEmittedNumberRef.current) {
|
|
4438
|
-
lastEmittedNumberRef.current = num;
|
|
4439
|
-
onChangeNumber(num);
|
|
4440
|
-
}
|
|
4441
|
-
if (countryIso !== lastEmittedCountryRef.current) {
|
|
4442
|
-
lastEmittedCountryRef.current = countryIso;
|
|
4443
|
-
onChangeCountry(countryIso);
|
|
4444
|
-
}
|
|
4445
|
-
if (itiRef.current) {
|
|
4446
|
-
const isValid = usePreciseValidation ? itiRef.current.isValidNumberPrecise() : itiRef.current.isValidNumber();
|
|
4447
|
-
const errorCode = isValid ? null : itiRef.current.getValidationError();
|
|
4448
|
-
if (isValid !== lastEmittedValidityRef.current) {
|
|
4449
|
-
lastEmittedValidityRef.current = isValid;
|
|
4450
|
-
onChangeValidity(isValid);
|
|
4451
|
-
}
|
|
4452
|
-
if (errorCode !== lastEmittedErrorCodeRef.current) {
|
|
4453
|
-
lastEmittedErrorCodeRef.current = errorCode;
|
|
4454
|
-
onChangeErrorCode(errorCode);
|
|
4455
|
-
}
|
|
4456
|
-
}
|
|
4457
|
-
}, [
|
|
4458
|
-
onChangeCountry,
|
|
4459
|
-
onChangeErrorCode,
|
|
4460
|
-
onChangeNumber,
|
|
4461
|
-
onChangeValidity,
|
|
4462
|
-
usePreciseValidation
|
|
4463
|
-
]);
|
|
4464
|
-
(0, import_react.useEffect)(() => {
|
|
4465
|
-
if (inputRef.current) {
|
|
4466
|
-
itiRef.current = intl_tel_input_default(inputRef.current, initOptions);
|
|
4467
|
-
}
|
|
4468
|
-
return () => {
|
|
4469
|
-
itiRef.current?.destroy();
|
|
4470
|
-
};
|
|
4471
|
-
}, []);
|
|
4472
|
-
(0, import_react.useEffect)(() => {
|
|
4473
|
-
const inputRefCurrent = inputRef.current;
|
|
4474
|
-
if (inputRefCurrent) {
|
|
4475
|
-
inputRefCurrent.addEventListener("countrychange", update);
|
|
4476
|
-
itiRef.current.promise.then(update);
|
|
4477
|
-
}
|
|
4478
|
-
return () => {
|
|
4479
|
-
if (inputRefCurrent) {
|
|
4480
|
-
inputRefCurrent.removeEventListener("countrychange", update);
|
|
4481
|
-
}
|
|
4482
|
-
};
|
|
4483
|
-
}, [update]);
|
|
4484
|
-
(0, import_react.useEffect)(() => {
|
|
4485
|
-
if (itiRef.current && disabled !== void 0) {
|
|
4486
|
-
itiRef.current.setDisabled(disabled);
|
|
4487
|
-
}
|
|
4488
|
-
}, [disabled]);
|
|
4489
|
-
const {
|
|
4490
|
-
value: _value,
|
|
4491
|
-
// disabled: _disabled,
|
|
4492
|
-
...sanitizedInputProps
|
|
4493
|
-
} = inputProps;
|
|
4494
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
4495
|
-
"input",
|
|
4496
|
-
{
|
|
4497
|
-
...sanitizedInputProps,
|
|
4498
|
-
type: "tel",
|
|
4499
|
-
ref: inputRef,
|
|
4500
|
-
onInput: update,
|
|
4501
|
-
defaultValue: initialValue
|
|
4502
|
-
}
|
|
4503
|
-
);
|
|
4504
|
-
});
|
|
4505
|
-
var react_default = IntlTelInput;
|
|
4392
|
+
export {
|
|
4393
|
+
Iti,
|
|
4394
|
+
intl_tel_input_default as default
|
|
4395
|
+
};
|