intl-tel-input 25.10.11 → 25.10.12
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 +24 -27
- package/angular/build/IntlTelInputWithUtils.js +24 -27
- package/angular/build/types/intl-tel-input.d.ts +0 -2
- package/build/css/intlTelInput.css +1 -13
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +0 -2
- package/build/js/intlTelInput.js +25 -28
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/intlTelInputWithUtils.js +25 -28
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +24 -27
- package/react/build/IntlTelInput.d.ts +0 -2
- package/react/build/IntlTelInput.js +24 -27
- package/react/build/IntlTelInputWithUtils.cjs +24 -27
- package/react/build/IntlTelInputWithUtils.js +24 -27
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +398 -392
- package/vue/build/IntlTelInputWithUtils.mjs +284 -278
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.10.
|
|
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.10.12/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.
|
|
@@ -2298,15 +2298,8 @@ var Iti = class _Iti {
|
|
|
2298
2298
|
_detectEnvironmentAndLayout() {
|
|
2299
2299
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2300
2300
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2301
|
-
this.telInput.dir = "ltr";
|
|
2302
|
-
const showOnDefaultSide = this.options.allowDropdown || this.options.separateDialCode;
|
|
2303
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !showOnDefaultSide : showOnDefaultSide;
|
|
2304
2301
|
if (this.options.separateDialCode) {
|
|
2305
|
-
|
|
2306
|
-
this.originalPaddingRight = this.telInput.style.paddingRight;
|
|
2307
|
-
} else {
|
|
2308
|
-
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2309
|
-
}
|
|
2302
|
+
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2310
2303
|
}
|
|
2311
2304
|
}
|
|
2312
2305
|
_createInitPromises() {
|
|
@@ -2377,6 +2370,9 @@ var Iti = class _Iti {
|
|
|
2377
2370
|
[containerClass]: Boolean(containerClass)
|
|
2378
2371
|
});
|
|
2379
2372
|
const wrapper = createEl("div", { class: parentClasses });
|
|
2373
|
+
if (this.isRTL) {
|
|
2374
|
+
wrapper.setAttribute("dir", "ltr");
|
|
2375
|
+
}
|
|
2380
2376
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
2381
2377
|
return wrapper;
|
|
2382
2378
|
}
|
|
@@ -2393,11 +2389,6 @@ var Iti = class _Iti {
|
|
|
2393
2389
|
{ class: "iti__country-container iti__v-hide" },
|
|
2394
2390
|
wrapper
|
|
2395
2391
|
);
|
|
2396
|
-
if (this.showSelectedCountryOnLeft) {
|
|
2397
|
-
this.countryContainer.style.left = "0px";
|
|
2398
|
-
} else {
|
|
2399
|
-
this.countryContainer.style.right = "0px";
|
|
2400
|
-
}
|
|
2401
2392
|
if (allowDropdown) {
|
|
2402
2393
|
this.selectedCountry = createEl(
|
|
2403
2394
|
"button",
|
|
@@ -2441,7 +2432,7 @@ var Iti = class _Iti {
|
|
|
2441
2432
|
if (separateDialCode) {
|
|
2442
2433
|
this.selectedDialCode = createEl(
|
|
2443
2434
|
"div",
|
|
2444
|
-
{ class: "iti__selected-dial-code"
|
|
2435
|
+
{ class: "iti__selected-dial-code" },
|
|
2445
2436
|
this.selectedCountry
|
|
2446
2437
|
);
|
|
2447
2438
|
}
|
|
@@ -2466,6 +2457,9 @@ var Iti = class _Iti {
|
|
|
2466
2457
|
role: "dialog",
|
|
2467
2458
|
"aria-modal": "true"
|
|
2468
2459
|
});
|
|
2460
|
+
if (this.isRTL) {
|
|
2461
|
+
this.dropdownContent.setAttribute("dir", "rtl");
|
|
2462
|
+
}
|
|
2469
2463
|
if (countrySearch) {
|
|
2470
2464
|
this._buildSearchUI();
|
|
2471
2465
|
}
|
|
@@ -3303,11 +3297,7 @@ var Iti = class _Iti {
|
|
|
3303
3297
|
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
3304
3298
|
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
3305
3299
|
const inputPadding = selectedCountryWidth + 6;
|
|
3306
|
-
|
|
3307
|
-
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3308
|
-
} else {
|
|
3309
|
-
this.telInput.style.paddingRight = `${inputPadding}px`;
|
|
3310
|
-
}
|
|
3300
|
+
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3311
3301
|
}
|
|
3312
3302
|
}
|
|
3313
3303
|
//* Update the maximum valid number length for the currently selected country.
|
|
@@ -3591,11 +3581,7 @@ var Iti = class _Iti {
|
|
|
3591
3581
|
}
|
|
3592
3582
|
this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
3593
3583
|
if (separateDialCode) {
|
|
3594
|
-
|
|
3595
|
-
this.telInput.style.paddingRight = this.originalPaddingRight;
|
|
3596
|
-
} else {
|
|
3597
|
-
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3598
|
-
}
|
|
3584
|
+
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3599
3585
|
}
|
|
3600
3586
|
const wrapper = this.telInput.parentNode;
|
|
3601
3587
|
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
|
|
@@ -3646,11 +3632,19 @@ var Iti = class _Iti {
|
|
|
3646
3632
|
}
|
|
3647
3633
|
return -99;
|
|
3648
3634
|
}
|
|
3649
|
-
//* Validate the input val
|
|
3635
|
+
//* Validate the input val using number length only
|
|
3650
3636
|
isValidNumber() {
|
|
3637
|
+
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3638
|
+
if (dialCode === "44" && intlTelInput.utils) {
|
|
3639
|
+
const number = this._getFullNumber();
|
|
3640
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3641
|
+
if (coreNumber[0] === "7" && coreNumber.length !== 10) {
|
|
3642
|
+
return false;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3651
3645
|
return this._validateNumber(false);
|
|
3652
3646
|
}
|
|
3653
|
-
//* Validate the input val
|
|
3647
|
+
//* Validate the input val with precise validation
|
|
3654
3648
|
isValidNumberPrecise() {
|
|
3655
3649
|
return this._validateNumber(true);
|
|
3656
3650
|
}
|
|
@@ -3659,6 +3653,9 @@ var Iti = class _Iti {
|
|
|
3659
3653
|
}
|
|
3660
3654
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3661
3655
|
_validateNumber(precise) {
|
|
3656
|
+
if (!intlTelInput.utils) {
|
|
3657
|
+
return null;
|
|
3658
|
+
}
|
|
3662
3659
|
if (!this.selectedCountryData.iso2) {
|
|
3663
3660
|
return false;
|
|
3664
3661
|
}
|
|
@@ -3770,7 +3767,7 @@ var intlTelInput = Object.assign(
|
|
|
3770
3767
|
attachUtils,
|
|
3771
3768
|
startedLoadingUtilsScript: false,
|
|
3772
3769
|
startedLoadingAutoCountry: false,
|
|
3773
|
-
version: "25.10.
|
|
3770
|
+
version: "25.10.12"
|
|
3774
3771
|
}
|
|
3775
3772
|
);
|
|
3776
3773
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -178,7 +178,6 @@ declare module "intl-tel-input" {
|
|
|
178
178
|
private options;
|
|
179
179
|
private hadInitialPlaceholder;
|
|
180
180
|
private isRTL;
|
|
181
|
-
private showSelectedCountryOnLeft;
|
|
182
181
|
private isAndroid;
|
|
183
182
|
private selectedCountryData;
|
|
184
183
|
private countries;
|
|
@@ -203,7 +202,6 @@ declare module "intl-tel-input" {
|
|
|
203
202
|
private hiddenInputCountry;
|
|
204
203
|
private maxCoreNumberLength;
|
|
205
204
|
private defaultCountry;
|
|
206
|
-
private originalPaddingRight;
|
|
207
205
|
private originalPaddingLeft;
|
|
208
206
|
private _handleHiddenInputSubmit;
|
|
209
207
|
private _handleLabelClick;
|
|
@@ -2262,15 +2262,8 @@ var Iti = class _Iti {
|
|
|
2262
2262
|
_detectEnvironmentAndLayout() {
|
|
2263
2263
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2264
2264
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2265
|
-
this.telInput.dir = "ltr";
|
|
2266
|
-
const showOnDefaultSide = this.options.allowDropdown || this.options.separateDialCode;
|
|
2267
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !showOnDefaultSide : showOnDefaultSide;
|
|
2268
2265
|
if (this.options.separateDialCode) {
|
|
2269
|
-
|
|
2270
|
-
this.originalPaddingRight = this.telInput.style.paddingRight;
|
|
2271
|
-
} else {
|
|
2272
|
-
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2273
|
-
}
|
|
2266
|
+
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2274
2267
|
}
|
|
2275
2268
|
}
|
|
2276
2269
|
_createInitPromises() {
|
|
@@ -2341,6 +2334,9 @@ var Iti = class _Iti {
|
|
|
2341
2334
|
[containerClass]: Boolean(containerClass)
|
|
2342
2335
|
});
|
|
2343
2336
|
const wrapper = createEl("div", { class: parentClasses });
|
|
2337
|
+
if (this.isRTL) {
|
|
2338
|
+
wrapper.setAttribute("dir", "ltr");
|
|
2339
|
+
}
|
|
2344
2340
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
2345
2341
|
return wrapper;
|
|
2346
2342
|
}
|
|
@@ -2357,11 +2353,6 @@ var Iti = class _Iti {
|
|
|
2357
2353
|
{ class: "iti__country-container iti__v-hide" },
|
|
2358
2354
|
wrapper
|
|
2359
2355
|
);
|
|
2360
|
-
if (this.showSelectedCountryOnLeft) {
|
|
2361
|
-
this.countryContainer.style.left = "0px";
|
|
2362
|
-
} else {
|
|
2363
|
-
this.countryContainer.style.right = "0px";
|
|
2364
|
-
}
|
|
2365
2356
|
if (allowDropdown) {
|
|
2366
2357
|
this.selectedCountry = createEl(
|
|
2367
2358
|
"button",
|
|
@@ -2405,7 +2396,7 @@ var Iti = class _Iti {
|
|
|
2405
2396
|
if (separateDialCode) {
|
|
2406
2397
|
this.selectedDialCode = createEl(
|
|
2407
2398
|
"div",
|
|
2408
|
-
{ class: "iti__selected-dial-code"
|
|
2399
|
+
{ class: "iti__selected-dial-code" },
|
|
2409
2400
|
this.selectedCountry
|
|
2410
2401
|
);
|
|
2411
2402
|
}
|
|
@@ -2430,6 +2421,9 @@ var Iti = class _Iti {
|
|
|
2430
2421
|
role: "dialog",
|
|
2431
2422
|
"aria-modal": "true"
|
|
2432
2423
|
});
|
|
2424
|
+
if (this.isRTL) {
|
|
2425
|
+
this.dropdownContent.setAttribute("dir", "rtl");
|
|
2426
|
+
}
|
|
2433
2427
|
if (countrySearch) {
|
|
2434
2428
|
this._buildSearchUI();
|
|
2435
2429
|
}
|
|
@@ -3267,11 +3261,7 @@ var Iti = class _Iti {
|
|
|
3267
3261
|
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
3268
3262
|
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
3269
3263
|
const inputPadding = selectedCountryWidth + 6;
|
|
3270
|
-
|
|
3271
|
-
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3272
|
-
} else {
|
|
3273
|
-
this.telInput.style.paddingRight = `${inputPadding}px`;
|
|
3274
|
-
}
|
|
3264
|
+
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3275
3265
|
}
|
|
3276
3266
|
}
|
|
3277
3267
|
//* Update the maximum valid number length for the currently selected country.
|
|
@@ -3555,11 +3545,7 @@ var Iti = class _Iti {
|
|
|
3555
3545
|
}
|
|
3556
3546
|
this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
3557
3547
|
if (separateDialCode) {
|
|
3558
|
-
|
|
3559
|
-
this.telInput.style.paddingRight = this.originalPaddingRight;
|
|
3560
|
-
} else {
|
|
3561
|
-
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3562
|
-
}
|
|
3548
|
+
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3563
3549
|
}
|
|
3564
3550
|
const wrapper = this.telInput.parentNode;
|
|
3565
3551
|
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
|
|
@@ -3610,11 +3596,19 @@ var Iti = class _Iti {
|
|
|
3610
3596
|
}
|
|
3611
3597
|
return -99;
|
|
3612
3598
|
}
|
|
3613
|
-
//* Validate the input val
|
|
3599
|
+
//* Validate the input val using number length only
|
|
3614
3600
|
isValidNumber() {
|
|
3601
|
+
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3602
|
+
if (dialCode === "44" && intlTelInput.utils) {
|
|
3603
|
+
const number = this._getFullNumber();
|
|
3604
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3605
|
+
if (coreNumber[0] === "7" && coreNumber.length !== 10) {
|
|
3606
|
+
return false;
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3615
3609
|
return this._validateNumber(false);
|
|
3616
3610
|
}
|
|
3617
|
-
//* Validate the input val
|
|
3611
|
+
//* Validate the input val with precise validation
|
|
3618
3612
|
isValidNumberPrecise() {
|
|
3619
3613
|
return this._validateNumber(true);
|
|
3620
3614
|
}
|
|
@@ -3623,6 +3617,9 @@ var Iti = class _Iti {
|
|
|
3623
3617
|
}
|
|
3624
3618
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3625
3619
|
_validateNumber(precise) {
|
|
3620
|
+
if (!intlTelInput.utils) {
|
|
3621
|
+
return null;
|
|
3622
|
+
}
|
|
3626
3623
|
if (!this.selectedCountryData.iso2) {
|
|
3627
3624
|
return false;
|
|
3628
3625
|
}
|
|
@@ -3734,7 +3731,7 @@ var intlTelInput = Object.assign(
|
|
|
3734
3731
|
attachUtils,
|
|
3735
3732
|
startedLoadingUtilsScript: false,
|
|
3736
3733
|
startedLoadingAutoCountry: false,
|
|
3737
|
-
version: "25.10.
|
|
3734
|
+
version: "25.10.12"
|
|
3738
3735
|
}
|
|
3739
3736
|
);
|
|
3740
3737
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2298,15 +2298,8 @@ var Iti = class _Iti {
|
|
|
2298
2298
|
_detectEnvironmentAndLayout() {
|
|
2299
2299
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2300
2300
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2301
|
-
this.telInput.dir = "ltr";
|
|
2302
|
-
const showOnDefaultSide = this.options.allowDropdown || this.options.separateDialCode;
|
|
2303
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !showOnDefaultSide : showOnDefaultSide;
|
|
2304
2301
|
if (this.options.separateDialCode) {
|
|
2305
|
-
|
|
2306
|
-
this.originalPaddingRight = this.telInput.style.paddingRight;
|
|
2307
|
-
} else {
|
|
2308
|
-
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2309
|
-
}
|
|
2302
|
+
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2310
2303
|
}
|
|
2311
2304
|
}
|
|
2312
2305
|
_createInitPromises() {
|
|
@@ -2377,6 +2370,9 @@ var Iti = class _Iti {
|
|
|
2377
2370
|
[containerClass]: Boolean(containerClass)
|
|
2378
2371
|
});
|
|
2379
2372
|
const wrapper = createEl("div", { class: parentClasses });
|
|
2373
|
+
if (this.isRTL) {
|
|
2374
|
+
wrapper.setAttribute("dir", "ltr");
|
|
2375
|
+
}
|
|
2380
2376
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
2381
2377
|
return wrapper;
|
|
2382
2378
|
}
|
|
@@ -2393,11 +2389,6 @@ var Iti = class _Iti {
|
|
|
2393
2389
|
{ class: "iti__country-container iti__v-hide" },
|
|
2394
2390
|
wrapper
|
|
2395
2391
|
);
|
|
2396
|
-
if (this.showSelectedCountryOnLeft) {
|
|
2397
|
-
this.countryContainer.style.left = "0px";
|
|
2398
|
-
} else {
|
|
2399
|
-
this.countryContainer.style.right = "0px";
|
|
2400
|
-
}
|
|
2401
2392
|
if (allowDropdown) {
|
|
2402
2393
|
this.selectedCountry = createEl(
|
|
2403
2394
|
"button",
|
|
@@ -2441,7 +2432,7 @@ var Iti = class _Iti {
|
|
|
2441
2432
|
if (separateDialCode) {
|
|
2442
2433
|
this.selectedDialCode = createEl(
|
|
2443
2434
|
"div",
|
|
2444
|
-
{ class: "iti__selected-dial-code"
|
|
2435
|
+
{ class: "iti__selected-dial-code" },
|
|
2445
2436
|
this.selectedCountry
|
|
2446
2437
|
);
|
|
2447
2438
|
}
|
|
@@ -2466,6 +2457,9 @@ var Iti = class _Iti {
|
|
|
2466
2457
|
role: "dialog",
|
|
2467
2458
|
"aria-modal": "true"
|
|
2468
2459
|
});
|
|
2460
|
+
if (this.isRTL) {
|
|
2461
|
+
this.dropdownContent.setAttribute("dir", "rtl");
|
|
2462
|
+
}
|
|
2469
2463
|
if (countrySearch) {
|
|
2470
2464
|
this._buildSearchUI();
|
|
2471
2465
|
}
|
|
@@ -3303,11 +3297,7 @@ var Iti = class _Iti {
|
|
|
3303
3297
|
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
3304
3298
|
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
3305
3299
|
const inputPadding = selectedCountryWidth + 6;
|
|
3306
|
-
|
|
3307
|
-
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3308
|
-
} else {
|
|
3309
|
-
this.telInput.style.paddingRight = `${inputPadding}px`;
|
|
3310
|
-
}
|
|
3300
|
+
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3311
3301
|
}
|
|
3312
3302
|
}
|
|
3313
3303
|
//* Update the maximum valid number length for the currently selected country.
|
|
@@ -3591,11 +3581,7 @@ var Iti = class _Iti {
|
|
|
3591
3581
|
}
|
|
3592
3582
|
this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
3593
3583
|
if (separateDialCode) {
|
|
3594
|
-
|
|
3595
|
-
this.telInput.style.paddingRight = this.originalPaddingRight;
|
|
3596
|
-
} else {
|
|
3597
|
-
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3598
|
-
}
|
|
3584
|
+
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3599
3585
|
}
|
|
3600
3586
|
const wrapper = this.telInput.parentNode;
|
|
3601
3587
|
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
|
|
@@ -3646,11 +3632,19 @@ var Iti = class _Iti {
|
|
|
3646
3632
|
}
|
|
3647
3633
|
return -99;
|
|
3648
3634
|
}
|
|
3649
|
-
//* Validate the input val
|
|
3635
|
+
//* Validate the input val using number length only
|
|
3650
3636
|
isValidNumber() {
|
|
3637
|
+
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3638
|
+
if (dialCode === "44" && intlTelInput.utils) {
|
|
3639
|
+
const number = this._getFullNumber();
|
|
3640
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3641
|
+
if (coreNumber[0] === "7" && coreNumber.length !== 10) {
|
|
3642
|
+
return false;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3651
3645
|
return this._validateNumber(false);
|
|
3652
3646
|
}
|
|
3653
|
-
//* Validate the input val
|
|
3647
|
+
//* Validate the input val with precise validation
|
|
3654
3648
|
isValidNumberPrecise() {
|
|
3655
3649
|
return this._validateNumber(true);
|
|
3656
3650
|
}
|
|
@@ -3659,6 +3653,9 @@ var Iti = class _Iti {
|
|
|
3659
3653
|
}
|
|
3660
3654
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3661
3655
|
_validateNumber(precise) {
|
|
3656
|
+
if (!intlTelInput.utils) {
|
|
3657
|
+
return null;
|
|
3658
|
+
}
|
|
3662
3659
|
if (!this.selectedCountryData.iso2) {
|
|
3663
3660
|
return false;
|
|
3664
3661
|
}
|
|
@@ -3770,7 +3767,7 @@ var intlTelInput = Object.assign(
|
|
|
3770
3767
|
attachUtils,
|
|
3771
3768
|
startedLoadingUtilsScript: false,
|
|
3772
3769
|
startedLoadingAutoCountry: false,
|
|
3773
|
-
version: "25.10.
|
|
3770
|
+
version: "25.10.12"
|
|
3774
3771
|
}
|
|
3775
3772
|
);
|
|
3776
3773
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2262,15 +2262,8 @@ var Iti = class _Iti {
|
|
|
2262
2262
|
_detectEnvironmentAndLayout() {
|
|
2263
2263
|
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2264
2264
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2265
|
-
this.telInput.dir = "ltr";
|
|
2266
|
-
const showOnDefaultSide = this.options.allowDropdown || this.options.separateDialCode;
|
|
2267
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !showOnDefaultSide : showOnDefaultSide;
|
|
2268
2265
|
if (this.options.separateDialCode) {
|
|
2269
|
-
|
|
2270
|
-
this.originalPaddingRight = this.telInput.style.paddingRight;
|
|
2271
|
-
} else {
|
|
2272
|
-
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2273
|
-
}
|
|
2266
|
+
this.originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2274
2267
|
}
|
|
2275
2268
|
}
|
|
2276
2269
|
_createInitPromises() {
|
|
@@ -2341,6 +2334,9 @@ var Iti = class _Iti {
|
|
|
2341
2334
|
[containerClass]: Boolean(containerClass)
|
|
2342
2335
|
});
|
|
2343
2336
|
const wrapper = createEl("div", { class: parentClasses });
|
|
2337
|
+
if (this.isRTL) {
|
|
2338
|
+
wrapper.setAttribute("dir", "ltr");
|
|
2339
|
+
}
|
|
2344
2340
|
this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
|
|
2345
2341
|
return wrapper;
|
|
2346
2342
|
}
|
|
@@ -2357,11 +2353,6 @@ var Iti = class _Iti {
|
|
|
2357
2353
|
{ class: "iti__country-container iti__v-hide" },
|
|
2358
2354
|
wrapper
|
|
2359
2355
|
);
|
|
2360
|
-
if (this.showSelectedCountryOnLeft) {
|
|
2361
|
-
this.countryContainer.style.left = "0px";
|
|
2362
|
-
} else {
|
|
2363
|
-
this.countryContainer.style.right = "0px";
|
|
2364
|
-
}
|
|
2365
2356
|
if (allowDropdown) {
|
|
2366
2357
|
this.selectedCountry = createEl(
|
|
2367
2358
|
"button",
|
|
@@ -2405,7 +2396,7 @@ var Iti = class _Iti {
|
|
|
2405
2396
|
if (separateDialCode) {
|
|
2406
2397
|
this.selectedDialCode = createEl(
|
|
2407
2398
|
"div",
|
|
2408
|
-
{ class: "iti__selected-dial-code"
|
|
2399
|
+
{ class: "iti__selected-dial-code" },
|
|
2409
2400
|
this.selectedCountry
|
|
2410
2401
|
);
|
|
2411
2402
|
}
|
|
@@ -2430,6 +2421,9 @@ var Iti = class _Iti {
|
|
|
2430
2421
|
role: "dialog",
|
|
2431
2422
|
"aria-modal": "true"
|
|
2432
2423
|
});
|
|
2424
|
+
if (this.isRTL) {
|
|
2425
|
+
this.dropdownContent.setAttribute("dir", "rtl");
|
|
2426
|
+
}
|
|
2433
2427
|
if (countrySearch) {
|
|
2434
2428
|
this._buildSearchUI();
|
|
2435
2429
|
}
|
|
@@ -3267,11 +3261,7 @@ var Iti = class _Iti {
|
|
|
3267
3261
|
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
3268
3262
|
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
3269
3263
|
const inputPadding = selectedCountryWidth + 6;
|
|
3270
|
-
|
|
3271
|
-
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3272
|
-
} else {
|
|
3273
|
-
this.telInput.style.paddingRight = `${inputPadding}px`;
|
|
3274
|
-
}
|
|
3264
|
+
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
3275
3265
|
}
|
|
3276
3266
|
}
|
|
3277
3267
|
//* Update the maximum valid number length for the currently selected country.
|
|
@@ -3555,11 +3545,7 @@ var Iti = class _Iti {
|
|
|
3555
3545
|
}
|
|
3556
3546
|
this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
3557
3547
|
if (separateDialCode) {
|
|
3558
|
-
|
|
3559
|
-
this.telInput.style.paddingRight = this.originalPaddingRight;
|
|
3560
|
-
} else {
|
|
3561
|
-
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3562
|
-
}
|
|
3548
|
+
this.telInput.style.paddingLeft = this.originalPaddingLeft;
|
|
3563
3549
|
}
|
|
3564
3550
|
const wrapper = this.telInput.parentNode;
|
|
3565
3551
|
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
|
|
@@ -3610,11 +3596,19 @@ var Iti = class _Iti {
|
|
|
3610
3596
|
}
|
|
3611
3597
|
return -99;
|
|
3612
3598
|
}
|
|
3613
|
-
//* Validate the input val
|
|
3599
|
+
//* Validate the input val using number length only
|
|
3614
3600
|
isValidNumber() {
|
|
3601
|
+
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3602
|
+
if (dialCode === "44" && intlTelInput.utils) {
|
|
3603
|
+
const number = this._getFullNumber();
|
|
3604
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3605
|
+
if (coreNumber[0] === "7" && coreNumber.length !== 10) {
|
|
3606
|
+
return false;
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3615
3609
|
return this._validateNumber(false);
|
|
3616
3610
|
}
|
|
3617
|
-
//* Validate the input val
|
|
3611
|
+
//* Validate the input val with precise validation
|
|
3618
3612
|
isValidNumberPrecise() {
|
|
3619
3613
|
return this._validateNumber(true);
|
|
3620
3614
|
}
|
|
@@ -3623,6 +3617,9 @@ var Iti = class _Iti {
|
|
|
3623
3617
|
}
|
|
3624
3618
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3625
3619
|
_validateNumber(precise) {
|
|
3620
|
+
if (!intlTelInput.utils) {
|
|
3621
|
+
return null;
|
|
3622
|
+
}
|
|
3626
3623
|
if (!this.selectedCountryData.iso2) {
|
|
3627
3624
|
return false;
|
|
3628
3625
|
}
|
|
@@ -3734,7 +3731,7 @@ var intlTelInput = Object.assign(
|
|
|
3734
3731
|
attachUtils,
|
|
3735
3732
|
startedLoadingUtilsScript: false,
|
|
3736
3733
|
startedLoadingAutoCountry: false,
|
|
3737
|
-
version: "25.10.
|
|
3734
|
+
version: "25.10.12"
|
|
3738
3735
|
}
|
|
3739
3736
|
);
|
|
3740
3737
|
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.10.
|
|
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.10.12/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.
|