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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-tel-input",
3
- "version": "25.10.0",
3
+ "version": "25.10.3",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
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.0/build/js/utils.js"`.
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.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.
@@ -1977,7 +1977,8 @@ var Iti = class _Iti {
1977
1977
  if (allowDropdown || showFlags || separateDialCode) {
1978
1978
  this.countryContainer = createEl(
1979
1979
  "div",
1980
- { class: "iti__country-container" },
1980
+ // visibly hidden until we measure it's width to set the input padding correctly
1981
+ { class: "iti__country-container iti__v-hide" },
1981
1982
  wrapper
1982
1983
  );
1983
1984
  if (this.showSelectedCountryOnLeft) {
@@ -2142,7 +2143,10 @@ var Iti = class _Iti {
2142
2143
  }
2143
2144
  }
2144
2145
  wrapper.appendChild(this.telInput);
2145
- this._updateInputPadding();
2146
+ if (this.countryContainer) {
2147
+ this._updateInputPadding();
2148
+ this.countryContainer.classList.remove("iti__v-hide");
2149
+ }
2146
2150
  if (hiddenInput) {
2147
2151
  const telInputName = this.telInput.getAttribute("name") || "";
2148
2152
  const names = hiddenInput(telInputName);
@@ -2802,7 +2806,8 @@ var Iti = class _Iti {
2802
2806
  //* Update the input padding to make space for the selected country/dial code.
2803
2807
  _updateInputPadding() {
2804
2808
  if (this.selectedCountry) {
2805
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2809
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2810
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2806
2811
  const inputPadding = selectedCountryWidth + 6;
2807
2812
  if (this.showSelectedCountryOnLeft) {
2808
2813
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2839,21 +2844,27 @@ var Iti = class _Iti {
2839
2844
  }
2840
2845
  }
2841
2846
  }
2842
- //* When the input is in a hidden container during initialisation, we must inject some markup
2843
- //* into the end of the DOM to calculate the correct offsetWidth.
2844
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2845
- //* will definitely exist.
2847
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2848
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2849
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2850
+ //* and then to inject a deep clone of the selectedCountry element.
2846
2851
  _getHiddenSelectedCountryWidth() {
2847
2852
  if (this.telInput.parentNode) {
2853
+ let body;
2854
+ try {
2855
+ body = window.top.document.body;
2856
+ } catch (e) {
2857
+ body = document.body;
2858
+ }
2848
2859
  const containerClone = this.telInput.parentNode.cloneNode(false);
2849
2860
  containerClone.style.visibility = "hidden";
2850
- document.body.appendChild(containerClone);
2861
+ body.appendChild(containerClone);
2851
2862
  const countryContainerClone = this.countryContainer.cloneNode();
2852
2863
  containerClone.appendChild(countryContainerClone);
2853
2864
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2854
2865
  countryContainerClone.appendChild(selectedCountryClone);
2855
2866
  const width = selectedCountryClone.offsetWidth;
2856
- document.body.removeChild(containerClone);
2867
+ body.removeChild(containerClone);
2857
2868
  return width;
2858
2869
  }
2859
2870
  return 0;
@@ -3271,7 +3282,7 @@ var intlTelInput = Object.assign(
3271
3282
  attachUtils,
3272
3283
  startedLoadingUtilsScript: false,
3273
3284
  startedLoadingAutoCountry: false,
3274
- version: "25.10.0"
3285
+ version: "25.10.3"
3275
3286
  }
3276
3287
  );
3277
3288
  var intl_tel_input_default = intlTelInput;
@@ -1941,7 +1941,8 @@ var Iti = class _Iti {
1941
1941
  if (allowDropdown || showFlags || separateDialCode) {
1942
1942
  this.countryContainer = createEl(
1943
1943
  "div",
1944
- { class: "iti__country-container" },
1944
+ // visibly hidden until we measure it's width to set the input padding correctly
1945
+ { class: "iti__country-container iti__v-hide" },
1945
1946
  wrapper
1946
1947
  );
1947
1948
  if (this.showSelectedCountryOnLeft) {
@@ -2106,7 +2107,10 @@ var Iti = class _Iti {
2106
2107
  }
2107
2108
  }
2108
2109
  wrapper.appendChild(this.telInput);
2109
- this._updateInputPadding();
2110
+ if (this.countryContainer) {
2111
+ this._updateInputPadding();
2112
+ this.countryContainer.classList.remove("iti__v-hide");
2113
+ }
2110
2114
  if (hiddenInput) {
2111
2115
  const telInputName = this.telInput.getAttribute("name") || "";
2112
2116
  const names = hiddenInput(telInputName);
@@ -2766,7 +2770,8 @@ var Iti = class _Iti {
2766
2770
  //* Update the input padding to make space for the selected country/dial code.
2767
2771
  _updateInputPadding() {
2768
2772
  if (this.selectedCountry) {
2769
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2773
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2774
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2770
2775
  const inputPadding = selectedCountryWidth + 6;
2771
2776
  if (this.showSelectedCountryOnLeft) {
2772
2777
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2803,21 +2808,27 @@ var Iti = class _Iti {
2803
2808
  }
2804
2809
  }
2805
2810
  }
2806
- //* When the input is in a hidden container during initialisation, we must inject some markup
2807
- //* into the end of the DOM to calculate the correct offsetWidth.
2808
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2809
- //* will definitely exist.
2811
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2812
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2813
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2814
+ //* and then to inject a deep clone of the selectedCountry element.
2810
2815
  _getHiddenSelectedCountryWidth() {
2811
2816
  if (this.telInput.parentNode) {
2817
+ let body;
2818
+ try {
2819
+ body = window.top.document.body;
2820
+ } catch (e) {
2821
+ body = document.body;
2822
+ }
2812
2823
  const containerClone = this.telInput.parentNode.cloneNode(false);
2813
2824
  containerClone.style.visibility = "hidden";
2814
- document.body.appendChild(containerClone);
2825
+ body.appendChild(containerClone);
2815
2826
  const countryContainerClone = this.countryContainer.cloneNode();
2816
2827
  containerClone.appendChild(countryContainerClone);
2817
2828
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2818
2829
  countryContainerClone.appendChild(selectedCountryClone);
2819
2830
  const width = selectedCountryClone.offsetWidth;
2820
- document.body.removeChild(containerClone);
2831
+ body.removeChild(containerClone);
2821
2832
  return width;
2822
2833
  }
2823
2834
  return 0;
@@ -3235,7 +3246,7 @@ var intlTelInput = Object.assign(
3235
3246
  attachUtils,
3236
3247
  startedLoadingUtilsScript: false,
3237
3248
  startedLoadingAutoCountry: false,
3238
- version: "25.10.0"
3249
+ version: "25.10.3"
3239
3250
  }
3240
3251
  );
3241
3252
  var intl_tel_input_default = intlTelInput;
@@ -1977,7 +1977,8 @@ var Iti = class _Iti {
1977
1977
  if (allowDropdown || showFlags || separateDialCode) {
1978
1978
  this.countryContainer = createEl(
1979
1979
  "div",
1980
- { class: "iti__country-container" },
1980
+ // visibly hidden until we measure it's width to set the input padding correctly
1981
+ { class: "iti__country-container iti__v-hide" },
1981
1982
  wrapper
1982
1983
  );
1983
1984
  if (this.showSelectedCountryOnLeft) {
@@ -2142,7 +2143,10 @@ var Iti = class _Iti {
2142
2143
  }
2143
2144
  }
2144
2145
  wrapper.appendChild(this.telInput);
2145
- this._updateInputPadding();
2146
+ if (this.countryContainer) {
2147
+ this._updateInputPadding();
2148
+ this.countryContainer.classList.remove("iti__v-hide");
2149
+ }
2146
2150
  if (hiddenInput) {
2147
2151
  const telInputName = this.telInput.getAttribute("name") || "";
2148
2152
  const names = hiddenInput(telInputName);
@@ -2802,7 +2806,8 @@ var Iti = class _Iti {
2802
2806
  //* Update the input padding to make space for the selected country/dial code.
2803
2807
  _updateInputPadding() {
2804
2808
  if (this.selectedCountry) {
2805
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2809
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2810
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2806
2811
  const inputPadding = selectedCountryWidth + 6;
2807
2812
  if (this.showSelectedCountryOnLeft) {
2808
2813
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2839,21 +2844,27 @@ var Iti = class _Iti {
2839
2844
  }
2840
2845
  }
2841
2846
  }
2842
- //* When the input is in a hidden container during initialisation, we must inject some markup
2843
- //* into the end of the DOM to calculate the correct offsetWidth.
2844
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2845
- //* will definitely exist.
2847
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2848
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2849
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2850
+ //* and then to inject a deep clone of the selectedCountry element.
2846
2851
  _getHiddenSelectedCountryWidth() {
2847
2852
  if (this.telInput.parentNode) {
2853
+ let body;
2854
+ try {
2855
+ body = window.top.document.body;
2856
+ } catch (e) {
2857
+ body = document.body;
2858
+ }
2848
2859
  const containerClone = this.telInput.parentNode.cloneNode(false);
2849
2860
  containerClone.style.visibility = "hidden";
2850
- document.body.appendChild(containerClone);
2861
+ body.appendChild(containerClone);
2851
2862
  const countryContainerClone = this.countryContainer.cloneNode();
2852
2863
  containerClone.appendChild(countryContainerClone);
2853
2864
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2854
2865
  countryContainerClone.appendChild(selectedCountryClone);
2855
2866
  const width = selectedCountryClone.offsetWidth;
2856
- document.body.removeChild(containerClone);
2867
+ body.removeChild(containerClone);
2857
2868
  return width;
2858
2869
  }
2859
2870
  return 0;
@@ -3271,7 +3282,7 @@ var intlTelInput = Object.assign(
3271
3282
  attachUtils,
3272
3283
  startedLoadingUtilsScript: false,
3273
3284
  startedLoadingAutoCountry: false,
3274
- version: "25.10.0"
3285
+ version: "25.10.3"
3275
3286
  }
3276
3287
  );
3277
3288
  var intl_tel_input_default = intlTelInput;
@@ -1941,7 +1941,8 @@ var Iti = class _Iti {
1941
1941
  if (allowDropdown || showFlags || separateDialCode) {
1942
1942
  this.countryContainer = createEl(
1943
1943
  "div",
1944
- { class: "iti__country-container" },
1944
+ // visibly hidden until we measure it's width to set the input padding correctly
1945
+ { class: "iti__country-container iti__v-hide" },
1945
1946
  wrapper
1946
1947
  );
1947
1948
  if (this.showSelectedCountryOnLeft) {
@@ -2106,7 +2107,10 @@ var Iti = class _Iti {
2106
2107
  }
2107
2108
  }
2108
2109
  wrapper.appendChild(this.telInput);
2109
- this._updateInputPadding();
2110
+ if (this.countryContainer) {
2111
+ this._updateInputPadding();
2112
+ this.countryContainer.classList.remove("iti__v-hide");
2113
+ }
2110
2114
  if (hiddenInput) {
2111
2115
  const telInputName = this.telInput.getAttribute("name") || "";
2112
2116
  const names = hiddenInput(telInputName);
@@ -2766,7 +2770,8 @@ var Iti = class _Iti {
2766
2770
  //* Update the input padding to make space for the selected country/dial code.
2767
2771
  _updateInputPadding() {
2768
2772
  if (this.selectedCountry) {
2769
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2773
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2774
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2770
2775
  const inputPadding = selectedCountryWidth + 6;
2771
2776
  if (this.showSelectedCountryOnLeft) {
2772
2777
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2803,21 +2808,27 @@ var Iti = class _Iti {
2803
2808
  }
2804
2809
  }
2805
2810
  }
2806
- //* When the input is in a hidden container during initialisation, we must inject some markup
2807
- //* into the end of the DOM to calculate the correct offsetWidth.
2808
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2809
- //* will definitely exist.
2811
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2812
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2813
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2814
+ //* and then to inject a deep clone of the selectedCountry element.
2810
2815
  _getHiddenSelectedCountryWidth() {
2811
2816
  if (this.telInput.parentNode) {
2817
+ let body;
2818
+ try {
2819
+ body = window.top.document.body;
2820
+ } catch (e) {
2821
+ body = document.body;
2822
+ }
2812
2823
  const containerClone = this.telInput.parentNode.cloneNode(false);
2813
2824
  containerClone.style.visibility = "hidden";
2814
- document.body.appendChild(containerClone);
2825
+ body.appendChild(containerClone);
2815
2826
  const countryContainerClone = this.countryContainer.cloneNode();
2816
2827
  containerClone.appendChild(countryContainerClone);
2817
2828
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2818
2829
  countryContainerClone.appendChild(selectedCountryClone);
2819
2830
  const width = selectedCountryClone.offsetWidth;
2820
- document.body.removeChild(containerClone);
2831
+ body.removeChild(containerClone);
2821
2832
  return width;
2822
2833
  }
2823
2834
  return 0;
@@ -3235,7 +3246,7 @@ var intlTelInput = Object.assign(
3235
3246
  attachUtils,
3236
3247
  startedLoadingUtilsScript: false,
3237
3248
  startedLoadingAutoCountry: false,
3238
- version: "25.10.0"
3249
+ version: "25.10.3"
3239
3250
  }
3240
3251
  );
3241
3252
  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.0/build/js/utils.js"`.
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.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,4 +1,4 @@
1
- import { mergeModels as A, useModel as M, ref as N, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as V, openBlock as z, mergeProps as O, vModelText as $ } from "vue";
1
+ import { mergeModels as A, useModel as M, ref as D, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as V, openBlock as z, mergeProps as O, vModelText as $ } from "vue";
2
2
  const j = [
3
3
  [
4
4
  "af",
@@ -1594,9 +1594,9 @@ const U = {
1594
1594
  for (const u of w)
1595
1595
  u.name = T[u.iso2];
1596
1596
  let K = 0;
1597
- const D = (u) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(u).matches, W = () => {
1597
+ const N = (u) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(u).matches, W = () => {
1598
1598
  if (typeof navigator < "u" && typeof window < "u") {
1599
- const u = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), t = D("(max-width: 500px)"), e = D("(max-height: 600px)"), i = D("(pointer: coarse)");
1599
+ const u = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), t = N("(max-width: 500px)"), e = N("(max-height: 600px)"), i = N("(pointer: coarse)");
1600
1600
  return u || t || i && e;
1601
1601
  }
1602
1602
  return !1;
@@ -1687,7 +1687,7 @@ const D = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
1687
1687
  return n;
1688
1688
  }
1689
1689
  return t.length;
1690
- }, m = (u, t, e) => {
1690
+ }, y = (u, t, e) => {
1691
1691
  const i = document.createElement(u);
1692
1692
  return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
1693
1693
  }, I = (u, ...t) => {
@@ -1815,13 +1815,14 @@ class L {
1815
1815
  "iti--show-flags": i,
1816
1816
  "iti--inline-dropdown": !d,
1817
1817
  [s]: !!s
1818
- }), y = m("div", { class: p });
1819
- if ((a = this.telInput.parentNode) == null || a.insertBefore(y, this.telInput), t || i || e) {
1820
- this.countryContainer = m(
1818
+ }), m = y("div", { class: p });
1819
+ if ((a = this.telInput.parentNode) == null || a.insertBefore(m, this.telInput), t || i || e) {
1820
+ this.countryContainer = y(
1821
1821
  "div",
1822
- { class: "iti__country-container" },
1823
- y
1824
- ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = m(
1822
+ // visibly hidden until we measure it's width to set the input padding correctly
1823
+ { class: "iti__country-container iti__v-hide" },
1824
+ m
1825
+ ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
1825
1826
  "button",
1826
1827
  {
1827
1828
  type: "button",
@@ -1832,42 +1833,42 @@ class L {
1832
1833
  "aria-controls": `iti-${this.id}__dropdown-content`
1833
1834
  },
1834
1835
  this.countryContainer
1835
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
1836
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = y(
1836
1837
  "div",
1837
1838
  { class: "iti__selected-country" },
1838
1839
  this.countryContainer
1839
1840
  );
1840
- const _ = m(
1841
+ const _ = y(
1841
1842
  "div",
1842
1843
  { class: "iti__selected-country-primary" },
1843
1844
  this.selectedCountry
1844
1845
  );
1845
- if (this.selectedCountryInner = m(
1846
+ if (this.selectedCountryInner = y(
1846
1847
  "div",
1847
1848
  { class: "iti__flag" },
1848
1849
  _
1849
- ), t && (this.dropdownArrow = m(
1850
+ ), t && (this.dropdownArrow = y(
1850
1851
  "div",
1851
1852
  { class: "iti__arrow", "aria-hidden": "true" },
1852
1853
  _
1853
- )), e && (this.selectedDialCode = m(
1854
+ )), e && (this.selectedDialCode = y(
1854
1855
  "div",
1855
1856
  { class: "iti__selected-dial-code", dir: "ltr" },
1856
1857
  this.selectedCountry
1857
1858
  )), t) {
1858
1859
  const b = o ? "" : "iti--flexible-dropdown-width";
1859
- if (this.dropdownContent = m("div", {
1860
+ if (this.dropdownContent = y("div", {
1860
1861
  id: `iti-${this.id}__dropdown-content`,
1861
1862
  class: `iti__dropdown-content iti__hide ${b}`,
1862
1863
  role: "dialog",
1863
1864
  "aria-modal": "true"
1864
1865
  }), C) {
1865
- const f = m(
1866
+ const f = y(
1866
1867
  "div",
1867
1868
  { class: "iti__search-input-wrapper" },
1868
1869
  this.dropdownContent
1869
1870
  );
1870
- this.searchIcon = m(
1871
+ this.searchIcon = y(
1871
1872
  "span",
1872
1873
  {
1873
1874
  class: "iti__search-icon",
@@ -1878,7 +1879,7 @@ class L {
1878
1879
  <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
1879
1880
  <circle cx="11" cy="11" r="7" />
1880
1881
  <line x1="21" y1="21" x2="16.65" y2="16.65" />
1881
- </svg>`, this.searchInput = m(
1882
+ </svg>`, this.searchInput = y(
1882
1883
  "input",
1883
1884
  {
1884
1885
  id: `iti-${this.id}__search-input`,
@@ -1895,7 +1896,7 @@ class L {
1895
1896
  autocomplete: "off"
1896
1897
  },
1897
1898
  f
1898
- ), this.searchClearButton = m(
1899
+ ), this.searchClearButton = y(
1899
1900
  "button",
1900
1901
  {
1901
1902
  type: "button",
@@ -1913,11 +1914,11 @@ class L {
1913
1914
  <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
1914
1915
  </mask>
1915
1916
  <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${S})" />
1916
- </svg>`, this.searchResultsA11yText = m(
1917
+ </svg>`, this.searchResultsA11yText = y(
1917
1918
  "span",
1918
1919
  { class: "iti__a11y-text" },
1919
1920
  this.dropdownContent
1920
- ), this.searchNoResults = m(
1921
+ ), this.searchNoResults = y(
1921
1922
  "div",
1922
1923
  {
1923
1924
  class: "iti__no-results iti__hide",
@@ -1927,7 +1928,7 @@ class L {
1927
1928
  this.dropdownContent
1928
1929
  ), this.searchNoResults.textContent = c.zeroSearchResults;
1929
1930
  }
1930
- if (this.countryList = m(
1931
+ if (this.countryList = y(
1931
1932
  "ul",
1932
1933
  {
1933
1934
  class: "iti__country-list",
@@ -1944,33 +1945,33 @@ class L {
1944
1945
  "iti--inline-dropdown": !d,
1945
1946
  [s]: !!s
1946
1947
  });
1947
- this.dropdown = m("div", { class: f }), this.dropdown.appendChild(this.dropdownContent);
1948
+ this.dropdown = y("div", { class: f }), this.dropdown.appendChild(this.dropdownContent);
1948
1949
  } else
1949
1950
  this.countryContainer.appendChild(this.dropdownContent);
1950
1951
  }
1951
1952
  }
1952
- if (y.appendChild(this.telInput), this._updateInputPadding(), n) {
1953
+ if (m.appendChild(this.telInput), this.countryContainer && (this._updateInputPadding(), this.countryContainer.classList.remove("iti__v-hide")), n) {
1953
1954
  const _ = this.telInput.getAttribute("name") || "", b = n(_);
1954
1955
  if (b.phone) {
1955
1956
  const f = (h = this.telInput.form) == null ? void 0 : h.querySelector(`input[name="${b.phone}"]`);
1956
- f ? this.hiddenInput = f : (this.hiddenInput = m("input", {
1957
+ f ? this.hiddenInput = f : (this.hiddenInput = y("input", {
1957
1958
  type: "hidden",
1958
1959
  name: b.phone
1959
- }), y.appendChild(this.hiddenInput));
1960
+ }), m.appendChild(this.hiddenInput));
1960
1961
  }
1961
1962
  if (b.country) {
1962
1963
  const f = (g = this.telInput.form) == null ? void 0 : g.querySelector(`input[name="${b.country}"]`);
1963
- f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = m("input", {
1964
+ f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = y("input", {
1964
1965
  type: "hidden",
1965
1966
  name: b.country
1966
- }), y.appendChild(this.hiddenInputCountry));
1967
+ }), m.appendChild(this.hiddenInputCountry));
1967
1968
  }
1968
1969
  }
1969
1970
  }
1970
1971
  //* For each country: add a country list item <li> to the countryList <ul> container.
1971
1972
  _appendListItems() {
1972
1973
  for (let t = 0; t < this.countries.length; t++) {
1973
- const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
1974
+ const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = y(
1974
1975
  "li",
1975
1976
  {
1976
1977
  id: `iti-${this.id}__item-${e.iso2}`,
@@ -2060,8 +2061,8 @@ class L {
2060
2061
  let r = !1;
2061
2062
  new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (o) => {
2062
2063
  if (this.isAndroid && (o == null ? void 0 : o.data) === "+" && i && s && n) {
2063
- const p = this.telInput.selectionStart || 0, y = this.telInput.value.substring(0, p - 1), a = this.telInput.value.substring(p);
2064
- this.telInput.value = y + a, this._openDropdownWithPlus();
2064
+ const p = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, p - 1), a = this.telInput.value.substring(p);
2065
+ this.telInput.value = m + a, this._openDropdownWithPlus();
2065
2066
  return;
2066
2067
  }
2067
2068
  this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
@@ -2079,8 +2080,8 @@ class L {
2079
2080
  return;
2080
2081
  }
2081
2082
  if (t) {
2082
- const d = this.telInput.value, c = !(d.charAt(0) === "+") && this.telInput.selectionStart === 0 && o.key === "+", p = /^[0-9]$/.test(o.key), y = i ? p : c || p, a = d.slice(0, this.telInput.selectionStart) + o.key + d.slice(this.telInput.selectionEnd), h = this._getFullNumber(a), g = l.utils.getCoreNumber(h, this.selectedCountryData.iso2), _ = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength, f = this._getNewCountryFromNumber(h) !== null;
2083
- (!y || _ && !f && !c) && o.preventDefault();
2083
+ const d = this.telInput.value, c = !(d.charAt(0) === "+") && this.telInput.selectionStart === 0 && o.key === "+", p = /^[0-9]$/.test(o.key), m = i ? p : c || p, a = d.slice(0, this.telInput.selectionStart) + o.key + d.slice(this.telInput.selectionEnd), h = this._getFullNumber(a), g = l.utils.getCoreNumber(h, this.selectedCountryData.iso2), _ = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength, f = this._getNewCountryFromNumber(h) !== null;
2084
+ (!m || _ && !f && !c) && o.preventDefault();
2084
2085
  }
2085
2086
  }
2086
2087
  }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
@@ -2172,7 +2173,7 @@ class L {
2172
2173
  const s = k(t), n = s.length, r = [], o = [], d = [], C = [], c = [], p = [];
2173
2174
  for (const a of this.countries)
2174
2175
  e || n === 0 ? d.push(a) : a.iso2 === s ? r.push(a) : a.normalisedName.startsWith(s) ? o.push(a) : a.normalisedName.includes(s) ? d.push(a) : s === a.dialCode || s === a.dialCodePlus ? C.push(a) : a.dialCodePlus.includes(s) ? c.push(a) : a.initials.includes(s) && p.push(a);
2175
- const y = [
2176
+ const m = [
2176
2177
  ...r.sort((a, h) => a.priority - h.priority),
2177
2178
  ...o.sort((a, h) => a.priority - h.priority),
2178
2179
  ...d.sort((a, h) => a.priority - h.priority),
@@ -2180,7 +2181,7 @@ class L {
2180
2181
  ...c.sort((a, h) => a.priority - h.priority),
2181
2182
  ...p.sort((a, h) => a.priority - h.priority)
2182
2183
  ];
2183
- for (const a of y) {
2184
+ for (const a of m) {
2184
2185
  const h = a.nodeById[this.id];
2185
2186
  h && (this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1));
2186
2187
  }
@@ -2298,8 +2299,8 @@ class L {
2298
2299
  //* Update the input padding to make space for the selected country/dial code.
2299
2300
  _updateInputPadding() {
2300
2301
  if (this.selectedCountry) {
2301
- const e = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
2302
- this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${e}px` : this.telInput.style.paddingRight = `${e}px`;
2302
+ const t = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + 6;
2303
+ this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
2303
2304
  }
2304
2305
  }
2305
2306
  //* Update the maximum valid number length for the currently selected country.
@@ -2321,20 +2322,26 @@ class L {
2321
2322
  } else
2322
2323
  this.maxCoreNumberLength = null;
2323
2324
  }
2324
- //* When the input is in a hidden container during initialisation, we must inject some markup
2325
- //* into the end of the DOM to calculate the correct offsetWidth.
2326
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2327
- //* will definitely exist.
2325
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2326
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2327
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2328
+ //* and then to inject a deep clone of the selectedCountry element.
2328
2329
  _getHiddenSelectedCountryWidth() {
2329
2330
  if (this.telInput.parentNode) {
2330
- const t = this.telInput.parentNode.cloneNode(!1);
2331
- t.style.visibility = "hidden", document.body.appendChild(t);
2332
- const e = this.countryContainer.cloneNode();
2333
- t.appendChild(e);
2334
- const i = this.selectedCountry.cloneNode(!0);
2331
+ let t;
2332
+ try {
2333
+ t = window.top.document.body;
2334
+ } catch {
2335
+ t = document.body;
2336
+ }
2337
+ const e = this.telInput.parentNode.cloneNode(!1);
2338
+ e.style.visibility = "hidden", t.appendChild(e);
2339
+ const i = this.countryContainer.cloneNode();
2335
2340
  e.appendChild(i);
2336
- const s = i.offsetWidth;
2337
- return document.body.removeChild(t), s;
2341
+ const s = this.selectedCountry.cloneNode(!0);
2342
+ i.appendChild(s);
2343
+ const n = s.offsetWidth;
2344
+ return t.removeChild(e), n;
2338
2345
  }
2339
2346
  return 0;
2340
2347
  }
@@ -2602,7 +2609,7 @@ const Y = (u) => {
2602
2609
  attachUtils: Y,
2603
2610
  startedLoadingUtilsScript: !1,
2604
2611
  startedLoadingAutoCountry: !1,
2605
- version: "25.10.0"
2612
+ version: "25.10.3"
2606
2613
  }
2607
2614
  ), Z = {
2608
2615
  __name: "IntlTelInput",
@@ -2637,7 +2644,7 @@ const Y = (u) => {
2637
2644
  "changeErrorCode"
2638
2645
  ], ["update:modelValue"]),
2639
2646
  setup(u, { expose: t, emit: e }) {
2640
- const i = M(u, "modelValue"), s = u, n = e, r = N(), o = N(), d = N(!1), C = () => o.value ? s.options.strictMode ? o.value.isValidNumberPrecise() : o.value.isValidNumber() : null, c = () => {
2647
+ const i = M(u, "modelValue"), s = u, n = e, r = D(), o = D(), d = D(!1), C = () => o.value ? s.options.strictMode ? o.value.isValidNumberPrecise() : o.value.isValidNumber() : null, c = () => {
2641
2648
  let a = C();
2642
2649
  d.value !== a && (d.value = a, n("changeValidity", !!a), n(
2643
2650
  "changeErrorCode",
@@ -2646,7 +2653,7 @@ const Y = (u) => {
2646
2653
  }, p = () => {
2647
2654
  var a;
2648
2655
  n("changeNumber", ((a = o.value) == null ? void 0 : a.getNumber()) ?? ""), c();
2649
- }, y = () => {
2656
+ }, m = () => {
2650
2657
  var a;
2651
2658
  n("changeCountry", ((a = o.value) == null ? void 0 : a.getSelectedCountryData().iso2) ?? ""), p(), c();
2652
2659
  };
@@ -2666,7 +2673,7 @@ const Y = (u) => {
2666
2673
  ref: r,
2667
2674
  "onUpdate:modelValue": h[0] || (h[0] = (g) => i.value = g),
2668
2675
  type: "tel",
2669
- onCountrychange: y,
2676
+ onCountrychange: m,
2670
2677
  onInput: p
2671
2678
  }, u.inputProps), null, 16)), [
2672
2679
  [