intl-tel-input 25.15.0 → 25.15.1
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 +21 -19
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +1 -1
- package/angular/build/IntlTelInputWithUtils.js +125 -186
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/zh-hk/countries.js +245 -0
- package/build/js/i18n/zh-hk/index.js +5 -0
- package/build/js/i18n/zh-hk/interface.js +14 -0
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +126 -187
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +53 -54
- package/package.json +2 -2
- package/react/README.md +4 -2
- package/react/build/IntlTelInput.cjs +1 -1
- package/react/build/IntlTelInput.js +1 -1
- package/react/build/IntlTelInputWithUtils.cjs +125 -186
- package/react/build/IntlTelInputWithUtils.js +125 -186
- package/svelte/README.md +7 -9
- package/svelte/build/IntlTelInput.mjs +1329 -1329
- package/svelte/build/IntlTelInputWithUtils.mjs +1829 -1890
- package/vue/README.md +7 -9
- package/vue/build/IntlTelInput.mjs +1 -1
- package/vue/build/IntlTelInputWithUtils.mjs +125 -186
- package/vue/build/exports/IntlTelInput.mjs +1 -1
- package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
- package/vue/build/intl-tel-input/data.d.ts +18 -0
- package/vue/build/intl-tel-input/i18n/ar/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bg/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bn/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bs/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ca/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/cs/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/da/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/de/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ee/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/el/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/en/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/es/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fa/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hu/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/id/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/index.d.ts +43 -0
- package/vue/build/intl-tel-input/i18n/it/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ja/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ko/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/lt/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/mr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/nl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/no/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/pl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/pt/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ro/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ru/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sk/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sq/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sv/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/te/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/th/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/tr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/types.d.ts +10 -0
- package/vue/build/intl-tel-input/i18n/uk/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ur/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/uz/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/vi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/zh/index.d.ts +3 -0
- package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +2 -0
- package/vue/build/{intl-tel-input-Db39yQmC.mjs → intl-tel-input-f0-6rrpA.mjs} +136 -138
- package/vue/build/modules/core/ui.d.ts +0 -1
- package/vue/build/modules/format/formatting.d.ts +1 -1
- package/vue/build/modules/types/public-api.d.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const q = [
|
|
2
2
|
[
|
|
3
3
|
"af",
|
|
4
4
|
// Afghanistan
|
|
@@ -1676,7 +1676,7 @@ const Y = [
|
|
|
1676
1676
|
"0"
|
|
1677
1677
|
]
|
|
1678
1678
|
], A = [];
|
|
1679
|
-
for (const l of
|
|
1679
|
+
for (const l of q)
|
|
1680
1680
|
A.push({
|
|
1681
1681
|
name: "",
|
|
1682
1682
|
// populated in the plugin
|
|
@@ -1718,7 +1718,7 @@ const S = {
|
|
|
1718
1718
|
}, B = {
|
|
1719
1719
|
PASTE: "insertFromPaste",
|
|
1720
1720
|
DELETE_FWD: "deleteContentForward"
|
|
1721
|
-
},
|
|
1721
|
+
}, L = {
|
|
1722
1722
|
ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
|
|
1723
1723
|
// any kind of letter from any language
|
|
1724
1724
|
NON_PLUS_NUMERIC: /[^+0-9]/,
|
|
@@ -1727,19 +1727,19 @@ const S = {
|
|
|
1727
1727
|
// chars that are NOT + or digit (global)
|
|
1728
1728
|
HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
|
|
1729
1729
|
// single acceptable hidden-search char
|
|
1730
|
-
},
|
|
1730
|
+
}, X = {
|
|
1731
1731
|
HIDDEN_SEARCH_RESET_MS: 1e3
|
|
1732
1732
|
}, F = {
|
|
1733
1733
|
UNKNOWN_NUMBER_TYPE: -99,
|
|
1734
1734
|
UNKNOWN_VALIDATION_ERROR: -99
|
|
1735
|
-
},
|
|
1735
|
+
}, v = {
|
|
1736
1736
|
SANE_SELECTED_WITH_DIAL_WIDTH: 78,
|
|
1737
1737
|
// px width fallback when separateDialCode enabled
|
|
1738
1738
|
SANE_SELECTED_NO_DIAL_WIDTH: 42,
|
|
1739
1739
|
// px width fallback when no separate dial code
|
|
1740
1740
|
INPUT_PADDING_EXTRA_LEFT: 6
|
|
1741
1741
|
// px gap between selected country container and input text
|
|
1742
|
-
},
|
|
1742
|
+
}, j = {
|
|
1743
1743
|
NANP: "1"
|
|
1744
1744
|
// North American Numbering Plan
|
|
1745
1745
|
}, R = {
|
|
@@ -1749,9 +1749,9 @@ const S = {
|
|
|
1749
1749
|
// UK mobile numbers start with 7 after national trunk (0) or core section
|
|
1750
1750
|
MOBILE_CORE_LENGTH: 10
|
|
1751
1751
|
// core number length (excluding dial code / national prefix) for mobiles
|
|
1752
|
-
},
|
|
1752
|
+
}, Q = {
|
|
1753
1753
|
ISO2: "us"
|
|
1754
|
-
},
|
|
1754
|
+
}, M = {
|
|
1755
1755
|
AGGRESSIVE: "aggressive",
|
|
1756
1756
|
POLITE: "polite"
|
|
1757
1757
|
}, x = {
|
|
@@ -1769,30 +1769,31 @@ const S = {
|
|
|
1769
1769
|
HIDDEN: "aria-hidden",
|
|
1770
1770
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
1771
1771
|
MODAL: "aria-modal"
|
|
1772
|
-
},
|
|
1772
|
+
}, Z = {
|
|
1773
1773
|
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1774
1774
|
noCountrySelected: "Select country",
|
|
1775
1775
|
countryListAriaLabel: "List of countries",
|
|
1776
1776
|
searchPlaceholder: "Search",
|
|
1777
1777
|
clearSearchAriaLabel: "Clear search",
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1778
|
+
searchEmptyState: "No results found",
|
|
1779
|
+
searchSummaryAria(l) {
|
|
1780
|
+
return l === 0 ? "No results found" : l === 1 ? "1 result found" : `${l} results found`;
|
|
1781
|
+
}
|
|
1782
|
+
}, U = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, J = () => {
|
|
1782
1783
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1783
|
-
const l =
|
|
1784
|
-
|
|
1785
|
-
), t = U("(max-width: 500px)"), e = U("(max-height: 600px)"), s = U("(pointer: coarse)");
|
|
1786
|
-
return l || t || s && e;
|
|
1784
|
+
const l = U("(max-width: 500px)"), t = U("(max-height: 600px)"), e = U("(pointer: coarse)");
|
|
1785
|
+
return l || e && t;
|
|
1787
1786
|
}
|
|
1788
1787
|
return !1;
|
|
1789
|
-
},
|
|
1790
|
-
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1791
|
-
allowPhonewords: !1,
|
|
1788
|
+
}, K = {
|
|
1792
1789
|
//* Whether or not to allow the dropdown.
|
|
1793
1790
|
allowDropdown: !0,
|
|
1791
|
+
//* Whether or not to allow extensions after the main number.
|
|
1792
|
+
allowNumberExtensions: !1,
|
|
1793
|
+
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1794
|
+
allowPhonewords: !1,
|
|
1794
1795
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
1795
|
-
autoPlaceholder:
|
|
1796
|
+
autoPlaceholder: M.POLITE,
|
|
1796
1797
|
//* Modify the parentClass.
|
|
1797
1798
|
containerClass: "",
|
|
1798
1799
|
//* Locale for localising country names via Intl.DisplayNames.
|
|
@@ -1836,25 +1837,25 @@ const S = {
|
|
|
1836
1837
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1837
1838
|
strictMode: !1,
|
|
1838
1839
|
//* Use full screen popup instead of dropdown for country list.
|
|
1839
|
-
useFullscreenPopup:
|
|
1840
|
+
useFullscreenPopup: J(),
|
|
1840
1841
|
//* The number type to enforce during validation.
|
|
1841
|
-
|
|
1842
|
-
},
|
|
1843
|
-
l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...
|
|
1844
|
-
}, P = (l) => l.replace(/\D/g, ""),
|
|
1845
|
-
const e =
|
|
1846
|
-
for (const
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1842
|
+
allowedNumberTypes: ["MOBILE", "FIXED_LINE"]
|
|
1843
|
+
}, tt = (l) => {
|
|
1844
|
+
l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...Z, ...l.i18n };
|
|
1845
|
+
}, P = (l) => l.replace(/\D/g, ""), Y = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), et = (l, t) => {
|
|
1846
|
+
const e = Y(t), s = [], i = [], o = [], n = [], r = [], a = [];
|
|
1847
|
+
for (const c of l)
|
|
1848
|
+
c.iso2 === e ? s.push(c) : c.normalisedName.startsWith(e) ? i.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
|
|
1849
|
+
const d = (c, m) => c.priority - m.priority;
|
|
1849
1850
|
return [
|
|
1850
|
-
...s.sort(
|
|
1851
|
-
...i.sort(
|
|
1852
|
-
...o.sort(
|
|
1853
|
-
...n.sort(
|
|
1854
|
-
...r.sort(
|
|
1855
|
-
...a.sort(
|
|
1851
|
+
...s.sort(d),
|
|
1852
|
+
...i.sort(d),
|
|
1853
|
+
...o.sort(d),
|
|
1854
|
+
...n.sort(d),
|
|
1855
|
+
...r.sort(d),
|
|
1856
|
+
...a.sort(d)
|
|
1856
1857
|
];
|
|
1857
|
-
},
|
|
1858
|
+
}, st = (l, t) => {
|
|
1858
1859
|
const e = t.toLowerCase();
|
|
1859
1860
|
for (const s of l)
|
|
1860
1861
|
if (s.name.toLowerCase().startsWith(e))
|
|
@@ -1865,11 +1866,11 @@ const S = {
|
|
|
1865
1866
|
return t && Object.entries(t).forEach(
|
|
1866
1867
|
([i, o]) => s.setAttribute(i, o)
|
|
1867
1868
|
), e && e.appendChild(s), s;
|
|
1868
|
-
},
|
|
1869
|
+
}, it = () => `
|
|
1869
1870
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
|
|
1870
1871
|
<circle cx="11" cy="11" r="7" />
|
|
1871
1872
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1872
|
-
</svg>`,
|
|
1873
|
+
</svg>`, nt = (l) => {
|
|
1873
1874
|
const t = `iti-${l}-clear-mask`;
|
|
1874
1875
|
return `
|
|
1875
1876
|
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
|
|
@@ -1879,25 +1880,21 @@ const S = {
|
|
|
1879
1880
|
</mask>
|
|
1880
1881
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
|
1881
1882
|
</svg>`;
|
|
1882
|
-
},
|
|
1883
|
+
}, ot = () => `
|
|
1883
1884
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
1884
1885
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
1885
1886
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
1886
1887
|
</svg>`;
|
|
1887
|
-
class
|
|
1888
|
+
class lt {
|
|
1888
1889
|
constructor(t, e, s) {
|
|
1889
1890
|
this.highlightedItem = null, this.selectedItem = null, t.dataset.intlTelInputId = s.toString(), this.telInput = t, this.options = e, this.id = s, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
1890
1891
|
}
|
|
1891
1892
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1892
1893
|
generateMarkup(t) {
|
|
1893
|
-
this.countries = t, this.
|
|
1894
|
+
this.countries = t, this.telInput.classList.add("iti__tel-input");
|
|
1894
1895
|
const e = this._createWrapperAndInsert();
|
|
1895
1896
|
this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
|
|
1896
1897
|
}
|
|
1897
|
-
_prepareTelInput() {
|
|
1898
|
-
var t;
|
|
1899
|
-
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((t = this.telInput.form) != null && t.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1900
|
-
}
|
|
1901
1898
|
_createWrapperAndInsert() {
|
|
1902
1899
|
const { allowDropdown: t, showFlags: e, containerClass: s, useFullscreenPopup: i } = this.options, o = H({
|
|
1903
1900
|
iti: !0,
|
|
@@ -2000,7 +1997,7 @@ class ot {
|
|
|
2000
1997
|
[p.HIDDEN]: "true"
|
|
2001
1998
|
},
|
|
2002
1999
|
e
|
|
2003
|
-
), this.searchIcon.innerHTML =
|
|
2000
|
+
), this.searchIcon.innerHTML = it(), this.searchInput = C(
|
|
2004
2001
|
"input",
|
|
2005
2002
|
{
|
|
2006
2003
|
id: `iti-${this.id}__search-input`,
|
|
@@ -2026,7 +2023,7 @@ class ot {
|
|
|
2026
2023
|
tabindex: "-1"
|
|
2027
2024
|
},
|
|
2028
2025
|
e
|
|
2029
|
-
), this.searchClearButton.innerHTML =
|
|
2026
|
+
), this.searchClearButton.innerHTML = nt(this.id), this.searchResultsA11yText = C(
|
|
2030
2027
|
"span",
|
|
2031
2028
|
{ class: "iti__a11y-text" },
|
|
2032
2029
|
this.dropdownContent
|
|
@@ -2038,7 +2035,7 @@ class ot {
|
|
|
2038
2035
|
// all a11y messaging happens in this.searchResultsA11yText
|
|
2039
2036
|
},
|
|
2040
2037
|
this.dropdownContent
|
|
2041
|
-
), this.searchNoResults.textContent = t.
|
|
2038
|
+
), this.searchNoResults.textContent = t.searchEmptyState;
|
|
2042
2039
|
}
|
|
2043
2040
|
_maybeUpdateInputPaddingAndReveal() {
|
|
2044
2041
|
this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(h.V_HIDE));
|
|
@@ -2092,7 +2089,7 @@ class ot {
|
|
|
2092
2089
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2093
2090
|
updateInputPadding() {
|
|
2094
2091
|
if (this.selectedCountry) {
|
|
2095
|
-
const t = this.options.separateDialCode ?
|
|
2092
|
+
const t = this.options.separateDialCode ? v.SANE_SELECTED_WITH_DIAL_WIDTH : v.SANE_SELECTED_NO_DIAL_WIDTH, s = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + v.INPUT_PADDING_EXTRA_LEFT;
|
|
2096
2093
|
this.telInput.style.paddingLeft = `${s}px`;
|
|
2097
2094
|
}
|
|
2098
2095
|
}
|
|
@@ -2126,20 +2123,16 @@ class ot {
|
|
|
2126
2123
|
//* Update search results text (for a11y).
|
|
2127
2124
|
updateSearchResultsA11yText() {
|
|
2128
2125
|
const { i18n: t } = this.options, e = this.countryList.childElementCount;
|
|
2129
|
-
|
|
2130
|
-
e === 0 ? s = t.zeroSearchResults : t.searchResultsText ? s = t.searchResultsText(e) : e === 1 ? s = t.oneSearchResult : s = t.multipleSearchResults.replace(
|
|
2131
|
-
"${count}",
|
|
2132
|
-
e.toString()
|
|
2133
|
-
), this.searchResultsA11yText.textContent = s;
|
|
2126
|
+
this.searchResultsA11yText.textContent = t.searchSummaryAria(e);
|
|
2134
2127
|
}
|
|
2135
2128
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2136
2129
|
scrollTo(t) {
|
|
2137
|
-
const e = this.countryList, s = document.documentElement.scrollTop, i = e.offsetHeight, o = e.getBoundingClientRect().top + s, n = o + i, r = t.offsetHeight, a = t.getBoundingClientRect().top + s,
|
|
2130
|
+
const e = this.countryList, s = document.documentElement.scrollTop, i = e.offsetHeight, o = e.getBoundingClientRect().top + s, n = o + i, r = t.offsetHeight, a = t.getBoundingClientRect().top + s, d = a + r, c = a - o + e.scrollTop;
|
|
2138
2131
|
if (a < o)
|
|
2139
|
-
e.scrollTop =
|
|
2140
|
-
else if (
|
|
2132
|
+
e.scrollTop = c;
|
|
2133
|
+
else if (d > n) {
|
|
2141
2134
|
const m = i - r;
|
|
2142
|
-
e.scrollTop =
|
|
2135
|
+
e.scrollTop = c - m;
|
|
2143
2136
|
}
|
|
2144
2137
|
}
|
|
2145
2138
|
//* Remove highlighting from the previous list item and highlight the new one.
|
|
@@ -2178,7 +2171,7 @@ class ot {
|
|
|
2178
2171
|
this.countries = null;
|
|
2179
2172
|
}
|
|
2180
2173
|
}
|
|
2181
|
-
const
|
|
2174
|
+
const rt = (l) => {
|
|
2182
2175
|
const { onlyCountries: t, excludeCountries: e } = l;
|
|
2183
2176
|
if (t.length) {
|
|
2184
2177
|
const s = t.map(
|
|
@@ -2196,13 +2189,13 @@ const lt = (l) => {
|
|
|
2196
2189
|
);
|
|
2197
2190
|
}
|
|
2198
2191
|
return A;
|
|
2199
|
-
},
|
|
2192
|
+
}, at = (l, t) => {
|
|
2200
2193
|
const { countryNameLocale: e, i18n: s } = t, o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(e, {
|
|
2201
2194
|
type: "region"
|
|
2202
2195
|
}) : null;
|
|
2203
2196
|
for (const n of l)
|
|
2204
2197
|
n.name = s[n.iso2] || (o == null ? void 0 : o.of(n.iso2.toUpperCase()));
|
|
2205
|
-
},
|
|
2198
|
+
}, ut = (l) => {
|
|
2206
2199
|
const t = /* @__PURE__ */ new Set();
|
|
2207
2200
|
let e = 0;
|
|
2208
2201
|
const s = {}, i = (n, r) => {
|
|
@@ -2221,8 +2214,8 @@ const lt = (l) => {
|
|
|
2221
2214
|
if (i(n.iso2, n.dialCode), n.areaCodes) {
|
|
2222
2215
|
const r = s[n.dialCode][0];
|
|
2223
2216
|
for (const a of n.areaCodes) {
|
|
2224
|
-
for (let
|
|
2225
|
-
const
|
|
2217
|
+
for (let d = 1; d < a.length; d++) {
|
|
2218
|
+
const c = a.substring(0, d), m = n.dialCode + c;
|
|
2226
2219
|
i(r, m), i(n.iso2, m);
|
|
2227
2220
|
}
|
|
2228
2221
|
i(n.iso2, n.dialCode + a);
|
|
@@ -2230,7 +2223,7 @@ const lt = (l) => {
|
|
|
2230
2223
|
}
|
|
2231
2224
|
}
|
|
2232
2225
|
return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: s };
|
|
2233
|
-
},
|
|
2226
|
+
}, dt = (l, t) => {
|
|
2234
2227
|
t.countryOrder && (t.countryOrder = t.countryOrder.map(
|
|
2235
2228
|
(e) => e.toLowerCase()
|
|
2236
2229
|
)), l.sort((e, s) => {
|
|
@@ -2244,13 +2237,12 @@ const lt = (l) => {
|
|
|
2244
2237
|
});
|
|
2245
2238
|
}, ct = (l) => {
|
|
2246
2239
|
for (const t of l)
|
|
2247
|
-
t.normalisedName =
|
|
2248
|
-
},
|
|
2240
|
+
t.normalisedName = Y(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
2241
|
+
}, $ = (l, t, e, s) => {
|
|
2249
2242
|
let i = l;
|
|
2250
2243
|
if (e && t) {
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
i = i.substring(o);
|
|
2244
|
+
const o = `+${s.dialCode}`, n = i[o.length] === " " || i[o.length] === "-" ? o.length + 1 : o.length;
|
|
2245
|
+
i = i.substring(n);
|
|
2254
2246
|
}
|
|
2255
2247
|
return i;
|
|
2256
2248
|
}, ht = (l, t, e, s, i) => {
|
|
@@ -2285,20 +2277,20 @@ const lt = (l) => {
|
|
|
2285
2277
|
"887",
|
|
2286
2278
|
"888",
|
|
2287
2279
|
"889"
|
|
2288
|
-
],
|
|
2280
|
+
], G = (l) => {
|
|
2289
2281
|
const t = P(l);
|
|
2290
|
-
if (t.startsWith(
|
|
2282
|
+
if (t.startsWith(j.NANP) && t.length >= 4) {
|
|
2291
2283
|
const e = t.substring(1, 4);
|
|
2292
2284
|
return Ct.includes(e);
|
|
2293
2285
|
}
|
|
2294
2286
|
return !1;
|
|
2295
2287
|
};
|
|
2296
2288
|
let mt = 0;
|
|
2297
|
-
const ft = new Set(A.map((l) => l.iso2)),
|
|
2289
|
+
const ft = new Set(A.map((l) => l.iso2)), k = (l) => ft.has(l);
|
|
2298
2290
|
class W {
|
|
2299
2291
|
constructor(t, e = {}) {
|
|
2300
|
-
this.id = mt++, this.options = { ...
|
|
2301
|
-
const { dialCodes: s, dialCodeMaxLen: i, dialCodeToIso2Map: o } =
|
|
2292
|
+
this.id = mt++, this.options = { ...K, ...e }, tt(this.options), this.ui = new lt(t, this.options, this.id), this.isAndroid = W._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = rt(this.options);
|
|
2293
|
+
const { dialCodes: s, dialCodeMaxLen: i, dialCodeToIso2Map: o } = ut(
|
|
2302
2294
|
this.countries
|
|
2303
2295
|
);
|
|
2304
2296
|
this.dialCodes = s, this.dialCodeMaxLen = i, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
|
|
@@ -2348,18 +2340,18 @@ class W {
|
|
|
2348
2340
|
//********************
|
|
2349
2341
|
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2350
2342
|
_processCountryData() {
|
|
2351
|
-
|
|
2343
|
+
at(this.countries, this.options), dt(this.countries, this.options), ct(this.countries);
|
|
2352
2344
|
}
|
|
2353
2345
|
//* Set the initial state of the input value and the selected country by:
|
|
2354
2346
|
//* 1. Extracting a dial code from the given number
|
|
2355
2347
|
//* 2. Using explicit initialCountry
|
|
2356
2348
|
_setInitialState(t = !1) {
|
|
2357
|
-
const e = this.ui.telInput.getAttribute("value"), s = this._normaliseNumerals(e), i = this._getTelInputValue(), n = s && s.startsWith("+") && (!i || !i.startsWith("+")) ? s : i, r = this._getDialCode(n), a =
|
|
2349
|
+
const e = this.ui.telInput.getAttribute("value"), s = this._normaliseNumerals(e), i = this._getTelInputValue(), n = s && s.startsWith("+") && (!i || !i.startsWith("+")) ? s : i, r = this._getDialCode(n), a = G(n), { initialCountry: d, geoIpLookup: c } = this.options, m = d === x.AUTO && c;
|
|
2358
2350
|
if (r && !a)
|
|
2359
2351
|
this._updateCountryFromNumber(n);
|
|
2360
2352
|
else if (!m || t) {
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2353
|
+
const g = d ? d.toLowerCase() : "";
|
|
2354
|
+
k(g) ? this._setCountry(g) : r && a ? this._setCountry(Q.ISO2) : this._setCountry("");
|
|
2363
2355
|
}
|
|
2364
2356
|
n && this._updateValFromNumber(n);
|
|
2365
2357
|
}
|
|
@@ -2434,7 +2426,7 @@ class W {
|
|
|
2434
2426
|
u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
2435
2427
|
(t = "") => {
|
|
2436
2428
|
const e = t.toLowerCase();
|
|
2437
|
-
|
|
2429
|
+
k(e) ? (u.autoCountry = e, setTimeout(() => T("handleAutoCountry"))) : (this._setInitialState(!0), T("rejectAutoCountryPromise"));
|
|
2438
2430
|
},
|
|
2439
2431
|
() => {
|
|
2440
2432
|
this._setInitialState(!0), T("rejectAutoCountryPromise");
|
|
@@ -2457,38 +2449,42 @@ class W {
|
|
|
2457
2449
|
countrySearch: o
|
|
2458
2450
|
} = this.options;
|
|
2459
2451
|
let n = !1;
|
|
2460
|
-
|
|
2452
|
+
L.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
|
|
2461
2453
|
const r = (a) => {
|
|
2462
|
-
const
|
|
2454
|
+
const d = this._getTelInputValue();
|
|
2463
2455
|
if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && s && i && o) {
|
|
2464
|
-
const
|
|
2456
|
+
const _ = this.ui.telInput.selectionStart || 0, N = d.substring(0, _ - 1), I = d.substring(_);
|
|
2465
2457
|
this._setTelInputValue(N + I), this._openDropdownWithPlus();
|
|
2466
2458
|
return;
|
|
2467
2459
|
}
|
|
2468
|
-
this._updateCountryFromNumber(
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2471
|
-
const
|
|
2472
|
-
if (e && !n && !
|
|
2473
|
-
const
|
|
2460
|
+
this._updateCountryFromNumber(d) && this._triggerCountryChange();
|
|
2461
|
+
const c = (a == null ? void 0 : a.data) && L.NON_PLUS_NUMERIC.test(a.data), m = (a == null ? void 0 : a.inputType) === B.PASTE && d;
|
|
2462
|
+
c || m && !t ? n = !0 : L.NON_PLUS_NUMERIC.test(d) || (n = !1);
|
|
2463
|
+
const g = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, E = this.userNumeralSet === "ascii";
|
|
2464
|
+
if (e && !n && !g && E) {
|
|
2465
|
+
const _ = this.ui.telInput.selectionStart || 0, I = d.substring(
|
|
2474
2466
|
0,
|
|
2475
|
-
|
|
2467
|
+
_
|
|
2476
2468
|
).replace(
|
|
2477
|
-
|
|
2469
|
+
L.NON_PLUS_NUMERIC_GLOBAL,
|
|
2478
2470
|
""
|
|
2479
|
-
).length, D = (a == null ? void 0 : a.inputType) === B.DELETE_FWD, f = this._getFullNumber(),
|
|
2471
|
+
).length, D = (a == null ? void 0 : a.inputType) === B.DELETE_FWD, f = this._getFullNumber(), w = ht(
|
|
2480
2472
|
f,
|
|
2481
|
-
|
|
2473
|
+
d,
|
|
2482
2474
|
u.utils,
|
|
2483
2475
|
this.selectedCountryData,
|
|
2484
|
-
|
|
2476
|
+
s
|
|
2485
2477
|
), b = pt(
|
|
2486
2478
|
I,
|
|
2487
|
-
|
|
2488
|
-
|
|
2479
|
+
w,
|
|
2480
|
+
_,
|
|
2489
2481
|
D
|
|
2490
2482
|
);
|
|
2491
|
-
this._setTelInputValue(
|
|
2483
|
+
this._setTelInputValue(w), this.ui.telInput.setSelectionRange(b, b);
|
|
2484
|
+
}
|
|
2485
|
+
if (s && d.startsWith("+") && this.selectedCountryData.dialCode) {
|
|
2486
|
+
const _ = $(d, !0, s, this.selectedCountryData);
|
|
2487
|
+
this._setTelInputValue(_);
|
|
2492
2488
|
}
|
|
2493
2489
|
};
|
|
2494
2490
|
this.ui.telInput.addEventListener(
|
|
@@ -2509,11 +2505,11 @@ class W {
|
|
|
2509
2505
|
return;
|
|
2510
2506
|
}
|
|
2511
2507
|
if (t) {
|
|
2512
|
-
const r = this._getTelInputValue(),
|
|
2513
|
-
|
|
2508
|
+
const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), m = /^[0-9]$/.test(c), g = e ? m : d || m, E = this.ui.telInput, _ = E.selectionStart, N = E.selectionEnd, I = r.slice(0, _), D = r.slice(N), f = I + n.key + D, w = this._getFullNumber(f), b = u.utils.getCoreNumber(
|
|
2509
|
+
w,
|
|
2514
2510
|
this.selectedCountryData.iso2
|
|
2515
|
-
),
|
|
2516
|
-
(!
|
|
2511
|
+
), O = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, z = this._getNewCountryFromNumber(w) !== null;
|
|
2512
|
+
(!g || O && !z && !d) && n.preventDefault();
|
|
2517
2513
|
}
|
|
2518
2514
|
}
|
|
2519
2515
|
};
|
|
@@ -2526,24 +2522,24 @@ class W {
|
|
|
2526
2522
|
if (this.options.strictMode) {
|
|
2527
2523
|
const t = (e) => {
|
|
2528
2524
|
e.preventDefault();
|
|
2529
|
-
const s = this.ui.telInput, i = s.selectionStart, o = s.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, i), a = n.slice(o),
|
|
2525
|
+
const s = this.ui.telInput, i = s.selectionStart, o = s.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, i), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), m = this._normaliseNumerals(c), g = i === 0 && o > 0, E = !n.startsWith("+") || g, _ = m.replace(L.NON_PLUS_NUMERIC_GLOBAL, ""), N = _.startsWith("+"), I = _.replace(/\+/g, ""), D = N && E ? `+${I}` : I;
|
|
2530
2526
|
let f = r + D + a;
|
|
2531
2527
|
if (f.length > 5) {
|
|
2532
|
-
let b = u.utils.getCoreNumber(f,
|
|
2528
|
+
let b = u.utils.getCoreNumber(f, d);
|
|
2533
2529
|
for (; b.length === 0 && f.length > 0; )
|
|
2534
|
-
f = f.slice(0, -1), b = u.utils.getCoreNumber(f,
|
|
2530
|
+
f = f.slice(0, -1), b = u.utils.getCoreNumber(f, d);
|
|
2535
2531
|
if (!b)
|
|
2536
2532
|
return;
|
|
2537
2533
|
if (this.maxCoreNumberLength && b.length > this.maxCoreNumberLength)
|
|
2538
2534
|
if (s.selectionEnd === n.length) {
|
|
2539
|
-
const
|
|
2540
|
-
f = f.slice(0, f.length -
|
|
2535
|
+
const O = b.length - this.maxCoreNumberLength;
|
|
2536
|
+
f = f.slice(0, f.length - O);
|
|
2541
2537
|
} else
|
|
2542
2538
|
return;
|
|
2543
2539
|
}
|
|
2544
2540
|
this._setTelInputValue(f);
|
|
2545
|
-
const
|
|
2546
|
-
s.setSelectionRange(
|
|
2541
|
+
const w = i + D.length;
|
|
2542
|
+
s.setSelectionRange(w, w), s.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
|
|
2547
2543
|
};
|
|
2548
2544
|
this.ui.telInput.addEventListener("paste", t, {
|
|
2549
2545
|
signal: this.abortController.signal
|
|
@@ -2650,9 +2646,9 @@ class W {
|
|
|
2650
2646
|
y.ARROW_DOWN,
|
|
2651
2647
|
y.ENTER,
|
|
2652
2648
|
y.ESC
|
|
2653
|
-
].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === y.ARROW_UP || o.key === y.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === y.ENTER ? this._handleEnterKey() : o.key === y.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch &&
|
|
2649
|
+
].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === y.ARROW_UP || o.key === y.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === y.ENTER ? this._handleEnterKey() : o.key === y.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && L.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), s && clearTimeout(s), e += o.key.toLowerCase(), this._searchForCountry(e), s = setTimeout(() => {
|
|
2654
2650
|
e = "";
|
|
2655
|
-
},
|
|
2651
|
+
}, X.HIDDEN_SEARCH_RESET_MS));
|
|
2656
2652
|
};
|
|
2657
2653
|
document.addEventListener("keydown", i, { signal: t });
|
|
2658
2654
|
}
|
|
@@ -2680,7 +2676,7 @@ class W {
|
|
|
2680
2676
|
}
|
|
2681
2677
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2682
2678
|
_searchForCountry(t) {
|
|
2683
|
-
const e =
|
|
2679
|
+
const e = st(this.countries, t);
|
|
2684
2680
|
if (e) {
|
|
2685
2681
|
const s = e.nodeById[this.id];
|
|
2686
2682
|
this.ui.highlightListItem(s, !1), this.ui.scrollTo(s);
|
|
@@ -2689,7 +2685,7 @@ class W {
|
|
|
2689
2685
|
//* Country search: Filter the countries according to the search query.
|
|
2690
2686
|
_filterCountriesByQuery(t) {
|
|
2691
2687
|
let e;
|
|
2692
|
-
t === "" ? e = this.countries : e =
|
|
2688
|
+
t === "" ? e = this.countries : e = et(this.countries, t), this.ui.filterCountries(e);
|
|
2693
2689
|
}
|
|
2694
2690
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2695
2691
|
_handleUpDownKey(t) {
|
|
@@ -2739,14 +2735,14 @@ class W {
|
|
|
2739
2735
|
s = this._ensureHasDialCode(s);
|
|
2740
2736
|
const n = this._getDialCode(s, !0), r = P(s);
|
|
2741
2737
|
if (n) {
|
|
2742
|
-
const a = P(n),
|
|
2743
|
-
if (
|
|
2744
|
-
return
|
|
2745
|
-
if (!i && this.defaultCountry &&
|
|
2738
|
+
const a = P(n), d = this.dialCodeToIso2Map[a];
|
|
2739
|
+
if (d.length === 1)
|
|
2740
|
+
return d[0] === i ? null : d[0];
|
|
2741
|
+
if (!i && this.defaultCountry && d.includes(this.defaultCountry))
|
|
2746
2742
|
return this.defaultCountry;
|
|
2747
|
-
if (o ===
|
|
2743
|
+
if (o === j.NANP && G(r))
|
|
2748
2744
|
return null;
|
|
2749
|
-
const { areaCodes: m, priority:
|
|
2745
|
+
const { areaCodes: m, priority: g } = this.selectedCountryData;
|
|
2750
2746
|
if (m) {
|
|
2751
2747
|
const D = m.map(
|
|
2752
2748
|
(f) => `${o}${f}`
|
|
@@ -2755,9 +2751,9 @@ class W {
|
|
|
2755
2751
|
if (r.startsWith(f))
|
|
2756
2752
|
return null;
|
|
2757
2753
|
}
|
|
2758
|
-
const
|
|
2754
|
+
const _ = m && !(g === 0) && r.length > a.length, N = i && d.includes(i) && !_, I = i === d[0];
|
|
2759
2755
|
if (!N && !I)
|
|
2760
|
-
return
|
|
2756
|
+
return d[0];
|
|
2761
2757
|
} else if (s.startsWith("+") && r.length) {
|
|
2762
2758
|
const a = this.selectedCountryData.dialCode || "";
|
|
2763
2759
|
return a && a.startsWith(r) ? null : "";
|
|
@@ -2771,13 +2767,13 @@ class W {
|
|
|
2771
2767
|
const { separateDialCode: e, showFlags: s, i18n: i, allowDropdown: o } = this.options, n = this.selectedCountryData.iso2 || "";
|
|
2772
2768
|
if (o && this.ui.updateSelectedItem(t), this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
2773
2769
|
const r = t && s ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
|
|
2774
|
-
let a,
|
|
2770
|
+
let a, d, c;
|
|
2775
2771
|
if (t) {
|
|
2776
|
-
const { name: m, dialCode:
|
|
2777
|
-
|
|
2772
|
+
const { name: m, dialCode: g } = this.selectedCountryData;
|
|
2773
|
+
d = m, a = i.selectedCountryAriaLabel.replace("${countryName}", m).replace("${dialCode}", `+${g}`), c = "";
|
|
2778
2774
|
} else
|
|
2779
|
-
|
|
2780
|
-
this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title",
|
|
2775
|
+
d = i.noCountrySelected, a = i.noCountrySelected, c = ot();
|
|
2776
|
+
this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title", d), this.ui.selectedCountry.setAttribute(p.LABEL, a), this.ui.selectedCountryInner.innerHTML = c;
|
|
2781
2777
|
}
|
|
2782
2778
|
if (e) {
|
|
2783
2779
|
const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
@@ -2787,7 +2783,7 @@ class W {
|
|
|
2787
2783
|
}
|
|
2788
2784
|
//* Update the maximum valid number length for the currently selected country.
|
|
2789
2785
|
_updateMaxLength() {
|
|
2790
|
-
const { strictMode: t, placeholderNumberType: e,
|
|
2786
|
+
const { strictMode: t, placeholderNumberType: e, allowedNumberTypes: s } = this.options, { iso2: i } = this.selectedCountryData;
|
|
2791
2787
|
if (t && u.utils)
|
|
2792
2788
|
if (i) {
|
|
2793
2789
|
const o = u.utils.numberType[e];
|
|
@@ -2815,7 +2811,7 @@ class W {
|
|
|
2815
2811
|
placeholderNumberType: e,
|
|
2816
2812
|
nationalMode: s,
|
|
2817
2813
|
customPlaceholder: i
|
|
2818
|
-
} = this.options, o = t ===
|
|
2814
|
+
} = this.options, o = t === M.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === M.POLITE;
|
|
2819
2815
|
if (u.utils && o) {
|
|
2820
2816
|
const n = u.utils.numberType[e];
|
|
2821
2817
|
let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
|
|
@@ -2882,7 +2878,7 @@ class W {
|
|
|
2882
2878
|
}
|
|
2883
2879
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2884
2880
|
_beforeSetNumber(t) {
|
|
2885
|
-
const e = this._getDialCode(t), s =
|
|
2881
|
+
const e = !!this._getDialCode(t), s = $(
|
|
2886
2882
|
t,
|
|
2887
2883
|
e,
|
|
2888
2884
|
this.options.separateDialCode,
|
|
@@ -2972,7 +2968,7 @@ class W {
|
|
|
2972
2968
|
return u.utils ? u.utils.isPossibleNumber(
|
|
2973
2969
|
t,
|
|
2974
2970
|
this.selectedCountryData.iso2,
|
|
2975
|
-
this.options.
|
|
2971
|
+
this.options.allowedNumberTypes
|
|
2976
2972
|
) : null;
|
|
2977
2973
|
}
|
|
2978
2974
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
@@ -2981,24 +2977,26 @@ class W {
|
|
|
2981
2977
|
return null;
|
|
2982
2978
|
if (!this.selectedCountryData.iso2)
|
|
2983
2979
|
return !1;
|
|
2984
|
-
const e = (
|
|
2985
|
-
if (i
|
|
2986
|
-
|
|
2987
|
-
|
|
2980
|
+
const { allowNumberExtensions: e, allowPhonewords: s } = this.options, i = (a) => t ? this._utilsIsValidNumber(a) : this._utilsIsPossibleNumber(a), o = this._getFullNumber();
|
|
2981
|
+
if (!i(o))
|
|
2982
|
+
return !1;
|
|
2983
|
+
if (o.search(L.ALPHA_UNICODE) > -1) {
|
|
2984
|
+
const a = this.selectedCountryData.iso2;
|
|
2985
|
+
return u.utils.getExtension(o, a) ? e : s;
|
|
2988
2986
|
}
|
|
2989
|
-
return
|
|
2987
|
+
return !0;
|
|
2990
2988
|
}
|
|
2991
2989
|
_utilsIsValidNumber(t) {
|
|
2992
2990
|
return u.utils ? u.utils.isValidNumber(
|
|
2993
2991
|
t,
|
|
2994
2992
|
this.selectedCountryData.iso2,
|
|
2995
|
-
this.options.
|
|
2993
|
+
this.options.allowedNumberTypes
|
|
2996
2994
|
) : null;
|
|
2997
2995
|
}
|
|
2998
2996
|
//* Update the selected country, and update the input val accordingly.
|
|
2999
2997
|
setCountry(t) {
|
|
3000
2998
|
const e = t == null ? void 0 : t.toLowerCase();
|
|
3001
|
-
if (!
|
|
2999
|
+
if (!k(e))
|
|
3002
3000
|
throw new Error(`Invalid country code: '${e}'`);
|
|
3003
3001
|
const s = this.selectedCountryData.iso2;
|
|
3004
3002
|
if (t && e !== s || !t && s) {
|
|
@@ -3060,7 +3058,7 @@ const yt = (l) => {
|
|
|
3060
3058
|
return u.instances[e.id] = e, l.iti = e, e;
|
|
3061
3059
|
},
|
|
3062
3060
|
{
|
|
3063
|
-
defaults:
|
|
3061
|
+
defaults: K,
|
|
3064
3062
|
//* Using a static var like this allows us to mock it in the tests.
|
|
3065
3063
|
documentReady: () => document.readyState === "complete",
|
|
3066
3064
|
//* Get the country data object.
|
|
@@ -3075,7 +3073,7 @@ const yt = (l) => {
|
|
|
3075
3073
|
attachUtils: yt,
|
|
3076
3074
|
startedLoadingUtilsScript: !1,
|
|
3077
3075
|
startedLoadingAutoCountry: !1,
|
|
3078
|
-
version: "
|
|
3076
|
+
version: "26.0.0-beta.1"
|
|
3079
3077
|
}
|
|
3080
3078
|
);
|
|
3081
3079
|
export {
|
|
@@ -27,7 +27,6 @@ export default class UI {
|
|
|
27
27
|
readonly hadInitialPlaceholder: boolean;
|
|
28
28
|
constructor(input: HTMLInputElement, options: AllOptions, id: number);
|
|
29
29
|
generateMarkup(countries: Country[]): void;
|
|
30
|
-
private _prepareTelInput;
|
|
31
30
|
private _createWrapperAndInsert;
|
|
32
31
|
private _maybeBuildCountryContainer;
|
|
33
32
|
private _buildDropdownContent;
|