intl-tel-input 25.10.6 → 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 +415 -316
- package/angular/build/IntlTelInputWithUtils.js +466 -338
- 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 +17 -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 +100 -292
- package/build/js/intlTelInput.js +461 -357
- package/build/js/intlTelInput.min.js +13 -13
- package/build/js/intlTelInputWithUtils.js +512 -379
- 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 +460 -356
- package/react/build/IntlTelInput.d.ts +104 -294
- package/react/build/IntlTelInput.js +460 -356
- package/react/build/IntlTelInputWithUtils.cjs +511 -378
- package/react/build/IntlTelInputWithUtils.js +511 -378
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +506 -452
- package/vue/build/IntlTelInputWithUtils.mjs +1096 -1013
|
@@ -1606,11 +1606,7 @@ var interface_default = interfaceTranslations;
|
|
|
1606
1606
|
var allTranslations = Object.assign(Object.assign({}, countries_default), interface_default);
|
|
1607
1607
|
var en_default = allTranslations;
|
|
1608
1608
|
|
|
1609
|
-
// angular/build/temp/
|
|
1610
|
-
for (const c of data_default) {
|
|
1611
|
-
c.name = en_default[c.iso2];
|
|
1612
|
-
}
|
|
1613
|
-
var id = 0;
|
|
1609
|
+
// angular/build/temp/modules/core/options.js
|
|
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 = Object.assign(Object.assign({}, en_default), o.i18n);
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// angular/build/temp/modules/utils/string.js
|
|
1695
|
+
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
1696
|
+
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1697
|
+
|
|
1698
|
+
// angular/build/temp/modules/utils/dom.js
|
|
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
|
+
// angular/build/temp/modules/data/country-data.js
|
|
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
|
+
// angular/build/temp/modules/format/formatting.js
|
|
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
|
+
// angular/build/temp/modules/format/caret.js
|
|
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
|
+
// angular/build/temp/modules/data/nanp-regionless.js
|
|
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
|
+
// angular/build/temp/intl-tel-input.js
|
|
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,122 +1943,34 @@ 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((country) => country.toLowerCase());
|
|
1866
|
-
this.countries = data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
|
|
1867
|
-
} else if (excludeCountries.length) {
|
|
1868
|
-
const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
|
|
1869
|
-
this.countries = data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
|
|
1870
|
-
} else {
|
|
1871
|
-
this.countries = data_default;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
//* Translate Countries by object literal provided on config.
|
|
1875
|
-
_translateCountryNames() {
|
|
1876
|
-
for (const c of this.countries) {
|
|
1877
|
-
const iso2 = c.iso2.toLowerCase();
|
|
1878
|
-
if (this.options.i18n.hasOwnProperty(iso2)) {
|
|
1879
|
-
c.name = this.options.i18n[iso2];
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1884
|
-
_processDialCodes() {
|
|
1885
|
-
this.dialCodes = /* @__PURE__ */ new Set();
|
|
1886
|
-
this.dialCodeMaxLen = 0;
|
|
1887
|
-
this.dialCodeToIso2Map = {};
|
|
1888
|
-
for (const c of this.countries) {
|
|
1889
|
-
if (!this.dialCodes.has(c.dialCode)) {
|
|
1890
|
-
this.dialCodes.add(c.dialCode);
|
|
1891
|
-
}
|
|
1892
|
-
this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
|
|
1893
|
-
}
|
|
1894
|
-
if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
|
|
1895
|
-
this.dialCodes.forEach((dialCode) => {
|
|
1896
|
-
this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
|
|
1897
|
-
});
|
|
1898
|
-
}
|
|
1899
|
-
for (const c of this.countries) {
|
|
1900
|
-
if (c.areaCodes) {
|
|
1901
|
-
const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
|
|
1902
|
-
for (const areaCode of c.areaCodes) {
|
|
1903
|
-
for (let k = 1; k < areaCode.length; k++) {
|
|
1904
|
-
const partialAreaCode = areaCode.substring(0, k);
|
|
1905
|
-
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1906
|
-
this._addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1907
|
-
this._addToDialCodeMap(c.iso2, partialDialCode);
|
|
1908
|
-
}
|
|
1909
|
-
this._addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1954
|
+
cacheSearchTokens(this.countries);
|
|
1913
1955
|
}
|
|
1914
1956
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1915
1957
|
_generateMarkup() {
|
|
1916
|
-
|
|
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() {
|
|
1917
1966
|
this.telInput.classList.add("iti__tel-input");
|
|
1918
1967
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
1919
1968
|
this.telInput.setAttribute("autocomplete", "off");
|
|
1920
1969
|
}
|
|
1921
|
-
|
|
1970
|
+
}
|
|
1971
|
+
_createWrapperAndInsert() {
|
|
1972
|
+
var _a;
|
|
1973
|
+
const { allowDropdown, showFlags, containerClass, useFullscreenPopup } = this.options;
|
|
1922
1974
|
const parentClasses = _Iti._buildClassNames({
|
|
1923
1975
|
"iti": true,
|
|
1924
1976
|
"iti--allow-dropdown": allowDropdown,
|
|
@@ -1928,6 +1980,10 @@ var Iti = class _Iti {
|
|
|
1928
1980
|
});
|
|
1929
1981
|
const wrapper = createEl("div", { class: parentClasses });
|
|
1930
1982
|
(_a = this.telInput.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(wrapper, this.telInput);
|
|
1983
|
+
return wrapper;
|
|
1984
|
+
}
|
|
1985
|
+
_maybeBuildCountryContainer(wrapper) {
|
|
1986
|
+
const { allowDropdown, separateDialCode, showFlags } = this.options;
|
|
1931
1987
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1932
1988
|
this.countryContainer = createEl(
|
|
1933
1989
|
"div",
|
|
@@ -1964,96 +2020,109 @@ var Iti = class _Iti {
|
|
|
1964
2020
|
this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", dir: "ltr" }, this.selectedCountry);
|
|
1965
2021
|
}
|
|
1966
2022
|
if (allowDropdown) {
|
|
1967
|
-
|
|
1968
|
-
this.dropdownContent = createEl("div", {
|
|
1969
|
-
id: `iti-${this.id}__dropdown-content`,
|
|
1970
|
-
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
1971
|
-
role: "dialog",
|
|
1972
|
-
"aria-modal": "true"
|
|
1973
|
-
});
|
|
1974
|
-
if (countrySearch) {
|
|
1975
|
-
const searchWrapper = createEl("div", { class: "iti__search-input-wrapper" }, this.dropdownContent);
|
|
1976
|
-
this.searchIcon = createEl("span", {
|
|
1977
|
-
class: "iti__search-icon",
|
|
1978
|
-
"aria-hidden": "true"
|
|
1979
|
-
}, searchWrapper);
|
|
1980
|
-
this.searchIcon.innerHTML = `
|
|
1981
|
-
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
1982
|
-
<circle cx="11" cy="11" r="7" />
|
|
1983
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1984
|
-
</svg>`;
|
|
1985
|
-
this.searchInput = createEl("input", {
|
|
1986
|
-
id: `iti-${this.id}__search-input`,
|
|
1987
|
-
// Chrome says inputs need either a name or an id
|
|
1988
|
-
type: "search",
|
|
1989
|
-
class: "iti__search-input",
|
|
1990
|
-
placeholder: i18n.searchPlaceholder,
|
|
1991
|
-
// 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
|
|
1992
|
-
role: "combobox",
|
|
1993
|
-
"aria-expanded": "true",
|
|
1994
|
-
"aria-label": i18n.searchPlaceholder,
|
|
1995
|
-
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1996
|
-
"aria-autocomplete": "list",
|
|
1997
|
-
"autocomplete": "off"
|
|
1998
|
-
}, searchWrapper);
|
|
1999
|
-
this.searchClearButton = createEl("button", {
|
|
2000
|
-
type: "button",
|
|
2001
|
-
class: "iti__search-clear iti__hide",
|
|
2002
|
-
"aria-label": i18n.clearSearchAriaLabel,
|
|
2003
|
-
tabindex: "-1"
|
|
2004
|
-
}, searchWrapper);
|
|
2005
|
-
const maskId = `iti-${this.id}-clear-mask`;
|
|
2006
|
-
this.searchClearButton.innerHTML = `
|
|
2007
|
-
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2008
|
-
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2009
|
-
<rect width="16" height="16" fill="white" />
|
|
2010
|
-
<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" />
|
|
2011
|
-
</mask>
|
|
2012
|
-
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2013
|
-
</svg>`;
|
|
2014
|
-
this.searchResultsA11yText = createEl("span", { class: "iti__a11y-text" }, this.dropdownContent);
|
|
2015
|
-
this.searchNoResults = createEl("div", {
|
|
2016
|
-
class: "iti__no-results iti__hide",
|
|
2017
|
-
"aria-hidden": "true"
|
|
2018
|
-
// all a11y messaging happens in this.searchResultsA11yText
|
|
2019
|
-
}, this.dropdownContent);
|
|
2020
|
-
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2021
|
-
}
|
|
2022
|
-
this.countryList = createEl("ul", {
|
|
2023
|
-
class: "iti__country-list",
|
|
2024
|
-
id: `iti-${this.id}__country-listbox`,
|
|
2025
|
-
role: "listbox",
|
|
2026
|
-
"aria-label": i18n.countryListAriaLabel
|
|
2027
|
-
}, this.dropdownContent);
|
|
2028
|
-
this._appendListItems();
|
|
2029
|
-
if (countrySearch) {
|
|
2030
|
-
this._updateSearchResultsA11yText();
|
|
2031
|
-
}
|
|
2032
|
-
if (dropdownContainer) {
|
|
2033
|
-
const dropdownClasses = _Iti._buildClassNames({
|
|
2034
|
-
"iti": true,
|
|
2035
|
-
"iti--container": true,
|
|
2036
|
-
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2037
|
-
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2038
|
-
[containerClass]: Boolean(containerClass)
|
|
2039
|
-
});
|
|
2040
|
-
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2041
|
-
this.dropdown.appendChild(this.dropdownContent);
|
|
2042
|
-
} else {
|
|
2043
|
-
this.countryContainer.appendChild(this.dropdownContent);
|
|
2044
|
-
}
|
|
2023
|
+
this._buildDropdownContent();
|
|
2045
2024
|
}
|
|
2046
2025
|
}
|
|
2047
|
-
|
|
2026
|
+
}
|
|
2027
|
+
_buildDropdownContent() {
|
|
2028
|
+
const { fixDropdownWidth, useFullscreenPopup, countrySearch, i18n, dropdownContainer, containerClass } = this.options;
|
|
2029
|
+
const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
2030
|
+
this.dropdownContent = createEl("div", {
|
|
2031
|
+
id: `iti-${this.id}__dropdown-content`,
|
|
2032
|
+
class: `iti__dropdown-content iti__hide ${extraClasses}`,
|
|
2033
|
+
role: "dialog",
|
|
2034
|
+
"aria-modal": "true"
|
|
2035
|
+
});
|
|
2036
|
+
if (countrySearch) {
|
|
2037
|
+
this._buildSearchUI();
|
|
2038
|
+
}
|
|
2039
|
+
this.countryList = createEl("ul", {
|
|
2040
|
+
class: "iti__country-list",
|
|
2041
|
+
id: `iti-${this.id}__country-listbox`,
|
|
2042
|
+
role: "listbox",
|
|
2043
|
+
"aria-label": i18n.countryListAriaLabel
|
|
2044
|
+
}, this.dropdownContent);
|
|
2045
|
+
this._appendListItems();
|
|
2046
|
+
if (countrySearch) {
|
|
2047
|
+
this._updateSearchResultsA11yText();
|
|
2048
|
+
}
|
|
2049
|
+
if (dropdownContainer) {
|
|
2050
|
+
const dropdownClasses = _Iti._buildClassNames({
|
|
2051
|
+
"iti": true,
|
|
2052
|
+
"iti--container": true,
|
|
2053
|
+
"iti--fullscreen-popup": useFullscreenPopup,
|
|
2054
|
+
"iti--inline-dropdown": !useFullscreenPopup,
|
|
2055
|
+
[containerClass]: Boolean(containerClass)
|
|
2056
|
+
});
|
|
2057
|
+
this.dropdown = createEl("div", { class: dropdownClasses });
|
|
2058
|
+
this.dropdown.appendChild(this.dropdownContent);
|
|
2059
|
+
} else {
|
|
2060
|
+
this.countryContainer.appendChild(this.dropdownContent);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
_buildSearchUI() {
|
|
2064
|
+
const { i18n } = this.options;
|
|
2065
|
+
const searchWrapper = createEl("div", { class: "iti__search-input-wrapper" }, this.dropdownContent);
|
|
2066
|
+
this.searchIcon = createEl("span", {
|
|
2067
|
+
class: "iti__search-icon",
|
|
2068
|
+
"aria-hidden": "true"
|
|
2069
|
+
}, searchWrapper);
|
|
2070
|
+
this.searchIcon.innerHTML = `
|
|
2071
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2072
|
+
<circle cx="11" cy="11" r="7" />
|
|
2073
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2074
|
+
</svg>`;
|
|
2075
|
+
this.searchInput = createEl("input", {
|
|
2076
|
+
id: `iti-${this.id}__search-input`,
|
|
2077
|
+
// Chrome says inputs need either a name or an id
|
|
2078
|
+
type: "search",
|
|
2079
|
+
class: "iti__search-input",
|
|
2080
|
+
placeholder: i18n.searchPlaceholder,
|
|
2081
|
+
// 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
|
|
2082
|
+
role: "combobox",
|
|
2083
|
+
"aria-expanded": "true",
|
|
2084
|
+
"aria-label": i18n.searchPlaceholder,
|
|
2085
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
2086
|
+
"aria-autocomplete": "list",
|
|
2087
|
+
"autocomplete": "off"
|
|
2088
|
+
}, searchWrapper);
|
|
2089
|
+
this.searchClearButton = createEl("button", {
|
|
2090
|
+
type: "button",
|
|
2091
|
+
class: "iti__search-clear iti__hide",
|
|
2092
|
+
"aria-label": i18n.clearSearchAriaLabel,
|
|
2093
|
+
tabindex: "-1"
|
|
2094
|
+
}, searchWrapper);
|
|
2095
|
+
const maskId = `iti-${this.id}-clear-mask`;
|
|
2096
|
+
this.searchClearButton.innerHTML = `
|
|
2097
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2098
|
+
<mask id="${maskId}" maskUnits="userSpaceOnUse">
|
|
2099
|
+
<rect width="16" height="16" fill="white" />
|
|
2100
|
+
<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" />
|
|
2101
|
+
</mask>
|
|
2102
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
|
|
2103
|
+
</svg>`;
|
|
2104
|
+
this.searchResultsA11yText = createEl("span", { class: "iti__a11y-text" }, this.dropdownContent);
|
|
2105
|
+
this.searchNoResults = createEl("div", {
|
|
2106
|
+
class: "iti__no-results iti__hide",
|
|
2107
|
+
"aria-hidden": "true"
|
|
2108
|
+
// all a11y messaging happens in this.searchResultsA11yText
|
|
2109
|
+
}, this.dropdownContent);
|
|
2110
|
+
this.searchNoResults.textContent = i18n.zeroSearchResults;
|
|
2111
|
+
}
|
|
2112
|
+
_maybeUpdateInputPaddingAndReveal() {
|
|
2048
2113
|
if (this.countryContainer) {
|
|
2049
2114
|
this._updateInputPadding();
|
|
2050
2115
|
this.countryContainer.classList.remove("iti__v-hide");
|
|
2051
2116
|
}
|
|
2117
|
+
}
|
|
2118
|
+
_maybeBuildHiddenInputs(wrapper) {
|
|
2119
|
+
var _a, _b;
|
|
2120
|
+
const { hiddenInput } = this.options;
|
|
2052
2121
|
if (hiddenInput) {
|
|
2053
2122
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2054
2123
|
const names = hiddenInput(telInputName);
|
|
2055
2124
|
if (names.phone) {
|
|
2056
|
-
const existingInput = (
|
|
2125
|
+
const existingInput = (_a = this.telInput.form) === null || _a === void 0 ? void 0 : _a.querySelector(`input[name="${names.phone}"]`);
|
|
2057
2126
|
if (existingInput) {
|
|
2058
2127
|
this.hiddenInput = existingInput;
|
|
2059
2128
|
} else {
|
|
@@ -2065,7 +2134,7 @@ var Iti = class _Iti {
|
|
|
2065
2134
|
}
|
|
2066
2135
|
}
|
|
2067
2136
|
if (names.country) {
|
|
2068
|
-
const existingInput = (
|
|
2137
|
+
const existingInput = (_b = this.telInput.form) === null || _b === void 0 ? void 0 : _b.querySelector(`input[name="${names.country}"]`);
|
|
2069
2138
|
if (existingInput) {
|
|
2070
2139
|
this.hiddenInputCountry = existingInput;
|
|
2071
2140
|
} else {
|
|
@@ -2118,14 +2187,13 @@ var Iti = class _Iti {
|
|
|
2118
2187
|
this._updateCountryFromNumber(val);
|
|
2119
2188
|
} else if (!isAutoCountry || overrideAutoCountry) {
|
|
2120
2189
|
const lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : "";
|
|
2121
|
-
|
|
2122
|
-
if (isValidInitialCountry) {
|
|
2190
|
+
if (isIso2(lowerInitialCountry)) {
|
|
2123
2191
|
this._setCountry(lowerInitialCountry);
|
|
2124
2192
|
} else {
|
|
2125
2193
|
if (dialCode && isRegionlessNanpNumber) {
|
|
2126
2194
|
this._setCountry("us");
|
|
2127
2195
|
} else {
|
|
2128
|
-
this._setCountry();
|
|
2196
|
+
this._setCountry("");
|
|
2129
2197
|
}
|
|
2130
2198
|
}
|
|
2131
2199
|
}
|
|
@@ -2223,8 +2291,7 @@ var Iti = class _Iti {
|
|
|
2223
2291
|
if (typeof this.options.geoIpLookup === "function") {
|
|
2224
2292
|
this.options.geoIpLookup((iso2 = "") => {
|
|
2225
2293
|
const iso2Lower = iso2.toLowerCase();
|
|
2226
|
-
|
|
2227
|
-
if (isValidIso2) {
|
|
2294
|
+
if (isIso2(iso2Lower)) {
|
|
2228
2295
|
intlTelInput.autoCountry = iso2Lower;
|
|
2229
2296
|
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2230
2297
|
} else {
|
|
@@ -2245,6 +2312,11 @@ var Iti = class _Iti {
|
|
|
2245
2312
|
}
|
|
2246
2313
|
//* Initialize the tel input listeners.
|
|
2247
2314
|
_initTelInputListeners() {
|
|
2315
|
+
this._bindInputListener();
|
|
2316
|
+
this._maybeBindKeydownListener();
|
|
2317
|
+
this._maybeBindPasteListener();
|
|
2318
|
+
}
|
|
2319
|
+
_bindInputListener() {
|
|
2248
2320
|
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2249
2321
|
let userOverrideFormatting = false;
|
|
2250
2322
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
@@ -2275,13 +2347,17 @@ var Iti = class _Iti {
|
|
|
2275
2347
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2276
2348
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
2277
2349
|
const isDeleteForwards = (e === null || e === void 0 ? void 0 : e.inputType) === "deleteContentForward";
|
|
2278
|
-
const
|
|
2350
|
+
const fullNumber = this._getFullNumber();
|
|
2351
|
+
const formattedValue = formatNumberAsYouType(fullNumber, this.telInput.value, intlTelInput.utils, this.selectedCountryData, this.options.separateDialCode);
|
|
2279
2352
|
const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
|
|
2280
2353
|
this.telInput.value = formattedValue;
|
|
2281
2354
|
this.telInput.setSelectionRange(newCaretPos, newCaretPos);
|
|
2282
2355
|
}
|
|
2283
2356
|
};
|
|
2284
2357
|
this.telInput.addEventListener("input", this._handleInputEvent);
|
|
2358
|
+
}
|
|
2359
|
+
_maybeBindKeydownListener() {
|
|
2360
|
+
const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2285
2361
|
if (strictMode || separateDialCode) {
|
|
2286
2362
|
this._handleKeydownEvent = (e) => {
|
|
2287
2363
|
if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
@@ -2311,6 +2387,48 @@ var Iti = class _Iti {
|
|
|
2311
2387
|
this.telInput.addEventListener("keydown", this._handleKeydownEvent);
|
|
2312
2388
|
}
|
|
2313
2389
|
}
|
|
2390
|
+
_maybeBindPasteListener() {
|
|
2391
|
+
if (this.options.strictMode) {
|
|
2392
|
+
this._handlePasteEvent = (e) => {
|
|
2393
|
+
e.preventDefault();
|
|
2394
|
+
const input = this.telInput;
|
|
2395
|
+
const selStart = input.selectionStart;
|
|
2396
|
+
const selEnd = input.selectionEnd;
|
|
2397
|
+
const before = input.value.slice(0, selStart);
|
|
2398
|
+
const after = input.value.slice(selEnd);
|
|
2399
|
+
const iso2 = this.selectedCountryData.iso2;
|
|
2400
|
+
const pasted = e.clipboardData.getData("text");
|
|
2401
|
+
const initialCharSelected = selStart === 0 && selEnd > 0;
|
|
2402
|
+
const allowLeadingPlus = !input.value.startsWith("+") || initialCharSelected;
|
|
2403
|
+
const allowedChars = pasted.replace(/[^0-9+]/g, "");
|
|
2404
|
+
const hasLeadingPlus = allowedChars.startsWith("+");
|
|
2405
|
+
const numerics = allowedChars.replace(/\+/g, "");
|
|
2406
|
+
const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
|
|
2407
|
+
let newVal = before + sanitised + after;
|
|
2408
|
+
let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2409
|
+
while (coreNumber.length === 0 && newVal.length > 0) {
|
|
2410
|
+
newVal = newVal.slice(0, -1);
|
|
2411
|
+
coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
2412
|
+
}
|
|
2413
|
+
if (!coreNumber) {
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
if (this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength) {
|
|
2417
|
+
if (input.selectionEnd === input.value.length) {
|
|
2418
|
+
const trimLength = coreNumber.length - this.maxCoreNumberLength;
|
|
2419
|
+
newVal = newVal.slice(0, newVal.length - trimLength);
|
|
2420
|
+
} else {
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
input.value = newVal;
|
|
2425
|
+
const caretPos = selStart + sanitised.length;
|
|
2426
|
+
input.setSelectionRange(caretPos, caretPos);
|
|
2427
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true }));
|
|
2428
|
+
};
|
|
2429
|
+
this.telInput.addEventListener("paste", this._handlePasteEvent);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2314
2432
|
//* Adhere to the input's maxlength attr.
|
|
2315
2433
|
_cap(number) {
|
|
2316
2434
|
const max = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
@@ -2460,43 +2578,14 @@ var Iti = class _Iti {
|
|
|
2460
2578
|
}
|
|
2461
2579
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2462
2580
|
_filterCountries(query) {
|
|
2463
|
-
let noCountriesAddedYet = true;
|
|
2464
2581
|
this.countryList.innerHTML = "";
|
|
2465
|
-
const normalisedQuery = normaliseString(query);
|
|
2466
2582
|
let matchedCountries;
|
|
2467
2583
|
if (query === "") {
|
|
2468
2584
|
matchedCountries = this.countries;
|
|
2469
2585
|
} else {
|
|
2470
|
-
|
|
2471
|
-
const nameStartWith = [];
|
|
2472
|
-
const nameContains = [];
|
|
2473
|
-
const dialCodeMatches = [];
|
|
2474
|
-
const dialCodeContains = [];
|
|
2475
|
-
const initialsMatches = [];
|
|
2476
|
-
for (const c of this.countries) {
|
|
2477
|
-
if (c.iso2 === normalisedQuery) {
|
|
2478
|
-
iso2Matches.push(c);
|
|
2479
|
-
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2480
|
-
nameStartWith.push(c);
|
|
2481
|
-
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2482
|
-
nameContains.push(c);
|
|
2483
|
-
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2484
|
-
dialCodeMatches.push(c);
|
|
2485
|
-
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2486
|
-
dialCodeContains.push(c);
|
|
2487
|
-
} else if (c.initials.includes(normalisedQuery)) {
|
|
2488
|
-
initialsMatches.push(c);
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
matchedCountries = [
|
|
2492
|
-
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2493
|
-
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2494
|
-
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2495
|
-
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2496
|
-
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2497
|
-
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2498
|
-
];
|
|
2586
|
+
matchedCountries = this._getMatchedCountries(query);
|
|
2499
2587
|
}
|
|
2588
|
+
let noCountriesAddedYet = true;
|
|
2500
2589
|
for (const c of matchedCountries) {
|
|
2501
2590
|
const listItem = c.nodeById[this.id];
|
|
2502
2591
|
if (listItem) {
|
|
@@ -2518,6 +2607,38 @@ var Iti = class _Iti {
|
|
|
2518
2607
|
this.countryList.scrollTop = 0;
|
|
2519
2608
|
this._updateSearchResultsA11yText();
|
|
2520
2609
|
}
|
|
2610
|
+
_getMatchedCountries(query) {
|
|
2611
|
+
const normalisedQuery = normaliseString(query);
|
|
2612
|
+
const iso2Matches = [];
|
|
2613
|
+
const nameStartWith = [];
|
|
2614
|
+
const nameContains = [];
|
|
2615
|
+
const dialCodeMatches = [];
|
|
2616
|
+
const dialCodeContains = [];
|
|
2617
|
+
const initialsMatches = [];
|
|
2618
|
+
for (const c of this.countries) {
|
|
2619
|
+
if (c.iso2 === normalisedQuery) {
|
|
2620
|
+
iso2Matches.push(c);
|
|
2621
|
+
} else if (c.normalisedName.startsWith(normalisedQuery)) {
|
|
2622
|
+
nameStartWith.push(c);
|
|
2623
|
+
} else if (c.normalisedName.includes(normalisedQuery)) {
|
|
2624
|
+
nameContains.push(c);
|
|
2625
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
|
|
2626
|
+
dialCodeMatches.push(c);
|
|
2627
|
+
} else if (c.dialCodePlus.includes(normalisedQuery)) {
|
|
2628
|
+
dialCodeContains.push(c);
|
|
2629
|
+
} else if (c.initials.includes(normalisedQuery)) {
|
|
2630
|
+
initialsMatches.push(c);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
return [
|
|
2634
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2635
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2636
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2637
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2638
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2639
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2640
|
+
];
|
|
2641
|
+
}
|
|
2521
2642
|
//* Update search results text (for a11y).
|
|
2522
2643
|
_updateSearchResultsA11yText() {
|
|
2523
2644
|
const { i18n } = this.options;
|
|
@@ -2645,24 +2766,12 @@ var Iti = class _Iti {
|
|
|
2645
2766
|
this.highlightedItem.focus();
|
|
2646
2767
|
}
|
|
2647
2768
|
}
|
|
2648
|
-
//* Find the country data for the given iso2 code
|
|
2649
|
-
//* 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
|
|
2650
|
-
_getCountryData(iso2, allowFail) {
|
|
2651
|
-
const country = this.countryByIso2.get(iso2);
|
|
2652
|
-
if (country) {
|
|
2653
|
-
return country;
|
|
2654
|
-
}
|
|
2655
|
-
if (allowFail) {
|
|
2656
|
-
return null;
|
|
2657
|
-
}
|
|
2658
|
-
throw new Error(`No country data for '${iso2}'`);
|
|
2659
|
-
}
|
|
2660
2769
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2661
2770
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2662
2771
|
_setCountry(iso2) {
|
|
2663
2772
|
const { separateDialCode, showFlags, i18n } = this.options;
|
|
2664
2773
|
const prevIso2 = this.selectedCountryData.iso2 || "";
|
|
2665
|
-
this.selectedCountryData = iso2 ? this.
|
|
2774
|
+
this.selectedCountryData = iso2 ? this.countryByIso2.get(iso2) : {};
|
|
2666
2775
|
if (this.selectedCountryData.iso2) {
|
|
2667
2776
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2668
2777
|
}
|
|
@@ -2767,9 +2876,11 @@ var Iti = class _Iti {
|
|
|
2767
2876
|
}
|
|
2768
2877
|
//* Called when the user selects a list item from the dropdown.
|
|
2769
2878
|
_selectListItem(listItem) {
|
|
2770
|
-
const
|
|
2879
|
+
const iso2 = listItem.getAttribute("data-country-code");
|
|
2880
|
+
const countryChanged = this._setCountry(iso2);
|
|
2771
2881
|
this._closeDropdown();
|
|
2772
|
-
|
|
2882
|
+
const dialCode = listItem.getAttribute("data-dial-code");
|
|
2883
|
+
this._updateDialCode(dialCode);
|
|
2773
2884
|
if (this.options.formatOnDisplay) {
|
|
2774
2885
|
this._updateValFromNumber(this.telInput.value);
|
|
2775
2886
|
}
|
|
@@ -2886,32 +2997,14 @@ var Iti = class _Iti {
|
|
|
2886
2997
|
}
|
|
2887
2998
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2888
2999
|
_beforeSetNumber(fullNumber) {
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
let dialCode = this._getDialCode(number);
|
|
2892
|
-
if (dialCode) {
|
|
2893
|
-
dialCode = `+${this.selectedCountryData.dialCode}`;
|
|
2894
|
-
const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
|
|
2895
|
-
number = number.substring(start);
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
3000
|
+
const dialCode = this._getDialCode(fullNumber);
|
|
3001
|
+
const number = beforeSetNumber(fullNumber, dialCode, this.options.separateDialCode, this.selectedCountryData);
|
|
2898
3002
|
return this._cap(number);
|
|
2899
3003
|
}
|
|
2900
3004
|
//* Trigger the 'countrychange' event.
|
|
2901
3005
|
_triggerCountryChange() {
|
|
2902
3006
|
this._trigger("countrychange");
|
|
2903
3007
|
}
|
|
2904
|
-
//* Format the number as the user types.
|
|
2905
|
-
_formatNumberAsYouType() {
|
|
2906
|
-
const val = this._getFullNumber();
|
|
2907
|
-
const result = intlTelInput.utils ? intlTelInput.utils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val;
|
|
2908
|
-
const { dialCode } = this.selectedCountryData;
|
|
2909
|
-
if (this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
2910
|
-
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
2911
|
-
return afterDialCode.trim();
|
|
2912
|
-
}
|
|
2913
|
-
return result;
|
|
2914
|
-
}
|
|
2915
3008
|
//**************************
|
|
2916
3009
|
//* SECRET PUBLIC METHODS
|
|
2917
3010
|
//**************************
|
|
@@ -2964,6 +3057,9 @@ var Iti = class _Iti {
|
|
|
2964
3057
|
if (this._handleKeydownEvent) {
|
|
2965
3058
|
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
|
|
2966
3059
|
}
|
|
3060
|
+
if (this._handlePasteEvent) {
|
|
3061
|
+
this.telInput.removeEventListener("paste", this._handlePasteEvent);
|
|
3062
|
+
}
|
|
2967
3063
|
this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
2968
3064
|
if (separateDialCode) {
|
|
2969
3065
|
if (this.isRTL) {
|
|
@@ -3045,6 +3141,9 @@ var Iti = class _Iti {
|
|
|
3045
3141
|
//* Update the selected country, and update the input val accordingly.
|
|
3046
3142
|
setCountry(iso2) {
|
|
3047
3143
|
const iso2Lower = iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase();
|
|
3144
|
+
if (!isIso2(iso2Lower)) {
|
|
3145
|
+
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
3146
|
+
}
|
|
3048
3147
|
const currentCountry = this.selectedCountryData.iso2;
|
|
3049
3148
|
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
3050
3149
|
if (isCountryChange) {
|
|
@@ -3130,7 +3229,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3130
3229
|
attachUtils,
|
|
3131
3230
|
startedLoadingUtilsScript: false,
|
|
3132
3231
|
startedLoadingAutoCountry: false,
|
|
3133
|
-
version: "25.10.
|
|
3232
|
+
version: "25.10.8"
|
|
3134
3233
|
});
|
|
3135
3234
|
var intl_tel_input_default = intlTelInput;
|
|
3136
3235
|
|
|
@@ -4905,12 +5004,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4905
5004
|
,
|
|
4906
5005
|
,
|
|
4907
5006
|
[9]
|
|
4908
|
-
], [, , "(?:
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
[
|
|
4913
|
-
], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
|
|
5007
|
+
], [, , "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"]], [
|
|
5008
|
+
,
|
|
5009
|
+
"(\\d{2})(\\d{3})(\\d{3})(\\d{3})",
|
|
5010
|
+
"$1 $2 $3 $4",
|
|
5011
|
+
["9"]
|
|
5012
|
+
], [, "(\\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"]],
|
|
4914
5013
|
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]], [
|
|
4915
5014
|
,
|
|
4916
5015
|
,
|
|
@@ -4931,6 +5030,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4931
5030
|
["3[02]|40|[68]9"],
|
|
4932
5031
|
"0$1"
|
|
4933
5032
|
],
|
|
5033
|
+
[, "(\\d{6})", "$1", ["227", "2277"]],
|
|
4934
5034
|
[, "(\\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"],
|
|
4935
5035
|
[
|
|
4936
5036
|
,
|
|
@@ -4954,7 +5054,38 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4954
5054
|
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
4955
5055
|
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
4956
5056
|
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
4957
|
-
],
|
|
5057
|
+
], [
|
|
5058
|
+
[, "(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"],
|
|
5059
|
+
[
|
|
5060
|
+
,
|
|
5061
|
+
"(\\d{3})(\\d{3,12})",
|
|
5062
|
+
"$1 $2",
|
|
5063
|
+
["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"],
|
|
5064
|
+
"0$1"
|
|
5065
|
+
],
|
|
5066
|
+
[
|
|
5067
|
+
,
|
|
5068
|
+
"(\\d{4})(\\d{2,11})",
|
|
5069
|
+
"$1 $2",
|
|
5070
|
+
["[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]"],
|
|
5071
|
+
"0$1"
|
|
5072
|
+
],
|
|
5073
|
+
[, "(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"],
|
|
5074
|
+
[, "(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"],
|
|
5075
|
+
[, "(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"],
|
|
5076
|
+
[, "(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"],
|
|
5077
|
+
[, "(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"],
|
|
5078
|
+
[, "(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"],
|
|
5079
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"],
|
|
5080
|
+
[, "(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"],
|
|
5081
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"],
|
|
5082
|
+
[, "(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"],
|
|
5083
|
+
[, "(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"],
|
|
5084
|
+
[, "(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"],
|
|
5085
|
+
[, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
|
|
5086
|
+
[, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
|
|
5087
|
+
[, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
|
|
5088
|
+
], [, , "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]], , , [
|
|
4958
5089
|
,
|
|
4959
5090
|
,
|
|
4960
5091
|
"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}",
|
|
@@ -6052,17 +6183,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6052
6183
|
,
|
|
6053
6184
|
[7]
|
|
6054
6185
|
], [, , , , , , , , , [-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]]],
|
|
6055
|
-
IT: [, [, , "0\\d{5,
|
|
6056
|
-
,
|
|
6057
|
-
,
|
|
6058
|
-
"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}",
|
|
6186
|
+
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]], [
|
|
6059
6187
|
,
|
|
6060
6188
|
,
|
|
6189
|
+
"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}",
|
|
6061
6190
|
,
|
|
6062
|
-
"0212345678",
|
|
6063
6191
|
,
|
|
6064
6192
|
,
|
|
6065
|
-
|
|
6193
|
+
"0212345678"
|
|
6066
6194
|
], [, , "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", , , , , , , , [
|
|
6067
6195
|
[, "(\\d{4,5})", "$1", ["1(?:0|9[246])", "1(?:0|9(?:2[2-9]|[46]))"]],
|
|
6068
6196
|
[, "(\\d{6})", "$1", ["1(?:1|92)"]],
|
|
@@ -6075,13 +6203,13 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6075
6203
|
[, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]],
|
|
6076
6204
|
[, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]],
|
|
6077
6205
|
[, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]],
|
|
6078
|
-
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["
|
|
6206
|
+
[, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]
|
|
6079
6207
|
], [[, "(\\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"]], [
|
|
6080
6208
|
,
|
|
6081
6209
|
"(\\d{3})(\\d{3})(\\d{3,4})",
|
|
6082
6210
|
"$1 $2 $3",
|
|
6083
6211
|
["1(?:44|[679])|[378]|43"]
|
|
6084
|
-
], [, "(\\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", ["
|
|
6212
|
+
], [, "(\\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]]],
|
|
6085
6213
|
JE: [, [, , "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", , , , , , , [10], [6]], [, , "1534[0-24-8]\\d{5}", , , , "1534456789", , , , [6]], [
|
|
6086
6214
|
,
|
|
6087
6215
|
,
|
|
@@ -6464,7 +6592,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6464
6592
|
,
|
|
6465
6593
|
"5002345678"
|
|
6466
6594
|
], [, , , , , , , , , [-1]], "LC", 1, "011", "1", , , "([2-8]\\d{6})$|1", "758$1", , , , , [, , , , , , , , , [-1]], , "758", [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6467
|
-
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
|
|
6595
|
+
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"], [
|
|
6468
6596
|
,
|
|
6469
6597
|
,
|
|
6470
6598
|
"90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",
|
|
@@ -6573,7 +6701,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6573
6701
|
,
|
|
6574
6702
|
"$CC $1"
|
|
6575
6703
|
], [, "(\\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]]],
|
|
6576
|
-
LV: [, [, , "(?:[268]\\d|90)\\d{6}", , , , , , , [8]], [
|
|
6704
|
+
LV: [, [, , "(?:[268]\\d|78|90)\\d{6}", , , , , , , [8]], [
|
|
6577
6705
|
,
|
|
6578
6706
|
,
|
|
6579
6707
|
"6\\d{7}",
|
|
@@ -6581,7 +6709,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6581
6709
|
,
|
|
6582
6710
|
,
|
|
6583
6711
|
"63123456"
|
|
6584
|
-
], [, , "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", ["[
|
|
6712
|
+
], [, , "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]]],
|
|
6585
6713
|
LY: [, [, , "[2-9]\\d{8}", , , , , , , [9], [7]], [
|
|
6586
6714
|
,
|
|
6587
6715
|
,
|
|
@@ -6643,7 +6771,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
6643
6771
|
,
|
|
6644
6772
|
[8],
|
|
6645
6773
|
[6]
|
|
6646
|
-
], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "
|
|
6774
|
+
], [, , "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]]],
|
|
6647
6775
|
MF: [
|
|
6648
6776
|
,
|
|
6649
6777
|
[, , "(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}", , , , , , , [9]],
|
|
@@ -7731,7 +7859,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
7731
7859
|
,
|
|
7732
7860
|
,
|
|
7733
7861
|
[8]
|
|
7734
|
-
], [, , "
|
|
7862
|
+
], [, , "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"]], [
|
|
7735
7863
|
,
|
|
7736
7864
|
"(\\d{4})(\\d{4})(\\d{3})",
|
|
7737
7865
|
"$1 $2 $3",
|
|
@@ -8309,7 +8437,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8309
8437
|
], [
|
|
8310
8438
|
,
|
|
8311
8439
|
,
|
|
8312
|
-
"(?: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-
|
|
8440
|
+
"(?: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}",
|
|
8313
8441
|
,
|
|
8314
8442
|
,
|
|
8315
8443
|
,
|
|
@@ -8321,7 +8449,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8321
8449
|
], [
|
|
8322
8450
|
,
|
|
8323
8451
|
,
|
|
8324
|
-
"(?: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-
|
|
8452
|
+
"(?: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}",
|
|
8325
8453
|
,
|
|
8326
8454
|
,
|
|
8327
8455
|
,
|
|
@@ -9793,7 +9921,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
9793
9921
|
}] });
|
|
9794
9922
|
})();
|
|
9795
9923
|
(() => {
|
|
9796
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber:
|
|
9924
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber: 43 });
|
|
9797
9925
|
})();
|
|
9798
9926
|
export {
|
|
9799
9927
|
IntlTelInputComponent,
|