intl-tel-input 25.10.0 → 25.10.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 +41 -19
- package/angular/build/IntlTelInputWithUtils.js +41 -19
- package/angular/build/types/intl-tel-input/angular.d.ts +3 -2
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +3 -2
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +22 -11
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +22 -11
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +21 -10
- package/react/build/IntlTelInput.js +21 -10
- package/react/build/IntlTelInputWithUtils.cjs +21 -10
- package/react/build/IntlTelInputWithUtils.js +21 -10
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +60 -53
- package/vue/build/IntlTelInputWithUtils.mjs +102 -95
package/README.md
CHANGED
|
@@ -77,16 +77,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
77
77
|
## Getting Started (Using a CDN)
|
|
78
78
|
1. Add the CSS
|
|
79
79
|
```html
|
|
80
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
80
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.3/build/css/intlTelInput.css">
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
2. Add the plugin script and initialise it on your input element
|
|
84
84
|
```html
|
|
85
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
85
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.3/build/js/intlTelInput.min.js"></script>
|
|
86
86
|
<script>
|
|
87
87
|
const input = document.querySelector("#phone");
|
|
88
88
|
window.intlTelInput(input, {
|
|
89
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
89
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.3/build/js/utils.js"),
|
|
90
90
|
});
|
|
91
91
|
</script>
|
|
92
92
|
```
|
|
@@ -326,7 +326,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
|
|
|
326
326
|
```js
|
|
327
327
|
// (A) import utils module from a CDN
|
|
328
328
|
intlTelInput(htmlInputElement, {
|
|
329
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
329
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.3/build/js/utils.js"),
|
|
330
330
|
});
|
|
331
331
|
|
|
332
332
|
// (B) import utils module from your own hosted version of utils.js
|
|
@@ -610,7 +610,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
|
|
|
610
610
|
```js
|
|
611
611
|
// (A) import utils module from a CDN
|
|
612
612
|
intlTelInput(htmlInputElement, {
|
|
613
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.
|
|
613
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.3/build/js/utils.js"),
|
|
614
614
|
});
|
|
615
615
|
|
|
616
616
|
// (B) import utils module from your own hosted version of utils.js
|
package/angular/README.md
CHANGED
|
@@ -29,7 +29,7 @@ import "intl-tel-input/styles";
|
|
|
29
29
|
|
|
30
30
|
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation.
|
|
31
31
|
|
|
32
|
-
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/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` 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.
|
|
32
|
+
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/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` 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.3/build/js/utils.js"`.
|
|
33
33
|
|
|
34
34
|
## Props
|
|
35
35
|
Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
|
|
@@ -1921,7 +1921,12 @@ var Iti = class _Iti {
|
|
|
1921
1921
|
const wrapper = createEl("div", { class: parentClasses });
|
|
1922
1922
|
(_a = this.telInput.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(wrapper, this.telInput);
|
|
1923
1923
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1924
|
-
this.countryContainer = createEl(
|
|
1924
|
+
this.countryContainer = createEl(
|
|
1925
|
+
"div",
|
|
1926
|
+
// visibly hidden until we measure it's width to set the input padding correctly
|
|
1927
|
+
{ class: "iti__country-container iti__v-hide" },
|
|
1928
|
+
wrapper
|
|
1929
|
+
);
|
|
1925
1930
|
if (this.showSelectedCountryOnLeft) {
|
|
1926
1931
|
this.countryContainer.style.left = "0px";
|
|
1927
1932
|
} else {
|
|
@@ -2032,7 +2037,10 @@ var Iti = class _Iti {
|
|
|
2032
2037
|
}
|
|
2033
2038
|
}
|
|
2034
2039
|
wrapper.appendChild(this.telInput);
|
|
2035
|
-
this.
|
|
2040
|
+
if (this.countryContainer) {
|
|
2041
|
+
this._updateInputPadding();
|
|
2042
|
+
this.countryContainer.classList.remove("iti__v-hide");
|
|
2043
|
+
}
|
|
2036
2044
|
if (hiddenInput) {
|
|
2037
2045
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2038
2046
|
const names = hiddenInput(telInputName);
|
|
@@ -2674,7 +2682,8 @@ var Iti = class _Iti {
|
|
|
2674
2682
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2675
2683
|
_updateInputPadding() {
|
|
2676
2684
|
if (this.selectedCountry) {
|
|
2677
|
-
const
|
|
2685
|
+
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
2686
|
+
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
2678
2687
|
const inputPadding = selectedCountryWidth + 6;
|
|
2679
2688
|
if (this.showSelectedCountryOnLeft) {
|
|
2680
2689
|
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
@@ -2706,21 +2715,27 @@ var Iti = class _Iti {
|
|
|
2706
2715
|
}
|
|
2707
2716
|
}
|
|
2708
2717
|
}
|
|
2709
|
-
//* When
|
|
2710
|
-
//*
|
|
2711
|
-
//*
|
|
2712
|
-
//*
|
|
2718
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2719
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2720
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2721
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2713
2722
|
_getHiddenSelectedCountryWidth() {
|
|
2714
2723
|
if (this.telInput.parentNode) {
|
|
2724
|
+
let body;
|
|
2725
|
+
try {
|
|
2726
|
+
body = window.top.document.body;
|
|
2727
|
+
} catch (e) {
|
|
2728
|
+
body = document.body;
|
|
2729
|
+
}
|
|
2715
2730
|
const containerClone = this.telInput.parentNode.cloneNode(false);
|
|
2716
2731
|
containerClone.style.visibility = "hidden";
|
|
2717
|
-
|
|
2732
|
+
body.appendChild(containerClone);
|
|
2718
2733
|
const countryContainerClone = this.countryContainer.cloneNode();
|
|
2719
2734
|
containerClone.appendChild(countryContainerClone);
|
|
2720
2735
|
const selectedCountryClone = this.selectedCountry.cloneNode(true);
|
|
2721
2736
|
countryContainerClone.appendChild(selectedCountryClone);
|
|
2722
2737
|
const width = selectedCountryClone.offsetWidth;
|
|
2723
|
-
|
|
2738
|
+
body.removeChild(containerClone);
|
|
2724
2739
|
return width;
|
|
2725
2740
|
}
|
|
2726
2741
|
return 0;
|
|
@@ -3104,7 +3119,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3104
3119
|
attachUtils,
|
|
3105
3120
|
startedLoadingUtilsScript: false,
|
|
3106
3121
|
startedLoadingAutoCountry: false,
|
|
3107
|
-
version: "25.10.
|
|
3122
|
+
version: "25.10.3"
|
|
3108
3123
|
});
|
|
3109
3124
|
var intl_tel_input_default = intlTelInput;
|
|
3110
3125
|
|
|
@@ -3153,10 +3168,19 @@ var IntlTelInputComponent = class {
|
|
|
3153
3168
|
}
|
|
3154
3169
|
}
|
|
3155
3170
|
ngAfterViewInit() {
|
|
3156
|
-
var _a;
|
|
3171
|
+
var _a, _b;
|
|
3157
3172
|
if (this.initialValue) {
|
|
3158
3173
|
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setNumber(this.initialValue);
|
|
3159
3174
|
}
|
|
3175
|
+
if (this.disabled) {
|
|
3176
|
+
(_b = this.iti) === null || _b === void 0 ? void 0 : _b.setDisabled(this.disabled);
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
ngOnChanges(changes) {
|
|
3180
|
+
var _a;
|
|
3181
|
+
if (changes["disabled"]) {
|
|
3182
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setDisabled(this.disabled || false);
|
|
3183
|
+
}
|
|
3160
3184
|
}
|
|
3161
3185
|
handleInput() {
|
|
3162
3186
|
if (!this.iti)
|
|
@@ -3198,8 +3222,8 @@ var IntlTelInputComponent = class {
|
|
|
3198
3222
|
}
|
|
3199
3223
|
// ============ ControlValueAccessor Implementation ============
|
|
3200
3224
|
writeValue(value) {
|
|
3201
|
-
if (this.iti
|
|
3202
|
-
this.iti.setNumber(value);
|
|
3225
|
+
if (this.iti) {
|
|
3226
|
+
this.iti.setNumber(value || "");
|
|
3203
3227
|
}
|
|
3204
3228
|
}
|
|
3205
3229
|
registerOnChange(fn) {
|
|
@@ -3209,7 +3233,9 @@ var IntlTelInputComponent = class {
|
|
|
3209
3233
|
this.onTouched = fn;
|
|
3210
3234
|
}
|
|
3211
3235
|
setDisabledState(isDisabled) {
|
|
3236
|
+
var _a;
|
|
3212
3237
|
this.disabled = isDisabled;
|
|
3238
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setDisabled(isDisabled);
|
|
3213
3239
|
}
|
|
3214
3240
|
// ============ Validator Implementation ============
|
|
3215
3241
|
validate(control) {
|
|
@@ -3254,7 +3280,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3254
3280
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3255
3281
|
multi: true
|
|
3256
3282
|
}
|
|
3257
|
-
])], decls: 2, vars:
|
|
3283
|
+
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3258
3284
|
if (rf & 1) {
|
|
3259
3285
|
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
3260
3286
|
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
@@ -3267,9 +3293,6 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3267
3293
|
});
|
|
3268
3294
|
i0.\u0275\u0275elementEnd();
|
|
3269
3295
|
}
|
|
3270
|
-
if (rf & 2) {
|
|
3271
|
-
i0.\u0275\u0275property("disabled", ctx.disabled);
|
|
3272
|
-
}
|
|
3273
3296
|
}, encapsulation: 2 });
|
|
3274
3297
|
(() => {
|
|
3275
3298
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassMetadata(IntlTelInputComponent, [{
|
|
@@ -3283,7 +3306,6 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3283
3306
|
#inputRef
|
|
3284
3307
|
(input)="handleInput()"
|
|
3285
3308
|
(blur)="handleBlur()"
|
|
3286
|
-
[disabled]="disabled"
|
|
3287
3309
|
/>
|
|
3288
3310
|
`,
|
|
3289
3311
|
providers: [
|
|
@@ -3323,7 +3345,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3323
3345
|
}] });
|
|
3324
3346
|
})();
|
|
3325
3347
|
(() => {
|
|
3326
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber:
|
|
3348
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber: 41 });
|
|
3327
3349
|
})();
|
|
3328
3350
|
export {
|
|
3329
3351
|
IntlTelInputComponent,
|
|
@@ -1921,7 +1921,12 @@ var Iti = class _Iti {
|
|
|
1921
1921
|
const wrapper = createEl("div", { class: parentClasses });
|
|
1922
1922
|
(_a = this.telInput.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(wrapper, this.telInput);
|
|
1923
1923
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1924
|
-
this.countryContainer = createEl(
|
|
1924
|
+
this.countryContainer = createEl(
|
|
1925
|
+
"div",
|
|
1926
|
+
// visibly hidden until we measure it's width to set the input padding correctly
|
|
1927
|
+
{ class: "iti__country-container iti__v-hide" },
|
|
1928
|
+
wrapper
|
|
1929
|
+
);
|
|
1925
1930
|
if (this.showSelectedCountryOnLeft) {
|
|
1926
1931
|
this.countryContainer.style.left = "0px";
|
|
1927
1932
|
} else {
|
|
@@ -2032,7 +2037,10 @@ var Iti = class _Iti {
|
|
|
2032
2037
|
}
|
|
2033
2038
|
}
|
|
2034
2039
|
wrapper.appendChild(this.telInput);
|
|
2035
|
-
this.
|
|
2040
|
+
if (this.countryContainer) {
|
|
2041
|
+
this._updateInputPadding();
|
|
2042
|
+
this.countryContainer.classList.remove("iti__v-hide");
|
|
2043
|
+
}
|
|
2036
2044
|
if (hiddenInput) {
|
|
2037
2045
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2038
2046
|
const names = hiddenInput(telInputName);
|
|
@@ -2674,7 +2682,8 @@ var Iti = class _Iti {
|
|
|
2674
2682
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2675
2683
|
_updateInputPadding() {
|
|
2676
2684
|
if (this.selectedCountry) {
|
|
2677
|
-
const
|
|
2685
|
+
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
2686
|
+
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
2678
2687
|
const inputPadding = selectedCountryWidth + 6;
|
|
2679
2688
|
if (this.showSelectedCountryOnLeft) {
|
|
2680
2689
|
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
@@ -2706,21 +2715,27 @@ var Iti = class _Iti {
|
|
|
2706
2715
|
}
|
|
2707
2716
|
}
|
|
2708
2717
|
}
|
|
2709
|
-
//* When
|
|
2710
|
-
//*
|
|
2711
|
-
//*
|
|
2712
|
-
//*
|
|
2718
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2719
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2720
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2721
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2713
2722
|
_getHiddenSelectedCountryWidth() {
|
|
2714
2723
|
if (this.telInput.parentNode) {
|
|
2724
|
+
let body;
|
|
2725
|
+
try {
|
|
2726
|
+
body = window.top.document.body;
|
|
2727
|
+
} catch (e) {
|
|
2728
|
+
body = document.body;
|
|
2729
|
+
}
|
|
2715
2730
|
const containerClone = this.telInput.parentNode.cloneNode(false);
|
|
2716
2731
|
containerClone.style.visibility = "hidden";
|
|
2717
|
-
|
|
2732
|
+
body.appendChild(containerClone);
|
|
2718
2733
|
const countryContainerClone = this.countryContainer.cloneNode();
|
|
2719
2734
|
containerClone.appendChild(countryContainerClone);
|
|
2720
2735
|
const selectedCountryClone = this.selectedCountry.cloneNode(true);
|
|
2721
2736
|
countryContainerClone.appendChild(selectedCountryClone);
|
|
2722
2737
|
const width = selectedCountryClone.offsetWidth;
|
|
2723
|
-
|
|
2738
|
+
body.removeChild(containerClone);
|
|
2724
2739
|
return width;
|
|
2725
2740
|
}
|
|
2726
2741
|
return 0;
|
|
@@ -3104,7 +3119,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3104
3119
|
attachUtils,
|
|
3105
3120
|
startedLoadingUtilsScript: false,
|
|
3106
3121
|
startedLoadingAutoCountry: false,
|
|
3107
|
-
version: "25.10.
|
|
3122
|
+
version: "25.10.3"
|
|
3108
3123
|
});
|
|
3109
3124
|
var intl_tel_input_default = intlTelInput;
|
|
3110
3125
|
|
|
@@ -9590,10 +9605,19 @@ var IntlTelInputComponent = class {
|
|
|
9590
9605
|
}
|
|
9591
9606
|
}
|
|
9592
9607
|
ngAfterViewInit() {
|
|
9593
|
-
var _a;
|
|
9608
|
+
var _a, _b;
|
|
9594
9609
|
if (this.initialValue) {
|
|
9595
9610
|
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setNumber(this.initialValue);
|
|
9596
9611
|
}
|
|
9612
|
+
if (this.disabled) {
|
|
9613
|
+
(_b = this.iti) === null || _b === void 0 ? void 0 : _b.setDisabled(this.disabled);
|
|
9614
|
+
}
|
|
9615
|
+
}
|
|
9616
|
+
ngOnChanges(changes) {
|
|
9617
|
+
var _a;
|
|
9618
|
+
if (changes["disabled"]) {
|
|
9619
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setDisabled(this.disabled || false);
|
|
9620
|
+
}
|
|
9597
9621
|
}
|
|
9598
9622
|
handleInput() {
|
|
9599
9623
|
if (!this.iti)
|
|
@@ -9635,8 +9659,8 @@ var IntlTelInputComponent = class {
|
|
|
9635
9659
|
}
|
|
9636
9660
|
// ============ ControlValueAccessor Implementation ============
|
|
9637
9661
|
writeValue(value) {
|
|
9638
|
-
if (this.iti
|
|
9639
|
-
this.iti.setNumber(value);
|
|
9662
|
+
if (this.iti) {
|
|
9663
|
+
this.iti.setNumber(value || "");
|
|
9640
9664
|
}
|
|
9641
9665
|
}
|
|
9642
9666
|
registerOnChange(fn) {
|
|
@@ -9646,7 +9670,9 @@ var IntlTelInputComponent = class {
|
|
|
9646
9670
|
this.onTouched = fn;
|
|
9647
9671
|
}
|
|
9648
9672
|
setDisabledState(isDisabled) {
|
|
9673
|
+
var _a;
|
|
9649
9674
|
this.disabled = isDisabled;
|
|
9675
|
+
(_a = this.iti) === null || _a === void 0 ? void 0 : _a.setDisabled(isDisabled);
|
|
9650
9676
|
}
|
|
9651
9677
|
// ============ Validator Implementation ============
|
|
9652
9678
|
validate(control) {
|
|
@@ -9691,7 +9717,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
9691
9717
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
9692
9718
|
multi: true
|
|
9693
9719
|
}
|
|
9694
|
-
])], decls: 2, vars:
|
|
9720
|
+
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
9695
9721
|
if (rf & 1) {
|
|
9696
9722
|
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
9697
9723
|
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
@@ -9704,9 +9730,6 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
9704
9730
|
});
|
|
9705
9731
|
i0.\u0275\u0275elementEnd();
|
|
9706
9732
|
}
|
|
9707
|
-
if (rf & 2) {
|
|
9708
|
-
i0.\u0275\u0275property("disabled", ctx.disabled);
|
|
9709
|
-
}
|
|
9710
9733
|
}, encapsulation: 2 });
|
|
9711
9734
|
(() => {
|
|
9712
9735
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassMetadata(IntlTelInputComponent, [{
|
|
@@ -9720,7 +9743,6 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
9720
9743
|
#inputRef
|
|
9721
9744
|
(input)="handleInput()"
|
|
9722
9745
|
(blur)="handleBlur()"
|
|
9723
|
-
[disabled]="disabled"
|
|
9724
9746
|
/>
|
|
9725
9747
|
`,
|
|
9726
9748
|
providers: [
|
|
@@ -9760,7 +9782,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
9760
9782
|
}] });
|
|
9761
9783
|
})();
|
|
9762
9784
|
(() => {
|
|
9763
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber:
|
|
9785
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber: 42 });
|
|
9764
9786
|
})();
|
|
9765
9787
|
export {
|
|
9766
9788
|
IntlTelInputComponent,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import intlTelInput from "../intl-tel-input";
|
|
2
2
|
import { Iti, SomeOptions } from "../intl-tel-input";
|
|
3
|
-
import { OnInit, OnDestroy, ElementRef, EventEmitter, AfterViewInit } from "@angular/core";
|
|
3
|
+
import { OnInit, OnDestroy, ElementRef, EventEmitter, AfterViewInit, OnChanges, SimpleChanges } from "@angular/core";
|
|
4
4
|
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from "@angular/forms";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export { intlTelInput };
|
|
7
7
|
export declare const PHONE_ERROR_MESSAGES: string[];
|
|
8
|
-
export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor, Validator {
|
|
8
|
+
export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges, ControlValueAccessor, Validator {
|
|
9
9
|
inputRef: ElementRef<HTMLInputElement>;
|
|
10
10
|
initialValue: string;
|
|
11
11
|
usePreciseValidation: boolean;
|
|
@@ -23,6 +23,7 @@ export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnD
|
|
|
23
23
|
private onValidatorChange;
|
|
24
24
|
ngOnInit(): void;
|
|
25
25
|
ngAfterViewInit(): void;
|
|
26
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
26
27
|
handleInput(): void;
|
|
27
28
|
handleBlur(): void;
|
|
28
29
|
getInstance(): Iti | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import intlTelInput from "./intlTelInputWithUtils";
|
|
2
2
|
import { Iti, SomeOptions } from "../intl-tel-input";
|
|
3
|
-
import { OnInit, OnDestroy, ElementRef, EventEmitter, AfterViewInit } from "@angular/core";
|
|
3
|
+
import { OnInit, OnDestroy, ElementRef, EventEmitter, AfterViewInit, OnChanges, SimpleChanges } from "@angular/core";
|
|
4
4
|
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from "@angular/forms";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export { intlTelInput };
|
|
7
7
|
export declare const PHONE_ERROR_MESSAGES: string[];
|
|
8
|
-
export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor, Validator {
|
|
8
|
+
export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges, ControlValueAccessor, Validator {
|
|
9
9
|
inputRef: ElementRef<HTMLInputElement>;
|
|
10
10
|
initialValue: string;
|
|
11
11
|
usePreciseValidation: boolean;
|
|
@@ -23,6 +23,7 @@ export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnD
|
|
|
23
23
|
private onValidatorChange;
|
|
24
24
|
ngOnInit(): void;
|
|
25
25
|
ngAfterViewInit(): void;
|
|
26
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
26
27
|
handleInput(): void;
|
|
27
28
|
handleBlur(): void;
|
|
28
29
|
getInstance(): Iti | null;
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v25.10.
|
|
2
|
+
* International Telephone Input v25.10.3
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1982,7 +1982,8 @@ var factoryOutput = (() => {
|
|
|
1982
1982
|
if (allowDropdown || showFlags || separateDialCode) {
|
|
1983
1983
|
this.countryContainer = createEl(
|
|
1984
1984
|
"div",
|
|
1985
|
-
|
|
1985
|
+
// visibly hidden until we measure it's width to set the input padding correctly
|
|
1986
|
+
{ class: "iti__country-container iti__v-hide" },
|
|
1986
1987
|
wrapper
|
|
1987
1988
|
);
|
|
1988
1989
|
if (this.showSelectedCountryOnLeft) {
|
|
@@ -2147,7 +2148,10 @@ var factoryOutput = (() => {
|
|
|
2147
2148
|
}
|
|
2148
2149
|
}
|
|
2149
2150
|
wrapper.appendChild(this.telInput);
|
|
2150
|
-
this.
|
|
2151
|
+
if (this.countryContainer) {
|
|
2152
|
+
this._updateInputPadding();
|
|
2153
|
+
this.countryContainer.classList.remove("iti__v-hide");
|
|
2154
|
+
}
|
|
2151
2155
|
if (hiddenInput) {
|
|
2152
2156
|
const telInputName = this.telInput.getAttribute("name") || "";
|
|
2153
2157
|
const names = hiddenInput(telInputName);
|
|
@@ -2807,7 +2811,8 @@ var factoryOutput = (() => {
|
|
|
2807
2811
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2808
2812
|
_updateInputPadding() {
|
|
2809
2813
|
if (this.selectedCountry) {
|
|
2810
|
-
const
|
|
2814
|
+
const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
|
|
2815
|
+
const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
|
|
2811
2816
|
const inputPadding = selectedCountryWidth + 6;
|
|
2812
2817
|
if (this.showSelectedCountryOnLeft) {
|
|
2813
2818
|
this.telInput.style.paddingLeft = `${inputPadding}px`;
|
|
@@ -2844,21 +2849,27 @@ var factoryOutput = (() => {
|
|
|
2844
2849
|
}
|
|
2845
2850
|
}
|
|
2846
2851
|
}
|
|
2847
|
-
//* When
|
|
2848
|
-
//*
|
|
2849
|
-
//*
|
|
2850
|
-
//*
|
|
2852
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2853
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2854
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2855
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2851
2856
|
_getHiddenSelectedCountryWidth() {
|
|
2852
2857
|
if (this.telInput.parentNode) {
|
|
2858
|
+
let body;
|
|
2859
|
+
try {
|
|
2860
|
+
body = window.top.document.body;
|
|
2861
|
+
} catch (e) {
|
|
2862
|
+
body = document.body;
|
|
2863
|
+
}
|
|
2853
2864
|
const containerClone = this.telInput.parentNode.cloneNode(false);
|
|
2854
2865
|
containerClone.style.visibility = "hidden";
|
|
2855
|
-
|
|
2866
|
+
body.appendChild(containerClone);
|
|
2856
2867
|
const countryContainerClone = this.countryContainer.cloneNode();
|
|
2857
2868
|
containerClone.appendChild(countryContainerClone);
|
|
2858
2869
|
const selectedCountryClone = this.selectedCountry.cloneNode(true);
|
|
2859
2870
|
countryContainerClone.appendChild(selectedCountryClone);
|
|
2860
2871
|
const width = selectedCountryClone.offsetWidth;
|
|
2861
|
-
|
|
2872
|
+
body.removeChild(containerClone);
|
|
2862
2873
|
return width;
|
|
2863
2874
|
}
|
|
2864
2875
|
return 0;
|
|
@@ -3276,7 +3287,7 @@ var factoryOutput = (() => {
|
|
|
3276
3287
|
attachUtils,
|
|
3277
3288
|
startedLoadingUtilsScript: false,
|
|
3278
3289
|
startedLoadingAutoCountry: false,
|
|
3279
|
-
version: "25.10.
|
|
3290
|
+
version: "25.10.3"
|
|
3280
3291
|
}
|
|
3281
3292
|
);
|
|
3282
3293
|
var intl_tel_input_default = intlTelInput;
|