intl-tel-input 25.13.0 → 25.13.1
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 +5 -5
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +8 -15
- package/angular/build/IntlTelInputWithUtils.js +8 -15
- package/angular/build/types/modules/data/country-data.d.ts +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -1
- package/build/js/intlTelInput.js +9 -17
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +9 -17
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +8 -16
- package/react/build/IntlTelInput.d.ts +1 -1
- package/react/build/IntlTelInput.js +8 -16
- package/react/build/IntlTelInputWithUtils.cjs +8 -16
- package/react/build/IntlTelInputWithUtils.js +8 -16
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +132 -141
- package/vue/build/IntlTelInputWithUtils.mjs +19 -28
|
@@ -1677,17 +1677,17 @@ const rt = [
|
|
|
1677
1677
|
"0"
|
|
1678
1678
|
]
|
|
1679
1679
|
], A = [];
|
|
1680
|
-
for (const
|
|
1680
|
+
for (const l of rt)
|
|
1681
1681
|
A.push({
|
|
1682
1682
|
name: "",
|
|
1683
1683
|
// populated in the plugin
|
|
1684
|
-
iso2:
|
|
1685
|
-
dialCode:
|
|
1686
|
-
priority:
|
|
1687
|
-
areaCodes:
|
|
1684
|
+
iso2: l[0],
|
|
1685
|
+
dialCode: l[1],
|
|
1686
|
+
priority: l[2] || 0,
|
|
1687
|
+
areaCodes: l[3] || null,
|
|
1688
1688
|
nodeById: {},
|
|
1689
1689
|
// populated by the plugin
|
|
1690
|
-
nationalPrefix:
|
|
1690
|
+
nationalPrefix: l[4] || null,
|
|
1691
1691
|
normalisedName: "",
|
|
1692
1692
|
// populated in the plugin
|
|
1693
1693
|
initials: "",
|
|
@@ -2025,12 +2025,12 @@ const lt = {
|
|
|
2025
2025
|
HIDDEN: "aria-hidden",
|
|
2026
2026
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
2027
2027
|
MODAL: "aria-modal"
|
|
2028
|
-
}, x = (
|
|
2028
|
+
}, x = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, ct = () => {
|
|
2029
2029
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
2030
|
-
const
|
|
2030
|
+
const l = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
2031
2031
|
navigator.userAgent
|
|
2032
2032
|
), t = x("(max-width: 500px)"), e = x("(max-height: 600px)"), i = x("(pointer: coarse)");
|
|
2033
|
-
return
|
|
2033
|
+
return l || t || i && e;
|
|
2034
2034
|
}
|
|
2035
2035
|
return !1;
|
|
2036
2036
|
}, Y = {
|
|
@@ -2084,29 +2084,29 @@ const lt = {
|
|
|
2084
2084
|
useFullscreenPopup: ct(),
|
|
2085
2085
|
//* The number type to enforce during validation.
|
|
2086
2086
|
validationNumberTypes: ["MOBILE"]
|
|
2087
|
-
}, ht = (
|
|
2088
|
-
|
|
2089
|
-
},
|
|
2090
|
-
const e = q(t), i = [], s = [], o = [], n = [],
|
|
2091
|
-
for (const c of
|
|
2092
|
-
c.iso2 === e ? i.push(c) : c.normalisedName.startsWith(e) ? s.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ?
|
|
2087
|
+
}, ht = (l, t) => {
|
|
2088
|
+
l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...t, ...l.i18n };
|
|
2089
|
+
}, P = (l) => l.replace(/\D/g, ""), q = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pt = (l, t) => {
|
|
2090
|
+
const e = q(t), i = [], s = [], o = [], n = [], r = [], a = [];
|
|
2091
|
+
for (const c of l)
|
|
2092
|
+
c.iso2 === e ? i.push(c) : c.normalisedName.startsWith(e) ? s.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
|
|
2093
2093
|
const d = (c, f) => c.priority - f.priority;
|
|
2094
2094
|
return [
|
|
2095
2095
|
...i.sort(d),
|
|
2096
2096
|
...s.sort(d),
|
|
2097
2097
|
...o.sort(d),
|
|
2098
2098
|
...n.sort(d),
|
|
2099
|
-
...
|
|
2099
|
+
...r.sort(d),
|
|
2100
2100
|
...a.sort(d)
|
|
2101
2101
|
];
|
|
2102
|
-
}, Ct = (
|
|
2102
|
+
}, Ct = (l, t) => {
|
|
2103
2103
|
const e = t.toLowerCase();
|
|
2104
|
-
for (const i of
|
|
2104
|
+
for (const i of l)
|
|
2105
2105
|
if (i.name.toLowerCase().startsWith(e))
|
|
2106
2106
|
return i;
|
|
2107
2107
|
return null;
|
|
2108
|
-
}, U = (
|
|
2109
|
-
const i = document.createElement(
|
|
2108
|
+
}, U = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), m = (l, t, e) => {
|
|
2109
|
+
const i = document.createElement(l);
|
|
2110
2110
|
return t && Object.entries(t).forEach(
|
|
2111
2111
|
([s, o]) => i.setAttribute(s, o)
|
|
2112
2112
|
), e && e.appendChild(i), i;
|
|
@@ -2114,8 +2114,8 @@ const lt = {
|
|
|
2114
2114
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
|
|
2115
2115
|
<circle cx="11" cy="11" r="7" />
|
|
2116
2116
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2117
|
-
</svg>`, ft = (
|
|
2118
|
-
const t = `iti-${
|
|
2117
|
+
</svg>`, ft = (l) => {
|
|
2118
|
+
const t = `iti-${l}-clear-mask`;
|
|
2119
2119
|
return `
|
|
2120
2120
|
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
|
|
2121
2121
|
<mask id="${t}" maskUnits="userSpaceOnUse">
|
|
@@ -2201,10 +2201,10 @@ class yt {
|
|
|
2201
2201
|
i18n: s,
|
|
2202
2202
|
dropdownContainer: o,
|
|
2203
2203
|
containerClass: n
|
|
2204
|
-
} = this.options,
|
|
2204
|
+
} = this.options, r = t ? "" : "iti--flexible-dropdown-width";
|
|
2205
2205
|
if (this.dropdownContent = m("div", {
|
|
2206
2206
|
id: `iti-${this.id}__dropdown-content`,
|
|
2207
|
-
class: `iti__dropdown-content ${h.HIDE} ${
|
|
2207
|
+
class: `iti__dropdown-content ${h.HIDE} ${r}`,
|
|
2208
2208
|
role: "dialog",
|
|
2209
2209
|
[p.MODAL]: "true"
|
|
2210
2210
|
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = m(
|
|
@@ -2290,19 +2290,19 @@ class yt {
|
|
|
2290
2290
|
if (e) {
|
|
2291
2291
|
const o = this.telInput.getAttribute("name") || "", n = e(o);
|
|
2292
2292
|
if (n.phone) {
|
|
2293
|
-
const
|
|
2293
|
+
const r = (i = this.telInput.form) == null ? void 0 : i.querySelector(
|
|
2294
2294
|
`input[name="${n.phone}"]`
|
|
2295
2295
|
);
|
|
2296
|
-
|
|
2296
|
+
r ? this.hiddenInput = r : (this.hiddenInput = m("input", {
|
|
2297
2297
|
type: "hidden",
|
|
2298
2298
|
name: n.phone
|
|
2299
2299
|
}), t.appendChild(this.hiddenInput));
|
|
2300
2300
|
}
|
|
2301
2301
|
if (n.country) {
|
|
2302
|
-
const
|
|
2302
|
+
const r = (s = this.telInput.form) == null ? void 0 : s.querySelector(
|
|
2303
2303
|
`input[name="${n.country}"]`
|
|
2304
2304
|
);
|
|
2305
|
-
|
|
2305
|
+
r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = m("input", {
|
|
2306
2306
|
type: "hidden",
|
|
2307
2307
|
name: n.country
|
|
2308
2308
|
}), t.appendChild(this.hiddenInputCountry));
|
|
@@ -2326,8 +2326,8 @@ class yt {
|
|
|
2326
2326
|
o.dataset.dialCode = i.dialCode, o.dataset.countryCode = i.iso2, i.nodeById[this.id] = o, this.options.showFlags && m("div", { class: `${h.FLAG} iti__${i.iso2}` }, o);
|
|
2327
2327
|
const n = m("span", { class: "iti__country-name" }, o);
|
|
2328
2328
|
n.textContent = i.name;
|
|
2329
|
-
const
|
|
2330
|
-
this.isRTL &&
|
|
2329
|
+
const r = m("span", { class: "iti__dial-code" }, o);
|
|
2330
|
+
this.isRTL && r.setAttribute("dir", "ltr"), r.textContent = `+${i.dialCode}`, t.appendChild(o);
|
|
2331
2331
|
}
|
|
2332
2332
|
this.countryList.appendChild(t);
|
|
2333
2333
|
}
|
|
@@ -2376,11 +2376,11 @@ class yt {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2378
2378
|
scrollTo(t) {
|
|
2379
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, o = e.getBoundingClientRect().top + i, n = o + s,
|
|
2379
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, o = e.getBoundingClientRect().top + i, n = o + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, d = a + r, c = a - o + e.scrollTop;
|
|
2380
2380
|
if (a < o)
|
|
2381
2381
|
e.scrollTop = c;
|
|
2382
2382
|
else if (d > n) {
|
|
2383
|
-
const f = s -
|
|
2383
|
+
const f = s - r;
|
|
2384
2384
|
e.scrollTop = c - f;
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
@@ -2412,8 +2412,8 @@ class yt {
|
|
|
2412
2412
|
this.countries = null;
|
|
2413
2413
|
}
|
|
2414
2414
|
}
|
|
2415
|
-
const gt = (
|
|
2416
|
-
const { onlyCountries: t, excludeCountries: e } =
|
|
2415
|
+
const gt = (l) => {
|
|
2416
|
+
const { onlyCountries: t, excludeCountries: e } = l;
|
|
2417
2417
|
if (t.length) {
|
|
2418
2418
|
const i = t.map(
|
|
2419
2419
|
(s) => s.toLowerCase()
|
|
@@ -2430,81 +2430,73 @@ const gt = (r) => {
|
|
|
2430
2430
|
);
|
|
2431
2431
|
}
|
|
2432
2432
|
return A;
|
|
2433
|
-
}, _t = (
|
|
2434
|
-
for (const e of
|
|
2433
|
+
}, _t = (l, t) => {
|
|
2434
|
+
for (const e of l) {
|
|
2435
2435
|
const i = e.iso2.toLowerCase();
|
|
2436
2436
|
t.i18n[i] && (e.name = t.i18n[i]);
|
|
2437
2437
|
}
|
|
2438
|
-
}, bt = (
|
|
2439
|
-
const
|
|
2440
|
-
let
|
|
2441
|
-
const
|
|
2442
|
-
if (!n || !
|
|
2438
|
+
}, bt = (l) => {
|
|
2439
|
+
const t = /* @__PURE__ */ new Set();
|
|
2440
|
+
let e = 0;
|
|
2441
|
+
const i = {}, s = (n, r) => {
|
|
2442
|
+
if (!n || !r)
|
|
2443
2443
|
return;
|
|
2444
|
-
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
for (let l = 1; l < n.dialCode.length; l++) {
|
|
2454
|
-
const a = n.dialCode.substring(0, l);
|
|
2455
|
-
o(n.iso2, a);
|
|
2444
|
+
r.length > e && (e = r.length), i.hasOwnProperty(r) || (i[r] = []);
|
|
2445
|
+
const a = i[r];
|
|
2446
|
+
a.includes(n) || a.push(n);
|
|
2447
|
+
}, o = [...l].sort((n, r) => n.priority - r.priority);
|
|
2448
|
+
for (const n of o) {
|
|
2449
|
+
t.has(n.dialCode) || t.add(n.dialCode);
|
|
2450
|
+
for (let r = 1; r < n.dialCode.length; r++) {
|
|
2451
|
+
const a = n.dialCode.substring(0, r);
|
|
2452
|
+
s(n.iso2, a);
|
|
2456
2453
|
}
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
(t.onlyCountries.length || t.excludeCountries.length) && e.forEach((n) => {
|
|
2460
|
-
s[n] = s[n].filter(Boolean);
|
|
2461
|
-
});
|
|
2462
|
-
for (const n of r)
|
|
2463
|
-
if (n.areaCodes) {
|
|
2464
|
-
const l = s[n.dialCode][0];
|
|
2454
|
+
if (s(n.iso2, n.dialCode), n.areaCodes) {
|
|
2455
|
+
const r = i[n.dialCode][0];
|
|
2465
2456
|
for (const a of n.areaCodes) {
|
|
2466
2457
|
for (let d = 1; d < a.length; d++) {
|
|
2467
2458
|
const c = a.substring(0, d), f = n.dialCode + c;
|
|
2468
|
-
|
|
2459
|
+
s(r, f), s(n.iso2, f);
|
|
2469
2460
|
}
|
|
2470
|
-
|
|
2461
|
+
s(n.iso2, n.dialCode + a);
|
|
2471
2462
|
}
|
|
2472
2463
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2464
|
+
}
|
|
2465
|
+
return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: i };
|
|
2466
|
+
}, It = (l, t) => {
|
|
2475
2467
|
t.countryOrder && (t.countryOrder = t.countryOrder.map(
|
|
2476
2468
|
(e) => e.toLowerCase()
|
|
2477
|
-
)),
|
|
2469
|
+
)), l.sort((e, i) => {
|
|
2478
2470
|
const { countryOrder: s } = t;
|
|
2479
2471
|
if (s) {
|
|
2480
|
-
const o = s.indexOf(e.iso2), n = s.indexOf(i.iso2),
|
|
2481
|
-
if (
|
|
2482
|
-
return
|
|
2472
|
+
const o = s.indexOf(e.iso2), n = s.indexOf(i.iso2), r = o > -1, a = n > -1;
|
|
2473
|
+
if (r || a)
|
|
2474
|
+
return r && a ? o - n : r ? -1 : 1;
|
|
2483
2475
|
}
|
|
2484
2476
|
return e.name.localeCompare(i.name);
|
|
2485
2477
|
});
|
|
2486
|
-
}, Nt = (
|
|
2487
|
-
for (const t of
|
|
2478
|
+
}, Nt = (l) => {
|
|
2479
|
+
for (const t of l)
|
|
2488
2480
|
t.normalisedName = q(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
2489
|
-
}, wt = (
|
|
2490
|
-
let s =
|
|
2481
|
+
}, wt = (l, t, e, i) => {
|
|
2482
|
+
let s = l;
|
|
2491
2483
|
if (e && t) {
|
|
2492
2484
|
t = `+${i.dialCode}`;
|
|
2493
2485
|
const o = s[t.length] === " " || s[t.length] === "-" ? t.length + 1 : t.length;
|
|
2494
2486
|
s = s.substring(o);
|
|
2495
2487
|
}
|
|
2496
2488
|
return s;
|
|
2497
|
-
}, Dt = (
|
|
2498
|
-
const o = e ? e.formatNumberAsYouType(
|
|
2489
|
+
}, Dt = (l, t, e, i, s) => {
|
|
2490
|
+
const o = e ? e.formatNumberAsYouType(l, i.iso2) : l, { dialCode: n } = i;
|
|
2499
2491
|
return s && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
|
|
2500
|
-
}, Et = (
|
|
2492
|
+
}, Et = (l, t, e, i) => {
|
|
2501
2493
|
if (e === 0 && !i)
|
|
2502
2494
|
return 0;
|
|
2503
2495
|
let s = 0;
|
|
2504
2496
|
for (let o = 0; o < t.length; o++) {
|
|
2505
|
-
if (/[+0-9]/.test(t[o]) && s++, s ===
|
|
2497
|
+
if (/[+0-9]/.test(t[o]) && s++, s === l && !i)
|
|
2506
2498
|
return o + 1;
|
|
2507
|
-
if (i && s ===
|
|
2499
|
+
if (i && s === l + 1)
|
|
2508
2500
|
return o;
|
|
2509
2501
|
}
|
|
2510
2502
|
return t.length;
|
|
@@ -2526,24 +2518,23 @@ const gt = (r) => {
|
|
|
2526
2518
|
"887",
|
|
2527
2519
|
"888",
|
|
2528
2520
|
"889"
|
|
2529
|
-
], z = (
|
|
2530
|
-
const t =
|
|
2521
|
+
], z = (l) => {
|
|
2522
|
+
const t = P(l);
|
|
2531
2523
|
if (t.startsWith(K.NANP) && t.length >= 4) {
|
|
2532
2524
|
const e = t.substring(1, 4);
|
|
2533
2525
|
return Lt.includes(e);
|
|
2534
2526
|
}
|
|
2535
2527
|
return !1;
|
|
2536
2528
|
};
|
|
2537
|
-
for (const
|
|
2538
|
-
|
|
2529
|
+
for (const l of A)
|
|
2530
|
+
l.name = j[l.iso2];
|
|
2539
2531
|
let At = 0;
|
|
2540
|
-
const Tt = new Set(A.map((
|
|
2532
|
+
const Tt = new Set(A.map((l) => l.iso2)), B = (l) => Tt.has(l);
|
|
2541
2533
|
class V {
|
|
2542
2534
|
constructor(t, e = {}) {
|
|
2543
2535
|
this.id = At++, this.options = { ...Y, ...e }, ht(this.options, j), this.ui = new yt(t, this.options, this.id), this.isAndroid = V._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = gt(this.options);
|
|
2544
2536
|
const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: o } = bt(
|
|
2545
|
-
this.countries
|
|
2546
|
-
this.options
|
|
2537
|
+
this.countries
|
|
2547
2538
|
);
|
|
2548
2539
|
this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
|
|
2549
2540
|
}
|
|
@@ -2598,12 +2589,12 @@ class V {
|
|
|
2598
2589
|
//* 1. Extracting a dial code from the given number
|
|
2599
2590
|
//* 2. Using explicit initialCountry
|
|
2600
2591
|
_setInitialState(t = !1) {
|
|
2601
|
-
const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s,
|
|
2602
|
-
if (
|
|
2592
|
+
const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, r = this._getDialCode(n), a = z(n), { initialCountry: d, geoIpLookup: c } = this.options, f = d === M.AUTO && c;
|
|
2593
|
+
if (r && !a)
|
|
2603
2594
|
this._updateCountryFromNumber(n);
|
|
2604
2595
|
else if (!f || t) {
|
|
2605
2596
|
const b = d ? d.toLowerCase() : "";
|
|
2606
|
-
B(b) ? this._setCountry(b) :
|
|
2597
|
+
B(b) ? this._setCountry(b) : r && a ? this._setCountry(dt.ISO2) : this._setCountry("");
|
|
2607
2598
|
}
|
|
2608
2599
|
n && this._updateValFromNumber(n);
|
|
2609
2600
|
}
|
|
@@ -2702,7 +2693,7 @@ class V {
|
|
|
2702
2693
|
} = this.options;
|
|
2703
2694
|
let n = !1;
|
|
2704
2695
|
L.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
|
|
2705
|
-
const
|
|
2696
|
+
const r = (a) => {
|
|
2706
2697
|
const d = this._getTelInputValue();
|
|
2707
2698
|
if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && s && o) {
|
|
2708
2699
|
const y = this.ui.telInput.selectionStart || 0, I = d.substring(0, y - 1), N = d.substring(y);
|
|
@@ -2737,7 +2728,7 @@ class V {
|
|
|
2737
2728
|
};
|
|
2738
2729
|
this.ui.telInput.addEventListener(
|
|
2739
2730
|
"input",
|
|
2740
|
-
|
|
2731
|
+
r,
|
|
2741
2732
|
{
|
|
2742
2733
|
signal: this.abortController.signal
|
|
2743
2734
|
}
|
|
@@ -2753,11 +2744,11 @@ class V {
|
|
|
2753
2744
|
return;
|
|
2754
2745
|
}
|
|
2755
2746
|
if (t) {
|
|
2756
|
-
const
|
|
2747
|
+
const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), f = /^[0-9]$/.test(c), b = e ? f : d || f, C = this.ui.telInput, y = C.selectionStart, I = C.selectionEnd, N = r.slice(0, y), D = r.slice(I), g = N + n.key + D, E = this._getFullNumber(g), w = u.utils.getCoreNumber(
|
|
2757
2748
|
E,
|
|
2758
2749
|
this.selectedCountryData.iso2
|
|
2759
|
-
),
|
|
2760
|
-
(!b ||
|
|
2750
|
+
), v = this.maxCoreNumberLength && w.length > this.maxCoreNumberLength, X = this._getNewCountryFromNumber(E) !== null;
|
|
2751
|
+
(!b || v && !X && !d) && n.preventDefault();
|
|
2761
2752
|
}
|
|
2762
2753
|
}
|
|
2763
2754
|
};
|
|
@@ -2770,8 +2761,8 @@ class V {
|
|
|
2770
2761
|
if (this.options.strictMode) {
|
|
2771
2762
|
const t = (e) => {
|
|
2772
2763
|
e.preventDefault();
|
|
2773
|
-
const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(),
|
|
2774
|
-
let g =
|
|
2764
|
+
const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, s), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), f = this._normaliseNumerals(c), b = s === 0 && o > 0, C = !n.startsWith("+") || b, y = f.replace(L.NON_PLUS_NUMERIC_GLOBAL, ""), I = y.startsWith("+"), N = y.replace(/\+/g, ""), D = I && C ? `+${N}` : N;
|
|
2765
|
+
let g = r + D + a;
|
|
2775
2766
|
if (g.length > 5) {
|
|
2776
2767
|
let w = u.utils.getCoreNumber(g, d);
|
|
2777
2768
|
for (; w.length === 0 && g.length > 0; )
|
|
@@ -2780,8 +2771,8 @@ class V {
|
|
|
2780
2771
|
return;
|
|
2781
2772
|
if (this.maxCoreNumberLength && w.length > this.maxCoreNumberLength)
|
|
2782
2773
|
if (i.selectionEnd === n.length) {
|
|
2783
|
-
const
|
|
2784
|
-
g = g.slice(0, g.length -
|
|
2774
|
+
const v = w.length - this.maxCoreNumberLength;
|
|
2775
|
+
g = g.slice(0, g.length - v);
|
|
2785
2776
|
} else
|
|
2786
2777
|
return;
|
|
2787
2778
|
}
|
|
@@ -2981,14 +2972,14 @@ class V {
|
|
|
2981
2972
|
let i = e ? t.substring(e) : t;
|
|
2982
2973
|
const s = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
|
|
2983
2974
|
i = this._ensureHasDialCode(i);
|
|
2984
|
-
const n = this._getDialCode(i, !0),
|
|
2975
|
+
const n = this._getDialCode(i, !0), r = P(i);
|
|
2985
2976
|
if (n) {
|
|
2986
|
-
const a =
|
|
2977
|
+
const a = P(n), d = this.dialCodeToIso2Map[a];
|
|
2987
2978
|
if (d.length === 1)
|
|
2988
2979
|
return d[0] === s ? null : d[0];
|
|
2989
2980
|
if (!s && this.defaultCountry && d.includes(this.defaultCountry))
|
|
2990
2981
|
return this.defaultCountry;
|
|
2991
|
-
if (o === K.NANP && z(
|
|
2982
|
+
if (o === K.NANP && z(r))
|
|
2992
2983
|
return null;
|
|
2993
2984
|
const { areaCodes: f, priority: b } = this.selectedCountryData;
|
|
2994
2985
|
if (f) {
|
|
@@ -2996,15 +2987,15 @@ class V {
|
|
|
2996
2987
|
(g) => `${o}${g}`
|
|
2997
2988
|
);
|
|
2998
2989
|
for (const g of D)
|
|
2999
|
-
if (
|
|
2990
|
+
if (r.startsWith(g))
|
|
3000
2991
|
return null;
|
|
3001
2992
|
}
|
|
3002
|
-
const y = f && !(b === 0) &&
|
|
2993
|
+
const y = f && !(b === 0) && r.length > a.length, I = s && d.includes(s) && !y, N = s === d[0];
|
|
3003
2994
|
if (!I && !N)
|
|
3004
2995
|
return d[0];
|
|
3005
|
-
} else if (i.startsWith("+") &&
|
|
2996
|
+
} else if (i.startsWith("+") && r.length) {
|
|
3006
2997
|
const a = this.selectedCountryData.dialCode || "";
|
|
3007
|
-
return a && a.startsWith(
|
|
2998
|
+
return a && a.startsWith(r) ? null : "";
|
|
3008
2999
|
} else if ((!i || i === "+") && !s)
|
|
3009
3000
|
return this.defaultCountry;
|
|
3010
3001
|
return null;
|
|
@@ -3015,13 +3006,13 @@ class V {
|
|
|
3015
3006
|
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, o = this.selectedCountryData.iso2 || "";
|
|
3016
3007
|
if (this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
3017
3008
|
const n = t && i ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
|
|
3018
|
-
let
|
|
3009
|
+
let r, a;
|
|
3019
3010
|
if (t) {
|
|
3020
3011
|
const { name: d, dialCode: c } = this.selectedCountryData;
|
|
3021
|
-
a = d,
|
|
3012
|
+
a = d, r = s.selectedCountryAriaLabel.replace("${countryName}", d).replace("${dialCode}", `+${c}`);
|
|
3022
3013
|
} else
|
|
3023
|
-
a = s.noCountrySelected,
|
|
3024
|
-
this.ui.selectedCountryInner.className = n, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(p.LABEL,
|
|
3014
|
+
a = s.noCountrySelected, r = s.noCountrySelected;
|
|
3015
|
+
this.ui.selectedCountryInner.className = n, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(p.LABEL, r);
|
|
3025
3016
|
}
|
|
3026
3017
|
if (e) {
|
|
3027
3018
|
const n = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
@@ -3040,14 +3031,14 @@ class V {
|
|
|
3040
3031
|
!1,
|
|
3041
3032
|
o,
|
|
3042
3033
|
!0
|
|
3043
|
-
),
|
|
3034
|
+
), r = n;
|
|
3044
3035
|
for (; u.utils.isPossibleNumber(
|
|
3045
3036
|
n,
|
|
3046
3037
|
s,
|
|
3047
3038
|
i
|
|
3048
3039
|
); )
|
|
3049
|
-
|
|
3050
|
-
const a = u.utils.getCoreNumber(
|
|
3040
|
+
r = n, n += "0";
|
|
3041
|
+
const a = u.utils.getCoreNumber(r, s);
|
|
3051
3042
|
this.maxCoreNumberLength = a.length, s === "by" && (this.maxCoreNumberLength = a.length + 1);
|
|
3052
3043
|
} else
|
|
3053
3044
|
this.maxCoreNumberLength = null;
|
|
@@ -3062,12 +3053,12 @@ class V {
|
|
|
3062
3053
|
} = this.options, o = t === H.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === H.POLITE;
|
|
3063
3054
|
if (u.utils && o) {
|
|
3064
3055
|
const n = u.utils.numberType[e];
|
|
3065
|
-
let
|
|
3056
|
+
let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
|
|
3066
3057
|
this.selectedCountryData.iso2,
|
|
3067
3058
|
i,
|
|
3068
3059
|
n
|
|
3069
3060
|
) : "";
|
|
3070
|
-
|
|
3061
|
+
r = this._beforeSetNumber(r), typeof s == "function" && (r = s(r, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", r);
|
|
3071
3062
|
}
|
|
3072
3063
|
}
|
|
3073
3064
|
//* Called when the user selects a list item from the dropdown.
|
|
@@ -3102,9 +3093,9 @@ class V {
|
|
|
3102
3093
|
if (t.startsWith("+")) {
|
|
3103
3094
|
let s = "", o = !1;
|
|
3104
3095
|
for (let n = 0; n < t.length; n++) {
|
|
3105
|
-
const
|
|
3106
|
-
if (/[0-9]/.test(
|
|
3107
|
-
if (s +=
|
|
3096
|
+
const r = t.charAt(n);
|
|
3097
|
+
if (/[0-9]/.test(r)) {
|
|
3098
|
+
if (s += r, !!!this.dialCodeToIso2Map[s])
|
|
3108
3099
|
break;
|
|
3109
3100
|
if (this.dialCodes.has(s)) {
|
|
3110
3101
|
if (i = t.substring(0, n + 1), o = !0, !e)
|
|
@@ -3121,7 +3112,7 @@ class V {
|
|
|
3121
3112
|
_getFullNumber(t) {
|
|
3122
3113
|
const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: i } = this.selectedCountryData;
|
|
3123
3114
|
let s;
|
|
3124
|
-
const o =
|
|
3115
|
+
const o = P(e);
|
|
3125
3116
|
return this.options.separateDialCode && !e.startsWith("+") && i && o ? s = `+${i}` : s = "", s + e;
|
|
3126
3117
|
}
|
|
3127
3118
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
@@ -3227,8 +3218,8 @@ class V {
|
|
|
3227
3218
|
return !1;
|
|
3228
3219
|
const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(L.ALPHA_UNICODE);
|
|
3229
3220
|
if (s > -1 && !this.options.allowPhonewords) {
|
|
3230
|
-
const n = i.substring(0, s),
|
|
3231
|
-
return
|
|
3221
|
+
const n = i.substring(0, s), r = e(n), a = e(i);
|
|
3222
|
+
return r && a;
|
|
3232
3223
|
}
|
|
3233
3224
|
return e(i);
|
|
3234
3225
|
}
|
|
@@ -3266,19 +3257,19 @@ class V {
|
|
|
3266
3257
|
this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
|
|
3267
3258
|
}
|
|
3268
3259
|
}
|
|
3269
|
-
const St = (
|
|
3260
|
+
const St = (l) => {
|
|
3270
3261
|
if (!u.utils && !u.startedLoadingUtilsScript) {
|
|
3271
3262
|
let t;
|
|
3272
|
-
if (typeof
|
|
3263
|
+
if (typeof l == "function")
|
|
3273
3264
|
try {
|
|
3274
|
-
t = Promise.resolve(
|
|
3265
|
+
t = Promise.resolve(l());
|
|
3275
3266
|
} catch (e) {
|
|
3276
3267
|
return Promise.reject(e);
|
|
3277
3268
|
}
|
|
3278
3269
|
else
|
|
3279
3270
|
return Promise.reject(
|
|
3280
3271
|
new TypeError(
|
|
3281
|
-
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof
|
|
3272
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof l}`
|
|
3282
3273
|
)
|
|
3283
3274
|
);
|
|
3284
3275
|
return u.startedLoadingUtilsScript = !0, t.then((e) => {
|
|
@@ -3293,15 +3284,15 @@ const St = (r) => {
|
|
|
3293
3284
|
});
|
|
3294
3285
|
}
|
|
3295
3286
|
return null;
|
|
3296
|
-
}, T = (
|
|
3287
|
+
}, T = (l, ...t) => {
|
|
3297
3288
|
Object.values(u.instances).forEach((e) => {
|
|
3298
|
-
const i = e[
|
|
3289
|
+
const i = e[l];
|
|
3299
3290
|
typeof i == "function" && i.apply(e, t);
|
|
3300
3291
|
});
|
|
3301
3292
|
}, u = Object.assign(
|
|
3302
|
-
(
|
|
3303
|
-
const e = new V(
|
|
3304
|
-
return u.instances[e.id] = e,
|
|
3293
|
+
(l, t) => {
|
|
3294
|
+
const e = new V(l, t);
|
|
3295
|
+
return u.instances[e.id] = e, l.iti = e, e;
|
|
3305
3296
|
},
|
|
3306
3297
|
{
|
|
3307
3298
|
defaults: Y,
|
|
@@ -3310,8 +3301,8 @@ const St = (r) => {
|
|
|
3310
3301
|
//* Get the country data object.
|
|
3311
3302
|
getCountryData: () => A,
|
|
3312
3303
|
//* A getter for the plugin instance.
|
|
3313
|
-
getInstance: (
|
|
3314
|
-
const t =
|
|
3304
|
+
getInstance: (l) => {
|
|
3305
|
+
const t = l.dataset.intlTelInputId;
|
|
3315
3306
|
return t ? u.instances[t] : null;
|
|
3316
3307
|
},
|
|
3317
3308
|
//* A map from instance ID to instance object.
|
|
@@ -3319,7 +3310,7 @@ const St = (r) => {
|
|
|
3319
3310
|
attachUtils: St,
|
|
3320
3311
|
startedLoadingUtilsScript: !1,
|
|
3321
3312
|
startedLoadingAutoCountry: !1,
|
|
3322
|
-
version: "25.13.
|
|
3313
|
+
version: "25.13.1"
|
|
3323
3314
|
}
|
|
3324
3315
|
), Ot = {
|
|
3325
3316
|
__name: "IntlTelInput",
|
|
@@ -3353,39 +3344,39 @@ const St = (r) => {
|
|
|
3353
3344
|
"changeValidity",
|
|
3354
3345
|
"changeErrorCode"
|
|
3355
3346
|
], ["update:modelValue"]),
|
|
3356
|
-
setup(
|
|
3357
|
-
const i = Q(
|
|
3347
|
+
setup(l, { expose: t, emit: e }) {
|
|
3348
|
+
const i = Q(l, "modelValue"), s = l, o = e, n = O(), r = O(), a = O(!1), d = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, c = () => {
|
|
3358
3349
|
let C = d();
|
|
3359
3350
|
a.value !== C && (a.value = C, o("changeValidity", !!C), o(
|
|
3360
3351
|
"changeErrorCode",
|
|
3361
|
-
C ? null :
|
|
3352
|
+
C ? null : r.value.getValidationError()
|
|
3362
3353
|
));
|
|
3363
3354
|
}, f = () => {
|
|
3364
3355
|
var C;
|
|
3365
|
-
o("changeNumber", ((C =
|
|
3356
|
+
o("changeNumber", ((C = r.value) == null ? void 0 : C.getNumber()) ?? ""), c();
|
|
3366
3357
|
}, b = () => {
|
|
3367
3358
|
var C;
|
|
3368
|
-
o("changeCountry", ((C =
|
|
3359
|
+
o("changeCountry", ((C = r.value) == null ? void 0 : C.getSelectedCountryData().iso2) ?? ""), f(), c();
|
|
3369
3360
|
};
|
|
3370
3361
|
return J(() => {
|
|
3371
|
-
n.value && (
|
|
3362
|
+
n.value && (r.value = u(n.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = d());
|
|
3372
3363
|
}), Z(
|
|
3373
3364
|
() => s.disabled,
|
|
3374
3365
|
(C) => {
|
|
3375
3366
|
var y;
|
|
3376
|
-
return (y =
|
|
3367
|
+
return (y = r.value) == null ? void 0 : y.setDisabled(C);
|
|
3377
3368
|
}
|
|
3378
3369
|
), tt(() => {
|
|
3379
3370
|
var C;
|
|
3380
|
-
return (C =
|
|
3381
|
-
}), t({ instance:
|
|
3371
|
+
return (C = r.value) == null ? void 0 : C.destroy();
|
|
3372
|
+
}), t({ instance: r, input: n }), (C, y) => et((st(), it("input", nt({
|
|
3382
3373
|
ref_key: "input",
|
|
3383
3374
|
ref: n,
|
|
3384
3375
|
"onUpdate:modelValue": y[0] || (y[0] = (I) => i.value = I),
|
|
3385
3376
|
type: "tel",
|
|
3386
3377
|
onCountrychange: b,
|
|
3387
3378
|
onInput: f
|
|
3388
|
-
},
|
|
3379
|
+
}, l.inputProps), null, 16)), [
|
|
3389
3380
|
[
|
|
3390
3381
|
ot,
|
|
3391
3382
|
i.value,
|