intl-tel-input 27.2.1 → 27.3.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/CHANGELOG.md +1 -1
- package/README.md +25 -14
- package/angular/dist/IntlTelInput.d.ts +3 -1
- package/angular/dist/IntlTelInput.js +157 -86
- package/angular/dist/IntlTelInputWithUtils.js +487 -393
- package/dist/css/intlTelInput-no-assets.css +1116 -1
- package/dist/css/intlTelInput-no-assets.min.css +1 -1
- package/dist/css/intlTelInput.css +1122 -1
- package/dist/css/intlTelInput.min.css +1 -1
- package/dist/js/data.d.ts +1 -4
- package/dist/js/data.js +2 -8
- package/dist/js/data.min.js +2 -2
- package/dist/js/data.mjs +1 -7
- package/dist/js/intlTelInput.d.ts +2 -4
- package/dist/js/intlTelInput.js +148 -85
- package/dist/js/intlTelInput.min.js +3 -3
- package/dist/js/intlTelInput.mjs +147 -84
- package/dist/js/intlTelInputWithUtils.js +478 -392
- package/dist/js/intlTelInputWithUtils.min.js +8 -8
- package/dist/js/intlTelInputWithUtils.mjs +477 -391
- package/dist/js/utils.js +50 -51
- package/package.json +3 -7
- package/react/dist/IntlTelInput.js +151 -84
- package/react/dist/IntlTelInputWithUtils.js +481 -391
- package/svelte/src/IntlTelInput.svelte +9 -2
- package/vue/dist/{IntlTelInput-CzuiSLVt.js → IntlTelInput-DWpqqgvZ.js} +463 -428
- package/vue/dist/IntlTelInput.js +1 -1
- package/vue/dist/IntlTelInputWithUtils.js +35 -14
|
@@ -1180,10 +1180,7 @@ for (let e of d) f.push({
|
|
|
1180
1180
|
dialCode: e[1],
|
|
1181
1181
|
priority: e[2] || 0,
|
|
1182
1182
|
areaCodes: e[3] || null,
|
|
1183
|
-
nationalPrefix: e[4] || null
|
|
1184
|
-
normalisedName: "",
|
|
1185
|
-
initials: "",
|
|
1186
|
-
dialCodePlus: ""
|
|
1183
|
+
nationalPrefix: e[4] || null
|
|
1187
1184
|
});
|
|
1188
1185
|
var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
1189
1186
|
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
@@ -1308,6 +1305,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1308
1305
|
placeholderNumberType: "MOBILE",
|
|
1309
1306
|
searchInputClass: "",
|
|
1310
1307
|
separateDialCode: !1,
|
|
1308
|
+
strictRejectAnimation: !1,
|
|
1311
1309
|
showFlags: !0,
|
|
1312
1310
|
strictMode: !1,
|
|
1313
1311
|
useFullscreenPopup: (() => {
|
|
@@ -1325,7 +1323,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1325
1323
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1326
1324
|
}, B = (e, t, n) => {
|
|
1327
1325
|
z(`Option '${e}' must be ${t}; got ${I(n)}. Ignoring.`);
|
|
1328
|
-
},
|
|
1326
|
+
}, V = (e, t) => {
|
|
1329
1327
|
let n = "an array of iso2 country code strings";
|
|
1330
1328
|
if (!Array.isArray(t)) return B(e, n, t), !1;
|
|
1331
1329
|
let r = [];
|
|
@@ -1334,7 +1332,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1334
1332
|
m(i.toLowerCase()) ? r.push(i) : z(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
|
|
1335
1333
|
}
|
|
1336
1334
|
return r;
|
|
1337
|
-
},
|
|
1335
|
+
}, ne = (e) => {
|
|
1338
1336
|
if (e === void 0) return {};
|
|
1339
1337
|
if (!L(e)) return z(`The second argument must be an options object; got ${I(e)}. Using defaults.`), {};
|
|
1340
1338
|
let t = {};
|
|
@@ -1356,6 +1354,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1356
1354
|
case "showFlags":
|
|
1357
1355
|
case "separateDialCode":
|
|
1358
1356
|
case "strictMode":
|
|
1357
|
+
case "strictRejectAnimation":
|
|
1359
1358
|
case "useFullscreenPopup":
|
|
1360
1359
|
if (typeof r != "boolean") {
|
|
1361
1360
|
B(n, "a boolean", r);
|
|
@@ -1382,7 +1381,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1382
1381
|
case "countryOrder":
|
|
1383
1382
|
if (r === null) t[n] = r;
|
|
1384
1383
|
else {
|
|
1385
|
-
let e =
|
|
1384
|
+
let e = V(n, r);
|
|
1386
1385
|
e !== !1 && (t[n] = e);
|
|
1387
1386
|
}
|
|
1388
1387
|
break;
|
|
@@ -1407,7 +1406,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1407
1406
|
case "onlyCountries":
|
|
1408
1407
|
if (r === null) t[n] = r;
|
|
1409
1408
|
else {
|
|
1410
|
-
let e =
|
|
1409
|
+
let e = V(n, r);
|
|
1411
1410
|
e !== !1 && (t[n] = e);
|
|
1412
1411
|
}
|
|
1413
1412
|
break;
|
|
@@ -1455,21 +1454,21 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1455
1454
|
}
|
|
1456
1455
|
}
|
|
1457
1456
|
return t;
|
|
1458
|
-
},
|
|
1457
|
+
}, re = (e) => {
|
|
1459
1458
|
e.initialCountry &&= e.initialCountry.toLowerCase(), e.onlyCountries?.length && (e.onlyCountries = e.onlyCountries.map((e) => e.toLowerCase())), e.excludeCountries?.length && (e.excludeCountries = e.excludeCountries.map((e) => e.toLowerCase())), e.countryOrder &&= e.countryOrder.map((e) => e.toLowerCase());
|
|
1460
|
-
},
|
|
1459
|
+
}, ie = (e) => {
|
|
1461
1460
|
e.dropdownAlwaysOpen && (e.useFullscreenPopup = !1, e.allowDropdown = !0), e.useFullscreenPopup ? e.fixDropdownWidth = !1 : P() && (e.fixDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && (e.nationalMode = !1), e.allowDropdown && !e.showFlags && !e.separateDialCode && (e.nationalMode = !1), e.useFullscreenPopup && !e.dropdownContainer && (e.dropdownContainer = document.body), e.i18n = {
|
|
1462
1461
|
...M,
|
|
1463
1462
|
...e.i18n
|
|
1464
1463
|
};
|
|
1465
|
-
},
|
|
1464
|
+
}, H = (e) => e.replace(/\D/g, ""), U = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), W = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), G = (e, t, n) => {
|
|
1466
1465
|
let r = document.createElement(e);
|
|
1467
1466
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1468
|
-
},
|
|
1467
|
+
}, ae = () => `
|
|
1469
1468
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${j.HIDDEN}="true">
|
|
1470
1469
|
<circle cx="11" cy="11" r="7" />
|
|
1471
1470
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1472
|
-
</svg>`,
|
|
1471
|
+
</svg>`, oe = (e) => {
|
|
1473
1472
|
let t = `iti-${e}-clear-mask`;
|
|
1474
1473
|
return `
|
|
1475
1474
|
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${j.HIDDEN}="true" focusable="false">
|
|
@@ -1479,33 +1478,72 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1479
1478
|
</mask>
|
|
1480
1479
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
|
1481
1480
|
</svg>`;
|
|
1482
|
-
},
|
|
1481
|
+
}, se = () => `
|
|
1483
1482
|
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${j.HIDDEN}="true">
|
|
1484
1483
|
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
|
1485
|
-
</svg>`,
|
|
1486
|
-
let
|
|
1487
|
-
for (let
|
|
1488
|
-
|
|
1484
|
+
</svg>`, K = () => "\n <svg width=\"256\" height=\"256\" viewBox=\"0 0 512 512\" class=\"iti__globe-svg\">\n <path d=\"M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39\"/>\n <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\"/>\n </svg>", ce = (e) => {
|
|
1485
|
+
let t = /* @__PURE__ */ new Map();
|
|
1486
|
+
for (let n of e) {
|
|
1487
|
+
let e = U(n.name), r = e.split(/[^a-z]/).map((e) => e[0]).join("");
|
|
1488
|
+
t.set(n.iso2, {
|
|
1489
|
+
normalisedName: e,
|
|
1490
|
+
initials: r,
|
|
1491
|
+
dialCodePlus: `+${n.dialCode}`
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
return t;
|
|
1495
|
+
}, le = (e, t, n) => {
|
|
1496
|
+
let r = U(n), i = [], a = [], o = [], s = [], c = [], l = [];
|
|
1497
|
+
for (let n of e) {
|
|
1498
|
+
let e = t.get(n.iso2);
|
|
1499
|
+
n.iso2 === r ? i.push(n) : e.normalisedName.startsWith(r) ? a.push(n) : e.normalisedName.includes(r) ? o.push(n) : r === n.dialCode || r === e.dialCodePlus ? s.push(n) : e.dialCodePlus.includes(r) ? c.push(n) : e.initials.includes(r) && l.push(n);
|
|
1500
|
+
}
|
|
1501
|
+
let u = (e, t) => e.priority - t.priority;
|
|
1489
1502
|
return [
|
|
1490
|
-
...r,
|
|
1491
1503
|
...i,
|
|
1492
1504
|
...a,
|
|
1493
|
-
...o
|
|
1494
|
-
...s.sort(
|
|
1495
|
-
...c
|
|
1505
|
+
...o,
|
|
1506
|
+
...s.sort(u),
|
|
1507
|
+
...c.sort(u),
|
|
1508
|
+
...l
|
|
1496
1509
|
];
|
|
1497
|
-
}, ue = (e, t) => {
|
|
1498
|
-
let
|
|
1499
|
-
for (let
|
|
1510
|
+
}, ue = (e, t, n) => {
|
|
1511
|
+
let r = U(n);
|
|
1512
|
+
for (let n of e) {
|
|
1513
|
+
let { normalisedName: e } = t.get(n.iso2);
|
|
1514
|
+
if (e.startsWith(r)) return n;
|
|
1515
|
+
}
|
|
1500
1516
|
return null;
|
|
1501
|
-
},
|
|
1517
|
+
}, q = class e {
|
|
1518
|
+
#e;
|
|
1519
|
+
static toAscii(e) {
|
|
1520
|
+
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
1521
|
+
}
|
|
1522
|
+
constructor(e) {
|
|
1523
|
+
e && this.#t(e);
|
|
1524
|
+
}
|
|
1525
|
+
#t(e) {
|
|
1526
|
+
/[٠-٩]/.test(e) ? this.#e = "arabic-indic" : /[۰-۹]/.test(e) ? this.#e = "persian" : this.#e = "ascii";
|
|
1527
|
+
}
|
|
1528
|
+
denormalise(e) {
|
|
1529
|
+
if (!this.#e || this.#e === "ascii") return e;
|
|
1530
|
+
let t = this.#e === "arabic-indic" ? 1632 : 1776;
|
|
1531
|
+
return e.replace(/[0-9]/g, (e) => String.fromCharCode(t + Number(e)));
|
|
1532
|
+
}
|
|
1533
|
+
normalise(t) {
|
|
1534
|
+
return t ? (this.#t(t), this.#e === "ascii" ? t : e.toAscii(t)) : "";
|
|
1535
|
+
}
|
|
1536
|
+
isAscii() {
|
|
1537
|
+
return !this.#e || this.#e === "ascii";
|
|
1538
|
+
}
|
|
1539
|
+
}, J = class e {
|
|
1502
1540
|
#e;
|
|
1503
1541
|
#t;
|
|
1504
1542
|
#n;
|
|
1505
1543
|
#r = "";
|
|
1506
1544
|
#i;
|
|
1507
|
-
#a
|
|
1508
|
-
#o;
|
|
1545
|
+
#a;
|
|
1546
|
+
#o = null;
|
|
1509
1547
|
#s;
|
|
1510
1548
|
#c;
|
|
1511
1549
|
#l;
|
|
@@ -1521,10 +1559,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1521
1559
|
#y;
|
|
1522
1560
|
#b;
|
|
1523
1561
|
#x;
|
|
1524
|
-
#S
|
|
1562
|
+
#S;
|
|
1525
1563
|
#C = null;
|
|
1526
|
-
#w =
|
|
1527
|
-
#T =
|
|
1564
|
+
#w = null;
|
|
1565
|
+
#T = /* @__PURE__ */ new Map();
|
|
1566
|
+
#E = null;
|
|
1528
1567
|
telInputEl;
|
|
1529
1568
|
hadInitialPlaceholder;
|
|
1530
1569
|
constructor(e, t, n) {
|
|
@@ -1537,13 +1576,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1537
1576
|
throw TypeError(`The first argument must be an HTMLInputElement, not ${t}`);
|
|
1538
1577
|
}
|
|
1539
1578
|
}
|
|
1540
|
-
buildMarkup(e) {
|
|
1541
|
-
this.#i = e, this.telInputEl.classList.add("iti__tel-input"), this.telInputEl.hasAttribute("type") || this.telInputEl.setAttribute("type", "tel"), this.telInputEl.hasAttribute("autocomplete") || this.telInputEl.setAttribute("autocomplete", "tel"), this.telInputEl.hasAttribute("inputmode") || this.telInputEl.setAttribute("inputmode", "tel");
|
|
1542
|
-
let
|
|
1543
|
-
this.#
|
|
1579
|
+
buildMarkup(e, t) {
|
|
1580
|
+
this.#i = e, this.#a = t, this.telInputEl.classList.add("iti__tel-input"), this.telInputEl.hasAttribute("type") || this.telInputEl.setAttribute("type", "tel"), this.telInputEl.hasAttribute("autocomplete") || this.telInputEl.setAttribute("autocomplete", "tel"), this.telInputEl.hasAttribute("inputmode") || this.telInputEl.setAttribute("inputmode", "tel");
|
|
1581
|
+
let n = this.#D();
|
|
1582
|
+
this.#O(n), n.appendChild(this.telInputEl), this.#j(), this.#M(n), this.ensureDropdownWidthSet();
|
|
1544
1583
|
}
|
|
1545
|
-
#
|
|
1546
|
-
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i =
|
|
1584
|
+
#D() {
|
|
1585
|
+
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i = G("div", { class: W({
|
|
1547
1586
|
iti: !0,
|
|
1548
1587
|
"iti--allow-dropdown": e,
|
|
1549
1588
|
"iti--show-flags": t,
|
|
@@ -1552,55 +1591,55 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1552
1591
|
}) });
|
|
1553
1592
|
return this.#n && i.setAttribute("dir", "ltr"), this.telInputEl.before(i), i;
|
|
1554
1593
|
}
|
|
1555
|
-
#
|
|
1594
|
+
#O(e) {
|
|
1556
1595
|
let { allowDropdown: t, separateDialCode: n, showFlags: r } = this.#e;
|
|
1557
1596
|
if (!t && !r && !n) return;
|
|
1558
|
-
this.#
|
|
1597
|
+
this.#c = G("div", { class: `iti__country-container ${_.V_HIDE}` }, e), t ? (this.#l = G("button", {
|
|
1559
1598
|
type: "button",
|
|
1560
1599
|
class: "iti__selected-country",
|
|
1561
1600
|
[j.EXPANDED]: "false",
|
|
1562
1601
|
[j.LABEL]: this.#e.i18n.noCountrySelected,
|
|
1563
1602
|
[j.HASPOPUP]: "dialog",
|
|
1564
1603
|
[j.CONTROLS]: `iti-${this.#t}__dropdown-content`
|
|
1565
|
-
}, this.#
|
|
1566
|
-
let i =
|
|
1567
|
-
this.#
|
|
1604
|
+
}, this.#c), this.telInputEl.disabled && this.#l.setAttribute("disabled", "true")) : this.#l = G("div", { class: "iti__selected-country" }, this.#c);
|
|
1605
|
+
let i = G("div", { class: "iti__selected-country-primary" }, this.#l);
|
|
1606
|
+
this.#u = G("div", { class: _.FLAG }, i), t && (this.#f = G("div", {
|
|
1568
1607
|
class: "iti__arrow",
|
|
1569
1608
|
[j.HIDDEN]: "true"
|
|
1570
|
-
}, i)), n && (this.#
|
|
1609
|
+
}, i)), n && (this.#d = G("div", { class: "iti__selected-dial-code" }, this.#l)), t && this.#k();
|
|
1571
1610
|
}
|
|
1572
1611
|
ensureDropdownWidthSet() {
|
|
1573
1612
|
let { fixDropdownWidth: e, allowDropdown: t } = this.#e;
|
|
1574
|
-
if (!t || !e || this.#
|
|
1613
|
+
if (!t || !e || this.#p.style.width) return;
|
|
1575
1614
|
let n = this.telInputEl.offsetWidth;
|
|
1576
|
-
n > 0 && (this.#
|
|
1615
|
+
n > 0 && (this.#p.style.width = `${n}px`);
|
|
1577
1616
|
}
|
|
1578
|
-
#
|
|
1617
|
+
#k() {
|
|
1579
1618
|
let { fixDropdownWidth: e, useFullscreenPopup: t, countrySearch: n, i18n: r, dropdownContainer: i, containerClass: a } = this.#e, o = e ? "" : "iti--flexible-dropdown-width";
|
|
1580
|
-
this.#
|
|
1619
|
+
this.#p = G("div", {
|
|
1581
1620
|
id: `iti-${this.#t}__dropdown-content`,
|
|
1582
1621
|
class: `iti__dropdown-content ${_.HIDE} ${o}`,
|
|
1583
1622
|
role: "dialog",
|
|
1584
1623
|
[j.MODAL]: "true"
|
|
1585
|
-
}), this.#n && this.#
|
|
1624
|
+
}), this.#n && this.#p.setAttribute("dir", "rtl"), n && this.#A(), this.#_ = G("ul", {
|
|
1586
1625
|
class: "iti__country-list",
|
|
1587
1626
|
id: `iti-${this.#t}__country-listbox`,
|
|
1588
1627
|
role: "listbox",
|
|
1589
1628
|
[j.LABEL]: r.countryListAriaLabel
|
|
1590
|
-
}, this.#
|
|
1629
|
+
}, this.#p), this.#N(), n && this.#R(), t || (this.#s = this.#L(), n && (this.#p.style.height = `${this.#s}px`)), i ? (this.#S = G("div", { class: W({
|
|
1591
1630
|
iti: !0,
|
|
1592
1631
|
"iti--container": !0,
|
|
1593
1632
|
"iti--fullscreen-popup": t,
|
|
1594
1633
|
"iti--inline-dropdown": !t,
|
|
1595
1634
|
[a]: !!a
|
|
1596
|
-
}) }), this.#
|
|
1635
|
+
}) }), this.#S.appendChild(this.#p)) : this.#c.appendChild(this.#p);
|
|
1597
1636
|
}
|
|
1598
|
-
#
|
|
1599
|
-
let { i18n: e, searchInputClass: t } = this.#e, n =
|
|
1600
|
-
this.#
|
|
1637
|
+
#A() {
|
|
1638
|
+
let { i18n: e, searchInputClass: t } = this.#e, n = G("div", { class: "iti__search-input-wrapper" }, this.#p);
|
|
1639
|
+
this.#m = G("span", {
|
|
1601
1640
|
class: "iti__search-icon",
|
|
1602
1641
|
[j.HIDDEN]: "true"
|
|
1603
|
-
}, n), this.#
|
|
1642
|
+
}, n), this.#m.innerHTML = ae(), this.#h = G("input", {
|
|
1604
1643
|
id: `iti-${this.#t}__search-input`,
|
|
1605
1644
|
type: "search",
|
|
1606
1645
|
class: `iti__search-input ${t}`,
|
|
@@ -1611,63 +1650,63 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1611
1650
|
[j.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1612
1651
|
[j.AUTOCOMPLETE]: "list",
|
|
1613
1652
|
autocomplete: "off"
|
|
1614
|
-
}, n), this.#
|
|
1653
|
+
}, n), this.#g = G("button", {
|
|
1615
1654
|
type: "button",
|
|
1616
1655
|
class: `iti__search-clear ${_.HIDE}`,
|
|
1617
1656
|
[j.LABEL]: e.clearSearchAriaLabel,
|
|
1618
1657
|
tabindex: "-1"
|
|
1619
|
-
}, n), this.#
|
|
1658
|
+
}, n), this.#g.innerHTML = oe(this.#t), this.#x = G("span", { class: "iti__a11y-text" }, this.#p), this.#b = G("div", {
|
|
1620
1659
|
class: `iti__no-results ${_.HIDE}`,
|
|
1621
1660
|
[j.HIDDEN]: "true"
|
|
1622
|
-
}, this.#
|
|
1661
|
+
}, this.#p), this.#b.textContent = e.searchEmptyState ?? null;
|
|
1623
1662
|
}
|
|
1624
|
-
#
|
|
1625
|
-
this.#
|
|
1663
|
+
#j() {
|
|
1664
|
+
this.#c && (this.#P(), this.#c.classList.remove(_.V_HIDE));
|
|
1626
1665
|
}
|
|
1627
|
-
#
|
|
1666
|
+
#M(e) {
|
|
1628
1667
|
let { hiddenInput: t } = this.#e;
|
|
1629
1668
|
if (!t) return;
|
|
1630
1669
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
1631
1670
|
if (n.phone) {
|
|
1632
1671
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.phone}"]`);
|
|
1633
|
-
t ? this.#
|
|
1672
|
+
t ? this.#v = t : (this.#v = G("input", {
|
|
1634
1673
|
type: "hidden",
|
|
1635
1674
|
name: n.phone
|
|
1636
|
-
}), e.appendChild(this.#
|
|
1675
|
+
}), e.appendChild(this.#v));
|
|
1637
1676
|
}
|
|
1638
1677
|
if (n.country) {
|
|
1639
1678
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.country}"]`);
|
|
1640
|
-
t ? this.#
|
|
1679
|
+
t ? this.#y = t : (this.#y = G("input", {
|
|
1641
1680
|
type: "hidden",
|
|
1642
1681
|
name: n.country
|
|
1643
|
-
}), e.appendChild(this.#
|
|
1682
|
+
}), e.appendChild(this.#y));
|
|
1644
1683
|
}
|
|
1645
1684
|
}
|
|
1646
|
-
#
|
|
1685
|
+
#N() {
|
|
1647
1686
|
let e = document.createDocumentFragment();
|
|
1648
1687
|
for (let t = 0; t < this.#i.length; t++) {
|
|
1649
|
-
let n = this.#i[t], r =
|
|
1688
|
+
let n = this.#i[t], r = W({ [_.COUNTRY_ITEM]: !0 }), i = G("li", {
|
|
1650
1689
|
id: `iti-${this.#t}__item-${n.iso2}`,
|
|
1651
1690
|
class: r,
|
|
1652
1691
|
tabindex: "-1",
|
|
1653
1692
|
role: "option",
|
|
1654
1693
|
[j.SELECTED]: "false"
|
|
1655
1694
|
});
|
|
1656
|
-
i.dataset[A.DIAL_CODE] = n.dialCode, i.dataset[A.ISO2] = n.iso2, this.#
|
|
1657
|
-
let a =
|
|
1695
|
+
i.dataset[A.DIAL_CODE] = n.dialCode, i.dataset[A.ISO2] = n.iso2, this.#T.set(n.iso2, i), this.#e.showFlags && G("div", { class: `${_.FLAG} iti__${n.iso2}` }, i);
|
|
1696
|
+
let a = G("span", { class: "iti__country-name" }, i);
|
|
1658
1697
|
a.textContent = `${n.name} `;
|
|
1659
|
-
let o =
|
|
1698
|
+
let o = G("span", { class: "iti__dial-code" }, a);
|
|
1660
1699
|
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${n.dialCode})`, e.appendChild(i);
|
|
1661
1700
|
}
|
|
1662
|
-
this.#
|
|
1701
|
+
this.#_.appendChild(e);
|
|
1663
1702
|
}
|
|
1664
|
-
#
|
|
1665
|
-
if (this.#
|
|
1666
|
-
let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_NO_DIAL_WIDTH, t = (this.#
|
|
1703
|
+
#P() {
|
|
1704
|
+
if (this.#l) {
|
|
1705
|
+
let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_NO_DIAL_WIDTH, t = (this.#l.offsetWidth || this.#I() || e) + C.INPUT_PADDING_EXTRA_LEFT;
|
|
1667
1706
|
this.telInputEl.style.paddingLeft = `${t}px`;
|
|
1668
1707
|
}
|
|
1669
1708
|
}
|
|
1670
|
-
static #
|
|
1709
|
+
static #F() {
|
|
1671
1710
|
let e;
|
|
1672
1711
|
try {
|
|
1673
1712
|
e = window.top.document.body;
|
|
@@ -1676,74 +1715,79 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1676
1715
|
}
|
|
1677
1716
|
return e;
|
|
1678
1717
|
}
|
|
1679
|
-
#
|
|
1718
|
+
#I() {
|
|
1680
1719
|
if (!this.telInputEl.parentNode) return 0;
|
|
1681
|
-
let t = e.#
|
|
1720
|
+
let t = e.#F(), n = this.telInputEl.parentNode.cloneNode(!1);
|
|
1682
1721
|
n.style.visibility = "hidden", t.appendChild(n);
|
|
1683
|
-
let r = this.#
|
|
1722
|
+
let r = this.#c.cloneNode();
|
|
1684
1723
|
n.appendChild(r);
|
|
1685
|
-
let i = this.#
|
|
1724
|
+
let i = this.#l.cloneNode(!0);
|
|
1686
1725
|
r.appendChild(i);
|
|
1687
1726
|
let a = i.offsetWidth;
|
|
1688
1727
|
return t.removeChild(n), a;
|
|
1689
1728
|
}
|
|
1690
|
-
#I() {
|
|
1691
|
-
let t = e.#P();
|
|
1692
|
-
this.#f.classList.remove(_.HIDE);
|
|
1693
|
-
let n = W("div", { class: "iti iti--inline-dropdown" });
|
|
1694
|
-
n.appendChild(this.#f), n.style.visibility = "hidden", t.appendChild(n);
|
|
1695
|
-
let r = this.#f.offsetHeight;
|
|
1696
|
-
return t.removeChild(n), n.style.visibility = "", this.#f.classList.add(_.HIDE), r > 0 ? r : C.FALLBACK_DROPDOWN_HEIGHT;
|
|
1697
|
-
}
|
|
1698
1729
|
#L() {
|
|
1699
|
-
let
|
|
1700
|
-
this.#
|
|
1730
|
+
let t = e.#F();
|
|
1731
|
+
this.#p.classList.remove(_.HIDE);
|
|
1732
|
+
let n = G("div", { class: "iti iti--inline-dropdown" });
|
|
1733
|
+
n.appendChild(this.#p), n.style.visibility = "hidden", t.appendChild(n);
|
|
1734
|
+
let r = this.#p.offsetHeight;
|
|
1735
|
+
return t.removeChild(n), n.style.visibility = "", this.#p.classList.add(_.HIDE), r > 0 ? r : C.FALLBACK_DROPDOWN_HEIGHT;
|
|
1736
|
+
}
|
|
1737
|
+
#R() {
|
|
1738
|
+
let { i18n: e } = this.#e, t = this.#_.childElementCount;
|
|
1739
|
+
this.#x.textContent = e.searchSummaryAria(t);
|
|
1701
1740
|
}
|
|
1702
|
-
#
|
|
1741
|
+
#z(e) {
|
|
1703
1742
|
let t;
|
|
1704
|
-
|
|
1743
|
+
if (e === "") t = this.#i;
|
|
1744
|
+
else {
|
|
1745
|
+
let n = q.toAscii(e);
|
|
1746
|
+
t = le(this.#i, this.#a, n);
|
|
1747
|
+
}
|
|
1748
|
+
this.#ee(t);
|
|
1705
1749
|
}
|
|
1706
1750
|
prefillSearchWithPlus() {
|
|
1707
|
-
this.#
|
|
1708
|
-
}
|
|
1709
|
-
#z() {
|
|
1710
|
-
let e = this.#m.value.trim();
|
|
1711
|
-
this.#R(e), this.#m.value ? this.#h.classList.remove(_.HIDE) : this.#h.classList.add(_.HIDE);
|
|
1751
|
+
this.#h.value = "+", this.#h.focus(), this.#z("");
|
|
1712
1752
|
}
|
|
1713
1753
|
#B() {
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}, x.SEARCH_DEBOUNCE_MS);
|
|
1754
|
+
let e = this.#h.value.trim();
|
|
1755
|
+
this.#z(e), this.#h.value ? this.#g.classList.remove(_.HIDE) : this.#g.classList.add(_.HIDE);
|
|
1717
1756
|
}
|
|
1718
1757
|
#V() {
|
|
1719
|
-
this.#
|
|
1758
|
+
this.#o && clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
1759
|
+
this.#B(), this.#o = null;
|
|
1760
|
+
}, x.SEARCH_DEBOUNCE_MS);
|
|
1761
|
+
}
|
|
1762
|
+
#H() {
|
|
1763
|
+
this.#h.value = "", this.#h.focus(), this.#B();
|
|
1720
1764
|
}
|
|
1721
|
-
#
|
|
1722
|
-
let t = this.#
|
|
1765
|
+
#U(e) {
|
|
1766
|
+
let t = this.#_, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
|
|
1723
1767
|
r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
|
|
1724
1768
|
}
|
|
1725
|
-
#
|
|
1726
|
-
if (this.#
|
|
1769
|
+
#W(e, t = !0) {
|
|
1770
|
+
if (this.#w?.classList.remove(_.HIGHLIGHT), e) {
|
|
1727
1771
|
if (e.classList.add(_.HIGHLIGHT), this.#e.countrySearch) {
|
|
1728
1772
|
let t = e.getAttribute("id") || "";
|
|
1729
|
-
this.#
|
|
1773
|
+
this.#h.setAttribute(j.ACTIVE_DESCENDANT, t);
|
|
1730
1774
|
}
|
|
1731
|
-
t && this.#
|
|
1732
|
-
} else this.#
|
|
1775
|
+
t && this.#U(e), this.#w = e;
|
|
1776
|
+
} else this.#w = null;
|
|
1733
1777
|
}
|
|
1734
1778
|
bindHiddenInputSubmitListener(e, t, n) {
|
|
1735
1779
|
let r = this.telInputEl.form;
|
|
1736
|
-
!r || !this.#
|
|
1737
|
-
this.#
|
|
1780
|
+
!r || !this.#v && !this.#y || r.addEventListener("submit", () => {
|
|
1781
|
+
this.#v && (this.#v.value = t()), this.#y && (this.#y.value = n());
|
|
1738
1782
|
}, { signal: e });
|
|
1739
1783
|
}
|
|
1740
1784
|
bindAllInitialDropdownListeners(e, t, n) {
|
|
1741
1785
|
let r = this.telInputEl.closest("label");
|
|
1742
1786
|
r && r.addEventListener("click", (e) => {
|
|
1743
1787
|
this.isDropdownOpen() ? e.preventDefault() : this.telInputEl.focus();
|
|
1744
|
-
}, { signal: e }), this.#
|
|
1788
|
+
}, { signal: e }), this.#l.addEventListener("click", () => {
|
|
1745
1789
|
!this.isDropdownOpen() && !this.telInputEl.disabled && !this.telInputEl.readOnly && t();
|
|
1746
|
-
}, { signal: e }), this.#
|
|
1790
|
+
}, { signal: e }), this.#c.addEventListener("keydown", (e) => {
|
|
1747
1791
|
let r = [
|
|
1748
1792
|
v.ARROW_UP,
|
|
1749
1793
|
v.ARROW_DOWN,
|
|
@@ -1755,41 +1799,41 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1755
1799
|
}
|
|
1756
1800
|
openDropdown(e, t) {
|
|
1757
1801
|
let { countrySearch: n, dropdownAlwaysOpen: r, dropdownContainer: i } = this.#e;
|
|
1758
|
-
if (this.#
|
|
1802
|
+
if (this.#E = new AbortController(), this.ensureDropdownWidthSet(), i) this.#ne();
|
|
1759
1803
|
else {
|
|
1760
|
-
let e = this.#
|
|
1761
|
-
e ? this.#
|
|
1804
|
+
let e = this.#te(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
|
|
1805
|
+
e ? this.#p.style.top = `${t}px` : this.#p.style.bottom = `${t}px`;
|
|
1762
1806
|
}
|
|
1763
|
-
this.#
|
|
1764
|
-
let a = this.#
|
|
1765
|
-
a && this.#
|
|
1766
|
-
this.#
|
|
1767
|
-
}, { signal: this.#
|
|
1768
|
-
}
|
|
1769
|
-
#
|
|
1770
|
-
let n = this.#
|
|
1771
|
-
this.#
|
|
1772
|
-
}
|
|
1773
|
-
#
|
|
1774
|
-
this.#
|
|
1807
|
+
this.#p.classList.remove(_.HIDE), this.#l.setAttribute(j.EXPANDED, "true");
|
|
1808
|
+
let a = this.#C ?? this.#_.firstElementChild;
|
|
1809
|
+
a && this.#W(a), n && !r && this.#h.focus(), this.#e.useFullscreenPopup && this.#S && window.visualViewport && window.visualViewport.addEventListener("resize", () => {
|
|
1810
|
+
this.#re(), this.#w && this.#U(this.#w);
|
|
1811
|
+
}, { signal: this.#E.signal }), this.#f.classList.add(_.ARROW_UP), this.#G(e, t);
|
|
1812
|
+
}
|
|
1813
|
+
#G(e, t) {
|
|
1814
|
+
let n = this.#E.signal;
|
|
1815
|
+
this.#K(n), this.#q(n, e), this.#e.dropdownAlwaysOpen || this.#J(n, t), this.#Y(n, e, t), this.#e.countrySearch && this.#X(n), !this.#e.useFullscreenPopup && this.#e.dropdownContainer && window.addEventListener("scroll", t, { signal: n });
|
|
1816
|
+
}
|
|
1817
|
+
#K(e) {
|
|
1818
|
+
this.#_.addEventListener("mouseover", (e) => {
|
|
1775
1819
|
let t = e.target?.closest(`.${_.COUNTRY_ITEM}`);
|
|
1776
|
-
t && this.#
|
|
1820
|
+
t && this.#W(t, !1);
|
|
1777
1821
|
}, { signal: e });
|
|
1778
1822
|
}
|
|
1779
|
-
#
|
|
1780
|
-
this.#
|
|
1823
|
+
#q(e, t) {
|
|
1824
|
+
this.#_.addEventListener("click", (e) => {
|
|
1781
1825
|
let n = e.target?.closest(`.${_.COUNTRY_ITEM}`);
|
|
1782
1826
|
n && t(n);
|
|
1783
1827
|
}, { signal: e });
|
|
1784
1828
|
}
|
|
1785
|
-
#
|
|
1829
|
+
#J(e, t) {
|
|
1786
1830
|
setTimeout(() => {
|
|
1787
1831
|
document.documentElement.addEventListener("click", (e) => {
|
|
1788
|
-
this.#
|
|
1832
|
+
this.#p.contains(e.target) || t();
|
|
1789
1833
|
}, { signal: e });
|
|
1790
1834
|
}, 0);
|
|
1791
1835
|
}
|
|
1792
|
-
#
|
|
1836
|
+
#Y(e, t, n) {
|
|
1793
1837
|
let r = "", i = null;
|
|
1794
1838
|
document.addEventListener("keydown", (e) => {
|
|
1795
1839
|
[
|
|
@@ -1797,105 +1841,105 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1797
1841
|
v.ARROW_DOWN,
|
|
1798
1842
|
v.ENTER,
|
|
1799
1843
|
v.ESC
|
|
1800
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#
|
|
1844
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#Q(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#w) : e.key === v.ESC && (n(), this.#l.focus())), !this.#e.countrySearch && e.target !== this.telInputEl && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#Z(r), i = setTimeout(() => {
|
|
1801
1845
|
r = "";
|
|
1802
1846
|
}, x.HIDDEN_SEARCH_RESET_MS));
|
|
1803
1847
|
}, { signal: e });
|
|
1804
1848
|
}
|
|
1805
|
-
#Y(e) {
|
|
1806
|
-
this.#m.addEventListener("input", () => this.#B(), { signal: e }), this.#h.addEventListener("click", () => this.#V(), { signal: e });
|
|
1807
|
-
}
|
|
1808
1849
|
#X(e) {
|
|
1809
|
-
|
|
1810
|
-
if (t) {
|
|
1811
|
-
let e = this.#w.get(t.iso2);
|
|
1812
|
-
this.#U(e);
|
|
1813
|
-
}
|
|
1850
|
+
this.#h.addEventListener("input", () => this.#V(), { signal: e }), this.#g.addEventListener("click", () => this.#H(), { signal: e });
|
|
1814
1851
|
}
|
|
1815
1852
|
#Z(e) {
|
|
1816
|
-
let t =
|
|
1817
|
-
|
|
1853
|
+
let t = ue(this.#i, this.#a, e);
|
|
1854
|
+
if (t) {
|
|
1855
|
+
let e = this.#T.get(t.iso2);
|
|
1856
|
+
this.#W(e);
|
|
1857
|
+
}
|
|
1818
1858
|
}
|
|
1819
1859
|
#Q(e) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1860
|
+
let t = e === v.ARROW_UP ? this.#w?.previousElementSibling : this.#w?.nextElementSibling;
|
|
1861
|
+
!t && this.#_.childElementCount > 1 && (t = e === v.ARROW_UP ? this.#_.lastElementChild : this.#_.firstElementChild), t && this.#W(t);
|
|
1862
|
+
}
|
|
1863
|
+
#$(e) {
|
|
1864
|
+
if (this.#C && this.#C.dataset[A.ISO2] !== e && (this.#C.setAttribute(j.SELECTED, "false"), this.#C.querySelector(".iti__country-check")?.remove(), this.#C = null), e && !this.#C) {
|
|
1865
|
+
let t = this.#_.querySelector(`[data-country-code="${e}"]`);
|
|
1822
1866
|
if (t) {
|
|
1823
1867
|
t.setAttribute(j.SELECTED, "true");
|
|
1824
|
-
let e =
|
|
1868
|
+
let e = G("span", {
|
|
1825
1869
|
class: "iti__country-check",
|
|
1826
1870
|
[j.HIDDEN]: "true"
|
|
1827
1871
|
}, t);
|
|
1828
|
-
e.innerHTML =
|
|
1872
|
+
e.innerHTML = se(), this.#C = t, this.#e.dropdownAlwaysOpen && this.#W(t);
|
|
1829
1873
|
}
|
|
1830
1874
|
}
|
|
1831
1875
|
}
|
|
1832
|
-
|
|
1833
|
-
this.#
|
|
1876
|
+
#ee(e) {
|
|
1877
|
+
this.#_.replaceChildren();
|
|
1834
1878
|
let t = !0;
|
|
1835
1879
|
for (let n of e) {
|
|
1836
|
-
let e = this.#
|
|
1837
|
-
e && (this.#
|
|
1880
|
+
let e = this.#T.get(n.iso2);
|
|
1881
|
+
e && (this.#_.appendChild(e), t &&= (this.#W(e, !1), !1));
|
|
1838
1882
|
}
|
|
1839
|
-
t ? (this.#
|
|
1883
|
+
t ? (this.#W(null), this.#b && this.#b.classList.remove(_.HIDE)) : this.#b && this.#b.classList.add(_.HIDE), this.#_.scrollTop = 0, this.#R();
|
|
1840
1884
|
}
|
|
1841
1885
|
closeDropdown() {
|
|
1842
1886
|
let { countrySearch: e, dropdownContainer: t } = this.#e;
|
|
1843
|
-
this.#
|
|
1887
|
+
this.#E.abort(), this.#E = null, this.#p.classList.add(_.HIDE), this.#l.setAttribute(j.EXPANDED, "false"), e && (this.#h.removeAttribute(j.ACTIVE_DESCENDANT), this.#h.value = "", this.#B(), this.#w &&= (this.#w.classList.remove(_.HIGHLIGHT), null)), this.#f.classList.remove(_.ARROW_UP), t ? (this.#S.remove(), this.#S.style.top = "", this.#S.style.bottom = "", this.#S.style.paddingLeft = "", this.#S.style.paddingRight = "") : (this.#p.style.top = "", this.#p.style.bottom = "");
|
|
1844
1888
|
}
|
|
1845
|
-
#
|
|
1889
|
+
#te() {
|
|
1846
1890
|
if (this.#e.dropdownAlwaysOpen) return !0;
|
|
1847
1891
|
let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
|
|
1848
|
-
return n >= this.#
|
|
1892
|
+
return n >= this.#s || n >= t;
|
|
1849
1893
|
}
|
|
1850
|
-
#
|
|
1894
|
+
#ne() {
|
|
1851
1895
|
let { dropdownContainer: e, useFullscreenPopup: t } = this.#e;
|
|
1852
1896
|
if (t) {
|
|
1853
1897
|
if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
|
|
1854
1898
|
let e = this.telInputEl.getBoundingClientRect();
|
|
1855
|
-
this.#
|
|
1899
|
+
this.#S.style.paddingLeft = `${e.left}px`, this.#S.style.paddingRight = `${window.innerWidth - e.right}px`;
|
|
1856
1900
|
}
|
|
1857
1901
|
} else {
|
|
1858
1902
|
let e = this.telInputEl.getBoundingClientRect();
|
|
1859
|
-
this.#
|
|
1903
|
+
this.#S.style.left = `${e.left}px`, this.#te() ? this.#S.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#S.style.top = "unset", this.#S.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
|
|
1860
1904
|
}
|
|
1861
|
-
e.appendChild(this.#
|
|
1905
|
+
e.appendChild(this.#S);
|
|
1862
1906
|
}
|
|
1863
|
-
#
|
|
1907
|
+
#re() {
|
|
1864
1908
|
let e = window.visualViewport;
|
|
1865
|
-
if (!e || !this.#
|
|
1909
|
+
if (!e || !this.#S) return;
|
|
1866
1910
|
let t = window.innerHeight - e.height;
|
|
1867
|
-
this.#
|
|
1911
|
+
this.#S.style.bottom = `${t}px`;
|
|
1868
1912
|
}
|
|
1869
1913
|
isDropdownOpen() {
|
|
1870
|
-
return !this.#
|
|
1914
|
+
return !this.#p.classList.contains(_.HIDE);
|
|
1871
1915
|
}
|
|
1872
1916
|
setLoading(e) {
|
|
1873
|
-
this.#
|
|
1917
|
+
this.#u.classList.toggle(_.LOADING, e);
|
|
1874
1918
|
}
|
|
1875
1919
|
isLoading() {
|
|
1876
|
-
return this.#
|
|
1920
|
+
return this.#u.classList.contains(_.LOADING);
|
|
1877
1921
|
}
|
|
1878
1922
|
setDisabled(e) {
|
|
1879
|
-
this.telInputEl.disabled = e, this.#
|
|
1923
|
+
this.telInputEl.disabled = e, this.#l && (e ? this.#l.setAttribute("disabled", "true") : this.#l.removeAttribute("disabled"));
|
|
1880
1924
|
}
|
|
1881
1925
|
setReadonly(e) {
|
|
1882
|
-
this.telInputEl.readOnly = e, this.#
|
|
1926
|
+
this.telInputEl.readOnly = e, this.#l && (e ? this.#l.setAttribute("disabled", "true") : this.#l.removeAttribute("disabled"));
|
|
1883
1927
|
}
|
|
1884
1928
|
setCountry(e) {
|
|
1885
1929
|
let { allowDropdown: t, showFlags: n, separateDialCode: r, i18n: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
1886
|
-
if (t && this
|
|
1930
|
+
if (t && this.#$(s), this.#l) {
|
|
1887
1931
|
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c;
|
|
1888
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" :
|
|
1932
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" : K()) : (r = i.noCountrySelected, t = i.noCountrySelected, c = K()), this.#u.className = e, this.#l.setAttribute("title", r), this.#l.setAttribute(j.LABEL, t), this.#u.innerHTML = c;
|
|
1889
1933
|
}
|
|
1890
1934
|
if (r) {
|
|
1891
1935
|
let e = o ? `+${o}` : "";
|
|
1892
|
-
this.#
|
|
1936
|
+
this.#d.textContent = e, this.#P();
|
|
1893
1937
|
}
|
|
1894
1938
|
}
|
|
1895
1939
|
destroy() {
|
|
1896
1940
|
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[A.INSTANCE_ID], this.telInputEl.style.paddingLeft = this.#r;
|
|
1897
1941
|
let e = this.telInputEl.parentNode;
|
|
1898
|
-
e && (e.before(this.telInputEl), e.remove()), this.#
|
|
1942
|
+
e && (e.before(this.telInputEl), e.remove()), this.#T.clear();
|
|
1899
1943
|
}
|
|
1900
1944
|
}, de = (e) => {
|
|
1901
1945
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
@@ -1946,9 +1990,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1946
1990
|
}
|
|
1947
1991
|
return e.name.localeCompare(t.name);
|
|
1948
1992
|
});
|
|
1949
|
-
}, he =
|
|
1950
|
-
for (let t of e) t.normalisedName = H(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
1951
|
-
}, ge = /* @__PURE__ */ new Set([
|
|
1993
|
+
}, he = /* @__PURE__ */ new Set([
|
|
1952
1994
|
"800",
|
|
1953
1995
|
"808",
|
|
1954
1996
|
"870",
|
|
@@ -1957,10 +1999,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1957
1999
|
"883",
|
|
1958
2000
|
"888",
|
|
1959
2001
|
"979"
|
|
1960
|
-
]),
|
|
1961
|
-
let t =
|
|
1962
|
-
return e.startsWith("+") &&
|
|
1963
|
-
},
|
|
2002
|
+
]), Y = (e) => {
|
|
2003
|
+
let t = H(e).slice(0, 3);
|
|
2004
|
+
return e.startsWith("+") && he.has(t);
|
|
2005
|
+
}, ge = (e, t, n, r) => {
|
|
1964
2006
|
if (!n || !t) return e;
|
|
1965
2007
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
1966
2008
|
return e.substring(a);
|
|
@@ -1993,35 +2035,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1993
2035
|
"887",
|
|
1994
2036
|
"888",
|
|
1995
2037
|
"889"
|
|
1996
|
-
]),
|
|
1997
|
-
let t =
|
|
2038
|
+
]), be = (e) => {
|
|
2039
|
+
let t = H(e);
|
|
1998
2040
|
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
1999
2041
|
let e = t.substring(1, 4);
|
|
2000
2042
|
return ye.has(e);
|
|
2001
2043
|
}
|
|
2002
2044
|
return !1;
|
|
2003
|
-
}, be = class {
|
|
2004
|
-
#e;
|
|
2005
|
-
constructor(e) {
|
|
2006
|
-
e && this.#t(e);
|
|
2007
|
-
}
|
|
2008
|
-
#t(e) {
|
|
2009
|
-
/[\u0660-\u0669]/.test(e) ? this.#e = "arabic-indic" : /[\u06F0-\u06F9]/.test(e) ? this.#e = "persian" : this.#e = "ascii";
|
|
2010
|
-
}
|
|
2011
|
-
denormalise(e) {
|
|
2012
|
-
if (!this.#e || this.#e === "ascii") return e;
|
|
2013
|
-
let t = this.#e === "arabic-indic" ? 1632 : 1776;
|
|
2014
|
-
return e.replace(/[0-9]/g, (e) => String.fromCharCode(t + Number(e)));
|
|
2015
|
-
}
|
|
2016
|
-
normalise(e) {
|
|
2017
|
-
if (!e) return "";
|
|
2018
|
-
if (this.#t(e), this.#e === "ascii") return e;
|
|
2019
|
-
let t = this.#e === "arabic-indic" ? 1632 : 1776, n = this.#e === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
|
|
2020
|
-
return e.replace(n, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - t)));
|
|
2021
|
-
}
|
|
2022
|
-
isAscii() {
|
|
2023
|
-
return !this.#e || this.#e === "ascii";
|
|
2024
|
-
}
|
|
2025
2045
|
}, xe = 0, X = (e) => {
|
|
2026
2046
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2027
2047
|
}, Se = () => {
|
|
@@ -2044,61 +2064,62 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2044
2064
|
#a;
|
|
2045
2065
|
#o;
|
|
2046
2066
|
#s;
|
|
2047
|
-
#c
|
|
2067
|
+
#c;
|
|
2048
2068
|
#l = null;
|
|
2049
|
-
#u;
|
|
2050
|
-
#d
|
|
2051
|
-
#f;
|
|
2069
|
+
#u = null;
|
|
2070
|
+
#d;
|
|
2071
|
+
#f = !0;
|
|
2052
2072
|
#p;
|
|
2053
|
-
#m
|
|
2054
|
-
#h;
|
|
2073
|
+
#m;
|
|
2074
|
+
#h = !1;
|
|
2055
2075
|
#g;
|
|
2076
|
+
#_;
|
|
2056
2077
|
constructor(e, t = {}) {
|
|
2057
|
-
this.id = xe++,
|
|
2058
|
-
let n =
|
|
2078
|
+
this.id = xe++, J.validateInput(e);
|
|
2079
|
+
let n = ne(t);
|
|
2059
2080
|
this.#t = {
|
|
2060
2081
|
...F,
|
|
2061
2082
|
...n
|
|
2062
|
-
},
|
|
2083
|
+
}, re(this.#t), ie(this.#t), this.#e = new J(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new q(e.value), this.promise = this.#b(this.#t), this.#r = de(this.#t);
|
|
2063
2084
|
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = pe(this.#r);
|
|
2064
|
-
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#
|
|
2085
|
+
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#x();
|
|
2065
2086
|
}
|
|
2066
|
-
#
|
|
2087
|
+
#v() {
|
|
2067
2088
|
let e = this.#e.telInputEl.value.trim();
|
|
2068
|
-
return this.#
|
|
2069
|
-
}
|
|
2070
|
-
#v(e) {
|
|
2071
|
-
this.#e.telInputEl.value = this.#p.denormalise(e);
|
|
2089
|
+
return this.#m.normalise(e);
|
|
2072
2090
|
}
|
|
2073
2091
|
#y(e) {
|
|
2074
|
-
|
|
2075
|
-
return i && (this.#h = Se()), a && (this.#g = Se()), Promise.all([this.#h?.promise, this.#g?.promise]).then(() => {});
|
|
2092
|
+
this.#e.telInputEl.value = this.#m.denormalise(e);
|
|
2076
2093
|
}
|
|
2077
|
-
#b() {
|
|
2078
|
-
|
|
2094
|
+
#b(e) {
|
|
2095
|
+
let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === O.AUTO && !!n, a = !!r && !Q.utils;
|
|
2096
|
+
return i && (this.#g = Se()), a && (this.#_ = Se()), Promise.all([this.#g?.promise, this.#_?.promise]).then(() => {});
|
|
2079
2097
|
}
|
|
2080
2098
|
#x() {
|
|
2081
|
-
|
|
2099
|
+
this.#p = new AbortController(), this.#S(), this.#e.buildMarkup(this.#r, this.#c), this.#C(), this.#w(), this.#T(), this.#t.dropdownAlwaysOpen && this.#U();
|
|
2082
2100
|
}
|
|
2083
|
-
#S(
|
|
2084
|
-
|
|
2085
|
-
a ? o ? f ? this.#q(u) : d || this.#q(E.ISO2) : (f && this.#q(u), this.#U(i)) : f ? this.#q(u) : d || this.#q(""), i && this.#H(i);
|
|
2101
|
+
#S() {
|
|
2102
|
+
fe(this.#r, this.#t), me(this.#r, this.#t), this.#c = ce(this.#r);
|
|
2086
2103
|
}
|
|
2087
|
-
#C() {
|
|
2088
|
-
this.#
|
|
2104
|
+
#C(e = !1) {
|
|
2105
|
+
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#v(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#te(i), o = be(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === O.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2106
|
+
a ? o ? f ? this.#Y(u) : d || this.#Y(E.ISO2) : (f && this.#Y(u), this.#G(i)) : f ? this.#Y(u) : d || this.#Y(""), i && this.#W(i);
|
|
2089
2107
|
}
|
|
2090
2108
|
#w() {
|
|
2091
|
-
|
|
2109
|
+
this.#k(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#p.signal, () => this.#U(), () => this.#$()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
|
|
2110
|
+
}
|
|
2111
|
+
#T() {
|
|
2112
|
+
if (this.#_) {
|
|
2092
2113
|
let { loadUtils: e } = this.#t, t = () => {
|
|
2093
2114
|
Q.attachUtils(e)?.catch(() => {});
|
|
2094
2115
|
};
|
|
2095
|
-
Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#
|
|
2116
|
+
Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#p.signal });
|
|
2096
2117
|
}
|
|
2097
|
-
this.#
|
|
2118
|
+
this.#g && (this.#l ? this.#g.resolve() : this.#E());
|
|
2098
2119
|
}
|
|
2099
|
-
#
|
|
2120
|
+
#E() {
|
|
2100
2121
|
if (Q.autoCountry) {
|
|
2101
|
-
this.#
|
|
2122
|
+
this.#se();
|
|
2102
2123
|
return;
|
|
2103
2124
|
}
|
|
2104
2125
|
this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function" && this.#t.geoIpLookup((t = "") => {
|
|
@@ -2108,99 +2129,107 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2108
2129
|
e.forEachInstance("handleAutoCountryFailure");
|
|
2109
2130
|
}));
|
|
2110
2131
|
}
|
|
2111
|
-
#
|
|
2112
|
-
this.#
|
|
2132
|
+
#D() {
|
|
2133
|
+
this.#U(), this.#e.prefillSearchWithPlus();
|
|
2113
2134
|
}
|
|
2114
|
-
#
|
|
2135
|
+
#O(e) {
|
|
2115
2136
|
let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
|
|
2116
|
-
return this.#
|
|
2137
|
+
return this.#y(n + r), t - 1;
|
|
2117
2138
|
}
|
|
2118
|
-
#
|
|
2119
|
-
this.#
|
|
2139
|
+
#k() {
|
|
2140
|
+
this.#P(), this.#I(), this.#R();
|
|
2120
2141
|
}
|
|
2121
|
-
#
|
|
2122
|
-
this.#
|
|
2142
|
+
#A(e) {
|
|
2143
|
+
this.#O(e), this.#D();
|
|
2123
2144
|
}
|
|
2124
|
-
#
|
|
2125
|
-
let n = this.#
|
|
2126
|
-
this.#e.telInputEl.setSelectionRange(n, n), this.#
|
|
2145
|
+
#j(e, t) {
|
|
2146
|
+
let n = this.#O(e);
|
|
2147
|
+
this.#e.telInputEl.setSelectionRange(n, n), this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2127
2148
|
source: "key",
|
|
2128
2149
|
rejectedInput: t,
|
|
2129
2150
|
reason: "invalid"
|
|
2130
2151
|
});
|
|
2131
2152
|
}
|
|
2132
|
-
#
|
|
2133
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = _e(this.#
|
|
2134
|
-
this.#
|
|
2153
|
+
#M(e, t) {
|
|
2154
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = _e(this.#re(), e, Q.utils, this.#l, this.#t.separateDialCode), a = ve(r, i, n, t);
|
|
2155
|
+
this.#y(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2135
2156
|
}
|
|
2136
|
-
#
|
|
2137
|
-
if (e.startsWith("+") && this.#
|
|
2138
|
-
let t =
|
|
2139
|
-
this.#
|
|
2157
|
+
#N(e) {
|
|
2158
|
+
if (e.startsWith("+") && this.#l && this.#te(e)) {
|
|
2159
|
+
let t = ge(e, !0, !0, this.#l);
|
|
2160
|
+
this.#y(t);
|
|
2140
2161
|
}
|
|
2141
2162
|
}
|
|
2142
|
-
#
|
|
2143
|
-
this.#
|
|
2163
|
+
#P() {
|
|
2164
|
+
this.#h = b.ALPHA_UNICODE.test(this.#v()), this.#e.telInputEl.addEventListener("input", this.#F, { signal: this.#p.signal });
|
|
2144
2165
|
}
|
|
2145
|
-
#
|
|
2166
|
+
#F = (e) => {
|
|
2146
2167
|
let { strictMode: t, formatAsYouType: n, separateDialCode: r, allowDropdown: i, countrySearch: a } = this.#t, o = e?.detail;
|
|
2147
2168
|
if (o?.isCountryChange) return;
|
|
2148
|
-
let s = this.#
|
|
2169
|
+
let s = this.#v();
|
|
2149
2170
|
if (this.#n && e?.data === "+" && r && i && a) {
|
|
2150
|
-
this.#
|
|
2171
|
+
this.#A(s);
|
|
2151
2172
|
return;
|
|
2152
2173
|
}
|
|
2153
2174
|
if (this.#n && t && (e?.data === " " || e?.data === "-" || e?.data === ".")) {
|
|
2154
|
-
this.#
|
|
2175
|
+
this.#j(s, e.data);
|
|
2155
2176
|
return;
|
|
2156
2177
|
}
|
|
2157
|
-
this.#
|
|
2178
|
+
this.#G(s) && this.#oe();
|
|
2158
2179
|
let c = e?.data && b.NON_PLUS_NUMERIC.test(e.data), l = e?.inputType === y.PASTE && s;
|
|
2159
|
-
c || l && !t ? this.#
|
|
2180
|
+
c || l && !t ? this.#h = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#M(s, e?.inputType === y.DELETE_FORWARD), r && this.#N(s);
|
|
2160
2181
|
};
|
|
2161
|
-
#
|
|
2182
|
+
#I() {
|
|
2162
2183
|
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
2163
|
-
!e && !t || this.#e.telInputEl.addEventListener("keydown", this.#
|
|
2184
|
+
!e && !t || this.#e.telInputEl.addEventListener("keydown", this.#L, { signal: this.#p.signal });
|
|
2164
2185
|
}
|
|
2165
|
-
#
|
|
2186
|
+
#L = (e) => {
|
|
2166
2187
|
let { strictMode: t, separateDialCode: n, allowDropdown: r, countrySearch: i } = this.#t;
|
|
2167
2188
|
if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2168
2189
|
if (n && r && i && e.key === "+") {
|
|
2169
|
-
e.preventDefault(), this.#
|
|
2190
|
+
e.preventDefault(), this.#D();
|
|
2170
2191
|
return;
|
|
2171
2192
|
}
|
|
2172
2193
|
if (!t) return;
|
|
2173
|
-
let a = this.#
|
|
2174
|
-
Q.utils && this.#
|
|
2175
|
-
let y = this.#
|
|
2176
|
-
(!l || v && !y && !o) && (this.#
|
|
2194
|
+
let a = this.#v(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#ne(h), v = !1;
|
|
2195
|
+
Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
|
|
2196
|
+
let y = this.#q(_) !== null;
|
|
2197
|
+
(!l || v && !y && !o) && (this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2177
2198
|
source: "key",
|
|
2178
2199
|
rejectedInput: e.key,
|
|
2179
2200
|
reason: l ? "max-length" : "invalid"
|
|
2180
2201
|
}), e.preventDefault());
|
|
2181
2202
|
};
|
|
2182
|
-
#
|
|
2183
|
-
this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#
|
|
2203
|
+
#R() {
|
|
2204
|
+
this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#z, { signal: this.#p.signal });
|
|
2184
2205
|
}
|
|
2185
|
-
#
|
|
2206
|
+
#z = (e) => {
|
|
2186
2207
|
e.preventDefault();
|
|
2187
|
-
let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#
|
|
2208
|
+
let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#v(), a = i.slice(0, n ?? void 0), o = i.slice(r ?? void 0), s = this.#l?.iso2, c = e.clipboardData.getData("text"), l = this.#m.normalise(c), u = n === 0 && r > 0, d = !i.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = a + h + o, v = h === l ? null : "invalid";
|
|
2209
|
+
if (_.length > 30) {
|
|
2210
|
+
this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2211
|
+
source: "paste",
|
|
2212
|
+
rejectedInput: c,
|
|
2213
|
+
reason: "max-length"
|
|
2214
|
+
});
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2188
2217
|
if (_.length > 5 && Q.utils) {
|
|
2189
2218
|
let e = Q.utils.getCoreNumber(_, s);
|
|
2190
2219
|
for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, s);
|
|
2191
2220
|
if (!e) {
|
|
2192
|
-
this.#
|
|
2221
|
+
this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2193
2222
|
source: "paste",
|
|
2194
2223
|
rejectedInput: c,
|
|
2195
2224
|
reason: "max-length"
|
|
2196
2225
|
});
|
|
2197
2226
|
return;
|
|
2198
2227
|
}
|
|
2199
|
-
if (this.#
|
|
2200
|
-
let t = e.length - this.#
|
|
2228
|
+
if (this.#u && e.length > this.#u) if (t.selectionEnd === i.length) {
|
|
2229
|
+
let t = e.length - this.#u;
|
|
2201
2230
|
_ = _.slice(0, _.length - t), v = "max-length";
|
|
2202
2231
|
} else {
|
|
2203
|
-
this.#
|
|
2232
|
+
this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2204
2233
|
source: "paste",
|
|
2205
2234
|
rejectedInput: c,
|
|
2206
2235
|
reason: "max-length"
|
|
@@ -2208,19 +2237,24 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2208
2237
|
return;
|
|
2209
2238
|
}
|
|
2210
2239
|
}
|
|
2211
|
-
this.#
|
|
2240
|
+
this.#y(_);
|
|
2212
2241
|
let y = n + h.length;
|
|
2213
|
-
t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && this.#
|
|
2242
|
+
t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && (l.length > 0 && h.length === 0 && this.#V(), this.#H(g.STRICT_REJECT, {
|
|
2214
2243
|
source: "paste",
|
|
2215
2244
|
rejectedInput: c,
|
|
2216
2245
|
reason: v
|
|
2217
|
-
});
|
|
2246
|
+
}));
|
|
2218
2247
|
};
|
|
2219
|
-
#
|
|
2248
|
+
#B(e) {
|
|
2220
2249
|
let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
|
|
2221
2250
|
return t && e.length > t ? e.substring(0, t) : e;
|
|
2222
2251
|
}
|
|
2223
|
-
#
|
|
2252
|
+
#V() {
|
|
2253
|
+
if (!this.#t.strictRejectAnimation) return;
|
|
2254
|
+
let e = this.#e.telInputEl.parentElement;
|
|
2255
|
+
e && (e.classList.remove("iti__strict-reject-animation"), e.offsetWidth, e.classList.add("iti__strict-reject-animation"));
|
|
2256
|
+
}
|
|
2257
|
+
#H(e, t = {}) {
|
|
2224
2258
|
let n = new CustomEvent(e, {
|
|
2225
2259
|
bubbles: !0,
|
|
2226
2260
|
cancelable: !0,
|
|
@@ -2228,43 +2262,43 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2228
2262
|
});
|
|
2229
2263
|
this.#e.telInputEl.dispatchEvent(n);
|
|
2230
2264
|
}
|
|
2231
|
-
#
|
|
2232
|
-
this.#e.openDropdown((e) => this.#
|
|
2265
|
+
#U() {
|
|
2266
|
+
this.#e.openDropdown((e) => this.#Q(e), () => this.#$()), this.#H(g.OPEN_COUNTRY_DROPDOWN);
|
|
2233
2267
|
}
|
|
2234
|
-
#
|
|
2268
|
+
#W(e) {
|
|
2235
2269
|
let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
|
|
2236
|
-
if (t && Q.utils && this.#
|
|
2237
|
-
let t =
|
|
2238
|
-
i = Q.utils.formatNumber(i, this.#
|
|
2270
|
+
if (t && Q.utils && this.#l) {
|
|
2271
|
+
let t = Y(e), a = n && !t || !i.startsWith("+") && !r, { NATIONAL: o, INTERNATIONAL: s } = Q.utils.numberFormat, c = a ? o : s;
|
|
2272
|
+
i = Q.utils.formatNumber(i, this.#l?.iso2, c);
|
|
2239
2273
|
}
|
|
2240
|
-
i = this.#
|
|
2274
|
+
i = this.#ie(i), this.#y(i);
|
|
2241
2275
|
}
|
|
2242
|
-
#
|
|
2243
|
-
let t = this.#
|
|
2244
|
-
return t === null ? !1 : this.#
|
|
2276
|
+
#G(e) {
|
|
2277
|
+
let t = this.#q(e);
|
|
2278
|
+
return t === null ? !1 : this.#Y(t);
|
|
2245
2279
|
}
|
|
2246
|
-
#
|
|
2247
|
-
let t = this.#
|
|
2280
|
+
#K(e) {
|
|
2281
|
+
let t = this.#l?.dialCode, n = this.#l?.nationalPrefix;
|
|
2248
2282
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2249
2283
|
}
|
|
2250
|
-
#
|
|
2251
|
-
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#
|
|
2252
|
-
n = this.#
|
|
2253
|
-
let i = this
|
|
2284
|
+
#q(e) {
|
|
2285
|
+
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
|
|
2286
|
+
n = this.#K(n);
|
|
2287
|
+
let i = this.#te(n, !0), a = H(n);
|
|
2254
2288
|
if (i) {
|
|
2255
|
-
let e =
|
|
2256
|
-
return t.length === 1 ? t[0] === r ? null : t[0] : this.#
|
|
2289
|
+
let e = H(i), t = this.#a[e];
|
|
2290
|
+
return t.length === 1 ? t[0] === r ? null : t[0] : this.#J(t, e, a);
|
|
2257
2291
|
} else if (n.startsWith("+") && a.length) {
|
|
2258
|
-
let e = this.#
|
|
2292
|
+
let e = this.#l?.dialCode || "";
|
|
2259
2293
|
return e && e.startsWith(a) ? null : "";
|
|
2260
|
-
} else if ((!n || n === "+") && !r && this.#
|
|
2294
|
+
} else if ((!n || n === "+") && !r && this.#d) return this.#d;
|
|
2261
2295
|
return null;
|
|
2262
2296
|
}
|
|
2263
|
-
#
|
|
2264
|
-
let r = this.#
|
|
2265
|
-
if (!r && this.#
|
|
2266
|
-
if (i === w.NANP &&
|
|
2267
|
-
let a = this.#
|
|
2297
|
+
#J(e, t, n) {
|
|
2298
|
+
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2299
|
+
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2300
|
+
if (i === w.NANP && be(n)) return null;
|
|
2301
|
+
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2268
2302
|
if (a) {
|
|
2269
2303
|
let e = a.map((e) => `${i}${e}`);
|
|
2270
2304
|
for (let t of e) if (n.startsWith(t)) return null;
|
|
@@ -2272,50 +2306,50 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2272
2306
|
let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
|
|
2273
2307
|
return !c && !l ? e[0] : null;
|
|
2274
2308
|
}
|
|
2275
|
-
#
|
|
2276
|
-
let t = this.#
|
|
2277
|
-
return this.#
|
|
2309
|
+
#Y(e) {
|
|
2310
|
+
let t = this.#l?.iso2 || "";
|
|
2311
|
+
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setCountry(this.#l), this.#Z(), this.#X(), t !== e;
|
|
2278
2312
|
}
|
|
2279
|
-
#
|
|
2313
|
+
#X() {
|
|
2280
2314
|
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2281
2315
|
if (!e || !Q.utils) return;
|
|
2282
|
-
let r = this.#
|
|
2316
|
+
let r = this.#l?.iso2;
|
|
2283
2317
|
if (!r) {
|
|
2284
|
-
this.#
|
|
2318
|
+
this.#u = null;
|
|
2285
2319
|
return;
|
|
2286
2320
|
}
|
|
2287
2321
|
let i = Q.utils.numberType[t], a = Q.utils.getExampleNumber(r, !1, i, !0), o = a;
|
|
2288
2322
|
for (; Q.utils.isPossibleNumber(a, r, n);) o = a, a += "0";
|
|
2289
2323
|
let s = Q.utils.getCoreNumber(o, r);
|
|
2290
|
-
this.#
|
|
2324
|
+
this.#u = s.length, r === "by" && (this.#u = s.length + 1);
|
|
2291
2325
|
}
|
|
2292
|
-
#
|
|
2326
|
+
#Z() {
|
|
2293
2327
|
let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === D.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === D.POLITE;
|
|
2294
2328
|
if (!Q.utils || !i) return;
|
|
2295
|
-
let a = Q.utils.numberType[t], o = this.#
|
|
2296
|
-
o = this.#
|
|
2329
|
+
let a = Q.utils.numberType[t], o = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, n, a) : "";
|
|
2330
|
+
o = this.#ie(o), typeof r == "function" && (o = r(o, this.#l)), this.#e.telInputEl.setAttribute("placeholder", o);
|
|
2297
2331
|
}
|
|
2298
|
-
#
|
|
2332
|
+
#Q(e) {
|
|
2299
2333
|
if (!e) return;
|
|
2300
|
-
let t = e.dataset[A.ISO2], n = this.#
|
|
2301
|
-
this
|
|
2334
|
+
let t = e.dataset[A.ISO2], n = this.#Y(t);
|
|
2335
|
+
this.#$();
|
|
2302
2336
|
let r = e.dataset[A.DIAL_CODE];
|
|
2303
|
-
if (this.#
|
|
2304
|
-
let e = this.#
|
|
2305
|
-
this.#
|
|
2337
|
+
if (this.#ee(r), this.#t.formatOnDisplay) {
|
|
2338
|
+
let e = this.#v();
|
|
2339
|
+
this.#W(e);
|
|
2306
2340
|
}
|
|
2307
|
-
this.#e.telInputEl.focus(), n && (this.#
|
|
2341
|
+
this.#e.telInputEl.focus(), n && (this.#oe(), this.#H(g.INPUT, { isCountryChange: !0 }));
|
|
2308
2342
|
}
|
|
2309
|
-
|
|
2310
|
-
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#
|
|
2343
|
+
#$(e) {
|
|
2344
|
+
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#H(g.CLOSE_COUNTRY_DROPDOWN));
|
|
2311
2345
|
}
|
|
2312
|
-
#
|
|
2313
|
-
let t = this.#
|
|
2346
|
+
#ee(e) {
|
|
2347
|
+
let t = this.#v();
|
|
2314
2348
|
if (!t.startsWith("+")) return;
|
|
2315
|
-
let n = `+${e}`, r = this
|
|
2316
|
-
i = r ? t.replace(r, n) : n, this.#
|
|
2349
|
+
let n = `+${e}`, r = this.#te(t), i;
|
|
2350
|
+
i = r ? t.replace(r, n) : n, this.#y(i);
|
|
2317
2351
|
}
|
|
2318
|
-
|
|
2352
|
+
#te(e, t) {
|
|
2319
2353
|
if (!e.startsWith("+")) return "";
|
|
2320
2354
|
let n = "", r = "", i = !1;
|
|
2321
2355
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -2330,20 +2364,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2330
2364
|
}
|
|
2331
2365
|
return n;
|
|
2332
2366
|
}
|
|
2333
|
-
#
|
|
2334
|
-
let t = this.#
|
|
2367
|
+
#ne(e) {
|
|
2368
|
+
let t = this.#l?.dialCode, n = H(e);
|
|
2335
2369
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2336
2370
|
}
|
|
2337
|
-
#
|
|
2338
|
-
let e = this.#
|
|
2339
|
-
return this.#
|
|
2371
|
+
#re() {
|
|
2372
|
+
let e = this.#v();
|
|
2373
|
+
return this.#ne(e);
|
|
2340
2374
|
}
|
|
2341
|
-
#
|
|
2342
|
-
let t =
|
|
2343
|
-
return this.#
|
|
2375
|
+
#ie(e) {
|
|
2376
|
+
let t = ge(e, !!this.#te(e), this.#t.separateDialCode, this.#l);
|
|
2377
|
+
return this.#B(t);
|
|
2344
2378
|
}
|
|
2345
|
-
#
|
|
2346
|
-
let e = this.#
|
|
2379
|
+
#ae() {
|
|
2380
|
+
let e = this.#l;
|
|
2347
2381
|
if (!e) return null;
|
|
2348
2382
|
let { iso2: t, dialCode: n, name: r } = e;
|
|
2349
2383
|
return {
|
|
@@ -2352,134 +2386,134 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2352
2386
|
name: r
|
|
2353
2387
|
};
|
|
2354
2388
|
}
|
|
2355
|
-
#
|
|
2356
|
-
let e = this.#
|
|
2357
|
-
this.#
|
|
2389
|
+
#oe() {
|
|
2390
|
+
let e = this.#ae();
|
|
2391
|
+
this.#H(g.COUNTRY_CHANGE, e);
|
|
2358
2392
|
}
|
|
2359
|
-
#
|
|
2360
|
-
if (!(!this.#
|
|
2361
|
-
if (!this.#
|
|
2362
|
-
this.#
|
|
2393
|
+
#se() {
|
|
2394
|
+
if (!(!this.#g || !Q.autoCountry)) {
|
|
2395
|
+
if (!this.#f) {
|
|
2396
|
+
this.#g.resolve();
|
|
2363
2397
|
return;
|
|
2364
2398
|
}
|
|
2365
|
-
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#
|
|
2399
|
+
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#g.resolve();
|
|
2366
2400
|
}
|
|
2367
2401
|
}
|
|
2368
|
-
#
|
|
2369
|
-
if (!this.#
|
|
2370
|
-
this.#
|
|
2402
|
+
#ce() {
|
|
2403
|
+
if (!this.#f) {
|
|
2404
|
+
this.#g?.reject();
|
|
2371
2405
|
return;
|
|
2372
2406
|
}
|
|
2373
|
-
this.#
|
|
2407
|
+
this.#C(!0), this.#e.setLoading(!1), this.#g?.reject();
|
|
2374
2408
|
}
|
|
2375
|
-
#
|
|
2376
|
-
if (!this.#
|
|
2377
|
-
this.#
|
|
2409
|
+
#le() {
|
|
2410
|
+
if (!this.#f) {
|
|
2411
|
+
this.#_?.resolve();
|
|
2378
2412
|
return;
|
|
2379
2413
|
}
|
|
2380
2414
|
if (!Q.utils) {
|
|
2381
|
-
this.#
|
|
2415
|
+
this.#_?.resolve();
|
|
2382
2416
|
return;
|
|
2383
2417
|
}
|
|
2384
|
-
let e = this.#
|
|
2385
|
-
e && this.#
|
|
2418
|
+
let e = this.#v();
|
|
2419
|
+
e && this.#W(e), this.#l && (this.#Z(), this.#X()), this.#_?.resolve();
|
|
2386
2420
|
}
|
|
2387
|
-
#
|
|
2388
|
-
if (!this.#
|
|
2389
|
-
this.#
|
|
2421
|
+
#ue(e) {
|
|
2422
|
+
if (!this.#f) {
|
|
2423
|
+
this.#_?.reject(e);
|
|
2390
2424
|
return;
|
|
2391
2425
|
}
|
|
2392
|
-
this.#
|
|
2426
|
+
this.#_?.reject(e);
|
|
2393
2427
|
}
|
|
2394
2428
|
destroy() {
|
|
2395
|
-
this.#
|
|
2429
|
+
this.#f && (this.#f = !1, this.#t.allowDropdown && this.#$(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2396
2430
|
}
|
|
2397
2431
|
isActive() {
|
|
2398
|
-
return this.#
|
|
2432
|
+
return this.#f;
|
|
2399
2433
|
}
|
|
2400
2434
|
getExtension() {
|
|
2401
|
-
return this.#
|
|
2435
|
+
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#re(), this.#l?.iso2)) : "";
|
|
2402
2436
|
}
|
|
2403
2437
|
getNumber(e) {
|
|
2404
|
-
if (!this.#
|
|
2438
|
+
if (!this.#f) return "";
|
|
2405
2439
|
X("getNumber");
|
|
2406
|
-
let t = this.#
|
|
2407
|
-
return this.#
|
|
2440
|
+
let t = this.#l?.iso2, n = this.#re(), r = Q.utils.formatNumber(n, t, e);
|
|
2441
|
+
return this.#m.denormalise(r);
|
|
2408
2442
|
}
|
|
2409
2443
|
getNumberType() {
|
|
2410
|
-
return this.#
|
|
2444
|
+
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#re(), this.#l?.iso2)) : S.UNKNOWN_NUMBER_TYPE;
|
|
2411
2445
|
}
|
|
2412
2446
|
getSelectedCountryData() {
|
|
2413
|
-
return this.#
|
|
2447
|
+
return this.#ae();
|
|
2414
2448
|
}
|
|
2415
2449
|
getValidationError() {
|
|
2416
|
-
if (!this.#
|
|
2450
|
+
if (!this.#f) return S.UNKNOWN_VALIDATION_ERROR;
|
|
2417
2451
|
X("getValidationError");
|
|
2418
|
-
let e = this.#
|
|
2419
|
-
return Q.utils.getValidationError(this.#
|
|
2452
|
+
let e = this.#l?.iso2;
|
|
2453
|
+
return Q.utils.getValidationError(this.#re(), e);
|
|
2420
2454
|
}
|
|
2421
2455
|
isValidNumber() {
|
|
2422
|
-
if (!this.#
|
|
2456
|
+
if (!this.#f) return null;
|
|
2423
2457
|
X("isValidNumber");
|
|
2424
|
-
let e = this.#
|
|
2458
|
+
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#re(), r = Q.utils.getCoreNumber(n, t);
|
|
2425
2459
|
if (r) {
|
|
2426
2460
|
if (e === T.DIAL_CODE && r[0] === T.MOBILE_PREFIX && r.length !== T.MOBILE_CORE_LENGTH) return !1;
|
|
2427
2461
|
if (!b.ALPHA_UNICODE.test(n) && e) {
|
|
2428
|
-
let t =
|
|
2462
|
+
let t = H(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
|
|
2429
2463
|
if (r.length > t) return !1;
|
|
2430
2464
|
}
|
|
2431
2465
|
}
|
|
2432
|
-
return this.#
|
|
2466
|
+
return this.#de("possible");
|
|
2433
2467
|
}
|
|
2434
2468
|
isValidNumberPrecise() {
|
|
2435
|
-
return this.#
|
|
2469
|
+
return this.#f ? (X("isValidNumberPrecise"), this.#de("precise")) : null;
|
|
2436
2470
|
}
|
|
2437
|
-
#
|
|
2438
|
-
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#
|
|
2439
|
-
return !this.#
|
|
2471
|
+
#de(e) {
|
|
2472
|
+
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#re();
|
|
2473
|
+
return !this.#l && !Y(a) || !(e === "precise" ? Q.utils.isValidNumber : Q.utils.isPossibleNumber)(a, i, r) ? !1 : b.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2440
2474
|
}
|
|
2441
2475
|
setCountry(e) {
|
|
2442
|
-
if (!this.#
|
|
2476
|
+
if (!this.#f) return;
|
|
2443
2477
|
let t = e?.toLowerCase();
|
|
2444
2478
|
if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
|
|
2445
|
-
let n = this.#
|
|
2479
|
+
let n = this.#l?.iso2;
|
|
2446
2480
|
if (e && t !== n || !e && n) {
|
|
2447
|
-
if (this.#
|
|
2448
|
-
let e = this.#
|
|
2449
|
-
this.#
|
|
2481
|
+
if (this.#Y(t), this.#ee(this.#l?.dialCode || ""), this.#t.formatOnDisplay) {
|
|
2482
|
+
let e = this.#v();
|
|
2483
|
+
this.#W(e);
|
|
2450
2484
|
}
|
|
2451
|
-
this.#
|
|
2485
|
+
this.#oe(), this.#H(g.INPUT, { isCountryChange: !0 });
|
|
2452
2486
|
}
|
|
2453
2487
|
}
|
|
2454
2488
|
setNumber(e) {
|
|
2455
|
-
if (!this.#
|
|
2456
|
-
let t = this.#
|
|
2457
|
-
this.#
|
|
2489
|
+
if (!this.#f) return;
|
|
2490
|
+
let t = this.#m.normalise(e), n = this.#G(t);
|
|
2491
|
+
this.#W(t), n && this.#oe(), this.#H(g.INPUT, { isSetNumber: !0 });
|
|
2458
2492
|
}
|
|
2459
2493
|
setPlaceholderNumberType(e) {
|
|
2460
|
-
this.#
|
|
2494
|
+
this.#f && (this.#t.placeholderNumberType = e, this.#Z());
|
|
2461
2495
|
}
|
|
2462
2496
|
setDisabled(e) {
|
|
2463
|
-
this.#
|
|
2497
|
+
this.#f && this.#e.setDisabled(e);
|
|
2464
2498
|
}
|
|
2465
2499
|
setReadonly(e) {
|
|
2466
|
-
this.#
|
|
2500
|
+
this.#f && this.#e.setReadonly(e);
|
|
2467
2501
|
}
|
|
2468
2502
|
static forEachInstance(t, ...n) {
|
|
2469
2503
|
let r = [...Q.instances.values()], i = n[0];
|
|
2470
2504
|
r.forEach((n) => {
|
|
2471
2505
|
if (n instanceof e) switch (t) {
|
|
2472
2506
|
case "handleUtilsLoaded":
|
|
2473
|
-
n.#
|
|
2507
|
+
n.#le();
|
|
2474
2508
|
break;
|
|
2475
2509
|
case "handleUtilsFailure":
|
|
2476
|
-
n.#
|
|
2510
|
+
n.#ue(i);
|
|
2477
2511
|
break;
|
|
2478
2512
|
case "handleAutoCountryLoaded":
|
|
2479
|
-
n.#
|
|
2513
|
+
n.#se();
|
|
2480
2514
|
break;
|
|
2481
2515
|
case "handleAutoCountryFailure":
|
|
2482
|
-
n.#
|
|
2516
|
+
n.#ce();
|
|
2483
2517
|
break;
|
|
2484
2518
|
}
|
|
2485
2519
|
});
|
|
@@ -2517,7 +2551,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2517
2551
|
},
|
|
2518
2552
|
startedLoadingUtils: !1,
|
|
2519
2553
|
startedLoadingAutoCountry: !1,
|
|
2520
|
-
version: "27.
|
|
2554
|
+
version: "27.3.1"
|
|
2521
2555
|
}), $ = Q, Ce = /* @__PURE__ */ n({
|
|
2522
2556
|
inheritAttrs: !1,
|
|
2523
2557
|
__name: "IntlTelInput",
|
|
@@ -2563,6 +2597,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2563
2597
|
placeholderNumberType: {},
|
|
2564
2598
|
searchInputClass: {},
|
|
2565
2599
|
separateDialCode: { type: Boolean },
|
|
2600
|
+
strictRejectAnimation: { type: Boolean },
|
|
2566
2601
|
showFlags: { type: Boolean },
|
|
2567
2602
|
strictMode: { type: Boolean },
|
|
2568
2603
|
useFullscreenPopup: { type: Boolean }
|
|
@@ -2587,61 +2622,61 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2587
2622
|
"readonly",
|
|
2588
2623
|
"onInput",
|
|
2589
2624
|
"oninput"
|
|
2590
|
-
]), _ = e(() => {
|
|
2625
|
+
]), _ = c(""), v = e(() => {
|
|
2591
2626
|
let e = p.inputProps ?? {}, t = {};
|
|
2592
|
-
for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : t[n] = r;
|
|
2627
|
+
for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : n === "class" ? t[n] = `${_.value} ${r}` : t[n] = r;
|
|
2593
2628
|
return t;
|
|
2594
|
-
}),
|
|
2595
|
-
let e =
|
|
2596
|
-
return
|
|
2629
|
+
}), y = e(() => p.modelValue ?? p.initialValue ?? ""), b = r(), x = Object.keys($.defaults), S = e(() => {
|
|
2630
|
+
let e = b?.vnode.props ?? {}, t = new Set(Object.keys(e).map((e) => e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()))), n = {};
|
|
2631
|
+
return x.forEach((e) => {
|
|
2597
2632
|
if (!t.has(e)) return;
|
|
2598
2633
|
let r = p[e];
|
|
2599
2634
|
r !== void 0 && (n[e] = r);
|
|
2600
2635
|
}), n;
|
|
2601
|
-
}),
|
|
2602
|
-
if (!
|
|
2636
|
+
}), C = c(null), w = l(null), T = c(), E = c(), D = c(), O = c(), k = !1, A = () => (p.usePreciseValidation ? w.value.isValidNumberPrecise() : w.value.isValidNumber()) ?? !1, j = () => {
|
|
2637
|
+
if (!w.value?.isActive()) return;
|
|
2603
2638
|
if (!$.utils) {
|
|
2604
|
-
|
|
2639
|
+
k = !0;
|
|
2605
2640
|
return;
|
|
2606
2641
|
}
|
|
2607
|
-
let e =
|
|
2608
|
-
e !==
|
|
2609
|
-
},
|
|
2610
|
-
if (!
|
|
2642
|
+
let e = A(), t = e ? null : w.value.getValidationError();
|
|
2643
|
+
e !== D.value && (D.value = e, m("changeValidity", e)), t !== O.value && (O.value = t, m("changeErrorCode", t));
|
|
2644
|
+
}, M = () => {
|
|
2645
|
+
if (!w.value?.isActive()) return;
|
|
2611
2646
|
if (!$.utils) {
|
|
2612
|
-
|
|
2647
|
+
k = !0;
|
|
2613
2648
|
return;
|
|
2614
2649
|
}
|
|
2615
|
-
let e =
|
|
2616
|
-
e !==
|
|
2617
|
-
},
|
|
2618
|
-
if (!
|
|
2619
|
-
let e =
|
|
2620
|
-
e !==
|
|
2621
|
-
},
|
|
2650
|
+
let e = w.value.getNumber() ?? "";
|
|
2651
|
+
e !== T.value && (T.value = e, m("changeNumber", e), m("update:modelValue", e)), j();
|
|
2652
|
+
}, N = () => {
|
|
2653
|
+
if (!w.value?.isActive()) return;
|
|
2654
|
+
let e = w.value.getSelectedCountryData()?.iso2 ?? "";
|
|
2655
|
+
e !== E.value && (E.value = e, m("changeCountry", e)), M();
|
|
2656
|
+
}, P = () => m("openCountryDropdown"), F = () => m("closeCountryDropdown"), I = (e) => {
|
|
2622
2657
|
let { source: t, rejectedInput: n, reason: r } = e.detail;
|
|
2623
2658
|
m("strictReject", t, n, r);
|
|
2624
2659
|
};
|
|
2625
2660
|
return a(() => {
|
|
2626
|
-
|
|
2627
|
-
|
|
2661
|
+
C.value && (w.value = $(C.value, S.value), _.value = C.value.className, C.value.addEventListener("open:countrydropdown", P), C.value.addEventListener("close:countrydropdown", F), C.value.addEventListener("strict:reject", I), p.disabled && w.value.setDisabled(p.disabled), p.readonly && w.value.setReadonly(p.readonly), E.value = w.value.getSelectedCountryData()?.iso2 ?? "", w.value.promise.then(() => {
|
|
2662
|
+
w.value?.isActive() && (y.value && w.value.setNumber(y.value), k ? (k = !1, N()) : (T.value = w.value.getNumber() ?? "", D.value = A(), O.value = D.value ? null : w.value.getValidationError()));
|
|
2628
2663
|
}));
|
|
2629
|
-
}), u(() => p.disabled, (e) =>
|
|
2630
|
-
|
|
2631
|
-
if (!
|
|
2632
|
-
let t = e ?? "", n =
|
|
2633
|
-
document.activeElement ===
|
|
2664
|
+
}), u(() => p.disabled, (e) => w.value?.setDisabled(e)), u(() => p.readonly, (e) => w.value?.setReadonly(e)), u(() => y.value, (e) => {
|
|
2665
|
+
w.value && w.value.promise.then(() => {
|
|
2666
|
+
if (!w.value?.isActive()) return;
|
|
2667
|
+
let t = e ?? "", n = w.value.getNumber() ?? "";
|
|
2668
|
+
document.activeElement === C.value || n === t || (w.value.setNumber(t), j());
|
|
2634
2669
|
});
|
|
2635
2670
|
}, { flush: "post" }), o(() => {
|
|
2636
|
-
|
|
2671
|
+
C.value && (C.value.removeEventListener("open:countrydropdown", P), C.value.removeEventListener("close:countrydropdown", F), C.value.removeEventListener("strict:reject", I)), w.value?.destroy();
|
|
2637
2672
|
}), d({
|
|
2638
|
-
instance:
|
|
2639
|
-
input:
|
|
2640
|
-
}), (e, n) => (s(), t("input", i(
|
|
2673
|
+
instance: w,
|
|
2674
|
+
input: C
|
|
2675
|
+
}), (e, n) => (s(), t("input", i(v.value, {
|
|
2641
2676
|
ref_key: "input",
|
|
2642
|
-
ref:
|
|
2677
|
+
ref: C,
|
|
2643
2678
|
type: "tel",
|
|
2644
|
-
onInput:
|
|
2679
|
+
onInput: N
|
|
2645
2680
|
}), null, 16));
|
|
2646
2681
|
}
|
|
2647
2682
|
});
|