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
|
@@ -1642,11 +1642,7 @@ var interface_default = interfaceTranslations;
|
|
|
1642
1642
|
var allTranslations = { ...countries_default, ...interface_default };
|
|
1643
1643
|
var en_default = allTranslations;
|
|
1644
1644
|
|
|
1645
|
-
// src/js/
|
|
1646
|
-
for (const c of data_default) {
|
|
1647
|
-
c.name = en_default[c.iso2];
|
|
1648
|
-
}
|
|
1649
|
-
var id = 0;
|
|
1645
|
+
// src/js/modules/core/options.ts
|
|
1650
1646
|
var mq = (q) => {
|
|
1651
1647
|
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1652
1648
|
};
|
|
@@ -1712,6 +1708,181 @@ var defaults = {
|
|
|
1712
1708
|
//* The number type to enforce during validation.
|
|
1713
1709
|
validationNumberTypes: ["MOBILE"]
|
|
1714
1710
|
};
|
|
1711
|
+
function applyOptionSideEffects(o) {
|
|
1712
|
+
if (o.useFullscreenPopup) {
|
|
1713
|
+
o.fixDropdownWidth = false;
|
|
1714
|
+
}
|
|
1715
|
+
if (o.onlyCountries.length === 1) {
|
|
1716
|
+
o.initialCountry = o.onlyCountries[0];
|
|
1717
|
+
}
|
|
1718
|
+
if (o.separateDialCode) {
|
|
1719
|
+
o.nationalMode = false;
|
|
1720
|
+
}
|
|
1721
|
+
if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
|
|
1722
|
+
o.nationalMode = false;
|
|
1723
|
+
}
|
|
1724
|
+
if (o.useFullscreenPopup && !o.dropdownContainer) {
|
|
1725
|
+
o.dropdownContainer = document.body;
|
|
1726
|
+
}
|
|
1727
|
+
o.i18n = { ...en_default, ...o.i18n };
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
// src/js/modules/utils/string.ts
|
|
1731
|
+
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
1732
|
+
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1733
|
+
|
|
1734
|
+
// src/js/modules/utils/dom.ts
|
|
1735
|
+
var createEl = (tagName, attrs, container) => {
|
|
1736
|
+
const el = document.createElement(tagName);
|
|
1737
|
+
if (attrs) {
|
|
1738
|
+
Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
|
|
1739
|
+
}
|
|
1740
|
+
if (container) {
|
|
1741
|
+
container.appendChild(el);
|
|
1742
|
+
}
|
|
1743
|
+
return el;
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
// src/js/modules/data/country-data.ts
|
|
1747
|
+
function processAllCountries(options) {
|
|
1748
|
+
const { onlyCountries, excludeCountries } = options;
|
|
1749
|
+
if (onlyCountries.length) {
|
|
1750
|
+
const lowerCaseOnlyCountries = onlyCountries.map((country) => country.toLowerCase());
|
|
1751
|
+
return data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
|
|
1752
|
+
} else if (excludeCountries.length) {
|
|
1753
|
+
const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
|
|
1754
|
+
return data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
|
|
1755
|
+
}
|
|
1756
|
+
return data_default;
|
|
1757
|
+
}
|
|
1758
|
+
function translateCountryNames(countries, options) {
|
|
1759
|
+
for (const c of countries) {
|
|
1760
|
+
const iso2 = c.iso2.toLowerCase();
|
|
1761
|
+
if (options.i18n[iso2]) {
|
|
1762
|
+
c.name = options.i18n[iso2];
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
function processDialCodes(countries, options) {
|
|
1767
|
+
const dialCodes = /* @__PURE__ */ new Set();
|
|
1768
|
+
let dialCodeMaxLen = 0;
|
|
1769
|
+
const dialCodeToIso2Map = {};
|
|
1770
|
+
const _addToDialCodeMap = (iso2, dialCode, priority) => {
|
|
1771
|
+
if (!iso2 || !dialCode) {
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
if (dialCode.length > dialCodeMaxLen) {
|
|
1775
|
+
dialCodeMaxLen = dialCode.length;
|
|
1776
|
+
}
|
|
1777
|
+
if (!dialCodeToIso2Map.hasOwnProperty(dialCode)) {
|
|
1778
|
+
dialCodeToIso2Map[dialCode] = [];
|
|
1779
|
+
}
|
|
1780
|
+
const iso2List = dialCodeToIso2Map[dialCode];
|
|
1781
|
+
if (iso2List.includes(iso2)) {
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
const index = priority !== void 0 ? priority : iso2List.length;
|
|
1785
|
+
iso2List[index] = iso2;
|
|
1786
|
+
};
|
|
1787
|
+
for (const c of countries) {
|
|
1788
|
+
if (!dialCodes.has(c.dialCode)) {
|
|
1789
|
+
dialCodes.add(c.dialCode);
|
|
1790
|
+
}
|
|
1791
|
+
_addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1792
|
+
}
|
|
1793
|
+
if (options.onlyCountries.length || options.excludeCountries.length) {
|
|
1794
|
+
dialCodes.forEach((dialCode) => {
|
|
1795
|
+
dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
for (const c of countries) {
|
|
1799
|
+
if (c.areaCodes) {
|
|
1800
|
+
const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
|
|
1801
|
+
for (const areaCode of c.areaCodes) {
|
|
1802
|
+
for (let k = 1; k < areaCode.length; k++) {
|
|
1803
|
+
const partialAreaCode = areaCode.substring(0, k);
|
|
1804
|
+
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1805
|
+
_addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1806
|
+
_addToDialCodeMap(c.iso2, partialDialCode);
|
|
1807
|
+
}
|
|
1808
|
+
_addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
return { dialCodes, dialCodeMaxLen, dialCodeToIso2Map };
|
|
1813
|
+
}
|
|
1814
|
+
function sortCountries(countries, options) {
|
|
1815
|
+
if (options.countryOrder) {
|
|
1816
|
+
options.countryOrder = options.countryOrder.map((iso2) => iso2.toLowerCase());
|
|
1817
|
+
}
|
|
1818
|
+
countries.sort((a, b) => {
|
|
1819
|
+
const { countryOrder } = options;
|
|
1820
|
+
if (countryOrder) {
|
|
1821
|
+
const aIndex = countryOrder.indexOf(a.iso2);
|
|
1822
|
+
const bIndex = countryOrder.indexOf(b.iso2);
|
|
1823
|
+
const aIndexExists = aIndex > -1;
|
|
1824
|
+
const bIndexExists = bIndex > -1;
|
|
1825
|
+
if (aIndexExists || bIndexExists) {
|
|
1826
|
+
if (aIndexExists && bIndexExists) {
|
|
1827
|
+
return aIndex - bIndex;
|
|
1828
|
+
}
|
|
1829
|
+
return aIndexExists ? -1 : 1;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
return a.name.localeCompare(b.name);
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
function cacheSearchTokens(countries) {
|
|
1836
|
+
for (const c of countries) {
|
|
1837
|
+
c.normalisedName = normaliseString(c.name);
|
|
1838
|
+
c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
1839
|
+
c.dialCodePlus = `+${c.dialCode}`;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
// src/js/modules/format/formatting.ts
|
|
1844
|
+
function beforeSetNumber(fullNumber, dialCode, separateDialCode, selectedCountryData) {
|
|
1845
|
+
let number = fullNumber;
|
|
1846
|
+
if (separateDialCode) {
|
|
1847
|
+
if (dialCode) {
|
|
1848
|
+
dialCode = `+${selectedCountryData.dialCode}`;
|
|
1849
|
+
const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
|
|
1850
|
+
number = number.substring(start);
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
return number;
|
|
1854
|
+
}
|
|
1855
|
+
function formatNumberAsYouType(fullNumber, telInputValue, utils2, selectedCountryData, separateDialCode) {
|
|
1856
|
+
const result = utils2 ? utils2.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
|
|
1857
|
+
const { dialCode } = selectedCountryData;
|
|
1858
|
+
if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
1859
|
+
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
1860
|
+
return afterDialCode.trim();
|
|
1861
|
+
}
|
|
1862
|
+
return result;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
// src/js/modules/format/caret.ts
|
|
1866
|
+
function translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) {
|
|
1867
|
+
if (prevCaretPos === 0 && !isDeleteForwards) {
|
|
1868
|
+
return 0;
|
|
1869
|
+
}
|
|
1870
|
+
let relevantCharCount = 0;
|
|
1871
|
+
for (let i = 0; i < formattedValue.length; i++) {
|
|
1872
|
+
if (/[+0-9]/.test(formattedValue[i])) {
|
|
1873
|
+
relevantCharCount++;
|
|
1874
|
+
}
|
|
1875
|
+
if (relevantCharCount === relevantChars && !isDeleteForwards) {
|
|
1876
|
+
return i + 1;
|
|
1877
|
+
}
|
|
1878
|
+
if (isDeleteForwards && relevantCharCount === relevantChars + 1) {
|
|
1879
|
+
return i;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return formattedValue.length;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
// src/js/modules/data/nanp-regionless.ts
|
|
1715
1886
|
var regionlessNanpNumbers = [
|
|
1716
1887
|
"800",
|
|
1717
1888
|
"822",
|
|
@@ -1731,8 +1902,6 @@ var regionlessNanpNumbers = [
|
|
|
1731
1902
|
"888",
|
|
1732
1903
|
"889"
|
|
1733
1904
|
];
|
|
1734
|
-
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
1735
|
-
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1736
1905
|
var isRegionlessNanp = (number) => {
|
|
1737
1906
|
const numeric = getNumeric(number);
|
|
1738
1907
|
if (numeric.charAt(0) === "1") {
|
|
@@ -1741,34 +1910,14 @@ var isRegionlessNanp = (number) => {
|
|
|
1741
1910
|
}
|
|
1742
1911
|
return false;
|
|
1743
1912
|
};
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
}
|
|
1753
|
-
if (count === relevantChars && !isDeleteForwards) {
|
|
1754
|
-
return i + 1;
|
|
1755
|
-
}
|
|
1756
|
-
if (isDeleteForwards && count === relevantChars + 1) {
|
|
1757
|
-
return i;
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
return formattedValue.length;
|
|
1761
|
-
};
|
|
1762
|
-
var createEl = (tagName, attrs, container) => {
|
|
1763
|
-
const el = document.createElement(tagName);
|
|
1764
|
-
if (attrs) {
|
|
1765
|
-
Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
|
|
1766
|
-
}
|
|
1767
|
-
if (container) {
|
|
1768
|
-
container.appendChild(el);
|
|
1769
|
-
}
|
|
1770
|
-
return el;
|
|
1771
|
-
};
|
|
1913
|
+
|
|
1914
|
+
// src/js/intl-tel-input.ts
|
|
1915
|
+
for (const c of data_default) {
|
|
1916
|
+
c.name = en_default[c.iso2];
|
|
1917
|
+
}
|
|
1918
|
+
var id = 0;
|
|
1919
|
+
var iso2Set = new Set(data_default.map((c) => c.iso2));
|
|
1920
|
+
var isIso2 = (val) => iso2Set.has(val);
|
|
1772
1921
|
var forEachInstance = (method, ...args) => {
|
|
1773
1922
|
const { instances } = intlTelInput;
|
|
1774
1923
|
Object.values(instances).forEach((instance) => instance[method](...args));
|
|
@@ -1788,23 +1937,7 @@ var Iti = class _Iti {
|
|
|
1788
1937
|
this.options = Object.assign({}, defaults, customOptions);
|
|
1789
1938
|
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
1790
1939
|
}
|
|
1791
|
-
|
|
1792
|
-
_init() {
|
|
1793
|
-
if (this.options.useFullscreenPopup) {
|
|
1794
|
-
this.options.fixDropdownWidth = false;
|
|
1795
|
-
}
|
|
1796
|
-
if (this.options.onlyCountries.length === 1) {
|
|
1797
|
-
this.options.initialCountry = this.options.onlyCountries[0];
|
|
1798
|
-
}
|
|
1799
|
-
if (this.options.separateDialCode) {
|
|
1800
|
-
this.options.nationalMode = false;
|
|
1801
|
-
}
|
|
1802
|
-
if (this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode) {
|
|
1803
|
-
this.options.nationalMode = false;
|
|
1804
|
-
}
|
|
1805
|
-
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
|
|
1806
|
-
this.options.dropdownContainer = document.body;
|
|
1807
|
-
}
|
|
1940
|
+
_detectEnvironmentAndLayout() {
|
|
1808
1941
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
1809
1942
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1810
1943
|
this.telInput.dir = "ltr";
|
|
@@ -1817,7 +1950,8 @@ var Iti = class _Iti {
|
|
|
1817
1950
|
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
1818
1951
|
}
|
|
1819
1952
|
}
|
|
1820
|
-
|
|
1953
|
+
}
|
|
1954
|
+
_createInitPromises() {
|
|
1821
1955
|
const autoCountryPromise = new Promise((resolve, reject) => {
|
|
1822
1956
|
this.resolveAutoCountryPromise = resolve;
|
|
1823
1957
|
this.rejectAutoCountryPromise = reject;
|
|
@@ -1827,6 +1961,12 @@ var Iti = class _Iti {
|
|
|
1827
1961
|
this.rejectUtilsScriptPromise = reject;
|
|
1828
1962
|
});
|
|
1829
1963
|
this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]);
|
|
1964
|
+
}
|
|
1965
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1966
|
+
_init() {
|
|
1967
|
+
applyOptionSideEffects(this.options);
|
|
1968
|
+
this._detectEnvironmentAndLayout();
|
|
1969
|
+
this._createInitPromises();
|
|
1830
1970
|
this.selectedCountryData = {};
|
|
1831
1971
|
this._processCountryData();
|
|
1832
1972
|
this._generateMarkup();
|
|
@@ -1839,139 +1979,37 @@ var Iti = class _Iti {
|
|
|
1839
1979
|
//********************
|
|
1840
1980
|
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
1841
1981
|
_processCountryData() {
|
|
1842
|
-
this.
|
|
1843
|
-
this.
|
|
1844
|
-
this.
|
|
1845
|
-
this.
|
|
1982
|
+
this.countries = processAllCountries(this.options);
|
|
1983
|
+
const dialRes = processDialCodes(this.countries, this.options);
|
|
1984
|
+
this.dialCodes = dialRes.dialCodes;
|
|
1985
|
+
this.dialCodeMaxLen = dialRes.dialCodeMaxLen;
|
|
1986
|
+
this.dialCodeToIso2Map = dialRes.dialCodeToIso2Map;
|
|
1987
|
+
translateCountryNames(this.countries, this.options);
|
|
1988
|
+
sortCountries(this.countries, this.options);
|
|
1846
1989
|
this.countryByIso2 = new Map(this.countries.map((c) => [c.iso2, c]));
|
|
1847
|
-
this.
|
|
1848
|
-
}
|
|
1849
|
-
//* Precompute and cache country search tokens to speed up filtering
|
|
1850
|
-
_cacheSearchTokens() {
|
|
1851
|
-
for (const c of this.countries) {
|
|
1852
|
-
c.normalisedName = normaliseString(c.name);
|
|
1853
|
-
c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
1854
|
-
c.dialCodePlus = `+${c.dialCode}`;
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
//* Sort countries by countryOrder option (if present), then name.
|
|
1858
|
-
_sortCountries() {
|
|
1859
|
-
if (this.options.countryOrder) {
|
|
1860
|
-
this.options.countryOrder = this.options.countryOrder.map((country) => country.toLowerCase());
|
|
1861
|
-
}
|
|
1862
|
-
this.countries.sort((a, b) => {
|
|
1863
|
-
const { countryOrder } = this.options;
|
|
1864
|
-
if (countryOrder) {
|
|
1865
|
-
const aIndex = countryOrder.indexOf(a.iso2);
|
|
1866
|
-
const bIndex = countryOrder.indexOf(b.iso2);
|
|
1867
|
-
const aIndexExists = aIndex > -1;
|
|
1868
|
-
const bIndexExists = bIndex > -1;
|
|
1869
|
-
if (aIndexExists || bIndexExists) {
|
|
1870
|
-
if (aIndexExists && bIndexExists) {
|
|
1871
|
-
return aIndex - bIndex;
|
|
1872
|
-
}
|
|
1873
|
-
return aIndexExists ? -1 : 1;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
return a.name.localeCompare(b.name);
|
|
1877
|
-
});
|
|
1878
|
-
}
|
|
1879
|
-
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1880
|
-
_addToDialCodeMap(iso2, dialCode, priority) {
|
|
1881
|
-
if (!iso2 || !dialCode) {
|
|
1882
|
-
return;
|
|
1883
|
-
}
|
|
1884
|
-
if (dialCode.length > this.dialCodeMaxLen) {
|
|
1885
|
-
this.dialCodeMaxLen = dialCode.length;
|
|
1886
|
-
}
|
|
1887
|
-
if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) {
|
|
1888
|
-
this.dialCodeToIso2Map[dialCode] = [];
|
|
1889
|
-
}
|
|
1890
|
-
const iso2List = this.dialCodeToIso2Map[dialCode];
|
|
1891
|
-
if (iso2List.includes(iso2)) {
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
const index = priority !== void 0 ? priority : iso2List.length;
|
|
1895
|
-
iso2List[index] = iso2;
|
|
1896
|
-
}
|
|
1897
|
-
//* Process onlyCountries or excludeCountries array if present.
|
|
1898
|
-
_processAllCountries() {
|
|
1899
|
-
const { onlyCountries, excludeCountries } = this.options;
|
|
1900
|
-
if (onlyCountries.length) {
|
|
1901
|
-
const lowerCaseOnlyCountries = onlyCountries.map(
|
|
1902
|
-
(country) => country.toLowerCase()
|
|
1903
|
-
);
|
|
1904
|
-
this.countries = data_default.filter(
|
|
1905
|
-
(country) => lowerCaseOnlyCountries.includes(country.iso2)
|
|
1906
|
-
);
|
|
1907
|
-
} else if (excludeCountries.length) {
|
|
1908
|
-
const lowerCaseExcludeCountries = excludeCountries.map(
|
|
1909
|
-
(country) => country.toLowerCase()
|
|
1910
|
-
);
|
|
1911
|
-
this.countries = data_default.filter(
|
|
1912
|
-
(country) => !lowerCaseExcludeCountries.includes(country.iso2)
|
|
1913
|
-
);
|
|
1914
|
-
} else {
|
|
1915
|
-
this.countries = data_default;
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
//* Translate Countries by object literal provided on config.
|
|
1919
|
-
_translateCountryNames() {
|
|
1920
|
-
for (const c of this.countries) {
|
|
1921
|
-
const iso2 = c.iso2.toLowerCase();
|
|
1922
|
-
if (this.options.i18n.hasOwnProperty(iso2)) {
|
|
1923
|
-
c.name = this.options.i18n[iso2];
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1928
|
-
_processDialCodes() {
|
|
1929
|
-
this.dialCodes = /* @__PURE__ */ new Set();
|
|
1930
|
-
this.dialCodeMaxLen = 0;
|
|
1931
|
-
this.dialCodeToIso2Map = {};
|
|
1932
|
-
for (const c of this.countries) {
|
|
1933
|
-
if (!this.dialCodes.has(c.dialCode)) {
|
|
1934
|
-
this.dialCodes.add(c.dialCode);
|
|
1935
|
-
}
|
|
1936
|
-
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1937
|
-
}
|
|
1938
|
-
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1939
|
-
this.dialCodes.forEach((dialCode) => {
|
|
1940
|
-
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
for (const c of this.countries) {
|
|
1944
|
-
if (c.areaCodes) {
|
|
1945
|
-
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
1946
|
-
for (const areaCode of c.areaCodes) {
|
|
1947
|
-
for (let k = 1; k < areaCode.length; k++) {
|
|
1948
|
-
const partialAreaCode = areaCode.substring(0, k);
|
|
1949
|
-
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1950
|
-
this._addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1951
|
-
this._addToDialCodeMap(c.iso2, partialDialCode);
|
|
1952
|
-
}
|
|
1953
|
-
this._addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1990
|
+
cacheSearchTokens(this.countries);
|
|
1957
1991
|
}
|
|
1958
1992
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1959
1993
|
_generateMarkup() {
|
|
1994
|
+
this._prepareTelInput();
|
|
1995
|
+
const wrapper = this._createWrapperAndInsert();
|
|
1996
|
+
this._maybeBuildCountryContainer(wrapper);
|
|
1997
|
+
wrapper.appendChild(this.telInput);
|
|
1998
|
+
this._maybeUpdateInputPaddingAndReveal();
|
|
1999
|
+
this._maybeBuildHiddenInputs(wrapper);
|
|
2000
|
+
}
|
|
2001
|
+
_prepareTelInput() {
|
|
1960
2002
|
this.telInput.classList.add("iti__tel-input");
|
|
1961
2003
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
1962
2004
|
this.telInput.setAttribute("autocomplete", "off");
|
|
1963
2005
|
}
|
|
2006
|
+
}
|
|
2007
|
+
_createWrapperAndInsert() {
|
|
1964
2008
|
const {
|
|
1965
2009
|
allowDropdown,
|
|
1966
|
-
separateDialCode,
|
|
1967
2010
|
showFlags,
|
|
1968
2011
|
containerClass,
|
|
1969
|
-
|
|
1970
|
-
dropdownContainer,
|
|
1971
|
-
fixDropdownWidth,
|
|
1972
|
-
useFullscreenPopup,
|
|
1973
|
-
countrySearch,
|
|
1974
|
-
i18n
|
|
2012
|
+
useFullscreenPopup
|
|
1975
2013
|
} = this.options;
|
|
1976
2014
|
const parentClasses = _Iti._buildClassNames({
|
|
1977
2015
|
"iti": true,
|
|
@@ -1982,6 +2020,14 @@ var Iti = class _Iti {
|
|
|
1982
2020
|
});
|
|
1983
2021
|
const wrapper = createEl("div", { class: parentClasses });
|
|
1984
2022
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
2023
|
+
return wrapper;
|
|
2024
|
+
}
|
|
2025
|
+
_maybeBuildCountryContainer(wrapper) {
|
|
2026
|
+
const {
|
|
2027
|
+
allowDropdown,
|
|
2028
|
+
separateDialCode,
|
|
2029
|
+
showFlags
|
|
2030
|
+
} = this.options;
|
|
1985
2031
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1986
2032
|
this.countryContainer = createEl(
|
|
1987
2033
|
"div",
|
|
@@ -2042,119 +2088,138 @@ var Iti = class _Iti {
|
|
|
2042
2088
|
);
|
|
2043
2089
|
}
|
|
2044
2090
|
if (allowDropdown) {
|
|
2045
|
-
|
|
2046
|
-
this.dropdownContent = createEl("div", {
|
|
2047
|
-
id: `iti-${this.id}__dropdown-content`,
|
|
2048
|
-
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
2049
|
-
role: "dialog",
|
|
2050
|
-
"aria-modal": "true"
|
|
2051
|
-
});
|
|
2052
|
-
if (countrySearch) {
|
|
2053
|
-
const searchWrapper = createEl(
|
|
2054
|
-
"div",
|
|
2055
|
-
{ class: "iti__search-input-wrapper" },
|
|
2056
|
-
this.dropdownContent
|
|
2057
|
-
);
|
|
2058
|
-
this.searchIcon = createEl(
|
|
2059
|
-
"span",
|
|
2060
|
-
{
|
|
2061
|
-
class: "iti__search-icon",
|
|
2062
|
-
"aria-hidden": "true"
|
|
2063
|
-
},
|
|
2064
|
-
searchWrapper
|
|
2065
|
-
);
|
|
2066
|
-
this.searchIcon.innerHTML = `
|
|
2067
|
-
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2068
|
-
<circle cx="11" cy="11" r="7" />
|
|
2069
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2070
|
-
</svg>`;
|
|
2071
|
-
this.searchInput = createEl(
|
|
2072
|
-
"input",
|
|
2073
|
-
{
|
|
2074
|
-
id: `iti-${this.id}__search-input`,
|
|
2075
|
-
// Chrome says inputs need either a name or an id
|
|
2076
|
-
type: "search",
|
|
2077
|
-
class: "iti__search-input",
|
|
2078
|
-
placeholder: i18n.searchPlaceholder,
|
|
2079
|
-
// 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
|
|
2080
|
-
role: "combobox",
|
|
2081
|
-
"aria-expanded": "true",
|
|
2082
|
-
"aria-label": i18n.searchPlaceholder,
|
|
2083
|
-
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
2084
|
-
"aria-autocomplete": "list",
|
|
2085
|
-
"autocomplete": "off"
|
|
2086
|
-
},
|
|
2087
|
-
searchWrapper
|
|
2088
|
-
);
|
|
2089
|
-
this.searchClearButton = createEl(
|
|
2090
|
-
"button",
|
|
2091
|
-
{
|
|
2092
|
-
type: "button",
|
|
2093
|
-
class: "iti__search-clear iti__hide",
|
|
2094
|
-
"aria-label": i18n.clearSearchAriaLabel,
|
|
2095
|
-
tabindex: "-1"
|
|
2096
|
-
},
|
|
2097
|
-
searchWrapper
|
|
2098
|
-
);
|
|
2099
|
-
const maskId = `iti-${this.id}-clear-mask`;
|
|
2100
|
-
this.searchClearButton.innerHTML = `
|
|
2101
|
-
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2102
|
-
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2103
|
-
<rect width="16" height="16" fill="white" />
|
|
2104
|
-
<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" />
|
|
2105
|
-
</mask>
|
|
2106
|
-
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2107
|
-
</svg>`;
|
|
2108
|
-
this.searchResultsA11yText = createEl(
|
|
2109
|
-
"span",
|
|
2110
|
-
{ class: "iti__a11y-text" },
|
|
2111
|
-
this.dropdownContent
|
|
2112
|
-
);
|
|
2113
|
-
this.searchNoResults = createEl(
|
|
2114
|
-
"div",
|
|
2115
|
-
{
|
|
2116
|
-
class: "iti__no-results iti__hide",
|
|
2117
|
-
"aria-hidden": "true"
|
|
2118
|
-
// all a11y messaging happens in this.searchResultsA11yText
|
|
2119
|
-
},
|
|
2120
|
-
this.dropdownContent
|
|
2121
|
-
);
|
|
2122
|
-
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2123
|
-
}
|
|
2124
|
-
this.countryList = createEl(
|
|
2125
|
-
"ul",
|
|
2126
|
-
{
|
|
2127
|
-
class: "iti__country-list",
|
|
2128
|
-
id: `iti-${this.id}__country-listbox`,
|
|
2129
|
-
role: "listbox",
|
|
2130
|
-
"aria-label": i18n.countryListAriaLabel
|
|
2131
|
-
},
|
|
2132
|
-
this.dropdownContent
|
|
2133
|
-
);
|
|
2134
|
-
this._appendListItems();
|
|
2135
|
-
if (countrySearch) {
|
|
2136
|
-
this._updateSearchResultsA11yText();
|
|
2137
|
-
}
|
|
2138
|
-
if (dropdownContainer) {
|
|
2139
|
-
const dropdownClasses = _Iti._buildClassNames({
|
|
2140
|
-
"iti": true,
|
|
2141
|
-
"iti--container": true,
|
|
2142
|
-
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2143
|
-
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2144
|
-
[containerClass]: Boolean(containerClass)
|
|
2145
|
-
});
|
|
2146
|
-
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2147
|
-
this.dropdown.appendChild(this.dropdownContent);
|
|
2148
|
-
} else {
|
|
2149
|
-
this.countryContainer.appendChild(this.dropdownContent);
|
|
2150
|
-
}
|
|
2091
|
+
this._buildDropdownContent();
|
|
2151
2092
|
}
|
|
2152
2093
|
}
|
|
2153
|
-
|
|
2094
|
+
}
|
|
2095
|
+
_buildDropdownContent() {
|
|
2096
|
+
const {
|
|
2097
|
+
fixDropdownWidth,
|
|
2098
|
+
useFullscreenPopup,
|
|
2099
|
+
countrySearch,
|
|
2100
|
+
i18n,
|
|
2101
|
+
dropdownContainer,
|
|
2102
|
+
containerClass
|
|
2103
|
+
} = this.options;
|
|
2104
|
+
const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
2105
|
+
this.dropdownContent = createEl("div", {
|
|
2106
|
+
id: `iti-${this.id}__dropdown-content`,
|
|
2107
|
+
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
2108
|
+
role: "dialog",
|
|
2109
|
+
"aria-modal": "true"
|
|
2110
|
+
});
|
|
2111
|
+
if (countrySearch) {
|
|
2112
|
+
this._buildSearchUI();
|
|
2113
|
+
}
|
|
2114
|
+
this.countryList = createEl(
|
|
2115
|
+
"ul",
|
|
2116
|
+
{
|
|
2117
|
+
class: "iti__country-list",
|
|
2118
|
+
id: `iti-${this.id}__country-listbox`,
|
|
2119
|
+
role: "listbox",
|
|
2120
|
+
"aria-label": i18n.countryListAriaLabel
|
|
2121
|
+
},
|
|
2122
|
+
this.dropdownContent
|
|
2123
|
+
);
|
|
2124
|
+
this._appendListItems();
|
|
2125
|
+
if (countrySearch) {
|
|
2126
|
+
this._updateSearchResultsA11yText();
|
|
2127
|
+
}
|
|
2128
|
+
if (dropdownContainer) {
|
|
2129
|
+
const dropdownClasses = _Iti._buildClassNames({
|
|
2130
|
+
"iti": true,
|
|
2131
|
+
"iti--container": true,
|
|
2132
|
+
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2133
|
+
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2134
|
+
[containerClass]: Boolean(containerClass)
|
|
2135
|
+
});
|
|
2136
|
+
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2137
|
+
this.dropdown.appendChild(this.dropdownContent);
|
|
2138
|
+
} else {
|
|
2139
|
+
this.countryContainer.appendChild(this.dropdownContent);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
_buildSearchUI() {
|
|
2143
|
+
const { i18n } = this.options;
|
|
2144
|
+
const searchWrapper = createEl(
|
|
2145
|
+
"div",
|
|
2146
|
+
{ class: "iti__search-input-wrapper" },
|
|
2147
|
+
this.dropdownContent
|
|
2148
|
+
);
|
|
2149
|
+
this.searchIcon = createEl(
|
|
2150
|
+
"span",
|
|
2151
|
+
{
|
|
2152
|
+
class: "iti__search-icon",
|
|
2153
|
+
"aria-hidden": "true"
|
|
2154
|
+
},
|
|
2155
|
+
searchWrapper
|
|
2156
|
+
);
|
|
2157
|
+
this.searchIcon.innerHTML = `
|
|
2158
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2159
|
+
<circle cx="11" cy="11" r="7" />
|
|
2160
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2161
|
+
</svg>`;
|
|
2162
|
+
this.searchInput = createEl(
|
|
2163
|
+
"input",
|
|
2164
|
+
{
|
|
2165
|
+
id: `iti-${this.id}__search-input`,
|
|
2166
|
+
// Chrome says inputs need either a name or an id
|
|
2167
|
+
type: "search",
|
|
2168
|
+
class: "iti__search-input",
|
|
2169
|
+
placeholder: i18n.searchPlaceholder,
|
|
2170
|
+
// 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
|
|
2171
|
+
role: "combobox",
|
|
2172
|
+
"aria-expanded": "true",
|
|
2173
|
+
"aria-label": i18n.searchPlaceholder,
|
|
2174
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
2175
|
+
"aria-autocomplete": "list",
|
|
2176
|
+
"autocomplete": "off"
|
|
2177
|
+
},
|
|
2178
|
+
searchWrapper
|
|
2179
|
+
);
|
|
2180
|
+
this.searchClearButton = createEl(
|
|
2181
|
+
"button",
|
|
2182
|
+
{
|
|
2183
|
+
type: "button",
|
|
2184
|
+
class: "iti__search-clear iti__hide",
|
|
2185
|
+
"aria-label": i18n.clearSearchAriaLabel,
|
|
2186
|
+
tabindex: "-1"
|
|
2187
|
+
},
|
|
2188
|
+
searchWrapper
|
|
2189
|
+
);
|
|
2190
|
+
const maskId = `iti-${this.id}-clear-mask`;
|
|
2191
|
+
this.searchClearButton.innerHTML = `
|
|
2192
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2193
|
+
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2194
|
+
<rect width="16" height="16" fill="white" />
|
|
2195
|
+
<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" />
|
|
2196
|
+
</mask>
|
|
2197
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2198
|
+
</svg>`;
|
|
2199
|
+
this.searchResultsA11yText = createEl(
|
|
2200
|
+
"span",
|
|
2201
|
+
{ class: "iti__a11y-text" },
|
|
2202
|
+
this.dropdownContent
|
|
2203
|
+
);
|
|
2204
|
+
this.searchNoResults = createEl(
|
|
2205
|
+
"div",
|
|
2206
|
+
{
|
|
2207
|
+
class: "iti__no-results iti__hide",
|
|
2208
|
+
"aria-hidden": "true"
|
|
2209
|
+
// all a11y messaging happens in this.searchResultsA11yText
|
|
2210
|
+
},
|
|
2211
|
+
this.dropdownContent
|
|
2212
|
+
);
|
|
2213
|
+
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2214
|
+
}
|
|
2215
|
+
_maybeUpdateInputPaddingAndReveal() {
|
|
2154
2216
|
if (this.countryContainer) {
|
|
2155
2217
|
this._updateInputPadding();
|
|
2156
2218
|
this.countryContainer.classList.remove("iti__v-hide");
|
|
2157
2219
|
}
|
|
2220
|
+
}
|
|
2221
|
+
_maybeBuildHiddenInputs(wrapper) {
|
|
2222
|
+
const { hiddenInput } = this.options;
|
|
2158
2223
|
if (hiddenInput) {
|
|
2159
2224
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2160
2225
|
const names = hiddenInput(telInputName);
|
|
@@ -2228,14 +2293,13 @@ var Iti = class _Iti {
|
|
|
2228
2293
|
this._updateCountryFromNumber(val);
|
|
2229
2294
|
} else if (!isAutoCountry || overrideAutoCountry) {
|
|
2230
2295
|
const lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : "";
|
|
2231
|
-
|
|
2232
|
-
if (isValidInitialCountry) {
|
|
2296
|
+
if (isIso2(lowerInitialCountry)) {
|
|
2233
2297
|
this._setCountry(lowerInitialCountry);
|
|
2234
2298
|
} else {
|
|
2235
2299
|
if (dialCode && isRegionlessNanpNumber) {
|
|
2236
2300
|
this._setCountry("us");
|
|
2237
2301
|
} else {
|
|
2238
|
-
this._setCountry();
|
|
2302
|
+
this._setCountry("");
|
|
2239
2303
|
}
|
|
2240
2304
|
}
|
|
2241
2305
|
}
|
|
@@ -2338,8 +2402,7 @@ var Iti = class _Iti {
|
|
|
2338
2402
|
this.options.geoIpLookup(
|
|
2339
2403
|
(iso2 = "") => {
|
|
2340
2404
|
const iso2Lower = iso2.toLowerCase();
|
|
2341
|
-
|
|
2342
|
-
if (isValidIso2) {
|
|
2405
|
+
if (isIso2(iso2Lower)) {
|
|
2343
2406
|
intlTelInput.autoCountry = iso2Lower;
|
|
2344
2407
|
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2345
2408
|
} else {
|
|
@@ -2362,6 +2425,11 @@ var Iti = class _Iti {
|
|
|
2362
2425
|
}
|
|
2363
2426
|
//* Initialize the tel input listeners.
|
|
2364
2427
|
_initTelInputListeners() {
|
|
2428
|
+
this._bindInputListener();
|
|
2429
|
+
this._maybeBindKeydownListener();
|
|
2430
|
+
this._maybeBindPasteListener();
|
|
2431
|
+
}
|
|
2432
|
+
_bindInputListener() {
|
|
2365
2433
|
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2366
2434
|
let userOverrideFormatting = false;
|
|
2367
2435
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
@@ -2392,13 +2460,23 @@ var Iti = class _Iti {
|
|
|
2392
2460
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2393
2461
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
2394
2462
|
const isDeleteForwards = e?.inputType === "deleteContentForward";
|
|
2395
|
-
const
|
|
2463
|
+
const fullNumber = this._getFullNumber();
|
|
2464
|
+
const formattedValue = formatNumberAsYouType(
|
|
2465
|
+
fullNumber,
|
|
2466
|
+
this.telInput.value,
|
|
2467
|
+
intlTelInput.utils,
|
|
2468
|
+
this.selectedCountryData,
|
|
2469
|
+
this.options.separateDialCode
|
|
2470
|
+
);
|
|
2396
2471
|
const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
|
|
2397
2472
|
this.telInput.value = formattedValue;
|
|
2398
2473
|
this.telInput.setSelectionRange(newCaretPos, newCaretPos);
|
|
2399
2474
|
}
|
|
2400
2475
|
};
|
|
2401
2476
|
this.telInput.addEventListener("input", this._handleInputEvent);
|
|
2477
|
+
}
|
|
2478
|
+
_maybeBindKeydownListener() {
|
|
2479
|
+
const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2402
2480
|
if (strictMode || separateDialCode) {
|
|
2403
2481
|
this._handleKeydownEvent = (e) => {
|
|
2404
2482
|
if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
@@ -2427,12 +2505,17 @@ var Iti = class _Iti {
|
|
|
2427
2505
|
};
|
|
2428
2506
|
this.telInput.addEventListener("keydown", this._handleKeydownEvent);
|
|
2429
2507
|
}
|
|
2430
|
-
|
|
2508
|
+
}
|
|
2509
|
+
_maybeBindPasteListener() {
|
|
2510
|
+
if (this.options.strictMode) {
|
|
2431
2511
|
this._handlePasteEvent = (e) => {
|
|
2432
2512
|
e.preventDefault();
|
|
2433
2513
|
const input = this.telInput;
|
|
2434
2514
|
const selStart = input.selectionStart;
|
|
2435
2515
|
const selEnd = input.selectionEnd;
|
|
2516
|
+
const before = input.value.slice(0, selStart);
|
|
2517
|
+
const after = input.value.slice(selEnd);
|
|
2518
|
+
const iso2 = this.selectedCountryData.iso2;
|
|
2436
2519
|
const pasted = e.clipboardData.getData("text");
|
|
2437
2520
|
const initialCharSelected = selStart === 0 && selEnd > 0;
|
|
2438
2521
|
const allowLeadingPlus = !input.value.startsWith("+") || initialCharSelected;
|
|
@@ -2440,8 +2523,15 @@ var Iti = class _Iti {
|
|
|
2440
2523
|
const hasLeadingPlus = allowedChars.startsWith("+");
|
|
2441
2524
|
const numerics = allowedChars.replace(/\+/g, "");
|
|
2442
2525
|
const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
|
|
2443
|
-
let newVal =
|
|
2444
|
-
|
|
2526
|
+
let newVal = before + sanitised + after;
|
|
2527
|
+
let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2528
|
+
while (coreNumber.length === 0 && newVal.length > 0) {
|
|
2529
|
+
newVal = newVal.slice(0, -1);
|
|
2530
|
+
coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2531
|
+
}
|
|
2532
|
+
if (!coreNumber) {
|
|
2533
|
+
return;
|
|
2534
|
+
}
|
|
2445
2535
|
if (this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength) {
|
|
2446
2536
|
if (input.selectionEnd === input.value.length) {
|
|
2447
2537
|
const trimLength = coreNumber.length - this.maxCoreNumberLength;
|
|
@@ -2611,43 +2701,14 @@ var Iti = class _Iti {
|
|
|
2611
2701
|
}
|
|
2612
2702
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2613
2703
|
_filterCountries(query) {
|
|
2614
|
-
let noCountriesAddedYet = true;
|
|
2615
2704
|
this.countryList.innerHTML = "";
|
|
2616
|
-
const normalisedQuery = normaliseString(query);
|
|
2617
2705
|
let matchedCountries;
|
|
2618
2706
|
if (query === "") {
|
|
2619
2707
|
matchedCountries = this.countries;
|
|
2620
2708
|
} else {
|
|
2621
|
-
|
|
2622
|
-
const nameStartWith = [];
|
|
2623
|
-
const nameContains = [];
|
|
2624
|
-
const dialCodeMatches = [];
|
|
2625
|
-
const dialCodeContains = [];
|
|
2626
|
-
const initialsMatches = [];
|
|
2627
|
-
for (const c of this.countries) {
|
|
2628
|
-
if (c.iso2 === normalisedQuery) {
|
|
2629
|
-
iso2Matches.push(c);
|
|
2630
|
-
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2631
|
-
nameStartWith.push(c);
|
|
2632
|
-
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2633
|
-
nameContains.push(c);
|
|
2634
|
-
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2635
|
-
dialCodeMatches.push(c);
|
|
2636
|
-
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2637
|
-
dialCodeContains.push(c);
|
|
2638
|
-
} else if (c.initials.includes(normalisedQuery)) {
|
|
2639
|
-
initialsMatches.push(c);
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
matchedCountries = [
|
|
2643
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2644
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2645
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2646
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2647
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2648
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2649
|
-
];
|
|
2709
|
+
matchedCountries = this._getMatchedCountries(query);
|
|
2650
2710
|
}
|
|
2711
|
+
let noCountriesAddedYet = true;
|
|
2651
2712
|
for (const c of matchedCountries) {
|
|
2652
2713
|
const listItem = c.nodeById[this.id];
|
|
2653
2714
|
if (listItem) {
|
|
@@ -2669,6 +2730,38 @@ var Iti = class _Iti {
|
|
|
2669
2730
|
this.countryList.scrollTop = 0;
|
|
2670
2731
|
this._updateSearchResultsA11yText();
|
|
2671
2732
|
}
|
|
2733
|
+
_getMatchedCountries(query) {
|
|
2734
|
+
const normalisedQuery = normaliseString(query);
|
|
2735
|
+
const iso2Matches = [];
|
|
2736
|
+
const nameStartWith = [];
|
|
2737
|
+
const nameContains = [];
|
|
2738
|
+
const dialCodeMatches = [];
|
|
2739
|
+
const dialCodeContains = [];
|
|
2740
|
+
const initialsMatches = [];
|
|
2741
|
+
for (const c of this.countries) {
|
|
2742
|
+
if (c.iso2 === normalisedQuery) {
|
|
2743
|
+
iso2Matches.push(c);
|
|
2744
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2745
|
+
nameStartWith.push(c);
|
|
2746
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2747
|
+
nameContains.push(c);
|
|
2748
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2749
|
+
dialCodeMatches.push(c);
|
|
2750
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2751
|
+
dialCodeContains.push(c);
|
|
2752
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2753
|
+
initialsMatches.push(c);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
return [
|
|
2757
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2758
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2759
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2760
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2761
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2762
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2763
|
+
];
|
|
2764
|
+
}
|
|
2672
2765
|
//* Update search results text (for a11y).
|
|
2673
2766
|
_updateSearchResultsA11yText() {
|
|
2674
2767
|
const { i18n } = this.options;
|
|
@@ -2799,24 +2892,12 @@ var Iti = class _Iti {
|
|
|
2799
2892
|
this.highlightedItem.focus();
|
|
2800
2893
|
}
|
|
2801
2894
|
}
|
|
2802
|
-
//* Find the country data for the given iso2 code
|
|
2803
|
-
//* 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
|
|
2804
|
-
_getCountryData(iso2, allowFail) {
|
|
2805
|
-
const country = this.countryByIso2.get(iso2);
|
|
2806
|
-
if (country) {
|
|
2807
|
-
return country;
|
|
2808
|
-
}
|
|
2809
|
-
if (allowFail) {
|
|
2810
|
-
return null;
|
|
2811
|
-
}
|
|
2812
|
-
throw new Error(`No country data for '${iso2}'`);
|
|
2813
|
-
}
|
|
2814
2895
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2815
2896
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2816
2897
|
_setCountry(iso2) {
|
|
2817
2898
|
const { separateDialCode, showFlags, i18n } = this.options;
|
|
2818
2899
|
const prevIso2 = this.selectedCountryData.iso2 || "";
|
|
2819
|
-
this.selectedCountryData = iso2 ? this.
|
|
2900
|
+
this.selectedCountryData = iso2 ? this.countryByIso2.get(iso2) : {};
|
|
2820
2901
|
if (this.selectedCountryData.iso2) {
|
|
2821
2902
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2822
2903
|
}
|
|
@@ -2935,11 +3016,11 @@ var Iti = class _Iti {
|
|
|
2935
3016
|
}
|
|
2936
3017
|
//* Called when the user selects a list item from the dropdown.
|
|
2937
3018
|
_selectListItem(listItem) {
|
|
2938
|
-
const
|
|
2939
|
-
|
|
2940
|
-
);
|
|
3019
|
+
const iso2 = listItem.getAttribute("data-country-code");
|
|
3020
|
+
const countryChanged = this._setCountry(iso2);
|
|
2941
3021
|
this._closeDropdown();
|
|
2942
|
-
|
|
3022
|
+
const dialCode = listItem.getAttribute("data-dial-code");
|
|
3023
|
+
this._updateDialCode(dialCode);
|
|
2943
3024
|
if (this.options.formatOnDisplay) {
|
|
2944
3025
|
this._updateValFromNumber(this.telInput.value);
|
|
2945
3026
|
}
|
|
@@ -3062,32 +3143,19 @@ var Iti = class _Iti {
|
|
|
3062
3143
|
}
|
|
3063
3144
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
3064
3145
|
_beforeSetNumber(fullNumber) {
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
}
|
|
3073
|
-
}
|
|
3146
|
+
const dialCode = this._getDialCode(fullNumber);
|
|
3147
|
+
const number = beforeSetNumber(
|
|
3148
|
+
fullNumber,
|
|
3149
|
+
dialCode,
|
|
3150
|
+
this.options.separateDialCode,
|
|
3151
|
+
this.selectedCountryData
|
|
3152
|
+
);
|
|
3074
3153
|
return this._cap(number);
|
|
3075
3154
|
}
|
|
3076
3155
|
//* Trigger the 'countrychange' event.
|
|
3077
3156
|
_triggerCountryChange() {
|
|
3078
3157
|
this._trigger("countrychange");
|
|
3079
3158
|
}
|
|
3080
|
-
//* Format the number as the user types.
|
|
3081
|
-
_formatNumberAsYouType() {
|
|
3082
|
-
const val = this._getFullNumber();
|
|
3083
|
-
const result = intlTelInput.utils ? intlTelInput.utils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val;
|
|
3084
|
-
const { dialCode } = this.selectedCountryData;
|
|
3085
|
-
if (this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
3086
|
-
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
3087
|
-
return afterDialCode.trim();
|
|
3088
|
-
}
|
|
3089
|
-
return result;
|
|
3090
|
-
}
|
|
3091
3159
|
//**************************
|
|
3092
3160
|
//* SECRET PUBLIC METHODS
|
|
3093
3161
|
//**************************
|
|
@@ -3239,6 +3307,9 @@ var Iti = class _Iti {
|
|
|
3239
3307
|
//* Update the selected country, and update the input val accordingly.
|
|
3240
3308
|
setCountry(iso2) {
|
|
3241
3309
|
const iso2Lower = iso2?.toLowerCase();
|
|
3310
|
+
if (!isIso2(iso2Lower)) {
|
|
3311
|
+
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
3312
|
+
}
|
|
3242
3313
|
const currentCountry = this.selectedCountryData.iso2;
|
|
3243
3314
|
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
3244
3315
|
if (isCountryChange) {
|
|
@@ -3326,7 +3397,7 @@ var intlTelInput = Object.assign(
|
|
|
3326
3397
|
attachUtils,
|
|
3327
3398
|
startedLoadingUtilsScript: false,
|
|
3328
3399
|
startedLoadingAutoCountry: false,
|
|
3329
|
-
version: "25.10.
|
|
3400
|
+
version: "25.10.8"
|
|
3330
3401
|
}
|
|
3331
3402
|
);
|
|
3332
3403
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -5075,12 +5146,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5075
5146
|
,
|
|
5076
5147
|
,
|
|
5077
5148
|
[9]
|
|
5078
|
-
], [, , "(?:
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
[
|
|
5083
|
-
], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
|
|
5149
|
+
], [, , "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"]], [
|
|
5150
|
+
,
|
|
5151
|
+
"(\\d{2})(\\d{3})(\\d{3})(\\d{3})",
|
|
5152
|
+
"$1 $2 $3 $4",
|
|
5153
|
+
["9"]
|
|
5154
|
+
], [, "(\\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"]],
|
|
5084
5155
|
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]], [
|
|
5085
5156
|
,
|
|
5086
5157
|
,
|
|
@@ -5101,6 +5172,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5101
5172
|
["3[02]|40|[68]9"],
|
|
5102
5173
|
"0$1"
|
|
5103
5174
|
],
|
|
5175
|
+
[, "(\\d{6})", "$1", ["227", "2277"]],
|
|
5104
5176
|
[, "(\\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"],
|
|
5105
5177
|
[
|
|
5106
5178
|
,
|
|
@@ -5124,7 +5196,38 @@ var intl_tel_input_default = intlTelInput;
|
|
|
5124
5196
|
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
5125
5197
|
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
5126
5198
|
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
5127
|
-
],
|
|
5199
|
+
], [
|
|
5200
|
+
[, "(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"],
|
|
5201
|
+
[
|
|
5202
|
+
,
|
|
5203
|
+
"(\\d{3})(\\d{3,12})",
|
|
5204
|
+
"$1 $2",
|
|
5205
|
+
["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"],
|
|
5206
|
+
"0$1"
|
|
5207
|
+
],
|
|
5208
|
+
[
|
|
5209
|
+
,
|
|
5210
|
+
"(\\d{4})(\\d{2,11})",
|
|
5211
|
+
"$1 $2",
|
|
5212
|
+
["[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]"],
|
|
5213
|
+
"0$1"
|
|
5214
|
+
],
|
|
5215
|
+
[, "(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"],
|
|
5216
|
+
[, "(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"],
|
|
5217
|
+
[, "(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"],
|
|
5218
|
+
[, "(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"],
|
|
5219
|
+
[, "(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"],
|
|
5220
|
+
[, "(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"],
|
|
5221
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"],
|
|
5222
|
+
[, "(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"],
|
|
5223
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"],
|
|
5224
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"],
|
|
5225
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"],
|
|
5226
|
+
[, "(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"],
|
|
5227
|
+
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
5228
|
+
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
5229
|
+
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
5230
|
+
], [, , "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]], , , [
|
|
5128
5231
|
,
|
|
5129
5232
|
,
|
|
5130
5233
|
"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}",
|
|
@@ -6222,17 +6325,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6222
6325
|
,
|
|
6223
6326
|
[7]
|
|
6224
6327
|
], [, , , , , , , , , [-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]]],
|
|
6225
|
-
IT: [, [, , "0\\d{5,
|
|
6226
|
-
,
|
|
6227
|
-
,
|
|
6228
|
-
"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}",
|
|
6328
|
+
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]], [
|
|
6229
6329
|
,
|
|
6230
6330
|
,
|
|
6331
|
+
"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}",
|
|
6231
6332
|
,
|
|
6232
|
-
"0212345678",
|
|
6233
6333
|
,
|
|
6234
6334
|
,
|
|
6235
|
-
|
|
6335
|
+
"0212345678"
|
|
6236
6336
|
], [, , "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", , , , , , , , [
|
|
6237
6337
|
[, "(\\d{4,5})", "$1", ["1(?:0|9[246])", "1(?:0|9(?:2[2-9]|[46]))"]],
|
|
6238
6338
|
[, "(\\d{6})", "$1", ["1(?:1|92)"]],
|
|
@@ -6245,13 +6345,13 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6245
6345
|
[, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]],
|
|
6246
6346
|
[, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]],
|
|
6247
6347
|
[, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]],
|
|
6248
|
-
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["
|
|
6348
|
+
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]
|
|
6249
6349
|
], [[, "(\\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"]], [
|
|
6250
6350
|
,
|
|
6251
6351
|
"(\\d{3})(\\d{3})(\\d{3,4})",
|
|
6252
6352
|
"$1 $2 $3",
|
|
6253
6353
|
["1(?:44|[679])|[378]|43"]
|
|
6254
|
-
], [, "(\\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", ["
|
|
6354
|
+
], [, "(\\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]]],
|
|
6255
6355
|
JE: [, [, , "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", , , , , , , [10], [6]], [, , "1534[0-24-8]\\d{5}", , , , "1534456789", , , , [6]], [
|
|
6256
6356
|
,
|
|
6257
6357
|
,
|
|
@@ -6634,7 +6734,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6634
6734
|
,
|
|
6635
6735
|
"5002345678"
|
|
6636
6736
|
], [, , , , , , , , , [-1]], "LC", 1, "011", "1", , , "([2-8]\\d{6})$|1", "758$1", , , , , [, , , , , , , , , [-1]], , "758", [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6637
|
-
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
|
|
6737
|
+
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"], [
|
|
6638
6738
|
,
|
|
6639
6739
|
,
|
|
6640
6740
|
"90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",
|
|
@@ -6743,7 +6843,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6743
6843
|
,
|
|
6744
6844
|
"$CC $1"
|
|
6745
6845
|
], [, "(\\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]]],
|
|
6746
|
-
LV: [, [, , "(?:[268]\\d|90)\\d{6}", , , , , , , [8]], [
|
|
6846
|
+
LV: [, [, , "(?:[268]\\d|78|90)\\d{6}", , , , , , , [8]], [
|
|
6747
6847
|
,
|
|
6748
6848
|
,
|
|
6749
6849
|
"6\\d{7}",
|
|
@@ -6751,7 +6851,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6751
6851
|
,
|
|
6752
6852
|
,
|
|
6753
6853
|
"63123456"
|
|
6754
|
-
], [, , "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", ["[
|
|
6854
|
+
], [, , "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]]],
|
|
6755
6855
|
LY: [, [, , "[2-9]\\d{8}", , , , , , , [9], [7]], [
|
|
6756
6856
|
,
|
|
6757
6857
|
,
|
|
@@ -6813,7 +6913,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6813
6913
|
,
|
|
6814
6914
|
[8],
|
|
6815
6915
|
[6]
|
|
6816
|
-
], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "
|
|
6916
|
+
], [, , "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]]],
|
|
6817
6917
|
MF: [
|
|
6818
6918
|
,
|
|
6819
6919
|
[, , "(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}", , , , , , , [9]],
|
|
@@ -7901,7 +8001,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
7901
8001
|
,
|
|
7902
8002
|
,
|
|
7903
8003
|
[8]
|
|
7904
|
-
], [, , "
|
|
8004
|
+
], [, , "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"]], [
|
|
7905
8005
|
,
|
|
7906
8006
|
"(\\d{4})(\\d{4})(\\d{3})",
|
|
7907
8007
|
"$1 $2 $3",
|
|
@@ -8479,7 +8579,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8479
8579
|
], [
|
|
8480
8580
|
,
|
|
8481
8581
|
,
|
|
8482
|
-
"(?: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-
|
|
8582
|
+
"(?: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}",
|
|
8483
8583
|
,
|
|
8484
8584
|
,
|
|
8485
8585
|
,
|
|
@@ -8491,7 +8591,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8491
8591
|
], [
|
|
8492
8592
|
,
|
|
8493
8593
|
,
|
|
8494
|
-
"(?: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-
|
|
8594
|
+
"(?: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}",
|
|
8495
8595
|
,
|
|
8496
8596
|
,
|
|
8497
8597
|
,
|