@intl-tel-input/vue 29.4.1 → 29.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1211,6 +1211,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1211
1211
|
"selectedDialCode",
|
|
1212
1212
|
"countrySelector",
|
|
1213
1213
|
"countrySelectorContainer",
|
|
1214
|
+
"closeButton",
|
|
1214
1215
|
"searchWrapper",
|
|
1215
1216
|
"searchIcon",
|
|
1216
1217
|
"searchInput",
|
|
@@ -1323,6 +1324,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1323
1324
|
countryListAriaLabel: "List of countries",
|
|
1324
1325
|
searchPlaceholder: "Search",
|
|
1325
1326
|
clearSearchAriaLabel: "Clear search",
|
|
1327
|
+
closeCountrySelectorAriaLabel: "Close",
|
|
1326
1328
|
searchEmptyState: "No results found",
|
|
1327
1329
|
searchSummaryAria(e) {
|
|
1328
1330
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
@@ -1604,6 +1606,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1604
1606
|
}]]
|
|
1605
1607
|
]);
|
|
1606
1608
|
}, _e = () => q([
|
|
1609
|
+
"svg",
|
|
1610
|
+
{
|
|
1611
|
+
class: "iti__close-button-svg",
|
|
1612
|
+
width: 20,
|
|
1613
|
+
height: 20,
|
|
1614
|
+
viewBox: "0 0 16 16",
|
|
1615
|
+
focusable: "false",
|
|
1616
|
+
[R.HIDDEN]: "true"
|
|
1617
|
+
},
|
|
1618
|
+
[["path", { d: "M3 3 L13 13 M13 3 L3 13" }]]
|
|
1619
|
+
]), ve = () => q([
|
|
1607
1620
|
"svg",
|
|
1608
1621
|
{
|
|
1609
1622
|
class: "iti__country-check-svg",
|
|
@@ -1615,7 +1628,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1615
1628
|
[R.HIDDEN]: "true"
|
|
1616
1629
|
},
|
|
1617
1630
|
[["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" }]]
|
|
1618
|
-
]),
|
|
1631
|
+
]), ye = () => q([
|
|
1619
1632
|
"svg",
|
|
1620
1633
|
{
|
|
1621
1634
|
width: 256,
|
|
@@ -1624,10 +1637,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1624
1637
|
class: "iti__globe-svg"
|
|
1625
1638
|
},
|
|
1626
1639
|
[["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" }], ["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" }]]
|
|
1627
|
-
]),
|
|
1640
|
+
]), J = (e) => fe(e).replace(/[^\p{L}]+/gu, " ").trim(), be = (e) => {
|
|
1628
1641
|
let t = /* @__PURE__ */ new Map();
|
|
1629
1642
|
for (let n of e) {
|
|
1630
|
-
let e =
|
|
1643
|
+
let e = J(n.name), r = e.split(" ").filter(Boolean), i = r.map((e) => e[0] || "").join("");
|
|
1631
1644
|
t.set(n.iso2, {
|
|
1632
1645
|
normalisedName: e,
|
|
1633
1646
|
words: r,
|
|
@@ -1636,8 +1649,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1636
1649
|
});
|
|
1637
1650
|
}
|
|
1638
1651
|
return t;
|
|
1639
|
-
},
|
|
1640
|
-
let r = fe(n), i =
|
|
1652
|
+
}, xe = (e, t, n) => {
|
|
1653
|
+
let r = fe(n), i = J(n), a = r !== "" && i === "", o = [], s = [], c = [], l = [], u = [], d = [], f = [];
|
|
1641
1654
|
for (let n of e) {
|
|
1642
1655
|
let e = t.get(n.iso2);
|
|
1643
1656
|
n.iso2 === r ? o.push(n) : !a && e.normalisedName.startsWith(i) ? s.push(n) : !a && e.normalisedName.includes(i) ? c.push(n) : r === n.dialCode || r === e.dialCodePlus ? l.push(n) : e.dialCodePlus.includes(r) ? u.push(n) : e.initials.includes(r) && d.push(n);
|
|
@@ -1665,14 +1678,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1665
1678
|
...d,
|
|
1666
1679
|
...f
|
|
1667
1680
|
];
|
|
1668
|
-
},
|
|
1669
|
-
let r =
|
|
1681
|
+
}, Se = (e, t, n) => {
|
|
1682
|
+
let r = J(n);
|
|
1670
1683
|
for (let n of e) {
|
|
1671
1684
|
let { normalisedName: e } = t.get(n.iso2);
|
|
1672
1685
|
if (e.startsWith(r)) return n;
|
|
1673
1686
|
}
|
|
1674
1687
|
return null;
|
|
1675
|
-
},
|
|
1688
|
+
}, Ce = class e {
|
|
1676
1689
|
#e;
|
|
1677
1690
|
static toAscii(e) {
|
|
1678
1691
|
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
@@ -1694,7 +1707,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1694
1707
|
isAscii() {
|
|
1695
1708
|
return !this.#e || this.#e === "ascii";
|
|
1696
1709
|
}
|
|
1697
|
-
},
|
|
1710
|
+
}, we = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --x"), Te = class {
|
|
1698
1711
|
#e;
|
|
1699
1712
|
#t;
|
|
1700
1713
|
#n;
|
|
@@ -1719,11 +1732,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1719
1732
|
#x;
|
|
1720
1733
|
#S;
|
|
1721
1734
|
#C;
|
|
1722
|
-
#w
|
|
1735
|
+
#w;
|
|
1723
1736
|
#T = null;
|
|
1724
|
-
#E =
|
|
1725
|
-
#D =
|
|
1726
|
-
#O;
|
|
1737
|
+
#E = null;
|
|
1738
|
+
#D = /* @__PURE__ */ new Map();
|
|
1739
|
+
#O = null;
|
|
1740
|
+
#k;
|
|
1727
1741
|
telInputEl;
|
|
1728
1742
|
hadInitialPlaceholder;
|
|
1729
1743
|
constructor(e, t, n) {
|
|
@@ -1736,16 +1750,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1736
1750
|
throw TypeError(`The first argument must be an HTMLInputElement, not ${t}`);
|
|
1737
1751
|
}
|
|
1738
1752
|
}
|
|
1739
|
-
#
|
|
1753
|
+
#A(e, t) {
|
|
1740
1754
|
let n = this.#e.classNames[e];
|
|
1741
1755
|
return n ? `${t} ${n}` : t;
|
|
1742
1756
|
}
|
|
1743
1757
|
buildMarkup(e, t) {
|
|
1744
|
-
this.#i = e, this.#a = t, this.telInputEl.classList.add(...this.#
|
|
1745
|
-
let n = this.#
|
|
1746
|
-
this.#
|
|
1758
|
+
this.#i = e, this.#a = t, this.telInputEl.classList.add(...this.#A("input", "iti__tel-input").split(" ")), 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");
|
|
1759
|
+
let n = this.#j();
|
|
1760
|
+
this.#M(n), n.appendChild(this.telInputEl), this.#L(), this.#V(), this.#R(n), this.ensureDropdownWidthSet();
|
|
1747
1761
|
}
|
|
1748
|
-
#
|
|
1762
|
+
#j() {
|
|
1749
1763
|
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r = pe({
|
|
1750
1764
|
iti: !0,
|
|
1751
1765
|
"iti--input-container": !0,
|
|
@@ -1753,25 +1767,25 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1753
1767
|
"iti--show-flags": t,
|
|
1754
1768
|
"iti--inline-country-selector": e !== I.FULLSCREEN,
|
|
1755
1769
|
[n]: !!n
|
|
1756
|
-
}), i = K("div", { class: this.#
|
|
1770
|
+
}), i = K("div", { class: this.#A("container", r) });
|
|
1757
1771
|
return this.#n && i.setAttribute("dir", "ltr"), this.telInputEl.before(i), i;
|
|
1758
1772
|
}
|
|
1759
|
-
#
|
|
1773
|
+
#M(e) {
|
|
1760
1774
|
let { countrySelectorMode: t, separateDialCode: n, showFlags: r } = this.#e, i = t !== I.OFF;
|
|
1761
1775
|
if (!i && !r && !n) return;
|
|
1762
|
-
this.#l = K("div", { class: this.#
|
|
1776
|
+
this.#l = K("div", { class: this.#A("countryContainer", `iti__country-container ${v.V_HIDE}`) }, e), i ? (this.#u = K("button", {
|
|
1763
1777
|
type: "button",
|
|
1764
|
-
class: this.#
|
|
1778
|
+
class: this.#A("selectedCountry", "iti__selected-country"),
|
|
1765
1779
|
[R.EXPANDED]: "false",
|
|
1766
1780
|
[R.LABEL]: this.#e.uiTranslations.noCountrySelected,
|
|
1767
1781
|
[R.HASPOPUP]: "dialog",
|
|
1768
1782
|
[R.CONTROLS]: `iti-${this.#t}__country-selector`
|
|
1769
|
-
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u = K("div", { class: this.#
|
|
1770
|
-
let a = K("div", { class: this.#
|
|
1771
|
-
this.#d = K("div", { class: this.#
|
|
1772
|
-
class: this.#
|
|
1783
|
+
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u = K("div", { class: this.#A("selectedCountry", "iti__selected-country") }, this.#l);
|
|
1784
|
+
let a = K("div", { class: this.#A("selectedCountryPrimary", "iti__selected-country-primary") }, this.#u);
|
|
1785
|
+
this.#d = K("div", { class: this.#A("selectedFlag", v.FLAG) }, a), i && (this.#p = K("div", {
|
|
1786
|
+
class: this.#A("arrow", "iti__arrow"),
|
|
1773
1787
|
[R.HIDDEN]: "true"
|
|
1774
|
-
}, a)), n && (this.#f = K("div", { class: this.#
|
|
1788
|
+
}, a)), n && (this.#f = K("div", { class: this.#A("selectedDialCode", "iti__selected-dial-code") }, this.#u)), i && this.#N();
|
|
1775
1789
|
}
|
|
1776
1790
|
ensureDropdownWidthSet() {
|
|
1777
1791
|
let { matchDropdownWidth: e, countrySelectorMode: t } = this.#e;
|
|
@@ -1779,19 +1793,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1779
1793
|
let n = this.telInputEl.offsetWidth;
|
|
1780
1794
|
n > 0 && (this.#m.style.width = `${n}px`);
|
|
1781
1795
|
}
|
|
1782
|
-
#
|
|
1783
|
-
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t === I.FULLSCREEN, o = this.#
|
|
1796
|
+
#N() {
|
|
1797
|
+
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t === I.FULLSCREEN, o = this.#P(), s = e ? "" : "iti--flexible-dropdown-width";
|
|
1784
1798
|
if (this.#m = K("div", {
|
|
1785
1799
|
id: `iti-${this.#t}__country-selector`,
|
|
1786
|
-
class: this.#
|
|
1800
|
+
class: this.#A("countrySelector", `iti__country-selector ${v.HIDE} ${s}`),
|
|
1787
1801
|
role: "dialog",
|
|
1788
1802
|
[R.MODAL]: "true"
|
|
1789
|
-
}), this.#n && this.#m.setAttribute("dir", "rtl"), n && this.#
|
|
1790
|
-
class: this.#
|
|
1803
|
+
}), this.#n && this.#m.setAttribute("dir", "rtl"), a && this.#F(), n && this.#I(), this.#y = K("ul", {
|
|
1804
|
+
class: this.#A("countryList", "iti__country-list"),
|
|
1791
1805
|
id: `iti-${this.#t}__country-listbox`,
|
|
1792
1806
|
role: "listbox",
|
|
1793
1807
|
[R.LABEL]: r.countryListAriaLabel
|
|
1794
|
-
}, this.#m), n || this.#
|
|
1808
|
+
}, this.#m), n || this.#y.setAttribute("tabindex", "0"), this.#z(), n && this.#G(), o) {
|
|
1795
1809
|
let e = pe({
|
|
1796
1810
|
iti: !0,
|
|
1797
1811
|
"iti--detached-country-selector": !0,
|
|
@@ -1799,22 +1813,30 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1799
1813
|
"iti--inline-country-selector": !a,
|
|
1800
1814
|
[i]: !!i
|
|
1801
1815
|
});
|
|
1802
|
-
this.#
|
|
1816
|
+
this.#w = K("div", { class: this.#A("countrySelectorContainer", e) }), this.#w.appendChild(this.#m);
|
|
1803
1817
|
} else this.#l.appendChild(this.#m);
|
|
1804
1818
|
}
|
|
1805
|
-
#
|
|
1819
|
+
#P() {
|
|
1806
1820
|
let { countrySelectorMode: e, dropdownParent: t, fullscreenParent: n } = this.#e;
|
|
1807
1821
|
return e === I.FULLSCREEN ? n ?? document.body : e === I.DROPDOWN ? t : null;
|
|
1808
1822
|
}
|
|
1809
|
-
#
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
class: this.#
|
|
1823
|
+
#F() {
|
|
1824
|
+
this.#h = K("button", {
|
|
1825
|
+
type: "button",
|
|
1826
|
+
class: this.#A("closeButton", "iti__close-button"),
|
|
1827
|
+
[R.LABEL]: this.#e.uiTranslations.closeCountrySelectorAriaLabel,
|
|
1828
|
+
tabindex: "-1"
|
|
1829
|
+
}, this.#m), this.#h.appendChild(_e());
|
|
1830
|
+
}
|
|
1831
|
+
#I() {
|
|
1832
|
+
let { uiTranslations: e, searchInputClass: t } = this.#e, n = K("div", { class: this.#A("searchWrapper", "iti__search-input-wrapper") }, this.#m);
|
|
1833
|
+
this.#g = K("span", {
|
|
1834
|
+
class: this.#A("searchIcon", "iti__search-icon"),
|
|
1813
1835
|
[R.HIDDEN]: "true"
|
|
1814
|
-
}, n), this.#
|
|
1836
|
+
}, n), this.#g.appendChild(he()), this.#_ = K("input", {
|
|
1815
1837
|
id: `iti-${this.#t}__search-input`,
|
|
1816
1838
|
type: "search",
|
|
1817
|
-
class: this.#
|
|
1839
|
+
class: this.#A("searchInput", `iti__search-input ${t}`),
|
|
1818
1840
|
placeholder: e.searchPlaceholder,
|
|
1819
1841
|
role: "combobox",
|
|
1820
1842
|
[R.EXPANDED]: "true",
|
|
@@ -1822,40 +1844,40 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1822
1844
|
[R.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1823
1845
|
[R.AUTOCOMPLETE]: "list",
|
|
1824
1846
|
autocomplete: "off"
|
|
1825
|
-
}, n), this.#
|
|
1847
|
+
}, n), this.#v = K("button", {
|
|
1826
1848
|
type: "button",
|
|
1827
|
-
class: this.#
|
|
1849
|
+
class: this.#A("searchClear", `iti__search-clear ${v.HIDE}`),
|
|
1828
1850
|
[R.LABEL]: e.clearSearchAriaLabel,
|
|
1829
1851
|
tabindex: "-1"
|
|
1830
|
-
}, n), this.#
|
|
1831
|
-
class: this.#
|
|
1852
|
+
}, n), this.#v.appendChild(ge(this.#t)), this.#C = K("span", { class: "iti__a11y-text" }, this.#m), this.#S = K("div", {
|
|
1853
|
+
class: this.#A("noResults", `iti__no-results ${v.HIDE}`),
|
|
1832
1854
|
[R.HIDDEN]: "true"
|
|
1833
|
-
}, this.#m), this.#
|
|
1855
|
+
}, this.#m), this.#S.textContent = e.searchEmptyState ?? null;
|
|
1834
1856
|
}
|
|
1835
|
-
#
|
|
1836
|
-
this.#l && (this.#
|
|
1857
|
+
#L() {
|
|
1858
|
+
this.#l && (this.#B(), this.#l.classList.remove(v.V_HIDE));
|
|
1837
1859
|
}
|
|
1838
|
-
#
|
|
1860
|
+
#R(e) {
|
|
1839
1861
|
let { hiddenInputs: t } = this.#e;
|
|
1840
1862
|
if (!t) return;
|
|
1841
1863
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
1842
1864
|
if (n.phone) {
|
|
1843
1865
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.phone}"]`);
|
|
1844
|
-
t ? this.#
|
|
1866
|
+
t ? this.#b = t : (this.#b = K("input", {
|
|
1845
1867
|
type: "hidden",
|
|
1846
1868
|
name: n.phone
|
|
1847
|
-
}), e.appendChild(this.#
|
|
1869
|
+
}), e.appendChild(this.#b));
|
|
1848
1870
|
}
|
|
1849
1871
|
if (n.country) {
|
|
1850
1872
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.country}"]`);
|
|
1851
|
-
t ? this.#
|
|
1873
|
+
t ? this.#x = t : (this.#x = K("input", {
|
|
1852
1874
|
type: "hidden",
|
|
1853
1875
|
name: n.country
|
|
1854
|
-
}), e.appendChild(this.#
|
|
1876
|
+
}), e.appendChild(this.#x));
|
|
1855
1877
|
}
|
|
1856
1878
|
}
|
|
1857
|
-
#
|
|
1858
|
-
let e = document.createDocumentFragment(), t = this.#
|
|
1879
|
+
#z() {
|
|
1880
|
+
let e = document.createDocumentFragment(), t = this.#A("countryListItem", v.COUNTRY_ITEM);
|
|
1859
1881
|
for (let n = 0; n < this.#i.length; n++) {
|
|
1860
1882
|
let r = this.#i[n], i = K("li", {
|
|
1861
1883
|
id: `iti-${this.#t}__item-${r.iso2}`,
|
|
@@ -1863,26 +1885,26 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1863
1885
|
role: "option",
|
|
1864
1886
|
[R.SELECTED]: "false"
|
|
1865
1887
|
});
|
|
1866
|
-
i.dataset[L.DIAL_CODE] = r.dialCode, i.dataset[L.ISO2] = r.iso2, this.#
|
|
1867
|
-
let a = K("span", { class: this.#
|
|
1888
|
+
i.dataset[L.DIAL_CODE] = r.dialCode, i.dataset[L.ISO2] = r.iso2, this.#D.set(r.iso2, i), this.#e.showFlags && K("div", { class: this.#A("countryListItemFlag", `${v.FLAG} iti__${r.iso2}`) }, i);
|
|
1889
|
+
let a = K("span", { class: this.#A("countryName", "iti__country-name") }, i);
|
|
1868
1890
|
a.textContent = `${r.name} `;
|
|
1869
|
-
let o = K("span", { class: this.#
|
|
1891
|
+
let o = K("span", { class: this.#A("dialCode", "iti__dial-code") }, a);
|
|
1870
1892
|
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${r.dialCode})`, e.appendChild(i);
|
|
1871
1893
|
}
|
|
1872
|
-
this.#
|
|
1894
|
+
this.#y.appendChild(e);
|
|
1873
1895
|
}
|
|
1874
|
-
#
|
|
1896
|
+
#B() {
|
|
1875
1897
|
if (this.#u) {
|
|
1876
|
-
let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH, t = (this.#u.offsetWidth || this.#
|
|
1898
|
+
let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH, t = (this.#u.offsetWidth || this.#H() || e) + C.INPUT_PADDING_EXTRA_LEFT;
|
|
1877
1899
|
this.telInputEl.style.paddingLeft = `${t}px`;
|
|
1878
1900
|
}
|
|
1879
1901
|
}
|
|
1880
|
-
#
|
|
1881
|
-
!this.#u || typeof ResizeObserver > "u" || (this.#
|
|
1882
|
-
this.#u?.offsetWidth && this.#
|
|
1883
|
-
}), this.#
|
|
1902
|
+
#V() {
|
|
1903
|
+
!this.#u || typeof ResizeObserver > "u" || (this.#k = new ResizeObserver(() => {
|
|
1904
|
+
this.#u?.offsetWidth && this.#B();
|
|
1905
|
+
}), this.#k.observe(this.#u));
|
|
1884
1906
|
}
|
|
1885
|
-
#
|
|
1907
|
+
#H() {
|
|
1886
1908
|
if (!this.telInputEl.parentNode) return 0;
|
|
1887
1909
|
let e = document.body, t = this.telInputEl.parentNode.cloneNode(!1);
|
|
1888
1910
|
t.style.visibility = "hidden", e.appendChild(t);
|
|
@@ -1893,12 +1915,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1893
1915
|
let i = r.offsetWidth;
|
|
1894
1916
|
return e.removeChild(t), i;
|
|
1895
1917
|
}
|
|
1896
|
-
#
|
|
1918
|
+
#U() {
|
|
1897
1919
|
if (this.#s !== void 0) return;
|
|
1898
|
-
let { countrySearch: e, matchDropdownWidth: t } = this.#e, { height: n, width: r } = this.#
|
|
1920
|
+
let { countrySearch: e, matchDropdownWidth: t } = this.#e, { height: n, width: r } = this.#W();
|
|
1899
1921
|
this.#s = n, e && (this.#m.style.height = `${n}px`, !t && r > 0 && (this.#m.style.width = `${r}px`));
|
|
1900
1922
|
}
|
|
1901
|
-
#
|
|
1923
|
+
#W() {
|
|
1902
1924
|
let e = document.body, t = this.#m, n = t.parentNode, r = t.nextSibling;
|
|
1903
1925
|
t.classList.remove(v.HIDE);
|
|
1904
1926
|
let i = K("div", { class: "iti iti--inline-country-selector" });
|
|
@@ -1909,52 +1931,52 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1909
1931
|
width: o
|
|
1910
1932
|
};
|
|
1911
1933
|
}
|
|
1912
|
-
#
|
|
1913
|
-
let { uiTranslations: e } = this.#e, t = this.#
|
|
1914
|
-
this.#
|
|
1934
|
+
#G() {
|
|
1935
|
+
let { uiTranslations: e } = this.#e, t = this.#y.childElementCount;
|
|
1936
|
+
this.#C.textContent = e.searchSummaryAria(t);
|
|
1915
1937
|
}
|
|
1916
|
-
#
|
|
1938
|
+
#K(e) {
|
|
1917
1939
|
let t;
|
|
1918
1940
|
if (e === "") t = this.#i;
|
|
1919
1941
|
else {
|
|
1920
|
-
let n =
|
|
1921
|
-
t =
|
|
1942
|
+
let n = Ce.toAscii(e);
|
|
1943
|
+
t = xe(this.#i, this.#a, n);
|
|
1922
1944
|
}
|
|
1923
|
-
this.#
|
|
1945
|
+
this.#ce(t);
|
|
1924
1946
|
}
|
|
1925
1947
|
prefillSearchWithPlus() {
|
|
1926
|
-
this.#
|
|
1948
|
+
this.#_.value = "+", this.#_.focus(), this.#K("");
|
|
1927
1949
|
}
|
|
1928
|
-
#
|
|
1929
|
-
let e = this.#
|
|
1930
|
-
this.#
|
|
1950
|
+
#q() {
|
|
1951
|
+
let e = this.#_.value.trim();
|
|
1952
|
+
this.#K(e), this.#_.value ? this.#v.classList.remove(v.HIDE) : this.#v.classList.add(v.HIDE);
|
|
1931
1953
|
}
|
|
1932
|
-
#
|
|
1954
|
+
#J() {
|
|
1933
1955
|
this.#o && clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
1934
|
-
this.#
|
|
1956
|
+
this.#q(), this.#o = null;
|
|
1935
1957
|
}, S.SEARCH_DEBOUNCE_MS);
|
|
1936
1958
|
}
|
|
1937
|
-
#
|
|
1938
|
-
this.#
|
|
1959
|
+
#Y() {
|
|
1960
|
+
this.#_.value = "", this.#_.focus(), this.#q();
|
|
1939
1961
|
}
|
|
1940
|
-
#
|
|
1941
|
-
let t = this.#
|
|
1962
|
+
#X(e) {
|
|
1963
|
+
let t = this.#y, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
|
|
1942
1964
|
r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
|
|
1943
1965
|
}
|
|
1944
|
-
#
|
|
1945
|
-
return this.#e.countrySearch ? this.#
|
|
1966
|
+
#Z() {
|
|
1967
|
+
return this.#e.countrySearch ? this.#_ : this.#y;
|
|
1946
1968
|
}
|
|
1947
|
-
#
|
|
1948
|
-
if (this.#
|
|
1969
|
+
#Q(e, t = !0) {
|
|
1970
|
+
if (this.#E?.classList.remove(v.HIGHLIGHT), e) {
|
|
1949
1971
|
e.classList.add(v.HIGHLIGHT);
|
|
1950
1972
|
let n = e.getAttribute("id") || "";
|
|
1951
|
-
this.#
|
|
1952
|
-
} else this.#
|
|
1973
|
+
this.#Z().setAttribute(R.ACTIVE_DESCENDANT, n), t && this.#X(e), this.#E = e;
|
|
1974
|
+
} else this.#E = null;
|
|
1953
1975
|
}
|
|
1954
1976
|
bindHiddenInputSubmitListener(e, t, n) {
|
|
1955
1977
|
let r = this.telInputEl.form;
|
|
1956
|
-
!r || !this.#
|
|
1957
|
-
this.#
|
|
1978
|
+
!r || !this.#b && !this.#x || r.addEventListener("submit", () => {
|
|
1979
|
+
this.#b && (this.#b.value = t()), this.#x && (this.#x.value = n());
|
|
1958
1980
|
}, { signal: e });
|
|
1959
1981
|
}
|
|
1960
1982
|
bindAllInitialCountrySelectorListeners(e, t, n) {
|
|
@@ -1975,122 +1997,124 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1975
1997
|
}
|
|
1976
1998
|
openCountrySelector(e, t) {
|
|
1977
1999
|
let { dropdownAlwaysOpen: n } = this.#e;
|
|
1978
|
-
if (this.#
|
|
2000
|
+
if (this.#O = new AbortController(), this.#e.countrySelectorMode !== I.FULLSCREEN && this.#U(), this.ensureDropdownWidthSet(), this.#w) this.#ue();
|
|
1979
2001
|
else {
|
|
1980
|
-
let e = this.#
|
|
2002
|
+
let e = this.#le(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
|
|
1981
2003
|
e ? this.#m.style.top = `${t}px` : this.#m.style.bottom = `${t}px`;
|
|
1982
2004
|
}
|
|
1983
2005
|
this.#m.classList.remove(v.HIDE), this.#u.setAttribute(R.EXPANDED, "true");
|
|
1984
|
-
let r = this.#
|
|
1985
|
-
r && this.#
|
|
1986
|
-
this.#
|
|
1987
|
-
}, { signal: this.#
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
let n = this.#
|
|
1991
|
-
this.#
|
|
2006
|
+
let r = this.#T ?? this.#y.firstElementChild;
|
|
2007
|
+
r && this.#Q(r), n || this.#Z().focus(), this.#e.countrySelectorMode === I.FULLSCREEN && this.#w && window.visualViewport && (this.#fe(), window.visualViewport.addEventListener("resize", () => {
|
|
2008
|
+
this.#fe(), this.#E && this.#X(this.#E);
|
|
2009
|
+
}, { signal: this.#O.signal })), this.#p.classList.add(v.ARROW_UP), this.#$(e, t);
|
|
2010
|
+
}
|
|
2011
|
+
#$(e, t) {
|
|
2012
|
+
let n = this.#O.signal;
|
|
2013
|
+
this.#ee(n), this.#te(n, e), this.#e.dropdownAlwaysOpen || this.#ne(n, t), this.#re(n, e, t), this.#h?.addEventListener("click", () => {
|
|
2014
|
+
t(), this.#u.focus();
|
|
2015
|
+
}, { signal: n }), this.#e.countrySearch && this.#ie(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !we && document.addEventListener("scroll", t, {
|
|
1992
2016
|
signal: n,
|
|
1993
2017
|
capture: !0,
|
|
1994
2018
|
passive: !0
|
|
1995
2019
|
});
|
|
1996
2020
|
}
|
|
1997
|
-
#
|
|
1998
|
-
this.#
|
|
2021
|
+
#ee(e) {
|
|
2022
|
+
this.#y.addEventListener("mouseover", (e) => {
|
|
1999
2023
|
let t = e.target?.closest(`.${v.COUNTRY_ITEM}`);
|
|
2000
|
-
t && this.#
|
|
2024
|
+
t && this.#Q(t, !1);
|
|
2001
2025
|
}, { signal: e });
|
|
2002
2026
|
}
|
|
2003
|
-
|
|
2004
|
-
this.#
|
|
2027
|
+
#te(e, t) {
|
|
2028
|
+
this.#y.addEventListener("click", (e) => {
|
|
2005
2029
|
let n = e.target?.closest(`.${v.COUNTRY_ITEM}`);
|
|
2006
2030
|
n && t(n);
|
|
2007
2031
|
}, { signal: e });
|
|
2008
2032
|
}
|
|
2009
|
-
#
|
|
2033
|
+
#ne(e, t) {
|
|
2010
2034
|
setTimeout(() => {
|
|
2011
2035
|
document.documentElement.addEventListener("click", (e) => {
|
|
2012
2036
|
this.#m.contains(e.target) || t();
|
|
2013
2037
|
}, { signal: e });
|
|
2014
2038
|
}, 0);
|
|
2015
2039
|
}
|
|
2016
|
-
#
|
|
2040
|
+
#re(e, t, n) {
|
|
2017
2041
|
let r = "", i = null, a = (e) => {
|
|
2018
2042
|
[
|
|
2019
2043
|
y.ARROW_UP,
|
|
2020
2044
|
y.ARROW_DOWN,
|
|
2021
2045
|
y.ENTER,
|
|
2022
2046
|
y.ESC
|
|
2023
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === y.ARROW_UP || e.key === y.ARROW_DOWN ? this.#
|
|
2047
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === y.ARROW_UP || e.key === y.ARROW_DOWN ? this.#oe(e.key) : e.key === y.ENTER && !e.isComposing ? t(this.#E) : e.key === y.ESC && (n(), this.#u.focus())), !this.#e.countrySearch && x.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#ae(r), i = setTimeout(() => {
|
|
2024
2048
|
r = "";
|
|
2025
2049
|
}, S.HIDDEN_SEARCH_RESET_MS));
|
|
2026
2050
|
};
|
|
2027
|
-
this.#u?.addEventListener("keydown", a, { signal: e }), this.#m?.addEventListener("keydown", a, { signal: e }), this.#
|
|
2051
|
+
this.#u?.addEventListener("keydown", a, { signal: e }), this.#m?.addEventListener("keydown", a, { signal: e }), this.#w && this.#m?.addEventListener("keydown", (e) => {
|
|
2028
2052
|
e.key === y.TAB && (e.preventDefault(), n(), (e.shiftKey ? this.#u : this.telInputEl).focus());
|
|
2029
2053
|
}, { signal: e });
|
|
2030
2054
|
}
|
|
2031
|
-
#
|
|
2032
|
-
this.#
|
|
2055
|
+
#ie(e) {
|
|
2056
|
+
this.#_.addEventListener("input", () => this.#J(), { signal: e }), this.#v.addEventListener("click", () => this.#Y(), { signal: e });
|
|
2033
2057
|
}
|
|
2034
|
-
#
|
|
2035
|
-
let t =
|
|
2058
|
+
#ae(e) {
|
|
2059
|
+
let t = Se(this.#i, this.#a, e);
|
|
2036
2060
|
if (t) {
|
|
2037
|
-
let e = this.#
|
|
2038
|
-
this.#
|
|
2061
|
+
let e = this.#D.get(t.iso2);
|
|
2062
|
+
this.#Q(e);
|
|
2039
2063
|
}
|
|
2040
2064
|
}
|
|
2041
|
-
#
|
|
2042
|
-
let t = e === y.ARROW_UP ? this.#
|
|
2043
|
-
!t && this.#
|
|
2065
|
+
#oe(e) {
|
|
2066
|
+
let t = e === y.ARROW_UP ? this.#E?.previousElementSibling : this.#E?.nextElementSibling;
|
|
2067
|
+
!t && this.#y.childElementCount > 1 && (t = e === y.ARROW_UP ? this.#y.lastElementChild : this.#y.firstElementChild), t && this.#Q(t);
|
|
2044
2068
|
}
|
|
2045
|
-
#
|
|
2046
|
-
if (this.#
|
|
2047
|
-
let t = this.#
|
|
2069
|
+
#se(e) {
|
|
2070
|
+
if (this.#T && this.#T.dataset[L.ISO2] !== e && (this.#T.setAttribute(R.SELECTED, "false"), this.#T.querySelector(".iti__country-check")?.remove(), this.#T = null), e && !this.#T) {
|
|
2071
|
+
let t = this.#y.querySelector(`[data-iso2="${e}"]`);
|
|
2048
2072
|
t && (t.setAttribute(R.SELECTED, "true"), K("span", {
|
|
2049
|
-
class: this.#
|
|
2073
|
+
class: this.#A("countryCheck", "iti__country-check"),
|
|
2050
2074
|
[R.HIDDEN]: "true"
|
|
2051
|
-
}, t).appendChild(
|
|
2075
|
+
}, t).appendChild(ve()), this.#T = t, this.#e.dropdownAlwaysOpen && this.#Q(t));
|
|
2052
2076
|
}
|
|
2053
2077
|
}
|
|
2054
|
-
#
|
|
2055
|
-
this.#
|
|
2078
|
+
#ce(e) {
|
|
2079
|
+
this.#y.replaceChildren();
|
|
2056
2080
|
let t = !0;
|
|
2057
2081
|
for (let n of e) {
|
|
2058
|
-
let e = this.#
|
|
2059
|
-
e && (this.#
|
|
2082
|
+
let e = this.#D.get(n.iso2);
|
|
2083
|
+
e && (this.#y.appendChild(e), t &&= (this.#Q(e, !1), !1));
|
|
2060
2084
|
}
|
|
2061
|
-
t ? (this.#
|
|
2085
|
+
t ? (this.#Q(null), this.#S && this.#S.classList.remove(v.HIDE)) : this.#S && this.#S.classList.add(v.HIDE), this.#y.scrollTop = 0, this.#G();
|
|
2062
2086
|
}
|
|
2063
2087
|
closeCountrySelector() {
|
|
2064
2088
|
let { countrySearch: e } = this.#e;
|
|
2065
|
-
this.#
|
|
2089
|
+
this.#O.abort(), this.#O = null, this.#m.classList.add(v.HIDE), this.#u.setAttribute(R.EXPANDED, "false"), this.#Z().removeAttribute(R.ACTIVE_DESCENDANT), e && (this.#_.value = "", this.#q(), this.#E &&= (this.#E.classList.remove(v.HIGHLIGHT), null)), this.#p.classList.remove(v.ARROW_UP), this.#w ? (this.#w.remove(), this.#w.style.top = "", this.#w.style.bottom = "", this.#w.style.removeProperty("--iti-virtual-keyboard-height"), this.#w.style.paddingLeft = "", this.#w.style.paddingRight = "") : (this.#m.style.top = "", this.#m.style.bottom = "");
|
|
2066
2090
|
}
|
|
2067
|
-
#
|
|
2091
|
+
#le() {
|
|
2068
2092
|
if (this.#e.dropdownAlwaysOpen) return !0;
|
|
2069
2093
|
let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
|
|
2070
2094
|
return n >= this.#s || n >= t;
|
|
2071
2095
|
}
|
|
2072
|
-
#
|
|
2073
|
-
let e = this.#e.countrySelectorMode === I.FULLSCREEN, t = this.#
|
|
2096
|
+
#ue() {
|
|
2097
|
+
let e = this.#e.countrySelectorMode === I.FULLSCREEN, t = this.#P();
|
|
2074
2098
|
if (e) {
|
|
2075
2099
|
if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
|
|
2076
2100
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2077
|
-
this.#
|
|
2101
|
+
this.#w.style.paddingLeft = `${e.left}px`, this.#w.style.paddingRight = `${window.innerWidth - e.right}px`;
|
|
2078
2102
|
}
|
|
2079
|
-
} else this.#
|
|
2080
|
-
if (!e && !
|
|
2103
|
+
} else this.#de();
|
|
2104
|
+
if (!e && !we) {
|
|
2081
2105
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2082
|
-
this.#
|
|
2106
|
+
this.#w.style.left = `${e.left}px`, this.#le() ? this.#w.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#w.style.top = "unset", this.#w.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
|
|
2083
2107
|
}
|
|
2084
|
-
t.appendChild(this.#
|
|
2108
|
+
t.appendChild(this.#w);
|
|
2085
2109
|
}
|
|
2086
|
-
#
|
|
2110
|
+
#de() {
|
|
2087
2111
|
if (this.#c) return;
|
|
2088
2112
|
this.#c = !0;
|
|
2089
2113
|
let e = `--iti-anchor-${this.#t}`, t = getComputedStyle(this.telInputEl).anchorName;
|
|
2090
|
-
this.telInputEl.style.anchorName = t && t !== "none" ? `${t}, ${e}` : e, this.#
|
|
2114
|
+
this.telInputEl.style.anchorName = t && t !== "none" ? `${t}, ${e}` : e, this.#w.style.positionAnchor = e;
|
|
2091
2115
|
}
|
|
2092
|
-
#
|
|
2093
|
-
let e = window.visualViewport, t = this.#
|
|
2116
|
+
#fe() {
|
|
2117
|
+
let e = window.visualViewport, t = this.#w;
|
|
2094
2118
|
if (!e || !t) return;
|
|
2095
2119
|
let n = Math.max(0, t.offsetHeight - e.height);
|
|
2096
2120
|
t.style.setProperty("--iti-virtual-keyboard-height", `${n}px`);
|
|
@@ -2117,24 +2141,24 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2117
2141
|
}
|
|
2118
2142
|
setSelectedCountry(e) {
|
|
2119
2143
|
let { countrySelectorMode: t, showFlags: n, separateDialCode: r, uiTranslations: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
2120
|
-
if (t !== I.OFF && this.#
|
|
2121
|
-
let e = this.#
|
|
2122
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c =
|
|
2144
|
+
if (t !== I.OFF && this.#se(s), this.#u) {
|
|
2145
|
+
let e = this.#A("selectedFlag", s && n ? `${v.FLAG} iti__${s}` : `${v.FLAG} ${v.GLOBE}`), t, r, c = null;
|
|
2146
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = ye())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = ye()), this.#d.className = e, this.#u.setAttribute("title", r), this.#u.setAttribute(R.LABEL, t), c ? this.#d.replaceChildren(c) : this.#d.replaceChildren();
|
|
2123
2147
|
}
|
|
2124
2148
|
if (r) {
|
|
2125
2149
|
let e = o ? `+${o}` : "";
|
|
2126
|
-
this.#f.textContent = e, this.#
|
|
2150
|
+
this.#f.textContent = e, this.#B();
|
|
2127
2151
|
}
|
|
2128
2152
|
}
|
|
2129
2153
|
destroy() {
|
|
2130
|
-
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[L.INSTANCE_ID], this.#
|
|
2154
|
+
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[L.INSTANCE_ID], this.#k?.disconnect(), this.telInputEl.style.paddingLeft = this.#r;
|
|
2131
2155
|
let e = this.telInputEl.parentNode;
|
|
2132
|
-
e && (e.before(this.telInputEl), e.remove()), this.#
|
|
2156
|
+
e && (e.before(this.telInputEl), e.remove()), this.#D.clear();
|
|
2133
2157
|
}
|
|
2134
|
-
},
|
|
2158
|
+
}, Ee = (e) => {
|
|
2135
2159
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
2136
2160
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
2137
|
-
},
|
|
2161
|
+
}, De = (e, t) => {
|
|
2138
2162
|
let { countryNameLocale: n, countryNameOverrides: r, uiTranslations: i } = t, a = i?.countryNames, o;
|
|
2139
2163
|
try {
|
|
2140
2164
|
o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -2142,7 +2166,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2142
2166
|
console.error(e), o = null;
|
|
2143
2167
|
}
|
|
2144
2168
|
for (let t of e) t.name = r[t.iso2] || a?.[t.iso2] || o?.of(t.iso2.toUpperCase()) || "";
|
|
2145
|
-
},
|
|
2169
|
+
}, Oe = (e) => {
|
|
2146
2170
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
2147
2171
|
if (!e || !t) return;
|
|
2148
2172
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -2171,7 +2195,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2171
2195
|
dialCodeMaxLength: n,
|
|
2172
2196
|
dialCodeToIso2Map: r
|
|
2173
2197
|
};
|
|
2174
|
-
},
|
|
2198
|
+
}, ke = (e, t) => {
|
|
2175
2199
|
let { countryOrder: n } = t;
|
|
2176
2200
|
e.sort((e, t) => {
|
|
2177
2201
|
if (n) {
|
|
@@ -2180,7 +2204,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2180
2204
|
}
|
|
2181
2205
|
return e.name.localeCompare(t.name);
|
|
2182
2206
|
});
|
|
2183
|
-
},
|
|
2207
|
+
}, Ae = /* @__PURE__ */ new Set([
|
|
2184
2208
|
"800",
|
|
2185
2209
|
"808",
|
|
2186
2210
|
"870",
|
|
@@ -2189,17 +2213,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2189
2213
|
"883",
|
|
2190
2214
|
"888",
|
|
2191
2215
|
"979"
|
|
2192
|
-
]),
|
|
2216
|
+
]), je = (e) => {
|
|
2193
2217
|
let t = G(e).slice(0, 3);
|
|
2194
|
-
return e.startsWith("+") &&
|
|
2195
|
-
},
|
|
2218
|
+
return e.startsWith("+") && Ae.has(t);
|
|
2219
|
+
}, Y = (e, t, n, r) => {
|
|
2196
2220
|
if (!n || !t) return e;
|
|
2197
2221
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
2198
2222
|
return e.substring(a);
|
|
2199
|
-
},
|
|
2223
|
+
}, Me = (e, t, n, r, i) => {
|
|
2200
2224
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
2201
2225
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
2202
|
-
},
|
|
2226
|
+
}, Ne = (e, t, n, r) => {
|
|
2203
2227
|
if (n === 0 && !r) return 0;
|
|
2204
2228
|
let i = 0;
|
|
2205
2229
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2207,7 +2231,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2207
2231
|
if (r && i === e + 1) return n;
|
|
2208
2232
|
}
|
|
2209
2233
|
return t.length;
|
|
2210
|
-
},
|
|
2234
|
+
}, Pe = /* @__PURE__ */ new Set([
|
|
2211
2235
|
"800",
|
|
2212
2236
|
"822",
|
|
2213
2237
|
"833",
|
|
@@ -2225,16 +2249,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2225
2249
|
"887",
|
|
2226
2250
|
"888",
|
|
2227
2251
|
"889"
|
|
2228
|
-
]),
|
|
2252
|
+
]), Fe = (e) => {
|
|
2229
2253
|
let t = G(e);
|
|
2230
2254
|
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
2231
2255
|
let e = t.substring(1, 4);
|
|
2232
|
-
return
|
|
2256
|
+
return Pe.has(e);
|
|
2233
2257
|
}
|
|
2234
2258
|
return !1;
|
|
2235
|
-
},
|
|
2259
|
+
}, Ie = 0, X = (e) => {
|
|
2236
2260
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2237
|
-
},
|
|
2261
|
+
}, Le = () => {
|
|
2238
2262
|
let e, t;
|
|
2239
2263
|
return {
|
|
2240
2264
|
promise: new Promise((n, r) => {
|
|
@@ -2266,13 +2290,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2266
2290
|
#_;
|
|
2267
2291
|
#v;
|
|
2268
2292
|
constructor(e, t = {}) {
|
|
2269
|
-
this.id =
|
|
2293
|
+
this.id = Ie++, Te.validateInput(e);
|
|
2270
2294
|
let n = le(t);
|
|
2271
2295
|
this.#t = {
|
|
2272
2296
|
...B,
|
|
2273
2297
|
...n
|
|
2274
|
-
}, ue(this.#t), de(this.#t), this.#e = new
|
|
2275
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2298
|
+
}, ue(this.#t), de(this.#t), this.#e = new Te(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new Ce(e.value), this.promise = this.#x(this.#t), this.#r = Ee(this.#t);
|
|
2299
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = Oe(this.#r);
|
|
2276
2300
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#S();
|
|
2277
2301
|
}
|
|
2278
2302
|
#y() {
|
|
@@ -2284,16 +2308,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2284
2308
|
}
|
|
2285
2309
|
#x(e) {
|
|
2286
2310
|
let { initialCountry: t, initialCountryLookup: n, loadUtils: r } = e, i = !t && !!n, a = !!r && !Q.utils;
|
|
2287
|
-
return i && (this.#_ =
|
|
2311
|
+
return i && (this.#_ = Le()), a && (this.#v = Le()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
|
|
2288
2312
|
}
|
|
2289
2313
|
#S() {
|
|
2290
2314
|
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.openCountrySelector();
|
|
2291
2315
|
}
|
|
2292
2316
|
#C() {
|
|
2293
|
-
|
|
2317
|
+
De(this.#r, this.#t), ke(this.#r, this.#t), this.#c = be(this.#r);
|
|
2294
2318
|
}
|
|
2295
2319
|
#w(e = !1) {
|
|
2296
|
-
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#re(i), o =
|
|
2320
|
+
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#re(i), o = Fe(i), { initialCountry: s, initialCountryLookup: c } = this.#t, l = !s && !!c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2297
2321
|
a ? o ? f ? this.#Z(u) : d || this.#Z(D.ISO2) : (f && this.#Z(u), this.#q(i)) : f ? this.#Z(u) : d || this.#Z(""), i && this.#K(i);
|
|
2298
2322
|
}
|
|
2299
2323
|
#T() {
|
|
@@ -2353,12 +2377,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2353
2377
|
});
|
|
2354
2378
|
}
|
|
2355
2379
|
#N(e, t) {
|
|
2356
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(x.NON_PLUS_NUMERIC_GLOBAL, "").length, i =
|
|
2380
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(x.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Me(this.#ae(), e, Q.utils, this.#l, this.#t.separateDialCode), a = Ne(r, i, n, t);
|
|
2357
2381
|
this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2358
2382
|
}
|
|
2359
2383
|
#P(e) {
|
|
2360
2384
|
if (e.startsWith("+") && this.#l && this.#re(e)) {
|
|
2361
|
-
let t =
|
|
2385
|
+
let t = Y(e, !0, !0, this.#l);
|
|
2362
2386
|
this.#b(t);
|
|
2363
2387
|
}
|
|
2364
2388
|
}
|
|
@@ -2471,7 +2495,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2471
2495
|
#K(e) {
|
|
2472
2496
|
let { numberDisplayFormat: t, separateDialCode: n } = this.#t, r = e;
|
|
2473
2497
|
if (Q.utils && this.#l) {
|
|
2474
|
-
let i =
|
|
2498
|
+
let i = je(e), a = !r.startsWith("+") && !n, o = t === N.NATIONAL && !i || a, s;
|
|
2475
2499
|
s = o ? N.NATIONAL : t === N.E164 && !i ? N.E164 : N.INTERNATIONAL, r = Q.utils.formatNumber(r, this.#l?.iso2, s);
|
|
2476
2500
|
}
|
|
2477
2501
|
r = this.#oe(r), this.#b(r);
|
|
@@ -2500,7 +2524,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2500
2524
|
#X(e, t, n) {
|
|
2501
2525
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2502
2526
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2503
|
-
if (i === w.NANP &&
|
|
2527
|
+
if (i === w.NANP && Fe(n)) return null;
|
|
2504
2528
|
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2505
2529
|
if (a) {
|
|
2506
2530
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2577,7 +2601,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2577
2601
|
return this.#ie(e);
|
|
2578
2602
|
}
|
|
2579
2603
|
#oe(e) {
|
|
2580
|
-
let t =
|
|
2604
|
+
let t = Y(e, !!this.#re(e), this.#t.separateDialCode, this.#l);
|
|
2581
2605
|
return this.#W(t);
|
|
2582
2606
|
}
|
|
2583
2607
|
#se() {
|
|
@@ -2663,7 +2687,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2663
2687
|
}
|
|
2664
2688
|
#fe(e) {
|
|
2665
2689
|
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ae();
|
|
2666
|
-
return !this.#l && !
|
|
2690
|
+
return !this.#l && !je(a) || !(e === "precise" ? Q.utils.isValidNumberPrecise : Q.utils.isValidNumber)(a, i, r) ? !1 : x.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2667
2691
|
}
|
|
2668
2692
|
setSelectedCountry(e) {
|
|
2669
2693
|
if (!this.#f) return;
|
|
@@ -2734,13 +2758,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2734
2758
|
},
|
|
2735
2759
|
startedLoadingUtils: !1,
|
|
2736
2760
|
startedLoadingAutoCountry: !1,
|
|
2737
|
-
version: "29.
|
|
2761
|
+
version: "29.5.0",
|
|
2738
2762
|
NUMBER_FORMAT: N,
|
|
2739
2763
|
NUMBER_TYPE: P,
|
|
2740
2764
|
VALIDATION_ERROR: F,
|
|
2741
2765
|
PLACEHOLDER_POLICY: O,
|
|
2742
2766
|
COUNTRY_SELECTOR_MODE: I
|
|
2743
|
-
}), $ = Q,
|
|
2767
|
+
}), $ = Q, Re = /* @__PURE__ */ n({
|
|
2744
2768
|
inheritAttrs: !1,
|
|
2745
2769
|
__name: "IntlTelInput",
|
|
2746
2770
|
props: {
|
|
@@ -2871,4 +2895,4 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2871
2895
|
}
|
|
2872
2896
|
});
|
|
2873
2897
|
//#endregion
|
|
2874
|
-
export { $ as n,
|
|
2898
|
+
export { $ as n, Re as t };
|
package/dist/IntlTelInput.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/vue",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.5.0",
|
|
4
4
|
"description": "A Vue component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"intl-tel-input": "^29.
|
|
27
|
+
"intl-tel-input": "^29.5.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"vue": "^3.0.0"
|