@intl-tel-input/vue 29.3.0 → 29.4.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vue component for intl-tel-input
2
2
 
3
- For entering, formatting, and validating international telephone numbers.
3
+ For entering, formatting, and validating international telephone numbers. Requires Vue 3.
4
4
 
5
5
  [Explore docs »](https://intl-tel-input.com/docs/vue-component)
6
6
 
@@ -1350,6 +1350,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1350
1350
  excludeCountries: null,
1351
1351
  matchDropdownWidth: !0,
1352
1352
  formatAsYouType: !0,
1353
+ fullscreenParent: null,
1353
1354
  hiddenInputs: null,
1354
1355
  uiTranslations: {},
1355
1356
  initialCountry: "",
@@ -1465,8 +1466,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1465
1466
  t[n] = r;
1466
1467
  break;
1467
1468
  case "dropdownParent":
1469
+ case "fullscreenParent":
1468
1470
  if (r !== null && !ae(r)) {
1469
- W("dropdownParent", "an HTMLElement or null", r);
1471
+ W(n, "an HTMLElement or null", r);
1470
1472
  break;
1471
1473
  }
1472
1474
  t[n] = r;
@@ -1789,7 +1791,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1789
1791
  id: `iti-${this.#t}__country-listbox`,
1790
1792
  role: "listbox",
1791
1793
  [R.LABEL]: r.countryListAriaLabel
1792
- }, this.#m), this.#L(), n && this.#U(), o) {
1794
+ }, this.#m), n || this.#v.setAttribute("tabindex", "0"), this.#L(), n && this.#U(), o) {
1793
1795
  let e = pe({
1794
1796
  iti: !0,
1795
1797
  "iti--detached-country-selector": !0,
@@ -1801,8 +1803,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1801
1803
  } else this.#l.appendChild(this.#m);
1802
1804
  }
1803
1805
  #N() {
1804
- let { countrySelectorMode: e, dropdownParent: t } = this.#e;
1805
- return e === I.FULLSCREEN ? document.body : e === I.DROPDOWN ? t : null;
1806
+ let { countrySelectorMode: e, dropdownParent: t, fullscreenParent: n } = this.#e;
1807
+ return e === I.FULLSCREEN ? n ?? document.body : e === I.DROPDOWN ? t : null;
1806
1808
  }
1807
1809
  #P() {
1808
1810
  let { uiTranslations: e, searchInputClass: t } = this.#e, n = K("div", { class: this.#k("searchWrapper", "iti__search-input-wrapper") }, this.#m);
@@ -1858,7 +1860,6 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1858
1860
  let r = this.#i[n], i = K("li", {
1859
1861
  id: `iti-${this.#t}__item-${r.iso2}`,
1860
1862
  class: t,
1861
- tabindex: "-1",
1862
1863
  role: "option",
1863
1864
  [R.SELECTED]: "false"
1864
1865
  });
@@ -1919,7 +1920,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1919
1920
  let n = xe.toAscii(e);
1920
1921
  t = ye(this.#i, this.#a, n);
1921
1922
  }
1922
- this.#ae(t);
1923
+ this.#oe(t);
1923
1924
  }
1924
1925
  prefillSearchWithPlus() {
1925
1926
  this.#g.value = "+", this.#g.focus(), this.#W("");
@@ -1940,13 +1941,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1940
1941
  let t = this.#v, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
1941
1942
  r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
1942
1943
  }
1943
- #Y(e, t = !0) {
1944
+ #Y() {
1945
+ return this.#e.countrySearch ? this.#g : this.#v;
1946
+ }
1947
+ #X(e, t = !0) {
1944
1948
  if (this.#T?.classList.remove(v.HIGHLIGHT), e) {
1945
- if (e.classList.add(v.HIGHLIGHT), this.#e.countrySearch) {
1946
- let t = e.getAttribute("id") || "";
1947
- this.#g.setAttribute(R.ACTIVE_DESCENDANT, t);
1948
- }
1949
- t && this.#J(e), this.#T = e;
1949
+ e.classList.add(v.HIGHLIGHT);
1950
+ let n = e.getAttribute("id") || "";
1951
+ this.#Y().setAttribute(R.ACTIVE_DESCENDANT, n), t && this.#J(e), this.#T = e;
1950
1952
  } else this.#T = null;
1951
1953
  }
1952
1954
  bindHiddenInputSubmitListener(e, t, n) {
@@ -1972,124 +1974,126 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1972
1974
  }, { signal: e });
1973
1975
  }
