@intl-tel-input/vue 28.0.8 → 28.1.0

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.
@@ -1196,7 +1196,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1196
1196
  FLAG: "iti__flag",
1197
1197
  LOADING: "iti__loading",
1198
1198
  COUNTRY_ITEM: "iti__country",
1199
- HIGHLIGHT: "iti__highlight"
1199
+ HIGHLIGHT: "iti__highlight",
1200
+ STRICT_REJECT_ANIMATION: "iti__strict-reject-animation"
1200
1201
  }, v = {
1201
1202
  ARROW_UP: "ArrowUp",
1202
1203
  ARROW_DOWN: "ArrowDown",
@@ -1938,17 +1939,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1938
1939
  }, 0);
1939
1940
  }
1940
1941
  #Z(e, t, n) {
1941
- let r = "", i = null;
1942
- document.addEventListener("keydown", (e) => {
1942
+ let r = "", i = null, a = (e) => {
1943
1943
  [
1944
1944
  v.ARROW_UP,
1945
1945
  v.ARROW_DOWN,
1946
1946
  v.ENTER,
1947
1947
  v.ESC
1948
- ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#ee(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#w) : e.key === v.ESC && (n(), this.#l.focus())), !this.#e.countrySearch && e.target !== this.telInputEl && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#$(r), i = setTimeout(() => {
1948
+ ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#ee(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#w) : e.key === v.ESC && (n(), this.#l.focus())), !this.#e.countrySearch && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#$(r), i = setTimeout(() => {
1949
1949
  r = "";
1950
1950
  }, x.HIDDEN_SEARCH_RESET_MS));
1951
- }, { signal: e });
1951
+ };
1952
+ this.#l?.addEventListener("keydown", a, { signal: e }), this.#p?.addEventListener("keydown", a, { signal: e });
1952
1953
  }
1953
1954
  #Q(e) {
1954
1955
  this.#h.addEventListener("input", () => this.#U(), { signal: e }), this.#g.addEventListener("click", () => this.#W(), { signal: e });
@@ -2016,6 +2017,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2016
2017
  setLoading(e) {
2017
2018
  this.#u.classList.toggle(_.LOADING, e);
2018
2019
  }
2020
+ playStrictRejectAnimation() {
2021
+ if (!this.#e.strictRejectAnimation) return;
2022
+ let e = this.telInputEl.parentElement;
2023
+ e && (e.classList.remove(_.STRICT_REJECT_ANIMATION), e.offsetWidth, e.classList.add(_.STRICT_REJECT_ANIMATION), e.addEventListener("animationend", () => e.classList.remove(_.STRICT_REJECT_ANIMATION), { once: !0 }));
2024
+ }
2019
2025
  isLoading() {
2020
2026
  return this.#u.classList.contains(_.LOADING);
2021
2027
  }
@@ -2172,54 +2178,55 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2172
2178
  #p;
2173
2179
  #m;
2174
2180
  #h = !1;
2175
- #g;
2181
+ #g = null;
2176
2182
  #_;
2183
+ #v;
2177
2184
  constructor(e, t = {}) {
2178
2185
  this.id = ke++, _e.validateInput(e);
2179
2186
  let n = ae(t);
2180
2187
  this.#t = {
2181
2188
  ...R,
2182
2189
  ...n
2183
- }, oe(this.#t), se(this.#t), this.#e = new _e(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new ge(e.value), this.promise = this.#b(this.#t), this.#r = ve(this.#t);
2190
+ }, oe(this.#t), se(this.#t), this.#e = new _e(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new ge(e.value), this.promise = this.#x(this.#t), this.#r = ve(this.#t);
2184
2191
  let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = be(this.#r);
2185
- this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#x();
2192
+ this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#S();
2186
2193
  }
2187
- #v() {
2194
+ #y() {
2188
2195
  let e = this.#e.telInputEl.value.trim();
2189
2196
  return this.#m.normalise(e);
2190
2197
  }
2191
- #y(e) {
2198
+ #b(e) {
2192
2199
  this.#e.telInputEl.value = this.#m.denormalise(e);
2193
2200
  }
