intl-tel-input 24.5.0 → 24.5.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 +11 -9
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -0
- package/build/js/intlTelInput.js +37 -26
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +104 -140
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +27 -27
- package/package.json +1 -1
- package/react/README.md +2 -2
- package/react/build/IntlTelInput.cjs +36 -25
- package/react/build/IntlTelInput.d.ts +1 -0
- package/react/build/IntlTelInput.js +36 -25
- package/react/build/IntlTelInputWithUtils.cjs +103 -139
- package/react/build/IntlTelInputWithUtils.js +103 -139
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +110 -99
- package/vue/build/IntlTelInputWithUtils.mjs +704 -740
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as D, useModel as x, ref as v, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as O, createElementBlock as V, mergeProps as z, vModelText as R } from "vue";
|
|
2
|
+
const N = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1306,8 +1306,8 @@ const D = [
|
|
|
1306
1306
|
"263"
|
|
1307
1307
|
]
|
|
1308
1308
|
], b = [];
|
|
1309
|
-
for (let u = 0; u <
|
|
1310
|
-
const t =
|
|
1309
|
+
for (let u = 0; u < N.length; u++) {
|
|
1310
|
+
const t = N[u];
|
|
1311
1311
|
b[u] = {
|
|
1312
1312
|
name: "",
|
|
1313
1313
|
// this is now populated in the plugin
|
|
@@ -1318,7 +1318,7 @@ for (let u = 0; u < D.length; u++) {
|
|
|
1318
1318
|
nodeById: {}
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
|
-
const
|
|
1321
|
+
const $ = {
|
|
1322
1322
|
ad: "Andorra",
|
|
1323
1323
|
ae: "United Arab Emirates",
|
|
1324
1324
|
af: "Afghanistan",
|
|
@@ -1561,7 +1561,7 @@ const R = {
|
|
|
1561
1561
|
za: "South Africa",
|
|
1562
1562
|
zm: "Zambia",
|
|
1563
1563
|
zw: "Zimbabwe"
|
|
1564
|
-
},
|
|
1564
|
+
}, j = {
|
|
1565
1565
|
selectedCountryAriaLabel: "Selected country",
|
|
1566
1566
|
noCountrySelected: "No country selected",
|
|
1567
1567
|
countryListAriaLabel: "List of countries",
|
|
@@ -1572,11 +1572,11 @@ const R = {
|
|
|
1572
1572
|
// additional countries (not supported by country-list library)
|
|
1573
1573
|
ac: "Ascension Island",
|
|
1574
1574
|
xk: "Kosovo"
|
|
1575
|
-
},
|
|
1575
|
+
}, k = { ...$, ...j };
|
|
1576
1576
|
for (let u = 0; u < b.length; u++)
|
|
1577
|
-
b[u].name =
|
|
1578
|
-
let
|
|
1579
|
-
const
|
|
1577
|
+
b[u].name = k[b[u].iso2];
|
|
1578
|
+
let K = 0;
|
|
1579
|
+
const T = {
|
|
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 k = {
|
|
|
1631
1631
|
utilsScript: "",
|
|
1632
1632
|
//* The number type to enforce during validation.
|
|
1633
1633
|
validationNumberType: "MOBILE"
|
|
1634
|
-
},
|
|
1634
|
+
}, U = [
|
|
1635
1635
|
"800",
|
|
1636
1636
|
"822",
|
|
1637
1637
|
"833",
|
|
@@ -1649,14 +1649,14 @@ const k = {
|
|
|
1649
1649
|
"887",
|
|
1650
1650
|
"888",
|
|
1651
1651
|
"889"
|
|
1652
|
-
],
|
|
1653
|
-
const t =
|
|
1652
|
+
], w = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
|
|
1653
|
+
const t = w(u);
|
|
1654
1654
|
if (t.charAt(0) === "1") {
|
|
1655
1655
|
const e = t.substr(1, 3);
|
|
1656
|
-
return
|
|
1656
|
+
return U.indexOf(e) !== -1;
|
|
1657
1657
|
}
|
|
1658
1658
|
return !1;
|
|
1659
|
-
},
|
|
1659
|
+
}, H = (u, t, e, i) => {
|
|
1660
1660
|
if (e === 0 && !i)
|
|
1661
1661
|
return 0;
|
|
1662
1662
|
let s = 0;
|
|
@@ -1674,15 +1674,15 @@ const k = {
|
|
|
1674
1674
|
const { instances: t } = l;
|
|
1675
1675
|
Object.values(t).forEach((e) => e[u]());
|
|
1676
1676
|
};
|
|
1677
|
-
class
|
|
1677
|
+
class G {
|
|
1678
1678
|
constructor(t, e = {}) {
|
|
1679
|
-
this.id =
|
|
1679
|
+
this.id = K++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, 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
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 = { ...k, ...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) => {
|
|
@@ -1781,16 +1781,16 @@ class H {
|
|
|
1781
1781
|
fixDropdownWidth: a,
|
|
1782
1782
|
useFullscreenPopup: r,
|
|
1783
1783
|
countrySearch: p,
|
|
1784
|
-
i18n:
|
|
1784
|
+
i18n: c
|
|
1785
1785
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
t && (
|
|
1788
|
-
const
|
|
1789
|
-
if ((h = this.telInput.parentNode) == null || h.insertBefore(
|
|
1786
|
+
let d = "iti";
|
|
1787
|
+
t && (d += " iti--allow-dropdown"), i && (d += " iti--show-flags"), s && (d += ` ${s}`), r || (d += " iti--inline-dropdown");
|
|
1788
|
+
const C = y("div", { class: d });
|
|
1789
|
+
if ((h = this.telInput.parentNode) == null || h.insertBefore(C, this.telInput), t || i || e) {
|
|
1790
1790
|
this.countryContainer = y(
|
|
1791
1791
|
"div",
|
|
1792
1792
|
{ class: "iti__country-container" },
|
|
1793
|
-
|
|
1793
|
+
C
|
|
1794
1794
|
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
|
|
1795
1795
|
"button",
|
|
1796
1796
|
{
|
|
@@ -1831,10 +1831,10 @@ class H {
|
|
|
1831
1831
|
{
|
|
1832
1832
|
type: "text",
|
|
1833
1833
|
class: "iti__search-input",
|
|
1834
|
-
placeholder:
|
|
1834
|
+
placeholder: c.searchPlaceholder,
|
|
1835
1835
|
role: "combobox",
|
|
1836
1836
|
"aria-expanded": "true",
|
|
1837
|
-
"aria-label":
|
|
1837
|
+
"aria-label": c.searchPlaceholder,
|
|
1838
1838
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1839
1839
|
"aria-autocomplete": "list",
|
|
1840
1840
|
autocomplete: "off"
|
|
@@ -1850,7 +1850,7 @@ class H {
|
|
|
1850
1850
|
class: "iti__country-list",
|
|
1851
1851
|
id: `iti-${this.id}__country-listbox`,
|
|
1852
1852
|
role: "listbox",
|
|
1853
|
-
"aria-label":
|
|
1853
|
+
"aria-label": c.countryListAriaLabel
|
|
1854
1854
|
},
|
|
1855
1855
|
this.dropdownContent
|
|
1856
1856
|
), this._appendListItems(), p && this._updateSearchResultsText(), o) {
|
|
@@ -1860,15 +1860,15 @@ class H {
|
|
|
1860
1860
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
|
-
if (
|
|
1863
|
+
if (C.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1864
1864
|
const m = this.telInput.getAttribute("name") || "", f = n(m);
|
|
1865
1865
|
f.phone && (this.hiddenInput = y("input", {
|
|
1866
1866
|
type: "hidden",
|
|
1867
1867
|
name: f.phone
|
|
1868
|
-
}),
|
|
1868
|
+
}), C.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry = y("input", {
|
|
1869
1869
|
type: "hidden",
|
|
1870
1870
|
name: f.country
|
|
1871
|
-
}),
|
|
1871
|
+
}), C.appendChild(this.hiddenInputCountry));
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
@@ -1896,12 +1896,12 @@ class H {
|
|
|
1896
1896
|
//* 1. Extracting a dial code from the given number
|
|
1897
1897
|
//* 2. Using explicit initialCountry
|
|
1898
1898
|
_setInitialState(t = !1) {
|
|
1899
|
-
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 =
|
|
1899
|
+
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 = S(n), { initialCountry: r, geoIpLookup: p } = this.options, c = r === "auto" && p;
|
|
1900
1900
|
if (o && !a)
|
|
1901
1901
|
this._updateCountryFromNumber(n);
|
|
1902
|
-
else if (!
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1902
|
+
else if (!c || t) {
|
|
1903
|
+
const d = r ? r.toLowerCase() : "";
|
|
1904
|
+
d && this._getCountryData(d, !0) ? this._setCountry(d) : o && a ? this._setCountry("us") : this._setCountry();
|
|
1905
1905
|
}
|
|
1906
1906
|
n && this._updateValFromNumber(n);
|
|
1907
1907
|
}
|
|
@@ -1962,17 +1962,17 @@ class H {
|
|
|
1962
1962
|
let a = !1;
|
|
1963
1963
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (r) => {
|
|
1964
1964
|
if (this.isAndroid && (r == null ? void 0 : r.data) === "+" && i && n && o) {
|
|
1965
|
-
const
|
|
1965
|
+
const C = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, C - 1), m = this.telInput.value.substring(C);
|
|
1966
1966
|
this.telInput.value = h + m, this._openDropdownWithPlus();
|
|
1967
1967
|
return;
|
|
1968
1968
|
}
|
|
1969
1969
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1970
|
-
const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data),
|
|
1971
|
-
p ||
|
|
1972
|
-
const
|
|
1973
|
-
if (e && !a && !
|
|
1974
|
-
const
|
|
1975
|
-
this.telInput.value = g, this.telInput.setSelectionRange(
|
|
1970
|
+
const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data), c = (r == null ? void 0 : r.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1971
|
+
p || c && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
|
|
1972
|
+
const d = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
|
|
1973
|
+
if (e && !a && !d) {
|
|
1974
|
+
const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), I = H(m, g, C, f);
|
|
1975
|
+
this.telInput.value = g, this.telInput.setSelectionRange(I, I);
|
|
1976
1976
|
}
|
|
1977
1977
|
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (r) => {
|
|
1978
1978
|
if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
|
|
@@ -1981,8 +1981,13 @@ class H {
|
|
|
1981
1981
|
return;
|
|
1982
1982
|
}
|
|
1983
1983
|
if (t) {
|
|
1984
|
-
const p = this.telInput.selectionStart === 0 && r.key === "+",
|
|
1985
|
-
|
|
1984
|
+
const p = this.telInput.value, c = p.charAt(0) === "+", d = !c && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), h = i ? C : d || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), f = this._getFullNumber(m), g = l.utils.getCoreNumber(f, this.selectedCountryData.iso2), I = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength;
|
|
1985
|
+
let L = !1;
|
|
1986
|
+
if (c) {
|
|
1987
|
+
const P = this.selectedCountryData.iso2;
|
|
1988
|
+
L = this._getCountryFromNumber(f) !== P;
|
|
1989
|
+
}
|
|
1990
|
+
(!h || I && !L && !d) && r.preventDefault();
|
|
1986
1991
|
}
|
|
1987
1992
|
}
|
|
1988
1993
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2071,12 +2076,12 @@ class H {
|
|
|
2071
2076
|
_filterCountries(t, e = !1) {
|
|
2072
2077
|
let i = !0;
|
|
2073
2078
|
this.countryList.innerHTML = "";
|
|
2074
|
-
const s =
|
|
2079
|
+
const s = A(t);
|
|
2075
2080
|
for (let n = 0; n < this.countries.length; n++) {
|
|
2076
|
-
const o = this.countries[n], a =
|
|
2081
|
+
const o = this.countries[n], a = A(o.name), r = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((c) => c[0]).join("").toLowerCase(), p = `+${o.dialCode}`;
|
|
2077
2082
|
if (e || a.includes(s) || p.includes(s) || o.iso2.includes(s) || r.includes(s)) {
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2083
|
+
const c = o.nodeById[this.id];
|
|
2084
|
+
c && this.countryList.appendChild(c), i && (this._highlightListItem(c, !1), i = !1);
|
|
2080
2085
|
}
|
|
2081
2086
|
}
|
|
2082
2087
|
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
@@ -2114,23 +2119,29 @@ class H {
|
|
|
2114
2119
|
//* Check if need to select a new country based on the given number
|
|
2115
2120
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2116
2121
|
_updateCountryFromNumber(t) {
|
|
2122
|
+
const e = this._getCountryFromNumber(t);
|
|
2123
|
+
return e !== null ? this._setCountry(e) : !1;
|
|
2124
|
+
}
|
|
2125
|
+
_getCountryFromNumber(t) {
|
|
2117
2126
|
const e = t.indexOf("+");
|
|
2118
2127
|
let i = e ? t.substring(e) : t;
|
|
2119
2128
|
const s = this.selectedCountryData.dialCode;
|
|
2120
2129
|
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}`);
|
|
2121
|
-
const o = this._getDialCode(i, !0), a =
|
|
2122
|
-
let r = null;
|
|
2130
|
+
const o = this._getDialCode(i, !0), a = w(i);
|
|
2123
2131
|
if (o) {
|
|
2124
|
-
const
|
|
2125
|
-
if (!(s === "1" &&
|
|
2126
|
-
for (let
|
|
2127
|
-
if (
|
|
2128
|
-
r
|
|
2129
|
-
break;
|
|
2130
|
-
}
|
|
2132
|
+
const r = this.dialCodeToIso2Map[w(o)], p = r.indexOf(this.selectedCountryData.iso2) !== -1 && a.length <= o.length - 1;
|
|
2133
|
+
if (!(s === "1" && S(a)) && !p) {
|
|
2134
|
+
for (let d = 0; d < r.length; d++)
|
|
2135
|
+
if (r[d])
|
|
2136
|
+
return r[d];
|
|
2131
2137
|
}
|
|
2132
|
-
} else
|
|
2133
|
-
|
|
2138
|
+
} else {
|
|
2139
|
+
if (i.charAt(0) === "+" && a.length)
|
|
2140
|
+
return "";
|
|
2141
|
+
if ((!i || i === "+") && !this.selectedCountryData.iso2)
|
|
2142
|
+
return this.defaultCountry;
|
|
2143
|
+
}
|
|
2144
|
+
return null;
|
|
2134
2145
|
}
|
|
2135
2146
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2136
2147
|
_highlightListItem(t, e) {
|
|
@@ -2175,20 +2186,20 @@ class H {
|
|
|
2175
2186
|
}
|
|
2176
2187
|
//* Update the maximum valid number length for the currently selected country.
|
|
2177
2188
|
_updateMaxLength() {
|
|
2178
|
-
const { strictMode: t, placeholderNumberType: e, validationNumberType: i } = this.options;
|
|
2189
|
+
const { strictMode: t, placeholderNumberType: e, validationNumberType: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
2179
2190
|
if (t && l.utils)
|
|
2180
|
-
if (
|
|
2181
|
-
const
|
|
2182
|
-
let
|
|
2183
|
-
this.selectedCountryData.iso2,
|
|
2184
|
-
!1,
|
|
2191
|
+
if (s) {
|
|
2192
|
+
const n = l.utils.numberType[e];
|
|
2193
|
+
let o = l.utils.getExampleNumber(
|
|
2185
2194
|
s,
|
|
2195
|
+
!1,
|
|
2196
|
+
n,
|
|
2186
2197
|
!0
|
|
2187
|
-
),
|
|
2188
|
-
for (; l.utils.isPossibleNumber(
|
|
2189
|
-
|
|
2190
|
-
const
|
|
2191
|
-
this.maxCoreNumberLength =
|
|
2198
|
+
), a = o;
|
|
2199
|
+
for (; l.utils.isPossibleNumber(o, s, i); )
|
|
2200
|
+
a = o, o += "0";
|
|
2201
|
+
const r = l.utils.getCoreNumber(a, s);
|
|
2202
|
+
this.maxCoreNumberLength = r.length, s === "by" && (this.maxCoreNumberLength = r.length + 1);
|
|
2192
2203
|
} else
|
|
2193
2204
|
this.maxCoreNumberLength = null;
|
|
2194
2205
|
}
|
|
@@ -2252,12 +2263,12 @@ class H {
|
|
|
2252
2263
|
}
|
|
2253
2264
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2254
2265
|
_scrollTo(t) {
|
|
2255
|
-
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,
|
|
2266
|
+
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, c = r - n + e.scrollTop;
|
|
2256
2267
|
if (r < n)
|
|
2257
|
-
e.scrollTop =
|
|
2268
|
+
e.scrollTop = c;
|
|
2258
2269
|
else if (p > o) {
|
|
2259
|
-
const
|
|
2260
|
-
e.scrollTop =
|
|
2270
|
+
const d = s - a;
|
|
2271
|
+
e.scrollTop = c - d;
|
|
2261
2272
|
}
|
|
2262
2273
|
}
|
|
2263
2274
|
//* Replace any existing dial code with the new one
|
|
@@ -2293,11 +2304,11 @@ class H {
|
|
|
2293
2304
|
return i;
|
|
2294
2305
|
}
|
|
2295
2306
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2296
|
-
_getFullNumber() {
|
|
2297
|
-
const
|
|
2298
|
-
let
|
|
2299
|
-
const
|
|
2300
|
-
return this.options.separateDialCode &&
|
|
2307
|
+
_getFullNumber(t) {
|
|
2308
|
+
const e = t || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2309
|
+
let s;
|
|
2310
|
+
const n = w(e);
|
|
2311
|
+
return this.options.separateDialCode && e.charAt(0) !== "+" && i && n ? s = `+${i}` : s = "", s + e;
|
|
2301
2312
|
}
|
|
2302
2313
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2303
2314
|
_beforeSetNumber(t) {
|
|
@@ -2439,7 +2450,7 @@ class H {
|
|
|
2439
2450
|
this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2440
2451
|
}
|
|
2441
2452
|
}
|
|
2442
|
-
const
|
|
2453
|
+
const W = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUtilsScript = !0, new Promise((t, e) => {
|
|
2443
2454
|
import(
|
|
2444
2455
|
/* webpackIgnore: true */
|
|
2445
2456
|
/* @vite-ignore */
|
|
@@ -2451,11 +2462,11 @@ const G = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2451
2462
|
});
|
|
2452
2463
|
})) : null, l = Object.assign(
|
|
2453
2464
|
(u, t) => {
|
|
2454
|
-
const e = new
|
|
2465
|
+
const e = new G(u, t);
|
|
2455
2466
|
return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, e;
|
|
2456
2467
|
},
|
|
2457
2468
|
{
|
|
2458
|
-
defaults:
|
|
2469
|
+
defaults: T,
|
|
2459
2470
|
//* Using a static var like this allows us to mock it in the tests.
|
|
2460
2471
|
documentReady: () => document.readyState === "complete",
|
|
2461
2472
|
//* Get the country data object.
|
|
@@ -2467,12 +2478,12 @@ const G = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2467
2478
|
},
|
|
2468
2479
|
//* A map from instance ID to instance object.
|
|
2469
2480
|
instances: {},
|
|
2470
|
-
loadUtils:
|
|
2471
|
-
version: "24.5.
|
|
2481
|
+
loadUtils: W,
|
|
2482
|
+
version: "24.5.2"
|
|
2472
2483
|
}
|
|
2473
|
-
),
|
|
2484
|
+
), J = {
|
|
2474
2485
|
__name: "IntlTelInput",
|
|
2475
|
-
props: /* @__PURE__ */
|
|
2486
|
+
props: /* @__PURE__ */ D({
|
|
2476
2487
|
disabled: {
|
|
2477
2488
|
type: Boolean,
|
|
2478
2489
|
default: !1
|
|
@@ -2496,49 +2507,49 @@ const G = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2496
2507
|
},
|
|
2497
2508
|
modelModifiers: {}
|
|
2498
2509
|
}),
|
|
2499
|
-
emits: /* @__PURE__ */
|
|
2510
|
+
emits: /* @__PURE__ */ D([
|
|
2500
2511
|
"changeNumber",
|
|
2501
2512
|
"changeCountry",
|
|
2502
2513
|
"changeValidity",
|
|
2503
2514
|
"changeErrorCode"
|
|
2504
2515
|
], ["update:modelValue"]),
|
|
2505
2516
|
setup(u, { expose: t, emit: e }) {
|
|
2506
|
-
const i =
|
|
2517
|
+
const i = x(u, "modelValue"), s = u, n = e, o = v(), a = v(), r = v(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, c = () => {
|
|
2507
2518
|
let h = p();
|
|
2508
2519
|
r.value !== h && (r.value = h, n("changeValidity", !!h), n(
|
|
2509
2520
|
"changeErrorCode",
|
|
2510
2521
|
h ? null : a.value.getValidationError()
|
|
2511
2522
|
));
|
|
2512
|
-
},
|
|
2523
|
+
}, d = () => {
|
|
2513
2524
|
var h;
|
|
2514
|
-
n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""),
|
|
2515
|
-
},
|
|
2525
|
+
n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""), c();
|
|
2526
|
+
}, C = () => {
|
|
2516
2527
|
var h;
|
|
2517
|
-
n("changeCountry", ((h = a.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""),
|
|
2528
|
+
n("changeCountry", ((h = a.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""), d(), c();
|
|
2518
2529
|
};
|
|
2519
|
-
return
|
|
2530
|
+
return E(() => {
|
|
2520
2531
|
o.value && (a.value = l(o.value, s.options), s.value && a.value.setNumber(s.value), s.disabled && a.value.setDisabled(s.disabled));
|
|
2521
|
-
}),
|
|
2532
|
+
}), M(
|
|
2522
2533
|
() => s.disabled,
|
|
2523
2534
|
(h) => {
|
|
2524
2535
|
var m;
|
|
2525
2536
|
return (m = a.value) == null ? void 0 : m.setDisabled(h);
|
|
2526
2537
|
}
|
|
2527
|
-
),
|
|
2538
|
+
), F(() => {
|
|
2528
2539
|
var h;
|
|
2529
2540
|
return (h = a.value) == null ? void 0 : h.destroy();
|
|
2530
|
-
}), t({ instance: a, input: o }), (h, m) => B((O(), V("input",
|
|
2541
|
+
}), t({ instance: a, input: o }), (h, m) => B((O(), V("input", z({
|
|
2531
2542
|
ref_key: "input",
|
|
2532
2543
|
ref: o,
|
|
2533
2544
|
"onUpdate:modelValue": m[0] || (m[0] = (f) => i.value = f),
|
|
2534
2545
|
type: "tel",
|
|
2535
|
-
onCountrychange:
|
|
2536
|
-
onInput:
|
|
2546
|
+
onCountrychange: C,
|
|
2547
|
+
onInput: d
|
|
2537
2548
|
}, u.inputProps), null, 16)), [
|
|
2538
|
-
[
|
|
2549
|
+
[R, i.value]
|
|
2539
2550
|
]);
|
|
2540
2551
|
}
|
|
2541
2552
|
};
|
|
2542
2553
|
export {
|
|
2543
|
-
|
|
2554
|
+
J as default
|
|
2544
2555
|
};
|