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