2194
- #b(e) {
2201
+ #x(e) {
2195
2202
  let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === D.AUTO && !!n, a = !!r && !Q.utils;
2196
- return i && (this.#g = Ae()), a && (this.#_ = Ae()), Promise.all([this.#g?.promise, this.#_?.promise]).then(() => {});
2197
- }
2198
- #x() {
2199
- this.#p = new AbortController(), this.#S(), this.#e.buildMarkup(this.#r, this.#c), this.#C(), this.#w(), this.#T(), this.#t.dropdownAlwaysOpen && this.#U();
2203
+ return i && (this.#_ = Ae()), a && (this.#v = Ae()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
2200
2204
  }
2201
2205
  #S() {
2202
- ye(this.#r, this.#t), xe(this.#r, this.#t), this.#c = pe(this.#r);
2206
+ this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.#G();
2203
2207
  }
2204
- #C(e = !1) {
2205
- let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#v(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#te(i), o = Oe(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === D.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
2206
- a ? o ? f ? this.#Y(u) : d || this.#Y(T.ISO2) : (f && this.#Y(u), this.#G(i)) : f ? this.#Y(u) : d || this.#Y(""), i && this.#W(i);
2208
+ #C() {
2209
+ ye(this.#r, this.#t), xe(this.#r, this.#t), this.#c = pe(this.#r);
2207
2210
  }
2208
- #w() {
2209
- this.#k(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#p.signal, () => this.#U(), () => this.#$()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
2211
+ #w(e = !1) {
2212
+ let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#re(i), o = Oe(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === D.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
2213
+ a ? o ? f ? this.#Z(u) : d || this.#Z(T.ISO2) : (f && this.#Z(u), this.#q(i)) : f ? this.#Z(u) : d || this.#Z(""), i && this.#K(i);
2210
2214
  }
2211
2215
  #T() {
2212
- if (this.#_) {
2216
+ this.#A(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#p.signal, () => this.#G(), () => this.#te()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
2217
+ }
2218
+ #E() {
2219
+ if (this.#v) {
2213
2220
  let { loadUtils: e } = this.#t, t = () => {
2214
2221
  Q.attachUtils(e).catch(() => {});
2215
2222
  };
2216
2223
  Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#p.signal });
2217
2224
  }
2218
- this.#g && (this.#l ? this.#g.resolve() : this.#E());
2225
+ this.#_ && (this.#l ? this.#_.resolve() : this.#D());
2219
2226
  }
2220
- async #E() {
2227
+ async #D() {
2221
2228
  if (Q.autoCountry) {
2222
- this.#oe();
2229
+ this.#ce();
2223
2230
  return;
2224
2231
  }
2225
2232
  if (this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function")) {
@@ -2240,132 +2247,133 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2240
2247
  }
2241
2248
  }
2242
2249
  }
2243
- #D() {
2244
- this.#U(), this.#e.prefillSearchWithPlus();
2250
+ #O() {
2251
+ this.#G(), this.#e.prefillSearchWithPlus();
2245
2252
  }
2246
- #O(e) {
2253
+ #k(e) {
2247
2254
  let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
2248
- return this.#y(n + r), t - 1;
2255
+ return this.#b(n + r), t - 1;
2249
2256
  }
2250
- #k() {
2251
- this.#P(), this.#I(), this.#R();
2257
+ #A() {
2258
+ this.#F(), this.#L(), this.#z();
2252
2259
  }
2253
- #A(e) {
2254
- this.#O(e), this.#D();
2260
+ #j(e) {
2261
+ this.#k(e), this.#O();
2255
2262
  }
2256
- #j(e, t) {
2257
- let n = this.#O(e);
2258
- this.#e.telInputEl.setSelectionRange(n, n), this.#V(), this.#H(g.STRICT_REJECT, {
2263
+ #M(e, t) {
2264
+ let n = this.#k(e);
2265
+ this.#e.telInputEl.setSelectionRange(n, n), this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2259
2266
  source: "key",
2260
2267
  rejectedInput: t,
2261
2268
  reason: "invalid"
2262
2269
  });
2263
2270
  }
