intl-tel-input 25.8.2 → 25.8.4
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 +7 -7
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +18 -26
- package/angular/build/IntlTelInputWithUtils.js +18 -26
- 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 +19 -27
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +19 -27
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +18 -26
- package/react/build/IntlTelInput.d.ts +0 -1
- package/react/build/IntlTelInput.js +18 -26
- package/react/build/IntlTelInputWithUtils.cjs +18 -26
- package/react/build/IntlTelInputWithUtils.js +18 -26
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +227 -232
- package/vue/build/IntlTelInputWithUtils.mjs +377 -382
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.4/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
|
}
|
|
@@ -2348,7 +2348,7 @@ var Iti = class _Iti {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
//* Initialize the tel input listeners.
|
|
2350
2350
|
_initTelInputListeners() {
|
|
2351
|
-
const { strictMode, formatAsYouType, separateDialCode,
|
|
2351
|
+
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2352
2352
|
let userOverrideFormatting = false;
|
|
2353
2353
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
2354
2354
|
userOverrideFormatting = true;
|
|
@@ -2372,8 +2372,8 @@ var Iti = class _Iti {
|
|
|
2372
2372
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2373
2373
|
userOverrideFormatting = false;
|
|
2374
2374
|
}
|
|
2375
|
-
const
|
|
2376
|
-
if (formatAsYouType && !userOverrideFormatting && !
|
|
2375
|
+
const isSetNumber = e?.detail && e.detail["isSetNumber"];
|
|
2376
|
+
if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
|
|
2377
2377
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2378
2378
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2379
2379
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
@@ -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
|
|
@@ -2899,6 +2885,9 @@ var Iti = class _Iti {
|
|
|
2899
2885
|
);
|
|
2900
2886
|
this._closeDropdown();
|
|
2901
2887
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2888
|
+
if (this.options.formatOnDisplay) {
|
|
2889
|
+
this._updateValFromNumber(this.telInput.value);
|
|
2890
|
+
}
|
|
2902
2891
|
this.telInput.focus();
|
|
2903
2892
|
if (countryChanged) {
|
|
2904
2893
|
this._triggerCountryChange();
|
|
@@ -3196,6 +3185,9 @@ var Iti = class _Iti {
|
|
|
3196
3185
|
if (isCountryChange) {
|
|
3197
3186
|
this._setCountry(iso2Lower);
|
|
3198
3187
|
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
3188
|
+
if (this.options.formatOnDisplay) {
|
|
3189
|
+
this._updateValFromNumber(this.telInput.value);
|
|
3190
|
+
}
|
|
3199
3191
|
this._triggerCountryChange();
|
|
3200
3192
|
}
|
|
3201
3193
|
}
|
|
@@ -3275,7 +3267,7 @@ var intlTelInput = Object.assign(
|
|
|
3275
3267
|
attachUtils,
|
|
3276
3268
|
startedLoadingUtilsScript: false,
|
|
3277
3269
|
startedLoadingAutoCountry: false,
|
|
3278
|
-
version: "25.8.
|
|
3270
|
+
version: "25.8.4"
|
|
3279
3271
|
}
|
|
3280
3272
|
);
|
|
3281
3273
|
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
|
}
|
|
@@ -2312,7 +2312,7 @@ var Iti = class _Iti {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
//* Initialize the tel input listeners.
|
|
2314
2314
|
_initTelInputListeners() {
|
|
2315
|
-
const { strictMode, formatAsYouType, separateDialCode,
|
|
2315
|
+
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2316
2316
|
let userOverrideFormatting = false;
|
|
2317
2317
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
2318
2318
|
userOverrideFormatting = true;
|
|
@@ -2336,8 +2336,8 @@ var Iti = class _Iti {
|
|
|
2336
2336
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2337
2337
|
userOverrideFormatting = false;
|
|
2338
2338
|
}
|
|
2339
|
-
const
|
|
2340
|
-
if (formatAsYouType && !userOverrideFormatting && !
|
|
2339
|
+
const isSetNumber = e?.detail && e.detail["isSetNumber"];
|
|
2340
|
+
if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
|
|
2341
2341
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2342
2342
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2343
2343
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
@@ -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
|
|
@@ -2863,6 +2849,9 @@ var Iti = class _Iti {
|
|
|
2863
2849
|
);
|
|
2864
2850
|
this._closeDropdown();
|
|
2865
2851
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2852
|
+
if (this.options.formatOnDisplay) {
|
|
2853
|
+
this._updateValFromNumber(this.telInput.value);
|
|
2854
|
+
}
|
|
2866
2855
|
this.telInput.focus();
|
|
2867
2856
|
if (countryChanged) {
|
|
2868
2857
|
this._triggerCountryChange();
|
|
@@ -3160,6 +3149,9 @@ var Iti = class _Iti {
|
|
|
3160
3149
|
if (isCountryChange) {
|
|
3161
3150
|
this._setCountry(iso2Lower);
|
|
3162
3151
|
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
3152
|
+
if (this.options.formatOnDisplay) {
|
|
3153
|
+
this._updateValFromNumber(this.telInput.value);
|
|
3154
|
+
}
|
|
3163
3155
|
this._triggerCountryChange();
|
|
3164
3156
|
}
|
|
3165
3157
|
}
|
|
@@ -3239,7 +3231,7 @@ var intlTelInput = Object.assign(
|
|
|
3239
3231
|
attachUtils,
|
|
3240
3232
|
startedLoadingUtilsScript: false,
|
|
3241
3233
|
startedLoadingAutoCountry: false,
|
|
3242
|
-
version: "25.8.
|
|
3234
|
+
version: "25.8.4"
|
|
3243
3235
|
}
|
|
3244
3236
|
);
|
|
3245
3237
|
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
|
}
|
|
@@ -2348,7 +2348,7 @@ var Iti = class _Iti {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
//* Initialize the tel input listeners.
|
|
2350
2350
|
_initTelInputListeners() {
|
|
2351
|
-
const { strictMode, formatAsYouType, separateDialCode,
|
|
2351
|
+
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2352
2352
|
let userOverrideFormatting = false;
|
|
2353
2353
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
2354
2354
|
userOverrideFormatting = true;
|
|
@@ -2372,8 +2372,8 @@ var Iti = class _Iti {
|
|
|
2372
2372
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2373
2373
|
userOverrideFormatting = false;
|
|
2374
2374
|
}
|
|
2375
|
-
const
|
|
2376
|
-
if (formatAsYouType && !userOverrideFormatting && !
|
|
2375
|
+
const isSetNumber = e?.detail && e.detail["isSetNumber"];
|
|
2376
|
+
if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
|
|
2377
2377
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2378
2378
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2379
2379
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
@@ -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
|
|
@@ -2899,6 +2885,9 @@ var Iti = class _Iti {
|
|
|
2899
2885
|
);
|
|
2900
2886
|
this._closeDropdown();
|
|
2901
2887
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2888
|
+
if (this.options.formatOnDisplay) {
|
|
2889
|
+
this._updateValFromNumber(this.telInput.value);
|
|
2890
|
+
}
|
|
2902
2891
|
this.telInput.focus();
|
|
2903
2892
|
if (countryChanged) {
|
|
2904
2893
|
this._triggerCountryChange();
|
|
@@ -3196,6 +3185,9 @@ var Iti = class _Iti {
|
|
|
3196
3185
|
if (isCountryChange) {
|
|
3197
3186
|
this._setCountry(iso2Lower);
|
|
3198
3187
|
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
3188
|
+
if (this.options.formatOnDisplay) {
|
|
3189
|
+
this._updateValFromNumber(this.telInput.value);
|
|
3190
|
+
}
|
|
3199
3191
|
this._triggerCountryChange();
|
|
3200
3192
|
}
|
|
3201
3193
|
}
|
|
@@ -3275,7 +3267,7 @@ var intlTelInput = Object.assign(
|
|
|
3275
3267
|
attachUtils,
|
|
3276
3268
|
startedLoadingUtilsScript: false,
|
|
3277
3269
|
startedLoadingAutoCountry: false,
|
|
3278
|
-
version: "25.8.
|
|
3270
|
+
version: "25.8.4"
|
|
3279
3271
|
}
|
|
3280
3272
|
);
|
|
3281
3273
|
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
|
}
|
|
@@ -2312,7 +2312,7 @@ var Iti = class _Iti {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
//* Initialize the tel input listeners.
|
|
2314
2314
|
_initTelInputListeners() {
|
|
2315
|
-
const { strictMode, formatAsYouType, separateDialCode,
|
|
2315
|
+
const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
|
|
2316
2316
|
let userOverrideFormatting = false;
|
|
2317
2317
|
if (/\p{L}/u.test(this.telInput.value)) {
|
|
2318
2318
|
userOverrideFormatting = true;
|
|
@@ -2336,8 +2336,8 @@ var Iti = class _Iti {
|
|
|
2336
2336
|
} else if (!/[^+0-9]/.test(this.telInput.value)) {
|
|
2337
2337
|
userOverrideFormatting = false;
|
|
2338
2338
|
}
|
|
2339
|
-
const
|
|
2340
|
-
if (formatAsYouType && !userOverrideFormatting && !
|
|
2339
|
+
const isSetNumber = e?.detail && e.detail["isSetNumber"];
|
|
2340
|
+
if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
|
|
2341
2341
|
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2342
2342
|
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
|
|
2343
2343
|
const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
|
|
@@ -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
|
|
@@ -2863,6 +2849,9 @@ var Iti = class _Iti {
|
|
|
2863
2849
|
);
|
|
2864
2850
|
this._closeDropdown();
|
|
2865
2851
|
this._updateDialCode(listItem.getAttribute("data-dial-code"));
|
|
2852
|
+
if (this.options.formatOnDisplay) {
|
|
2853
|
+
this._updateValFromNumber(this.telInput.value);
|
|
2854
|
+
}
|
|
2866
2855
|
this.telInput.focus();
|
|
2867
2856
|
if (countryChanged) {
|
|
2868
2857
|
this._triggerCountryChange();
|
|
@@ -3160,6 +3149,9 @@ var Iti = class _Iti {
|
|
|
3160
3149
|
if (isCountryChange) {
|
|
3161
3150
|
this._setCountry(iso2Lower);
|
|
3162
3151
|
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
3152
|
+
if (this.options.formatOnDisplay) {
|
|
3153
|
+
this._updateValFromNumber(this.telInput.value);
|
|
3154
|
+
}
|
|
3163
3155
|
this._triggerCountryChange();
|
|
3164
3156
|
}
|
|
3165
3157
|
}
|
|
@@ -3239,7 +3231,7 @@ var intlTelInput = Object.assign(
|
|
|
3239
3231
|
attachUtils,
|
|
3240
3232
|
startedLoadingUtilsScript: false,
|
|
3241
3233
|
startedLoadingAutoCountry: false,
|
|
3242
|
-
version: "25.8.
|
|
3234
|
+
version: "25.8.4"
|
|
3243
3235
|
}
|
|
3244
3236
|
);
|
|
3245
3237
|
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.4/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.
|