intl-tel-input 25.5.0 → 25.5.2
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/build/IntlTelInput.js +260 -317
- package/angular/build/IntlTelInputWithUtils.js +474 -447
- package/build/css/intlTelInput.css +5 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +5 -4
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +5 -4
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +4 -4
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +4 -3
- package/react/build/IntlTelInput.js +4 -3
- package/react/build/IntlTelInputWithUtils.cjs +4 -3
- package/react/build/IntlTelInputWithUtils.js +4 -3
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +4 -4
- package/vue/build/IntlTelInputWithUtils.mjs +4 -4
- package/angular/build/IntlTelInput.cjs +0 -3358
- package/angular/build/IntlTelInput.d.ts +0 -1671
- package/angular/build/IntlTelInputWithUtils.cjs +0 -9732
- package/angular/build/intl-tel-input/angular.js +0 -205
- package/angular/build/intl-tel-input/angularWithUtils.js +0 -206
- package/angular/build/intl-tel-input/data.js +0 -1096
- package/angular/build/intl-tel-input/i18n/ar/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ar/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ar/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/bg/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/bg/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/bg/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/bn/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/bn/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/bn/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/bs/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/bs/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/bs/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ca/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ca/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ca/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/cs/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/cs/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/cs/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/da/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/da/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/da/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/de/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/de/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/de/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ee/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ee/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ee/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/el/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/el/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/el/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/en/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/en/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/en/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/es/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/es/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/es/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/fa/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/fa/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/fa/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/fi/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/fi/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/fi/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/fr/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/fr/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/fr/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/hi/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/hi/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/hi/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/hr/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/hr/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/hr/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/hu/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/hu/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/hu/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/id/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/id/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/id/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/index.js +0 -40
- package/angular/build/intl-tel-input/i18n/it/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/it/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/it/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ja/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ja/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ja/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ko/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ko/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ko/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/mr/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/mr/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/mr/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/nl/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/nl/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/nl/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/no/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/no/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/no/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/pl/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/pl/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/pl/interface.js +0 -24
- package/angular/build/intl-tel-input/i18n/pt/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/pt/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/pt/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ro/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ro/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ro/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ru/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ru/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ru/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/sk/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/sk/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/sk/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/sv/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/sv/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/sv/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/te/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/te/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/te/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/th/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/th/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/th/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/tr/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/tr/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/tr/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/types.js +0 -1
- package/angular/build/intl-tel-input/i18n/uk/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/uk/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/uk/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/ur/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/ur/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/ur/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/uz/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/uz/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/uz/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/vi/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/vi/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/vi/interface.js +0 -13
- package/angular/build/intl-tel-input/i18n/zh/countries.js +0 -245
- package/angular/build/intl-tel-input/i18n/zh/index.js +0 -5
- package/angular/build/intl-tel-input/i18n/zh/interface.js +0 -13
- package/angular/build/intl-tel-input/intlTelInputWithUtils.js +0 -4
- package/angular/build/intl-tel-input/utils.js +0 -1341
- package/angular/build/intl-tel-input.js +0 -1812
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result) __defProp(target, key, result);
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// src/js/intl-tel-input/data.ts
|
|
1
|
+
// angular/build/temp/intl-tel-input/data.js
|
|
13
2
|
var rawCountryData = [
|
|
14
3
|
[
|
|
15
4
|
"af",
|
|
@@ -1350,7 +1339,7 @@ for (let i = 0; i < rawCountryData.length; i++) {
|
|
|
1350
1339
|
}
|
|
1351
1340
|
var data_default = allCountries;
|
|
1352
1341
|
|
|
1353
|
-
//
|
|
1342
|
+
// angular/build/temp/intl-tel-input/i18n/en/countries.js
|
|
1354
1343
|
var countryTranslations = {
|
|
1355
1344
|
ad: "Andorra",
|
|
1356
1345
|
ae: "United Arab Emirates",
|
|
@@ -1597,7 +1586,7 @@ var countryTranslations = {
|
|
|
1597
1586
|
};
|
|
1598
1587
|
var countries_default = countryTranslations;
|
|
1599
1588
|
|
|
1600
|
-
//
|
|
1589
|
+
// angular/build/temp/intl-tel-input/i18n/en/interface.js
|
|
1601
1590
|
var interfaceTranslations = {
|
|
1602
1591
|
selectedCountryAriaLabel: "Selected country",
|
|
1603
1592
|
noCountrySelected: "No country selected",
|
|
@@ -1612,11 +1601,11 @@ var interfaceTranslations = {
|
|
|
1612
1601
|
};
|
|
1613
1602
|
var interface_default = interfaceTranslations;
|
|
1614
1603
|
|
|
1615
|
-
//
|
|
1616
|
-
var allTranslations = {
|
|
1604
|
+
// angular/build/temp/intl-tel-input/i18n/en/index.js
|
|
1605
|
+
var allTranslations = Object.assign(Object.assign({}, countries_default), interface_default);
|
|
1617
1606
|
var en_default = allTranslations;
|
|
1618
1607
|
|
|
1619
|
-
//
|
|
1608
|
+
// angular/build/temp/intl-tel-input.js
|
|
1620
1609
|
for (let i = 0; i < data_default.length; i++) {
|
|
1621
1610
|
data_default[i].name = en_default[data_default[i].iso2];
|
|
1622
1611
|
}
|
|
@@ -1670,9 +1659,7 @@ var defaults = {
|
|
|
1670
1659
|
useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? (
|
|
1671
1660
|
//* We cannot just test screen size as some smartphones/website meta tags will report desktop resolutions.
|
|
1672
1661
|
//* Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
|
|
1673
|
-
/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1674
|
-
navigator.userAgent
|
|
1675
|
-
) || window.innerWidth <= 500
|
|
1662
|
+
/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500
|
|
1676
1663
|
) : false,
|
|
1677
1664
|
//* The number type to enforce during validation.
|
|
1678
1665
|
validationNumberTypes: ["MOBILE"]
|
|
@@ -1765,6 +1752,7 @@ var Iti = class {
|
|
|
1765
1752
|
}
|
|
1766
1753
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
1767
1754
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1755
|
+
this.telInput.dir = "ltr";
|
|
1768
1756
|
const showOnDefaultSide = this.options.allowDropdown || this.options.separateDialCode;
|
|
1769
1757
|
this.showSelectedCountryOnLeft = this.isRTL ? !showOnDefaultSide : showOnDefaultSide;
|
|
1770
1758
|
if (this.options.separateDialCode) {
|
|
@@ -1774,7 +1762,7 @@ var Iti = class {
|
|
|
1774
1762
|
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
1775
1763
|
}
|
|
1776
1764
|
}
|
|
1777
|
-
this.options.i18n = {
|
|
1765
|
+
this.options.i18n = Object.assign(Object.assign({}, en_default), this.options.i18n);
|
|
1778
1766
|
const autoCountryPromise = new Promise((resolve, reject) => {
|
|
1779
1767
|
this.resolveAutoCountryPromise = resolve;
|
|
1780
1768
|
this.rejectAutoCountryPromise = reject;
|
|
@@ -1843,19 +1831,11 @@ var Iti = class {
|
|
|
1843
1831
|
_processAllCountries() {
|
|
1844
1832
|
const { onlyCountries, excludeCountries } = this.options;
|
|
1845
1833
|
if (onlyCountries.length) {
|
|
1846
|
-
const lowerCaseOnlyCountries = onlyCountries.map(
|
|
1847
|
-
|
|
1848
|
-
);
|
|
1849
|
-
this.countries = data_default.filter(
|
|
1850
|
-
(country) => lowerCaseOnlyCountries.includes(country.iso2)
|
|
1851
|
-
);
|
|
1834
|
+
const lowerCaseOnlyCountries = onlyCountries.map((country) => country.toLowerCase());
|
|
1835
|
+
this.countries = data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
|
|
1852
1836
|
} else if (excludeCountries.length) {
|
|
1853
|
-
const lowerCaseExcludeCountries = excludeCountries.map(
|
|
1854
|
-
|
|
1855
|
-
);
|
|
1856
|
-
this.countries = data_default.filter(
|
|
1857
|
-
(country) => !lowerCaseExcludeCountries.includes(country.iso2)
|
|
1858
|
-
);
|
|
1837
|
+
const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
|
|
1838
|
+
this.countries = data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
|
|
1859
1839
|
} else {
|
|
1860
1840
|
this.countries = data_default;
|
|
1861
1841
|
}
|
|
@@ -1900,22 +1880,12 @@ var Iti = class {
|
|
|
1900
1880
|
}
|
|
1901
1881
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1902
1882
|
_generateMarkup() {
|
|
1883
|
+
var _a, _b, _c;
|
|
1903
1884
|
this.telInput.classList.add("iti__tel-input");
|
|
1904
1885
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
1905
1886
|
this.telInput.setAttribute("autocomplete", "off");
|
|
1906
1887
|
}
|
|
1907
|
-
const {
|
|
1908
|
-
allowDropdown,
|
|
1909
|
-
separateDialCode,
|
|
1910
|
-
showFlags,
|
|
1911
|
-
containerClass,
|
|
1912
|
-
hiddenInput,
|
|
1913
|
-
dropdownContainer,
|
|
1914
|
-
fixDropdownWidth,
|
|
1915
|
-
useFullscreenPopup,
|
|
1916
|
-
countrySearch,
|
|
1917
|
-
i18n
|
|
1918
|
-
} = this.options;
|
|
1888
|
+
const { allowDropdown, separateDialCode, showFlags, containerClass, hiddenInput, dropdownContainer, fixDropdownWidth, useFullscreenPopup, countrySearch, i18n } = this.options;
|
|
1919
1889
|
let parentClass = "iti";
|
|
1920
1890
|
if (allowDropdown) {
|
|
1921
1891
|
parentClass += " iti--allow-dropdown";
|
|
@@ -1930,62 +1900,38 @@ var Iti = class {
|
|
|
1930
1900
|
parentClass += " iti--inline-dropdown";
|
|
1931
1901
|
}
|
|
1932
1902
|
const wrapper = createEl("div", { class: parentClass });
|
|
1933
|
-
this.telInput.parentNode
|
|
1903
|
+
(_a = this.telInput.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(wrapper, this.telInput);
|
|
1934
1904
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1935
|
-
this.countryContainer = createEl(
|
|
1936
|
-
"div",
|
|
1937
|
-
{ class: "iti__country-container" },
|
|
1938
|
-
wrapper
|
|
1939
|
-
);
|
|
1905
|
+
this.countryContainer = createEl("div", { class: "iti__country-container" }, wrapper);
|
|
1940
1906
|
if (this.showSelectedCountryOnLeft) {
|
|
1941
1907
|
this.countryContainer.style.left = "0px";
|
|
1942
1908
|
} else {
|
|
1943
1909
|
this.countryContainer.style.right = "0px";
|
|
1944
1910
|
}
|
|
1945
1911
|
if (allowDropdown) {
|
|
1946
|
-
this.selectedCountry = createEl(
|
|
1947
|
-
"button",
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
"role": "combobox"
|
|
1956
|
-
},
|
|
1957
|
-
this.countryContainer
|
|
1958
|
-
);
|
|
1912
|
+
this.selectedCountry = createEl("button", {
|
|
1913
|
+
type: "button",
|
|
1914
|
+
class: "iti__selected-country",
|
|
1915
|
+
"aria-expanded": "false",
|
|
1916
|
+
"aria-label": this.options.i18n.selectedCountryAriaLabel,
|
|
1917
|
+
"aria-haspopup": "true",
|
|
1918
|
+
"aria-controls": `iti-${this.id}__dropdown-content`,
|
|
1919
|
+
"role": "combobox"
|
|
1920
|
+
}, this.countryContainer);
|
|
1959
1921
|
if (this.telInput.disabled) {
|
|
1960
1922
|
this.selectedCountry.setAttribute("disabled", "true");
|
|
1961
1923
|
}
|
|
1962
1924
|
} else {
|
|
1963
|
-
this.selectedCountry = createEl(
|
|
1964
|
-
"div",
|
|
1965
|
-
{ class: "iti__selected-country" },
|
|
1966
|
-
this.countryContainer
|
|
1967
|
-
);
|
|
1925
|
+
this.selectedCountry = createEl("div", { class: "iti__selected-country" }, this.countryContainer);
|
|
1968
1926
|
}
|
|
1969
1927
|
const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1970
1928
|
this.selectedCountryInner = createEl("div", { class: "iti__flag" }, selectedCountryPrimary);
|
|
1971
|
-
this.selectedCountryA11yText = createEl(
|
|
1972
|
-
"span",
|
|
1973
|
-
{ class: "iti__a11y-text" },
|
|
1974
|
-
this.selectedCountryInner
|
|
1975
|
-
);
|
|
1929
|
+
this.selectedCountryA11yText = createEl("span", { class: "iti__a11y-text" }, this.selectedCountryInner);
|
|
1976
1930
|
if (allowDropdown) {
|
|
1977
|
-
this.dropdownArrow = createEl(
|
|
1978
|
-
"div",
|
|
1979
|
-
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1980
|
-
selectedCountryPrimary
|
|
1981
|
-
);
|
|
1931
|
+
this.dropdownArrow = createEl("div", { class: "iti__arrow", "aria-hidden": "true" }, selectedCountryPrimary);
|
|
1982
1932
|
}
|
|
1983
1933
|
if (separateDialCode) {
|
|
1984
|
-
this.selectedDialCode = createEl(
|
|
1985
|
-
"div",
|
|
1986
|
-
{ class: "iti__selected-dial-code" },
|
|
1987
|
-
this.selectedCountry
|
|
1988
|
-
);
|
|
1934
|
+
this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" }, this.selectedCountry);
|
|
1989
1935
|
}
|
|
1990
1936
|
if (allowDropdown) {
|
|
1991
1937
|
const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
@@ -1994,37 +1940,25 @@ var Iti = class {
|
|
|
1994
1940
|
class: `iti__dropdown-content iti__hide ${extraClasses}`
|
|
1995
1941
|
});
|
|
1996
1942
|
if (countrySearch) {
|
|
1997
|
-
this.searchInput = createEl(
|
|
1998
|
-
"
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
},
|
|
2010
|
-
this.dropdownContent
|
|
2011
|
-
);
|
|
2012
|
-
this.searchResultsA11yText = createEl(
|
|
2013
|
-
"span",
|
|
2014
|
-
{ class: "iti__a11y-text" },
|
|
2015
|
-
this.dropdownContent
|
|
2016
|
-
);
|
|
1943
|
+
this.searchInput = createEl("input", {
|
|
1944
|
+
type: "text",
|
|
1945
|
+
class: "iti__search-input",
|
|
1946
|
+
placeholder: i18n.searchPlaceholder,
|
|
1947
|
+
role: "combobox",
|
|
1948
|
+
"aria-expanded": "true",
|
|
1949
|
+
"aria-label": i18n.searchPlaceholder,
|
|
1950
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1951
|
+
"aria-autocomplete": "list",
|
|
1952
|
+
"autocomplete": "off"
|
|
1953
|
+
}, this.dropdownContent);
|
|
1954
|
+
this.searchResultsA11yText = createEl("span", { class: "iti__a11y-text" }, this.dropdownContent);
|
|
2017
1955
|
}
|
|
2018
|
-
this.countryList = createEl(
|
|
2019
|
-
"
|
|
2020
|
-
{
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
"aria-label": i18n.countryListAriaLabel
|
|
2025
|
-
},
|
|
2026
|
-
this.dropdownContent
|
|
2027
|
-
);
|
|
1956
|
+
this.countryList = createEl("ul", {
|
|
1957
|
+
class: "iti__country-list",
|
|
1958
|
+
id: `iti-${this.id}__country-listbox`,
|
|
1959
|
+
role: "listbox",
|
|
1960
|
+
"aria-label": i18n.countryListAriaLabel
|
|
1961
|
+
}, this.dropdownContent);
|
|
2028
1962
|
this._appendListItems();
|
|
2029
1963
|
if (countrySearch) {
|
|
2030
1964
|
this._updateSearchResultsText();
|
|
@@ -2052,7 +1986,7 @@ var Iti = class {
|
|
|
2052
1986
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2053
1987
|
const names = hiddenInput(telInputName);
|
|
2054
1988
|
if (names.phone) {
|
|
2055
|
-
const existingInput = this.telInput.form
|
|
1989
|
+
const existingInput = (_b = this.telInput.form) === null || _b === void 0 ? void 0 : _b.querySelector(`input[name="${names.phone}"]`);
|
|
2056
1990
|
if (existingInput) {
|
|
2057
1991
|
this.hiddenInput = existingInput;
|
|
2058
1992
|
} else {
|
|
@@ -2064,7 +1998,7 @@ var Iti = class {
|
|
|
2064
1998
|
}
|
|
2065
1999
|
}
|
|
2066
2000
|
if (names.country) {
|
|
2067
|
-
const existingInput = this.telInput.form
|
|
2001
|
+
const existingInput = (_c = this.telInput.form) === null || _c === void 0 ? void 0 : _c.querySelector(`input[name="${names.country}"]`);
|
|
2068
2002
|
if (existingInput) {
|
|
2069
2003
|
this.hiddenInputCountry = existingInput;
|
|
2070
2004
|
} else {
|
|
@@ -2082,26 +2016,22 @@ var Iti = class {
|
|
|
2082
2016
|
for (let i = 0; i < this.countries.length; i++) {
|
|
2083
2017
|
const c = this.countries[i];
|
|
2084
2018
|
const extraClass = i === 0 ? "iti__highlight" : "";
|
|
2085
|
-
const listItem = createEl(
|
|
2086
|
-
|
|
2087
|
-
{
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
"aria-selected": "false"
|
|
2095
|
-
},
|
|
2096
|
-
this.countryList
|
|
2097
|
-
);
|
|
2019
|
+
const listItem = createEl("li", {
|
|
2020
|
+
id: `iti-${this.id}__item-${c.iso2}`,
|
|
2021
|
+
class: `iti__country ${extraClass}`,
|
|
2022
|
+
tabindex: "-1",
|
|
2023
|
+
role: "option",
|
|
2024
|
+
"data-dial-code": c.dialCode,
|
|
2025
|
+
"data-country-code": c.iso2,
|
|
2026
|
+
"aria-selected": "false"
|
|
2027
|
+
}, this.countryList);
|
|
2098
2028
|
c.nodeById[this.id] = listItem;
|
|
2099
2029
|
let content = "";
|
|
2100
2030
|
if (this.options.showFlags) {
|
|
2101
2031
|
content += `<div class='iti__flag iti__${c.iso2}'></div>`;
|
|
2102
2032
|
}
|
|
2103
2033
|
content += `<span class='iti__country-name'>${c.name}</span>`;
|
|
2104
|
-
content += `<span class='iti__dial-code'>+${c.dialCode}</span>`;
|
|
2034
|
+
content += `<span class='iti__dial-code' dir='ltr'>+${c.dialCode}</span>`;
|
|
2105
2035
|
listItem.insertAdjacentHTML("beforeend", content);
|
|
2106
2036
|
}
|
|
2107
2037
|
}
|
|
@@ -2148,6 +2078,7 @@ var Iti = class {
|
|
|
2148
2078
|
}
|
|
2149
2079
|
//* Update hidden input on form submit.
|
|
2150
2080
|
_initHiddenInputListener() {
|
|
2081
|
+
var _a;
|
|
2151
2082
|
this._handleHiddenInputSubmit = () => {
|
|
2152
2083
|
if (this.hiddenInput) {
|
|
2153
2084
|
this.hiddenInput.value = this.getNumber();
|
|
@@ -2156,10 +2087,7 @@ var Iti = class {
|
|
|
2156
2087
|
this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "";
|
|
2157
2088
|
}
|
|
2158
2089
|
};
|
|
2159
|
-
this.telInput.form
|
|
2160
|
-
"submit",
|
|
2161
|
-
this._handleHiddenInputSubmit
|
|
2162
|
-
);
|
|
2090
|
+
(_a = this.telInput.form) === null || _a === void 0 ? void 0 : _a.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
2163
2091
|
}
|
|
2164
2092
|
//* initialise the dropdown listeners.
|
|
2165
2093
|
_initDropdownListeners() {
|
|
@@ -2191,18 +2119,16 @@ var Iti = class {
|
|
|
2191
2119
|
this._closeDropdown();
|
|
2192
2120
|
}
|
|
2193
2121
|
};
|
|
2194
|
-
this.countryContainer.addEventListener(
|
|
2195
|
-
"keydown",
|
|
2196
|
-
this._handleCountryContainerKeydown
|
|
2197
|
-
);
|
|
2122
|
+
this.countryContainer.addEventListener("keydown", this._handleCountryContainerKeydown);
|
|
2198
2123
|
}
|
|
2199
2124
|
//* Init many requests: utils script / geo ip lookup.
|
|
2200
2125
|
_initRequests() {
|
|
2201
2126
|
let { loadUtils, initialCountry, geoIpLookup } = this.options;
|
|
2202
2127
|
if (loadUtils && !intlTelInput.utils) {
|
|
2203
2128
|
this._handlePageLoad = () => {
|
|
2129
|
+
var _a;
|
|
2204
2130
|
window.removeEventListener("load", this._handlePageLoad);
|
|
2205
|
-
intlTelInput.attachUtils(loadUtils)
|
|
2131
|
+
(_a = intlTelInput.attachUtils(loadUtils)) === null || _a === void 0 ? void 0 : _a.catch(() => {
|
|
2206
2132
|
});
|
|
2207
2133
|
};
|
|
2208
2134
|
if (intlTelInput.documentReady()) {
|
|
@@ -2227,23 +2153,20 @@ var Iti = class {
|
|
|
2227
2153
|
} else if (!intlTelInput.startedLoadingAutoCountry) {
|
|
2228
2154
|
intlTelInput.startedLoadingAutoCountry = true;
|
|
2229
2155
|
if (typeof this.options.geoIpLookup === "function") {
|
|
2230
|
-
this.options.geoIpLookup(
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
} else {
|
|
2238
|
-
this._setInitialState(true);
|
|
2239
|
-
forEachInstance("rejectAutoCountryPromise");
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
() => {
|
|
2156
|
+
this.options.geoIpLookup((iso2 = "") => {
|
|
2157
|
+
const iso2Lower = iso2.toLowerCase();
|
|
2158
|
+
const isValidIso2 = iso2Lower && this._getCountryData(iso2Lower, true);
|
|
2159
|
+
if (isValidIso2) {
|
|
2160
|
+
intlTelInput.autoCountry = iso2Lower;
|
|
2161
|
+
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2162
|
+
} else {
|
|
2243
2163
|
this._setInitialState(true);
|
|
2244
2164
|
forEachInstance("rejectAutoCountryPromise");
|
|
2245
2165
|
}
|
|
2246
|
-
)
|
|
2166
|
+
}, () => {
|
|
2167
|
+
this._setInitialState(true);
|
|
2168
|
+
forEachInstance("rejectAutoCountryPromise");
|
|
2169
|
+
});
|
|
2247
2170
|
}
|
|
2248
2171
|
}
|
|
2249
2172
|
}
|
|
@@ -2260,7 +2183,7 @@ var Iti = class {
|
|
|
2260
2183
|
userOverrideFormatting = true;
|
|
2261
2184
|
}
|
|
2262
2185
|
this._handleInputEvent = (e) => {
|
|
2263
|
-
if (this.isAndroid && e
|
|
2186
|
+
if (this.isAndroid && (e === null || e === void 0 ? void 0 : e.data) === "+" && separateDialCode && allowDropdown && countrySearch) {
|
|
2264
2187
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2265
2188
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos - 1);
|
|
2266
2189
|
const valueAfterCaret = this.telInput.value.substring(currentCaretPos);
|
|
@@ -2271,19 +2194,19 @@ var Iti = class {
|
|
|
2271
2194
|
if (this._updateCountryFromNumber(this.telInput.value)) {
|
|
2272
2195
|
this._triggerCountryChange();
|
|
2273
2196
|
}
|
|
2274
|
-
const isFormattingChar = e
|
|
2275
|
-
const isPaste = e
|
|
2197
|
+
const isFormattingChar = (e === null || e === void 0 ? void 0 : e.data) && /[^+0-9]/.test(e.data);
|
|
2198
|
+
const isPaste = (e === null || e === void 0 ? void 0 : e.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2276
2199
|
if (isFormattingChar || isPaste && !strictMode) {
|
|
2277
2200
|
userOverrideFormatting = true;
|
|
2278
2201
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2279
2202
|
userOverrideFormatting = false;
|
|
2280
2203
|
}
|
|
2281
|
-
const disableFormatOnSetNumber = e
|
|
2204
|
+
const disableFormatOnSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"] && !formatOnDisplay;
|
|
2282
2205
|
if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
|
|
2283
2206
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2284
2207
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2285
2208
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
2286
|
-
const isDeleteForwards = e
|
|
2209
|
+
const isDeleteForwards = (e === null || e === void 0 ? void 0 : e.inputType) === "deleteContentForward";
|
|
2287
2210
|
const formattedValue = this._formatNumberAsYouType();
|
|
2288
2211
|
const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
|
|
2289
2212
|
this.telInput.value = formattedValue;
|
|
@@ -2374,17 +2297,16 @@ var Iti = class {
|
|
|
2374
2297
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2375
2298
|
_bindDropdownListeners() {
|
|
2376
2299
|
this._handleMouseoverCountryList = (e) => {
|
|
2377
|
-
|
|
2300
|
+
var _a;
|
|
2301
|
+
const listItem = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(".iti__country");
|
|
2378
2302
|
if (listItem) {
|
|
2379
2303
|
this._highlightListItem(listItem, false);
|
|
2380
2304
|
}
|
|
2381
2305
|
};
|
|
2382
|
-
this.countryList.addEventListener(
|
|
2383
|
-
"mouseover",
|
|
2384
|
-
this._handleMouseoverCountryList
|
|
2385
|
-
);
|
|
2306
|
+
this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
|
|
2386
2307
|
this._handleClickCountryList = (e) => {
|
|
2387
|
-
|
|
2308
|
+
var _a;
|
|
2309
|
+
const listItem = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(".iti__country");
|
|
2388
2310
|
if (listItem) {
|
|
2389
2311
|
this._selectListItem(listItem);
|
|
2390
2312
|
}
|
|
@@ -2397,10 +2319,7 @@ var Iti = class {
|
|
|
2397
2319
|
}
|
|
2398
2320
|
isOpening = false;
|
|
2399
2321
|
};
|
|
2400
|
-
document.documentElement.addEventListener(
|
|
2401
|
-
"click",
|
|
2402
|
-
this._handleClickOffToClose
|
|
2403
|
-
);
|
|
2322
|
+
document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
2404
2323
|
let query = "";
|
|
2405
2324
|
let queryTimer = null;
|
|
2406
2325
|
this._handleKeydownOnDropdown = (e) => {
|
|
@@ -2469,16 +2388,45 @@ var Iti = class {
|
|
|
2469
2388
|
let noCountriesAddedYet = true;
|
|
2470
2389
|
this.countryList.innerHTML = "";
|
|
2471
2390
|
const normalisedQuery = normaliseString(query);
|
|
2391
|
+
const queryLength = normalisedQuery.length;
|
|
2392
|
+
const iso2Matches = [];
|
|
2393
|
+
const nameStartWith = [];
|
|
2394
|
+
const nameContains = [];
|
|
2395
|
+
const dialCodeMatches = [];
|
|
2396
|
+
const dialCodeContains = [];
|
|
2397
|
+
const initialsMatches = [];
|
|
2472
2398
|
for (let i = 0; i < this.countries.length; i++) {
|
|
2473
2399
|
const c = this.countries[i];
|
|
2474
2400
|
const normalisedCountryName = normaliseString(c.name);
|
|
2475
2401
|
const countryInitials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2402
|
+
if (isReset || queryLength === 0) {
|
|
2403
|
+
nameContains.push(c);
|
|
2404
|
+
} else if (c.iso2.toLowerCase() === normalisedQuery) {
|
|
2405
|
+
iso2Matches.push(c);
|
|
2406
|
+
} else if (normalisedCountryName.startsWith(normalisedQuery)) {
|
|
2407
|
+
nameStartWith.push(c);
|
|
2408
|
+
} else if (normalisedCountryName.includes(normalisedQuery)) {
|
|
2409
|
+
nameContains.push(c);
|
|
2410
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === `+${c.dialCode}`) {
|
|
2411
|
+
dialCodeMatches.push(c);
|
|
2412
|
+
} else if (`+${c.dialCode}`.includes(normalisedQuery)) {
|
|
2413
|
+
dialCodeContains.push(c);
|
|
2414
|
+
} else if (countryInitials.includes(normalisedQuery)) {
|
|
2415
|
+
initialsMatches.push(c);
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
const matchedCountries = [
|
|
2419
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2420
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2421
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2422
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2423
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2424
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2425
|
+
];
|
|
2426
|
+
for (const c of matchedCountries) {
|
|
2427
|
+
const listItem = c.nodeById[this.id];
|
|
2428
|
+
if (listItem) {
|
|
2429
|
+
this.countryList.appendChild(listItem);
|
|
2482
2430
|
if (noCountriesAddedYet) {
|
|
2483
2431
|
this._highlightListItem(listItem, false);
|
|
2484
2432
|
noCountriesAddedYet = false;
|
|
@@ -2511,7 +2459,8 @@ var Iti = class {
|
|
|
2511
2459
|
}
|
|
2512
2460
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2513
2461
|
_handleUpDownKey(key) {
|
|
2514
|
-
|
|
2462
|
+
var _a, _b;
|
|
2463
|
+
let next = key === "ArrowUp" ? (_a = this.highlightedItem) === null || _a === void 0 ? void 0 : _a.previousElementSibling : (_b = this.highlightedItem) === null || _b === void 0 ? void 0 : _b.nextElementSibling;
|
|
2515
2464
|
if (!next && this.countryList.childElementCount > 1) {
|
|
2516
2465
|
next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild;
|
|
2517
2466
|
}
|
|
@@ -2534,11 +2483,7 @@ var Iti = class {
|
|
|
2534
2483
|
const useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode;
|
|
2535
2484
|
const { NATIONAL, INTERNATIONAL } = intlTelInput.utils.numberFormat;
|
|
2536
2485
|
const format = useNational ? NATIONAL : INTERNATIONAL;
|
|
2537
|
-
number = intlTelInput.utils.formatNumber(
|
|
2538
|
-
number,
|
|
2539
|
-
this.selectedCountryData.iso2,
|
|
2540
|
-
format
|
|
2541
|
-
);
|
|
2486
|
+
number = intlTelInput.utils.formatNumber(number, this.selectedCountryData.iso2, format);
|
|
2542
2487
|
}
|
|
2543
2488
|
number = this._beforeSetNumber(number);
|
|
2544
2489
|
this.telInput.value = number;
|
|
@@ -2681,12 +2626,7 @@ var Iti = class {
|
|
|
2681
2626
|
if (strictMode && intlTelInput.utils) {
|
|
2682
2627
|
if (iso2) {
|
|
2683
2628
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2684
|
-
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
2685
|
-
iso2,
|
|
2686
|
-
false,
|
|
2687
|
-
numberType,
|
|
2688
|
-
true
|
|
2689
|
-
);
|
|
2629
|
+
let exampleNumber = intlTelInput.utils.getExampleNumber(iso2, false, numberType, true);
|
|
2690
2630
|
let validNumber = exampleNumber;
|
|
2691
2631
|
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2, validationNumberTypes)) {
|
|
2692
2632
|
validNumber = exampleNumber;
|
|
@@ -2737,20 +2677,11 @@ var Iti = class {
|
|
|
2737
2677
|
}
|
|
2738
2678
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2739
2679
|
_updatePlaceholder() {
|
|
2740
|
-
const {
|
|
2741
|
-
autoPlaceholder,
|
|
2742
|
-
placeholderNumberType,
|
|
2743
|
-
nationalMode,
|
|
2744
|
-
customPlaceholder
|
|
2745
|
-
} = this.options;
|
|
2680
|
+
const { autoPlaceholder, placeholderNumberType, nationalMode, customPlaceholder } = this.options;
|
|
2746
2681
|
const shouldSetPlaceholder = autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && autoPlaceholder === "polite";
|
|
2747
2682
|
if (intlTelInput.utils && shouldSetPlaceholder) {
|
|
2748
2683
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2749
|
-
let placeholder = this.selectedCountryData.iso2 ? intlTelInput.utils.getExampleNumber(
|
|
2750
|
-
this.selectedCountryData.iso2,
|
|
2751
|
-
nationalMode,
|
|
2752
|
-
numberType
|
|
2753
|
-
) : "";
|
|
2684
|
+
let placeholder = this.selectedCountryData.iso2 ? intlTelInput.utils.getExampleNumber(this.selectedCountryData.iso2, nationalMode, numberType) : "";
|
|
2754
2685
|
placeholder = this._beforeSetNumber(placeholder);
|
|
2755
2686
|
if (typeof customPlaceholder === "function") {
|
|
2756
2687
|
placeholder = customPlaceholder(placeholder, this.selectedCountryData);
|
|
@@ -2760,9 +2691,7 @@ var Iti = class {
|
|
|
2760
2691
|
}
|
|
2761
2692
|
//* Called when the user selects a list item from the dropdown.
|
|
2762
2693
|
_selectListItem(listItem) {
|
|
2763
|
-
const countryChanged = this._setCountry(
|
|
2764
|
-
listItem.getAttribute("data-country-code")
|
|
2765
|
-
);
|
|
2694
|
+
const countryChanged = this._setCountry(listItem.getAttribute("data-country-code"));
|
|
2766
2695
|
this._closeDropdown();
|
|
2767
2696
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2768
2697
|
this.telInput.focus();
|
|
@@ -2786,14 +2715,8 @@ var Iti = class {
|
|
|
2786
2715
|
if (this.options.countrySearch) {
|
|
2787
2716
|
this.searchInput.removeEventListener("input", this._handleSearchChange);
|
|
2788
2717
|
}
|
|
2789
|
-
document.documentElement.removeEventListener(
|
|
2790
|
-
|
|
2791
|
-
this._handleClickOffToClose
|
|
2792
|
-
);
|
|
2793
|
-
this.countryList.removeEventListener(
|
|
2794
|
-
"mouseover",
|
|
2795
|
-
this._handleMouseoverCountryList
|
|
2796
|
-
);
|
|
2718
|
+
document.documentElement.removeEventListener("click", this._handleClickOffToClose);
|
|
2719
|
+
this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
|
|
2797
2720
|
this.countryList.removeEventListener("click", this._handleClickCountryList);
|
|
2798
2721
|
if (this.options.dropdownContainer) {
|
|
2799
2722
|
if (!this.options.useFullscreenPopup) {
|
|
@@ -2943,18 +2866,13 @@ var Iti = class {
|
|
|
2943
2866
|
//********************
|
|
2944
2867
|
//* Remove plugin.
|
|
2945
2868
|
destroy() {
|
|
2869
|
+
var _a, _b;
|
|
2946
2870
|
this.telInput.iti = void 0;
|
|
2947
2871
|
const { allowDropdown, separateDialCode } = this.options;
|
|
2948
2872
|
if (allowDropdown) {
|
|
2949
2873
|
this._closeDropdown();
|
|
2950
|
-
this.selectedCountry.removeEventListener(
|
|
2951
|
-
|
|
2952
|
-
this._handleClickSelectedCountry
|
|
2953
|
-
);
|
|
2954
|
-
this.countryContainer.removeEventListener(
|
|
2955
|
-
"keydown",
|
|
2956
|
-
this._handleCountryContainerKeydown
|
|
2957
|
-
);
|
|
2874
|
+
this.selectedCountry.removeEventListener("click", this._handleClickSelectedCountry);
|
|
2875
|
+
this.countryContainer.removeEventListener("keydown", this._handleCountryContainerKeydown);
|
|
2958
2876
|
const label = this.telInput.closest("label");
|
|
2959
2877
|
if (label) {
|
|
2960
2878
|
label.removeEventListener("click", this._handleLabelClick);
|
|
@@ -2977,17 +2895,14 @@ var Iti = class {
|
|
|
2977
2895
|
}
|
|
2978
2896
|
}
|
|
2979
2897
|
const wrapper = this.telInput.parentNode;
|
|
2980
|
-
wrapper
|
|
2981
|
-
wrapper
|
|
2898
|
+
(_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.telInput, wrapper);
|
|
2899
|
+
(_b = wrapper === null || wrapper === void 0 ? void 0 : wrapper.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(wrapper);
|
|
2982
2900
|
delete intlTelInput.instances[this.id];
|
|
2983
2901
|
}
|
|
2984
2902
|
//* Get the extension from the current number.
|
|
2985
2903
|
getExtension() {
|
|
2986
2904
|
if (intlTelInput.utils) {
|
|
2987
|
-
return intlTelInput.utils.getExtension(
|
|
2988
|
-
this._getFullNumber(),
|
|
2989
|
-
this.selectedCountryData.iso2
|
|
2990
|
-
);
|
|
2905
|
+
return intlTelInput.utils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
2991
2906
|
}
|
|
2992
2907
|
return "";
|
|
2993
2908
|
}
|
|
@@ -2995,21 +2910,14 @@ var Iti = class {
|
|
|
2995
2910
|
getNumber(format) {
|
|
2996
2911
|
if (intlTelInput.utils) {
|
|
2997
2912
|
const { iso2 } = this.selectedCountryData;
|
|
2998
|
-
return intlTelInput.utils.formatNumber(
|
|
2999
|
-
this._getFullNumber(),
|
|
3000
|
-
iso2,
|
|
3001
|
-
format
|
|
3002
|
-
);
|
|
2913
|
+
return intlTelInput.utils.formatNumber(this._getFullNumber(), iso2, format);
|
|
3003
2914
|
}
|
|
3004
2915
|
return "";
|
|
3005
2916
|
}
|
|
3006
2917
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
3007
2918
|
getNumberType() {
|
|
3008
2919
|
if (intlTelInput.utils) {
|
|
3009
|
-
return intlTelInput.utils.getNumberType(
|
|
3010
|
-
this._getFullNumber(),
|
|
3011
|
-
this.selectedCountryData.iso2
|
|
3012
|
-
);
|
|
2920
|
+
return intlTelInput.utils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3013
2921
|
}
|
|
3014
2922
|
return -99;
|
|
3015
2923
|
}
|
|
@@ -3063,7 +2971,7 @@ var Iti = class {
|
|
|
3063
2971
|
}
|
|
3064
2972
|
//* Update the selected country, and update the input val accordingly.
|
|
3065
2973
|
setCountry(iso2) {
|
|
3066
|
-
const iso2Lower = iso2
|
|
2974
|
+
const iso2Lower = iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase();
|
|
3067
2975
|
const currentCountry = this.selectedCountryData.iso2;
|
|
3068
2976
|
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
3069
2977
|
if (isCountryChange) {
|
|
@@ -3109,7 +3017,7 @@ var attachUtils = (source) => {
|
|
|
3109
3017
|
}
|
|
3110
3018
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3111
3019
|
return loadCall.then((module) => {
|
|
3112
|
-
const utils = module
|
|
3020
|
+
const utils = module === null || module === void 0 ? void 0 : module.default;
|
|
3113
3021
|
if (!utils || typeof utils !== "object") {
|
|
3114
3022
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
3115
3023
|
}
|
|
@@ -3123,39 +3031,38 @@ var attachUtils = (source) => {
|
|
|
3123
3031
|
}
|
|
3124
3032
|
return null;
|
|
3125
3033
|
};
|
|
3126
|
-
var intlTelInput = Object.assign(
|
|
3127
|
-
(input, options)
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3034
|
+
var intlTelInput = Object.assign((input, options) => {
|
|
3035
|
+
const iti = new Iti(input, options);
|
|
3036
|
+
iti._init();
|
|
3037
|
+
input.setAttribute("data-intl-tel-input-id", iti.id.toString());
|
|
3038
|
+
intlTelInput.instances[iti.id] = iti;
|
|
3039
|
+
input.iti = iti;
|
|
3040
|
+
return iti;
|
|
3041
|
+
}, {
|
|
3042
|
+
defaults,
|
|
3043
|
+
//* Using a static var like this allows us to mock it in the tests.
|
|
3044
|
+
documentReady: () => document.readyState === "complete",
|
|
3045
|
+
//* Get the country data object.
|
|
3046
|
+
getCountryData: () => data_default,
|
|
3047
|
+
//* A getter for the plugin instance.
|
|
3048
|
+
getInstance: (input) => {
|
|
3049
|
+
const id2 = input.getAttribute("data-intl-tel-input-id");
|
|
3050
|
+
return id2 ? intlTelInput.instances[id2] : null;
|
|
3134
3051
|
},
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
getInstance: (input) => {
|
|
3143
|
-
const id2 = input.getAttribute("data-intl-tel-input-id");
|
|
3144
|
-
return id2 ? intlTelInput.instances[id2] : null;
|
|
3145
|
-
},
|
|
3146
|
-
//* A map from instance ID to instance object.
|
|
3147
|
-
instances: {},
|
|
3148
|
-
attachUtils,
|
|
3149
|
-
startedLoadingUtilsScript: false,
|
|
3150
|
-
startedLoadingAutoCountry: false,
|
|
3151
|
-
version: "25.4.7"
|
|
3152
|
-
}
|
|
3153
|
-
);
|
|
3052
|
+
//* A map from instance ID to instance object.
|
|
3053
|
+
instances: {},
|
|
3054
|
+
attachUtils,
|
|
3055
|
+
startedLoadingUtilsScript: false,
|
|
3056
|
+
startedLoadingAutoCountry: false,
|
|
3057
|
+
version: "25.5.2"
|
|
3058
|
+
});
|
|
3154
3059
|
var intl_tel_input_default = intlTelInput;
|
|
3155
3060
|
|
|
3156
|
-
// angular/
|
|
3157
|
-
import { Component, Input, ViewChild, Output, EventEmitter, forwardRef } from "@angular/core";
|
|
3061
|
+
// angular/build/temp/intl-tel-input/angular.js
|
|
3062
|
+
import { Component, Input, ViewChild, ElementRef, Output, EventEmitter, forwardRef } from "@angular/core";
|
|
3158
3063
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from "@angular/forms";
|
|
3064
|
+
import * as i0 from "@angular/core";
|
|
3065
|
+
var _c0 = ["inputRef"];
|
|
3159
3066
|
var PHONE_ERROR_MESSAGES = [
|
|
3160
3067
|
"invalid",
|
|
3161
3068
|
"invalid-country-code",
|
|
@@ -3176,13 +3083,10 @@ var IntlTelInputComponent = class {
|
|
|
3176
3083
|
this.errorCodeChange = new EventEmitter();
|
|
3177
3084
|
this.iti = null;
|
|
3178
3085
|
this.countryChangeHandler = () => this.handleInput();
|
|
3179
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3180
3086
|
this.onChange = () => {
|
|
3181
3087
|
};
|
|
3182
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3183
3088
|
this.onTouched = () => {
|
|
3184
3089
|
};
|
|
3185
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3186
3090
|
this.onValidatorChange = () => {
|
|
3187
3091
|
};
|
|
3188
3092
|
}
|
|
@@ -3199,12 +3103,14 @@ var IntlTelInputComponent = class {
|
|
|
3199
3103
|
}
|
|
3200
3104
|
}
|
|
3201
3105
|
ngAfterViewInit() {
|
|
3106
|
+
var _a;
|
|
3202
3107
|
if (this.initialValue) {
|
|
3203
|
-
this.iti
|
|
3108
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setNumber(this.initialValue);
|
|
3204
3109
|
}
|
|
3205
3110
|
}
|
|
3206
3111
|
handleInput() {
|
|
3207
|
-
if (!this.iti)
|
|
3112
|
+
if (!this.iti)
|
|
3113
|
+
return;
|
|
3208
3114
|
const num = this.iti.getNumber() || "";
|
|
3209
3115
|
const countryIso = this.iti.getSelectedCountryData().iso2 || "";
|
|
3210
3116
|
this.numberChange.emit(num);
|
|
@@ -3230,7 +3136,8 @@ var IntlTelInputComponent = class {
|
|
|
3230
3136
|
return this.inputRef.nativeElement;
|
|
3231
3137
|
}
|
|
3232
3138
|
ngOnDestroy() {
|
|
3233
|
-
|
|
3139
|
+
var _a;
|
|
3140
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3234
3141
|
this.inputRef.nativeElement.removeEventListener("countrychange", this.countryChangeHandler);
|
|
3235
3142
|
}
|
|
3236
3143
|
applyInputProps() {
|
|
@@ -3275,41 +3182,52 @@ var IntlTelInputComponent = class {
|
|
|
3275
3182
|
this.onValidatorChange = fn;
|
|
3276
3183
|
}
|
|
3277
3184
|
};
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3185
|
+
IntlTelInputComponent.\u0275fac = function IntlTelInputComponent_Factory(__ngFactoryType__) {
|
|
3186
|
+
return new (__ngFactoryType__ || IntlTelInputComponent)();
|
|
3187
|
+
};
|
|
3188
|
+
IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent({ type: IntlTelInputComponent, selectors: [["intl-tel-input"]], viewQuery: function IntlTelInputComponent_Query(rf, ctx) {
|
|
3189
|
+
if (rf & 1) {
|
|
3190
|
+
i0.\u0275\u0275viewQuery(_c0, 7);
|
|
3191
|
+
}
|
|
3192
|
+
if (rf & 2) {
|
|
3193
|
+
let _t;
|
|
3194
|
+
i0.\u0275\u0275queryRefresh(_t = i0.\u0275\u0275loadQuery()) && (ctx.inputRef = _t.first);
|
|
3195
|
+
}
|
|
3196
|
+
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3197
|
+
{
|
|
3198
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3199
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3200
|
+
multi: true
|
|
3201
|
+
},
|
|
3202
|
+
{
|
|
3203
|
+
provide: NG_VALIDATORS,
|
|
3204
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3205
|
+
multi: true
|
|
3206
|
+
}
|
|
3207
|
+
])], decls: 2, vars: 1, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur", "disabled"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3208
|
+
if (rf & 1) {
|
|
3209
|
+
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
3210
|
+
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
3211
|
+
i0.\u0275\u0275listener("input", function IntlTelInputComponent_Template_input_input_0_listener() {
|
|
3212
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
3213
|
+
return i0.\u0275\u0275resetView(ctx.handleInput());
|
|
3214
|
+
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener() {
|
|
3215
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
3216
|
+
return i0.\u0275\u0275resetView(ctx.handleBlur());
|
|
3217
|
+
});
|
|
3218
|
+
i0.\u0275\u0275elementEnd();
|
|
3219
|
+
}
|
|
3220
|
+
if (rf & 2) {
|
|
3221
|
+
i0.\u0275\u0275property("disabled", ctx.disabled);
|
|
3222
|
+
}
|
|
3223
|
+
}, encapsulation: 2 });
|
|
3224
|
+
(() => {
|
|
3225
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassMetadata(IntlTelInputComponent, [{
|
|
3226
|
+
type: Component,
|
|
3227
|
+
args: [{
|
|
3228
|
+
selector: "intl-tel-input",
|
|
3229
|
+
standalone: true,
|
|
3230
|
+
template: `
|
|
3313
3231
|
<input
|
|
3314
3232
|
type="tel"
|
|
3315
3233
|
#inputRef
|
|
@@ -3318,20 +3236,45 @@ IntlTelInputComponent = __decorateClass([
|
|
|
3318
3236
|
[disabled]="disabled"
|
|
3319
3237
|
/>
|
|
3320
3238
|
`,
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
],
|
|
3239
|
+
providers: [
|
|
3240
|
+
{
|
|
3241
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3242
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3243
|
+
multi: true
|
|
3244
|
+
},
|
|
3245
|
+
{
|
|
3246
|
+
provide: NG_VALIDATORS,
|
|
3247
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3248
|
+
multi: true
|
|
3249
|
+
}
|
|
3250
|
+
]
|
|
3251
|
+
}]
|
|
3252
|
+
}], null, { inputRef: [{
|
|
3253
|
+
type: ViewChild,
|
|
3254
|
+
args: ["inputRef", { static: true }]
|
|
3255
|
+
}], initialValue: [{
|
|
3256
|
+
type: Input
|
|
3257
|
+
}], usePreciseValidation: [{
|
|
3258
|
+
type: Input
|
|
3259
|
+
}], inputProps: [{
|
|
3260
|
+
type: Input
|
|
3261
|
+
}], disabled: [{
|
|
3262
|
+
type: Input
|
|
3263
|
+
}], initOptions: [{
|
|
3264
|
+
type: Input
|
|
3265
|
+
}], numberChange: [{
|
|
3266
|
+
type: Output
|
|
3267
|
+
}], countryChange: [{
|
|
3268
|
+
type: Output
|
|
3269
|
+
}], validityChange: [{
|
|
3270
|
+
type: Output
|
|
3271
|
+
}], errorCodeChange: [{
|
|
3272
|
+
type: Output
|
|
3273
|
+
}] });
|
|
3274
|
+
})();
|
|
3275
|
+
(() => {
|
|
3276
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber: 42 });
|
|
3277
|
+
})();
|
|
3335
3278
|
export {
|
|
3336
3279
|
IntlTelInputComponent,
|
|
3337
3280
|
PHONE_ERROR_MESSAGES,
|