2264
- #M(e, t) {
2265
- let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Te(this.#re(), e, Q.utils, this.#l, this.#t.separateDialCode), a = Ee(r, i, n, t);
2266
- this.#y(i), this.#e.telInputEl.setSelectionRange(a, a);
2271
+ #N(e, t) {
2272
+ let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Te(this.#ae(), e, Q.utils, this.#l, this.#t.separateDialCode), a = Ee(r, i, n, t);
2273
+ this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
2267
2274
  }
2268
- #N(e) {
2269
- if (e.startsWith("+") && this.#l && this.#te(e)) {
2275
+ #P(e) {
2276
+ if (e.startsWith("+") && this.#l && this.#re(e)) {
2270
2277
  let t = we(e, !0, !0, this.#l);
2271
- this.#y(t);
2278
+ this.#b(t);
2272
2279
  }
2273
2280
  }
2274
- #P() {
2275
- this.#h = b.ALPHA_UNICODE.test(this.#v()), this.#e.telInputEl.addEventListener("input", this.#F, { signal: this.#p.signal });
2281
+ #F() {
2282
+ this.#h = b.ALPHA_UNICODE.test(this.#y()), this.#e.telInputEl.addEventListener("input", this.#I, { signal: this.#p.signal });
2276
2283
  }
2277
- #F = (e) => {
2284
+ #I = (e) => {
2278
2285
  let { strictMode: t, formatAsYouType: n, separateDialCode: r, allowDropdown: i, countrySearch: a } = this.#t, o = e?.detail;
2279
2286
  if (o?.isCountryChange) return;
2280
- let s = this.#v();
2281
- if (this.#n && e?.data === "+" && r && i && a) {
2282
- this.#A(s);
2287
+ let s = this.#y(), c = e?.inputType === y.PASTE, l = t && c;
2288
+ if (this.#n && !c && e?.data === "+" && r && i && a) {
2289
+ this.#j(s);
2283
2290
  return;
2284
2291
  }
2285
- if (this.#n && t && (e?.data === " " || e?.data === "-" || e?.data === ".")) {
2286
- this.#j(s, e.data);
2292
+ if (this.#n && !c && t && (e?.data === " " || e?.data === "-" || e?.data === ".")) {
2293
+ this.#M(s, e.data);
2287
2294
  return;
2288
2295
  }
2289
- this.#G(s) && this.#ae();
2290
- let c = e?.data && b.NON_PLUS_NUMERIC.test(e.data), l = e?.inputType === y.PASTE && s;
2291
- c || l && !t ? this.#h = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#M(s, e?.inputType === y.DELETE_FORWARD), r && this.#N(s);
2296
+ if (l) {
2297
+ if (this.#V()) return;
2298
+ s = this.#y();
2299
+ }
2300
+ this.#q(s) && this.#se(), !l && e?.data && b.NON_PLUS_NUMERIC.test(e.data) || c && s && !t ? this.#h = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#N(s, e?.inputType === y.DELETE_FORWARD), r && this.#P(s);
2292
2301
  };
2293
- #I() {
2302
+ #L() {
2294
2303
  let { strictMode: e, separateDialCode: t } = this.#t;
2295
- !e && !t || this.#e.telInputEl.addEventListener("keydown", this.#L, { signal: this.#p.signal });
2304
+ !e && !t || this.#e.telInputEl.addEventListener("keydown", this.#R, { signal: this.#p.signal });
2296
2305
  }
2297
- #L = (e) => {
2306
+ #R = (e) => {
2298
2307
  let { strictMode: t, separateDialCode: n, allowDropdown: r, countrySearch: i } = this.#t;
2299
2308
  if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
2300
2309
  if (n && r && i && e.key === "+") {
2301
- e.preventDefault(), this.#D();
2310
+ e.preventDefault(), this.#O();
2302
2311
  return;
2303
2312
  }
2304
2313
  if (!t) return;
2305
- let a = this.#v(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#ne(h), v = !1;
2314
+ let a = this.#y(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#ie(h), v = !1;
2306
2315
  Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
2307
- let y = this.#q(_) !== null;
2308
- (!l || v && !y && !o) && (this.#V(), this.#H(g.STRICT_REJECT, {
2316
+ let y = this.#Y(_) !== null;
2317
+ (!l || v && !y && !o) && (this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2309
2318
  source: "key",
2310
2319
  rejectedInput: e.key,
2311
2320
  reason: l ? "max-length" : "invalid"
2312
2321
  }), e.preventDefault());
2313
2322
  };
