intl-tel-input 25.0.1 → 25.0.2
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 +9 -9
- package/build/js/data.js +3 -3
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +5 -1
- package/build/js/intlTelInput.js +38 -9
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +38 -9
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +37 -8
- package/react/build/IntlTelInput.d.ts +5 -1
- package/react/build/IntlTelInput.js +37 -8
- package/react/build/IntlTelInputWithUtils.cjs +37 -8
- package/react/build/IntlTelInputWithUtils.js +37 -8
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +293 -287
- package/vue/build/IntlTelInputWithUtils.mjs +337 -331
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as D, useModel as x, ref as L, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as D, useModel as x, ref as L, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as V, createElementBlock as O, mergeProps as z, vModelText as R } from "vue";
|
|
2
|
+
const A = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -9,8 +9,7 @@ const N = [
|
|
|
9
9
|
"ax",
|
|
10
10
|
// Åland Islands
|
|
11
11
|
"358",
|
|
12
|
-
1
|
|
13
|
-
["18"]
|
|
12
|
+
1
|
|
14
13
|
],
|
|
15
14
|
[
|
|
16
15
|
"al",
|
|
@@ -1306,15 +1305,16 @@ const N = [
|
|
|
1306
1305
|
"263"
|
|
1307
1306
|
]
|
|
1308
1307
|
], I = [];
|
|
1309
|
-
for (let u = 0; u <
|
|
1310
|
-
const
|
|
1308
|
+
for (let u = 0; u < A.length; u++) {
|
|
1309
|
+
const e = A[u];
|
|
1311
1310
|
I[u] = {
|
|
1312
1311
|
name: "",
|
|
1313
1312
|
// this is now populated in the plugin
|
|
1314
|
-
iso2:
|
|
1315
|
-
dialCode:
|
|
1316
|
-
priority:
|
|
1317
|
-
areaCodes:
|
|
1313
|
+
iso2: e[0],
|
|
1314
|
+
dialCode: e[1],
|
|
1315
|
+
priority: e[2] || 0,
|
|
1316
|
+
areaCodes: e[3] || null,
|
|
1317
|
+
partialAreaCodes: null,
|
|
1318
1318
|
nodeById: {}
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
@@ -1649,46 +1649,46 @@ const T = {
|
|
|
1649
1649
|
"887",
|
|
1650
1650
|
"888",
|
|
1651
1651
|
"889"
|
|
1652
|
-
], v = (u) => u.replace(/\D/g, ""),
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1655
|
-
const
|
|
1656
|
-
return K.indexOf(
|
|
1652
|
+
], v = (u) => u.replace(/\D/g, ""), N = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
|
|
1653
|
+
const e = v(u);
|
|
1654
|
+
if (e.charAt(0) === "1") {
|
|
1655
|
+
const t = e.substr(1, 3);
|
|
1656
|
+
return K.indexOf(t) !== -1;
|
|
1657
1657
|
}
|
|
1658
1658
|
return !1;
|
|
1659
|
-
}, H = (u,
|
|
1660
|
-
if (
|
|
1659
|
+
}, H = (u, e, t, i) => {
|
|
1660
|
+
if (t === 0 && !i)
|
|
1661
1661
|
return 0;
|
|
1662
1662
|
let s = 0;
|
|
1663
|
-
for (let n = 0; n <
|
|
1664
|
-
if (/[+0-9]/.test(
|
|
1663
|
+
for (let n = 0; n < e.length; n++) {
|
|
1664
|
+
if (/[+0-9]/.test(e[n]) && s++, s === u && !i)
|
|
1665
1665
|
return n + 1;
|
|
1666
1666
|
if (i && s === u + 1)
|
|
1667
1667
|
return n;
|
|
1668
1668
|
}
|
|
1669
|
-
return
|
|
1670
|
-
}, y = (u,
|
|
1669
|
+
return e.length;
|
|
1670
|
+
}, y = (u, e, t) => {
|
|
1671
1671
|
const i = document.createElement(u);
|
|
1672
|
-
return
|
|
1673
|
-
}, w = (u, ...
|
|
1674
|
-
const { instances:
|
|
1675
|
-
Object.values(
|
|
1672
|
+
return e && Object.entries(e).forEach(([s, n]) => i.setAttribute(s, n)), t && t.appendChild(i), i;
|
|
1673
|
+
}, w = (u, ...e) => {
|
|
1674
|
+
const { instances: t } = l;
|
|
1675
|
+
Object.values(t).forEach((i) => i[u](...e));
|
|
1676
1676
|
};
|
|
1677
1677
|
class G {
|
|
1678
|
-
constructor(
|
|
1679
|
-
this.id = U++, this.telInput =
|
|
1678
|
+
constructor(e, t = {}) {
|
|
1679
|
+
this.id = U++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, T, t), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
1680
1680
|
}
|
|
1681
1681
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1682
|
_init() {
|
|
1683
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
|
-
const
|
|
1685
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !
|
|
1686
|
-
const
|
|
1684
|
+
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1685
|
+
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...k, ...this.options.i18n };
|
|
1686
|
+
const t = new Promise((s, n) => {
|
|
1687
1687
|
this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = n;
|
|
1688
1688
|
}), i = new Promise((s, n) => {
|
|
1689
1689
|
this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = n;
|
|
1690
1690
|
});
|
|
1691
|
-
this.promise = Promise.all([
|
|
1691
|
+
this.promise = Promise.all([t, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1692
1692
|
}
|
|
1693
1693
|
//********************
|
|
1694
1694
|
//* PRIVATE METHODS
|
|
@@ -1699,37 +1699,37 @@ class G {
|
|
|
1699
1699
|
}
|
|
1700
1700
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1701
1701
|
_sortCountries() {
|
|
1702
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((
|
|
1702
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, t) => {
|
|
1703
1703
|
const { countryOrder: i } = this.options;
|
|
1704
1704
|
if (i) {
|
|
1705
|
-
const s = i.indexOf(
|
|
1705
|
+
const s = i.indexOf(e.iso2), n = i.indexOf(t.iso2), o = s > -1, a = n > -1;
|
|
1706
1706
|
if (o || a)
|
|
1707
1707
|
return o && a ? s - n : o ? -1 : 1;
|
|
1708
1708
|
}
|
|
1709
|
-
return
|
|
1709
|
+
return e.name.localeCompare(t.name);
|
|
1710
1710
|
});
|
|
1711
1711
|
}
|
|
1712
1712
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1713
|
-
_addToDialCodeMap(
|
|
1714
|
-
|
|
1715
|
-
for (let n = 0; n < this.dialCodeToIso2Map[
|
|
1716
|
-
if (this.dialCodeToIso2Map[
|
|
1713
|
+
_addToDialCodeMap(e, t, i) {
|
|
1714
|
+
t.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = t.length), this.dialCodeToIso2Map.hasOwnProperty(t) || (this.dialCodeToIso2Map[t] = []);
|
|
1715
|
+
for (let n = 0; n < this.dialCodeToIso2Map[t].length; n++)
|
|
1716
|
+
if (this.dialCodeToIso2Map[t][n] === e)
|
|
1717
1717
|
return;
|
|
1718
|
-
const s = i !== void 0 ? i : this.dialCodeToIso2Map[
|
|
1719
|
-
this.dialCodeToIso2Map[
|
|
1718
|
+
const s = i !== void 0 ? i : this.dialCodeToIso2Map[t].length;
|
|
1719
|
+
this.dialCodeToIso2Map[t][s] = e;
|
|
1720
1720
|
}
|
|
1721
1721
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1722
1722
|
_processAllCountries() {
|
|
1723
|
-
const { onlyCountries:
|
|
1724
|
-
if (
|
|
1725
|
-
const i =
|
|
1723
|
+
const { onlyCountries: e, excludeCountries: t } = this.options;
|
|
1724
|
+
if (e.length) {
|
|
1725
|
+
const i = e.map(
|
|
1726
1726
|
(s) => s.toLowerCase()
|
|
1727
1727
|
);
|
|
1728
1728
|
this.countries = I.filter(
|
|
1729
1729
|
(s) => i.indexOf(s.iso2) > -1
|
|
1730
1730
|
);
|
|
1731
|
-
} else if (
|
|
1732
|
-
const i =
|
|
1731
|
+
} else if (t.length) {
|
|
1732
|
+
const i = t.map(
|
|
1733
1733
|
(s) => s.toLowerCase()
|
|
1734
1734
|
);
|
|
1735
1735
|
this.countries = I.filter(
|
|
@@ -1740,40 +1740,40 @@ class G {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
//* Translate Countries by object literal provided on config.
|
|
1742
1742
|
_translateCountryNames() {
|
|
1743
|
-
for (let
|
|
1744
|
-
const
|
|
1745
|
-
this.options.i18n.hasOwnProperty(
|
|
1743
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1744
|
+
const t = this.countries[e].iso2.toLowerCase();
|
|
1745
|
+
this.options.i18n.hasOwnProperty(t) && (this.countries[e].name = this.options.i18n[t]);
|
|
1746
1746
|
}
|
|
1747
1747
|
}
|
|
1748
|
-
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1748
|
+
//* Generate this.dialCodes and this.dialCodeToIso2Map and country.partialAreaCodes.
|
|
1749
1749
|
_processDialCodes() {
|
|
1750
1750
|
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
|
|
1751
|
-
for (let
|
|
1752
|
-
const
|
|
1753
|
-
this.dialCodes[
|
|
1751
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1752
|
+
const t = this.countries[e];
|
|
1753
|
+
this.dialCodes[t.dialCode] || (this.dialCodes[t.dialCode] = !0), this._addToDialCodeMap(t.iso2, t.dialCode, t.priority);
|
|
1754
1754
|
}
|
|
1755
|
-
for (let
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
const i = this.dialCodeToIso2Map[
|
|
1759
|
-
for (let s = 0; s <
|
|
1760
|
-
const n =
|
|
1755
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1756
|
+
const t = this.countries[e];
|
|
1757
|
+
if (t.areaCodes) {
|
|
1758
|
+
const i = this.dialCodeToIso2Map[t.dialCode][0];
|
|
1759
|
+
for (let s = 0; s < t.areaCodes.length; s++) {
|
|
1760
|
+
const n = t.areaCodes[s];
|
|
1761
1761
|
for (let o = 1; o < n.length; o++) {
|
|
1762
|
-
const a =
|
|
1763
|
-
this._addToDialCodeMap(i,
|
|
1762
|
+
const a = n.substr(0, o), r = t.dialCode + a;
|
|
1763
|
+
this._addToDialCodeMap(i, r), this._addToDialCodeMap(t.iso2, r), t.partialAreaCodes || (t.partialAreaCodes = []), t.partialAreaCodes.includes(a) || t.partialAreaCodes.push(a);
|
|
1764
1764
|
}
|
|
1765
|
-
this._addToDialCodeMap(
|
|
1765
|
+
this._addToDialCodeMap(t.iso2, t.dialCode + n);
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
1768
|
}
|
|
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 d, m, b;
|
|
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
|
-
allowDropdown:
|
|
1776
|
-
separateDialCode:
|
|
1775
|
+
allowDropdown: e,
|
|
1776
|
+
separateDialCode: t,
|
|
1777
1777
|
showFlags: i,
|
|
1778
1778
|
containerClass: s,
|
|
1779
1779
|
hiddenInput: n,
|
|
@@ -1781,17 +1781,17 @@ class G {
|
|
|
1781
1781
|
fixDropdownWidth: a,
|
|
1782
1782
|
useFullscreenPopup: r,
|
|
1783
1783
|
countrySearch: p,
|
|
1784
|
-
i18n:
|
|
1784
|
+
i18n: h
|
|
1785
1785
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
|
|
1788
|
-
const C = y("div", { class:
|
|
1789
|
-
if ((
|
|
1786
|
+
let c = "iti";
|
|
1787
|
+
e && (c += " iti--allow-dropdown"), i && (c += " iti--show-flags"), s && (c += ` ${s}`), r || (c += " iti--inline-dropdown");
|
|
1788
|
+
const C = y("div", { class: c });
|
|
1789
|
+
if ((d = this.telInput.parentNode) == null || d.insertBefore(C, this.telInput), e || i || t) {
|
|
1790
1790
|
this.countryContainer = y(
|
|
1791
1791
|
"div",
|
|
1792
1792
|
{ class: "iti__country-container" },
|
|
1793
1793
|
C
|
|
1794
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px",
|
|
1794
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = y(
|
|
1795
1795
|
"button",
|
|
1796
1796
|
{
|
|
1797
1797
|
type: "button",
|
|
@@ -1813,15 +1813,15 @@ class G {
|
|
|
1813
1813
|
"span",
|
|
1814
1814
|
{ class: "iti__a11y-text" },
|
|
1815
1815
|
this.selectedCountryInner
|
|
1816
|
-
),
|
|
1816
|
+
), e && (this.dropdownArrow = y(
|
|
1817
1817
|
"div",
|
|
1818
1818
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1819
1819
|
_
|
|
1820
|
-
)),
|
|
1820
|
+
)), t && (this.selectedDialCode = y(
|
|
1821
1821
|
"div",
|
|
1822
1822
|
{ class: "iti__selected-dial-code" },
|
|
1823
1823
|
this.selectedCountry
|
|
1824
|
-
)),
|
|
1824
|
+
)), e) {
|
|
1825
1825
|
const f = a ? "" : "iti--flexible-dropdown-width";
|
|
1826
1826
|
if (this.dropdownContent = y("div", {
|
|
1827
1827
|
id: `iti-${this.id}__dropdown-content`,
|
|
@@ -1831,10 +1831,10 @@ class G {
|
|
|
1831
1831
|
{
|
|
1832
1832
|
type: "text",
|
|
1833
1833
|
class: "iti__search-input",
|
|
1834
|
-
placeholder:
|
|
1834
|
+
placeholder: h.searchPlaceholder,
|
|
1835
1835
|
role: "combobox",
|
|
1836
1836
|
"aria-expanded": "true",
|
|
1837
|
-
"aria-label":
|
|
1837
|
+
"aria-label": h.searchPlaceholder,
|
|
1838
1838
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1839
1839
|
"aria-autocomplete": "list",
|
|
1840
1840
|
autocomplete: "off"
|
|
@@ -1850,7 +1850,7 @@ class G {
|
|
|
1850
1850
|
class: "iti__country-list",
|
|
1851
1851
|
id: `iti-${this.id}__country-listbox`,
|
|
1852
1852
|
role: "listbox",
|
|
1853
|
-
"aria-label":
|
|
1853
|
+
"aria-label": h.countryListAriaLabel
|
|
1854
1854
|
},
|
|
1855
1855
|
this.dropdownContent
|
|
1856
1856
|
), this._appendListItems(), p && this._updateSearchResultsText(), o) {
|
|
@@ -1880,35 +1880,35 @@ class G {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1882
1882
|
_appendListItems() {
|
|
1883
|
-
for (let
|
|
1884
|
-
const
|
|
1883
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1884
|
+
const t = this.countries[e], i = e === 0 ? "iti__highlight" : "", s = y(
|
|
1885
1885
|
"li",
|
|
1886
1886
|
{
|
|
1887
|
-
id: `iti-${this.id}__item-${
|
|
1887
|
+
id: `iti-${this.id}__item-${t.iso2}`,
|
|
1888
1888
|
class: `iti__country ${i}`,
|
|
1889
1889
|
tabindex: "-1",
|
|
1890
1890
|
role: "option",
|
|
1891
|
-
"data-dial-code":
|
|
1892
|
-
"data-country-code":
|
|
1891
|
+
"data-dial-code": t.dialCode,
|
|
1892
|
+
"data-country-code": t.iso2,
|
|
1893
1893
|
"aria-selected": "false"
|
|
1894
1894
|
},
|
|
1895
1895
|
this.countryList
|
|
1896
1896
|
);
|
|
1897
|
-
|
|
1897
|
+
t.nodeById[this.id] = s;
|
|
1898
1898
|
let n = "";
|
|
1899
|
-
this.options.showFlags && (n += `<div class='iti__flag iti__${
|
|
1899
|
+
this.options.showFlags && (n += `<div class='iti__flag iti__${t.iso2}'></div>`), n += `<span class='iti__country-name'>${t.name}</span>`, n += `<span class='iti__dial-code'>+${t.dialCode}</span>`, s.insertAdjacentHTML("beforeend", n);
|
|
1900
1900
|
}
|
|
1901
1901
|
}
|
|
1902
1902
|
//* Set the initial state of the input value and the selected country by:
|
|
1903
1903
|
//* 1. Extracting a dial code from the given number
|
|
1904
1904
|
//* 2. Using explicit initialCountry
|
|
1905
|
-
_setInitialState(
|
|
1906
|
-
const
|
|
1905
|
+
_setInitialState(e = !1) {
|
|
1906
|
+
const t = this.telInput.getAttribute("value"), i = this.telInput.value, n = t && t.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? t : i, o = this._getDialCode(n), a = S(n), { initialCountry: r, geoIpLookup: p } = this.options, h = r === "auto" && p;
|
|
1907
1907
|
if (o && !a)
|
|
1908
1908
|
this._updateCountryFromNumber(n);
|
|
1909
|
-
else if (!
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1909
|
+
else if (!h || e) {
|
|
1910
|
+
const c = r ? r.toLowerCase() : "";
|
|
1911
|
+
c && this._getCountryData(c, !0) ? this._setCountry(c) : o && a ? this._setCountry("us") : this._setCountry();
|
|
1912
1912
|
}
|
|
1913
1913
|
n && this._updateValFromNumber(n);
|
|
1914
1914
|
}
|
|
@@ -1918,24 +1918,24 @@ class G {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
//* Update hidden input on form submit.
|
|
1920
1920
|
_initHiddenInputListener() {
|
|
1921
|
-
var
|
|
1921
|
+
var e;
|
|
1922
1922
|
this._handleHiddenInputSubmit = () => {
|
|
1923
1923
|
this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
|
|
1924
|
-
}, (
|
|
1924
|
+
}, (e = this.telInput.form) == null || e.addEventListener(
|
|
1925
1925
|
"submit",
|
|
1926
1926
|
this._handleHiddenInputSubmit
|
|
1927
1927
|
);
|
|
1928
1928
|
}
|
|
1929
1929
|
//* initialise the dropdown listeners.
|
|
1930
1930
|
_initDropdownListeners() {
|
|
1931
|
-
this._handleLabelClick = (
|
|
1932
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
1931
|
+
this._handleLabelClick = (t) => {
|
|
1932
|
+
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : t.preventDefault();
|
|
1933
1933
|
};
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1934
|
+
const e = this.telInput.closest("label");
|
|
1935
|
+
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1936
1936
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1937
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (
|
|
1938
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(
|
|
1937
|
+
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (t) => {
|
|
1938
|
+
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(t.key) && (t.preventDefault(), t.stopPropagation(), this._openDropdown()), t.key === "Tab" && this._closeDropdown();
|
|
1939
1939
|
}, this.countryContainer.addEventListener(
|
|
1940
1940
|
"keydown",
|
|
1941
1941
|
this._handleCountryContainerKeydown
|
|
@@ -1943,19 +1943,19 @@ class G {
|
|
|
1943
1943
|
}
|
|
1944
1944
|
//* Init many requests: utils script / geo ip lookup.
|
|
1945
1945
|
_initRequests() {
|
|
1946
|
-
let { loadUtils:
|
|
1947
|
-
|
|
1946
|
+
let { loadUtils: e, initialCountry: t, geoIpLookup: i } = this.options;
|
|
1947
|
+
e && !l.utils ? (this._handlePageLoad = () => {
|
|
1948
1948
|
var n;
|
|
1949
|
-
window.removeEventListener("load", this._handlePageLoad), (n = l.attachUtils(
|
|
1949
|
+
window.removeEventListener("load", this._handlePageLoad), (n = l.attachUtils(e)) == null || n.catch(() => {
|
|
1950
1950
|
});
|
|
1951
|
-
}, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(),
|
|
1951
|
+
}, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), t === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1952
1952
|
}
|
|
1953
1953
|
//* Perform the geo ip lookup.
|
|
1954
1954
|
_loadAutoCountry() {
|
|
1955
1955
|
l.autoCountry ? this.handleAutoCountry() : l.startedLoadingAutoCountry || (l.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1956
|
-
(
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1956
|
+
(e = "") => {
|
|
1957
|
+
const t = e.toLowerCase();
|
|
1958
|
+
t && this._getCountryData(t, !0) ? (l.autoCountry = t, setTimeout(() => w("handleAutoCountry"))) : (this._setInitialState(!0), w("rejectAutoCountryPromise"));
|
|
1959
1959
|
},
|
|
1960
1960
|
() => {
|
|
1961
1961
|
this._setInitialState(!0), w("rejectAutoCountryPromise");
|
|
@@ -1967,58 +1967,58 @@ class G {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
//* Initialize the tel input listeners.
|
|
1969
1969
|
_initTelInputListeners() {
|
|
1970
|
-
const { strictMode:
|
|
1970
|
+
const { strictMode: e, formatAsYouType: t, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: o } = this.options;
|
|
1971
1971
|
let a = !1;
|
|
1972
1972
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (r) => {
|
|
1973
1973
|
if (this.isAndroid && (r == null ? void 0 : r.data) === "+" && i && n && o) {
|
|
1974
|
-
const C = this.telInput.selectionStart || 0,
|
|
1975
|
-
this.telInput.value =
|
|
1974
|
+
const C = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, C - 1), m = this.telInput.value.substring(C);
|
|
1975
|
+
this.telInput.value = d + m, this._openDropdownWithPlus();
|
|
1976
1976
|
return;
|
|
1977
1977
|
}
|
|
1978
1978
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1979
|
-
const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data),
|
|
1980
|
-
p ||
|
|
1981
|
-
const
|
|
1982
|
-
if (
|
|
1979
|
+
const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data), h = (r == null ? void 0 : r.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1980
|
+
p || h && !e ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
|
|
1981
|
+
const c = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
|
|
1982
|
+
if (t && !a && !c) {
|
|
1983
1983
|
const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, b = (r == null ? void 0 : r.inputType) === "deleteContentForward", _ = this._formatNumberAsYouType(), f = H(m, _, C, b);
|
|
1984
1984
|
this.telInput.value = _, this.telInput.setSelectionRange(f, f);
|
|
1985
1985
|
}
|
|
1986
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (
|
|
1986
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || i) && (this._handleKeydownEvent = (r) => {
|
|
1987
1987
|
if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
|
|
1988
1988
|
if (i && n && o && r.key === "+") {
|
|
1989
1989
|
r.preventDefault(), this._openDropdownWithPlus();
|
|
1990
1990
|
return;
|
|
1991
1991
|
}
|
|
1992
|
-
if (
|
|
1993
|
-
const p = this.telInput.value,
|
|
1992
|
+
if (e) {
|
|
1993
|
+
const p = this.telInput.value, h = p.charAt(0) === "+", c = !h && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), d = i ? C : c || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), b = this._getFullNumber(m), _ = l.utils.getCoreNumber(b, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && _.length > this.maxCoreNumberLength;
|
|
1994
1994
|
let g = !1;
|
|
1995
|
-
if (
|
|
1995
|
+
if (h) {
|
|
1996
1996
|
const P = this.selectedCountryData.iso2;
|
|
1997
1997
|
g = this._getCountryFromNumber(b) !== P;
|
|
1998
1998
|
}
|
|
1999
|
-
(!
|
|
1999
|
+
(!d || f && !g && !c) && r.preventDefault();
|
|
2000
2000
|
}
|
|
2001
2001
|
}
|
|
2002
2002
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
2003
2003
|
}
|
|
2004
2004
|
//* Adhere to the input's maxlength attr.
|
|
2005
|
-
_cap(
|
|
2006
|
-
const
|
|
2007
|
-
return
|
|
2005
|
+
_cap(e) {
|
|
2006
|
+
const t = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2007
|
+
return t && e.length > t ? e.substr(0, t) : e;
|
|
2008
2008
|
}
|
|
2009
2009
|
//* Trigger a custom event on the input.
|
|
2010
|
-
_trigger(
|
|
2011
|
-
const i = new CustomEvent(
|
|
2010
|
+
_trigger(e, t = {}) {
|
|
2011
|
+
const i = new CustomEvent(e, {
|
|
2012
2012
|
bubbles: !0,
|
|
2013
2013
|
cancelable: !0,
|
|
2014
|
-
detail:
|
|
2014
|
+
detail: t
|
|
2015
2015
|
});
|
|
2016
2016
|
this.telInput.dispatchEvent(i);
|
|
2017
2017
|
}
|
|
2018
2018
|
//* Open the dropdown.
|
|
2019
2019
|
_openDropdown() {
|
|
2020
|
-
const { fixDropdownWidth:
|
|
2021
|
-
if (
|
|
2020
|
+
const { fixDropdownWidth: e, countrySearch: t } = this.options;
|
|
2021
|
+
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), t) {
|
|
2022
2022
|
const i = this.countryList.firstElementChild;
|
|
2023
2023
|
i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2024
2024
|
}
|
|
@@ -2027,8 +2027,8 @@ class G {
|
|
|
2027
2027
|
//* Set the dropdown position
|
|
2028
2028
|
_setDropdownPosition() {
|
|
2029
2029
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2030
|
-
const
|
|
2031
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${
|
|
2030
|
+
const e = this.telInput.getBoundingClientRect(), t = this.telInput.offsetHeight;
|
|
2031
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + t}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2032
2032
|
}
|
|
2033
2033
|
}
|
|
2034
2034
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
@@ -2045,17 +2045,17 @@ class G {
|
|
|
2045
2045
|
const n = (o = s.target) == null ? void 0 : o.closest(".iti__country");
|
|
2046
2046
|
n && this._selectListItem(n);
|
|
2047
2047
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2048
|
-
let
|
|
2048
|
+
let e = !0;
|
|
2049
2049
|
this._handleClickOffToClose = () => {
|
|
2050
|
-
|
|
2050
|
+
e || this._closeDropdown(), e = !1;
|
|
2051
2051
|
}, document.documentElement.addEventListener(
|
|
2052
2052
|
"click",
|
|
2053
2053
|
this._handleClickOffToClose
|
|
2054
2054
|
);
|
|
2055
|
-
let
|
|
2055
|
+
let t = "", i = null;
|
|
2056
2056
|
if (this._handleKeydownOnDropdown = (s) => {
|
|
2057
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(s.key) && (s.preventDefault(), s.stopPropagation(), s.key === "ArrowUp" || s.key === "ArrowDown" ? this._handleUpDownKey(s.key) : s.key === "Enter" ? this._handleEnterKey() : s.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key) && (s.stopPropagation(), i && clearTimeout(i),
|
|
2058
|
-
|
|
2057
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(s.key) && (s.preventDefault(), s.stopPropagation(), s.key === "ArrowUp" || s.key === "ArrowDown" ? this._handleUpDownKey(s.key) : s.key === "Enter" ? this._handleEnterKey() : s.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key) && (s.stopPropagation(), i && clearTimeout(i), t += s.key.toLowerCase(), this._searchForCountry(t), i = setTimeout(() => {
|
|
2058
|
+
t = "";
|
|
2059
2059
|
}, 1e3));
|
|
2060
2060
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2061
2061
|
const s = () => {
|
|
@@ -2071,10 +2071,10 @@ class G {
|
|
|
2071
2071
|
}
|
|
2072
2072
|
}
|
|
2073
2073
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2074
|
-
_searchForCountry(
|
|
2075
|
-
for (let
|
|
2076
|
-
const i = this.countries[
|
|
2077
|
-
if (i.name.substr(0,
|
|
2074
|
+
_searchForCountry(e) {
|
|
2075
|
+
for (let t = 0; t < this.countries.length; t++) {
|
|
2076
|
+
const i = this.countries[t];
|
|
2077
|
+
if (i.name.substr(0, e.length).toLowerCase() === e) {
|
|
2078
2078
|
const n = i.nodeById[this.id];
|
|
2079
2079
|
this._highlightListItem(n, !1), this._scrollTo(n);
|
|
2080
2080
|
break;
|
|
@@ -2082,30 +2082,30 @@ class G {
|
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2085
|
-
_filterCountries(
|
|
2085
|
+
_filterCountries(e, t = !1) {
|
|
2086
2086
|
let i = !0;
|
|
2087
2087
|
this.countryList.innerHTML = "";
|
|
2088
|
-
const s =
|
|
2088
|
+
const s = N(e);
|
|
2089
2089
|
for (let n = 0; n < this.countries.length; n++) {
|
|
2090
|
-
const o = this.countries[n], a =
|
|
2091
|
-
if (
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2090
|
+
const o = this.countries[n], a = N(o.name), r = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((h) => h[0]).join("").toLowerCase(), p = `+${o.dialCode}`;
|
|
2091
|
+
if (t || a.includes(s) || p.includes(s) || o.iso2.includes(s) || r.includes(s)) {
|
|
2092
|
+
const h = o.nodeById[this.id];
|
|
2093
|
+
h && this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1);
|
|
2094
2094
|
}
|
|
2095
2095
|
}
|
|
2096
2096
|
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2097
2097
|
}
|
|
2098
2098
|
//* Update search results text (for a11y).
|
|
2099
2099
|
_updateSearchResultsText() {
|
|
2100
|
-
const { i18n:
|
|
2100
|
+
const { i18n: e } = this.options, t = this.countryList.childElementCount;
|
|
2101
2101
|
let i;
|
|
2102
|
-
|
|
2102
|
+
t === 0 ? i = e.zeroSearchResults : t === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", t.toString()), this.searchResultsA11yText.textContent = i;
|
|
2103
2103
|
}
|
|
2104
2104
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2105
|
-
_handleUpDownKey(
|
|
2105
|
+
_handleUpDownKey(e) {
|
|
2106
2106
|
var i, s;
|
|
2107
|
-
let
|
|
2108
|
-
!
|
|
2107
|
+
let t = e === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.highlightedItem) == null ? void 0 : s.nextElementSibling;
|
|
2108
|
+
!t && this.countryList.childElementCount > 1 && (t = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), t && (this._scrollTo(t), this._highlightListItem(t, !1));
|
|
2109
2109
|
}
|
|
2110
2110
|
//* Select the currently highlighted item.
|
|
2111
2111
|
_handleEnterKey() {
|
|
@@ -2113,36 +2113,42 @@ class G {
|
|
|
2113
2113
|
}
|
|
2114
2114
|
//* Update the input's value to the given val (format first if possible)
|
|
2115
2115
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2116
|
-
_updateValFromNumber(
|
|
2117
|
-
let
|
|
2116
|
+
_updateValFromNumber(e) {
|
|
2117
|
+
let t = e;
|
|
2118
2118
|
if (this.options.formatOnDisplay && l.utils && this.selectedCountryData) {
|
|
2119
|
-
const i = this.options.nationalMode ||
|
|
2120
|
-
|
|
2121
|
-
|
|
2119
|
+
const i = this.options.nationalMode || t.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = l.utils.numberFormat, o = i ? s : n;
|
|
2120
|
+
t = l.utils.formatNumber(
|
|
2121
|
+
t,
|
|
2122
2122
|
this.selectedCountryData.iso2,
|
|
2123
2123
|
o
|
|
2124
2124
|
);
|
|
2125
2125
|
}
|
|
2126
|
-
|
|
2126
|
+
t = this._beforeSetNumber(t), this.telInput.value = t;
|
|
2127
2127
|
}
|
|
2128
2128
|
//* Check if need to select a new country based on the given number
|
|
2129
2129
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2130
|
-
_updateCountryFromNumber(
|
|
2131
|
-
const
|
|
2132
|
-
return
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2130
|
+
_updateCountryFromNumber(e) {
|
|
2131
|
+
const t = this._getCountryFromNumber(e);
|
|
2132
|
+
return t !== null ? this._setCountry(t) : !1;
|
|
2133
|
+
}
|
|
2134
|
+
//* Check if the given number matches an area code from the selected country.
|
|
2135
|
+
_isAreaCodeMatch(e, t) {
|
|
2136
|
+
const { areaCodes: i, partialAreaCodes: s, dialCode: n } = this.selectedCountryData, o = e.substring(n.length), a = t.substring(n.length);
|
|
2137
|
+
return !!(i.includes(a) || s.includes(o));
|
|
2138
|
+
}
|
|
2139
|
+
_getCountryFromNumber(e) {
|
|
2140
|
+
const t = e.indexOf("+");
|
|
2141
|
+
let i = t ? e.substring(t) : e;
|
|
2137
2142
|
const s = this.selectedCountryData.dialCode;
|
|
2138
2143
|
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}`);
|
|
2139
2144
|
const o = this._getDialCode(i, !0), a = v(i);
|
|
2140
2145
|
if (o) {
|
|
2141
|
-
const r =
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
+
const r = v(o), p = this.dialCodeToIso2Map[r], h = this.selectedCountryData.iso2 && p.includes(this.selectedCountryData.iso2);
|
|
2147
|
+
let c = !1;
|
|
2148
|
+
if (h && (this.selectedCountryData.areaCodes && a.length > s.length ? c = this._isAreaCodeMatch(a, r) : c = !0), !(s === "1" && S(a)) && (!h || !c)) {
|
|
2149
|
+
for (let d = 0; d < p.length; d++)
|
|
2150
|
+
if (p[d])
|
|
2151
|
+
return p[d];
|
|
2146
2152
|
}
|
|
2147
2153
|
} else {
|
|
2148
2154
|
if (i.charAt(0) === "+" && a.length)
|
|
@@ -2153,52 +2159,52 @@ class G {
|
|
|
2153
2159
|
return null;
|
|
2154
2160
|
}
|
|
2155
2161
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2156
|
-
_highlightListItem(
|
|
2162
|
+
_highlightListItem(e, t) {
|
|
2157
2163
|
const i = this.highlightedItem;
|
|
2158
|
-
if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem =
|
|
2164
|
+
if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
|
|
2159
2165
|
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
|
|
2160
2166
|
const s = this.highlightedItem.getAttribute("id") || "";
|
|
2161
2167
|
this.selectedCountry.setAttribute("aria-activedescendant", s), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", s);
|
|
2162
2168
|
}
|
|
2163
|
-
|
|
2169
|
+
t && this.highlightedItem.focus();
|
|
2164
2170
|
}
|
|
2165
2171
|
//* Find the country data for the given iso2 code
|
|
2166
2172
|
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
|
2167
|
-
_getCountryData(
|
|
2173
|
+
_getCountryData(e, t) {
|
|
2168
2174
|
for (let i = 0; i < this.countries.length; i++)
|
|
2169
|
-
if (this.countries[i].iso2 ===
|
|
2175
|
+
if (this.countries[i].iso2 === e)
|
|
2170
2176
|
return this.countries[i];
|
|
2171
|
-
if (
|
|
2177
|
+
if (t)
|
|
2172
2178
|
return null;
|
|
2173
|
-
throw new Error(`No country data for '${
|
|
2179
|
+
throw new Error(`No country data for '${e}'`);
|
|
2174
2180
|
}
|
|
2175
2181
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2176
2182
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2177
|
-
_setCountry(
|
|
2178
|
-
const { separateDialCode:
|
|
2179
|
-
if (this.selectedCountryData =
|
|
2183
|
+
_setCountry(e) {
|
|
2184
|
+
const { separateDialCode: t, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2185
|
+
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2180
2186
|
let o = "", a = "";
|
|
2181
|
-
|
|
2187
|
+
e && i ? (o = `iti__flag iti__${e}`, a = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (o = "iti__flag iti__globe", a = s.noCountrySelected), this.selectedCountryInner.className = o, this.selectedCountryA11yText.textContent = a;
|
|
2182
2188
|
}
|
|
2183
|
-
if (this._setSelectedCountryTitleAttribute(
|
|
2189
|
+
if (this._setSelectedCountryTitleAttribute(e, t), t) {
|
|
2184
2190
|
const o = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2185
2191
|
this.selectedDialCode.innerHTML = o, this._updateInputPadding();
|
|
2186
2192
|
}
|
|
2187
|
-
return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !==
|
|
2193
|
+
return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !== e;
|
|
2188
2194
|
}
|
|
2189
2195
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2190
2196
|
_updateInputPadding() {
|
|
2191
2197
|
if (this.selectedCountry) {
|
|
2192
|
-
const
|
|
2193
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${
|
|
2198
|
+
const t = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
|
|
2199
|
+
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${t}px` : this.telInput.style.paddingRight = `${t}px`;
|
|
2194
2200
|
}
|
|
2195
2201
|
}
|
|
2196
2202
|
//* Update the maximum valid number length for the currently selected country.
|
|
2197
2203
|
_updateMaxLength() {
|
|
2198
|
-
const { strictMode:
|
|
2199
|
-
if (
|
|
2204
|
+
const { strictMode: e, placeholderNumberType: t, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
2205
|
+
if (e && l.utils)
|
|
2200
2206
|
if (s) {
|
|
2201
|
-
const n = l.utils.numberType[
|
|
2207
|
+
const n = l.utils.numberType[t];
|
|
2202
2208
|
let o = l.utils.getExampleNumber(
|
|
2203
2209
|
s,
|
|
2204
2210
|
!1,
|
|
@@ -2212,11 +2218,11 @@ class G {
|
|
|
2212
2218
|
} else
|
|
2213
2219
|
this.maxCoreNumberLength = null;
|
|
2214
2220
|
}
|
|
2215
|
-
_setSelectedCountryTitleAttribute(
|
|
2221
|
+
_setSelectedCountryTitleAttribute(e = null, t) {
|
|
2216
2222
|
if (!this.selectedCountry)
|
|
2217
2223
|
return;
|
|
2218
2224
|
let i;
|
|
2219
|
-
|
|
2225
|
+
e && !t ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? i = this.selectedCountryData.name : i = "Unknown", this.selectedCountry.setAttribute("title", i);
|
|
2220
2226
|
}
|
|
2221
2227
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2222
2228
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2224,27 +2230,27 @@ class G {
|
|
|
2224
2230
|
//* will definitely exist.
|
|
2225
2231
|
_getHiddenSelectedCountryWidth() {
|
|
2226
2232
|
if (this.telInput.parentNode) {
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2233
|
+
const e = this.telInput.parentNode.cloneNode(!1);
|
|
2234
|
+
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2235
|
+
const t = this.countryContainer.cloneNode();
|
|
2236
|
+
e.appendChild(t);
|
|
2231
2237
|
const i = this.selectedCountry.cloneNode(!0);
|
|
2232
|
-
|
|
2238
|
+
t.appendChild(i);
|
|
2233
2239
|
const s = i.offsetWidth;
|
|
2234
|
-
return document.body.removeChild(
|
|
2240
|
+
return document.body.removeChild(e), s;
|
|
2235
2241
|
}
|
|
2236
2242
|
return 0;
|
|
2237
2243
|
}
|
|
2238
2244
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2239
2245
|
_updatePlaceholder() {
|
|
2240
2246
|
const {
|
|
2241
|
-
autoPlaceholder:
|
|
2242
|
-
placeholderNumberType:
|
|
2247
|
+
autoPlaceholder: e,
|
|
2248
|
+
placeholderNumberType: t,
|
|
2243
2249
|
nationalMode: i,
|
|
2244
2250
|
customPlaceholder: s
|
|
2245
|
-
} = this.options, n =
|
|
2251
|
+
} = this.options, n = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2246
2252
|
if (l.utils && n) {
|
|
2247
|
-
const o = l.utils.numberType[
|
|
2253
|
+
const o = l.utils.numberType[t];
|
|
2248
2254
|
let a = this.selectedCountryData.iso2 ? l.utils.getExampleNumber(
|
|
2249
2255
|
this.selectedCountryData.iso2,
|
|
2250
2256
|
i,
|
|
@@ -2254,11 +2260,11 @@ class G {
|
|
|
2254
2260
|
}
|
|
2255
2261
|
}
|
|
2256
2262
|
//* Called when the user selects a list item from the dropdown.
|
|
2257
|
-
_selectListItem(
|
|
2258
|
-
const
|
|
2259
|
-
|
|
2263
|
+
_selectListItem(e) {
|
|
2264
|
+
const t = this._setCountry(
|
|
2265
|
+
e.getAttribute("data-country-code")
|
|
2260
2266
|
);
|
|
2261
|
-
this._closeDropdown(), this._updateDialCode(
|
|
2267
|
+
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), t && this._triggerCountryChange();
|
|
2262
2268
|
}
|
|
2263
2269
|
//* Close the dropdown and unbind any listeners.
|
|
2264
2270
|
_closeDropdown() {
|
|
@@ -2271,38 +2277,38 @@ class G {
|
|
|
2271
2277
|
), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this._trigger("close:countrydropdown");
|
|
2272
2278
|
}
|
|
2273
2279
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2274
|
-
_scrollTo(
|
|
2275
|
-
const
|
|
2280
|
+
_scrollTo(e) {
|
|
2281
|
+
const t = this.countryList, i = document.documentElement.scrollTop, s = t.offsetHeight, n = t.getBoundingClientRect().top + i, o = n + s, a = e.offsetHeight, r = e.getBoundingClientRect().top + i, p = r + a, h = r - n + t.scrollTop;
|
|
2276
2282
|
if (r < n)
|
|
2277
|
-
|
|
2283
|
+
t.scrollTop = h;
|
|
2278
2284
|
else if (p > o) {
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2285
|
+
const c = s - a;
|
|
2286
|
+
t.scrollTop = h - c;
|
|
2281
2287
|
}
|
|
2282
2288
|
}
|
|
2283
2289
|
//* Replace any existing dial code with the new one
|
|
2284
2290
|
//* Note: called from _selectListItem and setCountry
|
|
2285
|
-
_updateDialCode(
|
|
2286
|
-
const
|
|
2291
|
+
_updateDialCode(e) {
|
|
2292
|
+
const t = this.telInput.value, i = `+${e}`;
|
|
2287
2293
|
let s;
|
|
2288
|
-
if (
|
|
2289
|
-
const n = this._getDialCode(
|
|
2290
|
-
n ? s =
|
|
2294
|
+
if (t.charAt(0) === "+") {
|
|
2295
|
+
const n = this._getDialCode(t);
|
|
2296
|
+
n ? s = t.replace(n, i) : s = i, this.telInput.value = s;
|
|
2291
2297
|
}
|
|
2292
2298
|
}
|
|
2293
2299
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2294
2300
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2295
|
-
_getDialCode(
|
|
2301
|
+
_getDialCode(e, t) {
|
|
2296
2302
|
let i = "";
|
|
2297
|
-
if (
|
|
2303
|
+
if (e.charAt(0) === "+") {
|
|
2298
2304
|
let s = "";
|
|
2299
|
-
for (let n = 0; n <
|
|
2300
|
-
const o =
|
|
2305
|
+
for (let n = 0; n < e.length; n++) {
|
|
2306
|
+
const o = e.charAt(n);
|
|
2301
2307
|
if (!isNaN(parseInt(o, 10))) {
|
|
2302
|
-
if (s += o,
|
|
2303
|
-
this.dialCodeToIso2Map[s] && (i =
|
|
2308
|
+
if (s += o, t)
|
|
2309
|
+
this.dialCodeToIso2Map[s] && (i = e.substr(0, n + 1));
|
|
2304
2310
|
else if (this.dialCodes[s]) {
|
|
2305
|
-
i =
|
|
2311
|
+
i = e.substr(0, n + 1);
|
|
2306
2312
|
break;
|
|
2307
2313
|
}
|
|
2308
2314
|
if (s.length === this.dialCodeMaxLen)
|
|
@@ -2313,24 +2319,24 @@ class G {
|
|
|
2313
2319
|
return i;
|
|
2314
2320
|
}
|
|
2315
2321
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2316
|
-
_getFullNumber(
|
|
2317
|
-
const
|
|
2322
|
+
_getFullNumber(e) {
|
|
2323
|
+
const t = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2318
2324
|
let s;
|
|
2319
|
-
const n = v(
|
|
2320
|
-
return this.options.separateDialCode &&
|
|
2325
|
+
const n = v(t);
|
|
2326
|
+
return this.options.separateDialCode && t.charAt(0) !== "+" && i && n ? s = `+${i}` : s = "", s + t;
|
|
2321
2327
|
}
|
|
2322
2328
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2323
|
-
_beforeSetNumber(
|
|
2324
|
-
let
|
|
2329
|
+
_beforeSetNumber(e) {
|
|
2330
|
+
let t = e;
|
|
2325
2331
|
if (this.options.separateDialCode) {
|
|
2326
|
-
let i = this._getDialCode(
|
|
2332
|
+
let i = this._getDialCode(t);
|
|
2327
2333
|
if (i) {
|
|
2328
2334
|
i = `+${this.selectedCountryData.dialCode}`;
|
|
2329
|
-
const s =
|
|
2330
|
-
|
|
2335
|
+
const s = t[i.length] === " " || t[i.length] === "-" ? i.length + 1 : i.length;
|
|
2336
|
+
t = t.substr(s);
|
|
2331
2337
|
}
|
|
2332
2338
|
}
|
|
2333
|
-
return this._cap(
|
|
2339
|
+
return this._cap(t);
|
|
2334
2340
|
}
|
|
2335
2341
|
//* Trigger the 'countrychange' event.
|
|
2336
2342
|
_triggerCountryChange() {
|
|
@@ -2338,8 +2344,8 @@ class G {
|
|
|
2338
2344
|
}
|
|
2339
2345
|
//* Format the number as the user types.
|
|
2340
2346
|
_formatNumberAsYouType() {
|
|
2341
|
-
const
|
|
2342
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" &&
|
|
2347
|
+
const e = this._getFullNumber(), t = l.utils ? l.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: i } = this.selectedCountryData;
|
|
2348
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && t.includes(`+${i}`) ? (t.split(`+${i}`)[1] || "").trim() : t;
|
|
2343
2349
|
}
|
|
2344
2350
|
//**************************
|
|
2345
2351
|
//* SECRET PUBLIC METHODS
|
|
@@ -2358,8 +2364,8 @@ class G {
|
|
|
2358
2364
|
//* Remove plugin.
|
|
2359
2365
|
destroy() {
|
|
2360
2366
|
var n, o;
|
|
2361
|
-
const { allowDropdown:
|
|
2362
|
-
if (
|
|
2367
|
+
const { allowDropdown: e, separateDialCode: t } = this.options;
|
|
2368
|
+
if (e) {
|
|
2363
2369
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2364
2370
|
"click",
|
|
2365
2371
|
this._handleClickSelectedCountry
|
|
@@ -2371,7 +2377,7 @@ class G {
|
|
|
2371
2377
|
a && a.removeEventListener("click", this._handleLabelClick);
|
|
2372
2378
|
}
|
|
2373
2379
|
const { form: i } = this.telInput;
|
|
2374
|
-
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"),
|
|
2380
|
+
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"), t && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2375
2381
|
const s = this.telInput.parentNode;
|
|
2376
2382
|
(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];
|
|
2377
2383
|
}
|
|
@@ -2383,13 +2389,13 @@ class G {
|
|
|
2383
2389
|
) : "";
|
|
2384
2390
|
}
|
|
2385
2391
|
//* Format the number to the given format.
|
|
2386
|
-
getNumber(
|
|
2392
|
+
getNumber(e) {
|
|
2387
2393
|
if (l.utils) {
|
|
2388
|
-
const { iso2:
|
|
2394
|
+
const { iso2: t } = this.selectedCountryData;
|
|
2389
2395
|
return l.utils.formatNumber(
|
|
2390
2396
|
this._getFullNumber(),
|
|
2391
|
-
|
|
2392
|
-
|
|
2397
|
+
t,
|
|
2398
|
+
e
|
|
2393
2399
|
);
|
|
2394
2400
|
}
|
|
2395
2401
|
return "";
|
|
@@ -2408,8 +2414,8 @@ class G {
|
|
|
2408
2414
|
//* Get the validation error.
|
|
2409
2415
|
getValidationError() {
|
|
2410
2416
|
if (l.utils) {
|
|
2411
|
-
const { iso2:
|
|
2412
|
-
return l.utils.getValidationError(this._getFullNumber(),
|
|
2417
|
+
const { iso2: e } = this.selectedCountryData;
|
|
2418
|
+
return l.utils.getValidationError(this._getFullNumber(), e);
|
|
2413
2419
|
}
|
|
2414
2420
|
return -99;
|
|
2415
2421
|
}
|
|
@@ -2417,73 +2423,73 @@ class G {
|
|
|
2417
2423
|
isValidNumber() {
|
|
2418
2424
|
if (!this.selectedCountryData.iso2)
|
|
2419
2425
|
return !1;
|
|
2420
|
-
const
|
|
2421
|
-
if (
|
|
2422
|
-
const i =
|
|
2426
|
+
const e = this._getFullNumber(), t = e.search(new RegExp("\\p{L}", "u"));
|
|
2427
|
+
if (t > -1) {
|
|
2428
|
+
const i = e.substring(0, t), s = this._utilsIsPossibleNumber(i), n = this._utilsIsPossibleNumber(e);
|
|
2423
2429
|
return s && n;
|
|
2424
2430
|
}
|
|
2425
|
-
return this._utilsIsPossibleNumber(
|
|
2431
|
+
return this._utilsIsPossibleNumber(e);
|
|
2426
2432
|
}
|
|
2427
|
-
_utilsIsPossibleNumber(
|
|
2428
|
-
return l.utils ? l.utils.isPossibleNumber(
|
|
2433
|
+
_utilsIsPossibleNumber(e) {
|
|
2434
|
+
return l.utils ? l.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2429
2435
|
}
|
|
2430
2436
|
//* Validate the input val (precise)
|
|
2431
2437
|
isValidNumberPrecise() {
|
|
2432
2438
|
if (!this.selectedCountryData.iso2)
|
|
2433
2439
|
return !1;
|
|
2434
|
-
const
|
|
2435
|
-
if (
|
|
2436
|
-
const i =
|
|
2440
|
+
const e = this._getFullNumber(), t = e.search(new RegExp("\\p{L}", "u"));
|
|
2441
|
+
if (t > -1) {
|
|
2442
|
+
const i = e.substring(0, t), s = this._utilsIsValidNumber(i), n = this._utilsIsValidNumber(e);
|
|
2437
2443
|
return s && n;
|
|
2438
2444
|
}
|
|
2439
|
-
return this._utilsIsValidNumber(
|
|
2445
|
+
return this._utilsIsValidNumber(e);
|
|
2440
2446
|
}
|
|
2441
|
-
_utilsIsValidNumber(
|
|
2442
|
-
return l.utils ? l.utils.isValidNumber(
|
|
2447
|
+
_utilsIsValidNumber(e) {
|
|
2448
|
+
return l.utils ? l.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2443
2449
|
}
|
|
2444
2450
|
//* Update the selected country, and update the input val accordingly.
|
|
2445
|
-
setCountry(
|
|
2446
|
-
const
|
|
2447
|
-
(
|
|
2451
|
+
setCountry(e) {
|
|
2452
|
+
const t = e == null ? void 0 : e.toLowerCase(), i = this.selectedCountryData.iso2;
|
|
2453
|
+
(e && t !== i || !e && i) && (this._setCountry(t), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2448
2454
|
}
|
|
2449
2455
|
//* Set the input value and update the country.
|
|
2450
|
-
setNumber(
|
|
2451
|
-
const
|
|
2452
|
-
this._updateValFromNumber(
|
|
2456
|
+
setNumber(e) {
|
|
2457
|
+
const t = this._updateCountryFromNumber(e);
|
|
2458
|
+
this._updateValFromNumber(e), t && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2453
2459
|
}
|
|
2454
2460
|
//* Set the placeholder number typ
|
|
2455
|
-
setPlaceholderNumberType(
|
|
2456
|
-
this.options.placeholderNumberType =
|
|
2461
|
+
setPlaceholderNumberType(e) {
|
|
2462
|
+
this.options.placeholderNumberType = e, this._updatePlaceholder();
|
|
2457
2463
|
}
|
|
2458
|
-
setDisabled(
|
|
2459
|
-
this.telInput.disabled =
|
|
2464
|
+
setDisabled(e) {
|
|
2465
|
+
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2460
2466
|
}
|
|
2461
2467
|
}
|
|
2462
2468
|
const W = (u) => {
|
|
2463
2469
|
if (!l.utils && !l.startedLoadingUtilsScript) {
|
|
2464
|
-
let
|
|
2470
|
+
let e;
|
|
2465
2471
|
if (typeof u == "function")
|
|
2466
2472
|
try {
|
|
2467
|
-
|
|
2468
|
-
} catch (
|
|
2469
|
-
return Promise.reject(
|
|
2473
|
+
e = Promise.resolve(u());
|
|
2474
|
+
} catch (t) {
|
|
2475
|
+
return Promise.reject(t);
|
|
2470
2476
|
}
|
|
2471
2477
|
else
|
|
2472
2478
|
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof u}`));
|
|
2473
|
-
return l.startedLoadingUtilsScript = !0,
|
|
2474
|
-
const i =
|
|
2479
|
+
return l.startedLoadingUtilsScript = !0, e.then((t) => {
|
|
2480
|
+
const i = t == null ? void 0 : t.default;
|
|
2475
2481
|
if (!i || typeof i != "object")
|
|
2476
2482
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2477
2483
|
return l.utils = i, w("handleUtils"), !0;
|
|
2478
|
-
}).catch((
|
|
2479
|
-
throw w("rejectUtilsScriptPromise",
|
|
2484
|
+
}).catch((t) => {
|
|
2485
|
+
throw w("rejectUtilsScriptPromise", t), t;
|
|
2480
2486
|
});
|
|
2481
2487
|
}
|
|
2482
2488
|
return null;
|
|
2483
2489
|
}, l = Object.assign(
|
|
2484
|
-
(u,
|
|
2485
|
-
const
|
|
2486
|
-
return
|
|
2490
|
+
(u, e) => {
|
|
2491
|
+
const t = new G(u, e);
|
|
2492
|
+
return t._init(), u.setAttribute("data-intl-tel-input-id", t.id.toString()), l.instances[t.id] = t, t;
|
|
2487
2493
|
},
|
|
2488
2494
|
{
|
|
2489
2495
|
defaults: T,
|
|
@@ -2493,15 +2499,15 @@ const W = (u) => {
|
|
|
2493
2499
|
getCountryData: () => I,
|
|
2494
2500
|
//* A getter for the plugin instance.
|
|
2495
2501
|
getInstance: (u) => {
|
|
2496
|
-
const
|
|
2497
|
-
return
|
|
2502
|
+
const e = u.getAttribute("data-intl-tel-input-id");
|
|
2503
|
+
return e ? l.instances[e] : null;
|
|
2498
2504
|
},
|
|
2499
2505
|
//* A map from instance ID to instance object.
|
|
2500
2506
|
instances: {},
|
|
2501
2507
|
attachUtils: W,
|
|
2502
2508
|
startedLoadingUtilsScript: !1,
|
|
2503
2509
|
startedLoadingAutoCountry: !1,
|
|
2504
|
-
version: "25.0.
|
|
2510
|
+
version: "25.0.2"
|
|
2505
2511
|
}
|
|
2506
2512
|
), J = {
|
|
2507
2513
|
__name: "IntlTelInput",
|
|
@@ -2535,38 +2541,38 @@ const W = (u) => {
|
|
|
2535
2541
|
"changeValidity",
|
|
2536
2542
|
"changeErrorCode"
|
|
2537
2543
|
], ["update:modelValue"]),
|
|
2538
|
-
setup(u, { expose:
|
|
2539
|
-
const i = x(u, "modelValue"), s = u, n =
|
|
2540
|
-
let
|
|
2541
|
-
r.value !==
|
|
2544
|
+
setup(u, { expose: e, emit: t }) {
|
|
2545
|
+
const i = x(u, "modelValue"), s = u, n = t, o = L(), a = L(), r = L(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, h = () => {
|
|
2546
|
+
let d = p();
|
|
2547
|
+
r.value !== d && (r.value = d, n("changeValidity", !!d), n(
|
|
2542
2548
|
"changeErrorCode",
|
|
2543
|
-
|
|
2549
|
+
d ? null : a.value.getValidationError()
|
|
2544
2550
|
));
|
|
2545
|
-
},
|
|
2546
|
-
var
|
|
2547
|
-
n("changeNumber", ((
|
|
2551
|
+
}, c = () => {
|
|
2552
|
+
var d;
|
|
2553
|
+
n("changeNumber", ((d = a.value) == null ? void 0 : d.getNumber()) ?? ""), h();
|
|
2548
2554
|
}, C = () => {
|
|
2549
|
-
var
|
|
2550
|
-
n("changeCountry", ((
|
|
2555
|
+
var d;
|
|
2556
|
+
n("changeCountry", ((d = a.value) == null ? void 0 : d.getSelectedCountryData().iso2) ?? ""), c(), h();
|
|
2551
2557
|
};
|
|
2552
2558
|
return E(() => {
|
|
2553
2559
|
o.value && (a.value = l(o.value, s.options), s.value && a.value.setNumber(s.value), s.disabled && a.value.setDisabled(s.disabled));
|
|
2554
2560
|
}), M(
|
|
2555
2561
|
() => s.disabled,
|
|
2556
|
-
(
|
|
2562
|
+
(d) => {
|
|
2557
2563
|
var m;
|
|
2558
|
-
return (m = a.value) == null ? void 0 : m.setDisabled(
|
|
2564
|
+
return (m = a.value) == null ? void 0 : m.setDisabled(d);
|
|
2559
2565
|
}
|
|
2560
2566
|
), F(() => {
|
|
2561
|
-
var
|
|
2562
|
-
return (
|
|
2563
|
-
}),
|
|
2567
|
+
var d;
|
|
2568
|
+
return (d = a.value) == null ? void 0 : d.destroy();
|
|
2569
|
+
}), e({ instance: a, input: o }), (d, m) => B((V(), O("input", z({
|
|
2564
2570
|
ref_key: "input",
|
|
2565
2571
|
ref: o,
|
|
2566
2572
|
"onUpdate:modelValue": m[0] || (m[0] = (b) => i.value = b),
|
|
2567
2573
|
type: "tel",
|
|
2568
2574
|
onCountrychange: C,
|
|
2569
|
-
onInput:
|
|
2575
|
+
onInput: c
|
|
2570
2576
|
}, u.inputProps), null, 16)), [
|
|
2571
2577
|
[R, i.value]
|
|
2572
2578
|
]);
|