intl-tel-input 25.10.7 → 25.10.8
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 +5 -5
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +385 -319
- package/angular/build/IntlTelInputWithUtils.js +436 -341
- package/angular/build/types/intl-tel-input/angular.d.ts +2 -1
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +2 -1
- package/angular/build/types/intl-tel-input/data.d.ts +3 -1
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +2 -245
- package/angular/build/types/intl-tel-input.d.ts +16 -87
- package/angular/build/types/modules/core/options.d.ts +3 -0
- package/angular/build/types/modules/data/country-data.d.ts +12 -0
- package/angular/build/types/modules/data/nanp-regionless.d.ts +2 -0
- package/angular/build/types/modules/format/caret.d.ts +1 -0
- package/angular/build/types/modules/format/formatting.d.ts +3 -0
- package/angular/build/types/modules/types/public-api.d.ts +79 -0
- package/angular/build/types/modules/utils/dom.d.ts +1 -0
- package/angular/build/types/modules/utils/string.d.ts +2 -0
- package/build/js/data.js +3 -2
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +99 -292
- package/build/js/intlTelInput.js +431 -360
- package/build/js/intlTelInput.min.js +13 -13
- package/build/js/intlTelInputWithUtils.js +482 -382
- package/build/js/intlTelInputWithUtils.min.js +13 -13
- package/build/js/utils.js +18 -15
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +430 -359
- package/react/build/IntlTelInput.d.ts +103 -294
- package/react/build/IntlTelInput.js +430 -359
- package/react/build/IntlTelInputWithUtils.cjs +481 -381
- package/react/build/IntlTelInputWithUtils.js +481 -381
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +483 -443
- package/vue/build/IntlTelInputWithUtils.mjs +1128 -1059
|
@@ -1606,11 +1606,7 @@ var interface_default = interfaceTranslations;
|
|
|
1606
1606
|
var allTranslations = { ...countries_default, ...interface_default };
|
|
1607
1607
|
var en_default = allTranslations;
|
|
1608
1608
|
|
|
1609
|
-
// src/js/
|
|
1610
|
-
for (const c of data_default) {
|
|
1611
|
-
c.name = en_default[c.iso2];
|
|
1612
|
-
}
|
|
1613
|
-
var id = 0;
|
|
1609
|
+
// src/js/modules/core/options.ts
|
|
1614
1610
|
var mq = (q) => {
|
|
1615
1611
|
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1616
1612
|
};
|
|
@@ -1676,6 +1672,181 @@ var defaults = {
|
|
|
1676
1672
|
//* The number type to enforce during validation.
|
|
1677
1673
|
validationNumberTypes: ["MOBILE"]
|
|
1678
1674
|
};
|
|
1675
|
+
function applyOptionSideEffects(o) {
|
|
1676
|
+
if (o.useFullscreenPopup) {
|
|
1677
|
+
o.fixDropdownWidth = false;
|
|
1678
|
+
}
|
|
1679
|
+
if (o.onlyCountries.length === 1) {
|
|
1680
|
+
o.initialCountry = o.onlyCountries[0];
|
|
1681
|
+
}
|
|
1682
|
+
if (o.separateDialCode) {
|
|
1683
|
+
o.nationalMode = false;
|
|
1684
|
+
}
|
|
1685
|
+
if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
|
|
1686
|
+
o.nationalMode = false;
|
|
1687
|
+
}
|
|
1688
|
+
if (o.useFullscreenPopup && !o.dropdownContainer) {
|
|
1689
|
+
o.dropdownContainer = document.body;
|
|
1690
|
+
}
|
|
1691
|
+
o.i18n = { ...en_default, ...o.i18n };
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// src/js/modules/utils/string.ts
|
|
1695
|
+
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
1696
|
+
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1697
|
+
|
|
1698
|
+
// src/js/modules/utils/dom.ts
|
|
1699
|
+
var createEl = (tagName, attrs, container) => {
|
|
1700
|
+
const el = document.createElement(tagName);
|
|
1701
|
+
if (attrs) {
|
|
1702
|
+
Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
|
|
1703
|
+
}
|
|
1704
|
+
if (container) {
|
|
1705
|
+
container.appendChild(el);
|
|
1706
|
+
}
|
|
1707
|
+
return el;
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
// src/js/modules/data/country-data.ts
|
|
1711
|
+
function processAllCountries(options) {
|
|
1712
|
+
const { onlyCountries, excludeCountries } = options;
|
|
1713
|
+
if (onlyCountries.length) {
|
|
1714
|
+
const lowerCaseOnlyCountries = onlyCountries.map((country) => country.toLowerCase());
|
|
1715
|
+
return data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
|
|
1716
|
+
} else if (excludeCountries.length) {
|
|
1717
|
+
const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
|
|
1718
|
+
return data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
|
|
1719
|
+
}
|
|
1720
|
+
return data_default;
|
|
1721
|
+
}
|
|
1722
|
+
function translateCountryNames(countries, options) {
|
|
1723
|
+
for (const c of countries) {
|
|
1724
|
+
const iso2 = c.iso2.toLowerCase();
|
|
1725
|
+
if (options.i18n[iso2]) {
|
|
1726
|
+
c.name = options.i18n[iso2];
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
function processDialCodes(countries, options) {
|
|
1731
|
+
const dialCodes = /* @__PURE__ */ new Set();
|
|
1732
|
+
let dialCodeMaxLen = 0;
|
|
1733
|
+
const dialCodeToIso2Map = {};
|
|
1734
|
+
const _addToDialCodeMap = (iso2, dialCode, priority) => {
|
|
1735
|
+
if (!iso2 || !dialCode) {
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
if (dialCode.length > dialCodeMaxLen) {
|
|
1739
|
+
dialCodeMaxLen = dialCode.length;
|
|
1740
|
+
}
|
|
1741
|
+
if (!dialCodeToIso2Map.hasOwnProperty(dialCode)) {
|
|
1742
|
+
dialCodeToIso2Map[dialCode] = [];
|
|
1743
|
+
}
|
|
1744
|
+
const iso2List = dialCodeToIso2Map[dialCode];
|
|
1745
|
+
if (iso2List.includes(iso2)) {
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
const index = priority !== void 0 ? priority : iso2List.length;
|
|
1749
|
+
iso2List[index] = iso2;
|
|
1750
|
+
};
|
|
1751
|
+
for (const c of countries) {
|
|
1752
|
+
if (!dialCodes.has(c.dialCode)) {
|
|
1753
|
+
dialCodes.add(c.dialCode);
|
|
1754
|
+
}
|
|
1755
|
+
_addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1756
|
+
}
|
|
1757
|
+
if (options.onlyCountries.length || options.excludeCountries.length) {
|
|
1758
|
+
dialCodes.forEach((dialCode) => {
|
|
1759
|
+
dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
for (const c of countries) {
|
|
1763
|
+
if (c.areaCodes) {
|
|
1764
|
+
const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
|
|
1765
|
+
for (const areaCode of c.areaCodes) {
|
|
1766
|
+
for (let k = 1; k < areaCode.length; k++) {
|
|
1767
|
+
const partialAreaCode = areaCode.substring(0, k);
|
|
1768
|
+
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1769
|
+
_addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1770
|
+
_addToDialCodeMap(c.iso2, partialDialCode);
|
|
1771
|
+
}
|
|
1772
|
+
_addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return { dialCodes, dialCodeMaxLen, dialCodeToIso2Map };
|
|
1777
|
+
}
|
|
1778
|
+
function sortCountries(countries, options) {
|
|
1779
|
+
if (options.countryOrder) {
|
|
1780
|
+
options.countryOrder = options.countryOrder.map((iso2) => iso2.toLowerCase());
|
|
1781
|
+
}
|
|
1782
|
+
countries.sort((a, b) => {
|
|
1783
|
+
const { countryOrder } = options;
|
|
1784
|
+
if (countryOrder) {
|
|
1785
|
+
const aIndex = countryOrder.indexOf(a.iso2);
|
|
1786
|
+
const bIndex = countryOrder.indexOf(b.iso2);
|
|
1787
|
+
const aIndexExists = aIndex > -1;
|
|
1788
|
+
const bIndexExists = bIndex > -1;
|
|
1789
|
+
if (aIndexExists || bIndexExists) {
|
|
1790
|
+
if (aIndexExists && bIndexExists) {
|
|
1791
|
+
return aIndex - bIndex;
|
|
1792
|
+
}
|
|
1793
|
+
return aIndexExists ? -1 : 1;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return a.name.localeCompare(b.name);
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
function cacheSearchTokens(countries) {
|
|
1800
|
+
for (const c of countries) {
|
|
1801
|
+
c.normalisedName = normaliseString(c.name);
|
|
1802
|
+
c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
1803
|
+
c.dialCodePlus = `+${c.dialCode}`;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
// src/js/modules/format/formatting.ts
|
|
1808
|
+
function beforeSetNumber(fullNumber, dialCode, separateDialCode, selectedCountryData) {
|
|
1809
|
+
let number = fullNumber;
|
|
1810
|
+
if (separateDialCode) {
|
|
1811
|
+
if (dialCode) {
|
|
1812
|
+
dialCode = `+${selectedCountryData.dialCode}`;
|
|
1813
|
+
const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
|
|
1814
|
+
number = number.substring(start);
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
return number;
|
|
1818
|
+
}
|
|
1819
|
+
function formatNumberAsYouType(fullNumber, telInputValue, utils2, selectedCountryData, separateDialCode) {
|
|
1820
|
+
const result = utils2 ? utils2.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
|
|
1821
|
+
const { dialCode } = selectedCountryData;
|
|
1822
|
+
if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
1823
|
+
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
1824
|
+
return afterDialCode.trim();
|
|
1825
|
+
}
|
|
1826
|
+
return result;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// src/js/modules/format/caret.ts
|
|
1830
|
+
function translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) {
|
|
1831
|
+
if (prevCaretPos === 0 && !isDeleteForwards) {
|
|
1832
|
+
return 0;
|
|
1833
|
+
}
|
|
1834
|
+
let relevantCharCount = 0;
|
|
1835
|
+
for (let i = 0; i < formattedValue.length; i++) {
|
|
1836
|
+
if (/[+0-9]/.test(formattedValue[i])) {
|
|
1837
|
+
relevantCharCount++;
|
|
1838
|
+
}
|
|
1839
|
+
if (relevantCharCount === relevantChars && !isDeleteForwards) {
|
|
1840
|
+
return i + 1;
|
|
1841
|
+
}
|
|
1842
|
+
if (isDeleteForwards && relevantCharCount === relevantChars + 1) {
|
|
1843
|
+
return i;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
return formattedValue.length;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/js/modules/data/nanp-regionless.ts
|
|
1679
1850
|
var regionlessNanpNumbers = [
|
|
1680
1851
|
"800",
|
|
1681
1852
|
"822",
|
|
@@ -1695,8 +1866,6 @@ var regionlessNanpNumbers = [
|
|
|
1695
1866
|
"888",
|
|
1696
1867
|
"889"
|
|
1697
1868
|
];
|
|
1698
|
-
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
1699
|
-
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1700
1869
|
var isRegionlessNanp = (number) => {
|
|
1701
1870
|
const numeric = getNumeric(number);
|
|
1702
1871
|
if (numeric.charAt(0) === "1") {
|
|
@@ -1705,34 +1874,14 @@ var isRegionlessNanp = (number) => {
|
|
|
1705
1874
|
}
|
|
1706
1875
|
return false;
|
|
1707
1876
|
};
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}
|
|
1717
|
-
if (count === relevantChars && !isDeleteForwards) {
|
|
1718
|
-
return i + 1;
|
|
1719
|
-
}
|
|
1720
|
-
if (isDeleteForwards && count === relevantChars + 1) {
|
|
1721
|
-
return i;
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
return formattedValue.length;
|
|
1725
|
-
};
|
|
1726
|
-
var createEl = (tagName, attrs, container) => {
|
|
1727
|
-
const el = document.createElement(tagName);
|
|
1728
|
-
if (attrs) {
|
|
1729
|
-
Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
|
|
1730
|
-
}
|
|
1731
|
-
if (container) {
|
|
1732
|
-
container.appendChild(el);
|
|
1733
|
-
}
|
|
1734
|
-
return el;
|
|
1735
|
-
};
|
|
1877
|
+
|
|
1878
|
+
// src/js/intl-tel-input.ts
|
|
1879
|
+
for (const c of data_default) {
|
|
1880
|
+
c.name = en_default[c.iso2];
|
|
1881
|
+
}
|
|
1882
|
+
var id = 0;
|
|
1883
|
+
var iso2Set = new Set(data_default.map((c) => c.iso2));
|
|
1884
|
+
var isIso2 = (val) => iso2Set.has(val);
|
|
1736
1885
|
var forEachInstance = (method, ...args) => {
|
|
1737
1886
|
const { instances } = intlTelInput;
|
|
1738
1887
|
Object.values(instances).forEach((instance) => instance[method](...args));
|
|
@@ -1752,23 +1901,7 @@ var Iti = class _Iti {
|
|
|
1752
1901
|
this.options = Object.assign({}, defaults, customOptions);
|
|
1753
1902
|
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
1754
1903
|
}
|
|
1755
|
-
|
|
1756
|
-
_init() {
|
|
1757
|
-
if (this.options.useFullscreenPopup) {
|
|
1758
|
-
this.options.fixDropdownWidth = false;
|
|
1759
|
-
}
|
|
1760
|
-
if (this.options.onlyCountries.length === 1) {
|
|
1761
|
-
this.options.initialCountry = this.options.onlyCountries[0];
|
|
1762
|
-
}
|
|
1763
|
-
if (this.options.separateDialCode) {
|
|
1764
|
-
this.options.nationalMode = false;
|
|
1765
|
-
}
|
|
1766
|
-
if (this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode) {
|
|
1767
|
-
this.options.nationalMode = false;
|
|
1768
|
-
}
|
|
1769
|
-
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
|
|
1770
|
-
this.options.dropdownContainer = document.body;
|
|
1771
|
-
}
|
|
1904
|
+
_detectEnvironmentAndLayout() {
|
|
1772
1905
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
1773
1906
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1774
1907
|
this.telInput.dir = "ltr";
|
|
@@ -1781,7 +1914,8 @@ var Iti = class _Iti {
|
|
|
1781
1914
|
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
1782
1915
|
}
|
|
1783
1916
|
}
|
|
1784
|
-
|
|
1917
|
+
}
|
|
1918
|
+
_createInitPromises() {
|
|
1785
1919
|
const autoCountryPromise = new Promise((resolve, reject) => {
|
|
1786
1920
|
this.resolveAutoCountryPromise = resolve;
|
|
1787
1921
|
this.rejectAutoCountryPromise = reject;
|
|
@@ -1791,6 +1925,12 @@ var Iti = class _Iti {
|
|
|
1791
1925
|
this.rejectUtilsScriptPromise = reject;
|
|
1792
1926
|
});
|
|
1793
1927
|
this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]);
|
|
1928
|
+
}
|
|
1929
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1930
|
+
_init() {
|
|
1931
|
+
applyOptionSideEffects(this.options);
|
|
1932
|
+
this._detectEnvironmentAndLayout();
|
|
1933
|
+
this._createInitPromises();
|
|
1794
1934
|
this.selectedCountryData = {};
|
|
1795
1935
|
this._processCountryData();
|
|
1796
1936
|
this._generateMarkup();
|
|
@@ -1803,139 +1943,37 @@ var Iti = class _Iti {
|
|
|
1803
1943
|
//********************
|
|
1804
1944
|
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
1805
1945
|
_processCountryData() {
|
|
1806
|
-
this.
|
|
1807
|
-
this.
|
|
1808
|
-
this.
|
|
1809
|
-
this.
|
|
1946
|
+
this.countries = processAllCountries(this.options);
|
|
1947
|
+
const dialRes = processDialCodes(this.countries, this.options);
|
|
1948
|
+
this.dialCodes = dialRes.dialCodes;
|
|
1949
|
+
this.dialCodeMaxLen = dialRes.dialCodeMaxLen;
|
|
1950
|
+
this.dialCodeToIso2Map = dialRes.dialCodeToIso2Map;
|
|
1951
|
+
translateCountryNames(this.countries, this.options);
|
|
1952
|
+
sortCountries(this.countries, this.options);
|
|
1810
1953
|
this.countryByIso2 = new Map(this.countries.map((c) => [c.iso2, c]));
|
|
1811
|
-
this.
|
|
1812
|
-
}
|
|
1813
|
-
//* Precompute and cache country search tokens to speed up filtering
|
|
1814
|
-
_cacheSearchTokens() {
|
|
1815
|
-
for (const c of this.countries) {
|
|
1816
|
-
c.normalisedName = normaliseString(c.name);
|
|
1817
|
-
c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
1818
|
-
c.dialCodePlus = `+${c.dialCode}`;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
//* Sort countries by countryOrder option (if present), then name.
|
|
1822
|
-
_sortCountries() {
|
|
1823
|
-
if (this.options.countryOrder) {
|
|
1824
|
-
this.options.countryOrder = this.options.countryOrder.map((country) => country.toLowerCase());
|
|
1825
|
-
}
|
|
1826
|
-
this.countries.sort((a, b) => {
|
|
1827
|
-
const { countryOrder } = this.options;
|
|
1828
|
-
if (countryOrder) {
|
|
1829
|
-
const aIndex = countryOrder.indexOf(a.iso2);
|
|
1830
|
-
const bIndex = countryOrder.indexOf(b.iso2);
|
|
1831
|
-
const aIndexExists = aIndex > -1;
|
|
1832
|
-
const bIndexExists = bIndex > -1;
|
|
1833
|
-
if (aIndexExists || bIndexExists) {
|
|
1834
|
-
if (aIndexExists && bIndexExists) {
|
|
1835
|
-
return aIndex - bIndex;
|
|
1836
|
-
}
|
|
1837
|
-
return aIndexExists ? -1 : 1;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
return a.name.localeCompare(b.name);
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1844
|
-
_addToDialCodeMap(iso2, dialCode, priority) {
|
|
1845
|
-
if (!iso2 || !dialCode) {
|
|
1846
|
-
return;
|
|
1847
|
-
}
|
|
1848
|
-
if (dialCode.length > this.dialCodeMaxLen) {
|
|
1849
|
-
this.dialCodeMaxLen = dialCode.length;
|
|
1850
|
-
}
|
|
1851
|
-
if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) {
|
|
1852
|
-
this.dialCodeToIso2Map[dialCode] = [];
|
|
1853
|
-
}
|
|
1854
|
-
const iso2List = this.dialCodeToIso2Map[dialCode];
|
|
1855
|
-
if (iso2List.includes(iso2)) {
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
const index = priority !== void 0 ? priority : iso2List.length;
|
|
1859
|
-
iso2List[index] = iso2;
|
|
1860
|
-
}
|
|
1861
|
-
//* Process onlyCountries or excludeCountries array if present.
|
|
1862
|
-
_processAllCountries() {
|
|
1863
|
-
const { onlyCountries, excludeCountries } = this.options;
|
|
1864
|
-
if (onlyCountries.length) {
|
|
1865
|
-
const lowerCaseOnlyCountries = onlyCountries.map(
|
|
1866
|
-
(country) => country.toLowerCase()
|
|
1867
|
-
);
|
|
1868
|
-
this.countries = data_default.filter(
|
|
1869
|
-
(country) => lowerCaseOnlyCountries.includes(country.iso2)
|
|
1870
|
-
);
|
|
1871
|
-
} else if (excludeCountries.length) {
|
|
1872
|
-
const lowerCaseExcludeCountries = excludeCountries.map(
|
|
1873
|
-
(country) => country.toLowerCase()
|
|
1874
|
-
);
|
|
1875
|
-
this.countries = data_default.filter(
|
|
1876
|
-
(country) => !lowerCaseExcludeCountries.includes(country.iso2)
|
|
1877
|
-
);
|
|
1878
|
-
} else {
|
|
1879
|
-
this.countries = data_default;
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
//* Translate Countries by object literal provided on config.
|
|
1883
|
-
_translateCountryNames() {
|
|
1884
|
-
for (const c of this.countries) {
|
|
1885
|
-
const iso2 = c.iso2.toLowerCase();
|
|
1886
|
-
if (this.options.i18n.hasOwnProperty(iso2)) {
|
|
1887
|
-
c.name = this.options.i18n[iso2];
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1892
|
-
_processDialCodes() {
|
|
1893
|
-
this.dialCodes = /* @__PURE__ */ new Set();
|
|
1894
|
-
this.dialCodeMaxLen = 0;
|
|
1895
|
-
this.dialCodeToIso2Map = {};
|
|
1896
|
-
for (const c of this.countries) {
|
|
1897
|
-
if (!this.dialCodes.has(c.dialCode)) {
|
|
1898
|
-
this.dialCodes.add(c.dialCode);
|
|
1899
|
-
}
|
|
1900
|
-
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1901
|
-
}
|
|
1902
|
-
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1903
|
-
this.dialCodes.forEach((dialCode) => {
|
|
1904
|
-
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
for (const c of this.countries) {
|
|
1908
|
-
if (c.areaCodes) {
|
|
1909
|
-
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
1910
|
-
for (const areaCode of c.areaCodes) {
|
|
1911
|
-
for (let k = 1; k < areaCode.length; k++) {
|
|
1912
|
-
const partialAreaCode = areaCode.substring(0, k);
|
|
1913
|
-
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1914
|
-
this._addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1915
|
-
this._addToDialCodeMap(c.iso2, partialDialCode);
|
|
1916
|
-
}
|
|
1917
|
-
this._addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1954
|
+
cacheSearchTokens(this.countries);
|
|
1921
1955
|
}
|
|
1922
1956
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1923
1957
|
_generateMarkup() {
|
|
1958
|
+
this._prepareTelInput();
|
|
1959
|
+
const wrapper = this._createWrapperAndInsert();
|
|
1960
|
+
this._maybeBuildCountryContainer(wrapper);
|
|
1961
|
+
wrapper.appendChild(this.telInput);
|
|
1962
|
+
this._maybeUpdateInputPaddingAndReveal();
|
|
1963
|
+
this._maybeBuildHiddenInputs(wrapper);
|
|
1964
|
+
}
|
|
1965
|
+
_prepareTelInput() {
|
|
1924
1966
|
this.telInput.classList.add("iti__tel-input");
|
|
1925
1967
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
1926
1968
|
this.telInput.setAttribute("autocomplete", "off");
|
|
1927
1969
|
}
|
|
1970
|
+
}
|
|
1971
|
+
_createWrapperAndInsert() {
|
|
1928
1972
|
const {
|
|
1929
1973
|
allowDropdown,
|
|
1930
|
-
separateDialCode,
|
|
1931
1974
|
showFlags,
|
|
1932
1975
|
containerClass,
|
|
1933
|
-
|
|
1934
|
-
dropdownContainer,
|
|
1935
|
-
fixDropdownWidth,
|
|
1936
|
-
useFullscreenPopup,
|
|
1937
|
-
countrySearch,
|
|
1938
|
-
i18n
|
|
1976
|
+
useFullscreenPopup
|
|
1939
1977
|
} = this.options;
|
|
1940
1978
|
const parentClasses = _Iti._buildClassNames({
|
|
1941
1979
|
"iti": true,
|
|
@@ -1946,6 +1984,14 @@ var Iti = class _Iti {
|
|
|
1946
1984
|
});
|
|
1947
1985
|
const wrapper = createEl("div", { class: parentClasses });
|
|
1948
1986
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
1987
|
+
return wrapper;
|
|
1988
|
+
}
|
|
1989
|
+
_maybeBuildCountryContainer(wrapper) {
|
|
1990
|
+
const {
|
|
1991
|
+
allowDropdown,
|
|
1992
|
+
separateDialCode,
|
|
1993
|
+
showFlags
|
|
1994
|
+
} = this.options;
|
|
1949
1995
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1950
1996
|
this.countryContainer = createEl(
|
|
1951
1997
|
"div",
|
|
@@ -2006,119 +2052,138 @@ var Iti = class _Iti {
|
|
|
2006
2052
|
);
|
|
2007
2053
|
}
|
|
2008
2054
|
if (allowDropdown) {
|
|
2009
|
-
|
|
2010
|
-
this.dropdownContent = createEl("div", {
|
|
2011
|
-
id: `iti-${this.id}__dropdown-content`,
|
|
2012
|
-
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
2013
|
-
role: "dialog",
|
|
2014
|
-
"aria-modal": "true"
|
|
2015
|
-
});
|
|
2016
|
-
if (countrySearch) {
|
|
2017
|
-
const searchWrapper = createEl(
|
|
2018
|
-
"div",
|
|
2019
|
-
{ class: "iti__search-input-wrapper" },
|
|
2020
|
-
this.dropdownContent
|
|
2021
|
-
);
|
|
2022
|
-
this.searchIcon = createEl(
|
|
2023
|
-
"span",
|
|
2024
|
-
{
|
|
2025
|
-
class: "iti__search-icon",
|
|
2026
|
-
"aria-hidden": "true"
|
|
2027
|
-
},
|
|
2028
|
-
searchWrapper
|
|
2029
|
-
);
|
|
2030
|
-
this.searchIcon.innerHTML = `
|
|
2031
|
-
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2032
|
-
<circle cx="11" cy="11" r="7" />
|
|
2033
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2034
|
-
</svg>`;
|
|
2035
|
-
this.searchInput = createEl(
|
|
2036
|
-
"input",
|
|
2037
|
-
{
|
|
2038
|
-
id: `iti-${this.id}__search-input`,
|
|
2039
|
-
// Chrome says inputs need either a name or an id
|
|
2040
|
-
type: "search",
|
|
2041
|
-
class: "iti__search-input",
|
|
2042
|
-
placeholder: i18n.searchPlaceholder,
|
|
2043
|
-
// 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
|
|
2044
|
-
role: "combobox",
|
|
2045
|
-
"aria-expanded": "true",
|
|
2046
|
-
"aria-label": i18n.searchPlaceholder,
|
|
2047
|
-
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
2048
|
-
"aria-autocomplete": "list",
|
|
2049
|
-
"autocomplete": "off"
|
|
2050
|
-
},
|
|
2051
|
-
searchWrapper
|
|
2052
|
-
);
|
|
2053
|
-
this.searchClearButton = createEl(
|
|
2054
|
-
"button",
|
|
2055
|
-
{
|
|
2056
|
-
type: "button",
|
|
2057
|
-
class: "iti__search-clear iti__hide",
|
|
2058
|
-
"aria-label": i18n.clearSearchAriaLabel,
|
|
2059
|
-
tabindex: "-1"
|
|
2060
|
-
},
|
|
2061
|
-
searchWrapper
|
|
2062
|
-
);
|
|
2063
|
-
const maskId = `iti-${this.id}-clear-mask`;
|
|
2064
|
-
this.searchClearButton.innerHTML = `
|
|
2065
|
-
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2066
|
-
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2067
|
-
<rect width="16" height="16" fill="white" />
|
|
2068
|
-
<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" />
|
|
2069
|
-
</mask>
|
|
2070
|
-
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2071
|
-
</svg>`;
|
|
2072
|
-
this.searchResultsA11yText = createEl(
|
|
2073
|
-
"span",
|
|
2074
|
-
{ class: "iti__a11y-text" },
|
|
2075
|
-
this.dropdownContent
|
|
2076
|
-
);
|
|
2077
|
-
this.searchNoResults = createEl(
|
|
2078
|
-
"div",
|
|
2079
|
-
{
|
|
2080
|
-
class: "iti__no-results iti__hide",
|
|
2081
|
-
"aria-hidden": "true"
|
|
2082
|
-
// all a11y messaging happens in this.searchResultsA11yText
|
|
2083
|
-
},
|
|
2084
|
-
this.dropdownContent
|
|
2085
|
-
);
|
|
2086
|
-
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2087
|
-
}
|
|
2088
|
-
this.countryList = createEl(
|
|
2089
|
-
"ul",
|
|
2090
|
-
{
|
|
2091
|
-
class: "iti__country-list",
|
|
2092
|
-
id: `iti-${this.id}__country-listbox`,
|
|
2093
|
-
role: "listbox",
|
|
2094
|
-
"aria-label": i18n.countryListAriaLabel
|
|
2095
|
-
},
|
|
2096
|
-
this.dropdownContent
|
|
2097
|
-
);
|
|
2098
|
-
this._appendListItems();
|
|
2099
|
-
if (countrySearch) {
|
|
2100
|
-
this._updateSearchResultsA11yText();
|
|
2101
|
-
}
|
|
2102
|
-
if (dropdownContainer) {
|
|
2103
|
-
const dropdownClasses = _Iti._buildClassNames({
|
|
2104
|
-
"iti": true,
|
|
2105
|
-
"iti--container": true,
|
|
2106
|
-
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2107
|
-
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2108
|
-
[containerClass]: Boolean(containerClass)
|
|
2109
|
-
});
|
|
2110
|
-
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2111
|
-
this.dropdown.appendChild(this.dropdownContent);
|
|
2112
|
-
} else {
|
|
2113
|
-
this.countryContainer.appendChild(this.dropdownContent);
|
|
2114
|
-
}
|
|
2055
|
+
this._buildDropdownContent();
|
|
2115
2056
|
}
|
|
2116
2057
|
}
|
|
2117
|
-
|
|
2058
|
+
}
|
|
2059
|
+
_buildDropdownContent() {
|
|
2060
|
+
const {
|
|
2061
|
+
fixDropdownWidth,
|
|
2062
|
+
useFullscreenPopup,
|
|
2063
|
+
countrySearch,
|
|
2064
|
+
i18n,
|
|
2065
|
+
dropdownContainer,
|
|
2066
|
+
containerClass
|
|
2067
|
+
} = this.options;
|
|
2068
|
+
const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
2069
|
+
this.dropdownContent = createEl("div", {
|
|
2070
|
+
id: `iti-${this.id}__dropdown-content`,
|
|
2071
|
+
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
2072
|
+
role: "dialog",
|
|
2073
|
+
"aria-modal": "true"
|
|
2074
|
+
});
|
|
2075
|
+
if (countrySearch) {
|
|
2076
|
+
this._buildSearchUI();
|
|
2077
|
+
}
|
|
2078
|
+
this.countryList = createEl(
|
|
2079
|
+
"ul",
|
|
2080
|
+
{
|
|
2081
|
+
class: "iti__country-list",
|
|
2082
|
+
id: `iti-${this.id}__country-listbox`,
|
|
2083
|
+
role: "listbox",
|
|
2084
|
+
"aria-label": i18n.countryListAriaLabel
|
|
2085
|
+
},
|
|
2086
|
+
this.dropdownContent
|
|
2087
|
+
);
|
|
2088
|
+
this._appendListItems();
|
|
2089
|
+
if (countrySearch) {
|
|
2090
|
+
this._updateSearchResultsA11yText();
|
|
2091
|
+
}
|
|
2092
|
+
if (dropdownContainer) {
|
|
2093
|
+
const dropdownClasses = _Iti._buildClassNames({
|
|
2094
|
+
"iti": true,
|
|
2095
|
+
"iti--container": true,
|
|
2096
|
+
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2097
|
+
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2098
|
+
[containerClass]: Boolean(containerClass)
|
|
2099
|
+
});
|
|
2100
|
+
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2101
|
+
this.dropdown.appendChild(this.dropdownContent);
|
|
2102
|
+
} else {
|
|
2103
|
+
this.countryContainer.appendChild(this.dropdownContent);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
_buildSearchUI() {
|
|
2107
|
+
const { i18n } = this.options;
|
|
2108
|
+
const searchWrapper = createEl(
|
|
2109
|
+
"div",
|
|
2110
|
+
{ class: "iti__search-input-wrapper" },
|
|
2111
|
+
this.dropdownContent
|
|
2112
|
+
);
|
|
2113
|
+
this.searchIcon = createEl(
|
|
2114
|
+
"span",
|
|
2115
|
+
{
|
|
2116
|
+
class: "iti__search-icon",
|
|
2117
|
+
"aria-hidden": "true"
|
|
2118
|
+
},
|
|
2119
|
+
searchWrapper
|
|
2120
|
+
);
|
|
2121
|
+
this.searchIcon.innerHTML = `
|
|
2122
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2123
|
+
<circle cx="11" cy="11" r="7" />
|
|
2124
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2125
|
+
</svg>`;
|
|
2126
|
+
this.searchInput = createEl(
|
|
2127
|
+
"input",
|
|
2128
|
+
{
|
|
2129
|
+
id: `iti-${this.id}__search-input`,
|
|
2130
|
+
// Chrome says inputs need either a name or an id
|
|
2131
|
+
type: "search",
|
|
2132
|
+
class: "iti__search-input",
|
|
2133
|
+
placeholder: i18n.searchPlaceholder,
|
|
2134
|
+
// 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
|
|
2135
|
+
role: "combobox",
|
|
2136
|
+
"aria-expanded": "true",
|
|
2137
|
+
"aria-label": i18n.searchPlaceholder,
|
|
2138
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
2139
|
+
"aria-autocomplete": "list",
|
|
2140
|
+
"autocomplete": "off"
|
|
2141
|
+
},
|
|
2142
|
+
searchWrapper
|
|
2143
|
+
);
|
|
2144
|
+
this.searchClearButton = createEl(
|
|
2145
|
+
"button",
|
|
2146
|
+
{
|
|
2147
|
+
type: "button",
|
|
2148
|
+
class: "iti__search-clear iti__hide",
|
|
2149
|
+
"aria-label": i18n.clearSearchAriaLabel,
|
|
2150
|
+
tabindex: "-1"
|
|
2151
|
+
},
|
|
2152
|
+
searchWrapper
|
|
2153
|
+
);
|
|
2154
|
+
const maskId = `iti-${this.id}-clear-mask`;
|
|
2155
|
+
this.searchClearButton.innerHTML = `
|
|
2156
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2157
|
+
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2158
|
+
<rect width="16" height="16" fill="white" />
|
|
2159
|
+
<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" />
|
|
2160
|
+
</mask>
|
|
2161
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2162
|
+
</svg>`;
|
|
2163
|
+
this.searchResultsA11yText = createEl(
|
|
2164
|
+
"span",
|
|
2165
|
+
{ class: "iti__a11y-text" },
|
|
2166
|
+
this.dropdownContent
|
|
2167
|
+
);
|
|
2168
|
+
this.searchNoResults = createEl(
|
|
2169
|
+
"div",
|
|
2170
|
+
{
|
|
2171
|
+
class: "iti__no-results iti__hide",
|
|
2172
|
+
"aria-hidden": "true"
|
|
2173
|
+
// all a11y messaging happens in this.searchResultsA11yText
|
|
2174
|
+
},
|
|
2175
|
+
this.dropdownContent
|
|
2176
|
+
);
|
|
2177
|
+
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2178
|
+
}
|
|
2179
|
+
_maybeUpdateInputPaddingAndReveal() {
|
|
2118
2180
|
if (this.countryContainer) {
|
|
2119
2181
|
this._updateInputPadding();
|
|
2120
2182
|
this.countryContainer.classList.remove("iti__v-hide");
|
|
2121
2183
|
}
|
|
2184
|
+
}
|
|
2185
|
+
_maybeBuildHiddenInputs(wrapper) {
|
|
2186
|
+
const { hiddenInput } = this.options;
|
|
2122
2187
|
if (hiddenInput) {
|
|
2123
2188
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2124
2189
|
const names = hiddenInput(telInputName);
|
|
@@ -2192,14 +2257,13 @@ var Iti = class _Iti {
|
|
|
2192
2257
|
this._updateCountryFromNumber(val);
|
|
2193
2258
|
} else if (!isAutoCountry || overrideAutoCountry) {
|
|
2194
2259
|
const lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : "";
|
|
2195
|
-
|
|
2196
|
-
if (isValidInitialCountry) {
|
|
2260
|
+
if (isIso2(lowerInitialCountry)) {
|
|
2197
2261
|
this._setCountry(lowerInitialCountry);
|
|
2198
2262
|
} else {
|
|
2199
2263
|
if (dialCode && isRegionlessNanpNumber) {
|
|
2200
2264
|
this._setCountry("us");
|
|
2201
2265
|
} else {
|
|
2202
|
-
this._setCountry();
|
|
2266
|
+
this._setCountry("");
|
|
2203
2267
|
}
|
|
2204
2268
|
}
|
|
2205
2269
|
}
|
|
@@ -2302,8 +2366,7 @@ var Iti = class _Iti {
|
|
|
2302
2366
|
this.options.geoIpLookup(
|
|
2303
2367
|
(iso2 = "") => {
|
|
2304
2368
|
const iso2Lower = iso2.toLowerCase();
|
|
2305
|
-
|
|
2306
|
-
if (isValidIso2) {
|
|
2369
|
+
if (isIso2(iso2Lower)) {
|
|
2307
2370
|
intlTelInput.autoCountry = iso2Lower;
|
|
2308
2371
|
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2309
2372
|
} else {
|
|
@@ -2326,6 +2389,11 @@ var Iti = class _Iti {
|
|
|
2326
2389
|
}
|
|
2327
2390
|
//* Initialize the tel input listeners.
|
|
2328
2391
|
_initTelInputListeners() {
|
|
2392
|
+
this._bindInputListener();
|
|
2393
|
+
this._maybeBindKeydownListener();
|
|
2394
|
+
this._maybeBindPasteListener();
|
|
2395
|
+
}
|
|
2396
|
+
_bindInputListener() {
|
|
2329
2397
|
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2330
2398
|
let userOverrideFormatting = false;
|
|
2331
2399
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
@@ -2356,13 +2424,23 @@ var Iti = class _Iti {
|
|
|
2356
2424
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2357
2425
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
2358
2426
|
const isDeleteForwards = e?.inputType === "deleteContentForward";
|
|
2359
|
-
const
|
|
2427
|
+
const fullNumber = this._getFullNumber();
|
|
2428
|
+
const formattedValue = formatNumberAsYouType(
|
|
2429
|
+
fullNumber,
|
|
2430
|
+
this.telInput.value,
|
|
2431
|
+
intlTelInput.utils,
|
|
2432
|
+
this.selectedCountryData,
|
|
2433
|
+
this.options.separateDialCode
|
|
2434
|
+
);
|
|
2360
2435
|
const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
|
|
2361
2436
|
this.telInput.value = formattedValue;
|
|
2362
2437
|
this.telInput.setSelectionRange(newCaretPos, newCaretPos);
|
|
2363
2438
|
}
|
|
2364
2439
|
};
|
|
2365
2440
|
this.telInput.addEventListener("input", this._handleInputEvent);
|
|
2441
|
+
}
|
|
2442
|
+
_maybeBindKeydownListener() {
|
|
2443
|
+
const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2366
2444
|
if (strictMode || separateDialCode) {
|
|
2367
2445
|
this._handleKeydownEvent = (e) => {
|
|
2368
2446
|
if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
@@ -2391,12 +2469,17 @@ var Iti = class _Iti {
|
|
|
2391
2469
|
};
|
|
2392
2470
|
this.telInput.addEventListener("keydown", this._handleKeydownEvent);
|
|
2393
2471
|
}
|
|
2394
|
-
|
|
2472
|
+
}
|
|
2473
|
+
_maybeBindPasteListener() {
|
|
2474
|
+
if (this.options.strictMode) {
|
|
2395
2475
|
this._handlePasteEvent = (e) => {
|
|
2396
2476
|
e.preventDefault();
|
|
2397
2477
|
const input = this.telInput;
|
|
2398
2478
|
const selStart = input.selectionStart;
|
|
2399
2479
|
const selEnd = input.selectionEnd;
|
|
2480
|
+
const before = input.value.slice(0, selStart);
|
|
2481
|
+
const after = input.value.slice(selEnd);
|
|
2482
|
+
const iso2 = this.selectedCountryData.iso2;
|
|
2400
2483
|
const pasted = e.clipboardData.getData("text");
|
|
2401
2484
|
const initialCharSelected = selStart === 0 && selEnd > 0;
|
|
2402
2485
|
const allowLeadingPlus = !input.value.startsWith("+") || initialCharSelected;
|
|
@@ -2404,8 +2487,15 @@ var Iti = class _Iti {
|
|
|
2404
2487
|
const hasLeadingPlus = allowedChars.startsWith("+");
|
|
2405
2488
|
const numerics = allowedChars.replace(/\+/g, "");
|
|
2406
2489
|
const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
|
|
2407
|
-
let newVal =
|
|
2408
|
-
|
|
2490
|
+
let newVal = before + sanitised + after;
|
|
2491
|
+
let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2492
|
+
while (coreNumber.length === 0 && newVal.length > 0) {
|
|
2493
|
+
newVal = newVal.slice(0, -1);
|
|
2494
|
+
coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2495
|
+
}
|
|
2496
|
+
if (!coreNumber) {
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2409
2499
|
if (this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength) {
|
|
2410
2500
|
if (input.selectionEnd === input.value.length) {
|
|
2411
2501
|
const trimLength = coreNumber.length - this.maxCoreNumberLength;
|
|
@@ -2575,43 +2665,14 @@ var Iti = class _Iti {
|
|
|
2575
2665
|
}
|
|
2576
2666
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2577
2667
|
_filterCountries(query) {
|
|
2578
|
-
let noCountriesAddedYet = true;
|
|
2579
2668
|
this.countryList.innerHTML = "";
|
|
2580
|
-
const normalisedQuery = normaliseString(query);
|
|
2581
2669
|
let matchedCountries;
|
|
2582
2670
|
if (query === "") {
|
|
2583
2671
|
matchedCountries = this.countries;
|
|
2584
2672
|
} else {
|
|
2585
|
-
|
|
2586
|
-
const nameStartWith = [];
|
|
2587
|
-
const nameContains = [];
|
|
2588
|
-
const dialCodeMatches = [];
|
|
2589
|
-
const dialCodeContains = [];
|
|
2590
|
-
const initialsMatches = [];
|
|
2591
|
-
for (const c of this.countries) {
|
|
2592
|
-
if (c.iso2 === normalisedQuery) {
|
|
2593
|
-
iso2Matches.push(c);
|
|
2594
|
-
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2595
|
-
nameStartWith.push(c);
|
|
2596
|
-
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2597
|
-
nameContains.push(c);
|
|
2598
|
-
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2599
|
-
dialCodeMatches.push(c);
|
|
2600
|
-
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2601
|
-
dialCodeContains.push(c);
|
|
2602
|
-
} else if (c.initials.includes(normalisedQuery)) {
|
|
2603
|
-
initialsMatches.push(c);
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
matchedCountries = [
|
|
2607
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2608
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2609
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2610
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2611
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2612
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2613
|
-
];
|
|
2673
|
+
matchedCountries = this._getMatchedCountries(query);
|
|
2614
2674
|
}
|
|
2675
|
+
let noCountriesAddedYet = true;
|
|
2615
2676
|
for (const c of matchedCountries) {
|
|
2616
2677
|
const listItem = c.nodeById[this.id];
|
|
2617
2678
|
if (listItem) {
|
|
@@ -2633,6 +2694,38 @@ var Iti = class _Iti {
|
|
|
2633
2694
|
this.countryList.scrollTop = 0;
|
|
2634
2695
|
this._updateSearchResultsA11yText();
|
|
2635
2696
|
}
|
|
2697
|
+
_getMatchedCountries(query) {
|
|
2698
|
+
const normalisedQuery = normaliseString(query);
|
|
2699
|
+
const iso2Matches = [];
|
|
2700
|
+
const nameStartWith = [];
|
|
2701
|
+
const nameContains = [];
|
|
2702
|
+
const dialCodeMatches = [];
|
|
2703
|
+
const dialCodeContains = [];
|
|
2704
|
+
const initialsMatches = [];
|
|
2705
|
+
for (const c of this.countries) {
|
|
2706
|
+
if (c.iso2 === normalisedQuery) {
|
|
2707
|
+
iso2Matches.push(c);
|
|
2708
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2709
|
+
nameStartWith.push(c);
|
|
2710
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2711
|
+
nameContains.push(c);
|
|
2712
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2713
|
+
dialCodeMatches.push(c);
|
|
2714
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2715
|
+
dialCodeContains.push(c);
|
|
2716
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2717
|
+
initialsMatches.push(c);
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
return [
|
|
2721
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2722
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2723
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2724
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2725
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2726
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2727
|
+
];
|
|
2728
|
+
}
|
|
2636
2729
|
//* Update search results text (for a11y).
|
|
2637
2730
|
_updateSearchResultsA11yText() {
|
|
2638
2731
|
const { i18n } = this.options;
|
|
@@ -2763,24 +2856,12 @@ var Iti = class _Iti {
|
|
|
2763
2856
|
this.highlightedItem.focus();
|
|
2764
2857
|
}
|
|
2765
2858
|
}
|
|
2766
|
-
//* Find the country data for the given iso2 code
|
|
2767
|
-
//* the allowFail option is only used during init() for the initialCountry option, and for the iso2 returned from geoIpLookup - in these 2 cases we don't want to error out
|
|
2768
|
-
_getCountryData(iso2, allowFail) {
|
|
2769
|
-
const country = this.countryByIso2.get(iso2);
|
|
2770
|
-
if (country) {
|
|
2771
|
-
return country;
|
|
2772
|
-
}
|
|
2773
|
-
if (allowFail) {
|
|
2774
|
-
return null;
|
|
2775
|
-
}
|
|
2776
|
-
throw new Error(`No country data for '${iso2}'`);
|
|
2777
|
-
}
|
|
2778
2859
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2779
2860
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2780
2861
|
_setCountry(iso2) {
|
|
2781
2862
|
const { separateDialCode, showFlags, i18n } = this.options;
|
|
2782
2863
|
const prevIso2 = this.selectedCountryData.iso2 || "";
|
|
2783
|
-
this.selectedCountryData = iso2 ? this.
|
|
2864
|
+
this.selectedCountryData = iso2 ? this.countryByIso2.get(iso2) : {};
|
|
2784
2865
|
if (this.selectedCountryData.iso2) {
|
|
2785
2866
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2786
2867
|
}
|
|
@@ -2899,11 +2980,11 @@ var Iti = class _Iti {
|
|
|
2899
2980
|
}
|
|
2900
2981
|
//* Called when the user selects a list item from the dropdown.
|
|
2901
2982
|
_selectListItem(listItem) {
|
|
2902
|
-
const
|
|
2903
|
-
|
|
2904
|
-
);
|
|
2983
|
+
const iso2 = listItem.getAttribute("data-country-code");
|
|
2984
|
+
const countryChanged = this._setCountry(iso2);
|
|
2905
2985
|
this._closeDropdown();
|
|
2906
|
-
|
|
2986
|
+
const dialCode = listItem.getAttribute("data-dial-code");
|
|
2987
|
+
this._updateDialCode(dialCode);
|
|
2907
2988
|
if (this.options.formatOnDisplay) {
|
|
2908
2989
|
this._updateValFromNumber(this.telInput.value);
|
|
2909
2990
|
}
|
|
@@ -3026,32 +3107,19 @@ var Iti = class _Iti {
|
|
|
3026
3107
|
}
|
|
3027
3108
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
3028
3109
|
_beforeSetNumber(fullNumber) {
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3110
|
+
const dialCode = this._getDialCode(fullNumber);
|
|
3111
|
+
const number = beforeSetNumber(
|
|
3112
|
+
fullNumber,
|
|
3113
|
+
dialCode,
|
|
3114
|
+
this.options.separateDialCode,
|
|
3115
|
+
this.selectedCountryData
|
|
3116
|
+
);
|
|
3038
3117
|
return this._cap(number);
|
|
3039
3118
|
}
|
|
3040
3119
|
//* Trigger the 'countrychange' event.
|
|
3041
3120
|
_triggerCountryChange() {
|
|
3042
3121
|
this._trigger("countrychange");
|
|
3043
3122
|
}
|
|
3044
|
-
//* Format the number as the user types.
|
|
3045
|
-
_formatNumberAsYouType() {
|
|
3046
|
-
const val = this._getFullNumber();
|
|
3047
|
-
const result = intlTelInput.utils ? intlTelInput.utils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val;
|
|
3048
|
-
const { dialCode } = this.selectedCountryData;
|
|
3049
|
-
if (this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
3050
|
-
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
3051
|
-
return afterDialCode.trim();
|
|
3052
|
-
}
|
|
3053
|
-
return result;
|
|
3054
|
-
}
|
|
3055
3123
|
//**************************
|
|
3056
3124
|
//* SECRET PUBLIC METHODS
|
|
3057
3125
|
//**************************
|
|
@@ -3203,6 +3271,9 @@ var Iti = class _Iti {
|
|
|
3203
3271
|
//* Update the selected country, and update the input val accordingly.
|
|
3204
3272
|
setCountry(iso2) {
|
|
3205
3273
|
const iso2Lower = iso2?.toLowerCase();
|
|
3274
|
+
if (!isIso2(iso2Lower)) {
|
|
3275
|
+
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
3276
|
+
}
|
|
3206
3277
|
const currentCountry = this.selectedCountryData.iso2;
|
|
3207
3278
|
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
3208
3279
|
if (isCountryChange) {
|
|
@@ -3290,7 +3361,7 @@ var intlTelInput = Object.assign(
|
|
|
3290
3361
|
attachUtils,
|
|
3291
3362
|
startedLoadingUtilsScript: false,
|
|
3292
3363
|
startedLoadingAutoCountry: false,
|
|
3293
|
-
version: "25.10.
|
|
3364
|
+
version: "25.10.8"
|
|
3294
3365
|
}
|
|
3295
3366
|
);
|
|
3296
3367
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -5039,12 +5110,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5039
5110
|
,
|
|
5040
5111
|
,
|
|
5041
5112
|
[9]
|
|
5042
|
-
], [, , "(?:
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
[
|
|
5047
|
-
], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
|
|
5113
|
+
], [, , "7(?:060\\d|19(?:[0-4]\\d|50))\\d{4}|(?:60[1-8]|7(?:0[2-5]|[2379]\\d))\\d{6}", , , , "601123456", , , [9]], [, , "800\\d{6}", , , , "800123456", , , [9]], [, , "9(?:0[05689]|76)\\d{6}", , , , "900123456", , , [9]], [, , "8[134]\\d{7}", , , , "811234567", , , [9]], [, , "70[01]\\d{6}", , , , "700123456", , , [9]], [, , "9[17]0\\d{6}", , , , "910123456", , , [9]], "CZ", 420, "00", , , , , , , , [[, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], [, "(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], [
|
|
5114
|
+
,
|
|
5115
|
+
"(\\d{2})(\\d{3})(\\d{3})(\\d{3})",
|
|
5116
|
+
"$1 $2 $3 $4",
|
|
5117
|
+
["9"]
|
|
5118
|
+
], [, "(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
|
|
5048
5119
|
DE: [, [, , "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", , , , , , , [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3]], [
|
|
5049
5120
|
,
|
|
5050
5121
|
,
|
|
@@ -5065,6 +5136,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5065
5136
|
["3[02]|40|[68]9"],
|
|
5066
5137
|
"0$1"
|
|
5067
5138
|
],
|
|
5139
|
+
[, "(\\d{6})", "$1", ["227", "2277"]],
|
|
5068
5140
|
[, "(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"],
|
|
5069
5141
|
[
|
|
5070
5142
|
,
|
|
@@ -5088,7 +5160,38 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5088
5160
|
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
5089
5161
|
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
5090
5162
|
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
5091
|
-
],
|
|
5163
|
+
], [
|
|
5164
|
+
[, "(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"],
|
|
5165
|
+
[
|
|
5166
|
+
,
|
|
5167
|
+
"(\\d{3})(\\d{3,12})",
|
|
5168
|
+
"$1 $2",
|
|
5169
|
+
["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],
|
|
5170
|
+
"0$1"
|
|
5171
|
+
],
|
|
5172
|
+
[
|
|
5173
|
+
,
|
|
5174
|
+
"(\\d{4})(\\d{2,11})",
|
|
5175
|
+
"$1 $2",
|
|
5176
|
+
["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],
|
|
5177
|
+
"0$1"
|
|
5178
|
+
],
|
|
5179
|
+
[, "(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"],
|
|
5180
|
+
[, "(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"],
|
|
5181
|
+
[, "(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"],
|
|
5182
|
+
[, "(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"],
|
|
5183
|
+
[, "(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"],
|
|
5184
|
+
[, "(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"],
|
|
5185
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"],
|
|
5186
|
+
[, "(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"],
|
|
5187
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"],
|
|
5188
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"],
|
|
5189
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"],
|
|
5190
|
+
[, "(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"],
|
|
5191
|
+
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
5192
|
+
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
5193
|
+
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
5194
|
+
], [, , "16(?:4\\d{1,10}|[89]\\d{1,11})", , , , "16412345", , , [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]], , , [, , , , , , , , , [-1]], [, , "18(?:1\\d{5,11}|[2-9]\\d{8})", , , , "18500123456", , , [8, 9, 10, 11, 12, 13, 14]], , , [
|
|
5092
5195
|
,
|
|
5093
5196
|
,
|
|
5094
5197
|
"1(?:6(?:013|255|399)|7(?:(?:[015]1|[69]3)3|[2-4]55|[78]99))\\d{7,8}|15(?:(?:[03-68]00|113)\\d|2\\d55|7\\d99|9\\d33)\\d{7}",
|
|
@@ -6186,17 +6289,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6186
6289
|
,
|
|
6187
6290
|
[7]
|
|
6188
6291
|
], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "49[0-24-79]\\d{4}", , , , "4921234", , , [7]], "IS", 354, "00|1(?:0(?:01|[12]0)|100)", , , , , , "00", , [[, "(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], [, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "809\\d{4}", , , , "8091234", , , [7]], , , [, , "(?:689|8(?:7[18]|80)|95[48])\\d{4}", , , , "6891234", , , [7]]],
|
|
6189
|
-
IT: [, [, , "0\\d{5,
|
|
6190
|
-
,
|
|
6191
|
-
,
|
|
6192
|
-
"0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",
|
|
6292
|
+
IT: [, [, , "0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", , , , , , , [6, 7, 8, 9, 10, 11, 12]], [
|
|
6193
6293
|
,
|
|
6194
6294
|
,
|
|
6295
|
+
"0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",
|
|
6195
6296
|
,
|
|
6196
|
-
"0212345678",
|
|
6197
6297
|
,
|
|
6198
6298
|
,
|
|
6199
|
-
|
|
6299
|
+
"0212345678"
|
|
6200
6300
|
], [, , "3[2-9]\\d{7,8}|(?:31|43)\\d{8}", , , , "3123456789", , , [9, 10]], [, , "80(?:0\\d{3}|3)\\d{3}", , , , "800123456", , , [6, 9]], [, , "(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", , , , "899123456", , , [6, 8, 9, 10]], [, , "84(?:[08]\\d{3}|[17])\\d{3}", , , , "848123456", , , [6, 9]], [, , "1(?:78\\d|99)\\d{6}", , , , "1781234567", , , [9, 10]], [, , "55\\d{8}", , , , "5512345678", , , [10]], "IT", 39, "00", , , , , , , , [
|
|
6201
6301
|
[, "(\\d{4,5})", "$1", ["1(?:0|9[246])", "1(?:0|9(?:2[2-9]|[46]))"]],
|
|
6202
6302
|
[, "(\\d{6})", "$1", ["1(?:1|92)"]],
|
|
@@ -6209,13 +6309,13 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6209
6309
|
[, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]],
|
|
6210
6310
|
[, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]],
|
|
6211
6311
|
[, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]],
|
|
6212
|
-
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["
|
|
6312
|
+
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]
|
|
6213
6313
|
], [[, "(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], [, "(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], [, "(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], [, "(\\d{4})(\\d{4})", "$1 $2", ["894"]], [, "(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], [
|
|
6214
6314
|
,
|
|
6215
6315
|
"(\\d{3})(\\d{3})(\\d{3,4})",
|
|
6216
6316
|
"$1 $2 $3",
|
|
6217
6317
|
["1(?:44|[679])|[378]|43"]
|
|
6218
|
-
], [, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], [, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], [, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["
|
|
6318
|
+
], [, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], [, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], [, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]], [, , , , , , , , , [-1]], 1, , [, , "848\\d{6}", , , , , , , [9]], [, , , , , , , , , [-1]], , , [, , "3[2-8]\\d{9,10}", , , , "33101234501", , , [11, 12]]],
|
|
6219
6319
|
JE: [, [, , "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", , , , , , , [10], [6]], [, , "1534[0-24-8]\\d{5}", , , , "1534456789", , , , [6]], [
|
|
6220
6320
|
,
|
|
6221
6321
|
,
|
|
@@ -6598,7 +6698,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6598
6698
|
,
|
|
6599
6699
|
"5002345678"
|
|
6600
6700
|
], [, , , , , , , , , [-1]], "LC", 1, "011", "1", , , "([2-8]\\d{6})$|1", "758$1", , , , , [, , , , , , , , , [-1]], , "758", [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6601
|
-
LI: [, [, , "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", , , , , , , [7, 9]], [, , "(?:2(?:01|1[27]|2[024]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}", , , , "2345678", , , [7]], [, , "(?:6(?:(?:4[5-9]|5
|
|
6701
|
+
LI: [, [, , "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", , , , , , , [7, 9]], [, , "(?:2(?:01|1[27]|2[024]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}", , , , "2345678", , , [7]], [, , "(?:6(?:(?:4[5-9]|5\\d)\\d|6(?:[024-6]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}", , , , "660234567"], [, , "8002[28]\\d\\d|80(?:05\\d|9)\\d{4}", , , , "8002222"], [
|
|
6602
6702
|
,
|
|
6603
6703
|
,
|
|
6604
6704
|
"90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",
|
|
@@ -6707,7 +6807,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6707
6807
|
,
|
|
6708
6808
|
"$CC $1"
|
|
6709
6809
|
], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"], , "$CC $1"], [, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"], , "$CC $1"], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["2(?:[0367]|4[3-8])"], , "$CC $1"], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"], , "$CC $1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6710
|
-
LV: [, [, , "(?:[268]\\d|90)\\d{6}", , , , , , , [8]], [
|
|
6810
|
+
LV: [, [, , "(?:[268]\\d|78|90)\\d{6}", , , , , , , [8]], [
|
|
6711
6811
|
,
|
|
6712
6812
|
,
|
|
6713
6813
|
"6\\d{7}",
|
|
@@ -6715,7 +6815,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6715
6815
|
,
|
|
6716
6816
|
,
|
|
6717
6817
|
"63123456"
|
|
6718
|
-
], [, , "2333[0-8]\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[02-9]|3[0-24-9]))\\d{4}", , , , "21234567"], [, , "80\\d{6}", , , , "80123456"], [, , "90\\d{6}", , , , "90123456"], [, , "81\\d{6}", , , , "81123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "LV", 371, "00", , , , , , , , [[, "(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[
|
|
6818
|
+
], [, , "2333[0-8]\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[02-9]|3[0-24-9]))\\d{4}", , , , "21234567"], [, , "80\\d{6}", , , , "80123456"], [, , "90\\d{6}", , , , "90123456"], [, , "81\\d{6}", , , , "81123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "LV", 371, "00", , , , , , , , [[, "(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2679]|8[01]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6719
6819
|
LY: [, [, , "[2-9]\\d{8}", , , , , , , [9], [7]], [
|
|
6720
6820
|
,
|
|
6721
6821
|
,
|
|
@@ -6777,7 +6877,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6777
6877
|
,
|
|
6778
6878
|
[8],
|
|
6779
6879
|
[6]
|
|
6780
|
-
], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "
|
|
6880
|
+
], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "60123456", , , [8]], [, , "80(?:[0-2578]|9\\d)\\d{5}", , , , "80080002"], [, , "9(?:4[1568]|5[178])\\d{5}", , , , "94515151", , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "78[1-49]\\d{5}", , , , "78108780", , , [8]], "ME", 382, "00", "0", , , "0", , , , [[, "(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "77[1-9]\\d{5}", , , , "77273012", , , [8]], , , [, , , , , , , , , [-1]]],
|
|
6781
6881
|
MF: [
|
|
6782
6882
|
,
|
|
6783
6883
|
[, , "(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}", , , , , , , [9]],
|
|
@@ -7865,7 +7965,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
7865
7965
|
,
|
|
7866
7966
|
,
|
|
7867
7967
|
[8]
|
|
7868
|
-
], [, , "
|
|
7968
|
+
], [, , "898[02-8]\\d{4}|(?:8(?:0[1-9]|[1-8]\\d|9[0-7])|9[0-8]\\d)\\d{5}", , , , "81234567", , , [8]], [, , "(?:18|8)00\\d{7}", , , , "18001234567", , , [10, 11]], [, , "1900\\d{7}", , , , "19001234567", , , [11]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "(?:3[12]\\d|666)\\d{5}", , , , "31234567", , , [8]], "SG", 65, "0[0-3]\\d", , , , , , , , [[, "(\\d{4,5})", "$1", ["1[013-9]|77", "1(?:[013-8]|9(?:0[1-9]|[1-9]))|77"]], [, "(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], [, "(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], [
|
|
7869
7969
|
,
|
|
7870
7970
|
"(\\d{4})(\\d{4})(\\d{3})",
|
|
7871
7971
|
"$1 $2 $3",
|
|
@@ -8443,7 +8543,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8443
8543
|
], [
|
|
8444
8544
|
,
|
|
8445
8545
|
,
|
|
8446
|
-
"(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-
|
|
8546
|
+
"(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
|
|
8447
8547
|
,
|
|
8448
8548
|
,
|
|
8449
8549
|
,
|
|
@@ -8455,7 +8555,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8455
8555
|
], [
|
|
8456
8556
|
,
|
|
8457
8557
|
,
|
|
8458
|
-
"(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-
|
|
8558
|
+
"(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
|
|
8459
8559
|
,
|
|
8460
8560
|
,
|
|
8461
8561
|
,
|