2314
- #R() {
2315
- this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#z, { signal: this.#p.signal });
2316
- }
2317
- #z = (e) => {
2318
- e.preventDefault();
2319
- let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#v(), a = i.slice(0, n ?? void 0), o = i.slice(r ?? void 0), s = this.#l?.iso2, c = e.clipboardData.getData("text"), l = this.#m.normalise(c), u = n === 0 && r > 0, d = !i.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = a + h + o, v = h === l ? null : "invalid";
2320
- if (_.length > 30) {
2321
- this.#V(), this.#H(g.STRICT_REJECT, {
2323
+ #z() {
2324
+ this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#B, { signal: this.#p.signal });
2325
+ }
2326
+ #B = (e) => {
2327
+ let t = this.#e.telInputEl, n = this.#y();
2328
+ this.#g = {
2329
+ pastedRaw: e.clipboardData?.getData("text") ?? "",
2330
+ value: n,
2331
+ selectionStart: t.selectionStart ?? n.length,
2332
+ selectionEnd: t.selectionEnd ?? n.length
2333
+ };
2334
+ };
2335
+ #V() {
2336
+ let e = this.#e.telInputEl, t = this.#g;
2337
+ if (this.#g = null, !t) return !1;
2338
+ let n = t.pastedRaw, r = t.value, i = t.selectionStart, a = t.selectionEnd, o = r.slice(0, i), s = r.slice(a), c = this.#l?.iso2, l = this.#m.normalise(n), u = i === 0 && a > 0, d = !r.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = o + h + s, v = h === l ? null : "invalid";
2339
+ if (_.length > 30) return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2340
+ source: "paste",
2341
+ rejectedInput: n,
2342
+ reason: "max-length"
2343
+ }), this.#H(t), !0;
2344
+ if (_.length > 5 && Q.utils) {
2345
+ let e = Q.utils.getCoreNumber(_, c);
2346
+ for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, c);
2347
+ if (!e) return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2322
2348
  source: "paste",
2323
- rejectedInput: c,
2349
+ rejectedInput: n,
2324
2350
  reason: "max-length"
2325
- });
2326
- return;
2327
- }
2328
- if (_.length > 5 && Q.utils) {
2329
- let e = Q.utils.getCoreNumber(_, s);
2330
- for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, s);
2331
- if (!e) {
2332
- this.#V(), this.#H(g.STRICT_REJECT, {
2333
- source: "paste",
2334
- rejectedInput: c,
2335
- reason: "max-length"
2336
- });
2337
- return;
2338
- }
2339
- if (this.#u && e.length > this.#u) if (t.selectionEnd === i.length) {
2351
+ }), this.#H(t), !0;
2352
+ if (this.#u && e.length > this.#u) if (a === r.length) {
2340
2353
  let t = e.length - this.#u;
2341
2354
  _ = _.slice(0, _.length - t), v = "max-length";
2342
- } else {
2343
- this.#V(), this.#H(g.STRICT_REJECT, {
2344
- source: "paste",
2345
- rejectedInput: c,
2346
- reason: "max-length"
2347
- });
2348
- return;
2349
- }
2355
+ } else return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2356
+ source: "paste",
2357
+ rejectedInput: n,
2358
+ reason: "max-length"
2359
+ }), this.#H(t), !0;
2350
2360
  }
