intl-tel-input 24.3.3 → 24.3.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 +6 -6
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +5 -6
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +5 -6
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +4 -5
- package/react/build/IntlTelInput.js +4 -5
- package/react/build/IntlTelInputWithUtils.cjs +4 -5
- package/react/build/IntlTelInputWithUtils.js +4 -5
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +190 -190
- package/vue/build/IntlTelInputWithUtils.mjs +440 -440
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as L, useModel as T, ref as w, onMounted as P, watch as x, onUnmounted as E, withDirectives as M, openBlock as B, createElementBlock as O, vModelText as V } from "vue";
|
|
2
|
+
const D = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1305,10 +1305,10 @@ const L = [
|
|
|
1305
1305
|
// Zimbabwe
|
|
1306
1306
|
"263"
|
|
1307
1307
|
]
|
|
1308
|
-
],
|
|
1309
|
-
for (let
|
|
1310
|
-
const t =
|
|
1311
|
-
|
|
1308
|
+
], b = [];
|
|
1309
|
+
for (let u = 0; u < D.length; u++) {
|
|
1310
|
+
const t = D[u];
|
|
1311
|
+
b[u] = {
|
|
1312
1312
|
name: "",
|
|
1313
1313
|
// this is now populated in the plugin
|
|
1314
1314
|
iso2: t[0],
|
|
@@ -1318,7 +1318,7 @@ for (let l = 0; l < L.length; l++) {
|
|
|
1318
1318
|
nodeById: {}
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
|
-
const
|
|
1321
|
+
const F = {
|
|
1322
1322
|
ad: "Andorra",
|
|
1323
1323
|
ae: "United Arab Emirates",
|
|
1324
1324
|
af: "Afghanistan",
|
|
@@ -1561,7 +1561,7 @@ const V = {
|
|
|
1561
1561
|
za: "South Africa",
|
|
1562
1562
|
zm: "Zambia",
|
|
1563
1563
|
zw: "Zimbabwe"
|
|
1564
|
-
},
|
|
1564
|
+
}, R = {
|
|
1565
1565
|
selectedCountryAriaLabel: "Selected country",
|
|
1566
1566
|
noCountrySelected: "No country selected",
|
|
1567
1567
|
countryListAriaLabel: "List of countries",
|
|
@@ -1572,11 +1572,11 @@ const V = {
|
|
|
1572
1572
|
// additional countries (not supported by country-list library)
|
|
1573
1573
|
ac: "Ascension Island",
|
|
1574
1574
|
xk: "Kosovo"
|
|
1575
|
-
},
|
|
1576
|
-
for (let
|
|
1577
|
-
|
|
1578
|
-
let
|
|
1579
|
-
const
|
|
1575
|
+
}, S = { ...F, ...R };
|
|
1576
|
+
for (let u = 0; u < b.length; u++)
|
|
1577
|
+
b[u].name = S[b[u].iso2];
|
|
1578
|
+
let z = 0;
|
|
1579
|
+
const k = {
|
|
1580
1580
|
//* Whether or not to allow the dropdown.
|
|
1581
1581
|
allowDropdown: !0,
|
|
1582
1582
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
@@ -1631,7 +1631,7 @@ const S = {
|
|
|
1631
1631
|
utilsScript: "",
|
|
1632
1632
|
//* The number type to enforce during validation.
|
|
1633
1633
|
validationNumberType: "MOBILE"
|
|
1634
|
-
},
|
|
1634
|
+
}, $ = [
|
|
1635
1635
|
"800",
|
|
1636
1636
|
"822",
|
|
1637
1637
|
"833",
|
|
@@ -1649,40 +1649,40 @@ const S = {
|
|
|
1649
1649
|
"887",
|
|
1650
1650
|
"888",
|
|
1651
1651
|
"889"
|
|
1652
|
-
], I = (
|
|
1653
|
-
const t = I(
|
|
1652
|
+
], I = (u) => u.replace(/\D/g, ""), N = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), A = (u) => {
|
|
1653
|
+
const t = I(u);
|
|
1654
1654
|
if (t.charAt(0) === "1") {
|
|
1655
1655
|
const e = t.substr(1, 3);
|
|
1656
|
-
return
|
|
1656
|
+
return $.indexOf(e) !== -1;
|
|
1657
1657
|
}
|
|
1658
1658
|
return !1;
|
|
1659
|
-
},
|
|
1659
|
+
}, j = (u, t, e, i) => {
|
|
1660
1660
|
if (e === 0 && !i)
|
|
1661
1661
|
return 0;
|
|
1662
1662
|
let s = 0;
|
|
1663
1663
|
for (let n = 0; n < t.length; n++) {
|
|
1664
|
-
if (/[+0-9]/.test(t[n]) && s++, s ===
|
|
1664
|
+
if (/[+0-9]/.test(t[n]) && s++, s === u && !i)
|
|
1665
1665
|
return n + 1;
|
|
1666
|
-
if (i && s ===
|
|
1666
|
+
if (i && s === u + 1)
|
|
1667
1667
|
return n;
|
|
1668
1668
|
}
|
|
1669
1669
|
return t.length;
|
|
1670
|
-
}, m = (
|
|
1671
|
-
const i = document.createElement(
|
|
1670
|
+
}, m = (u, t, e) => {
|
|
1671
|
+
const i = document.createElement(u);
|
|
1672
1672
|
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
|
|
1673
|
-
}, _ = (
|
|
1674
|
-
const { instances: t } =
|
|
1675
|
-
Object.values(t).forEach((e) => e[
|
|
1673
|
+
}, _ = (u) => {
|
|
1674
|
+
const { instances: t } = l;
|
|
1675
|
+
Object.values(t).forEach((e) => e[u]());
|
|
1676
1676
|
};
|
|
1677
|
-
class
|
|
1677
|
+
class K {
|
|
1678
1678
|
constructor(t, e = {}) {
|
|
1679
|
-
this.id =
|
|
1679
|
+
this.id = z++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, k, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
|
|
1680
1680
|
}
|
|
1681
1681
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1682
|
_init() {
|
|
1683
|
-
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1
|
|
1683
|
+
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1684
1684
|
const t = this.options.allowDropdown || this.options.separateDialCode;
|
|
1685
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !t : t, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...
|
|
1685
|
+
this.showSelectedCountryOnLeft = this.isRTL ? !t : t, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...S, ...this.options.i18n };
|
|
1686
1686
|
const e = new Promise((s, n) => {
|
|
1687
1687
|
this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = n;
|
|
1688
1688
|
}), i = new Promise((s, n) => {
|
|
@@ -1702,9 +1702,9 @@ class j {
|
|
|
1702
1702
|
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((t) => t.toLowerCase())), this.countries.sort((t, e) => {
|
|
1703
1703
|
const { countryOrder: i } = this.options;
|
|
1704
1704
|
if (i) {
|
|
1705
|
-
const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2),
|
|
1706
|
-
if (
|
|
1707
|
-
return
|
|
1705
|
+
const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2), o = s > -1, a = n > -1;
|
|
1706
|
+
if (o || a)
|
|
1707
|
+
return o && a ? s - n : o ? -1 : 1;
|
|
1708
1708
|
}
|
|
1709
1709
|
return t.name.localeCompare(e.name);
|
|
1710
1710
|
});
|
|
@@ -1725,18 +1725,18 @@ class j {
|
|
|
1725
1725
|
const i = t.map(
|
|
1726
1726
|
(s) => s.toLowerCase()
|
|
1727
1727
|
);
|
|
1728
|
-
this.countries =
|
|
1728
|
+
this.countries = b.filter(
|
|
1729
1729
|
(s) => i.indexOf(s.iso2) > -1
|
|
1730
1730
|
);
|
|
1731
1731
|
} else if (e.length) {
|
|
1732
1732
|
const i = e.map(
|
|
1733
1733
|
(s) => s.toLowerCase()
|
|
1734
1734
|
);
|
|
1735
|
-
this.countries =
|
|
1735
|
+
this.countries = b.filter(
|
|
1736
1736
|
(s) => i.indexOf(s.iso2) === -1
|
|
1737
1737
|
);
|
|
1738
1738
|
} else
|
|
1739
|
-
this.countries =
|
|
1739
|
+
this.countries = b;
|
|
1740
1740
|
}
|
|
1741
1741
|
//* Translate Countries by object literal provided on config.
|
|
1742
1742
|
_translateCountryNames() {
|
|
@@ -1758,9 +1758,9 @@ class j {
|
|
|
1758
1758
|
const i = this.dialCodeToIso2Map[e.dialCode][0];
|
|
1759
1759
|
for (let s = 0; s < e.areaCodes.length; s++) {
|
|
1760
1760
|
const n = e.areaCodes[s];
|
|
1761
|
-
for (let
|
|
1762
|
-
const
|
|
1763
|
-
this._addToDialCodeMap(i,
|
|
1761
|
+
for (let o = 1; o < n.length; o++) {
|
|
1762
|
+
const a = e.dialCode + n.substr(0, o);
|
|
1763
|
+
this._addToDialCodeMap(i, a), this._addToDialCodeMap(e.iso2, a);
|
|
1764
1764
|
}
|
|
1765
1765
|
this._addToDialCodeMap(e.iso2, e.dialCode + n);
|
|
1766
1766
|
}
|
|
@@ -1769,7 +1769,7 @@ class j {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1771
1771
|
_generateMarkup() {
|
|
1772
|
-
var
|
|
1772
|
+
var h;
|
|
1773
1773
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1774
1774
|
const {
|
|
1775
1775
|
allowDropdown: t,
|
|
@@ -1777,23 +1777,23 @@ class j {
|
|
|
1777
1777
|
showFlags: i,
|
|
1778
1778
|
containerClass: s,
|
|
1779
1779
|
hiddenInput: n,
|
|
1780
|
-
dropdownContainer:
|
|
1781
|
-
fixDropdownWidth:
|
|
1782
|
-
useFullscreenPopup:
|
|
1780
|
+
dropdownContainer: o,
|
|
1781
|
+
fixDropdownWidth: a,
|
|
1782
|
+
useFullscreenPopup: r,
|
|
1783
1783
|
countrySearch: p,
|
|
1784
|
-
i18n:
|
|
1784
|
+
i18n: d
|
|
1785
1785
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
t && (
|
|
1788
|
-
const
|
|
1789
|
-
if ((
|
|
1786
|
+
let C = "iti";
|
|
1787
|
+
t && (C += " iti--allow-dropdown"), i && (C += " iti--show-flags"), s && (C += ` ${s}`), r || (C += " iti--inline-dropdown");
|
|
1788
|
+
const c = m("div", { class: C });
|
|
1789
|
+
if ((h = this.telInput.parentNode) == null || h.insertBefore(c, this.telInput), t || i || e) {
|
|
1790
1790
|
this.countryContainer = m(
|
|
1791
1791
|
"div",
|
|
1792
1792
|
{
|
|
1793
1793
|
class: "iti__country-container",
|
|
1794
1794
|
style: this.showSelectedCountryOnLeft ? "left: 0" : "right: 0"
|
|
1795
1795
|
},
|
|
1796
|
-
|
|
1796
|
+
c
|
|
1797
1797
|
), t ? (this.selectedCountry = m(
|
|
1798
1798
|
"button",
|
|
1799
1799
|
{
|
|
@@ -1825,7 +1825,7 @@ class j {
|
|
|
1825
1825
|
{ class: "iti__selected-dial-code" },
|
|
1826
1826
|
this.selectedCountry
|
|
1827
1827
|
)), t) {
|
|
1828
|
-
const f =
|
|
1828
|
+
const f = a ? "" : "iti--flexible-dropdown-width";
|
|
1829
1829
|
if (this.dropdownContent = m("div", {
|
|
1830
1830
|
id: `iti-${this.id}__dropdown-content`,
|
|
1831
1831
|
class: `iti__dropdown-content iti__hide ${f}`
|
|
@@ -1834,10 +1834,10 @@ class j {
|
|
|
1834
1834
|
{
|
|
1835
1835
|
type: "text",
|
|
1836
1836
|
class: "iti__search-input",
|
|
1837
|
-
placeholder:
|
|
1837
|
+
placeholder: d.searchPlaceholder,
|
|
1838
1838
|
role: "combobox",
|
|
1839
1839
|
"aria-expanded": "true",
|
|
1840
|
-
"aria-label":
|
|
1840
|
+
"aria-label": d.searchPlaceholder,
|
|
1841
1841
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1842
1842
|
"aria-autocomplete": "list",
|
|
1843
1843
|
autocomplete: "off"
|
|
@@ -1853,25 +1853,25 @@ class j {
|
|
|
1853
1853
|
class: "iti__country-list",
|
|
1854
1854
|
id: `iti-${this.id}__country-listbox`,
|
|
1855
1855
|
role: "listbox",
|
|
1856
|
-
"aria-label":
|
|
1856
|
+
"aria-label": d.countryListAriaLabel
|
|
1857
1857
|
},
|
|
1858
1858
|
this.dropdownContent
|
|
1859
|
-
), this._appendListItems(), p && this._updateSearchResultsText(),
|
|
1860
|
-
let
|
|
1861
|
-
|
|
1859
|
+
), this._appendListItems(), p && this._updateSearchResultsText(), o) {
|
|
1860
|
+
let g = "iti iti--container";
|
|
1861
|
+
r ? g += " iti--fullscreen-popup" : g += " iti--inline-dropdown", this.dropdown = m("div", { class: g }), this.dropdown.appendChild(this.dropdownContent);
|
|
1862
1862
|
} else
|
|
1863
1863
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
|
-
if (
|
|
1866
|
+
if (c.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1867
1867
|
const y = this.telInput.getAttribute("name") || "", f = n(y);
|
|
1868
1868
|
f.phone && (this.hiddenInput = m("input", {
|
|
1869
1869
|
type: "hidden",
|
|
1870
1870
|
name: f.phone
|
|
1871
|
-
}),
|
|
1871
|
+
}), c.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry = m("input", {
|
|
1872
1872
|
type: "hidden",
|
|
1873
1873
|
name: f.country
|
|
1874
|
-
}),
|
|
1874
|
+
}), c.appendChild(this.hiddenInputCountry));
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
@@ -1899,12 +1899,12 @@ class j {
|
|
|
1899
1899
|
//* 1. Extracting a dial code from the given number
|
|
1900
1900
|
//* 2. Using explicit initialCountry
|
|
1901
1901
|
_setInitialState(t = !1) {
|
|
1902
|
-
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i,
|
|
1903
|
-
if (
|
|
1902
|
+
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, o = this._getDialCode(n), a = A(n), { initialCountry: r, geoIpLookup: p } = this.options, d = r === "auto" && p;
|
|
1903
|
+
if (o && !a)
|
|
1904
1904
|
this._updateCountryFromNumber(n);
|
|
1905
|
-
else if (!
|
|
1906
|
-
const
|
|
1907
|
-
|
|
1905
|
+
else if (!d || t) {
|
|
1906
|
+
const C = r ? r.toLowerCase() : "";
|
|
1907
|
+
C && this._getCountryData(C, !0) ? this._setCountry(C) : o && a ? this._setCountry("us") : this._setCountry();
|
|
1908
1908
|
}
|
|
1909
1909
|
n && this._updateValFromNumber(n);
|
|
1910
1910
|
}
|
|
@@ -1940,16 +1940,16 @@ class j {
|
|
|
1940
1940
|
//* Init many requests: utils script / geo ip lookup.
|
|
1941
1941
|
_initRequests() {
|
|
1942
1942
|
const { utilsScript: t, initialCountry: e, geoIpLookup: i } = this.options;
|
|
1943
|
-
t && !
|
|
1944
|
-
|
|
1943
|
+
t && !l.utils ? l.documentReady() ? l.loadUtils(t) : window.addEventListener("load", () => {
|
|
1944
|
+
l.loadUtils(t);
|
|
1945
1945
|
}) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1946
1946
|
}
|
|
1947
1947
|
//* Perform the geo ip lookup.
|
|
1948
1948
|
_loadAutoCountry() {
|
|
1949
|
-
|
|
1949
|
+
l.autoCountry ? this.handleAutoCountry() : l.startedLoadingAutoCountry || (l.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1950
1950
|
(t = "") => {
|
|
1951
1951
|
const e = t.toLowerCase();
|
|
1952
|
-
e && this._getCountryData(e, !0) ? (
|
|
1952
|
+
e && this._getCountryData(e, !0) ? (l.autoCountry = e, setTimeout(() => _("handleAutoCountry"))) : (this._setInitialState(!0), _("rejectAutoCountryPromise"));
|
|
1953
1953
|
},
|
|
1954
1954
|
() => {
|
|
1955
1955
|
this._setInitialState(!0), _("rejectAutoCountryPromise");
|
|
@@ -1961,31 +1961,31 @@ class j {
|
|
|
1961
1961
|
}
|
|
1962
1962
|
//* Initialize the tel input listeners.
|
|
1963
1963
|
_initTelInputListeners() {
|
|
1964
|
-
const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n } = this.options;
|
|
1964
|
+
const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: o } = this.options;
|
|
1965
1965
|
let a = !1;
|
|
1966
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (
|
|
1967
|
-
if (this.isAndroid && (
|
|
1968
|
-
const c = this.telInput.selectionStart || 0,
|
|
1969
|
-
this.telInput.value =
|
|
1966
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (r) => {
|
|
1967
|
+
if (this.isAndroid && (r == null ? void 0 : r.data) === "+" && i && n && o) {
|
|
1968
|
+
const c = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, c - 1), y = this.telInput.value.substring(c);
|
|
1969
|
+
this.telInput.value = h + y, this._openDropdownWithPlus();
|
|
1970
1970
|
return;
|
|
1971
1971
|
}
|
|
1972
1972
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1973
|
-
const
|
|
1974
|
-
|
|
1975
|
-
const
|
|
1976
|
-
if (e && !a && !
|
|
1977
|
-
const c = this.telInput.selectionStart || 0,
|
|
1978
|
-
this.telInput.value =
|
|
1973
|
+
const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data), d = (r == null ? void 0 : r.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1974
|
+
p || d && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
|
|
1975
|
+
const C = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
|
|
1976
|
+
if (e && !a && !C) {
|
|
1977
|
+
const c = this.telInput.selectionStart || 0, y = this.telInput.value.substring(0, c).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), v = j(y, g, c, f);
|
|
1978
|
+
this.telInput.value = g, this.telInput.setSelectionRange(v, v);
|
|
1979
1979
|
}
|
|
1980
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (
|
|
1981
|
-
if (
|
|
1982
|
-
if (i && n && o.key === "+") {
|
|
1983
|
-
|
|
1980
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (r) => {
|
|
1981
|
+
if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
|
|
1982
|
+
if (i && n && o && r.key === "+") {
|
|
1983
|
+
r.preventDefault(), this._openDropdownWithPlus();
|
|
1984
1984
|
return;
|
|
1985
1985
|
}
|
|
1986
1986
|
if (t) {
|
|
1987
|
-
const
|
|
1988
|
-
(!
|
|
1987
|
+
const p = this.telInput.selectionStart === 0 && r.key === "+", d = /^[0-9]$/.test(r.key), C = i ? d : p || d, c = this._getFullNumber(), h = l.utils.getCoreNumber(c, this.selectedCountryData.iso2), y = this.maxCoreNumberLength && h.length >= this.maxCoreNumberLength, f = this.telInput.value.substring(this.telInput.selectionStart, this.telInput.selectionEnd), g = /\d/.test(f);
|
|
1988
|
+
(!C || y && !g) && r.preventDefault();
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
1991
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2023,15 +2023,15 @@ class j {
|
|
|
2023
2023
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2024
2024
|
_bindDropdownListeners() {
|
|
2025
2025
|
this._handleMouseoverCountryList = (s) => {
|
|
2026
|
-
var
|
|
2027
|
-
const n = (
|
|
2026
|
+
var o;
|
|
2027
|
+
const n = (o = s.target) == null ? void 0 : o.closest(".iti__country");
|
|
2028
2028
|
n && this._highlightListItem(n, !1);
|
|
2029
2029
|
}, this.countryList.addEventListener(
|
|
2030
2030
|
"mouseover",
|
|
2031
2031
|
this._handleMouseoverCountryList
|
|
2032
2032
|
), this._handleClickCountryList = (s) => {
|
|
2033
|
-
var
|
|
2034
|
-
const n = (
|
|
2033
|
+
var o;
|
|
2034
|
+
const n = (o = s.target) == null ? void 0 : o.closest(".iti__country");
|
|
2035
2035
|
n && this._selectListItem(n);
|
|
2036
2036
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2037
2037
|
let t = !0;
|
|
@@ -2048,15 +2048,15 @@ class j {
|
|
|
2048
2048
|
}, 1e3));
|
|
2049
2049
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2050
2050
|
const s = () => {
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2051
|
+
const o = this.searchInput.value.trim();
|
|
2052
|
+
o ? this._filterCountries(o) : this._filterCountries("", !0);
|
|
2053
2053
|
};
|
|
2054
2054
|
let n = null;
|
|
2055
2055
|
this._handleSearchChange = () => {
|
|
2056
2056
|
n && clearTimeout(n), n = setTimeout(() => {
|
|
2057
2057
|
s(), n = null;
|
|
2058
2058
|
}, 100);
|
|
2059
|
-
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", (
|
|
2059
|
+
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", (o) => o.stopPropagation());
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
2062
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
@@ -2074,12 +2074,12 @@ class j {
|
|
|
2074
2074
|
_filterCountries(t, e = !1) {
|
|
2075
2075
|
let i = !0;
|
|
2076
2076
|
this.countryList.innerHTML = "";
|
|
2077
|
-
const s =
|
|
2077
|
+
const s = N(t);
|
|
2078
2078
|
for (let n = 0; n < this.countries.length; n++) {
|
|
2079
|
-
const
|
|
2080
|
-
if (e ||
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2079
|
+
const o = this.countries[n], a = N(o.name), r = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((d) => d[0]).join("").toLowerCase(), p = `+${o.dialCode}`;
|
|
2080
|
+
if (e || a.includes(s) || p.includes(s) || o.iso2.includes(s) || r.includes(s)) {
|
|
2081
|
+
const d = o.nodeById[this.id];
|
|
2082
|
+
d && this.countryList.appendChild(d), i && (this._highlightListItem(d, !1), i = !1);
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
2085
|
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
@@ -2104,12 +2104,12 @@ class j {
|
|
|
2104
2104
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2105
2105
|
_updateValFromNumber(t) {
|
|
2106
2106
|
let e = t;
|
|
2107
|
-
if (this.options.formatOnDisplay &&
|
|
2108
|
-
const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } =
|
|
2109
|
-
e =
|
|
2107
|
+
if (this.options.formatOnDisplay && l.utils && this.selectedCountryData) {
|
|
2108
|
+
const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = l.utils.numberFormat, o = i ? s : n;
|
|
2109
|
+
e = l.utils.formatNumber(
|
|
2110
2110
|
e,
|
|
2111
2111
|
this.selectedCountryData.iso2,
|
|
2112
|
-
|
|
2112
|
+
o
|
|
2113
2113
|
);
|
|
2114
2114
|
}
|
|
2115
2115
|
e = this._beforeSetNumber(e), this.telInput.value = e;
|
|
@@ -2121,19 +2121,19 @@ class j {
|
|
|
2121
2121
|
let i = e ? t.substring(e) : t;
|
|
2122
2122
|
const s = this.selectedCountryData.dialCode;
|
|
2123
2123
|
i && s === "1" && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = `1${i}`), i = `+${i}`), this.options.separateDialCode && s && i.charAt(0) !== "+" && (i = `+${s}${i}`);
|
|
2124
|
-
const
|
|
2125
|
-
let
|
|
2126
|
-
if (
|
|
2127
|
-
const p = this.dialCodeToIso2Map[I(
|
|
2128
|
-
if (!(s === "1" &&
|
|
2129
|
-
for (let
|
|
2130
|
-
if (p[
|
|
2131
|
-
|
|
2124
|
+
const o = this._getDialCode(i, !0), a = I(i);
|
|
2125
|
+
let r = null;
|
|
2126
|
+
if (o) {
|
|
2127
|
+
const p = this.dialCodeToIso2Map[I(o)], d = p.indexOf(this.selectedCountryData.iso2) !== -1 && a.length <= o.length - 1;
|
|
2128
|
+
if (!(s === "1" && A(a)) && !d) {
|
|
2129
|
+
for (let c = 0; c < p.length; c++)
|
|
2130
|
+
if (p[c]) {
|
|
2131
|
+
r = p[c];
|
|
2132
2132
|
break;
|
|
2133
2133
|
}
|
|
2134
2134
|
}
|
|
2135
|
-
} else i.charAt(0) === "+" &&
|
|
2136
|
-
return
|
|
2135
|
+
} else i.charAt(0) === "+" && a.length ? r = "" : (!i || i === "+") && !this.selectedCountryData.iso2 && (r = this.defaultCountry);
|
|
2136
|
+
return r !== null ? this._setCountry(r) : !1;
|
|
2137
2137
|
}
|
|
2138
2138
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2139
2139
|
_highlightListItem(t, e) {
|
|
@@ -2160,12 +2160,12 @@ class j {
|
|
|
2160
2160
|
_setCountry(t) {
|
|
2161
2161
|
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2162
2162
|
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2163
|
-
let
|
|
2164
|
-
t && i ? (
|
|
2163
|
+
let o = "", a = "";
|
|
2164
|
+
t && i ? (o = `iti__flag iti__${t}`, a = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (o = "iti__flag iti__globe", a = s.noCountrySelected), this.selectedCountryInner.className = o, this.selectedCountryA11yText.textContent = a;
|
|
2165
2165
|
}
|
|
2166
2166
|
if (this._setSelectedCountryTitleAttribute(t, e), e) {
|
|
2167
|
-
const
|
|
2168
|
-
this.selectedDialCode.innerHTML =
|
|
2167
|
+
const o = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2168
|
+
this.selectedDialCode.innerHTML = o, this._updateInputPadding();
|
|
2169
2169
|
}
|
|
2170
2170
|
return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !== t;
|
|
2171
2171
|
}
|
|
@@ -2179,19 +2179,19 @@ class j {
|
|
|
2179
2179
|
//* Update the maximum valid number length for the currently selected country.
|
|
2180
2180
|
_updateMaxLength() {
|
|
2181
2181
|
const { strictMode: t, placeholderNumberType: e, validationNumberType: i } = this.options;
|
|
2182
|
-
if (t &&
|
|
2182
|
+
if (t && l.utils)
|
|
2183
2183
|
if (this.selectedCountryData.iso2) {
|
|
2184
|
-
const s =
|
|
2185
|
-
let n =
|
|
2184
|
+
const s = l.utils.numberType[e];
|
|
2185
|
+
let n = l.utils.getExampleNumber(
|
|
2186
2186
|
this.selectedCountryData.iso2,
|
|
2187
2187
|
!1,
|
|
2188
2188
|
s,
|
|
2189
2189
|
!0
|
|
2190
|
-
),
|
|
2191
|
-
for (;
|
|
2192
|
-
|
|
2193
|
-
const
|
|
2194
|
-
this.maxCoreNumberLength =
|
|
2190
|
+
), o = n;
|
|
2191
|
+
for (; l.utils.isPossibleNumber(n, this.selectedCountryData.iso2, i); )
|
|
2192
|
+
o = n, n += "0";
|
|
2193
|
+
const a = l.utils.getCoreNumber(o, this.selectedCountryData.iso2);
|
|
2194
|
+
this.maxCoreNumberLength = a.length;
|
|
2195
2195
|
} else
|
|
2196
2196
|
this.maxCoreNumberLength = null;
|
|
2197
2197
|
}
|
|
@@ -2226,14 +2226,14 @@ class j {
|
|
|
2226
2226
|
nationalMode: i,
|
|
2227
2227
|
customPlaceholder: s
|
|
2228
2228
|
} = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
|
|
2229
|
-
if (
|
|
2230
|
-
const
|
|
2231
|
-
let
|
|
2229
|
+
if (l.utils && n) {
|
|
2230
|
+
const o = l.utils.numberType[e];
|
|
2231
|
+
let a = this.selectedCountryData.iso2 ? l.utils.getExampleNumber(
|
|
2232
2232
|
this.selectedCountryData.iso2,
|
|
2233
2233
|
i,
|
|
2234
|
-
|
|
2234
|
+
o
|
|
2235
2235
|
) : "";
|
|
2236
|
-
|
|
2236
|
+
a = this._beforeSetNumber(a), typeof s == "function" && (a = s(a, this.selectedCountryData)), this.telInput.setAttribute("placeholder", a);
|
|
2237
2237
|
}
|
|
2238
2238
|
}
|
|
2239
2239
|
//* Called when the user selects a list item from the dropdown.
|
|
@@ -2255,12 +2255,12 @@ class j {
|
|
|
2255
2255
|
}
|
|
2256
2256
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2257
2257
|
_scrollTo(t) {
|
|
2258
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i,
|
|
2259
|
-
if (
|
|
2260
|
-
e.scrollTop =
|
|
2261
|
-
else if (p >
|
|
2262
|
-
const
|
|
2263
|
-
e.scrollTop =
|
|
2258
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, a = t.offsetHeight, r = t.getBoundingClientRect().top + i, p = r + a, d = r - n + e.scrollTop;
|
|
2259
|
+
if (r < n)
|
|
2260
|
+
e.scrollTop = d;
|
|
2261
|
+
else if (p > o) {
|
|
2262
|
+
const C = s - a;
|
|
2263
|
+
e.scrollTop = d - C;
|
|
2264
2264
|
}
|
|
2265
2265
|
}
|
|
2266
2266
|
//* Replace any existing dial code with the new one
|
|
@@ -2280,9 +2280,9 @@ class j {
|
|
|
2280
2280
|
if (t.charAt(0) === "+") {
|
|
2281
2281
|
let s = "";
|
|
2282
2282
|
for (let n = 0; n < t.length; n++) {
|
|
2283
|
-
const
|
|
2284
|
-
if (!isNaN(parseInt(
|
|
2285
|
-
if (s +=
|
|
2283
|
+
const o = t.charAt(n);
|
|
2284
|
+
if (!isNaN(parseInt(o, 10))) {
|
|
2285
|
+
if (s += o, e)
|
|
2286
2286
|
this.dialCodeToIso2Map[s] && (i = t.substr(0, n + 1));
|
|
2287
2287
|
else if (this.dialCodes[s]) {
|
|
2288
2288
|
i = t.substr(0, n + 1);
|
|
@@ -2321,7 +2321,7 @@ class j {
|
|
|
2321
2321
|
}
|
|
2322
2322
|
//* Format the number as the user types.
|
|
2323
2323
|
_formatNumberAsYouType() {
|
|
2324
|
-
const t = this._getFullNumber(), e =
|
|
2324
|
+
const t = this._getFullNumber(), e = l.utils ? l.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
|
|
2325
2325
|
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && e.includes(`+${i}`) ? (e.split(`+${i}`)[1] || "").trim() : e;
|
|
2326
2326
|
}
|
|
2327
2327
|
//**************************
|
|
@@ -2329,18 +2329,18 @@ class j {
|
|
|
2329
2329
|
//**************************
|
|
2330
2330
|
//* This is called when the geoip call returns.
|
|
2331
2331
|
handleAutoCountry() {
|
|
2332
|
-
this.options.initialCountry === "auto" &&
|
|
2332
|
+
this.options.initialCountry === "auto" && l.autoCountry && (this.defaultCountry = l.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2333
2333
|
}
|
|
2334
2334
|
//* This is called when the utils request completes.
|
|
2335
2335
|
handleUtils() {
|
|
2336
|
-
|
|
2336
|
+
l.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2337
2337
|
}
|
|
2338
2338
|
//********************
|
|
2339
2339
|
//* PUBLIC METHODS
|
|
2340
2340
|
//********************
|
|
2341
2341
|
//* Remove plugin.
|
|
2342
2342
|
destroy() {
|
|
2343
|
-
var n,
|
|
2343
|
+
var n, o;
|
|
2344
2344
|
const { allowDropdown: t, separateDialCode: e } = this.options;
|
|
2345
2345
|
if (t) {
|
|
2346
2346
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
@@ -2350,26 +2350,26 @@ class j {
|
|
|
2350
2350
|
"keydown",
|
|
2351
2351
|
this._handleCountryContainerKeydown
|
|
2352
2352
|
);
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2353
|
+
const a = this.telInput.closest("label");
|
|
2354
|
+
a && a.removeEventListener("click", this._handleLabelClick);
|
|
2355
2355
|
}
|
|
2356
2356
|
const { form: i } = this.telInput;
|
|
2357
2357
|
this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), e && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2358
2358
|
const s = this.telInput.parentNode;
|
|
2359
|
-
(n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (
|
|
2359
|
+
(n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (o = s == null ? void 0 : s.parentNode) == null || o.removeChild(s), delete l.instances[this.id];
|
|
2360
2360
|
}
|
|
2361
2361
|
//* Get the extension from the current number.
|
|
2362
2362
|
getExtension() {
|
|
2363
|
-
return
|
|
2363
|
+
return l.utils ? l.utils.getExtension(
|
|
2364
2364
|
this._getFullNumber(),
|
|
2365
2365
|
this.selectedCountryData.iso2
|
|
2366
2366
|
) : "";
|
|
2367
2367
|
}
|
|
2368
2368
|
//* Format the number to the given format.
|
|
2369
2369
|
getNumber(t) {
|
|
2370
|
-
if (
|
|
2370
|
+
if (l.utils) {
|
|
2371
2371
|
const { iso2: e } = this.selectedCountryData;
|
|
2372
|
-
return
|
|
2372
|
+
return l.utils.formatNumber(
|
|
2373
2373
|
this._getFullNumber(),
|
|
2374
2374
|
e,
|
|
2375
2375
|
t
|
|
@@ -2379,7 +2379,7 @@ class j {
|
|
|
2379
2379
|
}
|
|
2380
2380
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2381
2381
|
getNumberType() {
|
|
2382
|
-
return
|
|
2382
|
+
return l.utils ? l.utils.getNumberType(
|
|
2383
2383
|
this._getFullNumber(),
|
|
2384
2384
|
this.selectedCountryData.iso2
|
|
2385
2385
|
) : -99;
|
|
@@ -2390,9 +2390,9 @@ class j {
|
|
|
2390
2390
|
}
|
|
2391
2391
|
//* Get the validation error.
|
|
2392
2392
|
getValidationError() {
|
|
2393
|
-
if (
|
|
2393
|
+
if (l.utils) {
|
|
2394
2394
|
const { iso2: t } = this.selectedCountryData;
|
|
2395
|
-
return
|
|
2395
|
+
return l.utils.getValidationError(this._getFullNumber(), t);
|
|
2396
2396
|
}
|
|
2397
2397
|
return -99;
|
|
2398
2398
|
}
|
|
@@ -2408,7 +2408,7 @@ class j {
|
|
|
2408
2408
|
return this._utilsIsPossibleNumber(t);
|
|
2409
2409
|
}
|
|
2410
2410
|
_utilsIsPossibleNumber(t) {
|
|
2411
|
-
return
|
|
2411
|
+
return l.utils ? l.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
|
|
2412
2412
|
}
|
|
2413
2413
|
//* Validate the input val (precise)
|
|
2414
2414
|
isValidNumberPrecise() {
|
|
@@ -2422,7 +2422,7 @@ class j {
|
|
|
2422
2422
|
return this._utilsIsValidNumber(t);
|
|
2423
2423
|
}
|
|
2424
2424
|
_utilsIsValidNumber(t) {
|
|
2425
|
-
return
|
|
2425
|
+
return l.utils ? l.utils.isValidNumber(t, this.selectedCountryData.iso2) : null;
|
|
2426
2426
|
}
|
|
2427
2427
|
//* Update the selected country, and update the input val accordingly.
|
|
2428
2428
|
setCountry(t) {
|
|
@@ -2442,40 +2442,40 @@ class j {
|
|
|
2442
2442
|
this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2443
2443
|
}
|
|
2444
2444
|
}
|
|
2445
|
-
const
|
|
2445
|
+
const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUtilsScript = !0, new Promise((t, e) => {
|
|
2446
2446
|
import(
|
|
2447
2447
|
/* webpackIgnore: true */
|
|
2448
2448
|
/* @vite-ignore */
|
|
2449
|
-
|
|
2449
|
+
u
|
|
2450
2450
|
).then(({ default: i }) => {
|
|
2451
|
-
|
|
2451
|
+
l.utils = i, _("handleUtils"), t(!0);
|
|
2452
2452
|
}).catch(() => {
|
|
2453
2453
|
_("rejectUtilsScriptPromise"), e();
|
|
2454
2454
|
});
|
|
2455
|
-
})) : null,
|
|
2456
|
-
(
|
|
2457
|
-
const e = new
|
|
2458
|
-
return e._init(),
|
|
2455
|
+
})) : null, l = Object.assign(
|
|
2456
|
+
(u, t) => {
|
|
2457
|
+
const e = new K(u, t);
|
|
2458
|
+
return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, e;
|
|
2459
2459
|
},
|
|
2460
2460
|
{
|
|
2461
|
-
defaults:
|
|
2461
|
+
defaults: k,
|
|
2462
2462
|
//* Using a static var like this allows us to mock it in the tests.
|
|
2463
2463
|
documentReady: () => document.readyState === "complete",
|
|
2464
2464
|
//* Get the country data object.
|
|
2465
|
-
getCountryData: () =>
|
|
2465
|
+
getCountryData: () => b,
|
|
2466
2466
|
//* A getter for the plugin instance.
|
|
2467
|
-
getInstance: (
|
|
2468
|
-
const t =
|
|
2469
|
-
return t ?
|
|
2467
|
+
getInstance: (u) => {
|
|
2468
|
+
const t = u.getAttribute("data-intl-tel-input-id");
|
|
2469
|
+
return t ? l.instances[t] : null;
|
|
2470
2470
|
},
|
|
2471
2471
|
//* A map from instance ID to instance object.
|
|
2472
2472
|
instances: {},
|
|
2473
|
-
loadUtils:
|
|
2473
|
+
loadUtils: U,
|
|
2474
2474
|
version: process.env.VERSION
|
|
2475
2475
|
}
|
|
2476
|
-
),
|
|
2476
|
+
), G = {
|
|
2477
2477
|
__name: "IntlTelInput",
|
|
2478
|
-
props: /* @__PURE__ */
|
|
2478
|
+
props: /* @__PURE__ */ L({
|
|
2479
2479
|
options: {
|
|
2480
2480
|
type: Object,
|
|
2481
2481
|
default: () => ({})
|
|
@@ -2494,41 +2494,41 @@ const K = (l) => !r.utils && !r.startedLoadingUtilsScript ? (r.startedLoadingUti
|
|
|
2494
2494
|
},
|
|
2495
2495
|
modelModifiers: {}
|
|
2496
2496
|
}),
|
|
2497
|
-
emits: /* @__PURE__ */
|
|
2498
|
-
setup(
|
|
2499
|
-
const i =
|
|
2500
|
-
let
|
|
2501
|
-
|
|
2502
|
-
}, c = () => {
|
|
2503
|
-
var d;
|
|
2504
|
-
n("changeNumber", ((d = o.value) == null ? void 0 : d.getNumber()) ?? ""), h();
|
|
2497
|
+
emits: /* @__PURE__ */ L(["changeNumber", "changeCountry", "changeValidity", "changeErrorCode"], ["update:modelValue"]),
|
|
2498
|
+
setup(u, { expose: t, emit: e }) {
|
|
2499
|
+
const i = T(u, "modelValue"), s = u, n = e, o = w(), a = w(), r = w(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, d = () => {
|
|
2500
|
+
let h = p();
|
|
2501
|
+
r.value !== h && (r.value = h, n("changeValidity", !!h), n("changeErrorCode", h ? null : a.value.getValidationError()));
|
|
2505
2502
|
}, C = () => {
|
|
2506
|
-
var
|
|
2507
|
-
n("
|
|
2503
|
+
var h;
|
|
2504
|
+
n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""), d();
|
|
2505
|
+
}, c = () => {
|
|
2506
|
+
var h;
|
|
2507
|
+
n("changeCountry", ((h = a.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""), C(), d();
|
|
2508
2508
|
};
|
|
2509
|
-
return
|
|
2510
|
-
|
|
2511
|
-
}),
|
|
2509
|
+
return P(() => {
|
|
2510
|
+
o.value && (a.value = l(o.value, s.options), s.value && a.value.setNumber(s.value), s.disabled && a.value.setDisabled(s.disabled));
|
|
2511
|
+
}), x(
|
|
2512
2512
|
() => s.disabled,
|
|
2513
|
-
(
|
|
2513
|
+
(h) => {
|
|
2514
2514
|
var y;
|
|
2515
|
-
return (y =
|
|
2515
|
+
return (y = a.value) == null ? void 0 : y.setDisabled(h);
|
|
2516
2516
|
}
|
|
2517
|
-
),
|
|
2518
|
-
var
|
|
2519
|
-
return (
|
|
2520
|
-
}), t({ instance:
|
|
2517
|
+
), E(() => {
|
|
2518
|
+
var h;
|
|
2519
|
+
return (h = a.value) == null ? void 0 : h.destroy();
|
|
2520
|
+
}), t({ instance: a, input: o }), (h, y) => M((B(), O("input", {
|
|
2521
2521
|
ref_key: "input",
|
|
2522
|
-
ref:
|
|
2522
|
+
ref: o,
|
|
2523
2523
|
"onUpdate:modelValue": y[0] || (y[0] = (f) => i.value = f),
|
|
2524
2524
|
type: "tel",
|
|
2525
|
-
onCountrychange:
|
|
2526
|
-
onInput:
|
|
2525
|
+
onCountrychange: c,
|
|
2526
|
+
onInput: C
|
|
2527
2527
|
}, null, 544)), [
|
|
2528
|
-
[
|
|
2528
|
+
[V, i.value]
|
|
2529
2529
|
]);
|
|
2530
2530
|
}
|
|
2531
2531
|
};
|
|
2532
2532
|
export {
|
|
2533
|
-
|
|
2533
|
+
G as default
|
|
2534
2534
|
};
|