intl-tel-input 25.0.1 → 25.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/build/js/data.js +35 -17
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +6 -1
- package/build/js/intlTelInput.js +61 -32
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +61 -32
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +60 -31
- package/react/build/IntlTelInput.d.ts +6 -1
- package/react/build/IntlTelInput.js +60 -31
- package/react/build/IntlTelInputWithUtils.cjs +60 -31
- package/react/build/IntlTelInputWithUtils.js +60 -31
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +140 -108
- package/vue/build/IntlTelInputWithUtils.mjs +527 -495
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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
2
|
const N = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -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",
|
|
@@ -77,7 +76,9 @@ const N = [
|
|
|
77
76
|
"au",
|
|
78
77
|
// Australia
|
|
79
78
|
"61",
|
|
80
|
-
0
|
|
79
|
+
0,
|
|
80
|
+
null,
|
|
81
|
+
"0"
|
|
81
82
|
],
|
|
82
83
|
[
|
|
83
84
|
"at",
|
|
@@ -258,14 +259,16 @@ const N = [
|
|
|
258
259
|
// Christmas Island
|
|
259
260
|
"61",
|
|
260
261
|
2,
|
|
261
|
-
["89164"]
|
|
262
|
+
["89164"],
|
|
263
|
+
"0"
|
|
262
264
|
],
|
|
263
265
|
[
|
|
264
266
|
"cc",
|
|
265
267
|
// Cocos (Keeling) Islands
|
|
266
268
|
"61",
|
|
267
269
|
1,
|
|
268
|
-
["89162"]
|
|
270
|
+
["89162"],
|
|
271
|
+
"0"
|
|
269
272
|
],
|
|
270
273
|
[
|
|
271
274
|
"co",
|
|
@@ -498,7 +501,8 @@ const N = [
|
|
|
498
501
|
// Guernsey
|
|
499
502
|
"44",
|
|
500
503
|
1,
|
|
501
|
-
["1481", "7781", "7839", "7911"]
|
|
504
|
+
["1481", "7781", "7839", "7911"],
|
|
505
|
+
"0"
|
|
502
506
|
],
|
|
503
507
|
[
|
|
504
508
|
"gn",
|
|
@@ -570,7 +574,8 @@ const N = [
|
|
|
570
574
|
// Isle of Man
|
|
571
575
|
"44",
|
|
572
576
|
2,
|
|
573
|
-
["1624", "74576", "7524", "7924", "7624"]
|
|
577
|
+
["1624", "74576", "7524", "7924", "7624"],
|
|
578
|
+
"0"
|
|
574
579
|
],
|
|
575
580
|
[
|
|
576
581
|
"il",
|
|
@@ -600,7 +605,8 @@ const N = [
|
|
|
600
605
|
// Jersey
|
|
601
606
|
"44",
|
|
602
607
|
3,
|
|
603
|
-
["1534", "7509", "7700", "7797", "7829", "7937"]
|
|
608
|
+
["1534", "7509", "7700", "7797", "7829", "7937"],
|
|
609
|
+
"0"
|
|
604
610
|
],
|
|
605
611
|
[
|
|
606
612
|
"jo",
|
|
@@ -612,7 +618,8 @@ const N = [
|
|
|
612
618
|
// Kazakhstan
|
|
613
619
|
"7",
|
|
614
620
|
1,
|
|
615
|
-
["33", "7"]
|
|
621
|
+
["33", "7"],
|
|
622
|
+
"8"
|
|
616
623
|
],
|
|
617
624
|
[
|
|
618
625
|
"ke",
|
|
@@ -744,7 +751,8 @@ const N = [
|
|
|
744
751
|
// Mayotte
|
|
745
752
|
"262",
|
|
746
753
|
1,
|
|
747
|
-
["269", "639"]
|
|
754
|
+
["269", "639"],
|
|
755
|
+
"0"
|
|
748
756
|
],
|
|
749
757
|
[
|
|
750
758
|
"mx",
|
|
@@ -787,7 +795,9 @@ const N = [
|
|
|
787
795
|
"ma",
|
|
788
796
|
// Morocco
|
|
789
797
|
"212",
|
|
790
|
-
0
|
|
798
|
+
0,
|
|
799
|
+
null,
|
|
800
|
+
"0"
|
|
791
801
|
],
|
|
792
802
|
[
|
|
793
803
|
"mz",
|
|
@@ -948,7 +958,9 @@ const N = [
|
|
|
948
958
|
"re",
|
|
949
959
|
// Réunion
|
|
950
960
|
"262",
|
|
951
|
-
0
|
|
961
|
+
0,
|
|
962
|
+
null,
|
|
963
|
+
"0"
|
|
952
964
|
],
|
|
953
965
|
[
|
|
954
966
|
"ro",
|
|
@@ -959,7 +971,9 @@ const N = [
|
|
|
959
971
|
"ru",
|
|
960
972
|
// Russia
|
|
961
973
|
"7",
|
|
962
|
-
0
|
|
974
|
+
0,
|
|
975
|
+
null,
|
|
976
|
+
"8"
|
|
963
977
|
],
|
|
964
978
|
[
|
|
965
979
|
"rw",
|
|
@@ -1231,7 +1245,9 @@ const N = [
|
|
|
1231
1245
|
"gb",
|
|
1232
1246
|
// United Kingdom
|
|
1233
1247
|
"44",
|
|
1234
|
-
0
|
|
1248
|
+
0,
|
|
1249
|
+
null,
|
|
1250
|
+
"0"
|
|
1235
1251
|
],
|
|
1236
1252
|
[
|
|
1237
1253
|
"us",
|
|
@@ -1288,7 +1304,8 @@ const N = [
|
|
|
1288
1304
|
// Western Sahara
|
|
1289
1305
|
"212",
|
|
1290
1306
|
1,
|
|
1291
|
-
["5288", "5289"]
|
|
1307
|
+
["5288", "5289"],
|
|
1308
|
+
"0"
|
|
1292
1309
|
],
|
|
1293
1310
|
[
|
|
1294
1311
|
"ye",
|
|
@@ -1315,7 +1332,8 @@ for (let u = 0; u < N.length; u++) {
|
|
|
1315
1332
|
dialCode: t[1],
|
|
1316
1333
|
priority: t[2] || 0,
|
|
1317
1334
|
areaCodes: t[3] || null,
|
|
1318
|
-
nodeById: {}
|
|
1335
|
+
nodeById: {},
|
|
1336
|
+
nationalPrefix: t[4] || null
|
|
1319
1337
|
};
|
|
1320
1338
|
}
|
|
1321
1339
|
const j = {
|
|
@@ -1631,7 +1649,7 @@ const T = {
|
|
|
1631
1649
|
) : !1,
|
|
1632
1650
|
//* The number type to enforce during validation.
|
|
1633
1651
|
validationNumberTypes: ["MOBILE"]
|
|
1634
|
-
},
|
|
1652
|
+
}, H = [
|
|
1635
1653
|
"800",
|
|
1636
1654
|
"822",
|
|
1637
1655
|
"833",
|
|
@@ -1653,10 +1671,10 @@ const T = {
|
|
|
1653
1671
|
const t = v(u);
|
|
1654
1672
|
if (t.charAt(0) === "1") {
|
|
1655
1673
|
const e = t.substr(1, 3);
|
|
1656
|
-
return
|
|
1674
|
+
return H.indexOf(e) !== -1;
|
|
1657
1675
|
}
|
|
1658
1676
|
return !1;
|
|
1659
|
-
},
|
|
1677
|
+
}, K = (u, t, e, i) => {
|
|
1660
1678
|
if (e === 0 && !i)
|
|
1661
1679
|
return 0;
|
|
1662
1680
|
let s = 0;
|
|
@@ -1702,9 +1720,9 @@ class G {
|
|
|
1702
1720
|
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((t) => t.toLowerCase())), this.countries.sort((t, e) => {
|
|
1703
1721
|
const { countryOrder: i } = this.options;
|
|
1704
1722
|
if (i) {
|
|
1705
|
-
const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2), o = s > -1,
|
|
1706
|
-
if (o ||
|
|
1707
|
-
return o &&
|
|
1723
|
+
const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2), o = s > -1, r = n > -1;
|
|
1724
|
+
if (o || r)
|
|
1725
|
+
return o && r ? s - n : o ? -1 : 1;
|
|
1708
1726
|
}
|
|
1709
1727
|
return t.name.localeCompare(e.name);
|
|
1710
1728
|
});
|
|
@@ -1759,7 +1777,7 @@ class G {
|
|
|
1759
1777
|
for (let s = 0; s < e.areaCodes.length; s++) {
|
|
1760
1778
|
const n = e.areaCodes[s];
|
|
1761
1779
|
for (let o = 1; o < n.length; o++) {
|
|
1762
|
-
const
|
|
1780
|
+
const r = n.substr(0, o), a = e.dialCode + r;
|
|
1763
1781
|
this._addToDialCodeMap(i, a), this._addToDialCodeMap(e.iso2, a);
|
|
1764
1782
|
}
|
|
1765
1783
|
this._addToDialCodeMap(e.iso2, e.dialCode + n);
|
|
@@ -1778,19 +1796,19 @@ class G {
|
|
|
1778
1796
|
containerClass: s,
|
|
1779
1797
|
hiddenInput: n,
|
|
1780
1798
|
dropdownContainer: o,
|
|
1781
|
-
fixDropdownWidth:
|
|
1782
|
-
useFullscreenPopup:
|
|
1783
|
-
countrySearch:
|
|
1784
|
-
i18n:
|
|
1799
|
+
fixDropdownWidth: r,
|
|
1800
|
+
useFullscreenPopup: a,
|
|
1801
|
+
countrySearch: c,
|
|
1802
|
+
i18n: d
|
|
1785
1803
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
t && (
|
|
1788
|
-
const
|
|
1789
|
-
if ((h = this.telInput.parentNode) == null || h.insertBefore(
|
|
1804
|
+
let C = "iti";
|
|
1805
|
+
t && (C += " iti--allow-dropdown"), i && (C += " iti--show-flags"), s && (C += ` ${s}`), a || (C += " iti--inline-dropdown");
|
|
1806
|
+
const p = y("div", { class: C });
|
|
1807
|
+
if ((h = this.telInput.parentNode) == null || h.insertBefore(p, this.telInput), t || i || e) {
|
|
1790
1808
|
this.countryContainer = y(
|
|
1791
1809
|
"div",
|
|
1792
1810
|
{ class: "iti__country-container" },
|
|
1793
|
-
|
|
1811
|
+
p
|
|
1794
1812
|
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
|
|
1795
1813
|
"button",
|
|
1796
1814
|
{
|
|
@@ -1822,19 +1840,19 @@ class G {
|
|
|
1822
1840
|
{ class: "iti__selected-dial-code" },
|
|
1823
1841
|
this.selectedCountry
|
|
1824
1842
|
)), t) {
|
|
1825
|
-
const f =
|
|
1843
|
+
const f = r ? "" : "iti--flexible-dropdown-width";
|
|
1826
1844
|
if (this.dropdownContent = y("div", {
|
|
1827
1845
|
id: `iti-${this.id}__dropdown-content`,
|
|
1828
1846
|
class: `iti__dropdown-content iti__hide ${f}`
|
|
1829
|
-
}),
|
|
1847
|
+
}), c && (this.searchInput = y(
|
|
1830
1848
|
"input",
|
|
1831
1849
|
{
|
|
1832
1850
|
type: "text",
|
|
1833
1851
|
class: "iti__search-input",
|
|
1834
|
-
placeholder:
|
|
1852
|
+
placeholder: d.searchPlaceholder,
|
|
1835
1853
|
role: "combobox",
|
|
1836
1854
|
"aria-expanded": "true",
|
|
1837
|
-
"aria-label":
|
|
1855
|
+
"aria-label": d.searchPlaceholder,
|
|
1838
1856
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1839
1857
|
"aria-autocomplete": "list",
|
|
1840
1858
|
autocomplete: "off"
|
|
@@ -1850,31 +1868,31 @@ class G {
|
|
|
1850
1868
|
class: "iti__country-list",
|
|
1851
1869
|
id: `iti-${this.id}__country-listbox`,
|
|
1852
1870
|
role: "listbox",
|
|
1853
|
-
"aria-label":
|
|
1871
|
+
"aria-label": d.countryListAriaLabel
|
|
1854
1872
|
},
|
|
1855
1873
|
this.dropdownContent
|
|
1856
|
-
), this._appendListItems(),
|
|
1874
|
+
), this._appendListItems(), c && this._updateSearchResultsText(), o) {
|
|
1857
1875
|
let g = "iti iti--container";
|
|
1858
|
-
|
|
1876
|
+
a ? g += " iti--fullscreen-popup" : g += " iti--inline-dropdown", this.dropdown = y("div", { class: g }), this.dropdown.appendChild(this.dropdownContent);
|
|
1859
1877
|
} else
|
|
1860
1878
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1861
1879
|
}
|
|
1862
1880
|
}
|
|
1863
|
-
if (
|
|
1881
|
+
if (p.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1864
1882
|
const _ = this.telInput.getAttribute("name") || "", f = n(_);
|
|
1865
1883
|
if (f.phone) {
|
|
1866
1884
|
const g = (m = this.telInput.form) == null ? void 0 : m.querySelector(`input[name="${f.phone}"]`);
|
|
1867
1885
|
g ? this.hiddenInput = g : (this.hiddenInput = y("input", {
|
|
1868
1886
|
type: "hidden",
|
|
1869
1887
|
name: f.phone
|
|
1870
|
-
}),
|
|
1888
|
+
}), p.appendChild(this.hiddenInput));
|
|
1871
1889
|
}
|
|
1872
1890
|
if (f.country) {
|
|
1873
1891
|
const g = (b = this.telInput.form) == null ? void 0 : b.querySelector(`input[name="${f.country}"]`);
|
|
1874
1892
|
g ? this.hiddenInputCountry = g : (this.hiddenInputCountry = y("input", {
|
|
1875
1893
|
type: "hidden",
|
|
1876
1894
|
name: f.country
|
|
1877
|
-
}),
|
|
1895
|
+
}), p.appendChild(this.hiddenInputCountry));
|
|
1878
1896
|
}
|
|
1879
1897
|
}
|
|
1880
1898
|
}
|
|
@@ -1903,12 +1921,12 @@ class G {
|
|
|
1903
1921
|
//* 1. Extracting a dial code from the given number
|
|
1904
1922
|
//* 2. Using explicit initialCountry
|
|
1905
1923
|
_setInitialState(t = !1) {
|
|
1906
|
-
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),
|
|
1907
|
-
if (o && !
|
|
1924
|
+
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), r = S(n), { initialCountry: a, geoIpLookup: c } = this.options, d = a === "auto" && c;
|
|
1925
|
+
if (o && !r)
|
|
1908
1926
|
this._updateCountryFromNumber(n);
|
|
1909
|
-
else if (!
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1927
|
+
else if (!d || t) {
|
|
1928
|
+
const C = a ? a.toLowerCase() : "";
|
|
1929
|
+
C && this._getCountryData(C, !0) ? this._setCountry(C) : o && r ? this._setCountry("us") : this._setCountry();
|
|
1912
1930
|
}
|
|
1913
1931
|
n && this._updateValFromNumber(n);
|
|
1914
1932
|
}
|
|
@@ -1968,35 +1986,35 @@ class G {
|
|
|
1968
1986
|
//* Initialize the tel input listeners.
|
|
1969
1987
|
_initTelInputListeners() {
|
|
1970
1988
|
const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: o } = this.options;
|
|
1971
|
-
let
|
|
1972
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (
|
|
1973
|
-
if (this.isAndroid && (
|
|
1974
|
-
const
|
|
1989
|
+
let r = !1;
|
|
1990
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (a) => {
|
|
1991
|
+
if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && n && o) {
|
|
1992
|
+
const p = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, p - 1), m = this.telInput.value.substring(p);
|
|
1975
1993
|
this.telInput.value = h + m, this._openDropdownWithPlus();
|
|
1976
1994
|
return;
|
|
1977
1995
|
}
|
|
1978
1996
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1979
|
-
const
|
|
1980
|
-
|
|
1981
|
-
const
|
|
1982
|
-
if (e && !
|
|
1983
|
-
const
|
|
1997
|
+
const c = (a == null ? void 0 : a.data) && /[^+0-9]/.test(a.data), d = (a == null ? void 0 : a.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1998
|
+
c || d && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
|
|
1999
|
+
const C = (a == null ? void 0 : a.detail) && a.detail.isSetNumber && !s;
|
|
2000
|
+
if (e && !r && !C) {
|
|
2001
|
+
const p = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, p).replace(/[^+0-9]/g, "").length, b = (a == null ? void 0 : a.inputType) === "deleteContentForward", _ = this._formatNumberAsYouType(), f = K(m, _, p, b);
|
|
1984
2002
|
this.telInput.value = _, this.telInput.setSelectionRange(f, f);
|
|
1985
2003
|
}
|
|
1986
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (
|
|
1987
|
-
if (
|
|
1988
|
-
if (i && n && o &&
|
|
1989
|
-
|
|
2004
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (a) => {
|
|
2005
|
+
if (a.key && a.key.length === 1 && !a.altKey && !a.ctrlKey && !a.metaKey) {
|
|
2006
|
+
if (i && n && o && a.key === "+") {
|
|
2007
|
+
a.preventDefault(), this._openDropdownWithPlus();
|
|
1990
2008
|
return;
|
|
1991
2009
|
}
|
|
1992
2010
|
if (t) {
|
|
1993
|
-
const
|
|
2011
|
+
const c = this.telInput.value, d = c.charAt(0) === "+", C = !d && this.telInput.selectionStart === 0 && a.key === "+", p = /^[0-9]$/.test(a.key), h = i ? p : C || p, m = c.slice(0, this.telInput.selectionStart) + a.key + c.slice(this.telInput.selectionEnd), b = this._getFullNumber(m), _ = l.utils.getCoreNumber(b, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && _.length > this.maxCoreNumberLength;
|
|
1994
2012
|
let g = !1;
|
|
1995
|
-
if (
|
|
2013
|
+
if (d) {
|
|
1996
2014
|
const P = this.selectedCountryData.iso2;
|
|
1997
2015
|
g = this._getCountryFromNumber(b) !== P;
|
|
1998
2016
|
}
|
|
1999
|
-
(!h || f && !g && !
|
|
2017
|
+
(!h || f && !g && !C) && a.preventDefault();
|
|
2000
2018
|
}
|
|
2001
2019
|
}
|
|
2002
2020
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2087,10 +2105,10 @@ class G {
|
|
|
2087
2105
|
this.countryList.innerHTML = "";
|
|
2088
2106
|
const s = A(t);
|
|
2089
2107
|
for (let n = 0; n < this.countries.length; n++) {
|
|
2090
|
-
const o = this.countries[n],
|
|
2091
|
-
if (e ||
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2108
|
+
const o = this.countries[n], r = A(o.name), a = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((d) => d[0]).join("").toLowerCase(), c = `+${o.dialCode}`;
|
|
2109
|
+
if (e || r.includes(s) || c.includes(s) || o.iso2.includes(s) || a.includes(s)) {
|
|
2110
|
+
const d = o.nodeById[this.id];
|
|
2111
|
+
d && this.countryList.appendChild(d), i && (this._highlightListItem(d, !1), i = !1);
|
|
2094
2112
|
}
|
|
2095
2113
|
}
|
|
2096
2114
|
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
@@ -2131,21 +2149,35 @@ class G {
|
|
|
2131
2149
|
const e = this._getCountryFromNumber(t);
|
|
2132
2150
|
return e !== null ? this._setCountry(e) : !1;
|
|
2133
2151
|
}
|
|
2152
|
+
_ensureHasDialCode(t) {
|
|
2153
|
+
const { dialCode: e, nationalPrefix: i } = this.selectedCountryData;
|
|
2154
|
+
if (t.charAt(0) === "+" || !e)
|
|
2155
|
+
return t;
|
|
2156
|
+
const o = i && t.charAt(0) === i && !this.options.separateDialCode ? t.substring(1) : t;
|
|
2157
|
+
return `+${e}${o}`;
|
|
2158
|
+
}
|
|
2134
2159
|
_getCountryFromNumber(t) {
|
|
2135
2160
|
const e = t.indexOf("+");
|
|
2136
2161
|
let i = e ? t.substring(e) : t;
|
|
2137
|
-
const s = this.selectedCountryData.dialCode;
|
|
2138
|
-
i
|
|
2139
|
-
const o = this._getDialCode(i, !0)
|
|
2162
|
+
const s = this.selectedCountryData.iso2, n = this.selectedCountryData.dialCode;
|
|
2163
|
+
i = this._ensureHasDialCode(i);
|
|
2164
|
+
const o = this._getDialCode(i, !0);
|
|
2165
|
+
if (o && o === this.prevDialCodeMatch)
|
|
2166
|
+
return null;
|
|
2167
|
+
this.prevDialCodeMatch = o;
|
|
2168
|
+
const r = v(i);
|
|
2140
2169
|
if (o) {
|
|
2141
|
-
const
|
|
2142
|
-
if (!
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2170
|
+
const a = v(o), c = this.dialCodeToIso2Map[a];
|
|
2171
|
+
if (!s && this.defaultCountry && c.includes(this.defaultCountry))
|
|
2172
|
+
return this.defaultCountry;
|
|
2173
|
+
const d = s && c.includes(s) && r.length === a.length;
|
|
2174
|
+
if (!(n === "1" && S(r)) && !d) {
|
|
2175
|
+
for (let p = 0; p < c.length; p++)
|
|
2176
|
+
if (c[p])
|
|
2177
|
+
return c[p];
|
|
2146
2178
|
}
|
|
2147
2179
|
} else {
|
|
2148
|
-
if (i.charAt(0) === "+" &&
|
|
2180
|
+
if (i.charAt(0) === "+" && r.length)
|
|
2149
2181
|
return "";
|
|
2150
2182
|
if ((!i || i === "+") && !this.selectedCountryData.iso2)
|
|
2151
2183
|
return this.defaultCountry;
|
|
@@ -2177,8 +2209,8 @@ class G {
|
|
|
2177
2209
|
_setCountry(t) {
|
|
2178
2210
|
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2179
2211
|
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2180
|
-
let o = "",
|
|
2181
|
-
t && i ? (o = `iti__flag iti__${t}`,
|
|
2212
|
+
let o = "", r = "";
|
|
2213
|
+
t && i ? (o = `iti__flag iti__${t}`, r = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (o = "iti__flag iti__globe", r = s.noCountrySelected), this.selectedCountryInner.className = o, this.selectedCountryA11yText.textContent = r;
|
|
2182
2214
|
}
|
|
2183
2215
|
if (this._setSelectedCountryTitleAttribute(t, e), e) {
|
|
2184
2216
|
const o = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
@@ -2204,11 +2236,11 @@ class G {
|
|
|
2204
2236
|
!1,
|
|
2205
2237
|
n,
|
|
2206
2238
|
!0
|
|
2207
|
-
),
|
|
2239
|
+
), r = o;
|
|
2208
2240
|
for (; l.utils.isPossibleNumber(o, s, i); )
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
this.maxCoreNumberLength =
|
|
2241
|
+
r = o, o += "0";
|
|
2242
|
+
const a = l.utils.getCoreNumber(r, s);
|
|
2243
|
+
this.maxCoreNumberLength = a.length, s === "by" && (this.maxCoreNumberLength = a.length + 1);
|
|
2212
2244
|
} else
|
|
2213
2245
|
this.maxCoreNumberLength = null;
|
|
2214
2246
|
}
|
|
@@ -2245,12 +2277,12 @@ class G {
|
|
|
2245
2277
|
} = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
|
|
2246
2278
|
if (l.utils && n) {
|
|
2247
2279
|
const o = l.utils.numberType[e];
|
|
2248
|
-
let
|
|
2280
|
+
let r = this.selectedCountryData.iso2 ? l.utils.getExampleNumber(
|
|
2249
2281
|
this.selectedCountryData.iso2,
|
|
2250
2282
|
i,
|
|
2251
2283
|
o
|
|
2252
2284
|
) : "";
|
|
2253
|
-
|
|
2285
|
+
r = this._beforeSetNumber(r), typeof s == "function" && (r = s(r, this.selectedCountryData)), this.telInput.setAttribute("placeholder", r);
|
|
2254
2286
|
}
|
|
2255
2287
|
}
|
|
2256
2288
|
//* Called when the user selects a list item from the dropdown.
|
|
@@ -2272,12 +2304,12 @@ class G {
|
|
|
2272
2304
|
}
|
|
2273
2305
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2274
2306
|
_scrollTo(t) {
|
|
2275
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s,
|
|
2276
|
-
if (
|
|
2277
|
-
e.scrollTop =
|
|
2278
|
-
else if (
|
|
2279
|
-
const
|
|
2280
|
-
e.scrollTop =
|
|
2307
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, c = a + r, d = a - n + e.scrollTop;
|
|
2308
|
+
if (a < n)
|
|
2309
|
+
e.scrollTop = d;
|
|
2310
|
+
else if (c > o) {
|
|
2311
|
+
const C = s - r;
|
|
2312
|
+
e.scrollTop = d - C;
|
|
2281
2313
|
}
|
|
2282
2314
|
}
|
|
2283
2315
|
//* Replace any existing dial code with the new one
|
|
@@ -2367,8 +2399,8 @@ class G {
|
|
|
2367
2399
|
"keydown",
|
|
2368
2400
|
this._handleCountryContainerKeydown
|
|
2369
2401
|
);
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2402
|
+
const r = this.telInput.closest("label");
|
|
2403
|
+
r && r.removeEventListener("click", this._handleLabelClick);
|
|
2372
2404
|
}
|
|
2373
2405
|
const { form: i } = this.telInput;
|
|
2374
2406
|
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);
|
|
@@ -2501,7 +2533,7 @@ const W = (u) => {
|
|
|
2501
2533
|
attachUtils: W,
|
|
2502
2534
|
startedLoadingUtilsScript: !1,
|
|
2503
2535
|
startedLoadingAutoCountry: !1,
|
|
2504
|
-
version: "25.0
|
|
2536
|
+
version: "25.1.0"
|
|
2505
2537
|
}
|
|
2506
2538
|
), J = {
|
|
2507
2539
|
__name: "IntlTelInput",
|
|
@@ -2536,37 +2568,37 @@ const W = (u) => {
|
|
|
2536
2568
|
"changeErrorCode"
|
|
2537
2569
|
], ["update:modelValue"]),
|
|
2538
2570
|
setup(u, { expose: t, emit: e }) {
|
|
2539
|
-
const i = x(u, "modelValue"), s = u, n = e, o = L(),
|
|
2540
|
-
let h =
|
|
2541
|
-
|
|
2571
|
+
const i = x(u, "modelValue"), s = u, n = e, o = L(), r = L(), a = L(!1), c = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, d = () => {
|
|
2572
|
+
let h = c();
|
|
2573
|
+
a.value !== h && (a.value = h, n("changeValidity", !!h), n(
|
|
2542
2574
|
"changeErrorCode",
|
|
2543
|
-
h ? null :
|
|
2575
|
+
h ? null : r.value.getValidationError()
|
|
2544
2576
|
));
|
|
2545
|
-
}, d = () => {
|
|
2546
|
-
var h;
|
|
2547
|
-
n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""), c();
|
|
2548
2577
|
}, C = () => {
|
|
2549
2578
|
var h;
|
|
2550
|
-
n("
|
|
2579
|
+
n("changeNumber", ((h = r.value) == null ? void 0 : h.getNumber()) ?? ""), d();
|
|
2580
|
+
}, p = () => {
|
|
2581
|
+
var h;
|
|
2582
|
+
n("changeCountry", ((h = r.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""), C(), d();
|
|
2551
2583
|
};
|
|
2552
2584
|
return E(() => {
|
|
2553
|
-
o.value && (
|
|
2585
|
+
o.value && (r.value = l(o.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled));
|
|
2554
2586
|
}), M(
|
|
2555
2587
|
() => s.disabled,
|
|
2556
2588
|
(h) => {
|
|
2557
2589
|
var m;
|
|
2558
|
-
return (m =
|
|
2590
|
+
return (m = r.value) == null ? void 0 : m.setDisabled(h);
|
|
2559
2591
|
}
|
|
2560
2592
|
), F(() => {
|
|
2561
2593
|
var h;
|
|
2562
|
-
return (h =
|
|
2563
|
-
}), t({ instance:
|
|
2594
|
+
return (h = r.value) == null ? void 0 : h.destroy();
|
|
2595
|
+
}), t({ instance: r, input: o }), (h, m) => B((V(), O("input", z({
|
|
2564
2596
|
ref_key: "input",
|
|
2565
2597
|
ref: o,
|
|
2566
2598
|
"onUpdate:modelValue": m[0] || (m[0] = (b) => i.value = b),
|
|
2567
2599
|
type: "tel",
|
|
2568
|
-
onCountrychange:
|
|
2569
|
-
onInput:
|
|
2600
|
+
onCountrychange: p,
|
|
2601
|
+
onInput: C
|
|
2570
2602
|
}, u.inputProps), null, 16)), [
|
|
2571
2603
|
[R, i.value]
|
|
2572
2604
|
]);
|