2351
- this.#y(_);
2352
- let y = n + h.length;
2353
- t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && (l.length > 0 && h.length === 0 && this.#V(), this.#H(g.STRICT_REJECT, {
2361
+ this.#b(_);
2362
+ let y = i + h.length;
2363
+ return e.setSelectionRange(y, y), v && (l.length > 0 && h.length === 0 && this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
2354
2364
  source: "paste",
2355
- rejectedInput: c,
2365
+ rejectedInput: n,
2356
2366
  reason: v
2357
- }));
2358
- };
2359
- #B(e) {
2367
+ })), !1;
2368
+ }
2369
+ #H(e) {
2370
+ this.#b(e.value), this.#e.telInputEl.setSelectionRange(e.selectionStart, e.selectionEnd);
2371
+ }
2372
+ #U(e) {
2360
2373
  let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
2361
2374
  return t && e.length > t ? e.substring(0, t) : e;
2362
2375
  }
2363
- #V() {
2364
- if (!this.#t.strictRejectAnimation) return;
2365
- let e = this.#e.telInputEl.parentElement;
2366
- e && (e.classList.remove("iti__strict-reject-animation"), e.offsetWidth, e.classList.add("iti__strict-reject-animation"));
2367
- }
2368
- #H(e, t = {}) {
2376
+ #W(e, t = {}) {
2369
2377
  let n = new CustomEvent(e, {
2370
2378
  bubbles: !0,
2371
2379
  cancelable: !0,
@@ -2373,39 +2381,39 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2373
2381
  });
2374
2382
  this.#e.telInputEl.dispatchEvent(n);
2375
2383
  }
2376
- #U() {
2377
- this.#e.isDropdownOpen() || (this.#e.openDropdown((e) => this.#Q(e), () => this.#$()), this.#H(g.OPEN_COUNTRY_DROPDOWN));
2384
+ #G() {
2385
+ this.#e.isDropdownOpen() || (this.#e.openDropdown((e) => this.#ee(e), () => this.#te()), this.#W(g.OPEN_COUNTRY_DROPDOWN));
2378
2386
  }
2379
- #W(e) {
2387
+ #K(e) {
2380
2388
  let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
2381
2389
  if (t && Q.utils && this.#l) {
2382
2390
  let t = Ce(e), a = n && !t || !i.startsWith("+") && !r ? M.NATIONAL : M.INTERNATIONAL;
2383
2391
  i = Q.utils.formatNumber(i, this.#l?.iso2, a);
2384
2392
  }
2385
- i = this.#ie(i), this.#y(i);
2393
+ i = this.#oe(i), this.#b(i);
2386
2394
  }
2387
- #G(e) {
2388
- let t = this.#q(e);
2389
- return t === null ? !1 : this.#Y(t);
2395
+ #q(e) {
2396
+ let t = this.#Y(e);
2397
+ return t === null ? !1 : this.#Z(t);
2390
2398
  }
2391
- #K(e) {
2399
+ #J(e) {
2392
2400
  let t = this.#l?.dialCode, n = this.#l?.nationalPrefix;
2393
2401
  return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
2394
2402
  }
2395
- #q(e) {
2403
+ #Y(e) {
2396
2404
  let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
2397
- n = this.#K(n);
2398
- let i = this.#te(n, !0), a = W(n);
2405
+ n = this.#J(n);
2406
+ let i = this.#re(n, !0), a = W(n);
2399
2407
  if (i) {
2400
2408
  let e = W(i), t = this.#a[e];
2401
- return t.length === 1 ? t[0] === r ? null : t[0] : this.#J(t, e, a);
2409
+ return t.length === 1 ? t[0] === r ? null : t[0] : this.#X(t, e, a);
2402
2410
  } else if (n.startsWith("+") && a.length) {
2403
2411
  let e = this.#l?.dialCode || "";
2404
2412
  return e && e.startsWith(a) ? null : "";
2405
2413
  } else if ((!n || n === "+") && !r && this.#d) return this.#d;
2406
2414
  return null;
2407
2415
  }
2408
- #J(e, t, n) {
2416
+ #X(e, t, n) {
2409
2417
  let r = this.#l?.iso2, i = this.#l?.dialCode;
2410
2418
  if (!r && this.#d && e.includes(this.#d)) return this.#d;
2411
2419
  if (i === C.NANP && Oe(n)) return null;
@@ -2417,11 +2425,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2417
2425
  let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
2418
2426
  return !c && !l ? e[0] : null;
2419
2427
  }
