intl-tel-input 25.5.0 → 25.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/angular/build/IntlTelInput.js +258 -316
- package/angular/build/IntlTelInputWithUtils.js +472 -446
- package/angular/build/intl-tel-input.js +4 -2
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +3 -3
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +3 -3
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +4 -4
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +2 -2
- package/react/build/IntlTelInput.js +2 -2
- package/react/build/IntlTelInputWithUtils.cjs +2 -2
- package/react/build/IntlTelInputWithUtils.js +2 -2
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +2 -2
- package/vue/build/IntlTelInputWithUtils.mjs +2 -2
- 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
|
@@ -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"]
|
|
@@ -1774,7 +1761,7 @@ var Iti = class {
|
|
|
1774
1761
|
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
1775
1762
|
}
|
|
1776
1763
|
}
|
|
1777
|
-
this.options.i18n = {
|
|
1764
|
+
this.options.i18n = Object.assign(Object.assign({}, en_default), this.options.i18n);
|
|
1778
1765
|
const autoCountryPromise = new Promise((resolve, reject) => {
|
|
1779
1766
|
this.resolveAutoCountryPromise = resolve;
|
|
1780
1767
|
this.rejectAutoCountryPromise = reject;
|
|
@@ -1843,19 +1830,11 @@ var Iti = class {
|
|
|
1843
1830
|
_processAllCountries() {
|
|
1844
1831
|
const { onlyCountries, excludeCountries } = this.options;
|
|
1845
1832
|
if (onlyCountries.length) {
|
|
1846
|
-
const lowerCaseOnlyCountries = onlyCountries.map(
|
|
1847
|
-
|
|
1848
|
-
);
|
|
1849
|
-
this.countries = data_default.filter(
|
|
1850
|
-
(country) => lowerCaseOnlyCountries.includes(country.iso2)
|
|
1851
|
-
);
|
|
1833
|
+
const lowerCaseOnlyCountries = onlyCountries.map((country) => country.toLowerCase());
|
|
1834
|
+
this.countries = data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
|
|
1852
1835
|
} else if (excludeCountries.length) {
|
|
1853
|
-
const lowerCaseExcludeCountries = excludeCountries.map(
|
|
1854
|
-
|
|
1855
|
-
);
|
|
1856
|
-
this.countries = data_default.filter(
|
|
1857
|
-
(country) => !lowerCaseExcludeCountries.includes(country.iso2)
|
|
1858
|
-
);
|
|
1836
|
+
const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
|
|
1837
|
+
this.countries = data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
|
|
1859
1838
|
} else {
|
|
1860
1839
|
this.countries = data_default;
|
|
1861
1840
|
}
|
|
@@ -1900,22 +1879,12 @@ var Iti = class {
|
|
|
1900
1879
|
}
|
|
1901
1880
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1902
1881
|
_generateMarkup() {
|
|
1882
|
+
var _a, _b, _c;
|
|
1903
1883
|
this.telInput.classList.add("iti__tel-input");
|
|
1904
1884
|
if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
|
|
1905
1885
|
this.telInput.setAttribute("autocomplete", "off");
|
|
1906
1886
|
}
|
|
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;
|
|
1887
|
+
const { allowDropdown, separateDialCode, showFlags, containerClass, hiddenInput, dropdownContainer, fixDropdownWidth, useFullscreenPopup, countrySearch, i18n } = this.options;
|
|
1919
1888
|
let parentClass = "iti";
|
|
1920
1889
|
if (allowDropdown) {
|
|
1921
1890
|
parentClass += " iti--allow-dropdown";
|
|
@@ -1930,62 +1899,38 @@ var Iti = class {
|
|
|
1930
1899
|
parentClass += " iti--inline-dropdown";
|
|
1931
1900
|
}
|
|
1932
1901
|
const wrapper = createEl("div", { class: parentClass });
|
|
1933
|
-
this.telInput.parentNode
|
|
1902
|
+
(_a = this.telInput.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(wrapper, this.telInput);
|
|
1934
1903
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1935
|
-
this.countryContainer = createEl(
|
|
1936
|
-
"div",
|
|
1937
|
-
{ class: "iti__country-container" },
|
|
1938
|
-
wrapper
|
|
1939
|
-
);
|
|
1904
|
+
this.countryContainer = createEl("div", { class: "iti__country-container" }, wrapper);
|
|
1940
1905
|
if (this.showSelectedCountryOnLeft) {
|
|
1941
1906
|
this.countryContainer.style.left = "0px";
|
|
1942
1907
|
} else {
|
|
1943
1908
|
this.countryContainer.style.right = "0px";
|
|
1944
1909
|
}
|
|
1945
1910
|
if (allowDropdown) {
|
|
1946
|
-
this.selectedCountry = createEl(
|
|
1947
|
-
"button",
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
"role": "combobox"
|
|
1956
|
-
},
|
|
1957
|
-
this.countryContainer
|
|
1958
|
-
);
|
|
1911
|
+
this.selectedCountry = createEl("button", {
|
|
1912
|
+
type: "button",
|
|
1913
|
+
class: "iti__selected-country",
|
|
1914
|
+
"aria-expanded": "false",
|
|
1915
|
+
"aria-label": this.options.i18n.selectedCountryAriaLabel,
|
|
1916
|
+
"aria-haspopup": "true",
|
|
1917
|
+
"aria-controls": `iti-${this.id}__dropdown-content`,
|
|
1918
|
+
"role": "combobox"
|
|
1919
|
+
}, this.countryContainer);
|
|
1959
1920
|
if (this.telInput.disabled) {
|
|
1960
1921
|
this.selectedCountry.setAttribute("disabled", "true");
|
|
1961
1922
|
}
|
|
1962
1923
|
} else {
|
|
1963
|
-
this.selectedCountry = createEl(
|
|
1964
|
-
"div",
|
|
1965
|
-
{ class: "iti__selected-country" },
|
|
1966
|
-
this.countryContainer
|
|
1967
|
-
);
|
|
1924
|
+
this.selectedCountry = createEl("div", { class: "iti__selected-country" }, this.countryContainer);
|
|
1968
1925
|
}
|
|
1969
1926
|
const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1970
1927
|
this.selectedCountryInner = createEl("div", { class: "iti__flag" }, selectedCountryPrimary);
|
|
1971
|
-
this.selectedCountryA11yText = createEl(
|
|
1972
|
-
"span",
|
|
1973
|
-
{ class: "iti__a11y-text" },
|
|
1974
|
-
this.selectedCountryInner
|
|
1975
|
-
);
|
|
1928
|
+
this.selectedCountryA11yText = createEl("span", { class: "iti__a11y-text" }, this.selectedCountryInner);
|
|
1976
1929
|
if (allowDropdown) {
|
|
1977
|
-
this.dropdownArrow = createEl(
|
|
1978
|
-
"div",
|
|
1979
|
-
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1980
|
-
selectedCountryPrimary
|
|
1981
|
-
);
|
|
1930
|
+
this.dropdownArrow = createEl("div", { class: "iti__arrow", "aria-hidden": "true" }, selectedCountryPrimary);
|
|
1982
1931
|
}
|
|
1983
1932
|
if (separateDialCode) {
|
|
1984
|
-
this.selectedDialCode = createEl(
|
|
1985
|
-
"div",
|
|
1986
|
-
{ class: "iti__selected-dial-code" },
|
|
1987
|
-
this.selectedCountry
|
|
1988
|
-
);
|
|
1933
|
+
this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", "aria-hidden": "true" }, this.selectedCountry);
|
|
1989
1934
|
}
|
|
1990
1935
|
if (allowDropdown) {
|
|
1991
1936
|
const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
@@ -1994,37 +1939,25 @@ var Iti = class {
|
|
|
1994
1939
|
class: `iti__dropdown-content iti__hide ${extraClasses}`
|
|
1995
1940
|
});
|
|
1996
1941
|
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
|
-
);
|
|
1942
|
+
this.searchInput = createEl("input", {
|
|
1943
|
+
type: "text",
|
|
1944
|
+
class: "iti__search-input",
|
|
1945
|
+
placeholder: i18n.searchPlaceholder,
|
|
1946
|
+
role: "combobox",
|
|
1947
|
+
"aria-expanded": "true",
|
|
1948
|
+
"aria-label": i18n.searchPlaceholder,
|
|
1949
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1950
|
+
"aria-autocomplete": "list",
|
|
1951
|
+
"autocomplete": "off"
|
|
1952
|
+
}, this.dropdownContent);
|
|
1953
|
+
this.searchResultsA11yText = createEl("span", { class: "iti__a11y-text" }, this.dropdownContent);
|
|
2017
1954
|
}
|
|
2018
|
-
this.countryList = createEl(
|
|
2019
|
-
"
|
|
2020
|
-
{
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
"aria-label": i18n.countryListAriaLabel
|
|
2025
|
-
},
|
|
2026
|
-
this.dropdownContent
|
|
2027
|
-
);
|
|
1955
|
+
this.countryList = createEl("ul", {
|
|
1956
|
+
class: "iti__country-list",
|
|
1957
|
+
id: `iti-${this.id}__country-listbox`,
|
|
1958
|
+
role: "listbox",
|
|
1959
|
+
"aria-label": i18n.countryListAriaLabel
|
|
1960
|
+
}, this.dropdownContent);
|
|
2028
1961
|
this._appendListItems();
|
|
2029
1962
|
if (countrySearch) {
|
|
2030
1963
|
this._updateSearchResultsText();
|
|
@@ -2052,7 +1985,7 @@ var Iti = class {
|
|
|
2052
1985
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2053
1986
|
const names = hiddenInput(telInputName);
|
|
2054
1987
|
if (names.phone) {
|
|
2055
|
-
const existingInput = this.telInput.form
|
|
1988
|
+
const existingInput = (_b = this.telInput.form) === null || _b === void 0 ? void 0 : _b.querySelector(`input[name="${names.phone}"]`);
|
|
2056
1989
|
if (existingInput) {
|
|
2057
1990
|
this.hiddenInput = existingInput;
|
|
2058
1991
|
} else {
|
|
@@ -2064,7 +1997,7 @@ var Iti = class {
|
|
|
2064
1997
|
}
|
|
2065
1998
|
}
|
|
2066
1999
|
if (names.country) {
|
|
2067
|
-
const existingInput = this.telInput.form
|
|
2000
|
+
const existingInput = (_c = this.telInput.form) === null || _c === void 0 ? void 0 : _c.querySelector(`input[name="${names.country}"]`);
|
|
2068
2001
|
if (existingInput) {
|
|
2069
2002
|
this.hiddenInputCountry = existingInput;
|
|
2070
2003
|
} else {
|
|
@@ -2082,19 +2015,15 @@ var Iti = class {
|
|
|
2082
2015
|
for (let i = 0; i < this.countries.length; i++) {
|
|
2083
2016
|
const c = this.countries[i];
|
|
2084
2017
|
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
|
-
);
|
|
2018
|
+
const listItem = createEl("li", {
|
|
2019
|
+
id: `iti-${this.id}__item-${c.iso2}`,
|
|
2020
|
+
class: `iti__country ${extraClass}`,
|
|
2021
|
+
tabindex: "-1",
|
|
2022
|
+
role: "option",
|
|
2023
|
+
"data-dial-code": c.dialCode,
|
|
2024
|
+
"data-country-code": c.iso2,
|
|
2025
|
+
"aria-selected": "false"
|
|
2026
|
+
}, this.countryList);
|
|
2098
2027
|
c.nodeById[this.id] = listItem;
|
|
2099
2028
|
let content = "";
|
|
2100
2029
|
if (this.options.showFlags) {
|
|
@@ -2148,6 +2077,7 @@ var Iti = class {
|
|
|
2148
2077
|
}
|
|
2149
2078
|
//* Update hidden input on form submit.
|
|
2150
2079
|
_initHiddenInputListener() {
|
|
2080
|
+
var _a;
|
|
2151
2081
|
this._handleHiddenInputSubmit = () => {
|
|
2152
2082
|
if (this.hiddenInput) {
|
|
2153
2083
|
this.hiddenInput.value = this.getNumber();
|
|
@@ -2156,10 +2086,7 @@ var Iti = class {
|
|
|
2156
2086
|
this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "";
|
|
2157
2087
|
}
|
|
2158
2088
|
};
|
|
2159
|
-
this.telInput.form
|
|
2160
|
-
"submit",
|
|
2161
|
-
this._handleHiddenInputSubmit
|
|
2162
|
-
);
|
|
2089
|
+
(_a = this.telInput.form) === null || _a === void 0 ? void 0 : _a.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
2163
2090
|
}
|
|
2164
2091
|
//* initialise the dropdown listeners.
|
|
2165
2092
|
_initDropdownListeners() {
|
|
@@ -2191,18 +2118,16 @@ var Iti = class {
|
|
|
2191
2118
|
this._closeDropdown();
|
|
2192
2119
|
}
|
|
2193
2120
|
};
|
|
2194
|
-
this.countryContainer.addEventListener(
|
|
2195
|
-
"keydown",
|
|
2196
|
-
this._handleCountryContainerKeydown
|
|
2197
|
-
);
|
|
2121
|
+
this.countryContainer.addEventListener("keydown", this._handleCountryContainerKeydown);
|
|
2198
2122
|
}
|
|
2199
2123
|
//* Init many requests: utils script / geo ip lookup.
|
|
2200
2124
|
_initRequests() {
|
|
2201
2125
|
let { loadUtils, initialCountry, geoIpLookup } = this.options;
|
|
2202
2126
|
if (loadUtils && !intlTelInput.utils) {
|
|
2203
2127
|
this._handlePageLoad = () => {
|
|
2128
|
+
var _a;
|
|
2204
2129
|
window.removeEventListener("load", this._handlePageLoad);
|
|
2205
|
-
intlTelInput.attachUtils(loadUtils)
|
|
2130
|
+
(_a = intlTelInput.attachUtils(loadUtils)) === null || _a === void 0 ? void 0 : _a.catch(() => {
|
|
2206
2131
|
});
|
|
2207
2132
|
};
|
|
2208
2133
|
if (intlTelInput.documentReady()) {
|
|
@@ -2227,23 +2152,20 @@ var Iti = class {
|
|
|
2227
2152
|
} else if (!intlTelInput.startedLoadingAutoCountry) {
|
|
2228
2153
|
intlTelInput.startedLoadingAutoCountry = true;
|
|
2229
2154
|
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
|
-
() => {
|
|
2155
|
+
this.options.geoIpLookup((iso2 = "") => {
|
|
2156
|
+
const iso2Lower = iso2.toLowerCase();
|
|
2157
|
+
const isValidIso2 = iso2Lower && this._getCountryData(iso2Lower, true);
|
|
2158
|
+
if (isValidIso2) {
|
|
2159
|
+
intlTelInput.autoCountry = iso2Lower;
|
|
2160
|
+
setTimeout(() => forEachInstance("handleAutoCountry"));
|
|
2161
|
+
} else {
|
|
2243
2162
|
this._setInitialState(true);
|
|
2244
2163
|
forEachInstance("rejectAutoCountryPromise");
|
|
2245
2164
|
}
|
|
2246
|
-
)
|
|
2165
|
+
}, () => {
|
|
2166
|
+
this._setInitialState(true);
|
|
2167
|
+
forEachInstance("rejectAutoCountryPromise");
|
|
2168
|
+
});
|
|
2247
2169
|
}
|
|
2248
2170
|
}
|
|
2249
2171
|
}
|
|
@@ -2260,7 +2182,7 @@ var Iti = class {
|
|
|
2260
2182
|
userOverrideFormatting = true;
|
|
2261
2183
|
}
|
|
2262
2184
|
this._handleInputEvent = (e) => {
|
|
2263
|
-
if (this.isAndroid && e
|
|
2185
|
+
if (this.isAndroid && (e === null || e === void 0 ? void 0 : e.data) === "+" && separateDialCode && allowDropdown && countrySearch) {
|
|
2264
2186
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2265
2187
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos - 1);
|
|
2266
2188
|
const valueAfterCaret = this.telInput.value.substring(currentCaretPos);
|
|
@@ -2271,19 +2193,19 @@ var Iti = class {
|
|
|
2271
2193
|
if (this._updateCountryFromNumber(this.telInput.value)) {
|
|
2272
2194
|
this._triggerCountryChange();
|
|
2273
2195
|
}
|
|
2274
|
-
const isFormattingChar = e
|
|
2275
|
-
const isPaste = e
|
|
2196
|
+
const isFormattingChar = (e === null || e === void 0 ? void 0 : e.data) && /[^+0-9]/.test(e.data);
|
|
2197
|
+
const isPaste = (e === null || e === void 0 ? void 0 : e.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2276
2198
|
if (isFormattingChar || isPaste && !strictMode) {
|
|
2277
2199
|
userOverrideFormatting = true;
|
|
2278
2200
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2279
2201
|
userOverrideFormatting = false;
|
|
2280
2202
|
}
|
|
2281
|
-
const disableFormatOnSetNumber = e
|
|
2203
|
+
const disableFormatOnSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"] && !formatOnDisplay;
|
|
2282
2204
|
if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
|
|
2283
2205
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2284
2206
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2285
2207
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
2286
|
-
const isDeleteForwards = e
|
|
2208
|
+
const isDeleteForwards = (e === null || e === void 0 ? void 0 : e.inputType) === "deleteContentForward";
|
|
2287
2209
|
const formattedValue = this._formatNumberAsYouType();
|
|
2288
2210
|
const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
|
|
2289
2211
|
this.telInput.value = formattedValue;
|
|
@@ -2374,17 +2296,16 @@ var Iti = class {
|
|
|
2374
2296
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2375
2297
|
_bindDropdownListeners() {
|
|
2376
2298
|
this._handleMouseoverCountryList = (e) => {
|
|
2377
|
-
|
|
2299
|
+
var _a;
|
|
2300
|
+
const listItem = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(".iti__country");
|
|
2378
2301
|
if (listItem) {
|
|
2379
2302
|
this._highlightListItem(listItem, false);
|
|
2380
2303
|
}
|
|
2381
2304
|
};
|
|
2382
|
-
this.countryList.addEventListener(
|
|
2383
|
-
"mouseover",
|
|
2384
|
-
this._handleMouseoverCountryList
|
|
2385
|
-
);
|
|
2305
|
+
this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
|
|
2386
2306
|
this._handleClickCountryList = (e) => {
|
|
2387
|
-
|
|
2307
|
+
var _a;
|
|
2308
|
+
const listItem = (_a = e.target) === null || _a === void 0 ? void 0 : _a.closest(".iti__country");
|
|
2388
2309
|
if (listItem) {
|
|
2389
2310
|
this._selectListItem(listItem);
|
|
2390
2311
|
}
|
|
@@ -2397,10 +2318,7 @@ var Iti = class {
|
|
|
2397
2318
|
}
|
|
2398
2319
|
isOpening = false;
|
|
2399
2320
|
};
|
|
2400
|
-
document.documentElement.addEventListener(
|
|
2401
|
-
"click",
|
|
2402
|
-
this._handleClickOffToClose
|
|
2403
|
-
);
|
|
2321
|
+
document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
2404
2322
|
let query = "";
|
|
2405
2323
|
let queryTimer = null;
|
|
2406
2324
|
this._handleKeydownOnDropdown = (e) => {
|
|
@@ -2469,16 +2387,45 @@ var Iti = class {
|
|
|
2469
2387
|
let noCountriesAddedYet = true;
|
|
2470
2388
|
this.countryList.innerHTML = "";
|
|
2471
2389
|
const normalisedQuery = normaliseString(query);
|
|
2390
|
+
const queryLength = normalisedQuery.length;
|
|
2391
|
+
const iso2Matches = [];
|
|
2392
|
+
const nameStartWith = [];
|
|
2393
|
+
const nameContains = [];
|
|
2394
|
+
const dialCodeMatches = [];
|
|
2395
|
+
const dialCodeContains = [];
|
|
2396
|
+
const initialsMatches = [];
|
|
2472
2397
|
for (let i = 0; i < this.countries.length; i++) {
|
|
2473
2398
|
const c = this.countries[i];
|
|
2474
2399
|
const normalisedCountryName = normaliseString(c.name);
|
|
2475
2400
|
const countryInitials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2401
|
+
if (isReset || queryLength === 0) {
|
|
2402
|
+
nameContains.push(c);
|
|
2403
|
+
} else if (c.iso2.toLowerCase() === normalisedQuery) {
|
|
2404
|
+
iso2Matches.push(c);
|
|
2405
|
+
} else if (normalisedCountryName.startsWith(normalisedQuery)) {
|
|
2406
|
+
nameStartWith.push(c);
|
|
2407
|
+
} else if (normalisedCountryName.includes(normalisedQuery)) {
|
|
2408
|
+
nameContains.push(c);
|
|
2409
|
+
} else if (normalisedQuery === c.dialCode || normalisedQuery === `+${c.dialCode}`) {
|
|
2410
|
+
dialCodeMatches.push(c);
|
|
2411
|
+
} else if (`+${c.dialCode}`.includes(normalisedQuery)) {
|
|
2412
|
+
dialCodeContains.push(c);
|
|
2413
|
+
} else if (countryInitials.includes(normalisedQuery)) {
|
|
2414
|
+
initialsMatches.push(c);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
const matchedCountries = [
|
|
2418
|
+
...iso2Matches.sort((a, b) => a.priority - b.priority),
|
|
2419
|
+
...nameStartWith.sort((a, b) => a.priority - b.priority),
|
|
2420
|
+
...nameContains.sort((a, b) => a.priority - b.priority),
|
|
2421
|
+
...dialCodeMatches.sort((a, b) => a.priority - b.priority),
|
|
2422
|
+
...dialCodeContains.sort((a, b) => a.priority - b.priority),
|
|
2423
|
+
...initialsMatches.sort((a, b) => a.priority - b.priority)
|
|
2424
|
+
];
|
|
2425
|
+
for (const c of matchedCountries) {
|
|
2426
|
+
const listItem = c.nodeById[this.id];
|
|
2427
|
+
if (listItem) {
|
|
2428
|
+
this.countryList.appendChild(listItem);
|
|
2482
2429
|
if (noCountriesAddedYet) {
|
|
2483
2430
|
this._highlightListItem(listItem, false);
|
|
2484
2431
|
noCountriesAddedYet = false;
|
|
@@ -2511,7 +2458,8 @@ var Iti = class {
|
|
|
2511
2458
|
}
|
|
2512
2459
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2513
2460
|
_handleUpDownKey(key) {
|
|
2514
|
-
|
|
2461
|
+
var _a, _b;
|
|
2462
|
+
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
2463
|
if (!next && this.countryList.childElementCount > 1) {
|
|
2516
2464
|
next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild;
|
|
2517
2465
|
}
|
|
@@ -2534,11 +2482,7 @@ var Iti = class {
|
|
|
2534
2482
|
const useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode;
|
|
2535
2483
|
const { NATIONAL, INTERNATIONAL } = intlTelInput.utils.numberFormat;
|
|
2536
2484
|
const format = useNational ? NATIONAL : INTERNATIONAL;
|
|
2537
|
-
number = intlTelInput.utils.formatNumber(
|
|
2538
|
-
number,
|
|
2539
|
-
this.selectedCountryData.iso2,
|
|
2540
|
-
format
|
|
2541
|
-
);
|
|
2485
|
+
number = intlTelInput.utils.formatNumber(number, this.selectedCountryData.iso2, format);
|
|
2542
2486
|
}
|
|
2543
2487
|
number = this._beforeSetNumber(number);
|
|
2544
2488
|
this.telInput.value = number;
|
|
@@ -2681,12 +2625,7 @@ var Iti = class {
|
|
|
2681
2625
|
if (strictMode && intlTelInput.utils) {
|
|
2682
2626
|
if (iso2) {
|
|
2683
2627
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2684
|
-
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
2685
|
-
iso2,
|
|
2686
|
-
false,
|
|
2687
|
-
numberType,
|
|
2688
|
-
true
|
|
2689
|
-
);
|
|
2628
|
+
let exampleNumber = intlTelInput.utils.getExampleNumber(iso2, false, numberType, true);
|
|
2690
2629
|
let validNumber = exampleNumber;
|
|
2691
2630
|
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2, validationNumberTypes)) {
|
|
2692
2631
|
validNumber = exampleNumber;
|
|
@@ -2737,20 +2676,11 @@ var Iti = class {
|
|
|
2737
2676
|
}
|
|
2738
2677
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2739
2678
|
_updatePlaceholder() {
|
|
2740
|
-
const {
|
|
2741
|
-
autoPlaceholder,
|
|
2742
|
-
placeholderNumberType,
|
|
2743
|
-
nationalMode,
|
|
2744
|
-
customPlaceholder
|
|
2745
|
-
} = this.options;
|
|
2679
|
+
const { autoPlaceholder, placeholderNumberType, nationalMode, customPlaceholder } = this.options;
|
|
2746
2680
|
const shouldSetPlaceholder = autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && autoPlaceholder === "polite";
|
|
2747
2681
|
if (intlTelInput.utils && shouldSetPlaceholder) {
|
|
2748
2682
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
2749
|
-
let placeholder = this.selectedCountryData.iso2 ? intlTelInput.utils.getExampleNumber(
|
|
2750
|
-
this.selectedCountryData.iso2,
|
|
2751
|
-
nationalMode,
|
|
2752
|
-
numberType
|
|
2753
|
-
) : "";
|
|
2683
|
+
let placeholder = this.selectedCountryData.iso2 ? intlTelInput.utils.getExampleNumber(this.selectedCountryData.iso2, nationalMode, numberType) : "";
|
|
2754
2684
|
placeholder = this._beforeSetNumber(placeholder);
|
|
2755
2685
|
if (typeof customPlaceholder === "function") {
|
|
2756
2686
|
placeholder = customPlaceholder(placeholder, this.selectedCountryData);
|
|
@@ -2760,9 +2690,7 @@ var Iti = class {
|
|
|
2760
2690
|
}
|
|
2761
2691
|
//* Called when the user selects a list item from the dropdown.
|
|
2762
2692
|
_selectListItem(listItem) {
|
|
2763
|
-
const countryChanged = this._setCountry(
|
|
2764
|
-
listItem.getAttribute("data-country-code")
|
|
2765
|
-
);
|
|
2693
|
+
const countryChanged = this._setCountry(listItem.getAttribute("data-country-code"));
|
|
2766
2694
|
this._closeDropdown();
|
|
2767
2695
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2768
2696
|
this.telInput.focus();
|
|
@@ -2786,14 +2714,8 @@ var Iti = class {
|
|
|
2786
2714
|
if (this.options.countrySearch) {
|
|
2787
2715
|
this.searchInput.removeEventListener("input", this._handleSearchChange);
|
|
2788
2716
|
}
|
|
2789
|
-
document.documentElement.removeEventListener(
|
|
2790
|
-
|
|
2791
|
-
this._handleClickOffToClose
|
|
2792
|
-
);
|
|
2793
|
-
this.countryList.removeEventListener(
|
|
2794
|
-
"mouseover",
|
|
2795
|
-
this._handleMouseoverCountryList
|
|
2796
|
-
);
|
|
2717
|
+
document.documentElement.removeEventListener("click", this._handleClickOffToClose);
|
|
2718
|
+
this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
|
|
2797
2719
|
this.countryList.removeEventListener("click", this._handleClickCountryList);
|
|
2798
2720
|
if (this.options.dropdownContainer) {
|
|
2799
2721
|
if (!this.options.useFullscreenPopup) {
|
|
@@ -2943,18 +2865,13 @@ var Iti = class {
|
|
|
2943
2865
|
//********************
|
|
2944
2866
|
//* Remove plugin.
|
|
2945
2867
|
destroy() {
|
|
2868
|
+
var _a, _b;
|
|
2946
2869
|
this.telInput.iti = void 0;
|
|
2947
2870
|
const { allowDropdown, separateDialCode } = this.options;
|
|
2948
2871
|
if (allowDropdown) {
|
|
2949
2872
|
this._closeDropdown();
|
|
2950
|
-
this.selectedCountry.removeEventListener(
|
|
2951
|
-
|
|
2952
|
-
this._handleClickSelectedCountry
|
|
2953
|
-
);
|
|
2954
|
-
this.countryContainer.removeEventListener(
|
|
2955
|
-
"keydown",
|
|
2956
|
-
this._handleCountryContainerKeydown
|
|
2957
|
-
);
|
|
2873
|
+
this.selectedCountry.removeEventListener("click", this._handleClickSelectedCountry);
|
|
2874
|
+
this.countryContainer.removeEventListener("keydown", this._handleCountryContainerKeydown);
|
|
2958
2875
|
const label = this.telInput.closest("label");
|
|
2959
2876
|
if (label) {
|
|
2960
2877
|
label.removeEventListener("click", this._handleLabelClick);
|
|
@@ -2977,17 +2894,14 @@ var Iti = class {
|
|
|
2977
2894
|
}
|
|
2978
2895
|
}
|
|
2979
2896
|
const wrapper = this.telInput.parentNode;
|
|
2980
|
-
wrapper
|
|
2981
|
-
wrapper
|
|
2897
|
+
(_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.telInput, wrapper);
|
|
2898
|
+
(_b = wrapper === null || wrapper === void 0 ? void 0 : wrapper.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(wrapper);
|
|
2982
2899
|
delete intlTelInput.instances[this.id];
|
|
2983
2900
|
}
|
|
2984
2901
|
//* Get the extension from the current number.
|
|
2985
2902
|
getExtension() {
|
|
2986
2903
|
if (intlTelInput.utils) {
|
|
2987
|
-
return intlTelInput.utils.getExtension(
|
|
2988
|
-
this._getFullNumber(),
|
|
2989
|
-
this.selectedCountryData.iso2
|
|
2990
|
-
);
|
|
2904
|
+
return intlTelInput.utils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
2991
2905
|
}
|
|
2992
2906
|
return "";
|
|
2993
2907
|
}
|
|
@@ -2995,21 +2909,14 @@ var Iti = class {
|
|
|
2995
2909
|
getNumber(format) {
|
|
2996
2910
|
if (intlTelInput.utils) {
|
|
2997
2911
|
const { iso2 } = this.selectedCountryData;
|
|
2998
|
-
return intlTelInput.utils.formatNumber(
|
|
2999
|
-
this._getFullNumber(),
|
|
3000
|
-
iso2,
|
|
3001
|
-
format
|
|
3002
|
-
);
|
|
2912
|
+
return intlTelInput.utils.formatNumber(this._getFullNumber(), iso2, format);
|
|
3003
2913
|
}
|
|
3004
2914
|
return "";
|
|
3005
2915
|
}
|
|
3006
2916
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
3007
2917
|
getNumberType() {
|
|
3008
2918
|
if (intlTelInput.utils) {
|
|
3009
|
-
return intlTelInput.utils.getNumberType(
|
|
3010
|
-
this._getFullNumber(),
|
|
3011
|
-
this.selectedCountryData.iso2
|
|
3012
|
-
);
|
|
2919
|
+
return intlTelInput.utils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3013
2920
|
}
|
|
3014
2921
|
return -99;
|
|
3015
2922
|
}
|
|
@@ -3063,7 +2970,7 @@ var Iti = class {
|
|
|
3063
2970
|
}
|
|
3064
2971
|
//* Update the selected country, and update the input val accordingly.
|
|
3065
2972
|
setCountry(iso2) {
|
|
3066
|
-
const iso2Lower = iso2
|
|
2973
|
+
const iso2Lower = iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase();
|
|
3067
2974
|
const currentCountry = this.selectedCountryData.iso2;
|
|
3068
2975
|
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
3069
2976
|
if (isCountryChange) {
|
|
@@ -3109,7 +3016,7 @@ var attachUtils = (source) => {
|
|
|
3109
3016
|
}
|
|
3110
3017
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3111
3018
|
return loadCall.then((module) => {
|
|
3112
|
-
const utils = module
|
|
3019
|
+
const utils = module === null || module === void 0 ? void 0 : module.default;
|
|
3113
3020
|
if (!utils || typeof utils !== "object") {
|
|
3114
3021
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
3115
3022
|
}
|
|
@@ -3123,39 +3030,38 @@ var attachUtils = (source) => {
|
|
|
3123
3030
|
}
|
|
3124
3031
|
return null;
|
|
3125
3032
|
};
|
|
3126
|
-
var intlTelInput = Object.assign(
|
|
3127
|
-
(input, options)
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3033
|
+
var intlTelInput = Object.assign((input, options) => {
|
|
3034
|
+
const iti = new Iti(input, options);
|
|
3035
|
+
iti._init();
|
|
3036
|
+
input.setAttribute("data-intl-tel-input-id", iti.id.toString());
|
|
3037
|
+
intlTelInput.instances[iti.id] = iti;
|
|
3038
|
+
input.iti = iti;
|
|
3039
|
+
return iti;
|
|
3040
|
+
}, {
|
|
3041
|
+
defaults,
|
|
3042
|
+
//* Using a static var like this allows us to mock it in the tests.
|
|
3043
|
+
documentReady: () => document.readyState === "complete",
|
|
3044
|
+
//* Get the country data object.
|
|
3045
|
+
getCountryData: () => data_default,
|
|
3046
|
+
//* A getter for the plugin instance.
|
|
3047
|
+
getInstance: (input) => {
|
|
3048
|
+
const id2 = input.getAttribute("data-intl-tel-input-id");
|
|
3049
|
+
return id2 ? intlTelInput.instances[id2] : null;
|
|
3134
3050
|
},
|
|
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
|
-
);
|
|
3051
|
+
//* A map from instance ID to instance object.
|
|
3052
|
+
instances: {},
|
|
3053
|
+
attachUtils,
|
|
3054
|
+
startedLoadingUtilsScript: false,
|
|
3055
|
+
startedLoadingAutoCountry: false,
|
|
3056
|
+
version: "25.5.1"
|
|
3057
|
+
});
|
|
3154
3058
|
var intl_tel_input_default = intlTelInput;
|
|
3155
3059
|
|
|
3156
|
-
// angular/
|
|
3157
|
-
import { Component, Input, ViewChild, Output, EventEmitter, forwardRef } from "@angular/core";
|
|
3060
|
+
// angular/build/temp/intl-tel-input/angular.js
|
|
3061
|
+
import { Component, Input, ViewChild, ElementRef, Output, EventEmitter, forwardRef } from "@angular/core";
|
|
3158
3062
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from "@angular/forms";
|
|
3063
|
+
import * as i0 from "@angular/core";
|
|
3064
|
+
var _c0 = ["inputRef"];
|
|
3159
3065
|
var PHONE_ERROR_MESSAGES = [
|
|
3160
3066
|
"invalid",
|
|
3161
3067
|
"invalid-country-code",
|
|
@@ -3176,13 +3082,10 @@ var IntlTelInputComponent = class {
|
|
|
3176
3082
|
this.errorCodeChange = new EventEmitter();
|
|
3177
3083
|
this.iti = null;
|
|
3178
3084
|
this.countryChangeHandler = () => this.handleInput();
|
|
3179
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3180
3085
|
this.onChange = () => {
|
|
3181
3086
|
};
|
|
3182
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3183
3087
|
this.onTouched = () => {
|
|
3184
3088
|
};
|
|
3185
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3186
3089
|
this.onValidatorChange = () => {
|
|
3187
3090
|
};
|
|
3188
3091
|
}
|
|
@@ -3199,12 +3102,14 @@ var IntlTelInputComponent = class {
|
|
|
3199
3102
|
}
|
|
3200
3103
|
}
|
|
3201
3104
|
ngAfterViewInit() {
|
|
3105
|
+
var _a;
|
|
3202
3106
|
if (this.initialValue) {
|
|
3203
|
-
this.iti
|
|
3107
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setNumber(this.initialValue);
|
|
3204
3108
|
}
|
|
3205
3109
|
}
|
|
3206
3110
|
handleInput() {
|
|
3207
|
-
if (!this.iti)
|
|
3111
|
+
if (!this.iti)
|
|
3112
|
+
return;
|
|
3208
3113
|
const num = this.iti.getNumber() || "";
|
|
3209
3114
|
const countryIso = this.iti.getSelectedCountryData().iso2 || "";
|
|
3210
3115
|
this.numberChange.emit(num);
|
|
@@ -3230,7 +3135,8 @@ var IntlTelInputComponent = class {
|
|
|
3230
3135
|
return this.inputRef.nativeElement;
|
|
3231
3136
|
}
|
|
3232
3137
|
ngOnDestroy() {
|
|
3233
|
-
|
|
3138
|
+
var _a;
|
|
3139
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3234
3140
|
this.inputRef.nativeElement.removeEventListener("countrychange", this.countryChangeHandler);
|
|
3235
3141
|
}
|
|
3236
3142
|
applyInputProps() {
|
|
@@ -3275,41 +3181,52 @@ var IntlTelInputComponent = class {
|
|
|
3275
3181
|
this.onValidatorChange = fn;
|
|
3276
3182
|
}
|
|
3277
3183
|
};
|
|
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
|
-
|
|
3184
|
+
IntlTelInputComponent.\u0275fac = function IntlTelInputComponent_Factory(__ngFactoryType__) {
|
|
3185
|
+
return new (__ngFactoryType__ || IntlTelInputComponent)();
|
|
3186
|
+
};
|
|
3187
|
+
IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent({ type: IntlTelInputComponent, selectors: [["intl-tel-input"]], viewQuery: function IntlTelInputComponent_Query(rf, ctx) {
|
|
3188
|
+
if (rf & 1) {
|
|
3189
|
+
i0.\u0275\u0275viewQuery(_c0, 7);
|
|
3190
|
+
}
|
|
3191
|
+
if (rf & 2) {
|
|
3192
|
+
let _t;
|
|
3193
|
+
i0.\u0275\u0275queryRefresh(_t = i0.\u0275\u0275loadQuery()) && (ctx.inputRef = _t.first);
|
|
3194
|
+
}
|
|
3195
|
+
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3196
|
+
{
|
|
3197
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3198
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3199
|
+
multi: true
|
|
3200
|
+
},
|
|
3201
|
+
{
|
|
3202
|
+
provide: NG_VALIDATORS,
|
|
3203
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3204
|
+
multi: true
|
|
3205
|
+
}
|
|
3206
|
+
])], decls: 2, vars: 1, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur", "disabled"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3207
|
+
if (rf & 1) {
|
|
3208
|
+
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
3209
|
+
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
3210
|
+
i0.\u0275\u0275listener("input", function IntlTelInputComponent_Template_input_input_0_listener() {
|
|
3211
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
3212
|
+
return i0.\u0275\u0275resetView(ctx.handleInput());
|
|
3213
|
+
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener() {
|
|
3214
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
3215
|
+
return i0.\u0275\u0275resetView(ctx.handleBlur());
|
|
3216
|
+
});
|
|
3217
|
+
i0.\u0275\u0275elementEnd();
|
|
3218
|
+
}
|
|
3219
|
+
if (rf & 2) {
|
|
3220
|
+
i0.\u0275\u0275property("disabled", ctx.disabled);
|
|
3221
|
+
}
|
|
3222
|
+
}, encapsulation: 2 });
|
|
3223
|
+
(() => {
|
|
3224
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassMetadata(IntlTelInputComponent, [{
|
|
3225
|
+
type: Component,
|
|
3226
|
+
args: [{
|
|
3227
|
+
selector: "intl-tel-input",
|
|
3228
|
+
standalone: true,
|
|
3229
|
+
template: `
|
|
3313
3230
|
<input
|
|
3314
3231
|
type="tel"
|
|
3315
3232
|
#inputRef
|
|
@@ -3318,20 +3235,45 @@ IntlTelInputComponent = __decorateClass([
|
|
|
3318
3235
|
[disabled]="disabled"
|
|
3319
3236
|
/>
|
|
3320
3237
|
`,
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
],
|
|
3238
|
+
providers: [
|
|
3239
|
+
{
|
|
3240
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3241
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3242
|
+
multi: true
|
|
3243
|
+
},
|
|
3244
|
+
{
|
|
3245
|
+
provide: NG_VALIDATORS,
|
|
3246
|
+
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3247
|
+
multi: true
|
|
3248
|
+
}
|
|
3249
|
+
]
|
|
3250
|
+
}]
|
|
3251
|
+
}], null, { inputRef: [{
|
|
3252
|
+
type: ViewChild,
|
|
3253
|
+
args: ["inputRef", { static: true }]
|
|
3254
|
+
}], initialValue: [{
|
|
3255
|
+
type: Input
|
|
3256
|
+
}], usePreciseValidation: [{
|
|
3257
|
+
type: Input
|
|
3258
|
+
}], inputProps: [{
|
|
3259
|
+
type: Input
|
|
3260
|
+
}], disabled: [{
|
|
3261
|
+
type: Input
|
|
3262
|
+
}], initOptions: [{
|
|
3263
|
+
type: Input
|
|
3264
|
+
}], numberChange: [{
|
|
3265
|
+
type: Output
|
|
3266
|
+
}], countryChange: [{
|
|
3267
|
+
type: Output
|
|
3268
|
+
}], validityChange: [{
|
|
3269
|
+
type: Output
|
|
3270
|
+
}], errorCodeChange: [{
|
|
3271
|
+
type: Output
|
|
3272
|
+
}] });
|
|
3273
|
+
})();
|
|
3274
|
+
(() => {
|
|
3275
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber: 42 });
|
|
3276
|
+
})();
|
|
3335
3277
|
export {
|
|
3336
3278
|
IntlTelInputComponent,
|
|
3337
3279
|
PHONE_ERROR_MESSAGES,
|