maz-ui 3.43.2 → 3.43.4
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/components/MazInputCode.mjs +41 -36
- package/components/MazPhoneNumberInput/PhoneInput.vue.d.ts +4 -0
- package/components/MazPhoneNumberInput.d.ts +5 -0
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/assets/MazInputCode.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/chunks/{MazBtn-CFwe--oV.mjs → MazBtn-BOb7Fg_d.mjs} +2 -2
- package/components/chunks/{MazCheckbox-BmPd9Bqa.mjs → MazCheckbox-CCa7grGF.mjs} +1 -1
- package/components/chunks/{MazIcon-DL8XAldH.mjs → MazIcon-BKuhvwwq.mjs} +1 -1
- package/components/chunks/{MazPhoneNumberInput-1tGT28Sa.mjs → MazPhoneNumberInput-HeEEyDu0.mjs} +452 -439
- package/components/chunks/{MazSpinner-BjIFFTYY.mjs → MazSpinner-2ti3NQjo.mjs} +1 -1
- package/nuxt/index.json +1 -1
- package/package.json +1 -1
- package/types/components/MazPhoneNumberInput/PhoneInput.vue.d.ts +4 -0
- package/types/components/MazPhoneNumberInput.vue.d.ts +5 -0
package/components/chunks/{MazPhoneNumberInput-1tGT28Sa.mjs → MazPhoneNumberInput-HeEEyDu0.mjs}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import '../assets/MazPhoneNumberInput.css';
|
|
2
|
-
import { getCurrentInstance as je, computed as
|
|
3
|
-
import { getCountries as
|
|
4
|
-
function ro(
|
|
2
|
+
import { getCurrentInstance as je, computed as y, defineComponent as ae, defineAsyncComponent as q, ref as P, onMounted as ge, useSlots as We, openBlock as V, createElementBlock as M, normalizeClass as N, normalizeStyle as te, createElementVNode as H, createCommentVNode as b, renderSlot as R, createBlock as D, unref as A, resolveDynamicComponent as Se, withDirectives as Pe, mergeProps as re, toHandlers as Qe, vModelDynamic as Ge, createTextVNode as ve, toDisplayString as X, withModifiers as oe, withCtx as j, createVNode as Z, useCssVars as Je, onBeforeMount as Ze, nextTick as ne, Transition as Xe, Fragment as Ie, renderList as xe, inject as _e, mergeModels as ke, useModel as eo, provide as oo, watch as fe } from "vue";
|
|
3
|
+
import { getCountries as Ae, getCountryCallingCode as ue, isSupportedCountry as to, parsePhoneNumberFromString as lo, AsYouType as no, getExampleNumber as ao } from "libphonenumber-js";
|
|
4
|
+
function ro(a, l) {
|
|
5
5
|
let o;
|
|
6
6
|
return function(...d) {
|
|
7
7
|
clearTimeout(o), o = setTimeout(() => {
|
|
8
|
-
|
|
8
|
+
a.apply(this, d);
|
|
9
9
|
}, l);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
function be({
|
|
13
|
-
componentName:
|
|
13
|
+
componentName: a,
|
|
14
14
|
providedId: l
|
|
15
15
|
}) {
|
|
16
16
|
const o = je();
|
|
17
|
-
return
|
|
17
|
+
return y(() => l ?? `${a}-${o == null ? void 0 : o.uid}`);
|
|
18
18
|
}
|
|
19
19
|
const so = {
|
|
20
20
|
key: 0,
|
|
@@ -59,16 +59,16 @@ const so = {
|
|
|
59
59
|
block: { type: Boolean }
|
|
60
60
|
},
|
|
61
61
|
emits: ["update:model-value", "focus", "blur", "click", "change"],
|
|
62
|
-
setup(
|
|
63
|
-
const o =
|
|
62
|
+
setup(a, { emit: l }) {
|
|
63
|
+
const o = q(() => import("./MazBtn-BOb7Fg_d.mjs")), d = q(() => import("./MazIcon-BKuhvwwq.mjs")), c = q(() => import("./eye-slash-tjfxO0LK.mjs")), p = q(() => import("./eye-DqO_Jx56.mjs")), z = q(() => import("./check-7UA4j2f2.mjs")), t = a, $ = l, F = P(!1), v = P(!1), S = P(), s = be({
|
|
64
64
|
componentName: "MazInput",
|
|
65
65
|
providedId: t.id
|
|
66
66
|
});
|
|
67
67
|
ge(() => {
|
|
68
68
|
var r;
|
|
69
|
-
t.autoFocus && ((r =
|
|
69
|
+
t.autoFocus && ((r = S.value) == null || r.focus());
|
|
70
70
|
});
|
|
71
|
-
const m =
|
|
71
|
+
const m = y(() => t.type === "password"), w = y(() => F.value ? "text" : t.type), I = y(() => {
|
|
72
72
|
if (!t.noBorder) {
|
|
73
73
|
if (t.error)
|
|
74
74
|
return "maz-border-danger";
|
|
@@ -76,7 +76,7 @@ const so = {
|
|
|
76
76
|
return "maz-border-success";
|
|
77
77
|
if (t.warning)
|
|
78
78
|
return "maz-border-warning";
|
|
79
|
-
if (
|
|
79
|
+
if (v.value || t.borderActive) {
|
|
80
80
|
if (t.color === "black")
|
|
81
81
|
return "maz-border-black";
|
|
82
82
|
if (t.color === "danger")
|
|
@@ -96,46 +96,46 @@ const so = {
|
|
|
96
96
|
}
|
|
97
97
|
return "--default-border";
|
|
98
98
|
}
|
|
99
|
-
}),
|
|
99
|
+
}), O = We(), W = y(() => {
|
|
100
100
|
const { required: r, placeholder: E } = t;
|
|
101
101
|
if (E)
|
|
102
102
|
return r ? `${E} *` : E;
|
|
103
|
-
}),
|
|
103
|
+
}), Q = y(() => g.value !== void 0 && g.value !== ""), h = ro(
|
|
104
104
|
(r) => {
|
|
105
|
-
|
|
105
|
+
$("update:model-value", r);
|
|
106
106
|
},
|
|
107
107
|
typeof t.debounce == "number" ? t.debounce : t.debounceDelay ?? 500
|
|
108
|
-
),
|
|
108
|
+
), C = (r) => {
|
|
109
109
|
if (t.debounce)
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
},
|
|
110
|
+
return h(r);
|
|
111
|
+
$("update:model-value", r);
|
|
112
|
+
}, g = y({
|
|
113
113
|
get: () => t.modelValue,
|
|
114
|
-
set: (r) =>
|
|
115
|
-
}), G =
|
|
114
|
+
set: (r) => C(r)
|
|
115
|
+
}), G = y(() => (!!t.label || !!t.hint) && (v.value || !!Q.value || !!t.placeholder || ["date", "month", "week"].includes(t.type))), n = y(() => !!t.label || !!t.hint);
|
|
116
116
|
function B() {
|
|
117
|
-
return !!
|
|
117
|
+
return !!O["right-icon"] || m.value || !!O["valid-button"] || t.validButton || !!t.rightIcon;
|
|
118
118
|
}
|
|
119
119
|
function L() {
|
|
120
|
-
return !!
|
|
120
|
+
return !!O["left-icon"] || !!t.leftIcon;
|
|
121
121
|
}
|
|
122
122
|
function T(r) {
|
|
123
|
-
|
|
123
|
+
$("focus", r), v.value = !0;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
125
|
+
function U(r) {
|
|
126
|
+
$("blur", r), v.value = !1;
|
|
127
127
|
}
|
|
128
128
|
function le(r) {
|
|
129
|
-
return
|
|
129
|
+
return $("change", r);
|
|
130
130
|
}
|
|
131
|
-
return (r, E) => (
|
|
131
|
+
return (r, E) => (V(), M(
|
|
132
132
|
"div",
|
|
133
133
|
{
|
|
134
134
|
class: N(["m-input", [
|
|
135
135
|
{
|
|
136
|
-
"--is-focused":
|
|
136
|
+
"--is-focused": v.value || r.borderActive,
|
|
137
137
|
"--should-up": G.value,
|
|
138
|
-
"--has-label":
|
|
138
|
+
"--has-label": n.value,
|
|
139
139
|
"--is-disabled": r.disabled,
|
|
140
140
|
"--is-readonly": r.readonly,
|
|
141
141
|
"--has-z-2": r.error || r.warning || r.success,
|
|
@@ -149,57 +149,57 @@ const so = {
|
|
|
149
149
|
style: te(r.style)
|
|
150
150
|
},
|
|
151
151
|
[
|
|
152
|
-
|
|
152
|
+
H(
|
|
153
153
|
"div",
|
|
154
154
|
{
|
|
155
155
|
class: N(["m-input-wrapper", [
|
|
156
156
|
r.inputClasses,
|
|
157
|
-
|
|
157
|
+
I.value,
|
|
158
158
|
r.roundedSize ? `--rounded-${r.roundedSize}` : { "maz-rounded": !r.noRadius }
|
|
159
159
|
]])
|
|
160
160
|
},
|
|
161
161
|
[
|
|
162
|
-
L() ? (
|
|
163
|
-
|
|
162
|
+
L() ? (V(), M("div", so, [
|
|
163
|
+
b(`
|
|
164
164
|
@slot left-icon - The icon to display on the left of the input
|
|
165
165
|
`),
|
|
166
166
|
r.$slots["left-icon"] || r.leftIcon ? R(r.$slots, "left-icon", { key: 0 }, () => [
|
|
167
|
-
typeof r.leftIcon == "string" ? (
|
|
167
|
+
typeof r.leftIcon == "string" ? (V(), D(A(d), {
|
|
168
168
|
key: 0,
|
|
169
169
|
name: r.leftIcon,
|
|
170
170
|
class: "maz-text-xl maz-text-muted"
|
|
171
|
-
}, null, 8, ["name"])) : r.leftIcon ? (
|
|
171
|
+
}, null, 8, ["name"])) : r.leftIcon ? (V(), D(Se(r.leftIcon), {
|
|
172
172
|
key: 1,
|
|
173
173
|
class: "maz-text-xl maz-text-muted"
|
|
174
|
-
})) :
|
|
175
|
-
], !0) :
|
|
176
|
-
])) :
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
id:
|
|
174
|
+
})) : b("v-if", !0)
|
|
175
|
+
], !0) : b("v-if", !0)
|
|
176
|
+
])) : b("v-if", !0),
|
|
177
|
+
H("div", uo, [
|
|
178
|
+
Pe(H("input", re({
|
|
179
|
+
id: A(s),
|
|
180
180
|
ref_key: "input",
|
|
181
|
-
ref:
|
|
182
|
-
"onUpdate:modelValue": E[0] || (E[0] = (J) =>
|
|
183
|
-
type:
|
|
181
|
+
ref: S,
|
|
182
|
+
"onUpdate:modelValue": E[0] || (E[0] = (J) => g.value = J),
|
|
183
|
+
type: w.value,
|
|
184
184
|
name: r.name
|
|
185
185
|
}, r.$attrs, {
|
|
186
186
|
inputmode: r.inputmode,
|
|
187
|
-
placeholder:
|
|
187
|
+
placeholder: W.value,
|
|
188
188
|
"aria-label": r.label || r.placeholder,
|
|
189
189
|
disabled: r.disabled,
|
|
190
190
|
readonly: r.readonly,
|
|
191
191
|
required: r.required,
|
|
192
192
|
class: "m-input-input"
|
|
193
193
|
}, Qe({
|
|
194
|
-
blur:
|
|
194
|
+
blur: U,
|
|
195
195
|
focus: T,
|
|
196
196
|
change: le
|
|
197
197
|
}, !0), {
|
|
198
198
|
onClick: E[1] || (E[1] = (J) => r.$emit("click", J))
|
|
199
199
|
}), null, 16, io), [
|
|
200
|
-
[Ge,
|
|
200
|
+
[Ge, g.value]
|
|
201
201
|
]),
|
|
202
|
-
r.label || r.hint ? (
|
|
202
|
+
r.label || r.hint ? (V(), M(
|
|
203
203
|
"span",
|
|
204
204
|
{
|
|
205
205
|
key: 0,
|
|
@@ -218,50 +218,50 @@ const so = {
|
|
|
218
218
|
1
|
|
219
219
|
/* TEXT */
|
|
220
220
|
),
|
|
221
|
-
r.required ? (
|
|
221
|
+
r.required ? (V(), M("sup", co, "*")) : b("v-if", !0)
|
|
222
222
|
],
|
|
223
223
|
2
|
|
224
224
|
/* CLASS */
|
|
225
|
-
)) :
|
|
225
|
+
)) : b("v-if", !0)
|
|
226
226
|
]),
|
|
227
|
-
B() ? (
|
|
228
|
-
|
|
227
|
+
B() ? (V(), M("div", fo, [
|
|
228
|
+
b(`
|
|
229
229
|
@slot right-icon - The icon to display on the right of the input
|
|
230
230
|
`),
|
|
231
231
|
r.$slots["right-icon"] || r.rightIcon ? R(r.$slots, "right-icon", { key: 0 }, () => [
|
|
232
|
-
typeof r.rightIcon == "string" ? (
|
|
232
|
+
typeof r.rightIcon == "string" ? (V(), D(A(d), {
|
|
233
233
|
key: 0,
|
|
234
234
|
name: r.rightIcon,
|
|
235
235
|
class: "maz-text-xl maz-text-muted"
|
|
236
|
-
}, null, 8, ["name"])) : r.rightIcon ? (
|
|
236
|
+
}, null, 8, ["name"])) : r.rightIcon ? (V(), D(Se(r.rightIcon), {
|
|
237
237
|
key: 1,
|
|
238
238
|
class: "maz-text-xl maz-text-muted"
|
|
239
|
-
})) :
|
|
240
|
-
], !0) :
|
|
241
|
-
m.value ? (
|
|
239
|
+
})) : b("v-if", !0)
|
|
240
|
+
], !0) : b("v-if", !0),
|
|
241
|
+
m.value ? (V(), D(A(o), {
|
|
242
242
|
key: 1,
|
|
243
243
|
color: "transparent",
|
|
244
244
|
tabindex: "-1",
|
|
245
245
|
size: "mini",
|
|
246
246
|
onClick: E[2] || (E[2] = oe((J) => F.value = !F.value, ["stop"]))
|
|
247
247
|
}, {
|
|
248
|
-
default:
|
|
249
|
-
F.value ? (
|
|
248
|
+
default: j(() => [
|
|
249
|
+
F.value ? (V(), D(A(c), {
|
|
250
250
|
key: 0,
|
|
251
251
|
class: "maz-text-xl maz-text-muted"
|
|
252
|
-
})) : (
|
|
252
|
+
})) : (V(), D(A(p), {
|
|
253
253
|
key: 1,
|
|
254
254
|
class: "maz-text-xl maz-text-muted"
|
|
255
255
|
}))
|
|
256
256
|
]),
|
|
257
257
|
_: 1
|
|
258
258
|
/* STABLE */
|
|
259
|
-
})) :
|
|
260
|
-
|
|
259
|
+
})) : b("v-if", !0),
|
|
260
|
+
b(`
|
|
261
261
|
@slot valid-button - Replace the valid button by your own
|
|
262
262
|
`),
|
|
263
263
|
r.$slots["valid-button"] || r.validButton ? R(r.$slots, "valid-button", { key: 2 }, () => [
|
|
264
|
-
Z(
|
|
264
|
+
Z(A(o), {
|
|
265
265
|
color: "transparent",
|
|
266
266
|
disabled: r.disabled,
|
|
267
267
|
tabindex: "-1",
|
|
@@ -270,14 +270,14 @@ const so = {
|
|
|
270
270
|
size: "mini",
|
|
271
271
|
type: "submit"
|
|
272
272
|
}, {
|
|
273
|
-
default:
|
|
274
|
-
Z(
|
|
273
|
+
default: j(() => [
|
|
274
|
+
Z(A(z), { class: "maz-text-2xl maz-text-normal" })
|
|
275
275
|
]),
|
|
276
276
|
_: 1
|
|
277
277
|
/* STABLE */
|
|
278
278
|
}, 8, ["disabled", "loading"])
|
|
279
|
-
], !0) :
|
|
280
|
-
])) :
|
|
279
|
+
], !0) : b("v-if", !0)
|
|
280
|
+
])) : b("v-if", !0)
|
|
281
281
|
],
|
|
282
282
|
2
|
|
283
283
|
/* CLASS */
|
|
@@ -287,15 +287,15 @@ const so = {
|
|
|
287
287
|
/* CLASS, STYLE */
|
|
288
288
|
));
|
|
289
289
|
}
|
|
290
|
-
}),
|
|
291
|
-
const o =
|
|
290
|
+
}), se = (a, l) => {
|
|
291
|
+
const o = a.__vccOpts || a;
|
|
292
292
|
for (const [d, c] of l)
|
|
293
293
|
o[d] = c;
|
|
294
294
|
return o;
|
|
295
|
-
}, he = /* @__PURE__ */
|
|
295
|
+
}, he = /* @__PURE__ */ se(po, [["__scopeId", "data-v-84073434"]]);
|
|
296
296
|
let pe = null;
|
|
297
|
-
function mo(
|
|
298
|
-
pe && clearTimeout(pe), pe = setTimeout(
|
|
297
|
+
function mo(a, l) {
|
|
298
|
+
pe && clearTimeout(pe), pe = setTimeout(a, l);
|
|
299
299
|
}
|
|
300
300
|
const yo = {
|
|
301
301
|
removeAccents: !0,
|
|
@@ -307,7 +307,7 @@ const yo = {
|
|
|
307
307
|
removeNumbers: !1,
|
|
308
308
|
customNormalizationForms: ["NFC", "NFKD"]
|
|
309
309
|
};
|
|
310
|
-
function
|
|
310
|
+
function ie(a, l) {
|
|
311
311
|
const o = { ...yo, ...l }, d = {
|
|
312
312
|
À: "A",
|
|
313
313
|
Á: "A",
|
|
@@ -357,77 +357,77 @@ function ue(n, l) {
|
|
|
357
357
|
ñ: "n",
|
|
358
358
|
ó: "o"
|
|
359
359
|
};
|
|
360
|
-
let c =
|
|
360
|
+
let c = a.toString();
|
|
361
361
|
if (o.trim && (c = c.trim()), o.normalizeSpaces && (c = c.replaceAll(/\s+/g, " ")), o.replaceSpaces && (c = c.replaceAll(" ", "-")), o.removeNumbers && (c = c.replaceAll(/\d/g, "")), o.removeAccents && (c = c.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g, (p) => d[p] || p), c = c.replaceAll(/[\u0300-\u036F]/g, "")), o.caseSensitive === !1 && (c = c.toLowerCase()), o.removeSpecialCharacters && (c = c.replaceAll(/[^\dA-Za-z-]/g, "")), o.trim && (c = c.trim()), o.customNormalizationForms)
|
|
362
362
|
for (const p of o.customNormalizationForms)
|
|
363
363
|
c = c.normalize(p);
|
|
364
364
|
return c;
|
|
365
365
|
}
|
|
366
|
-
function vo(
|
|
367
|
-
const o =
|
|
366
|
+
function vo(a, l) {
|
|
367
|
+
const o = a.length, d = l.length, c = [];
|
|
368
368
|
for (let p = 0; p <= o; p++)
|
|
369
369
|
c[p] = [p];
|
|
370
370
|
for (let p = 0; p <= d; p++)
|
|
371
371
|
c[0][p] = p;
|
|
372
372
|
for (let p = 1; p <= o; p++)
|
|
373
|
-
for (let
|
|
374
|
-
const t =
|
|
375
|
-
c[p][
|
|
376
|
-
c[p - 1][
|
|
377
|
-
c[p][
|
|
378
|
-
c[p - 1][
|
|
373
|
+
for (let z = 1; z <= d; z++) {
|
|
374
|
+
const t = a[p - 1] === l[z - 1] ? 0 : 1;
|
|
375
|
+
c[p][z] = Math.min(
|
|
376
|
+
c[p - 1][z] + 1,
|
|
377
|
+
c[p][z - 1] + 1,
|
|
378
|
+
c[p - 1][z - 1] + t
|
|
379
379
|
);
|
|
380
380
|
}
|
|
381
381
|
return c[o][d];
|
|
382
382
|
}
|
|
383
|
-
function Fe(
|
|
384
|
-
const o = vo(
|
|
383
|
+
function Fe(a, l) {
|
|
384
|
+
const o = vo(a, l), d = Math.max(a.length, l.length);
|
|
385
385
|
return 1 - o / d;
|
|
386
386
|
}
|
|
387
|
-
function ho(
|
|
388
|
-
return Fe(
|
|
387
|
+
function ho(a, l, o = 0.75) {
|
|
388
|
+
return Fe(a, l) >= o;
|
|
389
389
|
}
|
|
390
|
-
function me(
|
|
391
|
-
const d =
|
|
392
|
-
() =>
|
|
393
|
-
), c =
|
|
394
|
-
() =>
|
|
395
|
-
), p =
|
|
390
|
+
function me(a, l, o = 0.75) {
|
|
391
|
+
const d = y(
|
|
392
|
+
() => ie(typeof a == "string" ? a : a.value)
|
|
393
|
+
), c = y(
|
|
394
|
+
() => ie(typeof l == "string" ? l : l.value)
|
|
395
|
+
), p = y(() => typeof o == "number" ? o : o.value), z = y(() => Fe(d.value, c.value));
|
|
396
396
|
return {
|
|
397
|
-
isMatching:
|
|
397
|
+
isMatching: y(
|
|
398
398
|
() => ho(d.value, c.value, p.value)
|
|
399
399
|
),
|
|
400
|
-
score:
|
|
400
|
+
score: z
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
const Ee = (
|
|
404
|
-
var
|
|
405
|
-
|
|
403
|
+
const Ee = (a, l, o) => {
|
|
404
|
+
var z;
|
|
405
|
+
a.stopPropagation();
|
|
406
406
|
const d = typeof o.value == "function" ? o.value : o.value.handler, c = typeof o.value == "object" ? o.value.exclude : void 0;
|
|
407
407
|
let p = !1;
|
|
408
408
|
if (c && c.length > 0) {
|
|
409
409
|
for (const t of c)
|
|
410
|
-
if (!p &&
|
|
411
|
-
const
|
|
412
|
-
p =
|
|
410
|
+
if (!p && a.target instanceof HTMLElement) {
|
|
411
|
+
const $ = (z = document.querySelector(t)) == null ? void 0 : z.getAttribute("id");
|
|
412
|
+
p = a.target.getAttribute("id") === $;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
!l.contains(
|
|
415
|
+
!l.contains(a.target) && !p && (d == null || d());
|
|
416
416
|
};
|
|
417
417
|
function Le() {
|
|
418
418
|
return document.ontouchstart === null ? "touchstart" : "click";
|
|
419
419
|
}
|
|
420
|
-
function go(
|
|
420
|
+
function go(a, l) {
|
|
421
421
|
const o = Le();
|
|
422
|
-
document.removeEventListener(o, (d) => Ee(d,
|
|
422
|
+
document.removeEventListener(o, (d) => Ee(d, a, l));
|
|
423
423
|
}
|
|
424
|
-
function bo(
|
|
424
|
+
function bo(a, l) {
|
|
425
425
|
if (typeof l.value != "function" && typeof l.value == "object" && typeof l.value.handler != "function") {
|
|
426
426
|
console.error("[maz-ui](vClosable) v-closable directive requires a handler function");
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
429
|
const o = Le();
|
|
430
|
-
document.addEventListener(o, (d) => Ee(d,
|
|
430
|
+
document.addEventListener(o, (d) => Ee(d, a, l));
|
|
431
431
|
}
|
|
432
432
|
const zo = {
|
|
433
433
|
mounted: bo,
|
|
@@ -464,39 +464,39 @@ const zo = {
|
|
|
464
464
|
excludeSelectors: { default: void 0 }
|
|
465
465
|
},
|
|
466
466
|
emits: ["close", "open", "blur", "focus", "change", "update:model-value", "selected-option"],
|
|
467
|
-
setup(
|
|
467
|
+
setup(a, { expose: l, emit: o }) {
|
|
468
468
|
Je((e) => ({
|
|
469
|
-
"416802e0":
|
|
469
|
+
"416802e0": w.value,
|
|
470
470
|
"21823f4f": s.value,
|
|
471
471
|
"6d76cd12": m.value
|
|
472
472
|
}));
|
|
473
|
-
const d =
|
|
473
|
+
const d = q(() => import("./MazCheckbox-CCa7grGF.mjs")), c = q(() => import("./magnifying-glass-DZGg7953.mjs")), p = q(() => import("./chevron-down-CzMH-gFW.mjs")), z = q(() => import("./no-symbol-QAqP9IlR.mjs"));
|
|
474
474
|
l({
|
|
475
475
|
/** Method to open the option list */
|
|
476
476
|
openList: _,
|
|
477
477
|
/** Method to close the option list */
|
|
478
478
|
closeList: x
|
|
479
479
|
});
|
|
480
|
-
const t =
|
|
480
|
+
const t = a, $ = o, F = P(!1), v = P(), S = y(
|
|
481
481
|
() => ["black", "transparent", "white"].includes(t.color)
|
|
482
|
-
), s =
|
|
483
|
-
() =>
|
|
484
|
-
), m =
|
|
485
|
-
() =>
|
|
486
|
-
),
|
|
487
|
-
() =>
|
|
488
|
-
),
|
|
482
|
+
), s = y(
|
|
483
|
+
() => S.value ? "var(--maz-color-black)" : `var(--maz-color-${t.color}-800)`
|
|
484
|
+
), m = y(
|
|
485
|
+
() => S.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-100)`
|
|
486
|
+
), w = y(
|
|
487
|
+
() => S.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-200)`
|
|
488
|
+
), I = y(() => F.value || t.open), O = be({
|
|
489
489
|
componentName: "MazSelect",
|
|
490
490
|
providedId: t.id
|
|
491
491
|
});
|
|
492
|
-
function
|
|
492
|
+
function W(e) {
|
|
493
493
|
return {
|
|
494
494
|
[t.optionValueKey]: e,
|
|
495
495
|
[t.optionLabelKey]: e,
|
|
496
496
|
[t.optionInputValueKey]: e
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function Q(e) {
|
|
500
500
|
return {
|
|
501
501
|
...e,
|
|
502
502
|
[t.optionValueKey]: e[t.optionValueKey],
|
|
@@ -504,73 +504,73 @@ const zo = {
|
|
|
504
504
|
[t.optionInputValueKey]: e[t.optionInputValueKey]
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
const
|
|
507
|
+
const h = y(() => {
|
|
508
508
|
var u;
|
|
509
509
|
const e = [];
|
|
510
510
|
if (!((u = t.options) != null && u.length))
|
|
511
511
|
return [];
|
|
512
512
|
for (const f of t.options)
|
|
513
|
-
typeof f == "string" || typeof f == "number" || typeof f == "boolean" ? e.push(
|
|
513
|
+
typeof f == "string" || typeof f == "number" || typeof f == "boolean" ? e.push(W(f)) : typeof f == "object" && "options" in f && Array.isArray(f.options) ? e.push(
|
|
514
514
|
{ label: f.label, isOptGroup: !0 },
|
|
515
515
|
...f.options.map(
|
|
516
|
-
(i) => typeof i == "string" || typeof i == "number" || typeof i == "boolean" ?
|
|
516
|
+
(i) => typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? W(i) : Q(i)
|
|
517
517
|
)
|
|
518
|
-
) : e.push(
|
|
518
|
+
) : e.push(Q(f));
|
|
519
519
|
return e;
|
|
520
|
-
}),
|
|
520
|
+
}), C = y(
|
|
521
521
|
() => {
|
|
522
522
|
var e;
|
|
523
|
-
return ((e =
|
|
523
|
+
return ((e = h.value) == null ? void 0 : e.filter((u) => t.multiple ? Array.isArray(t.modelValue) ? t.modelValue.includes(u[t.optionValueKey]) && !L(u[t.optionValueKey]) : !1 : t.modelValue === u[t.optionValueKey] && !L(u[t.optionValueKey]))) ?? [];
|
|
524
524
|
}
|
|
525
525
|
);
|
|
526
526
|
Ze(() => {
|
|
527
527
|
var e;
|
|
528
528
|
(e = t.options) != null && e.length || console.warn("[maz-ui](MazSelect) you must provide options"), ce();
|
|
529
529
|
});
|
|
530
|
-
const
|
|
530
|
+
const g = P(), G = P(), n = P(), B = P(), L = (e) => e == null;
|
|
531
531
|
function T(e) {
|
|
532
532
|
var f;
|
|
533
|
-
return (((f =
|
|
533
|
+
return (((f = C.value) == null ? void 0 : f.some(
|
|
534
534
|
(i) => i[t.optionValueKey] === e[t.optionValueKey]
|
|
535
535
|
)) ?? !1) && !L(e[t.optionValueKey]);
|
|
536
536
|
}
|
|
537
|
-
const
|
|
537
|
+
const U = y(() => {
|
|
538
538
|
var u;
|
|
539
539
|
if (t.multiple && t.modelValue && Array.isArray(t.modelValue))
|
|
540
540
|
return t.modelValue.map(
|
|
541
541
|
(f) => {
|
|
542
|
-
var i,
|
|
543
|
-
return (
|
|
542
|
+
var i, k;
|
|
543
|
+
return (k = (i = h.value) == null ? void 0 : i.find((K) => K[t.optionValueKey] === f)) == null ? void 0 : k[t.optionInputValueKey];
|
|
544
544
|
}
|
|
545
545
|
).join(", ");
|
|
546
|
-
const e = (u =
|
|
546
|
+
const e = (u = h.value) == null ? void 0 : u.find(
|
|
547
547
|
(f) => f[t.optionValueKey] === t.modelValue
|
|
548
548
|
);
|
|
549
549
|
return L(t.modelValue) || e == null ? void 0 : e[t.optionInputValueKey];
|
|
550
|
-
}), le =
|
|
550
|
+
}), le = y(
|
|
551
551
|
() => t.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
552
|
-
), r =
|
|
552
|
+
), r = P(""), E = P(""), J = (e, u) => u && e && ie(e).includes(ie(u));
|
|
553
553
|
function ze(e) {
|
|
554
554
|
var u;
|
|
555
|
-
return e ? (u =
|
|
556
|
-
const i = f[t.optionLabelKey],
|
|
557
|
-
return J(i, e) || J(K, e) || J(
|
|
558
|
-
}) :
|
|
555
|
+
return e ? (u = h.value) == null ? void 0 : u.filter((f) => {
|
|
556
|
+
const i = f[t.optionLabelKey], k = f[t.optionValueKey], K = f[t.optionInputValueKey];
|
|
557
|
+
return J(i, e) || J(K, e) || J(k, e) || typeof i == "string" && me(i, e, 0.5).isMatching.value || typeof K == "string" && me(K, e, 0.5).isMatching.value || typeof k == "string" && me(k, e, 0.5).isMatching.value;
|
|
558
|
+
}) : h.value;
|
|
559
559
|
}
|
|
560
|
-
const
|
|
560
|
+
const Y = y(() => ze(r.value));
|
|
561
561
|
async function x(e) {
|
|
562
562
|
var f, i;
|
|
563
|
-
if (!
|
|
563
|
+
if (!I.value)
|
|
564
564
|
return;
|
|
565
|
-
if (e && ("relatedTarget" in e && ((f =
|
|
565
|
+
if (e && ("relatedTarget" in e && ((f = g.value) != null && f.contains(e.relatedTarget)) || e.type === "keydown"))
|
|
566
566
|
return e.preventDefault();
|
|
567
567
|
const u = e && "relatedTarget" in e && e.relatedTarget instanceof HTMLElement && e.relatedTarget.getAttribute("id");
|
|
568
568
|
if ((i = t.excludeSelectors) != null && i.includes(`#${u}`))
|
|
569
569
|
return e == null ? void 0 : e.preventDefault();
|
|
570
|
-
await ne(), F.value = !1,
|
|
570
|
+
await ne(), F.value = !1, v.value = 0, $("close", e);
|
|
571
571
|
}
|
|
572
572
|
async function _(e) {
|
|
573
|
-
t.disabled ||
|
|
573
|
+
t.disabled || I.value || (e == null || e.preventDefault(), F.value = !0, await de(), $("focus", e), $("open", F.value));
|
|
574
574
|
}
|
|
575
575
|
function Ce() {
|
|
576
576
|
var e, u;
|
|
@@ -581,15 +581,15 @@ const zo = {
|
|
|
581
581
|
}
|
|
582
582
|
function Oe(e) {
|
|
583
583
|
var u, f;
|
|
584
|
-
r.value = e, (f = ((u =
|
|
584
|
+
r.value = e, (f = ((u = n.value) == null ? void 0 : u.$el).querySelector("input")) == null || f.focus();
|
|
585
585
|
}
|
|
586
586
|
function Ue(e) {
|
|
587
587
|
var f;
|
|
588
588
|
e === "Backspace" && E.value.length > 0 ? E.value = E.value.slice(0, -1) : E.value += e;
|
|
589
589
|
const u = ze(E.value);
|
|
590
|
-
u != null && u.length && (
|
|
590
|
+
u != null && u.length && (v.value = (f = Y.value) == null ? void 0 : f.findIndex(
|
|
591
591
|
(i) => i[t.optionValueKey] === u[0][t.optionValueKey]
|
|
592
|
-
), typeof
|
|
592
|
+
), typeof v.value == "number" && v.value >= 0 && de(v.value)), mo(() => {
|
|
593
593
|
E.value = "";
|
|
594
594
|
}, 1e3);
|
|
595
595
|
}
|
|
@@ -597,26 +597,26 @@ const zo = {
|
|
|
597
597
|
const u = e.key;
|
|
598
598
|
/^[\dA-Za-z\u0400-\u04FF]$/.test(u) ? (e.preventDefault(), _(e), t.search ? Oe(u) : Ue(u)) : Ve(e);
|
|
599
599
|
}, Ve = (e) => {
|
|
600
|
-
const u = e.code, f = ["ArrowUp", "ArrowDown"].includes(u), i = ["Enter", "Space"].includes(u),
|
|
601
|
-
f ? qe(e,
|
|
600
|
+
const u = e.code, f = ["ArrowUp", "ArrowDown"].includes(u), i = ["Enter", "Space"].includes(u), k = u === "Escape" && I.value;
|
|
601
|
+
f ? qe(e, v.value) : i ? He(e, v.value) : k && x(e);
|
|
602
602
|
}, qe = (e, u) => {
|
|
603
|
-
var
|
|
603
|
+
var k;
|
|
604
604
|
e.preventDefault();
|
|
605
605
|
const f = e.code;
|
|
606
|
-
|
|
607
|
-
const i = (
|
|
608
|
-
i && (typeof u == "number" ? u === i - 1 && f === "ArrowDown" ?
|
|
606
|
+
I.value || _(e);
|
|
607
|
+
const i = (k = Y.value) == null ? void 0 : k.length;
|
|
608
|
+
i && (typeof u == "number" ? u === i - 1 && f === "ArrowDown" ? v.value = 0 : u === 0 && f === "ArrowUp" ? v.value = i - 1 : v.value = f === "ArrowDown" ? u + 1 : u - 1 : v.value = f === "ArrowDown" ? 0 : i - 1, de(v.value));
|
|
609
609
|
}, He = (e, u) => {
|
|
610
|
-
var i,
|
|
611
|
-
if (e.preventDefault(), !
|
|
610
|
+
var i, k, K;
|
|
611
|
+
if (e.preventDefault(), !I.value)
|
|
612
612
|
return _(e);
|
|
613
|
-
const f = u ? ((i =
|
|
613
|
+
const f = u ? ((i = Y.value) == null ? void 0 : i[u]) ?? ((k = Y.value) == null ? void 0 : k[0]) : (K = Y.value) == null ? void 0 : K[0];
|
|
614
614
|
L(f) || we(f);
|
|
615
615
|
};
|
|
616
616
|
async function de(e) {
|
|
617
617
|
var f, i;
|
|
618
618
|
await ne(), typeof e != "number" && ce();
|
|
619
|
-
const u = e ??
|
|
619
|
+
const u = e ?? v.value;
|
|
620
620
|
typeof u == "number" && u >= 0 && ((i = (f = B.value) == null ? void 0 : f.querySelectorAll(".m-select-list-item")[u]) == null || i.scrollIntoView({
|
|
621
621
|
behavior: "auto",
|
|
622
622
|
block: "nearest",
|
|
@@ -625,42 +625,42 @@ const zo = {
|
|
|
625
625
|
}
|
|
626
626
|
function ce(e) {
|
|
627
627
|
var f;
|
|
628
|
-
const u = (f =
|
|
629
|
-
var
|
|
630
|
-
return t.multiple && Array.isArray(t.modelValue) ? e ? e[t.optionValueKey] === i[t.optionValueKey] : [...t.modelValue].reverse()[0] === i[t.optionValueKey] : ((K = (
|
|
628
|
+
const u = (f = Y.value) == null ? void 0 : f.findIndex((i) => {
|
|
629
|
+
var k, K;
|
|
630
|
+
return t.multiple && Array.isArray(t.modelValue) ? e ? e[t.optionValueKey] === i[t.optionValueKey] : [...t.modelValue].reverse()[0] === i[t.optionValueKey] : ((K = (k = C.value) == null ? void 0 : k[0]) == null ? void 0 : K[t.optionValueKey]) === i[t.optionValueKey];
|
|
631
631
|
});
|
|
632
|
-
|
|
632
|
+
v.value = u && u >= 0 ? u : 0;
|
|
633
633
|
}
|
|
634
634
|
function we(e, u = !0) {
|
|
635
635
|
var K;
|
|
636
636
|
u && !t.multiple && ne(() => x()), r.value = "";
|
|
637
|
-
const f = (K =
|
|
637
|
+
const f = (K = C.value) == null ? void 0 : K.some(
|
|
638
638
|
(ee) => ee[t.optionValueKey] === e[t.optionValueKey]
|
|
639
639
|
);
|
|
640
|
-
let i =
|
|
640
|
+
let i = C.value;
|
|
641
641
|
f && t.multiple ? i = i == null ? void 0 : i.filter(
|
|
642
642
|
(ee) => ee[t.optionValueKey] !== e[t.optionValueKey]
|
|
643
643
|
) : t.multiple ? i.push(e) : i = [e];
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const k = i.map((ee) => ee[t.optionValueKey]);
|
|
645
|
+
$("update:model-value", t.multiple ? k : k[0]), $("selected-option", e), ce(e), Ce();
|
|
646
646
|
}
|
|
647
647
|
return (e, u) => {
|
|
648
648
|
var f;
|
|
649
|
-
return
|
|
649
|
+
return Pe((V(), M(
|
|
650
650
|
"div",
|
|
651
651
|
{
|
|
652
652
|
ref_key: "mazSelectElement",
|
|
653
|
-
ref:
|
|
653
|
+
ref: g,
|
|
654
654
|
class: N(["m-select", [
|
|
655
|
-
{ "--is-open":
|
|
655
|
+
{ "--is-open": I.value, "--disabled": e.disabled, "--block": e.block },
|
|
656
656
|
t.class,
|
|
657
657
|
`--${e.size}`
|
|
658
658
|
]]),
|
|
659
659
|
style: te(e.style)
|
|
660
660
|
},
|
|
661
661
|
[
|
|
662
|
-
Z(he,
|
|
663
|
-
id:
|
|
662
|
+
Z(he, re({
|
|
663
|
+
id: A(O),
|
|
664
664
|
ref_key: "mazInputComponent",
|
|
665
665
|
ref: G,
|
|
666
666
|
class: "m-select-input"
|
|
@@ -668,7 +668,7 @@ const zo = {
|
|
|
668
668
|
required: e.required,
|
|
669
669
|
"border-active": F.value,
|
|
670
670
|
color: e.color,
|
|
671
|
-
"model-value":
|
|
671
|
+
"model-value": U.value,
|
|
672
672
|
autocomplete: "off",
|
|
673
673
|
size: e.size,
|
|
674
674
|
block: "",
|
|
@@ -676,26 +676,26 @@ const zo = {
|
|
|
676
676
|
onFocus: oe(_, ["prevent", "stop"]),
|
|
677
677
|
onBlur: oe(x, ["prevent", "stop"]),
|
|
678
678
|
onClick: oe(_, ["prevent", "stop"]),
|
|
679
|
-
onChange: u[0] || (u[0] = (i) =>
|
|
679
|
+
onChange: u[0] || (u[0] = (i) => $("change", i)),
|
|
680
680
|
onKeydown: Ye
|
|
681
681
|
}), {
|
|
682
|
-
"right-icon":
|
|
683
|
-
|
|
682
|
+
"right-icon": j(() => [
|
|
683
|
+
H("button", {
|
|
684
684
|
tabindex: "-1",
|
|
685
685
|
type: "button",
|
|
686
686
|
class: "m-select-input__toggle-button maz-custom",
|
|
687
|
-
"aria-label": `${
|
|
687
|
+
"aria-label": `${I.value ? "collapse" : "expand"} list of options`,
|
|
688
688
|
onClick: oe(De, ["stop"])
|
|
689
689
|
}, [
|
|
690
|
-
Z(
|
|
690
|
+
Z(A(p), { class: "m-select-chevron maz-text-xl" })
|
|
691
691
|
], 8, Co)
|
|
692
692
|
]),
|
|
693
693
|
_: 1
|
|
694
694
|
/* STABLE */
|
|
695
695
|
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "disabled"]),
|
|
696
696
|
Z(Xe, { name: le.value }, {
|
|
697
|
-
default:
|
|
698
|
-
|
|
697
|
+
default: j(() => [
|
|
698
|
+
I.value ? (V(), M(
|
|
699
699
|
"div",
|
|
700
700
|
{
|
|
701
701
|
key: 0,
|
|
@@ -713,14 +713,14 @@ const zo = {
|
|
|
713
713
|
})
|
|
714
714
|
},
|
|
715
715
|
[
|
|
716
|
-
e.search ? (
|
|
716
|
+
e.search ? (V(), D(he, {
|
|
717
717
|
key: 0,
|
|
718
718
|
ref_key: "searchInputComponent",
|
|
719
|
-
ref:
|
|
719
|
+
ref: n,
|
|
720
720
|
modelValue: r.value,
|
|
721
721
|
"onUpdate:modelValue": [
|
|
722
722
|
u[1] || (u[1] = (i) => r.value = i),
|
|
723
|
-
u[2] || (u[2] = (i) =>
|
|
723
|
+
u[2] || (u[2] = (i) => v.value = 0)
|
|
724
724
|
],
|
|
725
725
|
size: "sm",
|
|
726
726
|
color: e.color,
|
|
@@ -729,25 +729,25 @@ const zo = {
|
|
|
729
729
|
autocomplete: "off",
|
|
730
730
|
tabindex: "-1",
|
|
731
731
|
class: "m-select-list__search-input maz-flex-none",
|
|
732
|
-
"left-icon":
|
|
732
|
+
"left-icon": A(c),
|
|
733
733
|
onKeydown: Ve
|
|
734
|
-
}, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) :
|
|
735
|
-
|
|
734
|
+
}, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) : b("v-if", !0),
|
|
735
|
+
b(`
|
|
736
736
|
@slot No results slot - Displayed when no results corresponding with search query
|
|
737
737
|
`),
|
|
738
|
-
!
|
|
739
|
-
|
|
740
|
-
Z(
|
|
738
|
+
!Y.value || Y.value.length <= 0 ? R(e.$slots, "no-results", { key: 1 }, () => [
|
|
739
|
+
H("span", Vo, [
|
|
740
|
+
Z(A(z), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
741
741
|
])
|
|
742
|
-
], !0) : (
|
|
743
|
-
(
|
|
742
|
+
], !0) : (V(), M("div", wo, [
|
|
743
|
+
(V(!0), M(
|
|
744
744
|
Ie,
|
|
745
745
|
null,
|
|
746
|
-
xe(
|
|
746
|
+
xe(Y.value, (i, k) => (V(), M(
|
|
747
747
|
Ie,
|
|
748
|
-
{ key:
|
|
748
|
+
{ key: k },
|
|
749
749
|
[
|
|
750
|
-
|
|
750
|
+
b(`
|
|
751
751
|
@slot Custom optgroup label
|
|
752
752
|
@binding {String} label - the label of the optgroup
|
|
753
753
|
`),
|
|
@@ -755,20 +755,20 @@ const zo = {
|
|
|
755
755
|
key: 0,
|
|
756
756
|
label: i.label
|
|
757
757
|
}, () => [
|
|
758
|
-
|
|
758
|
+
H(
|
|
759
759
|
"span",
|
|
760
760
|
So,
|
|
761
761
|
X(i.label),
|
|
762
762
|
1
|
|
763
763
|
/* TEXT */
|
|
764
764
|
)
|
|
765
|
-
], !0) : (
|
|
765
|
+
], !0) : (V(), M("button", {
|
|
766
766
|
key: 1,
|
|
767
767
|
tabindex: "-1",
|
|
768
768
|
type: "button",
|
|
769
769
|
class: N(["m-select-list-item maz-custom maz-flex-none", [
|
|
770
770
|
{
|
|
771
|
-
"--is-keyboard-selected":
|
|
771
|
+
"--is-keyboard-selected": v.value === k,
|
|
772
772
|
"--is-selected": T(i),
|
|
773
773
|
"--is-none-value": L(i[e.optionValueKey])
|
|
774
774
|
}
|
|
@@ -776,14 +776,14 @@ const zo = {
|
|
|
776
776
|
style: te(e.itemHeight ? { height: `${e.itemHeight}px` } : void 0),
|
|
777
777
|
onClick: oe((K) => we(i), ["prevent", "stop"])
|
|
778
778
|
}, [
|
|
779
|
-
e.multiple ? (
|
|
779
|
+
e.multiple ? (V(), D(A(d), {
|
|
780
780
|
key: 0,
|
|
781
781
|
tabindex: "-1",
|
|
782
782
|
"model-value": T(i),
|
|
783
783
|
size: "sm",
|
|
784
784
|
color: e.color
|
|
785
|
-
}, null, 8, ["model-value", "color"])) :
|
|
786
|
-
|
|
785
|
+
}, null, 8, ["model-value", "color"])) : b("v-if", !0),
|
|
786
|
+
b(`
|
|
787
787
|
@slot Custom option
|
|
788
788
|
@binding {Object} option - the option object
|
|
789
789
|
@binding {Boolean} is-selected - if the option is selected
|
|
@@ -792,7 +792,7 @@ const zo = {
|
|
|
792
792
|
option: i,
|
|
793
793
|
isSelected: T(i)
|
|
794
794
|
}, () => [
|
|
795
|
-
|
|
795
|
+
H(
|
|
796
796
|
"span",
|
|
797
797
|
null,
|
|
798
798
|
X(i[e.optionLabelKey]),
|
|
@@ -812,7 +812,7 @@ const zo = {
|
|
|
812
812
|
],
|
|
813
813
|
6
|
|
814
814
|
/* CLASS, STYLE */
|
|
815
|
-
)) :
|
|
815
|
+
)) : b("v-if", !0)
|
|
816
816
|
]),
|
|
817
817
|
_: 3
|
|
818
818
|
/* FORWARDED */
|
|
@@ -821,19 +821,19 @@ const zo = {
|
|
|
821
821
|
6
|
|
822
822
|
/* CLASS, STYLE */
|
|
823
823
|
)), [
|
|
824
|
-
[
|
|
824
|
+
[A(zo), {
|
|
825
825
|
exclude: (f = e.excludeSelectors) != null && f.length ? e.excludeSelectors : [],
|
|
826
826
|
handler: x
|
|
827
827
|
}]
|
|
828
828
|
]);
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
|
-
}), $o = /* @__PURE__ */
|
|
832
|
-
function Me(
|
|
833
|
-
return !!
|
|
831
|
+
}), $o = /* @__PURE__ */ se(ko, [["__scopeId", "data-v-05b98a1b"]]);
|
|
832
|
+
function Me(a) {
|
|
833
|
+
return !!a;
|
|
834
834
|
}
|
|
835
|
-
function $e(
|
|
836
|
-
return [...
|
|
835
|
+
function $e(a) {
|
|
836
|
+
return [...a].map((l) => {
|
|
837
837
|
const o = l.codePointAt(0);
|
|
838
838
|
return o ? o % 32 + 127461 : void 0;
|
|
839
839
|
}).filter(Me).map((l) => String.fromCodePoint(l)).join("");
|
|
@@ -841,32 +841,32 @@ function $e(n) {
|
|
|
841
841
|
function Te() {
|
|
842
842
|
if (typeof window > "u")
|
|
843
843
|
return;
|
|
844
|
-
const
|
|
845
|
-
if (!
|
|
844
|
+
const a = window.navigator.language;
|
|
845
|
+
if (!a)
|
|
846
846
|
return;
|
|
847
|
-
let l =
|
|
848
|
-
return l === "" && (l =
|
|
847
|
+
let l = a.slice(3, 7).toUpperCase();
|
|
848
|
+
return l === "" && (l = a.slice(0, 2).toUpperCase()), l === "EN" && (l = "US"), l === "JA" && (l = "JP"), {
|
|
849
849
|
locale: l,
|
|
850
|
-
browserLocale:
|
|
850
|
+
browserLocale: a
|
|
851
851
|
};
|
|
852
852
|
}
|
|
853
853
|
let ye, Be;
|
|
854
|
-
function Bo(
|
|
855
|
-
return o != null && o[l] ? o[l] : ((Be !==
|
|
854
|
+
function Bo(a, l, o) {
|
|
855
|
+
return o != null && o[l] ? o[l] : ((Be !== a || !ye) && (Be = a, ye = new Intl.DisplayNames([a], { type: "region" })), ye.of(l));
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Po(a, l) {
|
|
858
858
|
var c;
|
|
859
|
-
const o = [], d =
|
|
860
|
-
|
|
859
|
+
const o = [], d = Ae();
|
|
860
|
+
a = a ?? ((c = Te()) == null ? void 0 : c.browserLocale) ?? "en-US";
|
|
861
861
|
for (const p of d) {
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
862
|
+
const z = Bo(a, p, l);
|
|
863
|
+
if (z)
|
|
864
864
|
try {
|
|
865
|
-
const t =
|
|
865
|
+
const t = ue(p);
|
|
866
866
|
o.push({
|
|
867
867
|
iso2: p,
|
|
868
868
|
dialCode: t,
|
|
869
|
-
name:
|
|
869
|
+
name: z
|
|
870
870
|
});
|
|
871
871
|
} catch (t) {
|
|
872
872
|
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${t}`);
|
|
@@ -874,32 +874,32 @@ function Ao(n, l) {
|
|
|
874
874
|
}
|
|
875
875
|
return o;
|
|
876
876
|
}
|
|
877
|
-
async function
|
|
877
|
+
async function Ao() {
|
|
878
878
|
try {
|
|
879
|
-
const
|
|
879
|
+
const a = await fetch("https://ipwho.is"), { country_code: l } = await a.json();
|
|
880
880
|
return l;
|
|
881
|
-
} catch (
|
|
882
|
-
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${
|
|
881
|
+
} catch (a) {
|
|
882
|
+
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${a}`);
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function Fo(
|
|
886
|
-
if (!
|
|
885
|
+
function Fo(a) {
|
|
886
|
+
if (!a)
|
|
887
887
|
return "";
|
|
888
888
|
const l = new RegExp(/[^\d ()+-]/g);
|
|
889
|
-
return
|
|
889
|
+
return a.replaceAll(l, "").trim();
|
|
890
890
|
}
|
|
891
891
|
function Ke() {
|
|
892
892
|
return {
|
|
893
893
|
sanitizePhoneNumber: Fo,
|
|
894
|
-
fetchCountryCode:
|
|
894
|
+
fetchCountryCode: Ao,
|
|
895
895
|
getBrowserLocale: Te,
|
|
896
|
-
getCountriesList:
|
|
896
|
+
getCountriesList: Po
|
|
897
897
|
};
|
|
898
898
|
}
|
|
899
|
-
function Ne(
|
|
900
|
-
const o = _e(
|
|
899
|
+
function Ne(a, l) {
|
|
900
|
+
const o = _e(a, l);
|
|
901
901
|
if (!o)
|
|
902
|
-
throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${
|
|
902
|
+
throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${a}`);
|
|
903
903
|
return o;
|
|
904
904
|
}
|
|
905
905
|
const Eo = ["id"], Lo = {
|
|
@@ -932,34 +932,34 @@ const Eo = ["id"], Lo = {
|
|
|
932
932
|
excludeSelectors: { default: void 0 }
|
|
933
933
|
},
|
|
934
934
|
emits: ["update:model-value"],
|
|
935
|
-
setup(
|
|
936
|
-
const l =
|
|
935
|
+
setup(a) {
|
|
936
|
+
const l = a, { phoneNumber: o } = Ne("data"), d = P(), { getCountriesList: c } = Ke(), p = y(() => c(l.countryLocale, l.customCountriesList)), z = y(
|
|
937
937
|
() => {
|
|
938
938
|
var s;
|
|
939
939
|
return (s = p.value) == null ? void 0 : s.filter((m) => {
|
|
940
|
-
var
|
|
941
|
-
return !((
|
|
940
|
+
var w;
|
|
941
|
+
return !((w = l.ignoredCountries) != null && w.includes(m.iso2));
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
|
-
), t =
|
|
944
|
+
), t = y(() => {
|
|
945
945
|
const s = l.onlyCountries || l.preferredCountries;
|
|
946
946
|
return s == null ? void 0 : s.map(
|
|
947
947
|
(m) => {
|
|
948
|
-
var
|
|
949
|
-
return (
|
|
948
|
+
var w;
|
|
949
|
+
return (w = z.value) == null ? void 0 : w.find((I) => I.iso2.includes(m));
|
|
950
950
|
}
|
|
951
951
|
);
|
|
952
|
-
}),
|
|
952
|
+
}), $ = y(
|
|
953
953
|
() => {
|
|
954
954
|
var s;
|
|
955
|
-
return (s =
|
|
956
|
-
var
|
|
957
|
-
return !((
|
|
955
|
+
return (s = z.value) == null ? void 0 : s.filter((m) => {
|
|
956
|
+
var w;
|
|
957
|
+
return !((w = l.preferredCountries) != null && w.includes(m.iso2));
|
|
958
958
|
});
|
|
959
959
|
}
|
|
960
|
-
), F =
|
|
961
|
-
() => l.preferredCountries ? [...t.value ?? [],
|
|
962
|
-
),
|
|
960
|
+
), F = y(
|
|
961
|
+
() => l.preferredCountries ? [...t.value ?? [], ...$.value ?? []] : l.onlyCountries ? t.value : z.value
|
|
962
|
+
), v = y(
|
|
963
963
|
() => {
|
|
964
964
|
var s;
|
|
965
965
|
return (s = F.value) == null ? void 0 : s.map(
|
|
@@ -970,18 +970,18 @@ const Eo = ["id"], Lo = {
|
|
|
970
970
|
).filter(Me);
|
|
971
971
|
}
|
|
972
972
|
);
|
|
973
|
-
async function
|
|
973
|
+
async function S() {
|
|
974
974
|
var s, m;
|
|
975
975
|
(m = (s = d.value) == null ? void 0 : s.$el.querySelector("input")) == null || m.focus();
|
|
976
976
|
}
|
|
977
|
-
return (s, m) => (
|
|
977
|
+
return (s, m) => (V(), M(
|
|
978
978
|
"div",
|
|
979
979
|
{
|
|
980
980
|
class: N(["m-country-selector", [l.class, { "--no-flags": s.noFlags }]]),
|
|
981
981
|
style: te(s.style)
|
|
982
982
|
},
|
|
983
983
|
[
|
|
984
|
-
s.modelValue && !s.noFlags ? (
|
|
984
|
+
s.modelValue && !s.noFlags ? (V(), M("button", {
|
|
985
985
|
key: 0,
|
|
986
986
|
id: `country-selector-flag-button-${s.id}`,
|
|
987
987
|
class: N(["m-country-selector__country-flag maz-text-xl", {
|
|
@@ -989,21 +989,21 @@ const Eo = ["id"], Lo = {
|
|
|
989
989
|
}]),
|
|
990
990
|
tabindex: "-1",
|
|
991
991
|
type: "button",
|
|
992
|
-
onClick:
|
|
992
|
+
onClick: S
|
|
993
993
|
}, [
|
|
994
|
-
|
|
994
|
+
b(`
|
|
995
995
|
@slot Country selector flag
|
|
996
996
|
@binding {String} country-code - current selected country code - Ex: \`"FR"\`
|
|
997
997
|
`),
|
|
998
998
|
R(s.$slots, "selector-flag", { countryCode: s.modelValue }, () => [
|
|
999
999
|
ve(
|
|
1000
|
-
X(
|
|
1000
|
+
X(A($e)(s.modelValue)),
|
|
1001
1001
|
1
|
|
1002
1002
|
/* TEXT */
|
|
1003
1003
|
)
|
|
1004
1004
|
], !0)
|
|
1005
|
-
], 10, Eo)) :
|
|
1006
|
-
Z($o,
|
|
1005
|
+
], 10, Eo)) : b("v-if", !0),
|
|
1006
|
+
Z($o, re({
|
|
1007
1007
|
id: `country-selector-${s.id}`,
|
|
1008
1008
|
ref_key: "CountrySelectorRef",
|
|
1009
1009
|
ref: d,
|
|
@@ -1023,62 +1023,62 @@ const Eo = ["id"], Lo = {
|
|
|
1023
1023
|
success: s.success,
|
|
1024
1024
|
search: !s.noSearch,
|
|
1025
1025
|
"search-placeholder": s.locales.countrySelector.searchPlaceholder,
|
|
1026
|
-
options:
|
|
1027
|
-
hint:
|
|
1026
|
+
options: v.value,
|
|
1027
|
+
hint: A(o) && !s.modelValue ? s.locales.countrySelector.error : void 0,
|
|
1028
1028
|
label: s.locales.countrySelector.placeholder,
|
|
1029
1029
|
style: {
|
|
1030
1030
|
width: s.width
|
|
1031
1031
|
},
|
|
1032
1032
|
"exclude-selectors": [`#country-selector-flag-button-${s.id}`, ...s.excludeSelectors ?? []],
|
|
1033
|
-
"onUpdate:modelValue": m[0] || (m[0] = (
|
|
1033
|
+
"onUpdate:modelValue": m[0] || (m[0] = (w) => s.$emit("update:model-value", w))
|
|
1034
1034
|
}), {
|
|
1035
|
-
"no-results":
|
|
1035
|
+
"no-results": j(() => [
|
|
1036
1036
|
R(s.$slots, "no-results", {}, void 0, !0)
|
|
1037
1037
|
]),
|
|
1038
|
-
default:
|
|
1039
|
-
|
|
1038
|
+
default: j(({ option: w, isSelected: I }) => [
|
|
1039
|
+
H(
|
|
1040
1040
|
"div",
|
|
1041
1041
|
{
|
|
1042
1042
|
class: N(["m-country-selector__select__item maz-flex maz-items-center maz-gap-1 maz-truncate", {
|
|
1043
|
-
"m-country-selector__select__item--selected":
|
|
1043
|
+
"m-country-selector__select__item--selected": I
|
|
1044
1044
|
}])
|
|
1045
1045
|
},
|
|
1046
1046
|
[
|
|
1047
|
-
!s.noFlags && typeof
|
|
1048
|
-
|
|
1047
|
+
!s.noFlags && typeof w.iso2 == "string" ? (V(), M("span", Lo, [
|
|
1048
|
+
b(`
|
|
1049
1049
|
@slot Country list flag
|
|
1050
1050
|
@binding {String} country-code - country code of option - Ex: \`"FR"\`
|
|
1051
1051
|
@binding {{ iso2: string; dialCode: string; name: string; }} option - country data
|
|
1052
1052
|
@binding {Boolean} is-selected - \`true\` if option is selected
|
|
1053
1053
|
`),
|
|
1054
1054
|
R(s.$slots, "country-list-flag", {
|
|
1055
|
-
countryCode:
|
|
1056
|
-
option:
|
|
1057
|
-
isSelected:
|
|
1055
|
+
countryCode: w.iso2,
|
|
1056
|
+
option: w,
|
|
1057
|
+
isSelected: I
|
|
1058
1058
|
}, () => [
|
|
1059
1059
|
ve(
|
|
1060
|
-
X(
|
|
1060
|
+
X(A($e)(w.iso2)),
|
|
1061
1061
|
1
|
|
1062
1062
|
/* TEXT */
|
|
1063
1063
|
)
|
|
1064
1064
|
], !0)
|
|
1065
|
-
])) :
|
|
1066
|
-
s.showCodeOnList ? (
|
|
1065
|
+
])) : b("v-if", !0),
|
|
1066
|
+
s.showCodeOnList ? (V(), M(
|
|
1067
1067
|
"span",
|
|
1068
1068
|
{
|
|
1069
1069
|
key: 1,
|
|
1070
|
-
class: N(["maz-w-9 maz-flex-none", { "maz-text-muted": !
|
|
1070
|
+
class: N(["maz-w-9 maz-flex-none", { "maz-text-muted": !I }])
|
|
1071
1071
|
},
|
|
1072
|
-
X(
|
|
1072
|
+
X(w.dialCode),
|
|
1073
1073
|
3
|
|
1074
1074
|
/* TEXT, CLASS */
|
|
1075
|
-
)) :
|
|
1076
|
-
|
|
1075
|
+
)) : b("v-if", !0),
|
|
1076
|
+
H(
|
|
1077
1077
|
"span",
|
|
1078
1078
|
{
|
|
1079
|
-
class: N(["maz-flex-1 maz-truncate", { "maz-font-semibold":
|
|
1079
|
+
class: N(["maz-flex-1 maz-truncate", { "maz-font-semibold": I }])
|
|
1080
1080
|
},
|
|
1081
|
-
X(
|
|
1081
|
+
X(w.name),
|
|
1082
1082
|
3
|
|
1083
1083
|
/* TEXT, CLASS */
|
|
1084
1084
|
)
|
|
@@ -1095,26 +1095,26 @@ const Eo = ["id"], Lo = {
|
|
|
1095
1095
|
/* CLASS, STYLE */
|
|
1096
1096
|
));
|
|
1097
1097
|
}
|
|
1098
|
-
}), To = /* @__PURE__ */
|
|
1099
|
-
function Ko(
|
|
1098
|
+
}), To = /* @__PURE__ */ se(Mo, [["__scopeId", "data-v-b24f2449"]]);
|
|
1099
|
+
function Ko(a) {
|
|
1100
1100
|
try {
|
|
1101
|
-
const l = to(
|
|
1102
|
-
return l || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${
|
|
1101
|
+
const l = to(a);
|
|
1102
|
+
return l || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${a}" is not available`), !1);
|
|
1103
1103
|
} catch (l) {
|
|
1104
1104
|
return console.error(`[maz-ui](MazPhoneNumberInput) ${l}`), !1;
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
function No({
|
|
1108
|
-
phoneNumber:
|
|
1108
|
+
phoneNumber: a,
|
|
1109
1109
|
countryCode: l
|
|
1110
1110
|
}) {
|
|
1111
1111
|
try {
|
|
1112
|
-
if (!
|
|
1112
|
+
if (!a)
|
|
1113
1113
|
return {
|
|
1114
1114
|
isValid: !1,
|
|
1115
1115
|
countryCode: l
|
|
1116
1116
|
};
|
|
1117
|
-
const o = lo(
|
|
1117
|
+
const o = lo(a, l);
|
|
1118
1118
|
return {
|
|
1119
1119
|
countryCode: (o == null ? void 0 : o.country) ?? l,
|
|
1120
1120
|
isValid: (o == null ? void 0 : o.isValid()) ?? !1,
|
|
@@ -1127,44 +1127,44 @@ function No({
|
|
|
1127
1127
|
uri: o == null ? void 0 : o.getURI(),
|
|
1128
1128
|
e164: o == null ? void 0 : o.format("E.164"),
|
|
1129
1129
|
rfc3966: o == null ? void 0 : o.format("RFC3966"),
|
|
1130
|
-
phoneNumber:
|
|
1130
|
+
phoneNumber: a
|
|
1131
1131
|
};
|
|
1132
1132
|
} catch (o) {
|
|
1133
1133
|
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${o}`);
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
-
function Ro(
|
|
1136
|
+
function Ro(a, l) {
|
|
1137
1137
|
try {
|
|
1138
|
-
return l ? new no(
|
|
1138
|
+
return l ? new no(a).input(l) : "";
|
|
1139
1139
|
} catch (o) {
|
|
1140
1140
|
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${o}`);
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
1143
|
async function Do() {
|
|
1144
|
-
const { default:
|
|
1145
|
-
return
|
|
1144
|
+
const { default: a } = await import("./examples.mobile.json-um0ibyv5.mjs");
|
|
1145
|
+
return a;
|
|
1146
1146
|
}
|
|
1147
|
-
function Oo(
|
|
1147
|
+
function Oo(a, l) {
|
|
1148
1148
|
var o;
|
|
1149
1149
|
try {
|
|
1150
|
-
return
|
|
1150
|
+
return a && l ? (o = ao(l, a)) == null ? void 0 : o.formatNational() : void 0;
|
|
1151
1151
|
} catch (d) {
|
|
1152
1152
|
console.error(`[maz-ui](MazPhoneNumberInput) ${d}`);
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
function Re() {
|
|
1156
|
-
function
|
|
1157
|
-
return
|
|
1156
|
+
function a(l, o) {
|
|
1157
|
+
return ue(l) === ue(o);
|
|
1158
1158
|
}
|
|
1159
1159
|
return {
|
|
1160
1160
|
getAsYouTypeFormat: Ro,
|
|
1161
1161
|
getPhoneNumberResults: No,
|
|
1162
1162
|
getPhoneNumberExamplesFile: Do,
|
|
1163
1163
|
getPhoneNumberExample: Oo,
|
|
1164
|
-
isSameCountryCallingCode:
|
|
1164
|
+
isSameCountryCallingCode: a,
|
|
1165
1165
|
isCountryAvailable: Ko,
|
|
1166
|
-
getCountries:
|
|
1167
|
-
getCountryCallingCode:
|
|
1166
|
+
getCountries: Ae,
|
|
1167
|
+
getCountryCallingCode: ue
|
|
1168
1168
|
};
|
|
1169
1169
|
}
|
|
1170
1170
|
const Uo = /* @__PURE__ */ ae({
|
|
@@ -1175,6 +1175,7 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1175
1175
|
size: {},
|
|
1176
1176
|
locales: {},
|
|
1177
1177
|
label: { default: void 0 },
|
|
1178
|
+
placeholder: { default: void 0 },
|
|
1178
1179
|
noExample: { type: Boolean },
|
|
1179
1180
|
disabled: { type: Boolean },
|
|
1180
1181
|
hasRadius: { type: Boolean },
|
|
@@ -1187,64 +1188,72 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1187
1188
|
modelModifiers: {}
|
|
1188
1189
|
}),
|
|
1189
1190
|
emits: /* @__PURE__ */ ke(["update:model-value"], ["update:modelValue"]),
|
|
1190
|
-
setup(
|
|
1191
|
-
const o =
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1191
|
+
setup(a, { emit: l }) {
|
|
1192
|
+
const o = a, d = l, c = eo(a, "modelValue"), { getPhoneNumberExamplesFile: p, getPhoneNumberExample: z } = Re(), { selectionRange: t, results: $, selectedCountry: F } = Ne("data"), v = P(), S = P(!1);
|
|
1193
|
+
function s(h, C) {
|
|
1194
|
+
const g = z(h, C);
|
|
1195
|
+
return g ? `${o.locales.phoneInput.example} ${g}` : void 0;
|
|
1196
|
+
}
|
|
1197
|
+
const m = y(() => {
|
|
1198
|
+
var C;
|
|
1199
|
+
if (o.label || o.placeholder)
|
|
1200
|
+
return o.label || o.placeholder;
|
|
1201
|
+
const h = o.locales.phoneInput.placeholder;
|
|
1202
|
+
if (o.noExample || !v.value)
|
|
1203
|
+
return h;
|
|
1198
1204
|
{
|
|
1199
|
-
const
|
|
1200
|
-
return (
|
|
1205
|
+
const g = s(v.value, F.value);
|
|
1206
|
+
return (C = $.value) != null && C.isValid || !g ? h : g;
|
|
1201
1207
|
}
|
|
1202
|
-
}),
|
|
1203
|
-
|
|
1208
|
+
}), w = y(() => o.placeholder ? {
|
|
1209
|
+
placeholder: m.value
|
|
1210
|
+
} : {
|
|
1211
|
+
label: m.value
|
|
1212
|
+
}), I = P();
|
|
1213
|
+
async function O() {
|
|
1204
1214
|
try {
|
|
1205
|
-
if (
|
|
1215
|
+
if (v.value)
|
|
1206
1216
|
return;
|
|
1207
|
-
|
|
1208
|
-
} catch (
|
|
1209
|
-
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file",
|
|
1217
|
+
v.value = await p();
|
|
1218
|
+
} catch (h) {
|
|
1219
|
+
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file", h);
|
|
1210
1220
|
}
|
|
1211
1221
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
|
|
1222
|
+
async function W(h) {
|
|
1223
|
+
I.value && h && Q(I.value, h), await ne(), d("update:model-value", h);
|
|
1214
1224
|
}
|
|
1215
|
-
function
|
|
1216
|
-
const
|
|
1217
|
-
t.value.start =
|
|
1225
|
+
function Q(h, C) {
|
|
1226
|
+
const g = h.$el.querySelector("input");
|
|
1227
|
+
t.value.start = g == null ? void 0 : g.selectionStart, t.value.end = g == null ? void 0 : g.selectionEnd, t.value.cursorAtEnd = C && typeof t.value.start == "number" && C.length > 0 ? t.value.start >= C.length : !0;
|
|
1218
1228
|
}
|
|
1219
1229
|
return ge(() => {
|
|
1220
|
-
o.noExample ||
|
|
1221
|
-
}), (
|
|
1222
|
-
id:
|
|
1230
|
+
o.noExample || O();
|
|
1231
|
+
}), (h, C) => (V(), D(he, re({
|
|
1232
|
+
id: h.id,
|
|
1223
1233
|
ref_key: "PhoneInputRef",
|
|
1224
|
-
ref:
|
|
1234
|
+
ref: I,
|
|
1225
1235
|
"model-value": c.value
|
|
1226
|
-
},
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
success: b.success,
|
|
1236
|
+
}, { ...h.$attrs, ...w.value }, {
|
|
1237
|
+
disabled: h.disabled,
|
|
1238
|
+
color: h.color,
|
|
1239
|
+
error: h.error,
|
|
1240
|
+
size: h.size,
|
|
1241
|
+
success: h.success,
|
|
1233
1242
|
type: "tel",
|
|
1234
1243
|
inputmode: "tel",
|
|
1235
1244
|
class: ["m-phone-input", [
|
|
1236
1245
|
{
|
|
1237
|
-
"--border-radius":
|
|
1238
|
-
"--error":
|
|
1239
|
-
"--focused":
|
|
1246
|
+
"--border-radius": h.hasRadius,
|
|
1247
|
+
"--error": h.error || !A($).isValid,
|
|
1248
|
+
"--focused": S.value
|
|
1240
1249
|
}
|
|
1241
1250
|
]],
|
|
1242
|
-
onFocus:
|
|
1243
|
-
onBlur:
|
|
1244
|
-
"onUpdate:modelValue":
|
|
1245
|
-
}), null, 16, ["id", "model-value", "
|
|
1251
|
+
onFocus: C[0] || (C[0] = (g) => S.value = !0),
|
|
1252
|
+
onBlur: C[1] || (C[1] = (g) => S.value = !1),
|
|
1253
|
+
"onUpdate:modelValue": C[2] || (C[2] = (g) => W(g))
|
|
1254
|
+
}), null, 16, ["id", "model-value", "disabled", "color", "error", "size", "success", "class"]));
|
|
1246
1255
|
}
|
|
1247
|
-
}), Yo = /* @__PURE__ */
|
|
1256
|
+
}), Yo = /* @__PURE__ */ se(Uo, [["__scopeId", "data-v-34e13002"]]), qo = {
|
|
1248
1257
|
countrySelector: {
|
|
1249
1258
|
placeholder: "Country code",
|
|
1250
1259
|
error: "Choose country",
|
|
@@ -1255,6 +1264,7 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1255
1264
|
example: "Example:"
|
|
1256
1265
|
}
|
|
1257
1266
|
}, Ho = /* @__PURE__ */ ae({
|
|
1267
|
+
name: "MazPhoneNumberInput",
|
|
1258
1268
|
inheritAttrs: !1,
|
|
1259
1269
|
__name: "MazPhoneNumberInput",
|
|
1260
1270
|
props: {
|
|
@@ -1266,6 +1276,7 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1266
1276
|
defaultCountryCode: { default: void 0 },
|
|
1267
1277
|
id: { default: void 0 },
|
|
1268
1278
|
placeholder: { default: void 0 },
|
|
1279
|
+
label: { default: void 0 },
|
|
1269
1280
|
preferredCountries: { default: void 0 },
|
|
1270
1281
|
ignoredCountries: { default: void 0 },
|
|
1271
1282
|
onlyCountries: { default: void 0 },
|
|
@@ -1296,81 +1307,81 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1296
1307
|
orientation: { default: "responsive" }
|
|
1297
1308
|
},
|
|
1298
1309
|
emits: ["update:model-value", "country-code", "update:country-code", "update", "data"],
|
|
1299
|
-
setup(
|
|
1300
|
-
const o = l, d =
|
|
1310
|
+
setup(a, { emit: l }) {
|
|
1311
|
+
const o = l, d = a, { fetchCountryCode: c, sanitizePhoneNumber: p, getBrowserLocale: z } = Ke(), { isCountryAvailable: t, getPhoneNumberResults: $, getAsYouTypeFormat: F } = Re(), v = be({
|
|
1301
1312
|
componentName: "MazPhoneNumberInput",
|
|
1302
1313
|
providedId: d.id
|
|
1303
|
-
}),
|
|
1314
|
+
}), S = P(""), s = P(), m = P({
|
|
1304
1315
|
isValid: !1,
|
|
1305
1316
|
countryCode: void 0
|
|
1306
|
-
}),
|
|
1317
|
+
}), w = P({
|
|
1307
1318
|
start: 0,
|
|
1308
1319
|
end: 0,
|
|
1309
1320
|
cursorAtEnd: !0
|
|
1310
1321
|
});
|
|
1311
1322
|
oo("data", {
|
|
1312
1323
|
selectedCountry: s,
|
|
1313
|
-
phoneNumber:
|
|
1324
|
+
phoneNumber: S,
|
|
1314
1325
|
results: m,
|
|
1315
|
-
selectionRange:
|
|
1326
|
+
selectionRange: w
|
|
1316
1327
|
});
|
|
1317
|
-
const
|
|
1328
|
+
const I = y(() => ({
|
|
1318
1329
|
...qo,
|
|
1319
1330
|
...d.translations
|
|
1320
1331
|
}));
|
|
1321
1332
|
ge(async () => {
|
|
1322
|
-
var
|
|
1323
|
-
if (
|
|
1333
|
+
var n;
|
|
1334
|
+
if (C(d.countryCode ?? d.defaultCountryCode), d.fetchCountry && !s.value) {
|
|
1324
1335
|
const B = await c();
|
|
1325
|
-
|
|
1336
|
+
C(B);
|
|
1326
1337
|
}
|
|
1327
1338
|
if (!d.defaultCountryCode && !d.noUseBrowserLocale && !s.value) {
|
|
1328
|
-
const B = (
|
|
1329
|
-
|
|
1339
|
+
const B = (n = z()) == null ? void 0 : n.locale;
|
|
1340
|
+
C(B);
|
|
1330
1341
|
}
|
|
1331
1342
|
});
|
|
1332
|
-
const
|
|
1333
|
-
function
|
|
1334
|
-
var
|
|
1335
|
-
return (
|
|
1343
|
+
const O = P();
|
|
1344
|
+
function W() {
|
|
1345
|
+
var n;
|
|
1346
|
+
return (n = O.value) == null ? void 0 : n.$el.querySelector("input");
|
|
1336
1347
|
}
|
|
1337
|
-
async function
|
|
1338
|
-
var
|
|
1339
|
-
await ne(), (
|
|
1348
|
+
async function Q() {
|
|
1349
|
+
var n;
|
|
1350
|
+
await ne(), (n = W()) == null || n.select();
|
|
1340
1351
|
}
|
|
1341
|
-
function
|
|
1352
|
+
function h(n) {
|
|
1342
1353
|
G({
|
|
1343
|
-
countryCode:
|
|
1354
|
+
countryCode: n,
|
|
1344
1355
|
autoFormat: d.autoFormat,
|
|
1345
1356
|
noFormattingAsYouType: d.noFormattingAsYouType
|
|
1346
|
-
}),
|
|
1357
|
+
}), Q();
|
|
1347
1358
|
}
|
|
1348
|
-
function
|
|
1349
|
-
if (
|
|
1350
|
-
if (!t(
|
|
1359
|
+
function C(n) {
|
|
1360
|
+
if (n) {
|
|
1361
|
+
if (!t(n)) {
|
|
1351
1362
|
s.value = void 0;
|
|
1352
1363
|
return;
|
|
1353
1364
|
}
|
|
1354
|
-
s.value =
|
|
1365
|
+
s.value = n;
|
|
1355
1366
|
}
|
|
1356
1367
|
}
|
|
1357
|
-
function
|
|
1358
|
-
newPhoneNumber:
|
|
1368
|
+
function g({
|
|
1369
|
+
newPhoneNumber: n,
|
|
1359
1370
|
autoFormat: B,
|
|
1360
1371
|
noFormattingAsYouType: L,
|
|
1361
1372
|
updateResults: T = !0
|
|
1362
1373
|
}) {
|
|
1363
|
-
const
|
|
1364
|
-
if (T && (m.value =
|
|
1365
|
-
phoneNumber:
|
|
1374
|
+
const U = p(n);
|
|
1375
|
+
if (T && (m.value = $({
|
|
1376
|
+
phoneNumber: U,
|
|
1366
1377
|
countryCode: s.value
|
|
1367
1378
|
})), m.value.isValid && m.value.formatNational && B)
|
|
1368
|
-
|
|
1369
|
-
else if (
|
|
1370
|
-
const le = F(s.value,
|
|
1371
|
-
|
|
1379
|
+
S.value = m.value.formatNational;
|
|
1380
|
+
else if (w.value.cursorAtEnd && !L) {
|
|
1381
|
+
const le = F(s.value, U);
|
|
1382
|
+
S.value = le;
|
|
1372
1383
|
} else
|
|
1373
|
-
|
|
1384
|
+
S.value = U;
|
|
1374
1385
|
m.value.countryCode && m.value.countryCode !== s.value && G({
|
|
1375
1386
|
countryCode: m.value.countryCode,
|
|
1376
1387
|
autoFormat: B,
|
|
@@ -1379,20 +1390,20 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1379
1390
|
});
|
|
1380
1391
|
}
|
|
1381
1392
|
function G({
|
|
1382
|
-
countryCode:
|
|
1393
|
+
countryCode: n,
|
|
1383
1394
|
autoFormat: B,
|
|
1384
1395
|
noFormattingAsYouType: L,
|
|
1385
1396
|
updateResults: T = !0
|
|
1386
1397
|
}) {
|
|
1387
|
-
if (!
|
|
1398
|
+
if (!n) {
|
|
1388
1399
|
s.value = void 0;
|
|
1389
1400
|
return;
|
|
1390
1401
|
}
|
|
1391
|
-
|
|
1392
|
-
phoneNumber:
|
|
1393
|
-
countryCode:
|
|
1394
|
-
})),
|
|
1395
|
-
newPhoneNumber:
|
|
1402
|
+
n !== s.value && C(n), T && (m.value = $({
|
|
1403
|
+
phoneNumber: S.value,
|
|
1404
|
+
countryCode: n
|
|
1405
|
+
})), g({
|
|
1406
|
+
newPhoneNumber: S.value,
|
|
1396
1407
|
autoFormat: B,
|
|
1397
1408
|
noFormattingAsYouType: L,
|
|
1398
1409
|
updateResults: !1
|
|
@@ -1400,9 +1411,9 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1400
1411
|
}
|
|
1401
1412
|
return fe(
|
|
1402
1413
|
() => d.modelValue ?? d.defaultPhoneNumber,
|
|
1403
|
-
(
|
|
1404
|
-
|
|
1405
|
-
newPhoneNumber:
|
|
1414
|
+
(n, B) => {
|
|
1415
|
+
n && n !== B && n !== S.value && g({
|
|
1416
|
+
newPhoneNumber: n,
|
|
1406
1417
|
autoFormat: d.autoFormat,
|
|
1407
1418
|
noFormattingAsYouType: d.noFormattingAsYouType
|
|
1408
1419
|
});
|
|
@@ -1412,9 +1423,9 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1412
1423
|
}
|
|
1413
1424
|
), fe(
|
|
1414
1425
|
() => d.countryCode ?? d.defaultCountryCode,
|
|
1415
|
-
(
|
|
1416
|
-
|
|
1417
|
-
countryCode:
|
|
1426
|
+
(n, B) => {
|
|
1427
|
+
n && n !== B && n !== s.value && G({
|
|
1428
|
+
countryCode: n,
|
|
1418
1429
|
autoFormat: d.autoFormat,
|
|
1419
1430
|
noFormattingAsYouType: d.noFormattingAsYouType
|
|
1420
1431
|
});
|
|
@@ -1424,107 +1435,109 @@ const Uo = /* @__PURE__ */ ae({
|
|
|
1424
1435
|
}
|
|
1425
1436
|
), fe(
|
|
1426
1437
|
m,
|
|
1427
|
-
(
|
|
1428
|
-
o("update",
|
|
1438
|
+
(n) => {
|
|
1439
|
+
o("update", n), o("data", n), n.e164 && n.isValid ? o("update:model-value", n.e164) : o("update:model-value", S.value), o("country-code", s.value), o("update:country-code", s.value);
|
|
1429
1440
|
},
|
|
1430
1441
|
{
|
|
1431
1442
|
immediate: !0
|
|
1432
1443
|
}
|
|
1433
|
-
), (
|
|
1444
|
+
), (n, B) => {
|
|
1434
1445
|
var L;
|
|
1435
|
-
return
|
|
1446
|
+
return V(), M(
|
|
1436
1447
|
"div",
|
|
1437
1448
|
{
|
|
1438
|
-
class: N(["m-phone-number-input", [d.class, { "--block":
|
|
1439
|
-
style: te(
|
|
1449
|
+
class: N(["m-phone-number-input", [d.class, { "--block": n.block }, n.orientation ? `--${n.orientation}` : void 0]]),
|
|
1450
|
+
style: te(n.style)
|
|
1440
1451
|
},
|
|
1441
1452
|
[
|
|
1442
|
-
|
|
1453
|
+
n.noCountrySelector ? b("v-if", !0) : (V(), D(To, {
|
|
1443
1454
|
key: 0,
|
|
1444
|
-
id:
|
|
1455
|
+
id: A(v),
|
|
1445
1456
|
"model-value": s.value,
|
|
1446
|
-
color:
|
|
1447
|
-
size:
|
|
1448
|
-
"country-locale":
|
|
1449
|
-
"country-selector-display-name":
|
|
1450
|
-
"custom-countries-list":
|
|
1451
|
-
"ignored-countries":
|
|
1452
|
-
"list-position":
|
|
1453
|
-
"no-flags":
|
|
1454
|
-
"no-search":
|
|
1455
|
-
"exclude-selectors":
|
|
1456
|
-
error:
|
|
1457
|
-
success:
|
|
1458
|
-
locales:
|
|
1459
|
-
disabled:
|
|
1460
|
-
"show-code-on-list":
|
|
1461
|
-
"only-countries":
|
|
1462
|
-
"preferred-countries":
|
|
1463
|
-
width:
|
|
1464
|
-
"onUpdate:modelValue":
|
|
1457
|
+
color: n.color,
|
|
1458
|
+
size: n.size,
|
|
1459
|
+
"country-locale": n.countryLocale,
|
|
1460
|
+
"country-selector-display-name": n.countrySelectorDisplayName,
|
|
1461
|
+
"custom-countries-list": n.customCountriesList,
|
|
1462
|
+
"ignored-countries": n.ignoredCountries,
|
|
1463
|
+
"list-position": n.listPosition,
|
|
1464
|
+
"no-flags": n.noFlags,
|
|
1465
|
+
"no-search": n.noSearch,
|
|
1466
|
+
"exclude-selectors": n.excludeSelectors,
|
|
1467
|
+
error: n.error || (n.noValidationError ? !1 : !!S.value && !s.value),
|
|
1468
|
+
success: n.success || (n.noValidationSuccess ? !1 : (L = m.value) == null ? void 0 : L.isValid),
|
|
1469
|
+
locales: I.value,
|
|
1470
|
+
disabled: n.disabled,
|
|
1471
|
+
"show-code-on-list": n.showCodeOnList,
|
|
1472
|
+
"only-countries": n.onlyCountries,
|
|
1473
|
+
"preferred-countries": n.preferredCountries,
|
|
1474
|
+
width: n.countrySelectorWidth,
|
|
1475
|
+
"onUpdate:modelValue": h
|
|
1465
1476
|
}, {
|
|
1466
|
-
"no-results":
|
|
1467
|
-
|
|
1477
|
+
"no-results": j(() => [
|
|
1478
|
+
b(`
|
|
1468
1479
|
@slot Replace the "no results" icon in the country selector list
|
|
1469
1480
|
`),
|
|
1470
|
-
R(
|
|
1481
|
+
R(n.$slots, "no-results", {}, void 0, !0)
|
|
1471
1482
|
]),
|
|
1472
|
-
"selector-flag":
|
|
1473
|
-
|
|
1483
|
+
"selector-flag": j(({ countryCode: T }) => [
|
|
1484
|
+
b(`
|
|
1474
1485
|
@slot Country selector flag
|
|
1475
1486
|
@binding {String} country-code - current selected country code - Ex: \`"FR"\`
|
|
1476
1487
|
`),
|
|
1477
|
-
R(
|
|
1488
|
+
R(n.$slots, "selector-flag", { countryCode: T }, void 0, !0)
|
|
1478
1489
|
]),
|
|
1479
|
-
"country-list-flag":
|
|
1480
|
-
|
|
1490
|
+
"country-list-flag": j(({ isSelected: T, option: U }) => [
|
|
1491
|
+
b(`
|
|
1481
1492
|
@slot Country list flag
|
|
1482
1493
|
@binding {String} country-code - country code of option - Ex: \`"FR"\`
|
|
1483
1494
|
@binding {{ iso2: string; dialCode: string; name: string; }} option - country data
|
|
1484
1495
|
@binding {Boolean} is-selected - \`true\` if option is selected
|
|
1485
1496
|
`),
|
|
1486
|
-
R(
|
|
1487
|
-
countryCode:
|
|
1488
|
-
option:
|
|
1497
|
+
R(n.$slots, "country-list-flag", {
|
|
1498
|
+
countryCode: U.iso2,
|
|
1499
|
+
option: U,
|
|
1489
1500
|
isSelected: T
|
|
1490
1501
|
}, void 0, !0)
|
|
1491
1502
|
]),
|
|
1492
1503
|
_: 3
|
|
1493
1504
|
/* FORWARDED */
|
|
1494
1505
|
}, 8, ["id", "model-value", "color", "size", "country-locale", "country-selector-display-name", "custom-countries-list", "ignored-countries", "list-position", "no-flags", "no-search", "exclude-selectors", "error", "success", "locales", "disabled", "show-code-on-list", "only-countries", "preferred-countries", "width"])),
|
|
1495
|
-
Z(Yo, {
|
|
1496
|
-
id:
|
|
1506
|
+
Z(Yo, re({
|
|
1507
|
+
id: A(v),
|
|
1497
1508
|
ref_key: "PhoneInputRef",
|
|
1498
|
-
ref:
|
|
1499
|
-
"model-value":
|
|
1500
|
-
color:
|
|
1501
|
-
size:
|
|
1502
|
-
"no-example":
|
|
1509
|
+
ref: O,
|
|
1510
|
+
"model-value": S.value,
|
|
1511
|
+
color: n.color,
|
|
1512
|
+
size: n.size,
|
|
1513
|
+
"no-example": n.noExample,
|
|
1503
1514
|
block: "",
|
|
1504
|
-
disabled:
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
"
|
|
1511
|
-
|
|
1512
|
-
|
|
1515
|
+
disabled: n.disabled
|
|
1516
|
+
}, n.$attrs, {
|
|
1517
|
+
"has-radius": !n.noCountrySelector,
|
|
1518
|
+
success: n.success || (n.noValidationSuccess ? !1 : m.value.isValid),
|
|
1519
|
+
error: n.error || (n.noValidationError ? !1 : !!S.value && !m.value.isValid),
|
|
1520
|
+
locales: I.value,
|
|
1521
|
+
"no-formatting-as-you-type": n.noFormattingAsYouType,
|
|
1522
|
+
"auto-format": n.autoFormat,
|
|
1523
|
+
label: n.label,
|
|
1524
|
+
placeholder: n.placeholder,
|
|
1525
|
+
"onUpdate:modelValue": B[0] || (B[0] = (T) => g({
|
|
1513
1526
|
newPhoneNumber: T,
|
|
1514
|
-
autoFormat:
|
|
1515
|
-
noFormattingAsYouType:
|
|
1527
|
+
autoFormat: n.autoFormat,
|
|
1528
|
+
noFormattingAsYouType: n.noFormattingAsYouType
|
|
1516
1529
|
}))
|
|
1517
|
-
}, null,
|
|
1530
|
+
}), null, 16, ["id", "model-value", "color", "size", "no-example", "disabled", "has-radius", "success", "error", "locales", "no-formatting-as-you-type", "auto-format", "label", "placeholder"])
|
|
1518
1531
|
],
|
|
1519
1532
|
6
|
|
1520
1533
|
/* CLASS, STYLE */
|
|
1521
1534
|
);
|
|
1522
1535
|
};
|
|
1523
1536
|
}
|
|
1524
|
-
}), Qo = /* @__PURE__ */
|
|
1537
|
+
}), Qo = /* @__PURE__ */ se(Ho, [["__scopeId", "data-v-1ad77393"]]);
|
|
1525
1538
|
export {
|
|
1526
1539
|
Qo as M,
|
|
1527
|
-
|
|
1540
|
+
se as _,
|
|
1528
1541
|
Ne as i,
|
|
1529
1542
|
be as u
|
|
1530
1543
|
};
|