2420
- #Y(e) {
2428
+ #Z(e) {
2421
2429
  let t = this.#l?.iso2 || "";
2422
- return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setCountry(this.#l), this.#Z(), this.#X(), t !== e;
2430
+ return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setCountry(this.#l), this.#$(), this.#Q(), t !== e;
2423
2431
  }
2424
- #X() {
2432
+ #Q() {
2425
2433
  let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
2426
2434
  if (!e || !Q.utils) return;
2427
2435
  let r = this.#l?.iso2;
@@ -2434,33 +2442,33 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2434
2442
  let o = Q.utils.getCoreNumber(a, r);
2435
2443
  this.#u = o.length, r === "by" && (this.#u = o.length + 1);
2436
2444
  }
2437
- #Z() {
2445
+ #$() {
2438
2446
  let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === E.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === E.POLITE;
2439
2447
  if (!Q.utils || !i) return;
2440
2448
  let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, n, t) : "";
2441
- a = this.#ie(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
2449
+ a = this.#oe(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
2442
2450
  }
2443
- #Q(e) {
2451
+ #ee(e) {
2444
2452
  if (!e) return;
2445
- let t = e.dataset[F.ISO2], n = this.#Y(t);
2446
- this.#$();
2453
+ let t = e.dataset[F.ISO2], n = this.#Z(t);
2454
+ this.#te();
2447
2455
  let r = e.dataset[F.DIAL_CODE];
2448
- if (this.#ee(r), this.#t.formatOnDisplay) {
2449
- let e = this.#v();
2450
- this.#W(e);
2456
+ if (this.#ne(r), this.#t.formatOnDisplay) {
2457
+ let e = this.#y();
2458
+ this.#K(e);
2451
2459
  }
2452
- this.#e.telInputEl.focus(), n && (this.#ae(), this.#H(g.INPUT, { isCountryChange: !0 }));
2460
+ this.#e.telInputEl.focus(), n && (this.#se(), this.#W(g.INPUT, { isCountryChange: !0 }));
2453
2461
  }
2454
- #$(e) {
2455
- !this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#H(g.CLOSE_COUNTRY_DROPDOWN));
2462
+ #te(e) {
2463
+ !this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#W(g.CLOSE_COUNTRY_DROPDOWN));
2456
2464
  }
2457
- #ee(e) {
2458
- let t = this.#v();
2465
+ #ne(e) {
2466
+ let t = this.#y();
2459
2467
  if (!t.startsWith("+")) return;
2460
- let n = `+${e}`, r = this.#te(t), i;
2461
- i = r ? t.replace(r, n) : n, this.#y(i);
2468
+ let n = `+${e}`, r = this.#re(t), i;
2469
+ i = r ? t.replace(r, n) : n, this.#b(i);
2462
2470
  }
2463
- #te(e, t) {
2471
+ #re(e, t) {
2464
2472
  if (!e.startsWith("+")) return "";
2465
2473
  let n = "", r = "", i = !1;
2466
2474
  for (let a = 0; a < e.length; a++) {
@@ -2475,73 +2483,73 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2475
2483
  }
2476
2484
  return n;
2477
2485
  }
2478
- #ne(e) {
2486
+ #ie(e) {
2479
2487
  let t = this.#l?.dialCode, n = W(e);
2480
2488
  return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
2481
2489
  }
2482
- #re() {
2483
- let e = this.#v();
2484
- return this.#ne(e);
2490
+ #ae() {
2491
+ let e = this.#y();
2492
+ return this.#ie(e);
2485
2493
  }
2486
- #ie(e) {
2487
- let t = we(e, !!this.#te(e), this.#t.separateDialCode, this.#l);
2488
- return this.#B(t);
2494
+ #oe(e) {
2495
+ let t = we(e, !!this.#re(e), this.#t.separateDialCode, this.#l);
2496
+ return this.#U(t);
2489
2497
  }
2490
- #ae() {
2491
- this.#H(g.COUNTRY_CHANGE, this.#l ?? null);
2498
+ #se() {
2499
+ this.#W(g.COUNTRY_CHANGE, this.#l ?? null);
2492
2500
  }
