@intl-tel-input/vue 28.0.2 → 28.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vue component for intl-tel-input
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
For entering, formatting, and validating international telephone numbers.
|
|
4
4
|
|
|
5
5
|
[Explore docs »](https://intl-tel-input.com/docs/vue-component)
|
|
6
6
|
|
|
@@ -10,6 +10,10 @@ A Vue component for the [intl-tel-input](https://github.com/jackocnr/intl-tel-in
|
|
|
10
10
|
<img width="271" height="279" alt="intl-tel-input screenshot showing country dropdown open" src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/iti-github-light.png">
|
|
11
11
|
</picture>
|
|
12
12
|
|
|
13
|
+
## Resources
|
|
14
|
+
|
|
15
|
+
Check out the [website](https://intl-tel-input.com), where you can find [a full set of docs](https://intl-tel-input.com/docs/vue-component), a [live playground](https://intl-tel-input.com/playground/) where you can try out all of the options, as well as plenty of [examples](https://intl-tel-input.com/examples/vue-component/validation) of different setups.
|
|
16
|
+
|
|
13
17
|
## Running the demos locally
|
|
14
18
|
|
|
15
19
|
1. Initialise the submodules: `git submodule update --init --recursive`
|
|
@@ -18,3 +22,11 @@ A Vue component for the [intl-tel-input](https://github.com/jackocnr/intl-tel-in
|
|
|
18
22
|
4. Run a demo: `npm run vue:demo` and copy the given URL into your browser.
|
|
19
23
|
|
|
20
24
|
This defaults to the validation demo — to run a different one, set the `DEMO` env var, e.g. `DEMO=simple npm run vue:demo`. View the full list of [available demos](https://github.com/jackocnr/intl-tel-input/tree/master/packages/vue/demo).
|
|
25
|
+
|
|
26
|
+
## Issues and contributing
|
|
27
|
+
|
|
28
|
+
Please report issues and open pull requests on the [main repository](https://github.com/jackocnr/intl-tel-input).
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
|
@@ -1310,7 +1310,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1310
1310
|
i18n: {},
|
|
1311
1311
|
initialCountry: "",
|
|
1312
1312
|
loadUtils: null,
|
|
1313
|
-
nationalMode: !
|
|
1313
|
+
nationalMode: !1,
|
|
1314
1314
|
onlyCountries: null,
|
|
1315
1315
|
placeholderNumberType: N.MOBILE,
|
|
1316
1316
|
searchInputClass: "",
|
|
@@ -1481,24 +1481,89 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1481
1481
|
}, G = (e) => e.replace(/\D/g, ""), K = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), q = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), J = (e, t, n) => {
|
|
1482
1482
|
let r = document.createElement(e);
|
|
1483
1483
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1484
|
-
}, se = () =>
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1484
|
+
}, se = "http://www.w3.org/2000/svg", Y = ([e, t, n]) => {
|
|
1485
|
+
let r = document.createElementNS(se, e);
|
|
1486
|
+
if (t) for (let e in t) r.setAttribute(e, String(t[e]));
|
|
1487
|
+
if (n) for (let e of n) r.appendChild(Y(e));
|
|
1488
|
+
return r;
|
|
1489
|
+
}, ce = () => Y([
|
|
1490
|
+
"svg",
|
|
1491
|
+
{
|
|
1492
|
+
class: "iti__search-icon-svg",
|
|
1493
|
+
width: 14,
|
|
1494
|
+
height: 14,
|
|
1495
|
+
viewBox: "0 0 24 24",
|
|
1496
|
+
focusable: "false",
|
|
1497
|
+
[I.HIDDEN]: "true"
|
|
1498
|
+
},
|
|
1499
|
+
[["circle", {
|
|
1500
|
+
cx: 11,
|
|
1501
|
+
cy: 11,
|
|
1502
|
+
r: 7
|
|
1503
|
+
}], ["line", {
|
|
1504
|
+
x1: 21,
|
|
1505
|
+
y1: 21,
|
|
1506
|
+
x2: 16.65,
|
|
1507
|
+
y2: 16.65
|
|
1508
|
+
}]]
|
|
1509
|
+
]), le = (e) => {
|
|
1489
1510
|
let t = `iti-${e}-clear-mask`;
|
|
1490
|
-
return
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1511
|
+
return Y([
|
|
1512
|
+
"svg",
|
|
1513
|
+
{
|
|
1514
|
+
class: "iti__search-clear-svg",
|
|
1515
|
+
width: 12,
|
|
1516
|
+
height: 12,
|
|
1517
|
+
viewBox: "0 0 16 16",
|
|
1518
|
+
[I.HIDDEN]: "true",
|
|
1519
|
+
focusable: "false"
|
|
1520
|
+
},
|
|
1521
|
+
[[
|
|
1522
|
+
"mask",
|
|
1523
|
+
{
|
|
1524
|
+
id: t,
|
|
1525
|
+
maskUnits: "userSpaceOnUse"
|
|
1526
|
+
},
|
|
1527
|
+
[["rect", {
|
|
1528
|
+
width: 16,
|
|
1529
|
+
height: 16,
|
|
1530
|
+
fill: "white"
|
|
1531
|
+
}], ["path", {
|
|
1532
|
+
d: "M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8",
|
|
1533
|
+
stroke: "black",
|
|
1534
|
+
"stroke-linecap": "round",
|
|
1535
|
+
class: "iti__search-clear-x"
|
|
1536
|
+
}]]
|
|
1537
|
+
], ["circle", {
|
|
1538
|
+
cx: 8,
|
|
1539
|
+
cy: 8,
|
|
1540
|
+
r: 8,
|
|
1541
|
+
class: "iti__search-clear-bg",
|
|
1542
|
+
mask: `url(#${t})`
|
|
1543
|
+
}]]
|
|
1544
|
+
]);
|
|
1545
|
+
}, ue = () => Y([
|
|
1546
|
+
"svg",
|
|
1547
|
+
{
|
|
1548
|
+
class: "iti__country-check-svg",
|
|
1549
|
+
width: 14,
|
|
1550
|
+
height: 14,
|
|
1551
|
+
viewBox: "0 0 16 16",
|
|
1552
|
+
fill: "currentColor",
|
|
1553
|
+
focusable: "false",
|
|
1554
|
+
[I.HIDDEN]: "true"
|
|
1555
|
+
},
|
|
1556
|
+
[["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" }]]
|
|
1557
|
+
]), de = () => Y([
|
|
1558
|
+
"svg",
|
|
1559
|
+
{
|
|
1560
|
+
width: 256,
|
|
1561
|
+
height: 256,
|
|
1562
|
+
viewBox: "0 0 512 512",
|
|
1563
|
+
class: "iti__globe-svg"
|
|
1564
|
+
},
|
|
1565
|
+
[["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" }]]
|
|
1566
|
+
]), fe = (e) => {
|
|
1502
1567
|
let t = /* @__PURE__ */ new Map();
|
|
1503
1568
|
for (let n of e) {
|
|
1504
1569
|
let e = K(n.name), r = e.split(/[^a-z]/).map((e) => e[0]).join("");
|
|
@@ -1509,7 +1574,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1509
1574
|
});
|
|
1510
1575
|
}
|
|
1511
1576
|
return t;
|
|
1512
|
-
},
|
|
1577
|
+
}, pe = (e, t, n) => {
|
|
1513
1578
|
let r = K(n), i = [], a = [], o = [], s = [], c = [], l = [];
|
|
1514
1579
|
for (let n of e) {
|
|
1515
1580
|
let e = t.get(n.iso2);
|
|
@@ -1524,14 +1589,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1524
1589
|
...c.sort(u),
|
|
1525
1590
|
...l
|
|
1526
1591
|
];
|
|
1527
|
-
},
|
|
1592
|
+
}, me = (e, t, n) => {
|
|
1528
1593
|
let r = K(n);
|
|
1529
1594
|
for (let n of e) {
|
|
1530
1595
|
let { normalisedName: e } = t.get(n.iso2);
|
|
1531
1596
|
if (e.startsWith(r)) return n;
|
|
1532
1597
|
}
|
|
1533
1598
|
return null;
|
|
1534
|
-
},
|
|
1599
|
+
}, he = class e {
|
|
1535
1600
|
#e;
|
|
1536
1601
|
static toAscii(e) {
|
|
1537
1602
|
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
@@ -1553,7 +1618,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1553
1618
|
isAscii() {
|
|
1554
1619
|
return !this.#e || this.#e === "ascii";
|
|
1555
1620
|
}
|
|
1556
|
-
},
|
|
1621
|
+
}, ge = class e {
|
|
1557
1622
|
#e;
|
|
1558
1623
|
#t;
|
|
1559
1624
|
#n;
|
|
@@ -1656,7 +1721,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1656
1721
|
this.#m = J("span", {
|
|
1657
1722
|
class: "iti__search-icon",
|
|
1658
1723
|
[I.HIDDEN]: "true"
|
|
1659
|
-
}, n), this.#m.
|
|
1724
|
+
}, n), this.#m.appendChild(ce()), this.#h = J("input", {
|
|
1660
1725
|
id: `iti-${this.#t}__search-input`,
|
|
1661
1726
|
type: "search",
|
|
1662
1727
|
class: `iti__search-input ${t}`,
|
|
@@ -1672,7 +1737,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1672
1737
|
class: `iti__search-clear ${_.HIDE}`,
|
|
1673
1738
|
[I.LABEL]: e.clearSearchAriaLabel,
|
|
1674
1739
|
tabindex: "-1"
|
|
1675
|
-
}, n), this.#g.
|
|
1740
|
+
}, n), this.#g.appendChild(le(this.#t)), this.#x = J("span", { class: "iti__a11y-text" }, this.#p), this.#b = J("div", {
|
|
1676
1741
|
class: `iti__no-results ${_.HIDE}`,
|
|
1677
1742
|
[I.HIDDEN]: "true"
|
|
1678
1743
|
}, this.#p), this.#b.textContent = e.searchEmptyState ?? null;
|
|
@@ -1759,8 +1824,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1759
1824
|
let t;
|
|
1760
1825
|
if (e === "") t = this.#i;
|
|
1761
1826
|
else {
|
|
1762
|
-
let n =
|
|
1763
|
-
t =
|
|
1827
|
+
let n = he.toAscii(e);
|
|
1828
|
+
t = pe(this.#i, this.#a, n);
|
|
1764
1829
|
}
|
|
1765
1830
|
this.#ee(t);
|
|
1766
1831
|
}
|
|
@@ -1867,7 +1932,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1867
1932
|
this.#h.addEventListener("input", () => this.#V(), { signal: e }), this.#g.addEventListener("click", () => this.#H(), { signal: e });
|
|
1868
1933
|
}
|
|
1869
1934
|
#Z(e) {
|
|
1870
|
-
let t =
|
|
1935
|
+
let t = me(this.#i, this.#a, e);
|
|
1871
1936
|
if (t) {
|
|
1872
1937
|
let e = this.#T.get(t.iso2);
|
|
1873
1938
|
this.#W(e);
|
|
@@ -1880,14 +1945,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1880
1945
|
#$(e) {
|
|
1881
1946
|
if (this.#C && this.#C.dataset[F.ISO2] !== e && (this.#C.setAttribute(I.SELECTED, "false"), this.#C.querySelector(".iti__country-check")?.remove(), this.#C = null), e && !this.#C) {
|
|
1882
1947
|
let t = this.#_.querySelector(`[data-iso2="${e}"]`);
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
[I.HIDDEN]: "true"
|
|
1888
|
-
}, t);
|
|
1889
|
-
e.innerHTML = le(), this.#C = t, this.#e.dropdownAlwaysOpen && this.#W(t);
|
|
1890
|
-
}
|
|
1948
|
+
t && (t.setAttribute(I.SELECTED, "true"), J("span", {
|
|
1949
|
+
class: "iti__country-check",
|
|
1950
|
+
[I.HIDDEN]: "true"
|
|
1951
|
+
}, t).appendChild(ue()), this.#C = t, this.#e.dropdownAlwaysOpen && this.#W(t));
|
|
1891
1952
|
}
|
|
1892
1953
|
}
|
|
1893
1954
|
#ee(e) {
|
|
@@ -1945,8 +2006,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1945
2006
|
setCountry(e) {
|
|
1946
2007
|
let { allowDropdown: t, showFlags: n, separateDialCode: r, i18n: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
1947
2008
|
if (t && this.#$(s), this.#l) {
|
|
1948
|
-
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c;
|
|
1949
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`),
|
|
2009
|
+
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c = null;
|
|
2010
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = de())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = de()), this.#u.className = e, this.#l.setAttribute("title", r), this.#l.setAttribute(I.LABEL, t), c ? this.#u.replaceChildren(c) : this.#u.replaceChildren();
|
|
1950
2011
|
}
|
|
1951
2012
|
if (r) {
|
|
1952
2013
|
let e = o ? `+${o}` : "";
|
|
@@ -1958,10 +2019,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1958
2019
|
let e = this.telInputEl.parentNode;
|
|
1959
2020
|
e && (e.before(this.telInputEl), e.remove()), this.#T.clear();
|
|
1960
2021
|
}
|
|
1961
|
-
},
|
|
2022
|
+
}, _e = (e) => {
|
|
1962
2023
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
1963
2024
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
1964
|
-
},
|
|
2025
|
+
}, ve = (e, t) => {
|
|
1965
2026
|
let { countryNameLocale: n, countryNameOverrides: r } = t, i;
|
|
1966
2027
|
try {
|
|
1967
2028
|
i = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -1969,7 +2030,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1969
2030
|
console.error(e), i = null;
|
|
1970
2031
|
}
|
|
1971
2032
|
for (let t of e) t.name = r[t.iso2] || i?.of(t.iso2.toUpperCase()) || "";
|
|
1972
|
-
},
|
|
2033
|
+
}, ye = (e) => {
|
|
1973
2034
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
1974
2035
|
if (!e || !t) return;
|
|
1975
2036
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -1998,7 +2059,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1998
2059
|
dialCodeMaxLength: n,
|
|
1999
2060
|
dialCodeToIso2Map: r
|
|
2000
2061
|
};
|
|
2001
|
-
},
|
|
2062
|
+
}, be = (e, t) => {
|
|
2002
2063
|
let { countryOrder: n } = t;
|
|
2003
2064
|
e.sort((e, t) => {
|
|
2004
2065
|
if (n) {
|
|
@@ -2007,7 +2068,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2007
2068
|
}
|
|
2008
2069
|
return e.name.localeCompare(t.name);
|
|
2009
2070
|
});
|
|
2010
|
-
},
|
|
2071
|
+
}, xe = /* @__PURE__ */ new Set([
|
|
2011
2072
|
"800",
|
|
2012
2073
|
"808",
|
|
2013
2074
|
"870",
|
|
@@ -2016,17 +2077,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2016
2077
|
"883",
|
|
2017
2078
|
"888",
|
|
2018
2079
|
"979"
|
|
2019
|
-
]),
|
|
2080
|
+
]), Se = (e) => {
|
|
2020
2081
|
let t = G(e).slice(0, 3);
|
|
2021
|
-
return e.startsWith("+") &&
|
|
2022
|
-
},
|
|
2082
|
+
return e.startsWith("+") && xe.has(t);
|
|
2083
|
+
}, Ce = (e, t, n, r) => {
|
|
2023
2084
|
if (!n || !t) return e;
|
|
2024
2085
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
2025
2086
|
return e.substring(a);
|
|
2026
|
-
},
|
|
2087
|
+
}, we = (e, t, n, r, i) => {
|
|
2027
2088
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
2028
2089
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
2029
|
-
},
|
|
2090
|
+
}, Te = (e, t, n, r) => {
|
|
2030
2091
|
if (n === 0 && !r) return 0;
|
|
2031
2092
|
let i = 0;
|
|
2032
2093
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2034,7 +2095,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2034
2095
|
if (r && i === e + 1) return n;
|
|
2035
2096
|
}
|
|
2036
2097
|
return t.length;
|
|
2037
|
-
},
|
|
2098
|
+
}, Ee = /* @__PURE__ */ new Set([
|
|
2038
2099
|
"800",
|
|
2039
2100
|
"822",
|
|
2040
2101
|
"833",
|
|
@@ -2052,16 +2113,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2052
2113
|
"887",
|
|
2053
2114
|
"888",
|
|
2054
2115
|
"889"
|
|
2055
|
-
]),
|
|
2116
|
+
]), De = (e) => {
|
|
2056
2117
|
let t = G(e);
|
|
2057
2118
|
if (t.startsWith(C.NANP) && t.length >= 4) {
|
|
2058
2119
|
let e = t.substring(1, 4);
|
|
2059
|
-
return
|
|
2120
|
+
return Ee.has(e);
|
|
2060
2121
|
}
|
|
2061
2122
|
return !1;
|
|
2062
|
-
},
|
|
2123
|
+
}, Oe = 0, X = (e) => {
|
|
2063
2124
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2064
|
-
},
|
|
2125
|
+
}, ke = () => {
|
|
2065
2126
|
let e, t;
|
|
2066
2127
|
return {
|
|
2067
2128
|
promise: new Promise((n, r) => {
|
|
@@ -2092,13 +2153,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2092
2153
|
#g;
|
|
2093
2154
|
#_;
|
|
2094
2155
|
constructor(e, t = {}) {
|
|
2095
|
-
this.id =
|
|
2156
|
+
this.id = Oe++, ge.validateInput(e);
|
|
2096
2157
|
let n = ie(t);
|
|
2097
2158
|
this.#t = {
|
|
2098
2159
|
...z,
|
|
2099
2160
|
...n
|
|
2100
|
-
}, ae(this.#t), oe(this.#t), this.#e = new
|
|
2101
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2161
|
+
}, ae(this.#t), oe(this.#t), this.#e = new ge(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new he(e.value), this.promise = this.#b(this.#t), this.#r = _e(this.#t);
|
|
2162
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = ye(this.#r);
|
|
2102
2163
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#x();
|
|
2103
2164
|
}
|
|
2104
2165
|
#v() {
|
|
@@ -2110,16 +2171,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2110
2171
|
}
|
|
2111
2172
|
#b(e) {
|
|
2112
2173
|
let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === D.AUTO && !!n, a = !!r && !Q.utils;
|
|
2113
|
-
return i && (this.#g =
|
|
2174
|
+
return i && (this.#g = ke()), a && (this.#_ = ke()), Promise.all([this.#g?.promise, this.#_?.promise]).then(() => {});
|
|
2114
2175
|
}
|
|
2115
2176
|
#x() {
|
|
2116
2177
|
this.#p = new AbortController(), this.#S(), this.#e.buildMarkup(this.#r, this.#c), this.#C(), this.#w(), this.#T(), this.#t.dropdownAlwaysOpen && this.#U();
|
|
2117
2178
|
}
|
|
2118
2179
|
#S() {
|
|
2119
|
-
|
|
2180
|
+
ve(this.#r, this.#t), be(this.#r, this.#t), this.#c = fe(this.#r);
|
|
2120
2181
|
}
|
|
2121
2182
|
#C(e = !1) {
|
|
2122
|
-
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 =
|
|
2183
|
+
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 = De(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === D.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2123
2184
|
a ? o ? f ? this.#Y(u) : d || this.#Y(T.ISO2) : (f && this.#Y(u), this.#G(i)) : f ? this.#Y(u) : d || this.#Y(""), i && this.#W(i);
|
|
2124
2185
|
}
|
|
2125
2186
|
#w() {
|
|
@@ -2172,12 +2233,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2172
2233
|
});
|
|
2173
2234
|
}
|
|
2174
2235
|
#M(e, t) {
|
|
2175
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i =
|
|
2236
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = we(this.#re(), e, Q.utils, this.#l, this.#t.separateDialCode), a = Te(r, i, n, t);
|
|
2176
2237
|
this.#y(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2177
2238
|
}
|
|
2178
2239
|
#N(e) {
|
|
2179
2240
|
if (e.startsWith("+") && this.#l && this.#te(e)) {
|
|
2180
|
-
let t =
|
|
2241
|
+
let t = Ce(e, !0, !0, this.#l);
|
|
2181
2242
|
this.#y(t);
|
|
2182
2243
|
}
|
|
2183
2244
|
}
|
|
@@ -2289,7 +2350,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2289
2350
|
#W(e) {
|
|
2290
2351
|
let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
|
|
2291
2352
|
if (t && Q.utils && this.#l) {
|
|
2292
|
-
let t =
|
|
2353
|
+
let t = Se(e), a = n && !t || !i.startsWith("+") && !r ? M.NATIONAL : M.INTERNATIONAL;
|
|
2293
2354
|
i = Q.utils.formatNumber(i, this.#l?.iso2, a);
|
|
2294
2355
|
}
|
|
2295
2356
|
i = this.#ie(i), this.#y(i);
|
|
@@ -2318,7 +2379,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2318
2379
|
#J(e, t, n) {
|
|
2319
2380
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2320
2381
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2321
|
-
if (i === C.NANP &&
|
|
2382
|
+
if (i === C.NANP && De(n)) return null;
|
|
2322
2383
|
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2323
2384
|
if (a) {
|
|
2324
2385
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2394,7 +2455,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2394
2455
|
return this.#ne(e);
|
|
2395
2456
|
}
|
|
2396
2457
|
#ie(e) {
|
|
2397
|
-
let t =
|
|
2458
|
+
let t = Ce(e, !!this.#te(e), this.#t.separateDialCode, this.#l);
|
|
2398
2459
|
return this.#B(t);
|
|
2399
2460
|
}
|
|
2400
2461
|
#ae() {
|
|
@@ -2480,7 +2541,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2480
2541
|
}
|
|
2481
2542
|
#ue(e) {
|
|
2482
2543
|
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#re();
|
|
2483
|
-
return !this.#l && !
|
|
2544
|
+
return !this.#l && !Se(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;
|
|
2484
2545
|
}
|
|
2485
2546
|
setCountry(e) {
|
|
2486
2547
|
if (!this.#f) return;
|
|
@@ -2554,11 +2615,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2554
2615
|
},
|
|
2555
2616
|
startedLoadingUtils: !1,
|
|
2556
2617
|
startedLoadingAutoCountry: !1,
|
|
2557
|
-
version: "28.0.
|
|
2618
|
+
version: "28.0.4",
|
|
2558
2619
|
NUMBER_FORMAT: M,
|
|
2559
2620
|
NUMBER_TYPE: N,
|
|
2560
2621
|
VALIDATION_ERROR: P
|
|
2561
|
-
}), $ = Q,
|
|
2622
|
+
}), $ = Q, Ae = /* @__PURE__ */ n({
|
|
2562
2623
|
inheritAttrs: !1,
|
|
2563
2624
|
__name: "IntlTelInput",
|
|
2564
2625
|
props: {
|
|
@@ -2688,4 +2749,4 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2688
2749
|
}
|
|
2689
2750
|
});
|
|
2690
2751
|
//#endregion
|
|
2691
|
-
export { $ as n,
|
|
2752
|
+
export { $ as n, Ae as t };
|
package/dist/IntlTelInput.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/vue",
|
|
3
|
-
"version": "28.0.
|
|
4
|
-
"description": "A Vue component for
|
|
3
|
+
"version": "28.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",
|
|
7
7
|
"author": "Jack O'Connor (http://jackocnr.com)",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"intl-tel-input": "^28.0.
|
|
27
|
+
"intl-tel-input": "^28.0.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"vue": "^3.0.0"
|