intl-tel-input 25.8.5 → 25.8.6
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 +7 -7
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +7 -6
- package/angular/build/IntlTelInputWithUtils.js +7 -6
- package/angular/build/types/countryDataManager.d.ts +25 -0
- package/angular/build/types/dropdown.d.ts +56 -0
- package/angular/build/types/types.d.ts +53 -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.js +8 -7
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +8 -7
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +2 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +7 -6
- package/react/build/IntlTelInput.js +7 -6
- package/react/build/IntlTelInputWithUtils.cjs +7 -6
- package/react/build/IntlTelInputWithUtils.js +7 -6
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +91 -86
- package/vue/build/IntlTelInputWithUtils.mjs +156 -151
- package/build/js/i18n/index.mjs +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as k, useModel as M, ref as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as k, 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,9 +1594,9 @@ 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;
|
|
@@ -1685,7 +1685,7 @@ const N = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
|
|
|
1685
1685
|
return n;
|
|
1686
1686
|
}
|
|
1687
1687
|
return t.length;
|
|
1688
|
-
},
|
|
1688
|
+
}, m = (u, t, e) => {
|
|
1689
1689
|
const i = document.createElement(u);
|
|
1690
1690
|
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
|
|
1691
1691
|
}, I = (u, ...t) => {
|
|
@@ -1805,21 +1805,21 @@ class L {
|
|
|
1805
1805
|
dropdownContainer: r,
|
|
1806
1806
|
fixDropdownWidth: o,
|
|
1807
1807
|
useFullscreenPopup: d,
|
|
1808
|
-
countrySearch:
|
|
1809
|
-
i18n:
|
|
1810
|
-
} = this.options,
|
|
1808
|
+
countrySearch: C,
|
|
1809
|
+
i18n: c
|
|
1810
|
+
} = this.options, p = L._buildClassNames({
|
|
1811
1811
|
iti: !0,
|
|
1812
1812
|
"iti--allow-dropdown": t,
|
|
1813
1813
|
"iti--show-flags": i,
|
|
1814
1814
|
"iti--inline-dropdown": !d,
|
|
1815
1815
|
[s]: !!s
|
|
1816
|
-
}),
|
|
1817
|
-
if ((a = this.telInput.parentNode) == null || a.insertBefore(
|
|
1818
|
-
this.countryContainer =
|
|
1816
|
+
}), y = m("div", { class: p });
|
|
1817
|
+
if ((a = this.telInput.parentNode) == null || a.insertBefore(y, this.telInput), t || i || e) {
|
|
1818
|
+
this.countryContainer = m(
|
|
1819
1819
|
"div",
|
|
1820
1820
|
{ class: "iti__country-container" },
|
|
1821
|
-
|
|
1822
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry =
|
|
1821
|
+
y
|
|
1822
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = m(
|
|
1823
1823
|
"button",
|
|
1824
1824
|
{
|
|
1825
1825
|
type: "button",
|
|
@@ -1830,42 +1830,42 @@ class L {
|
|
|
1830
1830
|
"aria-controls": `iti-${this.id}__dropdown-content`
|
|
1831
1831
|
},
|
|
1832
1832
|
this.countryContainer
|
|
1833
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1833
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
|
|
1834
1834
|
"div",
|
|
1835
1835
|
{ class: "iti__selected-country" },
|
|
1836
1836
|
this.countryContainer
|
|
1837
1837
|
);
|
|
1838
|
-
const _ =
|
|
1838
|
+
const _ = m(
|
|
1839
1839
|
"div",
|
|
1840
1840
|
{ class: "iti__selected-country-primary" },
|
|
1841
1841
|
this.selectedCountry
|
|
1842
1842
|
);
|
|
1843
|
-
if (this.selectedCountryInner =
|
|
1843
|
+
if (this.selectedCountryInner = m(
|
|
1844
1844
|
"div",
|
|
1845
1845
|
{ class: "iti__flag" },
|
|
1846
1846
|
_
|
|
1847
|
-
), t && (this.dropdownArrow =
|
|
1847
|
+
), t && (this.dropdownArrow = m(
|
|
1848
1848
|
"div",
|
|
1849
1849
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1850
1850
|
_
|
|
1851
|
-
)), e && (this.selectedDialCode =
|
|
1851
|
+
)), e && (this.selectedDialCode = m(
|
|
1852
1852
|
"div",
|
|
1853
1853
|
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1854
1854
|
this.selectedCountry
|
|
1855
1855
|
)), t) {
|
|
1856
1856
|
const b = o ? "" : "iti--flexible-dropdown-width";
|
|
1857
|
-
if (this.dropdownContent =
|
|
1857
|
+
if (this.dropdownContent = m("div", {
|
|
1858
1858
|
id: `iti-${this.id}__dropdown-content`,
|
|
1859
1859
|
class: `iti__dropdown-content iti__hide ${b}`,
|
|
1860
1860
|
role: "dialog",
|
|
1861
1861
|
"aria-modal": "true"
|
|
1862
|
-
}),
|
|
1863
|
-
const f =
|
|
1862
|
+
}), C) {
|
|
1863
|
+
const f = m(
|
|
1864
1864
|
"div",
|
|
1865
1865
|
{ class: "iti__search-input-wrapper" },
|
|
1866
1866
|
this.dropdownContent
|
|
1867
1867
|
);
|
|
1868
|
-
this.searchIcon =
|
|
1868
|
+
this.searchIcon = m(
|
|
1869
1869
|
"span",
|
|
1870
1870
|
{
|
|
1871
1871
|
class: "iti__search-icon",
|
|
@@ -1876,29 +1876,29 @@ class L {
|
|
|
1876
1876
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
1877
1877
|
<circle cx="11" cy="11" r="7" />
|
|
1878
1878
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1879
|
-
</svg>`, this.searchInput =
|
|
1879
|
+
</svg>`, this.searchInput = m(
|
|
1880
1880
|
"input",
|
|
1881
1881
|
{
|
|
1882
1882
|
id: `iti-${this.id}__search-input`,
|
|
1883
1883
|
// Chrome says inputs need either a name or an id
|
|
1884
1884
|
type: "search",
|
|
1885
1885
|
class: "iti__search-input",
|
|
1886
|
-
placeholder:
|
|
1886
|
+
placeholder: c.searchPlaceholder,
|
|
1887
1887
|
// 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
1888
|
role: "combobox",
|
|
1889
1889
|
"aria-expanded": "true",
|
|
1890
|
-
"aria-label":
|
|
1890
|
+
"aria-label": c.searchPlaceholder,
|
|
1891
1891
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1892
1892
|
"aria-autocomplete": "list",
|
|
1893
1893
|
autocomplete: "off"
|
|
1894
1894
|
},
|
|
1895
1895
|
f
|
|
1896
|
-
), this.searchClearButton =
|
|
1896
|
+
), this.searchClearButton = m(
|
|
1897
1897
|
"button",
|
|
1898
1898
|
{
|
|
1899
1899
|
type: "button",
|
|
1900
1900
|
class: "iti__search-clear iti__hide",
|
|
1901
|
-
"aria-label":
|
|
1901
|
+
"aria-label": c.clearSearchAriaLabel,
|
|
1902
1902
|
tabindex: "-1"
|
|
1903
1903
|
},
|
|
1904
1904
|
f
|
|
@@ -1911,11 +1911,11 @@ class L {
|
|
|
1911
1911
|
<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
1912
|
</mask>
|
|
1913
1913
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${S})" />
|
|
1914
|
-
</svg>`, this.searchResultsA11yText =
|
|
1914
|
+
</svg>`, this.searchResultsA11yText = m(
|
|
1915
1915
|
"span",
|
|
1916
1916
|
{ class: "iti__a11y-text" },
|
|
1917
1917
|
this.dropdownContent
|
|
1918
|
-
), this.searchNoResults =
|
|
1918
|
+
), this.searchNoResults = m(
|
|
1919
1919
|
"div",
|
|
1920
1920
|
{
|
|
1921
1921
|
class: "iti__no-results iti__hide",
|
|
@@ -1923,18 +1923,18 @@ class L {
|
|
|
1923
1923
|
// all a11y messaging happens in this.searchResultsA11yText
|
|
1924
1924
|
},
|
|
1925
1925
|
this.dropdownContent
|
|
1926
|
-
), this.searchNoResults.textContent =
|
|
1926
|
+
), this.searchNoResults.textContent = c.zeroSearchResults;
|
|
1927
1927
|
}
|
|
1928
|
-
if (this.countryList =
|
|
1928
|
+
if (this.countryList = m(
|
|
1929
1929
|
"ul",
|
|
1930
1930
|
{
|
|
1931
1931
|
class: "iti__country-list",
|
|
1932
1932
|
id: `iti-${this.id}__country-listbox`,
|
|
1933
1933
|
role: "listbox",
|
|
1934
|
-
"aria-label":
|
|
1934
|
+
"aria-label": c.countryListAriaLabel
|
|
1935
1935
|
},
|
|
1936
1936
|
this.dropdownContent
|
|
1937
|
-
), this._appendListItems(),
|
|
1937
|
+
), this._appendListItems(), C && this._updateSearchResultsA11yText(), r) {
|
|
1938
1938
|
const f = L._buildClassNames({
|
|
1939
1939
|
iti: !0,
|
|
1940
1940
|
"iti--container": !0,
|
|
@@ -1942,33 +1942,33 @@ class L {
|
|
|
1942
1942
|
"iti--inline-dropdown": !d,
|
|
1943
1943
|
[s]: !!s
|
|
1944
1944
|
});
|
|
1945
|
-
this.dropdown =
|
|
1945
|
+
this.dropdown = m("div", { class: f }), this.dropdown.appendChild(this.dropdownContent);
|
|
1946
1946
|
} else
|
|
1947
1947
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1948
1948
|
}
|
|
1949
1949
|
}
|
|
1950
|
-
if (
|
|
1950
|
+
if (y.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1951
1951
|
const _ = this.telInput.getAttribute("name") || "", b = n(_);
|
|
1952
1952
|
if (b.phone) {
|
|
1953
1953
|
const f = (h = this.telInput.form) == null ? void 0 : h.querySelector(`input[name="${b.phone}"]`);
|
|
1954
|
-
f ? this.hiddenInput = f : (this.hiddenInput =
|
|
1954
|
+
f ? this.hiddenInput = f : (this.hiddenInput = m("input", {
|
|
1955
1955
|
type: "hidden",
|
|
1956
1956
|
name: b.phone
|
|
1957
|
-
}),
|
|
1957
|
+
}), y.appendChild(this.hiddenInput));
|
|
1958
1958
|
}
|
|
1959
1959
|
if (b.country) {
|
|
1960
1960
|
const f = (g = this.telInput.form) == null ? void 0 : g.querySelector(`input[name="${b.country}"]`);
|
|
1961
|
-
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry =
|
|
1961
|
+
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = m("input", {
|
|
1962
1962
|
type: "hidden",
|
|
1963
1963
|
name: b.country
|
|
1964
|
-
}),
|
|
1964
|
+
}), y.appendChild(this.hiddenInputCountry));
|
|
1965
1965
|
}
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
1968
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1969
1969
|
_appendListItems() {
|
|
1970
1970
|
for (let t = 0; t < this.countries.length; t++) {
|
|
1971
|
-
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s =
|
|
1971
|
+
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
|
|
1972
1972
|
"li",
|
|
1973
1973
|
{
|
|
1974
1974
|
id: `iti-${this.id}__item-${e.iso2}`,
|
|
@@ -1990,12 +1990,12 @@ class L {
|
|
|
1990
1990
|
//* 1. Extracting a dial code from the given number
|
|
1991
1991
|
//* 2. Using explicit initialCountry
|
|
1992
1992
|
_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:
|
|
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: C } = this.options, c = d === "auto" && C;
|
|
1994
1994
|
if (r && !o)
|
|
1995
1995
|
this._updateCountryFromNumber(n);
|
|
1996
|
-
else if (!
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1996
|
+
else if (!c || t) {
|
|
1997
|
+
const p = d ? d.toLowerCase() : "";
|
|
1998
|
+
p && this._getCountryData(p, !0) ? this._setCountry(p) : r && o ? this._setCountry("us") : this._setCountry();
|
|
1999
1999
|
}
|
|
2000
2000
|
n && this._updateValFromNumber(n);
|
|
2001
2001
|
}
|
|
@@ -2058,16 +2058,16 @@ class L {
|
|
|
2058
2058
|
let r = !1;
|
|
2059
2059
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (o) => {
|
|
2060
2060
|
if (this.isAndroid && (o == null ? void 0 : o.data) === "+" && i && s && n) {
|
|
2061
|
-
const
|
|
2062
|
-
this.telInput.value =
|
|
2061
|
+
const p = this.telInput.selectionStart || 0, y = this.telInput.value.substring(0, p - 1), a = this.telInput.value.substring(p);
|
|
2062
|
+
this.telInput.value = y + a, this._openDropdownWithPlus();
|
|
2063
2063
|
return;
|
|
2064
2064
|
}
|
|
2065
2065
|
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
|
|
2066
|
+
const d = (o == null ? void 0 : o.data) && /[^+0-9]/.test(o.data), C = (o == null ? void 0 : o.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2067
|
+
d || C && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
|
|
2068
|
+
const c = (o == null ? void 0 : o.detail) && o.detail.isSetNumber;
|
|
2069
|
+
if (e && !r && !c) {
|
|
2070
|
+
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
2071
|
this.telInput.value = g, this.telInput.setSelectionRange(_, _);
|
|
2072
2072
|
}
|
|
2073
2073
|
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (o) => {
|
|
@@ -2077,8 +2077,8 @@ class L {
|
|
|
2077
2077
|
return;
|
|
2078
2078
|
}
|
|
2079
2079
|
if (t) {
|
|
2080
|
-
const d = this.telInput.value,
|
|
2081
|
-
(!
|
|
2080
|
+
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;
|
|
2081
|
+
(!y || _ && !f && !c) && o.preventDefault();
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2167,18 +2167,18 @@ class L {
|
|
|
2167
2167
|
_filterCountries(t, e = !1) {
|
|
2168
2168
|
let i = !0;
|
|
2169
2169
|
this.countryList.innerHTML = "";
|
|
2170
|
-
const s = A(t), n = s.length, r = [], o = [], d = [],
|
|
2170
|
+
const s = A(t), n = s.length, r = [], o = [], d = [], C = [], c = [], p = [];
|
|
2171
2171
|
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
|
|
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 ? C.push(a) : a.dialCodePlus.includes(s) ? c.push(a) : a.initials.includes(s) && p.push(a);
|
|
2173
|
+
const y = [
|
|
2174
2174
|
...r.sort((a, h) => a.priority - h.priority),
|
|
2175
2175
|
...o.sort((a, h) => a.priority - h.priority),
|
|
2176
2176
|
...d.sort((a, h) => a.priority - h.priority),
|
|
2177
|
-
...
|
|
2178
|
-
...
|
|
2179
|
-
...
|
|
2177
|
+
...C.sort((a, h) => a.priority - h.priority),
|
|
2178
|
+
...c.sort((a, h) => a.priority - h.priority),
|
|
2179
|
+
...p.sort((a, h) => a.priority - h.priority)
|
|
2180
2180
|
];
|
|
2181
|
-
for (const a of
|
|
2181
|
+
for (const a of y) {
|
|
2182
2182
|
const h = a.nodeById[this.id];
|
|
2183
2183
|
h && (this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1));
|
|
2184
2184
|
}
|
|
@@ -2237,12 +2237,12 @@ class L {
|
|
|
2237
2237
|
i = this._ensureHasDialCode(i);
|
|
2238
2238
|
const r = this._getDialCode(i, !0), o = v(i);
|
|
2239
2239
|
if (r) {
|
|
2240
|
-
const d = v(r),
|
|
2241
|
-
if (!s && this.defaultCountry &&
|
|
2240
|
+
const d = v(r), C = this.dialCodeToIso2Map[d];
|
|
2241
|
+
if (!s && this.defaultCountry && C.includes(this.defaultCountry))
|
|
2242
2242
|
return this.defaultCountry;
|
|
2243
|
-
const
|
|
2244
|
-
if (!(n === "1" && P(o)) && !
|
|
2245
|
-
for (const a of
|
|
2243
|
+
const c = this.selectedCountryData.areaCodes && o.length > d.length, p = s && C.includes(s) && !c;
|
|
2244
|
+
if (!(n === "1" && P(o)) && !p) {
|
|
2245
|
+
for (const a of C)
|
|
2246
2246
|
if (a)
|
|
2247
2247
|
return a;
|
|
2248
2248
|
}
|
|
@@ -2276,17 +2276,22 @@ class L {
|
|
|
2276
2276
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2277
2277
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2278
2278
|
_setCountry(t) {
|
|
2279
|
-
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2
|
|
2279
|
+
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 || "";
|
|
2280
2280
|
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2281
2281
|
const r = t && i ? `iti__flag iti__${t}` : "iti__flag iti__globe";
|
|
2282
2282
|
let o, d;
|
|
2283
|
-
|
|
2283
|
+
if (t) {
|
|
2284
|
+
const { name: C, dialCode: c } = this.selectedCountryData;
|
|
2285
|
+
d = C, o = s.selectedCountryAriaLabel.replace("${countryName}", C).replace("${dialCode}", `+${c}`);
|
|
2286
|
+
} else
|
|
2287
|
+
d = s.noCountrySelected, o = s.noCountrySelected;
|
|
2288
|
+
this.selectedCountryInner.className = r, this.selectedCountry.setAttribute("title", d), this.selectedCountry.setAttribute("aria-label", o);
|
|
2284
2289
|
}
|
|
2285
2290
|
if (e) {
|
|
2286
2291
|
const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2287
2292
|
this.selectedDialCode.innerHTML = r, this._updateInputPadding();
|
|
2288
2293
|
}
|
|
2289
|
-
return this._updatePlaceholder(), this._updateMaxLength(), n
|
|
2294
|
+
return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
|
|
2290
2295
|
}
|
|
2291
2296
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2292
2297
|
_updateInputPadding() {
|
|
@@ -2368,12 +2373,12 @@ class L {
|
|
|
2368
2373
|
}
|
|
2369
2374
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2370
2375
|
_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,
|
|
2376
|
+
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
2377
|
if (d < n)
|
|
2373
|
-
e.scrollTop =
|
|
2374
|
-
else if (
|
|
2375
|
-
const
|
|
2376
|
-
e.scrollTop =
|
|
2378
|
+
e.scrollTop = c;
|
|
2379
|
+
else if (C > r) {
|
|
2380
|
+
const p = s - o;
|
|
2381
|
+
e.scrollTop = c - p;
|
|
2377
2382
|
}
|
|
2378
2383
|
}
|
|
2379
2384
|
//* Replace any existing dial code with the new one
|
|
@@ -2595,7 +2600,7 @@ const Y = (u) => {
|
|
|
2595
2600
|
attachUtils: Y,
|
|
2596
2601
|
startedLoadingUtilsScript: !1,
|
|
2597
2602
|
startedLoadingAutoCountry: !1,
|
|
2598
|
-
version: "25.8.
|
|
2603
|
+
version: "25.8.6"
|
|
2599
2604
|
}
|
|
2600
2605
|
), Z = {
|
|
2601
2606
|
__name: "IntlTelInput",
|
|
@@ -2630,21 +2635,21 @@ const Y = (u) => {
|
|
|
2630
2635
|
"changeErrorCode"
|
|
2631
2636
|
], ["update:modelValue"]),
|
|
2632
2637
|
setup(u, { expose: t, emit: e }) {
|
|
2633
|
-
const i = M(u, "modelValue"), s = u, n = e, r =
|
|
2634
|
-
let a =
|
|
2638
|
+
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 = () => {
|
|
2639
|
+
let a = C();
|
|
2635
2640
|
d.value !== a && (d.value = a, n("changeValidity", !!a), n(
|
|
2636
2641
|
"changeErrorCode",
|
|
2637
2642
|
a ? null : o.value.getValidationError()
|
|
2638
2643
|
));
|
|
2639
|
-
},
|
|
2644
|
+
}, p = () => {
|
|
2640
2645
|
var a;
|
|
2641
|
-
n("changeNumber", ((a = o.value) == null ? void 0 : a.getNumber()) ?? ""),
|
|
2642
|
-
},
|
|
2646
|
+
n("changeNumber", ((a = o.value) == null ? void 0 : a.getNumber()) ?? ""), c();
|
|
2647
|
+
}, y = () => {
|
|
2643
2648
|
var a;
|
|
2644
|
-
n("changeCountry", ((a = o.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""),
|
|
2649
|
+
n("changeCountry", ((a = o.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""), p(), c();
|
|
2645
2650
|
};
|
|
2646
2651
|
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 =
|
|
2652
|
+
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
2653
|
}), B(
|
|
2649
2654
|
() => s.disabled,
|
|
2650
2655
|
(a) => {
|
|
@@ -2659,11 +2664,11 @@ const Y = (u) => {
|
|
|
2659
2664
|
ref: r,
|
|
2660
2665
|
"onUpdate:modelValue": h[0] || (h[0] = (g) => i.value = g),
|
|
2661
2666
|
type: "tel",
|
|
2662
|
-
onCountrychange:
|
|
2663
|
-
onInput:
|
|
2667
|
+
onCountrychange: y,
|
|
2668
|
+
onInput: p
|
|
2664
2669
|
}, u.inputProps), null, 16)), [
|
|
2665
2670
|
[
|
|
2666
|
-
|
|
2671
|
+
$,
|
|
2667
2672
|
i.value,
|
|
2668
2673
|
void 0,
|
|
2669
2674
|
{ lazy: !0 }
|