1974
1976
  openCountrySelector(e, t) {
1975
- let { countrySearch: n, dropdownAlwaysOpen: r } = this.#e;
1976
- if (this.#D = new AbortController(), this.#e.countrySelectorMode !== I.FULLSCREEN && this.#V(), this.ensureDropdownWidthSet(), this.#C) this.#se();
1977
+ let { dropdownAlwaysOpen: n } = this.#e;
1978
+ if (this.#D = new AbortController(), this.#e.countrySelectorMode !== I.FULLSCREEN && this.#V(), this.ensureDropdownWidthSet(), this.#C) this.#ce();
1977
1979
  else {
1978
- let e = this.#oe(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
1980
+ let e = this.#se(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
1979
1981
  e ? this.#m.style.top = `${t}px` : this.#m.style.bottom = `${t}px`;
1980
1982
  }
1981
1983
  this.#m.classList.remove(v.HIDE), this.#u.setAttribute(R.EXPANDED, "true");
1982
- let i = this.#w ?? this.#v.firstElementChild;
1983
- i && this.#Y(i), n && !r && this.#g.focus(), this.#e.countrySelectorMode === I.FULLSCREEN && this.#C && window.visualViewport && window.visualViewport.addEventListener("resize", () => {
1984
- this.#le(), this.#T && this.#J(this.#T);
1985
- }, { signal: this.#D.signal }), this.#p.classList.add(v.ARROW_UP), this.#X(e, t);
1984
+ let r = this.#w ?? this.#v.firstElementChild;
1985
+ r && this.#X(r), n || this.#Y().focus(), this.#e.countrySelectorMode === I.FULLSCREEN && this.#C && window.visualViewport && (this.#ue(), window.visualViewport.addEventListener("resize", () => {
1986
+ this.#ue(), this.#T && this.#J(this.#T);
1987
+ }, { signal: this.#D.signal })), this.#p.classList.add(v.ARROW_UP), this.#Z(e, t);
1986
1988
  }
1987
- #X(e, t) {
1989
+ #Z(e, t) {
1988
1990
  let n = this.#D.signal;
1989
- this.#Z(n), this.#Q(n, e), this.#e.dropdownAlwaysOpen || this.#$(n, t), this.#ee(n, e, t), this.#e.countrySearch && this.#te(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !Se && document.addEventListener("scroll", t, {
1991
+ this.#Q(n), this.#$(n, e), this.#e.dropdownAlwaysOpen || this.#ee(n, t), this.#te(n, e, t), this.#e.countrySearch && this.#ne(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !Se && document.addEventListener("scroll", t, {
1990
1992
  signal: n,
1991
1993
  capture: !0,
1992
1994
  passive: !0
1993
1995
  });
1994
1996
  }
1995
- #Z(e) {
1997
+ #Q(e) {
1996
1998
  this.#v.addEventListener("mouseover", (e) => {
1997
1999
  let t = e.target?.closest(`.${v.COUNTRY_ITEM}`);
1998
- t && this.#Y(t, !1);
2000
+ t && this.#X(t, !1);
1999
2001
  }, { signal: e });
2000
2002
  }
2001
- #Q(e, t) {
2003
+ #$(e, t) {
2002
2004
  this.#v.addEventListener("click", (e) => {
2003
2005
  let n = e.target?.closest(`.${v.COUNTRY_ITEM}`);
2004
2006
  n && t(n);
2005
2007
  }, { signal: e });
2006
2008
  }
2007
- #$(e, t) {
2009
+ #ee(e, t) {
2008
2010
  setTimeout(() => {
2009
2011
  document.documentElement.addEventListener("click", (e) => {
2010
2012
  this.#m.contains(e.target) || t();
2011
2013
  }, { signal: e });
2012
2014
  }, 0);
2013
2015
  }
2014
- #ee(e, t, n) {
2016
+ #te(e, t, n) {
2015
2017
  let r = "", i = null, a = (e) => {
2016
2018
  [
2017
2019
  y.ARROW_UP,
2018
2020
  y.ARROW_DOWN,
2019
2021
  y.ENTER,
2020
2022
  y.ESC
2021
- ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === y.ARROW_UP || e.key === y.ARROW_DOWN ? this.#re(e.key) : e.key === y.ENTER && !e.isComposing ? t(this.#T) : e.key === y.ESC && (n(), this.#u.focus())), !this.#e.countrySearch && x.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#ne(r), i = setTimeout(() => {
2023
+ ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === y.ARROW_UP || e.key === y.ARROW_DOWN ? this.#ie(e.key) : e.key === y.ENTER && !e.isComposing ? t(this.#T) : e.key === y.ESC && (n(), this.#u.focus())), !this.#e.countrySearch && x.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#re(r), i = setTimeout(() => {
2022
2024
  r = "";
2023
2025
  }, S.HIDDEN_SEARCH_RESET_MS));
2024
2026
  };
