intl-tel-input 25.8.5 → 25.10.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 +10 -6
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +12 -8
- package/angular/build/IntlTelInputWithUtils.js +12 -8
- package/angular/build/types/intl-tel-input.d.ts +1 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/en/interface.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -0
- package/build/js/intlTelInput.js +13 -9
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +13 -9
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +11 -10
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +12 -8
- package/react/build/IntlTelInput.d.ts +1 -0
- package/react/build/IntlTelInput.js +12 -8
- package/react/build/IntlTelInputWithUtils.cjs +12 -8
- package/react/build/IntlTelInputWithUtils.js +12 -8
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +102 -95
- package/vue/build/IntlTelInputWithUtils.mjs +279 -272
- package/build/js/i18n/index.mjs +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as A, useModel as M, ref as N, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as V, openBlock as z, mergeProps as O, vModelText as $ } from "vue";
|
|
2
|
+
const j = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1323,7 +1323,7 @@ const $ = [
|
|
|
1323
1323
|
"263"
|
|
1324
1324
|
]
|
|
1325
1325
|
], w = [];
|
|
1326
|
-
for (const u of
|
|
1326
|
+
for (const u of j)
|
|
1327
1327
|
w.push({
|
|
1328
1328
|
name: "",
|
|
1329
1329
|
// populated in the plugin
|
|
@@ -1579,7 +1579,7 @@ const U = {
|
|
|
1579
1579
|
zm: "Zambia",
|
|
1580
1580
|
zw: "Zimbabwe"
|
|
1581
1581
|
}, H = {
|
|
1582
|
-
selectedCountryAriaLabel: "Change country, selected ${
|
|
1582
|
+
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1583
1583
|
noCountrySelected: "Select country",
|
|
1584
1584
|
countryListAriaLabel: "List of countries",
|
|
1585
1585
|
searchPlaceholder: "Search",
|
|
@@ -1594,13 +1594,15 @@ const U = {
|
|
|
1594
1594
|
for (const u of w)
|
|
1595
1595
|
u.name = T[u.iso2];
|
|
1596
1596
|
let K = 0;
|
|
1597
|
-
const
|
|
1597
|
+
const D = (u) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(u).matches, W = () => {
|
|
1598
1598
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1599
|
-
const u = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), t =
|
|
1599
|
+
const u = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), t = D("(max-width: 500px)"), e = D("(max-height: 600px)"), i = D("(pointer: coarse)");
|
|
1600
1600
|
return u || t || i && e;
|
|
1601
1601
|
}
|
|
1602
1602
|
return !1;
|
|
1603
1603
|
}, x = {
|
|
1604
|
+
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1605
|
+
allowPhonewords: !1,
|
|
1604
1606
|
//* Whether or not to allow the dropdown.
|
|
1605
1607
|
allowDropdown: !0,
|
|
1606
1608
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
@@ -1667,7 +1669,7 @@ const N = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
|
|
|
1667
1669
|
"887",
|
|
1668
1670
|
"888",
|
|
1669
1671
|
"889"
|
|
1670
|
-
], v = (u) => u.replace(/\D/g, ""),
|
|
1672
|
+
], v = (u) => u.replace(/\D/g, ""), k = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), P = (u) => {
|
|
1671
1673
|
const t = v(u);
|
|
1672
1674
|
if (t.charAt(0) === "1") {
|
|
1673
1675
|
const e = t.substring(1, 4);
|
|
@@ -1685,7 +1687,7 @@ const N = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
|
|
|
1685
1687
|
return n;
|
|
1686
1688
|
}
|
|
1687
1689
|
return t.length;
|
|
1688
|
-
},
|
|
1690
|
+
}, m = (u, t, e) => {
|
|
1689
1691
|
const i = document.createElement(u);
|
|
1690
1692
|
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
|
|
1691
1693
|
}, I = (u, ...t) => {
|
|
@@ -1725,7 +1727,7 @@ class L {
|
|
|
1725
1727
|
//* Precompute and cache country search tokens to speed up filtering
|
|
1726
1728
|
_cacheSearchTokens() {
|
|
1727
1729
|
for (const t of this.countries)
|
|
1728
|
-
t.normalisedName =
|
|
1730
|
+
t.normalisedName = k(t.name), t.initials = t.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((e) => e[0]).join("").toLowerCase(), t.dialCodePlus = `+${t.dialCode}`;
|
|
1729
1731
|
}
|
|
1730
1732
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1731
1733
|
_sortCountries() {
|
|
@@ -1805,21 +1807,21 @@ class L {
|
|
|
1805
1807
|
dropdownContainer: r,
|
|
1806
1808
|
fixDropdownWidth: o,
|
|
1807
1809
|
useFullscreenPopup: d,
|
|
1808
|
-
countrySearch:
|
|
1809
|
-
i18n:
|
|
1810
|
-
} = this.options,
|
|
1810
|
+
countrySearch: C,
|
|
1811
|
+
i18n: c
|
|
1812
|
+
} = this.options, p = L._buildClassNames({
|
|
1811
1813
|
iti: !0,
|
|
1812
1814
|
"iti--allow-dropdown": t,
|
|
1813
1815
|
"iti--show-flags": i,
|
|
1814
1816
|
"iti--inline-dropdown": !d,
|
|
1815
1817
|
[s]: !!s
|
|
1816
|
-
}),
|
|
1817
|
-
if ((a = this.telInput.parentNode) == null || a.insertBefore(
|
|
1818
|
-
this.countryContainer =
|
|
1818
|
+
}), y = m("div", { class: p });
|
|
1819
|
+
if ((a = this.telInput.parentNode) == null || a.insertBefore(y, this.telInput), t || i || e) {
|
|
1820
|
+
this.countryContainer = m(
|
|
1819
1821
|
"div",
|
|
1820
1822
|
{ class: "iti__country-container" },
|
|
1821
|
-
|
|
1822
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry =
|
|
1823
|
+
y
|
|
1824
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = m(
|
|
1823
1825
|
"button",
|
|
1824
1826
|
{
|
|
1825
1827
|
type: "button",
|
|
@@ -1830,42 +1832,42 @@ class L {
|
|
|
1830
1832
|
"aria-controls": `iti-${this.id}__dropdown-content`
|
|
1831
1833
|
},
|
|
1832
1834
|
this.countryContainer
|
|
1833
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1835
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
|
|
1834
1836
|
"div",
|
|
1835
1837
|
{ class: "iti__selected-country" },
|
|
1836
1838
|
this.countryContainer
|
|
1837
1839
|
);
|
|
1838
|
-
const _ =
|
|
1840
|
+
const _ = m(
|
|
1839
1841
|
"div",
|
|
1840
1842
|
{ class: "iti__selected-country-primary" },
|
|
1841
1843
|
this.selectedCountry
|
|
1842
1844
|
);
|
|
1843
|
-
if (this.selectedCountryInner =
|
|
1845
|
+
if (this.selectedCountryInner = m(
|
|
1844
1846
|
"div",
|
|
1845
1847
|
{ class: "iti__flag" },
|
|
1846
1848
|
_
|
|
1847
|
-
), t && (this.dropdownArrow =
|
|
1849
|
+
), t && (this.dropdownArrow = m(
|
|
1848
1850
|
"div",
|
|
1849
1851
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1850
1852
|
_
|
|
1851
|
-
)), e && (this.selectedDialCode =
|
|
1853
|
+
)), e && (this.selectedDialCode = m(
|
|
1852
1854
|
"div",
|
|
1853
1855
|
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1854
1856
|
this.selectedCountry
|
|
1855
1857
|
)), t) {
|
|
1856
1858
|
const b = o ? "" : "iti--flexible-dropdown-width";
|
|
1857
|
-
if (this.dropdownContent =
|
|
1859
|
+
if (this.dropdownContent = m("div", {
|
|
1858
1860
|
id: `iti-${this.id}__dropdown-content`,
|
|
1859
1861
|
class: `iti__dropdown-content iti__hide ${b}`,
|
|
1860
1862
|
role: "dialog",
|
|
1861
1863
|
"aria-modal": "true"
|
|
1862
|
-
}),
|
|
1863
|
-
const f =
|
|
1864
|
+
}), C) {
|
|
1865
|
+
const f = m(
|
|
1864
1866
|
"div",
|
|
1865
1867
|
{ class: "iti__search-input-wrapper" },
|
|
1866
1868
|
this.dropdownContent
|
|
1867
1869
|
);
|
|
1868
|
-
this.searchIcon =
|
|
1870
|
+
this.searchIcon = m(
|
|
1869
1871
|
"span",
|
|
1870
1872
|
{
|
|
1871
1873
|
class: "iti__search-icon",
|
|
@@ -1876,29 +1878,29 @@ class L {
|
|
|
1876
1878
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
1877
1879
|
<circle cx="11" cy="11" r="7" />
|
|
1878
1880
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1879
|
-
</svg>`, this.searchInput =
|
|
1881
|
+
</svg>`, this.searchInput = m(
|
|
1880
1882
|
"input",
|
|
1881
1883
|
{
|
|
1882
1884
|
id: `iti-${this.id}__search-input`,
|
|
1883
1885
|
// Chrome says inputs need either a name or an id
|
|
1884
1886
|
type: "search",
|
|
1885
1887
|
class: "iti__search-input",
|
|
1886
|
-
placeholder:
|
|
1888
|
+
placeholder: c.searchPlaceholder,
|
|
1887
1889
|
// role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
|
|
1888
1890
|
role: "combobox",
|
|
1889
1891
|
"aria-expanded": "true",
|
|
1890
|
-
"aria-label":
|
|
1892
|
+
"aria-label": c.searchPlaceholder,
|
|
1891
1893
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1892
1894
|
"aria-autocomplete": "list",
|
|
1893
1895
|
autocomplete: "off"
|
|
1894
1896
|
},
|
|
1895
1897
|
f
|
|
1896
|
-
), this.searchClearButton =
|
|
1898
|
+
), this.searchClearButton = m(
|
|
1897
1899
|
"button",
|
|
1898
1900
|
{
|
|
1899
1901
|
type: "button",
|
|
1900
1902
|
class: "iti__search-clear iti__hide",
|
|
1901
|
-
"aria-label":
|
|
1903
|
+
"aria-label": c.clearSearchAriaLabel,
|
|
1902
1904
|
tabindex: "-1"
|
|
1903
1905
|
},
|
|
1904
1906
|
f
|
|
@@ -1911,11 +1913,11 @@ class L {
|
|
|
1911
1913
|
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
1912
1914
|
</mask>
|
|
1913
1915
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${S})" />
|
|
1914
|
-
</svg>`, this.searchResultsA11yText =
|
|
1916
|
+
</svg>`, this.searchResultsA11yText = m(
|
|
1915
1917
|
"span",
|
|
1916
1918
|
{ class: "iti__a11y-text" },
|
|
1917
1919
|
this.dropdownContent
|
|
1918
|
-
), this.searchNoResults =
|
|
1920
|
+
), this.searchNoResults = m(
|
|
1919
1921
|
"div",
|
|
1920
1922
|
{
|
|
1921
1923
|
class: "iti__no-results iti__hide",
|
|
@@ -1923,18 +1925,18 @@ class L {
|
|
|
1923
1925
|
// all a11y messaging happens in this.searchResultsA11yText
|
|
1924
1926
|
},
|
|
1925
1927
|
this.dropdownContent
|
|
1926
|
-
), this.searchNoResults.textContent =
|
|
1928
|
+
), this.searchNoResults.textContent = c.zeroSearchResults;
|
|
1927
1929
|
}
|
|
1928
|
-
if (this.countryList =
|
|
1930
|
+
if (this.countryList = m(
|
|
1929
1931
|
"ul",
|
|
1930
1932
|
{
|
|
1931
1933
|
class: "iti__country-list",
|
|
1932
1934
|
id: `iti-${this.id}__country-listbox`,
|
|
1933
1935
|
role: "listbox",
|
|
1934
|
-
"aria-label":
|
|
1936
|
+
"aria-label": c.countryListAriaLabel
|
|
1935
1937
|
},
|
|
1936
1938
|
this.dropdownContent
|
|
1937
|
-
), this._appendListItems(),
|
|
1939
|
+
), this._appendListItems(), C && this._updateSearchResultsA11yText(), r) {
|
|
1938
1940
|
const f = L._buildClassNames({
|
|
1939
1941
|
iti: !0,
|
|
1940
1942
|
"iti--container": !0,
|
|
@@ -1942,33 +1944,33 @@ class L {
|
|
|
1942
1944
|
"iti--inline-dropdown": !d,
|
|
1943
1945
|
[s]: !!s
|
|
1944
1946
|
});
|
|
1945
|
-
this.dropdown =
|
|
1947
|
+
this.dropdown = m("div", { class: f }), this.dropdown.appendChild(this.dropdownContent);
|
|
1946
1948
|
} else
|
|
1947
1949
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1948
1950
|
}
|
|
1949
1951
|
}
|
|
1950
|
-
if (
|
|
1952
|
+
if (y.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1951
1953
|
const _ = this.telInput.getAttribute("name") || "", b = n(_);
|
|
1952
1954
|
if (b.phone) {
|
|
1953
1955
|
const f = (h = this.telInput.form) == null ? void 0 : h.querySelector(`input[name="${b.phone}"]`);
|
|
1954
|
-
f ? this.hiddenInput = f : (this.hiddenInput =
|
|
1956
|
+
f ? this.hiddenInput = f : (this.hiddenInput = m("input", {
|
|
1955
1957
|
type: "hidden",
|
|
1956
1958
|
name: b.phone
|
|
1957
|
-
}),
|
|
1959
|
+
}), y.appendChild(this.hiddenInput));
|
|
1958
1960
|
}
|
|
1959
1961
|
if (b.country) {
|
|
1960
1962
|
const f = (g = this.telInput.form) == null ? void 0 : g.querySelector(`input[name="${b.country}"]`);
|
|
1961
|
-
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry =
|
|
1963
|
+
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = m("input", {
|
|
1962
1964
|
type: "hidden",
|
|
1963
1965
|
name: b.country
|
|
1964
|
-
}),
|
|
1966
|
+
}), y.appendChild(this.hiddenInputCountry));
|
|
1965
1967
|
}
|
|
1966
1968
|
}
|
|
1967
1969
|
}
|
|
1968
1970
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1969
1971
|
_appendListItems() {
|
|
1970
1972
|
for (let t = 0; t < this.countries.length; t++) {
|
|
1971
|
-
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s =
|
|
1973
|
+
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
|
|
1972
1974
|
"li",
|
|
1973
1975
|
{
|
|
1974
1976
|
id: `iti-${this.id}__item-${e.iso2}`,
|
|
@@ -1990,12 +1992,12 @@ class L {
|
|
|
1990
1992
|
//* 1. Extracting a dial code from the given number
|
|
1991
1993
|
//* 2. Using explicit initialCountry
|
|
1992
1994
|
_setInitialState(t = !1) {
|
|
1993
|
-
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, r = this._getDialCode(n), o = P(n), { initialCountry: d, geoIpLookup:
|
|
1995
|
+
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, r = this._getDialCode(n), o = P(n), { initialCountry: d, geoIpLookup: C } = this.options, c = d === "auto" && C;
|
|
1994
1996
|
if (r && !o)
|
|
1995
1997
|
this._updateCountryFromNumber(n);
|
|
1996
|
-
else if (!
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1998
|
+
else if (!c || t) {
|
|
1999
|
+
const p = d ? d.toLowerCase() : "";
|
|
2000
|
+
p && this._getCountryData(p, !0) ? this._setCountry(p) : r && o ? this._setCountry("us") : this._setCountry();
|
|
1999
2001
|
}
|
|
2000
2002
|
n && this._updateValFromNumber(n);
|
|
2001
2003
|
}
|
|
@@ -2058,16 +2060,16 @@ class L {
|
|
|
2058
2060
|
let r = !1;
|
|
2059
2061
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (o) => {
|
|
2060
2062
|
if (this.isAndroid && (o == null ? void 0 : o.data) === "+" && i && s && n) {
|
|
2061
|
-
const
|
|
2062
|
-
this.telInput.value =
|
|
2063
|
+
const p = this.telInput.selectionStart || 0, y = this.telInput.value.substring(0, p - 1), a = this.telInput.value.substring(p);
|
|
2064
|
+
this.telInput.value = y + a, this._openDropdownWithPlus();
|
|
2063
2065
|
return;
|
|
2064
2066
|
}
|
|
2065
2067
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
2066
|
-
const d = (o == null ? void 0 : o.data) && /[^+0-9]/.test(o.data),
|
|
2067
|
-
d ||
|
|
2068
|
-
const
|
|
2069
|
-
if (e && !r && !
|
|
2070
|
-
const
|
|
2068
|
+
const d = (o == null ? void 0 : o.data) && /[^+0-9]/.test(o.data), C = (o == null ? void 0 : o.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2069
|
+
d || C && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
|
|
2070
|
+
const c = (o == null ? void 0 : o.detail) && o.detail.isSetNumber;
|
|
2071
|
+
if (e && !r && !c) {
|
|
2072
|
+
const p = this.telInput.selectionStart || 0, a = this.telInput.value.substring(0, p).replace(/[^+0-9]/g, "").length, h = (o == null ? void 0 : o.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), _ = G(a, g, p, h);
|
|
2071
2073
|
this.telInput.value = g, this.telInput.setSelectionRange(_, _);
|
|
2072
2074
|
}
|
|
2073
2075
|
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (o) => {
|
|
@@ -2077,8 +2079,8 @@ class L {
|
|
|
2077
2079
|
return;
|
|
2078
2080
|
}
|
|
2079
2081
|
if (t) {
|
|
2080
|
-
const d = this.telInput.value,
|
|
2081
|
-
(!
|
|
2082
|
+
const d = this.telInput.value, c = !(d.charAt(0) === "+") && this.telInput.selectionStart === 0 && o.key === "+", p = /^[0-9]$/.test(o.key), y = i ? p : c || p, a = d.slice(0, this.telInput.selectionStart) + o.key + d.slice(this.telInput.selectionEnd), h = this._getFullNumber(a), g = l.utils.getCoreNumber(h, this.selectedCountryData.iso2), _ = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength, f = this._getNewCountryFromNumber(h) !== null;
|
|
2083
|
+
(!y || _ && !f && !c) && o.preventDefault();
|
|
2082
2084
|
}
|
|
2083
2085
|
}
|
|
2084
2086
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2167,18 +2169,18 @@ class L {
|
|
|
2167
2169
|
_filterCountries(t, e = !1) {
|
|
2168
2170
|
let i = !0;
|
|
2169
2171
|
this.countryList.innerHTML = "";
|
|
2170
|
-
const s =
|
|
2172
|
+
const s = k(t), n = s.length, r = [], o = [], d = [], C = [], c = [], p = [];
|
|
2171
2173
|
for (const a of this.countries)
|
|
2172
|
-
e || n === 0 ? d.push(a) : a.iso2 === s ? r.push(a) : a.normalisedName.startsWith(s) ? o.push(a) : a.normalisedName.includes(s) ? d.push(a) : s === a.dialCode || s === a.dialCodePlus ?
|
|
2173
|
-
const
|
|
2174
|
+
e || n === 0 ? d.push(a) : a.iso2 === s ? r.push(a) : a.normalisedName.startsWith(s) ? o.push(a) : a.normalisedName.includes(s) ? d.push(a) : s === a.dialCode || s === a.dialCodePlus ? C.push(a) : a.dialCodePlus.includes(s) ? c.push(a) : a.initials.includes(s) && p.push(a);
|
|
2175
|
+
const y = [
|
|
2174
2176
|
...r.sort((a, h) => a.priority - h.priority),
|
|
2175
2177
|
...o.sort((a, h) => a.priority - h.priority),
|
|
2176
2178
|
...d.sort((a, h) => a.priority - h.priority),
|
|
2177
|
-
...
|
|
2178
|
-
...
|
|
2179
|
-
...
|
|
2179
|
+
...C.sort((a, h) => a.priority - h.priority),
|
|
2180
|
+
...c.sort((a, h) => a.priority - h.priority),
|
|
2181
|
+
...p.sort((a, h) => a.priority - h.priority)
|
|
2180
2182
|
];
|
|
2181
|
-
for (const a of
|
|
2183
|
+
for (const a of y) {
|
|
2182
2184
|
const h = a.nodeById[this.id];
|
|
2183
2185
|
h && (this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1));
|
|
2184
2186
|
}
|
|
@@ -2237,12 +2239,12 @@ class L {
|
|
|
2237
2239
|
i = this._ensureHasDialCode(i);
|
|
2238
2240
|
const r = this._getDialCode(i, !0), o = v(i);
|
|
2239
2241
|
if (r) {
|
|
2240
|
-
const d = v(r),
|
|
2241
|
-
if (!s && this.defaultCountry &&
|
|
2242
|
+
const d = v(r), C = this.dialCodeToIso2Map[d];
|
|
2243
|
+
if (!s && this.defaultCountry && C.includes(this.defaultCountry))
|
|
2242
2244
|
return this.defaultCountry;
|
|
2243
|
-
const
|
|
2244
|
-
if (!(n === "1" && P(o)) && !
|
|
2245
|
-
for (const a of
|
|
2245
|
+
const c = this.selectedCountryData.areaCodes && o.length > d.length, p = s && C.includes(s) && !c;
|
|
2246
|
+
if (!(n === "1" && P(o)) && !p) {
|
|
2247
|
+
for (const a of C)
|
|
2246
2248
|
if (a)
|
|
2247
2249
|
return a;
|
|
2248
2250
|
}
|
|
@@ -2276,17 +2278,22 @@ class L {
|
|
|
2276
2278
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2277
2279
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2278
2280
|
_setCountry(t) {
|
|
2279
|
-
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2
|
|
2281
|
+
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 || "";
|
|
2280
2282
|
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2281
2283
|
const r = t && i ? `iti__flag iti__${t}` : "iti__flag iti__globe";
|
|
2282
2284
|
let o, d;
|
|
2283
|
-
|
|
2285
|
+
if (t) {
|
|
2286
|
+
const { name: C, dialCode: c } = this.selectedCountryData;
|
|
2287
|
+
d = C, o = s.selectedCountryAriaLabel.replace("${countryName}", C).replace("${dialCode}", `+${c}`);
|
|
2288
|
+
} else
|
|
2289
|
+
d = s.noCountrySelected, o = s.noCountrySelected;
|
|
2290
|
+
this.selectedCountryInner.className = r, this.selectedCountry.setAttribute("title", d), this.selectedCountry.setAttribute("aria-label", o);
|
|
2284
2291
|
}
|
|
2285
2292
|
if (e) {
|
|
2286
2293
|
const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2287
2294
|
this.selectedDialCode.innerHTML = r, this._updateInputPadding();
|
|
2288
2295
|
}
|
|
2289
|
-
return this._updatePlaceholder(), this._updateMaxLength(), n
|
|
2296
|
+
return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
|
|
2290
2297
|
}
|
|
2291
2298
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2292
2299
|
_updateInputPadding() {
|
|
@@ -2368,12 +2375,12 @@ class L {
|
|
|
2368
2375
|
}
|
|
2369
2376
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2370
2377
|
_scrollTo(t) {
|
|
2371
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, r = n + s, o = t.offsetHeight, d = t.getBoundingClientRect().top + i,
|
|
2378
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, r = n + s, o = t.offsetHeight, d = t.getBoundingClientRect().top + i, C = d + o, c = d - n + e.scrollTop;
|
|
2372
2379
|
if (d < n)
|
|
2373
|
-
e.scrollTop =
|
|
2374
|
-
else if (
|
|
2375
|
-
const
|
|
2376
|
-
e.scrollTop =
|
|
2380
|
+
e.scrollTop = c;
|
|
2381
|
+
else if (C > r) {
|
|
2382
|
+
const p = s - o;
|
|
2383
|
+
e.scrollTop = c - p;
|
|
2377
2384
|
}
|
|
2378
2385
|
}
|
|
2379
2386
|
//* Replace any existing dial code with the new one
|
|
@@ -2525,12 +2532,12 @@ class L {
|
|
|
2525
2532
|
_validateNumber(t) {
|
|
2526
2533
|
if (!this.selectedCountryData.iso2)
|
|
2527
2534
|
return !1;
|
|
2528
|
-
const e = this.
|
|
2529
|
-
if (
|
|
2530
|
-
const
|
|
2531
|
-
return
|
|
2535
|
+
const e = (r) => t ? this._utilsIsValidNumber(r) : this._utilsIsPossibleNumber(r), i = this._getFullNumber(), s = i.search(new RegExp("\\p{L}", "u"));
|
|
2536
|
+
if (s > -1 && !this.options.allowPhonewords) {
|
|
2537
|
+
const r = i.substring(0, s), o = e(r), d = e(i);
|
|
2538
|
+
return o && d;
|
|
2532
2539
|
}
|
|
2533
|
-
return
|
|
2540
|
+
return e(i);
|
|
2534
2541
|
}
|
|
2535
2542
|
_utilsIsValidNumber(t) {
|
|
2536
2543
|
return l.utils ? l.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
@@ -2595,11 +2602,11 @@ const Y = (u) => {
|
|
|
2595
2602
|
attachUtils: Y,
|
|
2596
2603
|
startedLoadingUtilsScript: !1,
|
|
2597
2604
|
startedLoadingAutoCountry: !1,
|
|
2598
|
-
version: "25.
|
|
2605
|
+
version: "25.10.0"
|
|
2599
2606
|
}
|
|
2600
2607
|
), Z = {
|
|
2601
2608
|
__name: "IntlTelInput",
|
|
2602
|
-
props: /* @__PURE__ */
|
|
2609
|
+
props: /* @__PURE__ */ A({
|
|
2603
2610
|
disabled: {
|
|
2604
2611
|
type: Boolean,
|
|
2605
2612
|
default: !1
|
|
@@ -2623,28 +2630,28 @@ const Y = (u) => {
|
|
|
2623
2630
|
},
|
|
2624
2631
|
modelModifiers: {}
|
|
2625
2632
|
}),
|
|
2626
|
-
emits: /* @__PURE__ */
|
|
2633
|
+
emits: /* @__PURE__ */ A([
|
|
2627
2634
|
"changeNumber",
|
|
2628
2635
|
"changeCountry",
|
|
2629
2636
|
"changeValidity",
|
|
2630
2637
|
"changeErrorCode"
|
|
2631
2638
|
], ["update:modelValue"]),
|
|
2632
2639
|
setup(u, { expose: t, emit: e }) {
|
|
2633
|
-
const i = M(u, "modelValue"), s = u, n = e, r =
|
|
2634
|
-
let a =
|
|
2640
|
+
const i = M(u, "modelValue"), s = u, n = e, r = N(), o = N(), d = N(!1), C = () => o.value ? s.options.strictMode ? o.value.isValidNumberPrecise() : o.value.isValidNumber() : null, c = () => {
|
|
2641
|
+
let a = C();
|
|
2635
2642
|
d.value !== a && (d.value = a, n("changeValidity", !!a), n(
|
|
2636
2643
|
"changeErrorCode",
|
|
2637
2644
|
a ? null : o.value.getValidationError()
|
|
2638
2645
|
));
|
|
2639
|
-
},
|
|
2646
|
+
}, p = () => {
|
|
2640
2647
|
var a;
|
|
2641
|
-
n("changeNumber", ((a = o.value) == null ? void 0 : a.getNumber()) ?? ""),
|
|
2642
|
-
},
|
|
2648
|
+
n("changeNumber", ((a = o.value) == null ? void 0 : a.getNumber()) ?? ""), c();
|
|
2649
|
+
}, y = () => {
|
|
2643
2650
|
var a;
|
|
2644
|
-
n("changeCountry", ((a = o.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""),
|
|
2651
|
+
n("changeCountry", ((a = o.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""), p(), c();
|
|
2645
2652
|
};
|
|
2646
2653
|
return E(() => {
|
|
2647
|
-
r.value && (o.value = l(r.value, s.options), s.value && o.value.setNumber(s.value), s.disabled && o.value.setDisabled(s.disabled), d.value =
|
|
2654
|
+
r.value && (o.value = l(r.value, s.options), s.value && o.value.setNumber(s.value), s.disabled && o.value.setDisabled(s.disabled), d.value = C());
|
|
2648
2655
|
}), B(
|
|
2649
2656
|
() => s.disabled,
|
|
2650
2657
|
(a) => {
|
|
@@ -2659,11 +2666,11 @@ const Y = (u) => {
|
|
|
2659
2666
|
ref: r,
|
|
2660
2667
|
"onUpdate:modelValue": h[0] || (h[0] = (g) => i.value = g),
|
|
2661
2668
|
type: "tel",
|
|
2662
|
-
onCountrychange:
|
|
2663
|
-
onInput:
|
|
2669
|
+
onCountrychange: y,
|
|
2670
|
+
onInput: p
|
|
2664
2671
|
}, u.inputProps), null, 16)), [
|
|
2665
2672
|
[
|
|
2666
|
-
|
|
2673
|
+
$,
|
|
2667
2674
|
i.value,
|
|
2668
2675
|
void 0,
|
|
2669
2676
|
{ lazy: !0 }
|