@intl-tel-input/vue 28.0.9 → 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 &&
|
|
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
|
-
}
|
|
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
|
}
|
|
@@ -2197,17 +2203,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2197
2203
|
return i && (this.#_ = Ae()), a && (this.#v = Ae()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
|
|
2198
2204
|
}
|
|
2199
2205
|
#S() {
|
|
2200
|
-
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.#
|
|
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();
|
|
2201
2207
|
}
|
|
2202
2208
|
#C() {
|
|
2203
2209
|
ye(this.#r, this.#t), xe(this.#r, this.#t), this.#c = pe(this.#r);
|
|
2204
2210
|
}
|
|
2205
2211
|
#w(e = !1) {
|
|
2206
|
-
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.#
|
|
2207
|
-
a ? o ? f ? this.#
|
|
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);
|
|
2208
2214
|
}
|
|
2209
2215
|
#T() {
|
|
2210
|
-
this.#A(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#p.signal, () => 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 || "");
|
|
2211
2217
|
}
|
|
2212
2218
|
#E() {
|
|
2213
2219
|
if (this.#v) {
|
|
@@ -2220,7 +2226,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2220
2226
|
}
|
|
2221
2227
|
async #D() {
|
|
2222
2228
|
if (Q.autoCountry) {
|
|
2223
|
-
this.#
|
|
2229
|
+
this.#ce();
|
|
2224
2230
|
return;
|
|
2225
2231
|
}
|
|
2226
2232
|
if (this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function")) {
|
|
@@ -2242,7 +2248,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2242
2248
|
}
|
|
2243
2249
|
}
|
|
2244
2250
|
#O() {
|
|
2245
|
-
this.#
|
|
2251
|
+
this.#G(), this.#e.prefillSearchWithPlus();
|
|
2246
2252
|
}
|
|
2247
2253
|
#k(e) {
|
|
2248
2254
|
let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
|
|
@@ -2256,18 +2262,18 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2256
2262
|
}
|
|
2257
2263
|
#M(e, t) {
|
|
2258
2264
|
let n = this.#k(e);
|
|
2259
|
-
this.#e.telInputEl.setSelectionRange(n, n), this.#
|
|
2265
|
+
this.#e.telInputEl.setSelectionRange(n, n), this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2260
2266
|
source: "key",
|
|
2261
2267
|
rejectedInput: t,
|
|
2262
2268
|
reason: "invalid"
|
|
2263
2269
|
});
|
|
2264
2270
|
}
|
|
2265
2271
|
#N(e, t) {
|
|
2266
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Te(this.#
|
|
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);
|
|
2267
2273
|
this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2268
2274
|
}
|
|
2269
2275
|
#P(e) {
|
|
2270
|
-
if (e.startsWith("+") && this.#l && this.#
|
|
2276
|
+
if (e.startsWith("+") && this.#l && this.#re(e)) {
|
|
2271
2277
|
let t = we(e, !0, !0, this.#l);
|
|
2272
2278
|
this.#b(t);
|
|
2273
2279
|
}
|
|
@@ -2291,7 +2297,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2291
2297
|
if (this.#V()) return;
|
|
2292
2298
|
s = this.#y();
|
|
2293
2299
|
}
|
|
2294
|
-
this.#
|
|
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);
|
|
2295
2301
|
};
|
|
2296
2302
|
#L() {
|
|
2297
2303
|
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
@@ -2305,10 +2311,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2305
2311
|
return;
|
|
2306
2312
|
}
|
|
2307
2313
|
if (!t) return;
|
|
2308
|
-
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.#
|
|
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;
|
|
2309
2315
|
Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
|
|
2310
|
-
let y = this.#
|
|
2311
|
-
(!l || v && !y && !o) && (this.#
|
|
2316
|
+
let y = this.#Y(_) !== null;
|
|
2317
|
+
(!l || v && !y && !o) && (this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2312
2318
|
source: "key",
|
|
2313
2319
|
rejectedInput: e.key,
|
|
2314
2320
|
reason: l ? "max-length" : "invalid"
|
|
@@ -2330,7 +2336,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2330
2336
|
let e = this.#e.telInputEl, t = this.#g;
|
|
2331
2337
|
if (this.#g = null, !t) return !1;
|
|
2332
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";
|
|
2333
|
-
if (_.length > 30) return this.#
|
|
2339
|
+
if (_.length > 30) return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2334
2340
|
source: "paste",
|
|
2335
2341
|
rejectedInput: n,
|
|
2336
2342
|
reason: "max-length"
|
|
@@ -2338,7 +2344,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2338
2344
|
if (_.length > 5 && Q.utils) {
|
|
2339
2345
|
let e = Q.utils.getCoreNumber(_, c);
|
|
2340
2346
|
for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, c);
|
|
2341
|
-
if (!e) return this.#
|
|
2347
|
+
if (!e) return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2342
2348
|
source: "paste",
|
|
2343
2349
|
rejectedInput: n,
|
|
2344
2350
|
reason: "max-length"
|
|
@@ -2346,7 +2352,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2346
2352
|
if (this.#u && e.length > this.#u) if (a === r.length) {
|
|
2347
2353
|
let t = e.length - this.#u;
|
|
2348
2354
|
_ = _.slice(0, _.length - t), v = "max-length";
|
|
2349
|
-
} else return this.#
|
|
2355
|
+
} else return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2350
2356
|
source: "paste",
|
|
2351
2357
|
rejectedInput: n,
|
|
2352
2358
|
reason: "max-length"
|
|
@@ -2354,7 +2360,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2354
2360
|
}
|
|
2355
2361
|
this.#b(_);
|
|
2356
2362
|
let y = i + h.length;
|
|
2357
|
-
return e.setSelectionRange(y, y), v && (l.length > 0 && h.length === 0 && this.#
|
|
2363
|
+
return e.setSelectionRange(y, y), v && (l.length > 0 && h.length === 0 && this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2358
2364
|
source: "paste",
|
|
2359
2365
|
rejectedInput: n,
|
|
2360
2366
|
reason: v
|
|
@@ -2367,12 +2373,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2367
2373
|
let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
|
|
2368
2374
|
return t && e.length > t ? e.substring(0, t) : e;
|
|
2369
2375
|
}
|
|
2370
|
-
#W() {
|
|
2371
|
-
if (!this.#t.strictRejectAnimation) return;
|
|
2372
|
-
let e = this.#e.telInputEl.parentElement;
|
|
2373
|
-
e && (e.classList.remove("iti__strict-reject-animation"), e.offsetWidth, e.classList.add("iti__strict-reject-animation"));
|
|
2374
|
-
}
|
|
2375
|
-
#G(e, t = {}) {
|
|
2376
|
+
#W(e, t = {}) {
|
|
2376
2377
|
let n = new CustomEvent(e, {
|
|
2377
2378
|
bubbles: !0,
|
|
2378
2379
|
cancelable: !0,
|
|
@@ -2380,39 +2381,39 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2380
2381
|
});
|
|
2381
2382
|
this.#e.telInputEl.dispatchEvent(n);
|
|
2382
2383
|
}
|
|
2383
|
-
#
|
|
2384
|
-
this.#e.isDropdownOpen() || (this.#e.openDropdown((e) => this.#
|
|
2384
|
+
#G() {
|
|
2385
|
+
this.#e.isDropdownOpen() || (this.#e.openDropdown((e) => this.#ee(e), () => this.#te()), this.#W(g.OPEN_COUNTRY_DROPDOWN));
|
|
2385
2386
|
}
|
|
2386
|
-
#
|
|
2387
|
+
#K(e) {
|
|
2387
2388
|
let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
|
|
2388
2389
|
if (t && Q.utils && this.#l) {
|
|
2389
2390
|
let t = Ce(e), a = n && !t || !i.startsWith("+") && !r ? M.NATIONAL : M.INTERNATIONAL;
|
|
2390
2391
|
i = Q.utils.formatNumber(i, this.#l?.iso2, a);
|
|
2391
2392
|
}
|
|
2392
|
-
i = this.#
|
|
2393
|
+
i = this.#oe(i), this.#b(i);
|
|
2393
2394
|
}
|
|
2394
|
-
#
|
|
2395
|
-
let t = this.#
|
|
2396
|
-
return t === null ? !1 : this.#
|
|
2395
|
+
#q(e) {
|
|
2396
|
+
let t = this.#Y(e);
|
|
2397
|
+
return t === null ? !1 : this.#Z(t);
|
|
2397
2398
|
}
|
|
2398
|
-
#
|
|
2399
|
+
#J(e) {
|
|
2399
2400
|
let t = this.#l?.dialCode, n = this.#l?.nationalPrefix;
|
|
2400
2401
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2401
2402
|
}
|
|
2402
|
-
#
|
|
2403
|
+
#Y(e) {
|
|
2403
2404
|
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
|
|
2404
|
-
n = this.#
|
|
2405
|
-
let i = this.#
|
|
2405
|
+
n = this.#J(n);
|
|
2406
|
+
let i = this.#re(n, !0), a = W(n);
|
|
2406
2407
|
if (i) {
|
|
2407
2408
|
let e = W(i), t = this.#a[e];
|
|
2408
|
-
return t.length === 1 ? t[0] === r ? null : t[0] : this.#
|
|
2409
|
+
return t.length === 1 ? t[0] === r ? null : t[0] : this.#X(t, e, a);
|
|
2409
2410
|
} else if (n.startsWith("+") && a.length) {
|
|
2410
2411
|
let e = this.#l?.dialCode || "";
|
|
2411
2412
|
return e && e.startsWith(a) ? null : "";
|
|
2412
2413
|
} else if ((!n || n === "+") && !r && this.#d) return this.#d;
|
|
2413
2414
|
return null;
|
|
2414
2415
|
}
|
|
2415
|
-
#
|
|
2416
|
+
#X(e, t, n) {
|
|
2416
2417
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2417
2418
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2418
2419
|
if (i === C.NANP && Oe(n)) return null;
|
|
@@ -2424,11 +2425,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2424
2425
|
let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
|
|
2425
2426
|
return !c && !l ? e[0] : null;
|
|
2426
2427
|
}
|
|
2427
|
-
#
|
|
2428
|
+
#Z(e) {
|
|
2428
2429
|
let t = this.#l?.iso2 || "";
|
|
2429
|
-
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setCountry(this.#l), this
|
|
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;
|
|
2430
2431
|
}
|
|
2431
|
-
|
|
2432
|
+
#Q() {
|
|
2432
2433
|
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2433
2434
|
if (!e || !Q.utils) return;
|
|
2434
2435
|
let r = this.#l?.iso2;
|
|
@@ -2441,33 +2442,33 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2441
2442
|
let o = Q.utils.getCoreNumber(a, r);
|
|
2442
2443
|
this.#u = o.length, r === "by" && (this.#u = o.length + 1);
|
|
2443
2444
|
}
|
|
2444
|
-
|
|
2445
|
+
#$() {
|
|
2445
2446
|
let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === E.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === E.POLITE;
|
|
2446
2447
|
if (!Q.utils || !i) return;
|
|
2447
2448
|
let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, n, t) : "";
|
|
2448
|
-
a = this.#
|
|
2449
|
+
a = this.#oe(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
|
|
2449
2450
|
}
|
|
2450
|
-
#
|
|
2451
|
+
#ee(e) {
|
|
2451
2452
|
if (!e) return;
|
|
2452
|
-
let t = e.dataset[F.ISO2], n = this.#
|
|
2453
|
-
this.#
|
|
2453
|
+
let t = e.dataset[F.ISO2], n = this.#Z(t);
|
|
2454
|
+
this.#te();
|
|
2454
2455
|
let r = e.dataset[F.DIAL_CODE];
|
|
2455
|
-
if (this.#
|
|
2456
|
+
if (this.#ne(r), this.#t.formatOnDisplay) {
|
|
2456
2457
|
let e = this.#y();
|
|
2457
|
-
this.#
|
|
2458
|
+
this.#K(e);
|
|
2458
2459
|
}
|
|
2459
|
-
this.#e.telInputEl.focus(), n && (this.#
|
|
2460
|
+
this.#e.telInputEl.focus(), n && (this.#se(), this.#W(g.INPUT, { isCountryChange: !0 }));
|
|
2460
2461
|
}
|
|
2461
|
-
#
|
|
2462
|
-
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#
|
|
2462
|
+
#te(e) {
|
|
2463
|
+
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#W(g.CLOSE_COUNTRY_DROPDOWN));
|
|
2463
2464
|
}
|
|
2464
|
-
#
|
|
2465
|
+
#ne(e) {
|
|
2465
2466
|
let t = this.#y();
|
|
2466
2467
|
if (!t.startsWith("+")) return;
|
|
2467
|
-
let n = `+${e}`, r = this.#
|
|
2468
|
+
let n = `+${e}`, r = this.#re(t), i;
|
|
2468
2469
|
i = r ? t.replace(r, n) : n, this.#b(i);
|
|
2469
2470
|
}
|
|
2470
|
-
#
|
|
2471
|
+
#re(e, t) {
|
|
2471
2472
|
if (!e.startsWith("+")) return "";
|
|
2472
2473
|
let n = "", r = "", i = !1;
|
|
2473
2474
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -2482,22 +2483,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2482
2483
|
}
|
|
2483
2484
|
return n;
|
|
2484
2485
|
}
|
|
2485
|
-
#
|
|
2486
|
+
#ie(e) {
|
|
2486
2487
|
let t = this.#l?.dialCode, n = W(e);
|
|
2487
2488
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2488
2489
|
}
|
|
2489
|
-
#
|
|
2490
|
+
#ae() {
|
|
2490
2491
|
let e = this.#y();
|
|
2491
|
-
return this.#
|
|
2492
|
+
return this.#ie(e);
|
|
2492
2493
|
}
|
|
2493
|
-
#
|
|
2494
|
-
let t = we(e, !!this.#
|
|
2494
|
+
#oe(e) {
|
|
2495
|
+
let t = we(e, !!this.#re(e), this.#t.separateDialCode, this.#l);
|
|
2495
2496
|
return this.#U(t);
|
|
2496
2497
|
}
|
|
2497
|
-
#
|
|
2498
|
-
this.#
|
|
2498
|
+
#se() {
|
|
2499
|
+
this.#W(g.COUNTRY_CHANGE, this.#l ?? null);
|
|
2499
2500
|
}
|
|
2500
|
-
#
|
|
2501
|
+
#ce() {
|
|
2501
2502
|
if (!(!this.#_ || !Q.autoCountry)) {
|
|
2502
2503
|
if (!this.#f) {
|
|
2503
2504
|
this.#_.resolve();
|
|
@@ -2506,14 +2507,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2506
2507
|
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#_.resolve();
|
|
2507
2508
|
}
|
|
2508
2509
|
}
|
|
2509
|
-
#
|
|
2510
|
+
#le() {
|
|
2510
2511
|
if (!this.#f) {
|
|
2511
2512
|
this.#_?.reject();
|
|
2512
2513
|
return;
|
|
2513
2514
|
}
|
|
2514
2515
|
this.#w(!0), this.#e.setLoading(!1), this.#_?.reject();
|
|
2515
2516
|
}
|
|
2516
|
-
#
|
|
2517
|
+
#ue() {
|
|
2517
2518
|
if (!this.#f) {
|
|
2518
2519
|
this.#v?.resolve();
|
|
2519
2520
|
return;
|
|
@@ -2523,9 +2524,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2523
2524
|
return;
|
|
2524
2525
|
}
|
|
2525
2526
|
let e = this.#y();
|
|
2526
|
-
e && this.#
|
|
2527
|
+
e && this.#K(e), this.#l && (this.#$(), this.#Q()), this.#v?.resolve();
|
|
2527
2528
|
}
|
|
2528
|
-
#
|
|
2529
|
+
#de(e) {
|
|
2529
2530
|
if (!this.#f) {
|
|
2530
2531
|
this.#v?.reject(e);
|
|
2531
2532
|
return;
|
|
@@ -2533,22 +2534,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2533
2534
|
this.#v?.reject(e);
|
|
2534
2535
|
}
|
|
2535
2536
|
destroy() {
|
|
2536
|
-
this.#f && (this.#f = !1, this.#t.allowDropdown && this.#
|
|
2537
|
+
this.#f && (this.#f = !1, this.#t.allowDropdown && this.#te(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2537
2538
|
}
|
|
2538
2539
|
isActive() {
|
|
2539
2540
|
return this.#f;
|
|
2540
2541
|
}
|
|
2541
2542
|
getExtension() {
|
|
2542
|
-
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#
|
|
2543
|
+
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#ae(), this.#l?.iso2)) : "";
|
|
2543
2544
|
}
|
|
2544
2545
|
getNumber(e) {
|
|
2545
2546
|
if (!this.#f) return "";
|
|
2546
2547
|
X("getNumber");
|
|
2547
|
-
let t = this.#l?.iso2, n = this.#
|
|
2548
|
+
let t = this.#l?.iso2, n = this.#ae(), r = Q.utils.formatNumber(n, t, e);
|
|
2548
2549
|
return this.#m.denormalise(r);
|
|
2549
2550
|
}
|
|
2550
2551
|
getNumberType() {
|
|
2551
|
-
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#
|
|
2552
|
+
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#ae(), this.#l?.iso2)) : null;
|
|
2552
2553
|
}
|
|
2553
2554
|
getSelectedCountryData() {
|
|
2554
2555
|
return this.#l ?? null;
|
|
@@ -2557,12 +2558,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2557
2558
|
if (!this.#f) return null;
|
|
2558
2559
|
X("getValidationError");
|
|
2559
2560
|
let e = this.#l?.iso2;
|
|
2560
|
-
return Q.utils.getValidationError(this.#
|
|
2561
|
+
return Q.utils.getValidationError(this.#ae(), e);
|
|
2561
2562
|
}
|
|
2562
2563
|
isValidNumber() {
|
|
2563
2564
|
if (!this.#f) return null;
|
|
2564
2565
|
X("isValidNumber");
|
|
2565
|
-
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#
|
|
2566
|
+
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#ae(), r = Q.utils.getCoreNumber(n, t);
|
|
2566
2567
|
if (r) {
|
|
2567
2568
|
if (e === w.DIAL_CODE && r[0] === w.MOBILE_PREFIX && r.length !== w.MOBILE_CORE_LENGTH) return !1;
|
|
2568
2569
|
if (!b.ALPHA_UNICODE.test(n) && e) {
|
|
@@ -2570,13 +2571,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2570
2571
|
if (r.length > t) return !1;
|
|
2571
2572
|
}
|
|
2572
2573
|
}
|
|
2573
|
-
return this.#
|
|
2574
|
+
return this.#fe("possible");
|
|
2574
2575
|
}
|
|
2575
2576
|
isValidNumberPrecise() {
|
|
2576
|
-
return this.#f ? (X("isValidNumberPrecise"), this.#
|
|
2577
|
+
return this.#f ? (X("isValidNumberPrecise"), this.#fe("precise")) : null;
|
|
2577
2578
|
}
|
|
2578
|
-
#
|
|
2579
|
-
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#
|
|
2579
|
+
#fe(e) {
|
|
2580
|
+
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ae();
|
|
2580
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;
|
|
2581
2582
|
}
|
|
2582
2583
|
setCountry(e) {
|
|
@@ -2585,20 +2586,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2585
2586
|
if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
|
|
2586
2587
|
let n = this.#l?.iso2;
|
|
2587
2588
|
if (e && t !== n || !e && n) {
|
|
2588
|
-
if (this.#
|
|
2589
|
+
if (this.#Z(t), this.#ne(this.#l?.dialCode || ""), this.#t.formatOnDisplay) {
|
|
2589
2590
|
let e = this.#y();
|
|
2590
|
-
this.#
|
|
2591
|
+
this.#K(e);
|
|
2591
2592
|
}
|
|
2592
|
-
this.#
|
|
2593
|
+
this.#se(), this.#W(g.INPUT, { isCountryChange: !0 });
|
|
2593
2594
|
}
|
|
2594
2595
|
}
|
|
2595
2596
|
setNumber(e) {
|
|
2596
2597
|
if (!this.#f) return;
|
|
2597
|
-
let t = this.#m.normalise(e), n = this.#
|
|
2598
|
-
this.#
|
|
2598
|
+
let t = this.#m.normalise(e), n = this.#q(t);
|
|
2599
|
+
this.#K(t), n && this.#se(), this.#W(g.INPUT, { isSetNumber: !0 });
|
|
2599
2600
|
}
|
|
2600
2601
|
setPlaceholderNumberType(e) {
|
|
2601
|
-
this.#f && (this.#t.placeholderNumberType = e, this
|
|
2602
|
+
this.#f && (this.#t.placeholderNumberType = e, this.#$());
|
|
2602
2603
|
}
|
|
2603
2604
|
setDisabled(e) {
|
|
2604
2605
|
this.#f && this.#e.setDisabled(e);
|
|
@@ -2611,16 +2612,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2611
2612
|
r.forEach((n) => {
|
|
2612
2613
|
if (n instanceof e) switch (t) {
|
|
2613
2614
|
case "handleUtilsLoaded":
|
|
2614
|
-
n.#
|
|
2615
|
+
n.#ue();
|
|
2615
2616
|
break;
|
|
2616
2617
|
case "handleUtilsFailure":
|
|
2617
|
-
n.#
|
|
2618
|
+
n.#de(i);
|
|
2618
2619
|
break;
|
|
2619
2620
|
case "handleAutoCountryLoaded":
|
|
2620
|
-
n.#
|
|
2621
|
+
n.#ce();
|
|
2621
2622
|
break;
|
|
2622
2623
|
case "handleAutoCountryFailure":
|
|
2623
|
-
n.#
|
|
2624
|
+
n.#le();
|
|
2624
2625
|
break;
|
|
2625
2626
|
}
|
|
2626
2627
|
});
|
|
@@ -2651,7 +2652,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2651
2652
|
},
|
|
2652
2653
|
startedLoadingUtils: !1,
|
|
2653
2654
|
startedLoadingAutoCountry: !1,
|
|
2654
|
-
version: "28.0
|
|
2655
|
+
version: "28.1.0",
|
|
2655
2656
|
NUMBER_FORMAT: M,
|
|
2656
2657
|
NUMBER_TYPE: N,
|
|
2657
2658
|
VALIDATION_ERROR: P
|
package/dist/IntlTelInput.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/vue",
|
|
3
|
-
"version": "28.0
|
|
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
|
|
27
|
+
"intl-tel-input": "^28.1.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"vue": "^3.0.0"
|