2025
- this.#u?.addEventListener("keydown", a, { signal: e }), this.#m?.addEventListener("keydown", a, { signal: e });
2027
+ this.#u?.addEventListener("keydown", a, { signal: e }), this.#m?.addEventListener("keydown", a, { signal: e }), this.#C && this.#m?.addEventListener("keydown", (e) => {
2028
+ e.key === y.TAB && (e.preventDefault(), n(), (e.shiftKey ? this.#u : this.telInputEl).focus());
2029
+ }, { signal: e });
2026
2030
  }
2027
- #te(e) {
2031
+ #ne(e) {
2028
2032
  this.#g.addEventListener("input", () => this.#K(), { signal: e }), this.#_.addEventListener("click", () => this.#q(), { signal: e });
2029
2033
  }
2030
- #ne(e) {
2034
+ #re(e) {
2031
2035
  let t = be(this.#i, this.#a, e);
2032
2036
  if (t) {
2033
2037
  let e = this.#E.get(t.iso2);
2034
- this.#Y(e);
2038
+ this.#X(e);
2035
2039
  }
2036
2040
  }
2037
- #re(e) {
2041
+ #ie(e) {
2038
2042
  let t = e === y.ARROW_UP ? this.#T?.previousElementSibling : this.#T?.nextElementSibling;
2039
- !t && this.#v.childElementCount > 1 && (t = e === y.ARROW_UP ? this.#v.lastElementChild : this.#v.firstElementChild), t && this.#Y(t);
2043
+ !t && this.#v.childElementCount > 1 && (t = e === y.ARROW_UP ? this.#v.lastElementChild : this.#v.firstElementChild), t && this.#X(t);
2040
2044
  }
2041
- #ie(e) {
2045
+ #ae(e) {
2042
2046
  if (this.#w && this.#w.dataset[L.ISO2] !== e && (this.#w.setAttribute(R.SELECTED, "false"), this.#w.querySelector(".iti__country-check")?.remove(), this.#w = null), e && !this.#w) {
2043
2047
  let t = this.#v.querySelector(`[data-iso2="${e}"]`);
2044
2048
  t && (t.setAttribute(R.SELECTED, "true"), K("span", {
2045
2049
  class: this.#k("countryCheck", "iti__country-check"),
2046
2050
  [R.HIDDEN]: "true"
2047
- }, t).appendChild(_e()), this.#w = t, this.#e.dropdownAlwaysOpen && this.#Y(t));
2051
+ }, t).appendChild(_e()), this.#w = t, this.#e.dropdownAlwaysOpen && this.#X(t));
2048
2052
  }
2049
2053
  }
2050
- #ae(e) {
2054
+ #oe(e) {
2051
2055
  this.#v.replaceChildren();
2052
2056
  let t = !0;