2493
- #oe() {
2494
- if (!(!this.#g || !Q.autoCountry)) {
2501
+ #ce() {
2502
+ if (!(!this.#_ || !Q.autoCountry)) {
2495
2503
  if (!this.#f) {
2496
- this.#g.resolve();
2504
+ this.#_.resolve();
2497
2505
  return;
2498
2506
  }
2499
- this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#g.resolve();
2507
+ this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#_.resolve();
2500
2508
  }
2501
2509
  }
2502
- #se() {
2510
+ #le() {
2503
2511
  if (!this.#f) {
2504
- this.#g?.reject();
2512
+ this.#_?.reject();
2505
2513
  return;
2506
2514
  }
2507
- this.#C(!0), this.#e.setLoading(!1), this.#g?.reject();
2515
+ this.#w(!0), this.#e.setLoading(!1), this.#_?.reject();
2508
2516
  }
2509
- #ce() {
2517
+ #ue() {
2510
2518
  if (!this.#f) {
2511
- this.#_?.resolve();
2519
+ this.#v?.resolve();
2512
2520
  return;
2513
2521
  }
2514
2522
  if (!Q.utils) {
2515
- this.#_?.resolve();
2523
+ this.#v?.resolve();
2516
2524
  return;
2517
2525
  }
2518
- let e = this.#v();
2519
- e && this.#W(e), this.#l && (this.#Z(), this.#X()), this.#_?.resolve();
2526
+ let e = this.#y();
2527
+ e && this.#K(e), this.#l && (this.#$(), this.#Q()), this.#v?.resolve();
2520
2528
  }
2521
- #le(e) {
2529
+ #de(e) {
2522
2530
  if (!this.#f) {
2523
- this.#_?.reject(e);
2531
+ this.#v?.reject(e);
2524
2532
  return;
2525
2533
  }
2526
- this.#_?.reject(e);
2534
+ this.#v?.reject(e);
2527
2535
  }
2528
2536
  destroy() {
2529
- this.#f && (this.#f = !1, this.#t.allowDropdown && this.#$(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
2537
+ this.#f && (this.#f = !1, this.#t.allowDropdown && this.#te(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
2530
2538
  }
2531
2539
  isActive() {
2532
2540
  return this.#f;
2533
2541
  }
2534
2542
  getExtension() {
2535
- return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#re(), this.#l?.iso2)) : "";
2543
+ return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#ae(), this.#l?.iso2)) : "";
2536
2544
  }
