intl-tel-input 25.8.2 → 25.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +9 -23
- package/angular/build/IntlTelInputWithUtils.js +9 -23
- package/angular/build/types/intl-tel-input.d.ts +0 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +0 -1
- package/build/js/intlTelInput.js +10 -24
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +10 -24
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +9 -23
- package/react/build/IntlTelInput.d.ts +0 -1
- package/react/build/IntlTelInput.js +9 -23
- package/react/build/IntlTelInputWithUtils.cjs +9 -23
- package/react/build/IntlTelInputWithUtils.js +9 -23
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +70 -75
- package/vue/build/IntlTelInputWithUtils.mjs +75 -80
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -28,7 +28,7 @@ import "intl-tel-input/styles";
|
|
|
28
28
|
|
|
29
29
|
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/react/demo/validation/ValidationApp.tsx) for a more fleshed-out example of how to handle validation.
|
|
30
30
|
|
|
31
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/reactWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.
|
|
31
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/reactWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.3/build/js/utils.js"`.
|
|
32
32
|
|
|
33
33
|
## Props
|
|
34
34
|
Here's a list of all of the current props you can pass to the IntlTelInput React component.
|
|
@@ -2026,7 +2026,7 @@ var Iti = class _Iti {
|
|
|
2026
2026
|
if (separateDialCode) {
|
|
2027
2027
|
this.selectedDialCode = createEl(
|
|
2028
2028
|
"div",
|
|
2029
|
-
{ class: "iti__selected-dial-code",
|
|
2029
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
2030
2030
|
this.selectedCountry
|
|
2031
2031
|
);
|
|
2032
2032
|
}
|
|
@@ -2773,20 +2773,20 @@ var Iti = class _Iti {
|
|
|
2773
2773
|
if (this.selectedCountryData.iso2) {
|
|
2774
2774
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2775
2775
|
}
|
|
2776
|
-
if (this.
|
|
2777
|
-
|
|
2778
|
-
let ariaLabel
|
|
2779
|
-
if (iso2
|
|
2780
|
-
|
|
2776
|
+
if (this.selectedCountry) {
|
|
2777
|
+
const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
|
|
2778
|
+
let ariaLabel, title;
|
|
2779
|
+
if (iso2) {
|
|
2780
|
+
title = this.selectedCountryData.name;
|
|
2781
2781
|
ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
|
|
2782
2782
|
} else {
|
|
2783
|
-
|
|
2783
|
+
title = i18n.noCountrySelected;
|
|
2784
2784
|
ariaLabel = i18n.noCountrySelected;
|
|
2785
2785
|
}
|
|
2786
2786
|
this.selectedCountryInner.className = flagClass;
|
|
2787
|
+
this.selectedCountry.setAttribute("title", title);
|
|
2787
2788
|
this.selectedCountry.setAttribute("aria-label", ariaLabel);
|
|
2788
2789
|
}
|
|
2789
|
-
this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
|
|
2790
2790
|
if (separateDialCode) {
|
|
2791
2791
|
const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2792
2792
|
this.selectedDialCode.innerHTML = dialCode;
|
|
@@ -2836,20 +2836,6 @@ var Iti = class _Iti {
|
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
2838
2838
|
}
|
|
2839
|
-
_setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
|
|
2840
|
-
if (!this.selectedCountry) {
|
|
2841
|
-
return;
|
|
2842
|
-
}
|
|
2843
|
-
let title;
|
|
2844
|
-
if (iso2 && !separateDialCode) {
|
|
2845
|
-
title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
|
|
2846
|
-
} else if (iso2) {
|
|
2847
|
-
title = this.selectedCountryData.name;
|
|
2848
|
-
} else {
|
|
2849
|
-
title = this.options.i18n.noCountrySelected;
|
|
2850
|
-
}
|
|
2851
|
-
this.selectedCountry.setAttribute("title", title);
|
|
2852
|
-
}
|
|
2853
2839
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2854
2840
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2855
2841
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -3275,7 +3261,7 @@ var intlTelInput = Object.assign(
|
|
|
3275
3261
|
attachUtils,
|
|
3276
3262
|
startedLoadingUtilsScript: false,
|
|
3277
3263
|
startedLoadingAutoCountry: false,
|
|
3278
|
-
version: "25.8.
|
|
3264
|
+
version: "25.8.3"
|
|
3279
3265
|
}
|
|
3280
3266
|
);
|
|
3281
3267
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -470,7 +470,6 @@ declare module "intl-tel-input" {
|
|
|
470
470
|
private _setCountry;
|
|
471
471
|
private _updateInputPadding;
|
|
472
472
|
private _updateMaxLength;
|
|
473
|
-
private _setSelectedCountryTitleAttribute;
|
|
474
473
|
private _getHiddenSelectedCountryWidth;
|
|
475
474
|
private _updatePlaceholder;
|
|
476
475
|
private _selectListItem;
|
|
@@ -1990,7 +1990,7 @@ var Iti = class _Iti {
|
|
|
1990
1990
|
if (separateDialCode) {
|
|
1991
1991
|
this.selectedDialCode = createEl(
|
|
1992
1992
|
"div",
|
|
1993
|
-
{ class: "iti__selected-dial-code",
|
|
1993
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1994
1994
|
this.selectedCountry
|
|
1995
1995
|
);
|
|
1996
1996
|
}
|
|
@@ -2737,20 +2737,20 @@ var Iti = class _Iti {
|
|
|
2737
2737
|
if (this.selectedCountryData.iso2) {
|
|
2738
2738
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2739
2739
|
}
|
|
2740
|
-
if (this.
|
|
2741
|
-
|
|
2742
|
-
let ariaLabel
|
|
2743
|
-
if (iso2
|
|
2744
|
-
|
|
2740
|
+
if (this.selectedCountry) {
|
|
2741
|
+
const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
|
|
2742
|
+
let ariaLabel, title;
|
|
2743
|
+
if (iso2) {
|
|
2744
|
+
title = this.selectedCountryData.name;
|
|
2745
2745
|
ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
|
|
2746
2746
|
} else {
|
|
2747
|
-
|
|
2747
|
+
title = i18n.noCountrySelected;
|
|
2748
2748
|
ariaLabel = i18n.noCountrySelected;
|
|
2749
2749
|
}
|
|
2750
2750
|
this.selectedCountryInner.className = flagClass;
|
|
2751
|
+
this.selectedCountry.setAttribute("title", title);
|
|
2751
2752
|
this.selectedCountry.setAttribute("aria-label", ariaLabel);
|
|
2752
2753
|
}
|
|
2753
|
-
this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
|
|
2754
2754
|
if (separateDialCode) {
|
|
2755
2755
|
const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2756
2756
|
this.selectedDialCode.innerHTML = dialCode;
|
|
@@ -2800,20 +2800,6 @@ var Iti = class _Iti {
|
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
2802
|
}
|
|
2803
|
-
_setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
|
|
2804
|
-
if (!this.selectedCountry) {
|
|
2805
|
-
return;
|
|
2806
|
-
}
|
|
2807
|
-
let title;
|
|
2808
|
-
if (iso2 && !separateDialCode) {
|
|
2809
|
-
title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
|
|
2810
|
-
} else if (iso2) {
|
|
2811
|
-
title = this.selectedCountryData.name;
|
|
2812
|
-
} else {
|
|
2813
|
-
title = this.options.i18n.noCountrySelected;
|
|
2814
|
-
}
|
|
2815
|
-
this.selectedCountry.setAttribute("title", title);
|
|
2816
|
-
}
|
|
2817
2803
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2818
2804
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2819
2805
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -3239,7 +3225,7 @@ var intlTelInput = Object.assign(
|
|
|
3239
3225
|
attachUtils,
|
|
3240
3226
|
startedLoadingUtilsScript: false,
|
|
3241
3227
|
startedLoadingAutoCountry: false,
|
|
3242
|
-
version: "25.8.
|
|
3228
|
+
version: "25.8.3"
|
|
3243
3229
|
}
|
|
3244
3230
|
);
|
|
3245
3231
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2026,7 +2026,7 @@ var Iti = class _Iti {
|
|
|
2026
2026
|
if (separateDialCode) {
|
|
2027
2027
|
this.selectedDialCode = createEl(
|
|
2028
2028
|
"div",
|
|
2029
|
-
{ class: "iti__selected-dial-code",
|
|
2029
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
2030
2030
|
this.selectedCountry
|
|
2031
2031
|
);
|
|
2032
2032
|
}
|
|
@@ -2773,20 +2773,20 @@ var Iti = class _Iti {
|
|
|
2773
2773
|
if (this.selectedCountryData.iso2) {
|
|
2774
2774
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2775
2775
|
}
|
|
2776
|
-
if (this.
|
|
2777
|
-
|
|
2778
|
-
let ariaLabel
|
|
2779
|
-
if (iso2
|
|
2780
|
-
|
|
2776
|
+
if (this.selectedCountry) {
|
|
2777
|
+
const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
|
|
2778
|
+
let ariaLabel, title;
|
|
2779
|
+
if (iso2) {
|
|
2780
|
+
title = this.selectedCountryData.name;
|
|
2781
2781
|
ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
|
|
2782
2782
|
} else {
|
|
2783
|
-
|
|
2783
|
+
title = i18n.noCountrySelected;
|
|
2784
2784
|
ariaLabel = i18n.noCountrySelected;
|
|
2785
2785
|
}
|
|
2786
2786
|
this.selectedCountryInner.className = flagClass;
|
|
2787
|
+
this.selectedCountry.setAttribute("title", title);
|
|
2787
2788
|
this.selectedCountry.setAttribute("aria-label", ariaLabel);
|
|
2788
2789
|
}
|
|
2789
|
-
this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
|
|
2790
2790
|
if (separateDialCode) {
|
|
2791
2791
|
const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2792
2792
|
this.selectedDialCode.innerHTML = dialCode;
|
|
@@ -2836,20 +2836,6 @@ var Iti = class _Iti {
|
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
2838
2838
|
}
|
|
2839
|
-
_setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
|
|
2840
|
-
if (!this.selectedCountry) {
|
|
2841
|
-
return;
|
|
2842
|
-
}
|
|
2843
|
-
let title;
|
|
2844
|
-
if (iso2 && !separateDialCode) {
|
|
2845
|
-
title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
|
|
2846
|
-
} else if (iso2) {
|
|
2847
|
-
title = this.selectedCountryData.name;
|
|
2848
|
-
} else {
|
|
2849
|
-
title = this.options.i18n.noCountrySelected;
|
|
2850
|
-
}
|
|
2851
|
-
this.selectedCountry.setAttribute("title", title);
|
|
2852
|
-
}
|
|
2853
2839
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2854
2840
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2855
2841
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -3275,7 +3261,7 @@ var intlTelInput = Object.assign(
|
|
|
3275
3261
|
attachUtils,
|
|
3276
3262
|
startedLoadingUtilsScript: false,
|
|
3277
3263
|
startedLoadingAutoCountry: false,
|
|
3278
|
-
version: "25.8.
|
|
3264
|
+
version: "25.8.3"
|
|
3279
3265
|
}
|
|
3280
3266
|
);
|
|
3281
3267
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1990,7 +1990,7 @@ var Iti = class _Iti {
|
|
|
1990
1990
|
if (separateDialCode) {
|
|
1991
1991
|
this.selectedDialCode = createEl(
|
|
1992
1992
|
"div",
|
|
1993
|
-
{ class: "iti__selected-dial-code",
|
|
1993
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1994
1994
|
this.selectedCountry
|
|
1995
1995
|
);
|
|
1996
1996
|
}
|
|
@@ -2737,20 +2737,20 @@ var Iti = class _Iti {
|
|
|
2737
2737
|
if (this.selectedCountryData.iso2) {
|
|
2738
2738
|
this.defaultCountry = this.selectedCountryData.iso2;
|
|
2739
2739
|
}
|
|
2740
|
-
if (this.
|
|
2741
|
-
|
|
2742
|
-
let ariaLabel
|
|
2743
|
-
if (iso2
|
|
2744
|
-
|
|
2740
|
+
if (this.selectedCountry) {
|
|
2741
|
+
const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
|
|
2742
|
+
let ariaLabel, title;
|
|
2743
|
+
if (iso2) {
|
|
2744
|
+
title = this.selectedCountryData.name;
|
|
2745
2745
|
ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
|
|
2746
2746
|
} else {
|
|
2747
|
-
|
|
2747
|
+
title = i18n.noCountrySelected;
|
|
2748
2748
|
ariaLabel = i18n.noCountrySelected;
|
|
2749
2749
|
}
|
|
2750
2750
|
this.selectedCountryInner.className = flagClass;
|
|
2751
|
+
this.selectedCountry.setAttribute("title", title);
|
|
2751
2752
|
this.selectedCountry.setAttribute("aria-label", ariaLabel);
|
|
2752
2753
|
}
|
|
2753
|
-
this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
|
|
2754
2754
|
if (separateDialCode) {
|
|
2755
2755
|
const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2756
2756
|
this.selectedDialCode.innerHTML = dialCode;
|
|
@@ -2800,20 +2800,6 @@ var Iti = class _Iti {
|
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
2802
|
}
|
|
2803
|
-
_setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
|
|
2804
|
-
if (!this.selectedCountry) {
|
|
2805
|
-
return;
|
|
2806
|
-
}
|
|
2807
|
-
let title;
|
|
2808
|
-
if (iso2 && !separateDialCode) {
|
|
2809
|
-
title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
|
|
2810
|
-
} else if (iso2) {
|
|
2811
|
-
title = this.selectedCountryData.name;
|
|
2812
|
-
} else {
|
|
2813
|
-
title = this.options.i18n.noCountrySelected;
|
|
2814
|
-
}
|
|
2815
|
-
this.selectedCountry.setAttribute("title", title);
|
|
2816
|
-
}
|
|
2817
2803
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2818
2804
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2819
2805
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -3239,7 +3225,7 @@ var intlTelInput = Object.assign(
|
|
|
3239
3225
|
attachUtils,
|
|
3240
3226
|
startedLoadingUtilsScript: false,
|
|
3241
3227
|
startedLoadingAutoCountry: false,
|
|
3242
|
-
version: "25.8.
|
|
3228
|
+
version: "25.8.3"
|
|
3243
3229
|
}
|
|
3244
3230
|
);
|
|
3245
3231
|
var intl_tel_input_default = intlTelInput;
|
package/vue/README.md
CHANGED
|
@@ -34,7 +34,7 @@ See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master
|
|
|
34
34
|
"vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.
|
|
37
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.3/build/js/utils.js"`.
|
|
38
38
|
|
|
39
39
|
## Props
|
|
40
40
|
Here's a list of all of the current props you can pass to the IntlTelInput Vue component.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as k, useModel as M, ref as N, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as z, openBlock as V, mergeProps as O, vModelText as j } from "vue";
|
|
2
|
+
const $ = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1323,7 +1323,7 @@ const j = [
|
|
|
1323
1323
|
"263"
|
|
1324
1324
|
]
|
|
1325
1325
|
], w = [];
|
|
1326
|
-
for (const d of
|
|
1326
|
+
for (const d of $)
|
|
1327
1327
|
w.push({
|
|
1328
1328
|
name: "",
|
|
1329
1329
|
// populated in the plugin
|
|
@@ -1667,7 +1667,7 @@ const S = (d) => typeof window < "u" && typeof window.matchMedia == "function" &
|
|
|
1667
1667
|
"887",
|
|
1668
1668
|
"888",
|
|
1669
1669
|
"889"
|
|
1670
|
-
], L = (d) => d.replace(/\D/g, ""),
|
|
1670
|
+
], L = (d) => d.replace(/\D/g, ""), A = (d = "") => d.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), P = (d) => {
|
|
1671
1671
|
const t = L(d);
|
|
1672
1672
|
if (t.charAt(0) === "1") {
|
|
1673
1673
|
const e = t.substring(1, 4);
|
|
@@ -1725,7 +1725,7 @@ class D {
|
|
|
1725
1725
|
//* Precompute and cache country search tokens to speed up filtering
|
|
1726
1726
|
_cacheSearchTokens() {
|
|
1727
1727
|
for (const t of this.countries)
|
|
1728
|
-
t.normalisedName =
|
|
1728
|
+
t.normalisedName = A(t.name), t.initials = t.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((e) => e[0]).join("").toLowerCase(), t.dialCodePlus = `+${t.dialCode}`;
|
|
1729
1729
|
}
|
|
1730
1730
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1731
1731
|
_sortCountries() {
|
|
@@ -1794,7 +1794,7 @@ class D {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1796
1796
|
_generateMarkup() {
|
|
1797
|
-
var
|
|
1797
|
+
var a, h, _;
|
|
1798
1798
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1799
1799
|
const {
|
|
1800
1800
|
allowDropdown: t,
|
|
@@ -1804,17 +1804,17 @@ class D {
|
|
|
1804
1804
|
hiddenInput: n,
|
|
1805
1805
|
dropdownContainer: l,
|
|
1806
1806
|
fixDropdownWidth: r,
|
|
1807
|
-
useFullscreenPopup:
|
|
1807
|
+
useFullscreenPopup: o,
|
|
1808
1808
|
countrySearch: c,
|
|
1809
1809
|
i18n: p
|
|
1810
1810
|
} = this.options, C = D._buildClassNames({
|
|
1811
1811
|
iti: !0,
|
|
1812
1812
|
"iti--allow-dropdown": t,
|
|
1813
1813
|
"iti--show-flags": i,
|
|
1814
|
-
"iti--inline-dropdown": !
|
|
1814
|
+
"iti--inline-dropdown": !o,
|
|
1815
1815
|
[s]: !!s
|
|
1816
1816
|
}), y = m("div", { class: C });
|
|
1817
|
-
if ((
|
|
1817
|
+
if ((a = this.telInput.parentNode) == null || a.insertBefore(y, this.telInput), t || i || e) {
|
|
1818
1818
|
this.countryContainer = m(
|
|
1819
1819
|
"div",
|
|
1820
1820
|
{ class: "iti__country-container" },
|
|
@@ -1850,7 +1850,7 @@ class D {
|
|
|
1850
1850
|
b
|
|
1851
1851
|
)), e && (this.selectedDialCode = m(
|
|
1852
1852
|
"div",
|
|
1853
|
-
{ class: "iti__selected-dial-code",
|
|
1853
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1854
1854
|
this.selectedCountry
|
|
1855
1855
|
)), t) {
|
|
1856
1856
|
const f = r ? "" : "iti--flexible-dropdown-width";
|
|
@@ -1938,8 +1938,8 @@ class D {
|
|
|
1938
1938
|
const g = D._buildClassNames({
|
|
1939
1939
|
iti: !0,
|
|
1940
1940
|
"iti--container": !0,
|
|
1941
|
-
"iti--fullscreen-popup":
|
|
1942
|
-
"iti--inline-dropdown": !
|
|
1941
|
+
"iti--fullscreen-popup": o,
|
|
1942
|
+
"iti--inline-dropdown": !o,
|
|
1943
1943
|
[s]: !!s
|
|
1944
1944
|
});
|
|
1945
1945
|
this.dropdown = m("div", { class: g }), this.dropdown.appendChild(this.dropdownContent);
|
|
@@ -1990,11 +1990,11 @@ class D {
|
|
|
1990
1990
|
//* 1. Extracting a dial code from the given number
|
|
1991
1991
|
//* 2. Using explicit initialCountry
|
|
1992
1992
|
_setInitialState(t = !1) {
|
|
1993
|
-
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, l = this._getDialCode(n), r = P(n), { initialCountry:
|
|
1993
|
+
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, l = this._getDialCode(n), r = P(n), { initialCountry: o, geoIpLookup: c } = this.options, p = o === "auto" && c;
|
|
1994
1994
|
if (l && !r)
|
|
1995
1995
|
this._updateCountryFromNumber(n);
|
|
1996
1996
|
else if (!p || t) {
|
|
1997
|
-
const C =
|
|
1997
|
+
const C = o ? o.toLowerCase() : "";
|
|
1998
1998
|
C && this._getCountryData(C, !0) ? this._setCountry(C) : l && r ? this._setCountry("us") : this._setCountry();
|
|
1999
1999
|
}
|
|
2000
2000
|
n && this._updateValFromNumber(n);
|
|
@@ -2056,29 +2056,29 @@ class D {
|
|
|
2056
2056
|
_initTelInputListeners() {
|
|
2057
2057
|
const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: l } = this.options;
|
|
2058
2058
|
let r = !1;
|
|
2059
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (
|
|
2060
|
-
if (this.isAndroid && (
|
|
2061
|
-
const y = this.telInput.selectionStart || 0,
|
|
2062
|
-
this.telInput.value =
|
|
2059
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (o) => {
|
|
2060
|
+
if (this.isAndroid && (o == null ? void 0 : o.data) === "+" && i && n && l) {
|
|
2061
|
+
const y = this.telInput.selectionStart || 0, a = this.telInput.value.substring(0, y - 1), h = this.telInput.value.substring(y);
|
|
2062
|
+
this.telInput.value = a + h, this._openDropdownWithPlus();
|
|
2063
2063
|
return;
|
|
2064
2064
|
}
|
|
2065
2065
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
2066
|
-
const c = (
|
|
2066
|
+
const c = (o == null ? void 0 : o.data) && /[^+0-9]/.test(o.data), p = (o == null ? void 0 : o.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2067
2067
|
c || p && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
|
|
2068
|
-
const C = (
|
|
2068
|
+
const C = (o == null ? void 0 : o.detail) && o.detail.isSetNumber && !s;
|
|
2069
2069
|
if (e && !r && !C) {
|
|
2070
|
-
const y = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, y).replace(/[^+0-9]/g, "").length, _ = (
|
|
2070
|
+
const y = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, y).replace(/[^+0-9]/g, "").length, _ = (o == null ? void 0 : o.inputType) === "deleteContentForward", b = this._formatNumberAsYouType(), f = G(h, b, y, _);
|
|
2071
2071
|
this.telInput.value = b, this.telInput.setSelectionRange(f, f);
|
|
2072
2072
|
}
|
|
2073
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (
|
|
2074
|
-
if (
|
|
2075
|
-
if (i && n && l &&
|
|
2076
|
-
|
|
2073
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (o) => {
|
|
2074
|
+
if (o.key && o.key.length === 1 && !o.altKey && !o.ctrlKey && !o.metaKey) {
|
|
2075
|
+
if (i && n && l && o.key === "+") {
|
|
2076
|
+
o.preventDefault(), this._openDropdownWithPlus();
|
|
2077
2077
|
return;
|
|
2078
2078
|
}
|
|
2079
2079
|
if (t) {
|
|
2080
|
-
const c = this.telInput.value, C = !(c.charAt(0) === "+") && this.telInput.selectionStart === 0 &&
|
|
2081
|
-
(!
|
|
2080
|
+
const c = this.telInput.value, C = !(c.charAt(0) === "+") && this.telInput.selectionStart === 0 && o.key === "+", y = /^[0-9]$/.test(o.key), a = i ? y : C || y, h = c.slice(0, this.telInput.selectionStart) + o.key + c.slice(this.telInput.selectionEnd), _ = this._getFullNumber(h), b = u.utils.getCoreNumber(_, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, v = this._getNewCountryFromNumber(_) !== null;
|
|
2081
|
+
(!a || f && !v && !C) && o.preventDefault();
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2167,19 +2167,19 @@ class D {
|
|
|
2167
2167
|
_filterCountries(t, e = !1) {
|
|
2168
2168
|
let i = !0;
|
|
2169
2169
|
this.countryList.innerHTML = "";
|
|
2170
|
-
const s =
|
|
2171
|
-
for (const
|
|
2172
|
-
e || n === 0 ?
|
|
2170
|
+
const s = A(t), n = s.length, l = [], r = [], o = [], c = [], p = [], C = [];
|
|
2171
|
+
for (const a of this.countries)
|
|
2172
|
+
e || n === 0 ? o.push(a) : a.iso2 === s ? l.push(a) : a.normalisedName.startsWith(s) ? r.push(a) : a.normalisedName.includes(s) ? o.push(a) : s === a.dialCode || s === a.dialCodePlus ? c.push(a) : a.dialCodePlus.includes(s) ? p.push(a) : a.initials.includes(s) && C.push(a);
|
|
2173
2173
|
const y = [
|
|
2174
|
-
...l.sort((
|
|
2175
|
-
...r.sort((
|
|
2176
|
-
...
|
|
2177
|
-
...c.sort((
|
|
2178
|
-
...p.sort((
|
|
2179
|
-
...C.sort((
|
|
2174
|
+
...l.sort((a, h) => a.priority - h.priority),
|
|
2175
|
+
...r.sort((a, h) => a.priority - h.priority),
|
|
2176
|
+
...o.sort((a, h) => a.priority - h.priority),
|
|
2177
|
+
...c.sort((a, h) => a.priority - h.priority),
|
|
2178
|
+
...p.sort((a, h) => a.priority - h.priority),
|
|
2179
|
+
...C.sort((a, h) => a.priority - h.priority)
|
|
2180
2180
|
];
|
|
2181
|
-
for (const
|
|
2182
|
-
const h =
|
|
2181
|
+
for (const a of y) {
|
|
2182
|
+
const h = a.nodeById[this.id];
|
|
2183
2183
|
h && (this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1));
|
|
2184
2184
|
}
|
|
2185
2185
|
i ? (this._highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this._updateSearchResultsA11yText();
|
|
@@ -2237,14 +2237,14 @@ class D {
|
|
|
2237
2237
|
i = this._ensureHasDialCode(i);
|
|
2238
2238
|
const l = this._getDialCode(i, !0), r = L(i);
|
|
2239
2239
|
if (l) {
|
|
2240
|
-
const
|
|
2240
|
+
const o = L(l), c = this.dialCodeToIso2Map[o];
|
|
2241
2241
|
if (!s && this.defaultCountry && c.includes(this.defaultCountry))
|
|
2242
2242
|
return this.defaultCountry;
|
|
2243
|
-
const p = this.selectedCountryData.areaCodes && r.length >
|
|
2243
|
+
const p = this.selectedCountryData.areaCodes && r.length > o.length, C = s && c.includes(s) && !p;
|
|
2244
2244
|
if (!(n === "1" && P(r)) && !C) {
|
|
2245
|
-
for (const
|
|
2246
|
-
if (
|
|
2247
|
-
return
|
|
2245
|
+
for (const a of c)
|
|
2246
|
+
if (a)
|
|
2247
|
+
return a;
|
|
2248
2248
|
}
|
|
2249
2249
|
} else {
|
|
2250
2250
|
if (i.charAt(0) === "+" && r.length)
|
|
@@ -2277,11 +2277,12 @@ class D {
|
|
|
2277
2277
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2278
2278
|
_setCountry(t) {
|
|
2279
2279
|
const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2280
|
-
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.
|
|
2281
|
-
|
|
2282
|
-
|
|
2280
|
+
if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2281
|
+
const l = t && i ? `iti__flag iti__${t}` : "iti__flag iti__globe";
|
|
2282
|
+
let r, o;
|
|
2283
|
+
t ? (o = this.selectedCountryData.name, r = s.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name)) : (o = s.noCountrySelected, r = s.noCountrySelected), this.selectedCountryInner.className = l, this.selectedCountry.setAttribute("title", o), this.selectedCountry.setAttribute("aria-label", r);
|
|
2283
2284
|
}
|
|
2284
|
-
if (
|
|
2285
|
+
if (e) {
|
|
2285
2286
|
const l = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2286
2287
|
this.selectedDialCode.innerHTML = l, this._updateInputPadding();
|
|
2287
2288
|
}
|
|
@@ -2308,17 +2309,11 @@ class D {
|
|
|
2308
2309
|
), r = l;
|
|
2309
2310
|
for (; u.utils.isPossibleNumber(l, s, i); )
|
|
2310
2311
|
r = l, l += "0";
|
|
2311
|
-
const
|
|
2312
|
-
this.maxCoreNumberLength =
|
|
2312
|
+
const o = u.utils.getCoreNumber(r, s);
|
|
2313
|
+
this.maxCoreNumberLength = o.length, s === "by" && (this.maxCoreNumberLength = o.length + 1);
|
|
2313
2314
|
} else
|
|
2314
2315
|
this.maxCoreNumberLength = null;
|
|
2315
2316
|
}
|
|
2316
|
-
_setSelectedCountryTitleAttribute(t = null, e) {
|
|
2317
|
-
if (!this.selectedCountry)
|
|
2318
|
-
return;
|
|
2319
|
-
let i;
|
|
2320
|
-
t && !e ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : t ? i = this.selectedCountryData.name : i = this.options.i18n.noCountrySelected, this.selectedCountry.setAttribute("title", i);
|
|
2321
|
-
}
|
|
2322
2317
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2323
2318
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2324
2319
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -2373,8 +2368,8 @@ class D {
|
|
|
2373
2368
|
}
|
|
2374
2369
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2375
2370
|
_scrollTo(t) {
|
|
2376
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, l = n + s, r = t.offsetHeight,
|
|
2377
|
-
if (
|
|
2371
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, l = n + s, r = t.offsetHeight, o = t.getBoundingClientRect().top + i, c = o + r, p = o - n + e.scrollTop;
|
|
2372
|
+
if (o < n)
|
|
2378
2373
|
e.scrollTop = p;
|
|
2379
2374
|
else if (c > l) {
|
|
2380
2375
|
const C = s - r;
|
|
@@ -2600,11 +2595,11 @@ const Y = (d) => {
|
|
|
2600
2595
|
attachUtils: Y,
|
|
2601
2596
|
startedLoadingUtilsScript: !1,
|
|
2602
2597
|
startedLoadingAutoCountry: !1,
|
|
2603
|
-
version: "25.8.
|
|
2598
|
+
version: "25.8.3"
|
|
2604
2599
|
}
|
|
2605
2600
|
), Z = {
|
|
2606
2601
|
__name: "IntlTelInput",
|
|
2607
|
-
props: /* @__PURE__ */
|
|
2602
|
+
props: /* @__PURE__ */ k({
|
|
2608
2603
|
disabled: {
|
|
2609
2604
|
type: Boolean,
|
|
2610
2605
|
default: !1
|
|
@@ -2628,38 +2623,38 @@ const Y = (d) => {
|
|
|
2628
2623
|
},
|
|
2629
2624
|
modelModifiers: {}
|
|
2630
2625
|
}),
|
|
2631
|
-
emits: /* @__PURE__ */
|
|
2626
|
+
emits: /* @__PURE__ */ k([
|
|
2632
2627
|
"changeNumber",
|
|
2633
2628
|
"changeCountry",
|
|
2634
2629
|
"changeValidity",
|
|
2635
2630
|
"changeErrorCode"
|
|
2636
2631
|
], ["update:modelValue"]),
|
|
2637
2632
|
setup(d, { expose: t, emit: e }) {
|
|
2638
|
-
const i = M(d, "modelValue"), s = d, n = e, l = N(), r = N(),
|
|
2639
|
-
let
|
|
2640
|
-
|
|
2633
|
+
const i = M(d, "modelValue"), s = d, n = e, l = N(), r = N(), o = N(!1), c = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, p = () => {
|
|
2634
|
+
let a = c();
|
|
2635
|
+
o.value !== a && (o.value = a, n("changeValidity", !!a), n(
|
|
2641
2636
|
"changeErrorCode",
|
|
2642
|
-
|
|
2637
|
+
a ? null : r.value.getValidationError()
|
|
2643
2638
|
));
|
|
2644
2639
|
}, C = () => {
|
|
2645
|
-
var
|
|
2646
|
-
n("changeNumber", ((
|
|
2640
|
+
var a;
|
|
2641
|
+
n("changeNumber", ((a = r.value) == null ? void 0 : a.getNumber()) ?? ""), p();
|
|
2647
2642
|
}, y = () => {
|
|
2648
|
-
var
|
|
2649
|
-
n("changeCountry", ((
|
|
2643
|
+
var a;
|
|
2644
|
+
n("changeCountry", ((a = r.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""), C(), p();
|
|
2650
2645
|
};
|
|
2651
2646
|
return E(() => {
|
|
2652
|
-
l.value && (r.value = u(l.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled),
|
|
2647
|
+
l.value && (r.value = u(l.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), o.value = c());
|
|
2653
2648
|
}), B(
|
|
2654
2649
|
() => s.disabled,
|
|
2655
|
-
(
|
|
2650
|
+
(a) => {
|
|
2656
2651
|
var h;
|
|
2657
|
-
return (h = r.value) == null ? void 0 : h.setDisabled(
|
|
2652
|
+
return (h = r.value) == null ? void 0 : h.setDisabled(a);
|
|
2658
2653
|
}
|
|
2659
2654
|
), R(() => {
|
|
2660
|
-
var
|
|
2661
|
-
return (
|
|
2662
|
-
}), t({ instance: r, input: l }), (
|
|
2655
|
+
var a;
|
|
2656
|
+
return (a = r.value) == null ? void 0 : a.destroy();
|
|
2657
|
+
}), t({ instance: r, input: l }), (a, h) => F((V(), z("input", O({
|
|
2663
2658
|
ref_key: "input",
|
|
2664
2659
|
ref: l,
|
|
2665
2660
|
"onUpdate:modelValue": h[0] || (h[0] = (_) => i.value = _),
|
|
@@ -2668,7 +2663,7 @@ const Y = (d) => {
|
|
|
2668
2663
|
onInput: C
|
|
2669
2664
|
}, d.inputProps), null, 16)), [
|
|
2670
2665
|
[
|
|
2671
|
-
|
|
2666
|
+
j,
|
|
2672
2667
|
i.value,
|
|
2673
2668
|
void 0,
|
|
2674
2669
|
{ lazy: !0 }
|