2053
2057
  for (let n of e) {
2054
2058
  let e = this.#E.get(n.iso2);
2055
- e && (this.#v.appendChild(e), t &&= (this.#Y(e, !1), !1));
2059
+ e && (this.#v.appendChild(e), t &&= (this.#X(e, !1), !1));
2056
2060
  }
2057
- t ? (this.#Y(null), this.#x && this.#x.classList.remove(v.HIDE)) : this.#x && this.#x.classList.add(v.HIDE), this.#v.scrollTop = 0, this.#U();
2061
+ t ? (this.#X(null), this.#x && this.#x.classList.remove(v.HIDE)) : this.#x && this.#x.classList.add(v.HIDE), this.#v.scrollTop = 0, this.#U();
2058
2062
  }
2059
2063
  closeCountrySelector() {
2060
2064
  let { countrySearch: e } = this.#e;
2061
- this.#D.abort(), this.#D = null, this.#m.classList.add(v.HIDE), this.#u.setAttribute(R.EXPANDED, "false"), e && (this.#g.removeAttribute(R.ACTIVE_DESCENDANT), this.#g.value = "", this.#G(), this.#T &&= (this.#T.classList.remove(v.HIGHLIGHT), null)), this.#p.classList.remove(v.ARROW_UP), this.#C ? (this.#C.remove(), this.#C.style.top = "", this.#C.style.bottom = "", this.#C.style.paddingLeft = "", this.#C.style.paddingRight = "") : (this.#m.style.top = "", this.#m.style.bottom = "");
2065
+ this.#D.abort(), this.#D = null, this.#m.classList.add(v.HIDE), this.#u.setAttribute(R.EXPANDED, "false"), this.#Y().removeAttribute(R.ACTIVE_DESCENDANT), e && (this.#g.value = "", this.#G(), this.#T &&= (this.#T.classList.remove(v.HIGHLIGHT), null)), this.#p.classList.remove(v.ARROW_UP), this.#C ? (this.#C.remove(), this.#C.style.top = "", this.#C.style.bottom = "", this.#C.style.removeProperty("--iti-virtual-keyboard-height"), this.#C.style.paddingLeft = "", this.#C.style.paddingRight = "") : (this.#m.style.top = "", this.#m.style.bottom = "");
2062
2066
  }
2063
- #oe() {
2067
+ #se() {
2064
2068
  if (this.#e.dropdownAlwaysOpen) return !0;
2065
2069
  let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
2066
2070
  return n >= this.#s || n >= t;
2067
2071
  }
2068
- #se() {
2072
+ #ce() {
2069
2073
  let e = this.#e.countrySelectorMode === I.FULLSCREEN, t = this.#N();
2070
2074
  if (e) {
2071
2075
  if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
2072
2076
  let e = this.telInputEl.getBoundingClientRect();
2073
2077
  this.#C.style.paddingLeft = `${e.left}px`, this.#C.style.paddingRight = `${window.innerWidth - e.right}px`;
2074
2078
  }
2075
- } else this.#ce();
2079
+ } else this.#le();
2076
2080
  if (!e && !Se) {
2077
2081
  let e = this.telInputEl.getBoundingClientRect();
2078
- this.#C.style.left = `${e.left}px`, this.#oe() ? this.#C.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#C.style.top = "unset", this.#C.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
2082
+ this.#C.style.left = `${e.left}px`, this.#se() ? this.#C.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#C.style.top = "unset", this.#C.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
2079
2083
  }
2080
2084
  t.appendChild(this.#C);
2081
2085
  }
2082
- #ce() {
2086
+ #le() {
2083
2087
  if (this.#c) return;
2084
2088
  this.#c = !0;
2085
2089
  let e = `--iti-anchor-${this.#t}`, t = getComputedStyle(this.telInputEl).anchorName;
2086
2090
  this.telInputEl.style.anchorName = t && t !== "none" ? `${t}, ${e}` : e, this.#C.style.positionAnchor = e;
2087
2091
  }
2088
- #le() {
2089
- let e = window.visualViewport;
2090
- if (!e || !this.#C) return;
2091
- let t = window.innerHeight - e.height;
2092
- this.#C.style.bottom = `${t}px`;
2092
+ #ue() {
2093
+ let e = window.visualViewport, t = this.#C;
2094
+ if (!e || !t) return;
2095
+ let n = Math.max(0, t.offsetHeight - e.height);
2096
+ t.style.setProperty("--iti-virtual-keyboard-height", `${n}px`);
2093
2097
  }
2094
2098
  isCountrySelectorOpen() {
2095
2099
  return !this.#m.classList.contains(v.HIDE);
@@ -2113,7 +2117,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2113
2117
  }
2114
2118
  setSelectedCountry(e) {
2115
2119
  let { countrySelectorMode: t, showFlags: n, separateDialCode: r, uiTranslations: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
2116
- if (t !== I.OFF && this.#ie(s), this.#u) {
2120
+ if (t !== I.OFF && this.#ae(s), this.#u) {
2117
2121
  let e = this.#k("selectedFlag", s && n ? `${v.FLAG} iti__${s}` : `${v.FLAG} ${v.GLOBE}`), t, r, c = null;
2118
2122
  s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = J())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = J()), this.#d.className = e, this.#u.setAttribute("title", r), this.#u.setAttribute(R.LABEL, t), c ? this.#d.replaceChildren(c) : this.#d.replaceChildren();
2119
2123
  }
@@ -2730,7 +2734,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2730
2734
  },
2731
2735
  startedLoadingUtils: !1,
2732
2736
  startedLoadingAutoCountry: !1,
2733
- version: "29.3.0",
2737
+ version: "29.4.1",
2734
2738
  NUMBER_FORMAT: N,
2735
2739
  NUMBER_TYPE: P,
2736
2740
  VALIDATION_ERROR: F,
@@ -2771,6 +2775,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2771
2775
  excludeCountries: {},
2772
2776
  matchDropdownWidth: { type: Boolean },
2773
2777
  formatAsYouType: { type: Boolean },
2778
+ fullscreenParent: {},
2774
2779
  hiddenInputs: {},
2775
2780
  uiTranslations: {},
2776
2781
  initialCountry: {},
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./IntlTelInput-B6i9DFRz.js";
1
+ import { n as e, t } from "./IntlTelInput-DGKXDaPb.js";
2
2
  //#region packages/vue/src/index.ts
3
3
  var n = t;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./IntlTelInput-B6i9DFRz.js";
1
+ import { n as e, t } from "./IntlTelInput-DGKXDaPb.js";
2
2
  //#region packages/core/dist/js/utils.js
3
3
  var n = {};
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intl-tel-input/vue",
3
- "version": "29.3.0",
3
+ "version": "29.4.1",
4
4
  "description": "A Vue component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "README.md"
25
25
  ],
26
26
  "dependencies": {
27
- "intl-tel-input": "^29.3.0"
27
+ "intl-tel-input": "^29.4.1"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "vue": "^3.0.0"