intl-tel-input 25.0.0 → 25.0.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 +9 -9
- package/build/js/data.js +3 -3
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +5 -1
- package/build/js/intlTelInput.js +58 -19
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +58 -19
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +57 -18
- package/react/build/IntlTelInput.d.ts +5 -1
- package/react/build/IntlTelInput.js +57 -18
- package/react/build/IntlTelInputWithUtils.cjs +57 -18
- package/react/build/IntlTelInputWithUtils.js +57 -18
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +327 -314
- package/vue/build/IntlTelInputWithUtils.mjs +450 -437
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v25.0.
|
|
2
|
+
* International Telephone Input v25.0.2
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -49,8 +49,7 @@ var factoryOutput = (() => {
|
|
|
49
49
|
"ax",
|
|
50
50
|
// Åland Islands
|
|
51
51
|
"358",
|
|
52
|
-
1
|
|
53
|
-
["18"]
|
|
52
|
+
1
|
|
54
53
|
],
|
|
55
54
|
[
|
|
56
55
|
"al",
|
|
@@ -1356,6 +1355,7 @@ var factoryOutput = (() => {
|
|
|
1356
1355
|
dialCode: c[1],
|
|
1357
1356
|
priority: c[2] || 0,
|
|
1358
1357
|
areaCodes: c[3] || null,
|
|
1358
|
+
partialAreaCodes: null,
|
|
1359
1359
|
nodeById: {}
|
|
1360
1360
|
};
|
|
1361
1361
|
}
|
|
@@ -1880,7 +1880,7 @@ var factoryOutput = (() => {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
|
-
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1883
|
+
//* Generate this.dialCodes and this.dialCodeToIso2Map and country.partialAreaCodes.
|
|
1884
1884
|
_processDialCodes() {
|
|
1885
1885
|
this.dialCodes = {};
|
|
1886
1886
|
this.dialCodeMaxLen = 0;
|
|
@@ -1899,9 +1899,16 @@ var factoryOutput = (() => {
|
|
|
1899
1899
|
for (let j = 0; j < c.areaCodes.length; j++) {
|
|
1900
1900
|
const areaCode = c.areaCodes[j];
|
|
1901
1901
|
for (let k = 1; k < areaCode.length; k++) {
|
|
1902
|
-
const
|
|
1902
|
+
const partialAreaCode = areaCode.substr(0, k);
|
|
1903
|
+
const partialDialCode = c.dialCode + partialAreaCode;
|
|
1903
1904
|
this._addToDialCodeMap(rootIso2Code, partialDialCode);
|
|
1904
1905
|
this._addToDialCodeMap(c.iso2, partialDialCode);
|
|
1906
|
+
if (!c.partialAreaCodes) {
|
|
1907
|
+
c.partialAreaCodes = [];
|
|
1908
|
+
}
|
|
1909
|
+
if (!c.partialAreaCodes.includes(partialAreaCode)) {
|
|
1910
|
+
c.partialAreaCodes.push(partialAreaCode);
|
|
1911
|
+
}
|
|
1905
1912
|
}
|
|
1906
1913
|
this._addToDialCodeMap(c.iso2, c.dialCode + areaCode);
|
|
1907
1914
|
}
|
|
@@ -2059,18 +2066,28 @@ var factoryOutput = (() => {
|
|
|
2059
2066
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2060
2067
|
const names = hiddenInput(telInputName);
|
|
2061
2068
|
if (names.phone) {
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2069
|
+
const existingInput = this.telInput.form?.querySelector(`input[name="${names.phone}"]`);
|
|
2070
|
+
if (existingInput) {
|
|
2071
|
+
this.hiddenInput = existingInput;
|
|
2072
|
+
} else {
|
|
2073
|
+
this.hiddenInput = createEl("input", {
|
|
2074
|
+
type: "hidden",
|
|
2075
|
+
name: names.phone
|
|
2076
|
+
});
|
|
2077
|
+
wrapper.appendChild(this.hiddenInput);
|
|
2078
|
+
}
|
|
2067
2079
|
}
|
|
2068
2080
|
if (names.country) {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2081
|
+
const existingInput = this.telInput.form?.querySelector(`input[name="${names.country}"]`);
|
|
2082
|
+
if (existingInput) {
|
|
2083
|
+
this.hiddenInputCountry = existingInput;
|
|
2084
|
+
} else {
|
|
2085
|
+
this.hiddenInputCountry = createEl("input", {
|
|
2086
|
+
type: "hidden",
|
|
2087
|
+
name: names.country
|
|
2088
|
+
});
|
|
2089
|
+
wrapper.appendChild(this.hiddenInputCountry);
|
|
2090
|
+
}
|
|
2074
2091
|
}
|
|
2075
2092
|
}
|
|
2076
2093
|
}
|
|
@@ -2549,6 +2566,19 @@ var factoryOutput = (() => {
|
|
|
2549
2566
|
}
|
|
2550
2567
|
return false;
|
|
2551
2568
|
}
|
|
2569
|
+
//* Check if the given number matches an area code from the selected country.
|
|
2570
|
+
_isAreaCodeMatch(numeric, dialCodeNumerics) {
|
|
2571
|
+
const { areaCodes, partialAreaCodes, dialCode } = this.selectedCountryData;
|
|
2572
|
+
const typedNumber = numeric.substring(dialCode.length);
|
|
2573
|
+
const typedAreaCode = dialCodeNumerics.substring(dialCode.length);
|
|
2574
|
+
if (areaCodes.includes(typedAreaCode)) {
|
|
2575
|
+
return true;
|
|
2576
|
+
}
|
|
2577
|
+
if (partialAreaCodes.includes(typedNumber)) {
|
|
2578
|
+
return true;
|
|
2579
|
+
}
|
|
2580
|
+
return false;
|
|
2581
|
+
}
|
|
2552
2582
|
_getCountryFromNumber(fullNumber) {
|
|
2553
2583
|
const plusIndex = fullNumber.indexOf("+");
|
|
2554
2584
|
let number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
|
|
@@ -2566,10 +2596,19 @@ var factoryOutput = (() => {
|
|
|
2566
2596
|
const dialCode = this._getDialCode(number, true);
|
|
2567
2597
|
const numeric = getNumeric(number);
|
|
2568
2598
|
if (dialCode) {
|
|
2569
|
-
const
|
|
2570
|
-
const
|
|
2599
|
+
const dialCodeNumerics = getNumeric(dialCode);
|
|
2600
|
+
const iso2Codes = this.dialCodeToIso2Map[dialCodeNumerics];
|
|
2601
|
+
const alreadySelected = this.selectedCountryData.iso2 && iso2Codes.includes(this.selectedCountryData.iso2);
|
|
2602
|
+
let areaCodeMatch = false;
|
|
2603
|
+
if (alreadySelected) {
|
|
2604
|
+
if (this.selectedCountryData.areaCodes && numeric.length > selectedDialCode.length) {
|
|
2605
|
+
areaCodeMatch = this._isAreaCodeMatch(numeric, dialCodeNumerics);
|
|
2606
|
+
} else {
|
|
2607
|
+
areaCodeMatch = true;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2571
2610
|
const isRegionlessNanpNumber = selectedDialCode === "1" && isRegionlessNanp(numeric);
|
|
2572
|
-
if (!isRegionlessNanpNumber && !alreadySelected) {
|
|
2611
|
+
if (!isRegionlessNanpNumber && (!alreadySelected || !areaCodeMatch)) {
|
|
2573
2612
|
for (let j = 0; j < iso2Codes.length; j++) {
|
|
2574
2613
|
if (iso2Codes[j]) {
|
|
2575
2614
|
return iso2Codes[j];
|
|
@@ -3133,7 +3172,7 @@ var factoryOutput = (() => {
|
|
|
3133
3172
|
attachUtils,
|
|
3134
3173
|
startedLoadingUtilsScript: false,
|
|
3135
3174
|
startedLoadingAutoCountry: false,
|
|
3136
|
-
version: "25.0.
|
|
3175
|
+
version: "25.0.2"
|
|
3137
3176
|
}
|
|
3138
3177
|
);
|
|
3139
3178
|
var intl_tel_input_default = intlTelInput;
|