intl-tel-input 28.0.6 → 28.0.8
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/dist/js/data.js +1 -1
- package/dist/js/data.min.js +1 -1
- package/dist/js/intlTelInput.js +23 -3
- package/dist/js/intlTelInput.min.js +2 -2
- package/dist/js/intlTelInput.mjs +22 -2
- package/dist/js/intlTelInputWithUtils.js +23 -3
- package/dist/js/intlTelInputWithUtils.min.js +2 -2
- package/dist/js/intlTelInputWithUtils.mjs +22 -2
- package/package.json +1 -1
|
@@ -2467,6 +2467,7 @@ var UI = class _UI {
|
|
|
2467
2467
|
#highlightedListItemEl = null;
|
|
2468
2468
|
#listItemByIso2 = /* @__PURE__ */ new Map();
|
|
2469
2469
|
#dropdownAbortController = null;
|
|
2470
|
+
#resizeObserver;
|
|
2470
2471
|
// public
|
|
2471
2472
|
telInputEl;
|
|
2472
2473
|
hadInitialPlaceholder;
|
|
@@ -2508,6 +2509,7 @@ var UI = class _UI {
|
|
|
2508
2509
|
this.#buildCountryContainer(wrapper);
|
|
2509
2510
|
wrapper.appendChild(this.telInputEl);
|
|
2510
2511
|
this.#updateInputPaddingAndReveal();
|
|
2512
|
+
this.#observeSelectedCountryResize();
|
|
2511
2513
|
this.#buildHiddenInputs(wrapper);
|
|
2512
2514
|
this.ensureDropdownWidthSet();
|
|
2513
2515
|
}
|
|
@@ -2515,6 +2517,7 @@ var UI = class _UI {
|
|
|
2515
2517
|
const { allowDropdown, showFlags, containerClass, useFullscreenPopup } = this.#options;
|
|
2516
2518
|
const parentClasses = buildClassNames({
|
|
2517
2519
|
iti: true,
|
|
2520
|
+
"iti--input-container": true,
|
|
2518
2521
|
"iti--allow-dropdown": allowDropdown,
|
|
2519
2522
|
"iti--show-flags": showFlags,
|
|
2520
2523
|
"iti--inline-dropdown": !useFullscreenPopup,
|
|
@@ -2800,6 +2803,18 @@ var UI = class _UI {
|
|
|
2800
2803
|
this.telInputEl.style.paddingLeft = `${inputPadding}px`;
|
|
2801
2804
|
}
|
|
2802
2805
|
}
|
|
2806
|
+
//* Keep the input padding in sync when the selected country's rendered width changes — e.g. responsive font-size shifts that change the dial code text width. Skip while hidden (offsetWidth === 0) so we don't waste work or clobber the padding using a fallback constant.
|
|
2807
|
+
#observeSelectedCountryResize() {
|
|
2808
|
+
if (!this.#selectedCountryEl || typeof ResizeObserver === "undefined") {
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
2812
|
+
if (this.#selectedCountryEl?.offsetWidth) {
|
|
2813
|
+
this.#updateInputPadding();
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
this.#resizeObserver.observe(this.#selectedCountryEl);
|
|
2817
|
+
}
|
|
2803
2818
|
static #getBody() {
|
|
2804
2819
|
let body;
|
|
2805
2820
|
try {
|
|
@@ -3375,6 +3390,7 @@ var UI = class _UI {
|
|
|
3375
3390
|
destroy() {
|
|
3376
3391
|
this.telInputEl.iti = void 0;
|
|
3377
3392
|
delete this.telInputEl.dataset[DATA_KEYS.INSTANCE_ID];
|
|
3393
|
+
this.#resizeObserver?.disconnect();
|
|
3378
3394
|
this.telInputEl.style.paddingLeft = this.#originalPaddingLeft;
|
|
3379
3395
|
const wrapper = this.telInputEl.parentNode;
|
|
3380
3396
|
if (wrapper) {
|
|
@@ -4092,8 +4108,12 @@ var Iti = class _Iti {
|
|
|
4092
4108
|
});
|
|
4093
4109
|
this.#ui.telInputEl.dispatchEvent(e);
|
|
4094
4110
|
}
|
|
4095
|
-
//* Open the dropdown.
|
|
4111
|
+
//* Open the dropdown. Bail if already open — otherwise the existing AbortController gets overwritten
|
|
4112
|
+
//* and its listeners leak. Reachable via openDropdownWithPlus when dropdownAlwaysOpen is set
|
|
4096
4113
|
#openDropdown() {
|
|
4114
|
+
if (this.#ui.isDropdownOpen()) {
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4097
4117
|
this.#ui.openDropdown(
|
|
4098
4118
|
(li) => this.#selectListItem(li),
|
|
4099
4119
|
() => this.#closeDropdown()
|
|
@@ -4698,7 +4718,7 @@ var intlTelInput = Object.assign(
|
|
|
4698
4718
|
attachUtils,
|
|
4699
4719
|
startedLoadingUtils: false,
|
|
4700
4720
|
startedLoadingAutoCountry: false,
|
|
4701
|
-
version: "28.0.
|
|
4721
|
+
version: "28.0.8",
|
|
4702
4722
|
NUMBER_FORMAT,
|
|
4703
4723
|
NUMBER_TYPE,
|
|
4704
4724
|
VALIDATION_ERROR
|