2537
2545
  getNumber(e) {
2538
2546
  if (!this.#f) return "";
2539
2547
  X("getNumber");
2540
- let t = this.#l?.iso2, n = this.#re(), r = Q.utils.formatNumber(n, t, e);
2548
+ let t = this.#l?.iso2, n = this.#ae(), r = Q.utils.formatNumber(n, t, e);
2541
2549
  return this.#m.denormalise(r);
2542
2550
  }
2543
2551
  getNumberType() {
2544
- return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#re(), this.#l?.iso2)) : null;
2552
+ return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#ae(), this.#l?.iso2)) : null;
2545
2553
  }
2546
2554
  getSelectedCountryData() {
2547
2555
  return this.#l ?? null;
@@ -2550,12 +2558,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2550
2558
  if (!this.#f) return null;
2551
2559
  X("getValidationError");
2552
2560
  let e = this.#l?.iso2;
2553
- return Q.utils.getValidationError(this.#re(), e);
2561
+ return Q.utils.getValidationError(this.#ae(), e);
2554
2562
  }
2555
2563
  isValidNumber() {
2556
2564
  if (!this.#f) return null;
2557
2565
  X("isValidNumber");
2558
- let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#re(), r = Q.utils.getCoreNumber(n, t);
2566
+ let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#ae(), r = Q.utils.getCoreNumber(n, t);
2559
2567
  if (r) {
2560
2568
  if (e === w.DIAL_CODE && r[0] === w.MOBILE_PREFIX && r.length !== w.MOBILE_CORE_LENGTH) return !1;
2561
2569
  if (!b.ALPHA_UNICODE.test(n) && e) {
@@ -2563,13 +2571,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2563
2571
  if (r.length > t) return !1;
2564
2572
  }
2565
2573
  }
2566
- return this.#ue("possible");
2574
+ return this.#fe("possible");
2567
2575
  }
2568
2576
  isValidNumberPrecise() {
2569
- return this.#f ? (X("isValidNumberPrecise"), this.#ue("precise")) : null;
2577
+ return this.#f ? (X("isValidNumberPrecise"), this.#fe("precise")) : null;
2570
2578
  }
2571
- #ue(e) {
2572
- let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#re();
2579
+ #fe(e) {
2580
+ let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ae();
2573
2581
  return !this.#l && !Ce(a) || !(e === "precise" ? Q.utils.isValidNumber : Q.utils.isPossibleNumber)(a, i, r) ? !1 : b.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
2574
2582
  }
2575
2583
  setCountry(e) {
@@ -2578,20 +2586,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2578
2586
  if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
2579
2587
  let n = this.#l?.iso2;
2580
2588
  if (e && t !== n || !e && n) {
2581
- if (this.#Y(t), this.#ee(this.#l?.dialCode || ""), this.#t.formatOnDisplay) {
2582
- let e = this.#v();
2583
- this.#W(e);
2589
+ if (this.#Z(t), this.#ne(this.#l?.dialCode || ""), this.#t.formatOnDisplay) {
2590
+ let e = this.#y();
2591
+ this.#K(e);
2584
2592
  }
2585
- this.#ae(), this.#H(g.INPUT, { isCountryChange: !0 });
2593
+ this.#se(), this.#W(g.INPUT, { isCountryChange: !0 });
2586
2594
  }
2587
2595
  }
2588
2596
  setNumber(e) {
2589
2597
  if (!this.#f) return;
2590
- let t = this.#m.normalise(e), n = this.#G(t);
2591
- this.#W(t), n && this.#ae(), this.#H(g.INPUT, { isSetNumber: !0 });
2598
+ let t = this.#m.normalise(e), n = this.#q(t);
2599
+ this.#K(t), n && this.#se(), this.#W(g.INPUT, { isSetNumber: !0 });
2592
2600
  }
2593
2601
  setPlaceholderNumberType(e) {
2594
- this.#f && (this.#t.placeholderNumberType = e, this.#Z());
2602
+ this.#f && (this.#t.placeholderNumberType = e, this.#$());
2595
2603
  }
2596
2604
  setDisabled(e) {
2597
2605
  this.#f && this.#e.setDisabled(e);
@@ -2604,16 +2612,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2604
2612
  r.forEach((n) => {
2605
2613
  if (n instanceof e) switch (t) {
2606
2614
  case "handleUtilsLoaded":
2607
- n.#ce();
2615
+ n.#ue();
2608
2616
  break;
2609
2617
  case "handleUtilsFailure":
2610
- n.#le(i);
2618
+ n.#de(i);
2611
2619
  break;
2612
2620
  case "handleAutoCountryLoaded":
2613
- n.#oe();
2621
+ n.#ce();
2614
2622
  break;
2615
2623
  case "handleAutoCountryFailure":
2616
- n.#se();
2624
+ n.#le();
2617
2625
  break;
2618
2626
  }
2619
2627
  });
@@ -2644,7 +2652,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
2644
2652
  },
2645
2653
  startedLoadingUtils: !1,
2646
2654
  startedLoadingAutoCountry: !1,
2647
- version: "28.0.8",
2655
+ version: "28.1.0",
2648
2656
  NUMBER_FORMAT: M,
2649
2657
  NUMBER_TYPE: N,
2650
2658
  VALIDATION_ERROR: P
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./IntlTelInput-DxicrgkA.js";
1
+ import { n as e, t } from "./IntlTelInput-CrRJx9yp.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-DxicrgkA.js";
1
+ import { n as e, t } from "./IntlTelInput-CrRJx9yp.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": "28.0.8",
3
+ "version": "28.1.0",
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": "^28.0.8"
27
+ "intl-tel-input": "^28.1.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "vue": "^3.0.0"