maz-ui 3.37.0 → 3.37.2
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/MazCheckbox.d.ts +4 -0
- package/components/MazCheckbox.mjs +31 -24
- package/components/MazInput.d.ts +2 -0
- package/components/MazInput.mjs +1 -1
- package/components/MazInputNumber.d.ts +2 -0
- package/components/MazInputNumber.mjs +1 -1
- package/components/MazInputPrice.d.ts +8 -0
- package/components/MazInputPrice.mjs +1 -1
- package/components/MazInputTags.d.ts +2 -0
- package/components/MazInputTags.mjs +1 -1
- package/components/MazPhoneNumberInput.d.ts +2 -0
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/MazPicker.d.ts +2 -0
- package/components/MazPicker.mjs +1 -1
- package/components/MazRadio.d.ts +9 -0
- package/components/MazRadio.mjs +44 -37
- package/components/MazSelect.d.ts +2 -0
- package/components/MazSelect.mjs +1 -1
- package/components/MazTable.mjs +1 -1
- package/components/MazTextarea.mjs +1 -1
- package/components/assets/MazCheckbox.css +1 -1
- package/components/assets/MazInput.css +1 -1
- package/components/assets/MazInputNumber.css +1 -1
- package/components/assets/MazInputPrice.css +1 -1
- package/components/assets/MazInputTags.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazPicker.css +1 -1
- package/components/assets/MazRadio.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/assets/MazTable.css +1 -1
- package/components/assets/MazTextarea.css +1 -1
- package/components/chunks/{MazBtn-C3z_znl5.mjs → MazBtn-Bo51KtKY.mjs} +2 -2
- package/components/chunks/{MazBtn-CuYCQCM2.mjs → MazBtn-CDQAW3fg.mjs} +2 -2
- package/components/chunks/MazBtn-D-Axz-X0.mjs +151 -0
- package/components/chunks/{MazBtn-D7b2VFGB.mjs → MazBtn-Koayc6g_.mjs} +2 -2
- package/components/chunks/{MazBtn-CS2F1-mC.mjs → MazBtn-pLRsSxug.mjs} +2 -2
- package/components/chunks/{MazCheckbox-BTM3Xpxz.mjs → MazCheckbox-CXVe5vda.mjs} +30 -23
- package/components/chunks/{MazCheckbox-COTppi08.mjs → MazCheckbox-DBlQwP82.mjs} +30 -23
- package/components/chunks/{MazIcon-Bspx_Ojq.mjs → MazIcon-BTsi1M-S.mjs} +1 -1
- package/components/chunks/{MazInput-C1r0b8BB.mjs → MazInput-Caas-0Nk.mjs} +19 -17
- package/components/chunks/{MazInputNumber-DJWxTvJ0.mjs → MazInputNumber-CnoCQQzg.mjs} +85 -81
- package/components/chunks/{MazInputPrice-CmX_rC0L.mjs → MazInputPrice---5nCUKm.mjs} +57 -53
- package/components/chunks/{MazInputTags-pm_5HtHM.mjs → MazInputTags-CipoVBP2.mjs} +83 -79
- package/components/chunks/{MazPhoneNumberInput-CVz5eTvG.mjs → MazPhoneNumberInput-CsX6Kqob.mjs} +402 -395
- package/components/chunks/{MazPicker-DP1zd8tt.mjs → MazPicker-CfhI75aw.mjs} +67 -62
- package/components/chunks/{MazPickerCalendar-qjcDNw86.mjs → MazPickerCalendar-DnkNE-Am.mjs} +3 -3
- package/components/chunks/{MazPickerHeader-CozeYkFf.mjs → MazPickerHeader-Vt86yzXS.mjs} +1 -1
- package/components/chunks/{MazPickerMonthSwitcher-aaUELZpE.mjs → MazPickerMonthSwitcher-zfKhsjW1.mjs} +2 -2
- package/components/chunks/{MazPickerShortcuts-ppox8lXf.mjs → MazPickerShortcuts-DUIKfOO8.mjs} +2 -2
- package/components/chunks/{MazPickerTime-DmpypIWr.mjs → MazPickerTime-B2znRxr2.mjs} +2 -2
- package/components/chunks/{MazPickerYearSwitcher-BNBvipzs.mjs → MazPickerYearSwitcher-CB339kof.mjs} +3 -3
- package/components/chunks/{MazSelect-DGEof7R3.mjs → MazSelect-DZeXglR8.mjs} +117 -109
- package/components/chunks/{MazSpinner-CTdeHHNH.mjs → MazSpinner-BAhgxOgg.mjs} +1 -1
- package/components/chunks/{MazSpinner-DmFFdtxB.mjs → MazSpinner-CJaSrYbQ.mjs} +1 -1
- package/components/chunks/{MazSpinner-KKcK5-QF.mjs → MazSpinner-CORsBFCP.mjs} +1 -1
- package/components/chunks/{MazSpinner-DTZHIIMh.mjs → MazSpinner-CVBVegaS.mjs} +1 -1
- package/components/chunks/MazSpinner-CkdjTE0y.mjs +38 -0
- package/components/chunks/{MazSpinner-DZTqt2Yn.mjs → MazSpinner-DECa8Pby.mjs} +1 -1
- package/components/chunks/{MazSpinner-DUVEeU4h.mjs → MazSpinner-Dq4o-_GM.mjs} +1 -1
- package/components/chunks/{MazSpinner-CiPbsWOG.mjs → MazSpinner-DqXjnLKa.mjs} +1 -1
- package/components/chunks/{MazTable-BhDfeDU1.mjs → MazTable-DrFqDO-J.mjs} +214 -199
- package/nuxt/index.json +1 -1
- package/package.json +1 -1
- package/types/components/MazCheckbox.vue.d.ts +4 -0
- package/types/components/MazInput.vue.d.ts +2 -0
- package/types/components/MazInputNumber.vue.d.ts +2 -0
- package/types/components/MazInputPrice.vue.d.ts +8 -0
- package/types/components/MazInputTags.vue.d.ts +2 -0
- package/types/components/MazPhoneNumberInput.vue.d.ts +2 -0
- package/types/components/MazPicker.vue.d.ts +2 -0
- package/types/components/MazRadio.vue.d.ts +9 -0
- package/types/components/MazSelect.vue.d.ts +2 -0
- package/components/chunks/MazBtn-OUDBhJKd.mjs +0 -151
- package/components/chunks/MazSpinner-yPD_Biya.mjs +0 -38
package/components/chunks/{MazPhoneNumberInput-CVz5eTvG.mjs → MazPhoneNumberInput-CsX6Kqob.mjs}
RENAMED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import '../assets/MazPhoneNumberInput.css';
|
|
2
|
-
import { getCurrentInstance as to, computed as v, defineComponent as re, defineAsyncComponent as U, ref as
|
|
3
|
-
import { getCountries as Te, getCountryCallingCode as de, getExampleNumber as
|
|
4
|
-
function
|
|
2
|
+
import { getCurrentInstance as to, computed as v, defineComponent as re, defineAsyncComponent as U, ref as I, onMounted as we, useSlots as lo, openBlock as C, createElementBlock as P, normalizeClass as E, normalizeStyle as _, createElementVNode as R, createCommentVNode as V, renderSlot as H, createBlock as K, unref as b, resolveDynamicComponent as Fe, withDirectives as Ne, mergeProps as pe, toHandlers as no, vModelDynamic as ao, createTextVNode as Ce, toDisplayString as G, withModifiers as x, withCtx as ae, createVNode as q, nextTick as ee, useCssVars as ro, onBeforeMount as so, Transition as uo, Fragment as Ae, renderList as io, reactive as co, mergeModels as Le, useModel as po, watch as he } from "vue";
|
|
3
|
+
import { getCountries as Te, getCountryCallingCode as de, getExampleNumber as fo, isSupportedCountry as mo, parsePhoneNumberFromString as yo, AsYouType as vo } from "libphonenumber-js";
|
|
4
|
+
function ho(t, l) {
|
|
5
5
|
let o;
|
|
6
6
|
return function(...c) {
|
|
7
7
|
clearTimeout(o), o = setTimeout(() => {
|
|
8
8
|
t.apply(this, c);
|
|
9
|
-
},
|
|
9
|
+
}, l);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const ke = ({
|
|
13
13
|
componentName: t,
|
|
14
|
-
providedId:
|
|
14
|
+
providedId: l
|
|
15
15
|
}) => {
|
|
16
16
|
const o = to();
|
|
17
|
-
return v(() =>
|
|
18
|
-
},
|
|
17
|
+
return v(() => l ?? `${t}-${o == null ? void 0 : o.uid}`);
|
|
18
|
+
}, bo = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "m-input-wrapper-left"
|
|
21
|
-
},
|
|
21
|
+
}, go = { class: "m-input-wrapper-input" }, zo = ["id", "type", "name", "inputmode", "placeholder", "aria-label", "disabled", "readonly", "required"], Co = { key: 0 }, Vo = {
|
|
22
22
|
key: 1,
|
|
23
23
|
class: "m-input-wrapper-right"
|
|
24
|
-
},
|
|
24
|
+
}, wo = /* @__PURE__ */ re({
|
|
25
25
|
inheritAttrs: !1,
|
|
26
26
|
__name: "MazInput",
|
|
27
27
|
props: {
|
|
@@ -54,19 +54,20 @@ const we = ({
|
|
|
54
54
|
borderActive: { type: Boolean, default: !1 },
|
|
55
55
|
leftIcon: { default: void 0 },
|
|
56
56
|
rightIcon: { default: void 0 },
|
|
57
|
-
roundedSize: { default: void 0 }
|
|
57
|
+
roundedSize: { default: void 0 },
|
|
58
|
+
block: { type: Boolean }
|
|
58
59
|
},
|
|
59
60
|
emits: ["update:model-value", "focus", "blur", "click", "change"],
|
|
60
|
-
setup(t, { emit:
|
|
61
|
-
const o = U(() => import("./MazBtn-
|
|
61
|
+
setup(t, { emit: l }) {
|
|
62
|
+
const o = U(() => import("./MazBtn-D-Axz-X0.mjs")), c = U(() => import("./MazIcon-Cxrv3_OK.mjs")), m = U(() => import("./eye-slash-tjfxO0LK.mjs")), f = U(() => import("./eye-DqO_Jx56.mjs")), n = U(() => import("./check-7UA4j2f2.mjs")), i = t, k = l, h = I(!1), B = I(!1), M = I(), d = ke({
|
|
62
63
|
componentName: "MazInput",
|
|
63
64
|
providedId: i.id
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
var
|
|
67
|
-
i.autoFocus && ((
|
|
66
|
+
we(() => {
|
|
67
|
+
var r;
|
|
68
|
+
i.autoFocus && ((r = M.value) == null || r.focus());
|
|
68
69
|
});
|
|
69
|
-
const g = v(() => i.type === "password"), y = v(() => h.value ? "text" : i.type),
|
|
70
|
+
const g = v(() => i.type === "password"), y = v(() => h.value ? "text" : i.type), F = v(() => {
|
|
70
71
|
if (!i.noBorder) {
|
|
71
72
|
if (i.error)
|
|
72
73
|
return "maz-border-danger";
|
|
@@ -94,143 +95,144 @@ const we = ({
|
|
|
94
95
|
}
|
|
95
96
|
return "--default-border";
|
|
96
97
|
}
|
|
97
|
-
}), z =
|
|
98
|
-
const { required:
|
|
98
|
+
}), z = lo(), $ = v(() => {
|
|
99
|
+
const { required: r, placeholder: L } = i;
|
|
99
100
|
if (L)
|
|
100
|
-
return
|
|
101
|
-
}),
|
|
102
|
-
(
|
|
103
|
-
N.value =
|
|
101
|
+
return r ? `${L} *` : L;
|
|
102
|
+
}), a = v(() => N.value !== void 0 && N.value !== ""), S = ho(
|
|
103
|
+
(r) => {
|
|
104
|
+
N.value = r;
|
|
104
105
|
},
|
|
105
106
|
typeof i.debounce == "number" ? i.debounce : i.debounceDelay ?? 500
|
|
106
107
|
), N = v({
|
|
107
108
|
get: () => i.modelValue,
|
|
108
|
-
set: (
|
|
109
|
+
set: (r) => {
|
|
109
110
|
if (i.debounce)
|
|
110
|
-
return
|
|
111
|
-
|
|
111
|
+
return S(r);
|
|
112
|
+
k("update:model-value", r);
|
|
112
113
|
}
|
|
113
|
-
}), ue = v(() => (!!i.label || !!i.hint) && (B.value || !!
|
|
114
|
+
}), ue = v(() => (!!i.label || !!i.hint) && (B.value || !!a.value || !!i.placeholder || ["date", "month", "week"].includes(i.type))), ie = v(() => !!i.label || !!i.hint);
|
|
114
115
|
function O() {
|
|
115
116
|
return !!z["right-icon"] || g.value || !!z["valid-button"] || i.validButton || !!i.rightIcon;
|
|
116
117
|
}
|
|
117
118
|
function te() {
|
|
118
119
|
return !!z["left-icon"] || !!i.leftIcon;
|
|
119
120
|
}
|
|
120
|
-
function fe(
|
|
121
|
-
|
|
121
|
+
function fe(r) {
|
|
122
|
+
k("focus", r), B.value = !0;
|
|
122
123
|
}
|
|
123
|
-
function me(
|
|
124
|
-
|
|
124
|
+
function me(r) {
|
|
125
|
+
k("blur", r), B.value = !1;
|
|
125
126
|
}
|
|
126
|
-
function j(
|
|
127
|
-
return
|
|
127
|
+
function j(r) {
|
|
128
|
+
return k("change", r);
|
|
128
129
|
}
|
|
129
|
-
return (
|
|
130
|
+
return (r, L) => (C(), P(
|
|
130
131
|
"div",
|
|
131
132
|
{
|
|
132
133
|
class: E(["m-input", [
|
|
133
134
|
{
|
|
134
|
-
"--is-focused": B.value ||
|
|
135
|
+
"--is-focused": B.value || r.borderActive,
|
|
135
136
|
"--should-up": ue.value,
|
|
136
137
|
"--has-label": ie.value,
|
|
137
|
-
"--is-disabled":
|
|
138
|
-
"--is-readonly":
|
|
139
|
-
"--has-z-2":
|
|
140
|
-
"--has-state":
|
|
138
|
+
"--is-disabled": r.disabled,
|
|
139
|
+
"--is-readonly": r.readonly,
|
|
140
|
+
"--has-z-2": r.error || r.warning || r.success,
|
|
141
|
+
"--has-state": r.error || r.warning || r.success,
|
|
142
|
+
"--block": r.block
|
|
141
143
|
},
|
|
142
144
|
i.class,
|
|
143
|
-
`--${
|
|
144
|
-
`--${
|
|
145
|
+
`--${r.color}`,
|
|
146
|
+
`--${r.size}`
|
|
145
147
|
]]),
|
|
146
|
-
style: _(
|
|
148
|
+
style: _(r.style)
|
|
147
149
|
},
|
|
148
150
|
[
|
|
149
151
|
R(
|
|
150
152
|
"div",
|
|
151
153
|
{
|
|
152
154
|
class: E(["m-input-wrapper", [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
r.inputClasses,
|
|
156
|
+
F.value,
|
|
157
|
+
r.roundedSize ? `--rounded-${r.roundedSize}` : { "maz-rounded": !r.noRadius }
|
|
156
158
|
]])
|
|
157
159
|
},
|
|
158
160
|
[
|
|
159
|
-
te() ? (C(),
|
|
161
|
+
te() ? (C(), P("div", bo, [
|
|
160
162
|
V(`
|
|
161
163
|
@slot left-icon - The icon to display on the left of the input
|
|
162
164
|
`),
|
|
163
|
-
|
|
164
|
-
typeof
|
|
165
|
+
r.$slots["left-icon"] || r.leftIcon ? H(r.$slots, "left-icon", { key: 0 }, () => [
|
|
166
|
+
typeof r.leftIcon == "string" ? (C(), K(b(c), {
|
|
165
167
|
key: 0,
|
|
166
|
-
name:
|
|
168
|
+
name: r.leftIcon,
|
|
167
169
|
class: "maz-text-xl maz-text-muted"
|
|
168
|
-
}, null, 8, ["name"])) :
|
|
170
|
+
}, null, 8, ["name"])) : r.leftIcon ? (C(), K(Fe(r.leftIcon), {
|
|
169
171
|
key: 1,
|
|
170
172
|
class: "maz-text-xl maz-text-muted"
|
|
171
173
|
})) : V("v-if", !0)
|
|
172
174
|
], !0) : V("v-if", !0)
|
|
173
175
|
])) : V("v-if", !0),
|
|
174
|
-
R("div",
|
|
176
|
+
R("div", go, [
|
|
175
177
|
Ne(R("input", pe({
|
|
176
178
|
id: b(d),
|
|
177
179
|
ref_key: "input",
|
|
178
180
|
ref: M,
|
|
179
181
|
"onUpdate:modelValue": L[0] || (L[0] = (Y) => N.value = Y),
|
|
180
182
|
type: y.value,
|
|
181
|
-
name:
|
|
182
|
-
},
|
|
183
|
-
inputmode:
|
|
184
|
-
placeholder:
|
|
185
|
-
"aria-label":
|
|
186
|
-
disabled:
|
|
187
|
-
readonly:
|
|
188
|
-
required:
|
|
183
|
+
name: r.name
|
|
184
|
+
}, r.$attrs, {
|
|
185
|
+
inputmode: r.inputmode,
|
|
186
|
+
placeholder: $.value,
|
|
187
|
+
"aria-label": r.label || r.placeholder,
|
|
188
|
+
disabled: r.disabled,
|
|
189
|
+
readonly: r.readonly,
|
|
190
|
+
required: r.required,
|
|
189
191
|
class: "m-input-input"
|
|
190
|
-
},
|
|
192
|
+
}, no({
|
|
191
193
|
blur: me,
|
|
192
194
|
focus: fe,
|
|
193
195
|
change: j
|
|
194
196
|
}, !0), {
|
|
195
|
-
onClick: L[1] || (L[1] = (Y) =>
|
|
196
|
-
}), null, 16,
|
|
197
|
+
onClick: L[1] || (L[1] = (Y) => r.$emit("click", Y))
|
|
198
|
+
}), null, 16, zo), [
|
|
197
199
|
[ao, N.value]
|
|
198
200
|
]),
|
|
199
|
-
|
|
201
|
+
r.label || r.hint ? (C(), P(
|
|
200
202
|
"span",
|
|
201
203
|
{
|
|
202
204
|
key: 0,
|
|
203
205
|
ref: "label",
|
|
204
206
|
class: E(["m-input-label", [
|
|
205
207
|
{
|
|
206
|
-
"maz-text-danger-600":
|
|
207
|
-
"maz-text-success-600":
|
|
208
|
-
"maz-text-warning-600":
|
|
208
|
+
"maz-text-danger-600": r.error,
|
|
209
|
+
"maz-text-success-600": r.success,
|
|
210
|
+
"maz-text-warning-600": r.warning
|
|
209
211
|
}
|
|
210
212
|
]])
|
|
211
213
|
},
|
|
212
214
|
[
|
|
213
215
|
Ce(
|
|
214
|
-
G(
|
|
216
|
+
G(r.hint || r.label) + " ",
|
|
215
217
|
1
|
|
216
218
|
/* TEXT */
|
|
217
219
|
),
|
|
218
|
-
|
|
220
|
+
r.required ? (C(), P("sup", Co, "*")) : V("v-if", !0)
|
|
219
221
|
],
|
|
220
222
|
2
|
|
221
223
|
/* CLASS */
|
|
222
224
|
)) : V("v-if", !0)
|
|
223
225
|
]),
|
|
224
|
-
O() ? (C(),
|
|
226
|
+
O() ? (C(), P("div", Vo, [
|
|
225
227
|
V(`
|
|
226
228
|
@slot right-icon - The icon to display on the right of the input
|
|
227
229
|
`),
|
|
228
|
-
|
|
229
|
-
typeof
|
|
230
|
+
r.$slots["right-icon"] || r.rightIcon ? H(r.$slots, "right-icon", { key: 0 }, () => [
|
|
231
|
+
typeof r.rightIcon == "string" ? (C(), K(b(c), {
|
|
230
232
|
key: 0,
|
|
231
|
-
name:
|
|
233
|
+
name: r.rightIcon,
|
|
232
234
|
class: "maz-text-xl maz-text-muted"
|
|
233
|
-
}, null, 8, ["name"])) :
|
|
235
|
+
}, null, 8, ["name"])) : r.rightIcon ? (C(), K(Fe(r.rightIcon), {
|
|
234
236
|
key: 1,
|
|
235
237
|
class: "maz-text-xl maz-text-muted"
|
|
236
238
|
})) : V("v-if", !0)
|
|
@@ -257,18 +259,18 @@ const we = ({
|
|
|
257
259
|
V(`
|
|
258
260
|
@slot valid-button - Replace the valid button by your own
|
|
259
261
|
`),
|
|
260
|
-
|
|
262
|
+
r.$slots["valid-button"] || r.validButton ? H(r.$slots, "valid-button", { key: 2 }, () => [
|
|
261
263
|
q(b(o), {
|
|
262
264
|
color: "transparent",
|
|
263
|
-
disabled:
|
|
265
|
+
disabled: r.disabled,
|
|
264
266
|
tabindex: "-1",
|
|
265
|
-
loading:
|
|
267
|
+
loading: r.validButtonLoading,
|
|
266
268
|
class: "m-input-valid-button",
|
|
267
269
|
size: "mini",
|
|
268
270
|
type: "submit"
|
|
269
271
|
}, {
|
|
270
272
|
default: ae(() => [
|
|
271
|
-
q(b(
|
|
273
|
+
q(b(n), { class: "maz-text-2xl maz-text-normal" })
|
|
272
274
|
]),
|
|
273
275
|
_: 1
|
|
274
276
|
/* STABLE */
|
|
@@ -284,26 +286,26 @@ const we = ({
|
|
|
284
286
|
/* CLASS, STYLE */
|
|
285
287
|
));
|
|
286
288
|
}
|
|
287
|
-
}), se = (t,
|
|
289
|
+
}), se = (t, l) => {
|
|
288
290
|
const o = t.__vccOpts || t;
|
|
289
|
-
for (const [c, m] of
|
|
291
|
+
for (const [c, m] of l)
|
|
290
292
|
o[c] = m;
|
|
291
293
|
return o;
|
|
292
|
-
},
|
|
294
|
+
}, Ve = /* @__PURE__ */ se(wo, [["__scopeId", "data-v-78090be8"]]);
|
|
293
295
|
let be = null;
|
|
294
|
-
function ko(t,
|
|
295
|
-
be && clearTimeout(be), be = setTimeout(t,
|
|
296
|
+
function ko(t, l) {
|
|
297
|
+
be && clearTimeout(be), be = setTimeout(t, l);
|
|
296
298
|
}
|
|
297
299
|
const ce = "__maz-click-outside__", De = () => document.ontouchstart === null ? "touchstart" : "click";
|
|
298
|
-
async function Ue(t,
|
|
300
|
+
async function Ue(t, l) {
|
|
299
301
|
try {
|
|
300
302
|
Re(t);
|
|
301
|
-
const o =
|
|
303
|
+
const o = l.instance, c = l.value, m = typeof c == "function";
|
|
302
304
|
if (!m)
|
|
303
305
|
throw new Error("[maz-ui](vClickOutside) the callback should be a function");
|
|
304
|
-
await ee(), t[ce] = (
|
|
305
|
-
if ((!t ||
|
|
306
|
-
return c.call(o,
|
|
306
|
+
await ee(), t[ce] = (n) => {
|
|
307
|
+
if ((!t || n.target && !t.contains(n.target)) && c && m)
|
|
308
|
+
return c.call(o, n);
|
|
307
309
|
};
|
|
308
310
|
const f = De();
|
|
309
311
|
document.addEventListener(f, t[ce], { passive: !0 });
|
|
@@ -313,39 +315,39 @@ async function Ue(t, n) {
|
|
|
313
315
|
}
|
|
314
316
|
function Re(t) {
|
|
315
317
|
try {
|
|
316
|
-
const
|
|
317
|
-
document.removeEventListener(
|
|
318
|
-
} catch (
|
|
319
|
-
console.error("[maz-ui](vClickOutside)",
|
|
318
|
+
const l = De();
|
|
319
|
+
document.removeEventListener(l, t[ce], !1), delete t[ce];
|
|
320
|
+
} catch (l) {
|
|
321
|
+
console.error("[maz-ui](vClickOutside)", l);
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
|
-
function
|
|
324
|
+
function Io(t, l) {
|
|
323
325
|
try {
|
|
324
|
-
if (
|
|
326
|
+
if (l.value === l.oldValue)
|
|
325
327
|
return;
|
|
326
|
-
Ue(t,
|
|
328
|
+
Ue(t, l);
|
|
327
329
|
} catch (o) {
|
|
328
330
|
console.error("[maz-ui](vClickOutside)", o);
|
|
329
331
|
}
|
|
330
332
|
}
|
|
331
|
-
const
|
|
333
|
+
const So = {
|
|
332
334
|
mounted: Ue,
|
|
333
|
-
updated:
|
|
335
|
+
updated: Io,
|
|
334
336
|
unmounted: Re
|
|
335
337
|
};
|
|
336
|
-
function
|
|
337
|
-
const o = t.length, c =
|
|
338
|
+
function Bo(t, l) {
|
|
339
|
+
const o = t.length, c = l.length, m = [];
|
|
338
340
|
for (let f = 0; f <= o; f++)
|
|
339
341
|
m[f] = [f];
|
|
340
342
|
for (let f = 0; f <= c; f++)
|
|
341
343
|
m[0][f] = f;
|
|
342
344
|
for (let f = 1; f <= o; f++)
|
|
343
|
-
for (let
|
|
344
|
-
const i = t[f - 1] === n
|
|
345
|
-
m[f][
|
|
346
|
-
m[f - 1][
|
|
347
|
-
m[f][
|
|
348
|
-
m[f - 1][
|
|
345
|
+
for (let n = 1; n <= c; n++) {
|
|
346
|
+
const i = t[f - 1] === l[n - 1] ? 0 : 1;
|
|
347
|
+
m[f][n] = Math.min(
|
|
348
|
+
m[f - 1][n] + 1,
|
|
349
|
+
m[f][n - 1] + 1,
|
|
350
|
+
m[f - 1][n - 1] + i
|
|
349
351
|
);
|
|
350
352
|
}
|
|
351
353
|
return m[o][c];
|
|
@@ -353,31 +355,31 @@ function $o(t, n) {
|
|
|
353
355
|
function Me(t) {
|
|
354
356
|
return t.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").toLowerCase();
|
|
355
357
|
}
|
|
356
|
-
function Oe(t,
|
|
357
|
-
const o =
|
|
358
|
+
function Oe(t, l) {
|
|
359
|
+
const o = Bo(t, l), c = Math.max(t.length, l.length);
|
|
358
360
|
return 1 - o / c;
|
|
359
361
|
}
|
|
360
|
-
function
|
|
361
|
-
return Oe(t,
|
|
362
|
+
function $o(t, l, o = 0.75) {
|
|
363
|
+
return Oe(t, l) >= o;
|
|
362
364
|
}
|
|
363
|
-
function ge(t,
|
|
365
|
+
function ge(t, l, o = 0.75) {
|
|
364
366
|
const c = v(
|
|
365
367
|
() => Me(typeof t == "string" ? t : t.value)
|
|
366
368
|
), m = v(
|
|
367
|
-
() => Me(typeof
|
|
368
|
-
), f = v(() => typeof o == "number" ? o : o.value),
|
|
369
|
+
() => Me(typeof l == "string" ? l : l.value)
|
|
370
|
+
), f = v(() => typeof o == "number" ? o : o.value), n = v(() => Oe(c.value, m.value));
|
|
369
371
|
return {
|
|
370
372
|
isMatching: v(
|
|
371
|
-
() =>
|
|
373
|
+
() => $o(c.value, m.value, f.value)
|
|
372
374
|
),
|
|
373
|
-
score:
|
|
375
|
+
score: n
|
|
374
376
|
};
|
|
375
377
|
}
|
|
376
|
-
const
|
|
378
|
+
const Po = ["aria-label"], Fo = { class: "m-select-list__no-results" }, Ao = {
|
|
377
379
|
key: 2,
|
|
378
380
|
class: "m-select-list__scroll-wrapper",
|
|
379
381
|
tabindex: "-1"
|
|
380
|
-
},
|
|
382
|
+
}, Lo = { class: "m-select-list-optgroup" }, Mo = ["onClick"], Eo = /* @__PURE__ */ re({
|
|
381
383
|
inheritAttrs: !1,
|
|
382
384
|
__name: "MazSelect",
|
|
383
385
|
props: {
|
|
@@ -400,119 +402,120 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
400
402
|
open: { type: Boolean },
|
|
401
403
|
multiple: { type: Boolean },
|
|
402
404
|
required: { type: Boolean },
|
|
403
|
-
disabled: { type: Boolean }
|
|
405
|
+
disabled: { type: Boolean },
|
|
406
|
+
block: { type: Boolean }
|
|
404
407
|
},
|
|
405
408
|
emits: ["close", "open", "blur", "focus", "change", "update:model-value", "selected-option"],
|
|
406
|
-
setup(t, { emit:
|
|
409
|
+
setup(t, { emit: l }) {
|
|
407
410
|
ro((e) => ({
|
|
408
|
-
"
|
|
409
|
-
|
|
410
|
-
"
|
|
411
|
+
"2223ba14": g.value,
|
|
412
|
+
"619dedd3": M.value,
|
|
413
|
+
"72c218fb": d.value
|
|
411
414
|
}));
|
|
412
|
-
const o = U(() => import("./MazCheckbox-
|
|
413
|
-
() => ["black", "transparent", "white"].includes(
|
|
415
|
+
const o = U(() => import("./MazCheckbox-CXVe5vda.mjs")), c = U(() => import("./magnifying-glass-DZGg7953.mjs")), m = U(() => import("./chevron-down-CzMH-gFW.mjs")), f = U(() => import("./no-symbol-QAqP9IlR.mjs")), n = t, i = l, k = I(!1), h = I(), B = v(
|
|
416
|
+
() => ["black", "transparent", "white"].includes(n.color)
|
|
414
417
|
), M = v(
|
|
415
|
-
() => B.value ? "var(--maz-color-black)" : `var(--maz-color-${
|
|
418
|
+
() => B.value ? "var(--maz-color-black)" : `var(--maz-color-${n.color}-800)`
|
|
416
419
|
), d = v(
|
|
417
|
-
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${
|
|
420
|
+
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${n.color}-100)`
|
|
418
421
|
), g = v(
|
|
419
|
-
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${
|
|
420
|
-
), y = v(() =>
|
|
422
|
+
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${n.color}-200)`
|
|
423
|
+
), y = v(() => k.value || n.open), F = ke({
|
|
421
424
|
componentName: "MazSelect",
|
|
422
|
-
providedId:
|
|
425
|
+
providedId: n.id
|
|
423
426
|
});
|
|
424
427
|
function z(e) {
|
|
425
428
|
return {
|
|
426
|
-
[
|
|
427
|
-
[
|
|
428
|
-
[
|
|
429
|
+
[n.optionValueKey]: e,
|
|
430
|
+
[n.optionLabelKey]: e,
|
|
431
|
+
[n.optionInputValueKey]: e
|
|
429
432
|
};
|
|
430
433
|
}
|
|
431
|
-
function
|
|
434
|
+
function $(e) {
|
|
432
435
|
return {
|
|
433
436
|
...e,
|
|
434
|
-
[
|
|
435
|
-
[
|
|
436
|
-
[
|
|
437
|
+
[n.optionValueKey]: e[n.optionValueKey],
|
|
438
|
+
[n.optionLabelKey]: e[n.optionLabelKey],
|
|
439
|
+
[n.optionInputValueKey]: e[n.optionInputValueKey]
|
|
437
440
|
};
|
|
438
441
|
}
|
|
439
|
-
const
|
|
442
|
+
const a = v(() => {
|
|
440
443
|
var s;
|
|
441
444
|
const e = [];
|
|
442
|
-
if (!((s =
|
|
445
|
+
if (!((s = n.options) != null && s.length))
|
|
443
446
|
return [];
|
|
444
|
-
for (const u of
|
|
447
|
+
for (const u of n.options)
|
|
445
448
|
typeof u == "string" || typeof u == "number" || typeof u == "boolean" ? e.push(z(u)) : "options" in u && Array.isArray(u.options) ? e.push(
|
|
446
449
|
{ label: u.label, isOptGroup: !0 },
|
|
447
450
|
...u.options.map(
|
|
448
|
-
(p) => typeof p == "string" || typeof p == "number" || typeof p == "boolean" ? z(p) :
|
|
451
|
+
(p) => typeof p == "string" || typeof p == "number" || typeof p == "boolean" ? z(p) : $(p)
|
|
449
452
|
)
|
|
450
|
-
) : e.push(
|
|
453
|
+
) : e.push($(u));
|
|
451
454
|
return e;
|
|
452
|
-
}),
|
|
455
|
+
}), S = v(
|
|
453
456
|
() => {
|
|
454
457
|
var e;
|
|
455
|
-
return ((e =
|
|
458
|
+
return ((e = a.value) == null ? void 0 : e.filter((s) => n.multiple ? Array.isArray(n.modelValue) ? n.modelValue.includes(s[n.optionValueKey]) && !O(s[n.optionValueKey]) : !1 : n.modelValue === s[n.optionValueKey] && !O(s[n.optionValueKey]))) ?? [];
|
|
456
459
|
}
|
|
457
460
|
);
|
|
458
461
|
so(() => {
|
|
459
462
|
var e;
|
|
460
|
-
(e =
|
|
463
|
+
(e = n.options) != null && e.length || console.warn("[maz-ui](MazSelect) you must provide options"), ve();
|
|
461
464
|
});
|
|
462
|
-
const Z =
|
|
465
|
+
const Z = I(), N = I(), ue = I(), ie = I(), O = (e) => e == null;
|
|
463
466
|
function te(e) {
|
|
464
467
|
var u;
|
|
465
|
-
return (((u =
|
|
466
|
-
(p) => p[
|
|
467
|
-
)) ?? !1) && !O(e[
|
|
468
|
+
return (((u = S.value) == null ? void 0 : u.some(
|
|
469
|
+
(p) => p[n.optionValueKey] === e[n.optionValueKey]
|
|
470
|
+
)) ?? !1) && !O(e[n.optionValueKey]);
|
|
468
471
|
}
|
|
469
472
|
const fe = v(() => {
|
|
470
473
|
var s;
|
|
471
|
-
if (
|
|
472
|
-
return
|
|
474
|
+
if (n.multiple && n.modelValue && Array.isArray(n.modelValue))
|
|
475
|
+
return n.modelValue.map(
|
|
473
476
|
(u) => {
|
|
474
477
|
var p, w;
|
|
475
|
-
return (w = (p =
|
|
478
|
+
return (w = (p = a.value) == null ? void 0 : p.find((A) => A[n.optionValueKey] === u)) == null ? void 0 : w[n.optionInputValueKey];
|
|
476
479
|
}
|
|
477
480
|
).join(", ");
|
|
478
|
-
const e = (s =
|
|
479
|
-
(u) => u[
|
|
481
|
+
const e = (s = a.value) == null ? void 0 : s.find(
|
|
482
|
+
(u) => u[n.optionValueKey] === n.modelValue
|
|
480
483
|
);
|
|
481
|
-
return O(
|
|
484
|
+
return O(n.modelValue) || e == null ? void 0 : e[n.optionInputValueKey];
|
|
482
485
|
}), me = v(
|
|
483
|
-
() =>
|
|
484
|
-
), j =
|
|
486
|
+
() => n.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
487
|
+
), j = I(""), r = I("");
|
|
485
488
|
function L(e) {
|
|
486
489
|
return e.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[^\dA-Za-z\u0400-\u04FF]/g, "");
|
|
487
490
|
}
|
|
488
491
|
const Y = (e, s) => s && e && L(e.toString().toLocaleLowerCase().trim()).includes(
|
|
489
492
|
L(s.toLocaleLowerCase().trim())
|
|
490
493
|
);
|
|
491
|
-
function
|
|
494
|
+
function Se(e) {
|
|
492
495
|
var s;
|
|
493
|
-
return e ? (s =
|
|
494
|
-
const p = u[
|
|
496
|
+
return e ? (s = a.value) == null ? void 0 : s.filter((u) => {
|
|
497
|
+
const p = u[n.optionLabelKey], w = u[n.optionValueKey], A = u[n.optionInputValueKey];
|
|
495
498
|
return Y(p, e) || Y(A, e) || Y(w, e) || typeof p == "string" && ge(p, e).isMatching.value || typeof A == "string" && ge(A, e).isMatching.value || typeof w == "string" && ge(w, e).isMatching.value;
|
|
496
|
-
}) :
|
|
499
|
+
}) : a.value;
|
|
497
500
|
}
|
|
498
|
-
const T = v(() =>
|
|
499
|
-
async function
|
|
501
|
+
const T = v(() => Se(j.value));
|
|
502
|
+
async function le(e) {
|
|
500
503
|
var s;
|
|
501
504
|
if (y.value) {
|
|
502
505
|
if (e && ("relatedTarget" in e && ((s = Z.value) != null && s.contains(e.relatedTarget)) || e.type === "keydown"))
|
|
503
506
|
return e.preventDefault();
|
|
504
|
-
await ee(),
|
|
507
|
+
await ee(), k.value = !1, h.value = 0, i("close", e);
|
|
505
508
|
}
|
|
506
509
|
}
|
|
507
|
-
async function
|
|
508
|
-
|
|
510
|
+
async function ne(e) {
|
|
511
|
+
n.disabled || y.value || (e == null || e.preventDefault(), k.value = !0, await ye(), i("focus", e), i("open", k.value));
|
|
509
512
|
}
|
|
510
|
-
function
|
|
513
|
+
function Be() {
|
|
511
514
|
var e, s;
|
|
512
515
|
(s = ((e = N.value) == null ? void 0 : e.$el).querySelector("input")) == null || s.focus();
|
|
513
516
|
}
|
|
514
517
|
function Ze(e) {
|
|
515
|
-
|
|
518
|
+
k.value ? le(e) : Be();
|
|
516
519
|
}
|
|
517
520
|
function Xe(e) {
|
|
518
521
|
var s, u;
|
|
@@ -520,33 +523,33 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
520
523
|
}
|
|
521
524
|
function xe(e) {
|
|
522
525
|
var u;
|
|
523
|
-
e === "Backspace" &&
|
|
524
|
-
const s =
|
|
526
|
+
e === "Backspace" && r.value.length > 0 ? r.value = r.value.slice(0, -1) : r.value += e;
|
|
527
|
+
const s = Se(r.value);
|
|
525
528
|
s != null && s.length && (h.value = (u = T.value) == null ? void 0 : u.findIndex(
|
|
526
|
-
(p) => p[
|
|
529
|
+
(p) => p[n.optionValueKey] === s[0][n.optionValueKey]
|
|
527
530
|
), typeof h.value == "number" && h.value >= 0 && ye(h.value)), ko(() => {
|
|
528
|
-
|
|
531
|
+
r.value = "";
|
|
529
532
|
}, 1e3);
|
|
530
533
|
}
|
|
531
534
|
const _e = (e) => {
|
|
532
535
|
const s = e.key;
|
|
533
|
-
/^[\dA-Za-z\u0400-\u04FF]$/.test(s) ? (e.preventDefault(),
|
|
534
|
-
},
|
|
536
|
+
/^[\dA-Za-z\u0400-\u04FF]$/.test(s) ? (e.preventDefault(), ne(e), n.search ? Xe(s) : xe(s)) : $e(e);
|
|
537
|
+
}, $e = (e) => {
|
|
535
538
|
const s = e.code, u = ["ArrowUp", "ArrowDown"].includes(s), p = ["Enter", "Space"].includes(s), w = s === "Escape" && y.value;
|
|
536
|
-
u ? eo(e, h.value) : p ? oo(e, h.value) : w &&
|
|
539
|
+
u ? eo(e, h.value) : p ? oo(e, h.value) : w && le();
|
|
537
540
|
}, eo = (e, s) => {
|
|
538
541
|
var w;
|
|
539
542
|
e.preventDefault();
|
|
540
543
|
const u = e.code;
|
|
541
|
-
y.value ||
|
|
544
|
+
y.value || ne(e);
|
|
542
545
|
const p = (w = T.value) == null ? void 0 : w.length;
|
|
543
546
|
p && (typeof s == "number" ? s === p - 1 && u === "ArrowDown" ? h.value = 0 : s === 0 && u === "ArrowUp" ? h.value = p - 1 : h.value = u === "ArrowDown" ? s + 1 : s - 1 : h.value = u === "ArrowDown" ? 0 : p - 1, ye(h.value));
|
|
544
547
|
}, oo = (e, s) => {
|
|
545
548
|
var p, w, A;
|
|
546
549
|
if (e.preventDefault(), !y.value)
|
|
547
|
-
return
|
|
550
|
+
return ne(e);
|
|
548
551
|
const u = s ? ((p = T.value) == null ? void 0 : p[s]) ?? ((w = T.value) == null ? void 0 : w[0]) : (A = T.value) == null ? void 0 : A[0];
|
|
549
|
-
O(u) ||
|
|
552
|
+
O(u) || Pe(u);
|
|
550
553
|
};
|
|
551
554
|
async function ye(e) {
|
|
552
555
|
var u, p;
|
|
@@ -562,48 +565,53 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
562
565
|
var u;
|
|
563
566
|
const s = (u = T.value) == null ? void 0 : u.findIndex((p) => {
|
|
564
567
|
var w, A;
|
|
565
|
-
return
|
|
568
|
+
return n.multiple && Array.isArray(n.modelValue) ? e ? e[n.optionValueKey] === p[n.optionValueKey] : [...n.modelValue].reverse()[0] === p[n.optionValueKey] : ((A = (w = S.value) == null ? void 0 : w[0]) == null ? void 0 : A[n.optionValueKey]) === p[n.optionValueKey];
|
|
566
569
|
});
|
|
567
570
|
h.value = s && s >= 0 ? s : 0;
|
|
568
571
|
}
|
|
569
|
-
const
|
|
572
|
+
const Pe = (e, s = !0) => {
|
|
570
573
|
var A;
|
|
571
|
-
s && !
|
|
572
|
-
const u = (A =
|
|
573
|
-
(X) => X[
|
|
574
|
+
s && !n.multiple && ee(() => le()), j.value = "";
|
|
575
|
+
const u = (A = S.value) == null ? void 0 : A.some(
|
|
576
|
+
(X) => X[n.optionValueKey] === e[n.optionValueKey]
|
|
574
577
|
);
|
|
575
|
-
let p =
|
|
576
|
-
u &&
|
|
577
|
-
(X) => X[
|
|
578
|
-
) :
|
|
579
|
-
const w = p.map((X) => X[
|
|
580
|
-
i("update:model-value",
|
|
578
|
+
let p = S.value;
|
|
579
|
+
u && n.multiple ? p = p == null ? void 0 : p.filter(
|
|
580
|
+
(X) => X[n.optionValueKey] !== e[n.optionValueKey]
|
|
581
|
+
) : n.multiple ? p.push(e) : p = [e];
|
|
582
|
+
const w = p.map((X) => X[n.optionValueKey]);
|
|
583
|
+
i("update:model-value", n.multiple ? w : w[0]), i("selected-option", e), ve(e), Be();
|
|
581
584
|
};
|
|
582
|
-
return (e, s) => Ne((C(),
|
|
585
|
+
return (e, s) => Ne((C(), P(
|
|
583
586
|
"div",
|
|
584
587
|
{
|
|
585
588
|
ref_key: "mazSelectElement",
|
|
586
589
|
ref: Z,
|
|
587
|
-
class: E(["m-select", [
|
|
590
|
+
class: E(["m-select", [
|
|
591
|
+
{ "--is-open": y.value, "--disabled": e.disabled, "--block": e.block },
|
|
592
|
+
n.class,
|
|
593
|
+
`--${e.size}`
|
|
594
|
+
]]),
|
|
588
595
|
style: _(e.style)
|
|
589
596
|
},
|
|
590
597
|
[
|
|
591
|
-
q(
|
|
592
|
-
id: b(
|
|
598
|
+
q(Ve, pe({
|
|
599
|
+
id: b(F),
|
|
593
600
|
ref_key: "mazInputComponent",
|
|
594
601
|
ref: N,
|
|
595
602
|
class: "m-select-input"
|
|
596
603
|
}, e.$attrs, {
|
|
597
604
|
required: e.required,
|
|
598
|
-
"border-active":
|
|
605
|
+
"border-active": k.value,
|
|
599
606
|
color: e.color,
|
|
600
607
|
"model-value": fe.value,
|
|
601
608
|
autocomplete: "off",
|
|
602
609
|
size: e.size,
|
|
610
|
+
block: "",
|
|
603
611
|
disabled: e.disabled,
|
|
604
|
-
onFocus: x(
|
|
605
|
-
onClick: x(
|
|
606
|
-
onBlur: x(
|
|
612
|
+
onFocus: x(ne, ["prevent", "stop"]),
|
|
613
|
+
onClick: x(ne, ["prevent", "stop"]),
|
|
614
|
+
onBlur: x(le, ["prevent", "stop"]),
|
|
607
615
|
onChange: s[0] || (s[0] = (u) => i("change", u)),
|
|
608
616
|
onKeydown: _e
|
|
609
617
|
}), {
|
|
@@ -616,14 +624,14 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
616
624
|
onClick: x(Ze, ["stop"])
|
|
617
625
|
}, [
|
|
618
626
|
q(b(m), { class: "m-select-chevron maz-text-xl" })
|
|
619
|
-
], 8,
|
|
627
|
+
], 8, Po)
|
|
620
628
|
]),
|
|
621
629
|
_: 1
|
|
622
630
|
/* STABLE */
|
|
623
631
|
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "disabled"]),
|
|
624
632
|
q(uo, { name: me.value }, {
|
|
625
633
|
default: ae(() => [
|
|
626
|
-
y.value ? (C(),
|
|
634
|
+
y.value ? (C(), P(
|
|
627
635
|
"div",
|
|
628
636
|
{
|
|
629
637
|
key: 0,
|
|
@@ -641,7 +649,7 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
641
649
|
})
|
|
642
650
|
},
|
|
643
651
|
[
|
|
644
|
-
e.search ? (C(), K(
|
|
652
|
+
e.search ? (C(), K(Ve, {
|
|
645
653
|
key: 0,
|
|
646
654
|
ref_key: "searchInputComponent",
|
|
647
655
|
ref: ue,
|
|
@@ -658,21 +666,21 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
658
666
|
tabindex: "-1",
|
|
659
667
|
class: "m-select-list__search-input maz-flex-none",
|
|
660
668
|
"left-icon": b(c),
|
|
661
|
-
onKeydown:
|
|
669
|
+
onKeydown: $e
|
|
662
670
|
}, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) : V("v-if", !0),
|
|
663
671
|
V(`
|
|
664
672
|
@slot No results slot - Displayed when no results corresponding with search query
|
|
665
673
|
`),
|
|
666
674
|
!T.value || T.value.length <= 0 ? H(e.$slots, "no-results", { key: 1 }, () => [
|
|
667
|
-
R("span",
|
|
675
|
+
R("span", Fo, [
|
|
668
676
|
q(b(f), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
669
677
|
])
|
|
670
|
-
], !0) : (C(),
|
|
671
|
-
(C(!0),
|
|
672
|
-
|
|
678
|
+
], !0) : (C(), P("div", Ao, [
|
|
679
|
+
(C(!0), P(
|
|
680
|
+
Ae,
|
|
673
681
|
null,
|
|
674
|
-
io(T.value, (u, p) => (C(),
|
|
675
|
-
|
|
682
|
+
io(T.value, (u, p) => (C(), P(
|
|
683
|
+
Ae,
|
|
676
684
|
{ key: p },
|
|
677
685
|
[
|
|
678
686
|
V(`
|
|
@@ -685,12 +693,12 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
685
693
|
}, () => [
|
|
686
694
|
R(
|
|
687
695
|
"span",
|
|
688
|
-
|
|
696
|
+
Lo,
|
|
689
697
|
G(u.label),
|
|
690
698
|
1
|
|
691
699
|
/* TEXT */
|
|
692
700
|
)
|
|
693
|
-
], !0) : (C(),
|
|
701
|
+
], !0) : (C(), P("button", {
|
|
694
702
|
key: 1,
|
|
695
703
|
tabindex: "-1",
|
|
696
704
|
type: "button",
|
|
@@ -702,7 +710,7 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
702
710
|
}
|
|
703
711
|
]]),
|
|
704
712
|
style: _(e.itemHeight ? { height: `${e.itemHeight}px` } : void 0),
|
|
705
|
-
onClick: x((w) =>
|
|
713
|
+
onClick: x((w) => Pe(u), ["prevent", "stop"])
|
|
706
714
|
}, [
|
|
707
715
|
e.multiple ? (C(), K(b(o), {
|
|
708
716
|
key: 0,
|
|
@@ -728,7 +736,7 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
728
736
|
/* TEXT */
|
|
729
737
|
)
|
|
730
738
|
], !0)
|
|
731
|
-
], 14,
|
|
739
|
+
], 14, Mo))
|
|
732
740
|
],
|
|
733
741
|
64
|
|
734
742
|
/* STABLE_FRAGMENT */
|
|
@@ -749,58 +757,58 @@ const Fo = ["aria-label"], Ao = { class: "m-select-list__no-results" }, Lo = {
|
|
|
749
757
|
6
|
|
750
758
|
/* CLASS, STYLE */
|
|
751
759
|
)), [
|
|
752
|
-
[b(
|
|
760
|
+
[b(So), le]
|
|
753
761
|
]);
|
|
754
762
|
}
|
|
755
|
-
}),
|
|
763
|
+
}), Ko = /* @__PURE__ */ se(Eo, [["__scopeId", "data-v-7825a2da"]]);
|
|
756
764
|
function Ye(t) {
|
|
757
765
|
return !!t;
|
|
758
766
|
}
|
|
759
767
|
function Ee(t) {
|
|
760
|
-
return [...t].map((
|
|
761
|
-
const o =
|
|
768
|
+
return [...t].map((l) => {
|
|
769
|
+
const o = l.codePointAt(0);
|
|
762
770
|
return o ? o % 32 + 127461 : void 0;
|
|
763
|
-
}).filter(Ye).map((
|
|
771
|
+
}).filter(Ye).map((l) => String.fromCodePoint(l)).join("");
|
|
764
772
|
}
|
|
765
|
-
const J =
|
|
766
|
-
async function
|
|
773
|
+
const J = I();
|
|
774
|
+
async function No() {
|
|
767
775
|
if (J.value)
|
|
768
776
|
return J.value;
|
|
769
777
|
const { default: t } = await import("./examples.mobile.json-zD8w3Qhl.mjs");
|
|
770
778
|
return J.value = t, J.value;
|
|
771
779
|
}
|
|
772
|
-
function
|
|
773
|
-
return de(t) === de(
|
|
780
|
+
function To(t, l) {
|
|
781
|
+
return de(t) === de(l);
|
|
774
782
|
}
|
|
775
|
-
function
|
|
776
|
-
var
|
|
783
|
+
function Do(t) {
|
|
784
|
+
var l;
|
|
777
785
|
try {
|
|
778
|
-
return J.value && t ? (
|
|
786
|
+
return J.value && t ? (l = fo(t, J.value)) == null ? void 0 : l.formatNational() : void 0;
|
|
779
787
|
} catch (o) {
|
|
780
788
|
console.error(`[maz-ui](MazPhoneNumberInput) ${o}`);
|
|
781
789
|
}
|
|
782
790
|
}
|
|
783
|
-
function
|
|
791
|
+
function Uo(t) {
|
|
784
792
|
try {
|
|
785
|
-
const
|
|
786
|
-
return
|
|
787
|
-
} catch (
|
|
788
|
-
return console.error(`[maz-ui](MazPhoneNumberInput) ${
|
|
793
|
+
const l = mo(t);
|
|
794
|
+
return l || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${t}" is not available`), !1);
|
|
795
|
+
} catch (l) {
|
|
796
|
+
return console.error(`[maz-ui](MazPhoneNumberInput) ${l}`), !1;
|
|
789
797
|
}
|
|
790
798
|
}
|
|
791
|
-
function
|
|
799
|
+
function Ro({
|
|
792
800
|
phoneNumber: t,
|
|
793
|
-
countryCode:
|
|
801
|
+
countryCode: l
|
|
794
802
|
}) {
|
|
795
803
|
try {
|
|
796
804
|
if (!t)
|
|
797
805
|
return {
|
|
798
806
|
isValid: !1,
|
|
799
|
-
countryCode:
|
|
807
|
+
countryCode: l
|
|
800
808
|
};
|
|
801
|
-
const o =
|
|
809
|
+
const o = yo(t, l);
|
|
802
810
|
return {
|
|
803
|
-
countryCode: (o == null ? void 0 : o.country) ??
|
|
811
|
+
countryCode: (o == null ? void 0 : o.country) ?? l,
|
|
804
812
|
isValid: (o == null ? void 0 : o.isValid()) ?? !1,
|
|
805
813
|
isPossible: o == null ? void 0 : o.isPossible(),
|
|
806
814
|
countryCallingCode: o == null ? void 0 : o.countryCallingCode,
|
|
@@ -817,9 +825,9 @@ function Oo({
|
|
|
817
825
|
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${o}`);
|
|
818
826
|
}
|
|
819
827
|
}
|
|
820
|
-
function
|
|
828
|
+
function Oo(t, l) {
|
|
821
829
|
try {
|
|
822
|
-
return
|
|
830
|
+
return l ? new vo(t).input(l) : "";
|
|
823
831
|
} catch (o) {
|
|
824
832
|
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${o}`);
|
|
825
833
|
}
|
|
@@ -827,28 +835,28 @@ function Yo(t, n) {
|
|
|
827
835
|
function qe() {
|
|
828
836
|
return {
|
|
829
837
|
examples: J,
|
|
830
|
-
getAsYouTypeFormat:
|
|
831
|
-
getPhoneNumberResults:
|
|
832
|
-
loadPhoneNumberExamplesFile:
|
|
833
|
-
getPhoneNumberExample:
|
|
834
|
-
isSameCountryCallingCode:
|
|
835
|
-
isCountryAvailable:
|
|
838
|
+
getAsYouTypeFormat: Oo,
|
|
839
|
+
getPhoneNumberResults: Ro,
|
|
840
|
+
loadPhoneNumberExamplesFile: No,
|
|
841
|
+
getPhoneNumberExample: Do,
|
|
842
|
+
isSameCountryCallingCode: To,
|
|
843
|
+
isCountryAvailable: Uo,
|
|
836
844
|
getCountries: Te,
|
|
837
845
|
getCountryCallingCode: de
|
|
838
846
|
};
|
|
839
847
|
}
|
|
840
|
-
const { isCountryAvailable:
|
|
848
|
+
const { isCountryAvailable: Yo, getPhoneNumberResults: He, getAsYouTypeFormat: qo } = qe(), oe = I(""), W = I(), Q = co({
|
|
841
849
|
start: 0,
|
|
842
850
|
end: 0,
|
|
843
851
|
cursorAtEnd: !0
|
|
844
|
-
}), D =
|
|
852
|
+
}), D = I({
|
|
845
853
|
isValid: !1,
|
|
846
854
|
countryCode: void 0
|
|
847
855
|
});
|
|
848
|
-
async function
|
|
856
|
+
async function Ho() {
|
|
849
857
|
try {
|
|
850
|
-
const t = await fetch("https://ipwho.is"), { country_code:
|
|
851
|
-
return
|
|
858
|
+
const t = await fetch("https://ipwho.is"), { country_code: l } = await t.json();
|
|
859
|
+
return l;
|
|
852
860
|
} catch (t) {
|
|
853
861
|
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${t}`);
|
|
854
862
|
}
|
|
@@ -856,16 +864,16 @@ async function Wo() {
|
|
|
856
864
|
function We(t) {
|
|
857
865
|
if (!t)
|
|
858
866
|
return "";
|
|
859
|
-
const
|
|
860
|
-
return t.replaceAll(
|
|
867
|
+
const l = new RegExp(/[^\d ()+-]/g);
|
|
868
|
+
return t.replaceAll(l, "").trim();
|
|
861
869
|
}
|
|
862
|
-
function
|
|
870
|
+
function Wo(t, l) {
|
|
863
871
|
const o = t == null ? void 0 : t.$el.querySelector("input");
|
|
864
|
-
Q.start = o == null ? void 0 : o.selectionStart, Q.end = o == null ? void 0 : o.selectionEnd, Q.cursorAtEnd =
|
|
872
|
+
Q.start = o == null ? void 0 : o.selectionStart, Q.end = o == null ? void 0 : o.selectionEnd, Q.cursorAtEnd = l && typeof Q.start == "number" && l.length > 0 ? Q.start >= l.length : !0;
|
|
865
873
|
}
|
|
866
874
|
function je(t) {
|
|
867
875
|
if (t) {
|
|
868
|
-
if (!
|
|
876
|
+
if (!Yo(t)) {
|
|
869
877
|
W.value = void 0;
|
|
870
878
|
return;
|
|
871
879
|
}
|
|
@@ -874,7 +882,7 @@ function je(t) {
|
|
|
874
882
|
}
|
|
875
883
|
function Qe({
|
|
876
884
|
newPhoneNumber: t,
|
|
877
|
-
autoFormat:
|
|
885
|
+
autoFormat: l,
|
|
878
886
|
noFormattingAsYouType: o,
|
|
879
887
|
updateResults: c = !0
|
|
880
888
|
}) {
|
|
@@ -882,23 +890,23 @@ function Qe({
|
|
|
882
890
|
if (c && (D.value = He({
|
|
883
891
|
phoneNumber: m,
|
|
884
892
|
countryCode: W.value
|
|
885
|
-
})), D.value.isValid && D.value.formatNational &&
|
|
893
|
+
})), D.value.isValid && D.value.formatNational && l)
|
|
886
894
|
oe.value = D.value.formatNational;
|
|
887
895
|
else if (Q.cursorAtEnd && !o) {
|
|
888
|
-
const f =
|
|
896
|
+
const f = qo(W.value, m);
|
|
889
897
|
oe.value = f;
|
|
890
898
|
} else
|
|
891
899
|
oe.value = m;
|
|
892
900
|
D.value.countryCode && D.value.countryCode !== W.value && Ge({
|
|
893
901
|
countryCode: D.value.countryCode,
|
|
894
|
-
autoFormat:
|
|
902
|
+
autoFormat: l,
|
|
895
903
|
noFormattingAsYouType: o,
|
|
896
904
|
updateResults: !1
|
|
897
905
|
});
|
|
898
906
|
}
|
|
899
907
|
function Ge({
|
|
900
908
|
countryCode: t,
|
|
901
|
-
autoFormat:
|
|
909
|
+
autoFormat: l,
|
|
902
910
|
noFormattingAsYouType: o,
|
|
903
911
|
updateResults: c = !0
|
|
904
912
|
}) {
|
|
@@ -911,7 +919,7 @@ function Ge({
|
|
|
911
919
|
countryCode: t
|
|
912
920
|
})), Qe({
|
|
913
921
|
newPhoneNumber: oe.value,
|
|
914
|
-
autoFormat:
|
|
922
|
+
autoFormat: l,
|
|
915
923
|
noFormattingAsYouType: o,
|
|
916
924
|
updateResults: !1
|
|
917
925
|
});
|
|
@@ -922,29 +930,29 @@ function Je() {
|
|
|
922
930
|
const t = window.navigator.language;
|
|
923
931
|
if (!t)
|
|
924
932
|
return;
|
|
925
|
-
let
|
|
926
|
-
return
|
|
927
|
-
locale:
|
|
933
|
+
let l = t.slice(3, 7).toUpperCase();
|
|
934
|
+
return l === "" && (l = t.slice(0, 2).toUpperCase()), l === "EN" && (l = "US"), l === "JA" && (l = "JP"), {
|
|
935
|
+
locale: l,
|
|
928
936
|
browserLocale: t
|
|
929
937
|
};
|
|
930
938
|
}
|
|
931
939
|
let ze, Ke;
|
|
932
|
-
function
|
|
933
|
-
return o != null && o[
|
|
940
|
+
function jo(t, l, o) {
|
|
941
|
+
return o != null && o[l] ? o[l] : ((Ke !== t || !ze) && (Ke = t, ze = new Intl.DisplayNames([t], { type: "region" })), ze.of(l));
|
|
934
942
|
}
|
|
935
|
-
function
|
|
943
|
+
function Qo(t, l) {
|
|
936
944
|
var m;
|
|
937
945
|
const o = [], c = Te();
|
|
938
946
|
t = t ?? ((m = Je()) == null ? void 0 : m.browserLocale) ?? "en-US";
|
|
939
947
|
for (const f of c) {
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
948
|
+
const n = jo(t, f, l);
|
|
949
|
+
if (n)
|
|
942
950
|
try {
|
|
943
951
|
const i = de(f);
|
|
944
952
|
o.push({
|
|
945
953
|
iso2: f,
|
|
946
954
|
dialCode: i,
|
|
947
|
-
name:
|
|
955
|
+
name: n
|
|
948
956
|
});
|
|
949
957
|
} catch (i) {
|
|
950
958
|
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${i}`);
|
|
@@ -957,21 +965,21 @@ function Ie() {
|
|
|
957
965
|
setSelectedCountry: je,
|
|
958
966
|
results: D,
|
|
959
967
|
sanitizePhoneNumber: We,
|
|
960
|
-
fetchCountryCode:
|
|
968
|
+
fetchCountryCode: Ho,
|
|
961
969
|
selectedCountry: W,
|
|
962
970
|
phoneNumber: oe,
|
|
963
971
|
selectionRange: Q,
|
|
964
|
-
saveCursorPosition:
|
|
972
|
+
saveCursorPosition: Wo,
|
|
965
973
|
onPhoneNumberChanged: Qe,
|
|
966
974
|
onCountryChanged: Ge,
|
|
967
975
|
getBrowserLocale: Je,
|
|
968
|
-
getCountriesList:
|
|
976
|
+
getCountriesList: Qo
|
|
969
977
|
};
|
|
970
978
|
}
|
|
971
|
-
const
|
|
979
|
+
const Go = {
|
|
972
980
|
key: 0,
|
|
973
981
|
class: "maz-text-lg"
|
|
974
|
-
},
|
|
982
|
+
}, Jo = /* @__PURE__ */ re({
|
|
975
983
|
__name: "CountrySelector",
|
|
976
984
|
props: {
|
|
977
985
|
style: { default: void 0 },
|
|
@@ -998,27 +1006,27 @@ const Jo = {
|
|
|
998
1006
|
},
|
|
999
1007
|
emits: ["update:model-value"],
|
|
1000
1008
|
setup(t) {
|
|
1001
|
-
const
|
|
1009
|
+
const l = t, o = I(), { phoneNumber: c, getCountriesList: m } = Ie(), f = v(() => m(l.countryLocale, l.customCountriesList)), n = v(() => {
|
|
1002
1010
|
var d;
|
|
1003
1011
|
return (d = f.value) == null ? void 0 : d.filter((g) => {
|
|
1004
1012
|
var y;
|
|
1005
|
-
return !((y =
|
|
1013
|
+
return !((y = l.ignoredCountries) != null && y.includes(g.iso2));
|
|
1006
1014
|
});
|
|
1007
1015
|
}), i = v(() => {
|
|
1008
|
-
const d =
|
|
1016
|
+
const d = l.onlyCountries || l.preferredCountries;
|
|
1009
1017
|
return d == null ? void 0 : d.map(
|
|
1010
1018
|
(g) => {
|
|
1011
1019
|
var y;
|
|
1012
|
-
return (y =
|
|
1020
|
+
return (y = n.value) == null ? void 0 : y.find((F) => F.iso2.includes(g));
|
|
1013
1021
|
}
|
|
1014
1022
|
);
|
|
1015
|
-
}),
|
|
1023
|
+
}), k = v(() => {
|
|
1016
1024
|
var d;
|
|
1017
|
-
return (d =
|
|
1025
|
+
return (d = n.value) == null ? void 0 : d.filter((g) => {
|
|
1018
1026
|
var y;
|
|
1019
|
-
return !((y =
|
|
1027
|
+
return !((y = l.preferredCountries) != null && y.includes(g.iso2));
|
|
1020
1028
|
});
|
|
1021
|
-
}), h = v(() =>
|
|
1029
|
+
}), h = v(() => l.preferredCountries ? [...i.value ?? [], ...k.value ?? []] : l.onlyCountries ? i.value : n.value), B = v(() => {
|
|
1022
1030
|
var d;
|
|
1023
1031
|
return (d = h.value) == null ? void 0 : d.map((g) => g ? {
|
|
1024
1032
|
...g,
|
|
@@ -1029,14 +1037,14 @@ const Jo = {
|
|
|
1029
1037
|
var d, g;
|
|
1030
1038
|
(g = (d = o.value) == null ? void 0 : d.$el.querySelector("input")) == null || g.focus();
|
|
1031
1039
|
}
|
|
1032
|
-
return (d, g) => (C(),
|
|
1040
|
+
return (d, g) => (C(), P(
|
|
1033
1041
|
"div",
|
|
1034
1042
|
{
|
|
1035
|
-
class: E(["m-country-selector", [
|
|
1043
|
+
class: E(["m-country-selector", [l.class, { "--no-flags": d.noFlags }]]),
|
|
1036
1044
|
style: _(d.style)
|
|
1037
1045
|
},
|
|
1038
1046
|
[
|
|
1039
|
-
d.modelValue && !d.noFlags ? (C(),
|
|
1047
|
+
d.modelValue && !d.noFlags ? (C(), P(
|
|
1040
1048
|
"button",
|
|
1041
1049
|
{
|
|
1042
1050
|
key: 0,
|
|
@@ -1063,7 +1071,7 @@ const Jo = {
|
|
|
1063
1071
|
2
|
|
1064
1072
|
/* CLASS */
|
|
1065
1073
|
)) : V("v-if", !0),
|
|
1066
|
-
q(
|
|
1074
|
+
q(Ko, pe({
|
|
1067
1075
|
id: `country-selector-${d.id}`,
|
|
1068
1076
|
ref_key: "CountrySelectorRef",
|
|
1069
1077
|
ref: o,
|
|
@@ -1091,16 +1099,16 @@ const Jo = {
|
|
|
1091
1099
|
},
|
|
1092
1100
|
"onUpdate:modelValue": g[0] || (g[0] = (y) => d.$emit("update:model-value", y))
|
|
1093
1101
|
}), {
|
|
1094
|
-
default: ae(({ option: y, isSelected:
|
|
1102
|
+
default: ae(({ option: y, isSelected: F }) => [
|
|
1095
1103
|
R(
|
|
1096
1104
|
"div",
|
|
1097
1105
|
{
|
|
1098
1106
|
class: E(["m-country-selector__select__item maz-flex maz-items-center maz-gap-1 maz-truncate", {
|
|
1099
|
-
"m-country-selector__select__item--selected":
|
|
1107
|
+
"m-country-selector__select__item--selected": F
|
|
1100
1108
|
}])
|
|
1101
1109
|
},
|
|
1102
1110
|
[
|
|
1103
|
-
!d.noFlags && typeof y.iso2 == "string" ? (C(),
|
|
1111
|
+
!d.noFlags && typeof y.iso2 == "string" ? (C(), P("span", Go, [
|
|
1104
1112
|
V(`
|
|
1105
1113
|
@slot Country list flag
|
|
1106
1114
|
@binding {String} country-code - country code of option - Ex: \`"FR"\`
|
|
@@ -1110,7 +1118,7 @@ const Jo = {
|
|
|
1110
1118
|
H(d.$slots, "country-list-flag", {
|
|
1111
1119
|
countryCode: y.iso2,
|
|
1112
1120
|
option: y,
|
|
1113
|
-
isSelected:
|
|
1121
|
+
isSelected: F
|
|
1114
1122
|
}, () => [
|
|
1115
1123
|
Ce(
|
|
1116
1124
|
G(b(Ee)(y.iso2)),
|
|
@@ -1119,11 +1127,11 @@ const Jo = {
|
|
|
1119
1127
|
)
|
|
1120
1128
|
], !0)
|
|
1121
1129
|
])) : V("v-if", !0),
|
|
1122
|
-
d.showCodeOnList ? (C(),
|
|
1130
|
+
d.showCodeOnList ? (C(), P(
|
|
1123
1131
|
"span",
|
|
1124
1132
|
{
|
|
1125
1133
|
key: 1,
|
|
1126
|
-
class: E(["maz-w-9 maz-flex-none", { "maz-text-muted": !
|
|
1134
|
+
class: E(["maz-w-9 maz-flex-none", { "maz-text-muted": !F }])
|
|
1127
1135
|
},
|
|
1128
1136
|
G(y.dialCode),
|
|
1129
1137
|
3
|
|
@@ -1132,7 +1140,7 @@ const Jo = {
|
|
|
1132
1140
|
R(
|
|
1133
1141
|
"span",
|
|
1134
1142
|
{
|
|
1135
|
-
class: E(["maz-flex-1 maz-truncate", { "maz-font-semibold":
|
|
1143
|
+
class: E(["maz-flex-1 maz-truncate", { "maz-font-semibold": F }])
|
|
1136
1144
|
},
|
|
1137
1145
|
G(y.name),
|
|
1138
1146
|
3
|
|
@@ -1151,9 +1159,9 @@ const Jo = {
|
|
|
1151
1159
|
/* CLASS, STYLE */
|
|
1152
1160
|
));
|
|
1153
1161
|
}
|
|
1154
|
-
}),
|
|
1162
|
+
}), Zo = /* @__PURE__ */ se(Jo, [["__scopeId", "data-v-e21defba"]]), Xo = /* @__PURE__ */ re({
|
|
1155
1163
|
__name: "PhoneInput",
|
|
1156
|
-
props: /* @__PURE__ */
|
|
1164
|
+
props: /* @__PURE__ */ Le({
|
|
1157
1165
|
id: {},
|
|
1158
1166
|
color: {},
|
|
1159
1167
|
size: {},
|
|
@@ -1170,20 +1178,20 @@ const Jo = {
|
|
|
1170
1178
|
modelValue: {},
|
|
1171
1179
|
modelModifiers: {}
|
|
1172
1180
|
}),
|
|
1173
|
-
emits: /* @__PURE__ */
|
|
1174
|
-
setup(t, { emit:
|
|
1175
|
-
const o = t, c =
|
|
1176
|
-
var
|
|
1181
|
+
emits: /* @__PURE__ */ Le(["update:model-value"], ["update:modelValue"]),
|
|
1182
|
+
setup(t, { emit: l }) {
|
|
1183
|
+
const o = t, c = l, m = po(t, "modelValue"), { loadPhoneNumberExamplesFile: f, getPhoneNumberExample: n, examples: i } = qe(), { selectedCountry: k, results: h, saveCursorPosition: B } = Ie(), M = I(!1), d = v(() => {
|
|
1184
|
+
var $;
|
|
1177
1185
|
if (o.label)
|
|
1178
1186
|
return o.label;
|
|
1179
1187
|
const z = o.locales.phoneInput.placeholder;
|
|
1180
1188
|
if (o.noExample || !i.value)
|
|
1181
1189
|
return z;
|
|
1182
1190
|
{
|
|
1183
|
-
const
|
|
1184
|
-
return (
|
|
1191
|
+
const a = n(k.value);
|
|
1192
|
+
return ($ = h.value) != null && $.isValid || !a ? z : `${o.locales.phoneInput.example} ${a}`;
|
|
1185
1193
|
}
|
|
1186
|
-
}), g =
|
|
1194
|
+
}), g = I();
|
|
1187
1195
|
async function y() {
|
|
1188
1196
|
try {
|
|
1189
1197
|
return f();
|
|
@@ -1191,39 +1199,36 @@ const Jo = {
|
|
|
1191
1199
|
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file", z);
|
|
1192
1200
|
}
|
|
1193
1201
|
}
|
|
1194
|
-
async function
|
|
1202
|
+
async function F(z) {
|
|
1195
1203
|
g.value && z && B(g.value, z), await ee(), c("update:model-value", z);
|
|
1196
1204
|
}
|
|
1197
|
-
return
|
|
1205
|
+
return we(() => {
|
|
1198
1206
|
o.noExample || y();
|
|
1199
|
-
}), (z,
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
"onUpdate:modelValue": P
|
|
1223
|
-
}), null, 16, ["id", "model-value", "label", "disabled", "color", "error", "size", "success", "class"]);
|
|
1224
|
-
};
|
|
1207
|
+
}), (z, $) => (C(), K(Ve, pe({
|
|
1208
|
+
id: `phone-number-${z.id}`,
|
|
1209
|
+
ref_key: "PhoneInputRef",
|
|
1210
|
+
ref: g,
|
|
1211
|
+
"model-value": m.value
|
|
1212
|
+
}, z.$attrs, {
|
|
1213
|
+
label: d.value,
|
|
1214
|
+
disabled: z.disabled,
|
|
1215
|
+
color: z.color,
|
|
1216
|
+
error: z.error,
|
|
1217
|
+
size: z.size,
|
|
1218
|
+
success: z.success,
|
|
1219
|
+
type: "tel",
|
|
1220
|
+
inputmode: "tel",
|
|
1221
|
+
class: ["m-phone-input", {
|
|
1222
|
+
"--border-radius": z.hasRadius,
|
|
1223
|
+
"--error": z.error || !b(h).isValid,
|
|
1224
|
+
"--focused": M.value
|
|
1225
|
+
}],
|
|
1226
|
+
onFocus: $[0] || ($[0] = (a) => M.value = !0),
|
|
1227
|
+
onBlur: $[1] || ($[1] = (a) => M.value = !1),
|
|
1228
|
+
"onUpdate:modelValue": $[2] || ($[2] = (a) => F(a))
|
|
1229
|
+
}), null, 16, ["id", "model-value", "label", "disabled", "color", "error", "size", "success", "class"]));
|
|
1225
1230
|
}
|
|
1226
|
-
}),
|
|
1231
|
+
}), xo = /* @__PURE__ */ se(Xo, [["__scopeId", "data-v-e2bf70df"]]), _o = {
|
|
1227
1232
|
countrySelector: {
|
|
1228
1233
|
placeholder: "Country code",
|
|
1229
1234
|
error: "Choose country",
|
|
@@ -1233,7 +1238,7 @@ const Jo = {
|
|
|
1233
1238
|
placeholder: "Phone number",
|
|
1234
1239
|
example: "Example:"
|
|
1235
1240
|
}
|
|
1236
|
-
},
|
|
1241
|
+
}, et = /* @__PURE__ */ re({
|
|
1237
1242
|
inheritAttrs: !1,
|
|
1238
1243
|
__name: "MazPhoneNumberInput",
|
|
1239
1244
|
props: {
|
|
@@ -1269,58 +1274,59 @@ const Jo = {
|
|
|
1269
1274
|
success: { type: Boolean },
|
|
1270
1275
|
error: { type: Boolean },
|
|
1271
1276
|
countrySelectorDisplayName: { type: Boolean },
|
|
1272
|
-
countrySelectorWidth: { default: "9rem" }
|
|
1277
|
+
countrySelectorWidth: { default: "9rem" },
|
|
1278
|
+
block: { type: Boolean }
|
|
1273
1279
|
},
|
|
1274
1280
|
emits: ["update", "data", "country-code", "update:model-value", "update:country-code"],
|
|
1275
|
-
setup(t, { emit:
|
|
1276
|
-
const o =
|
|
1281
|
+
setup(t, { emit: l }) {
|
|
1282
|
+
const o = l, c = t, {
|
|
1277
1283
|
phoneNumber: m,
|
|
1278
1284
|
selectedCountry: f,
|
|
1279
|
-
results:
|
|
1285
|
+
results: n,
|
|
1280
1286
|
fetchCountryCode: i,
|
|
1281
|
-
setSelectedCountry:
|
|
1287
|
+
setSelectedCountry: k,
|
|
1282
1288
|
onPhoneNumberChanged: h,
|
|
1283
1289
|
onCountryChanged: B,
|
|
1284
1290
|
getBrowserLocale: M
|
|
1285
|
-
} = Ie(), d =
|
|
1291
|
+
} = Ie(), d = ke({
|
|
1286
1292
|
componentName: "MazPhoneNumberInput",
|
|
1287
1293
|
providedId: c.id
|
|
1288
1294
|
}), g = v(() => ({
|
|
1289
|
-
...
|
|
1295
|
+
..._o,
|
|
1290
1296
|
...c.translations
|
|
1291
1297
|
}));
|
|
1292
|
-
|
|
1293
|
-
var
|
|
1294
|
-
if (
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1298
|
+
we(async () => {
|
|
1299
|
+
var a;
|
|
1300
|
+
if (k(c.countryCode ?? c.defaultCountryCode), c.fetchCountry && !f.value) {
|
|
1301
|
+
const S = await i();
|
|
1302
|
+
k(S);
|
|
1297
1303
|
}
|
|
1298
1304
|
if (!c.defaultCountryCode && !c.noUseBrowserLocale && !f.value) {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1305
|
+
const S = (a = M()) == null ? void 0 : a.locale;
|
|
1306
|
+
k(S);
|
|
1301
1307
|
}
|
|
1302
1308
|
});
|
|
1303
|
-
const y =
|
|
1304
|
-
function
|
|
1305
|
-
var
|
|
1306
|
-
return (
|
|
1309
|
+
const y = I();
|
|
1310
|
+
function F() {
|
|
1311
|
+
var a;
|
|
1312
|
+
return (a = y.value) == null ? void 0 : a.$el.querySelector("input");
|
|
1307
1313
|
}
|
|
1308
1314
|
async function z() {
|
|
1309
|
-
var
|
|
1310
|
-
await ee(), (
|
|
1315
|
+
var a;
|
|
1316
|
+
await ee(), (a = F()) == null || a.select();
|
|
1311
1317
|
}
|
|
1312
|
-
function
|
|
1318
|
+
function $(a) {
|
|
1313
1319
|
B({
|
|
1314
|
-
countryCode:
|
|
1320
|
+
countryCode: a,
|
|
1315
1321
|
autoFormat: c.autoFormat,
|
|
1316
1322
|
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1317
1323
|
}), z();
|
|
1318
1324
|
}
|
|
1319
1325
|
return he(
|
|
1320
1326
|
() => c.modelValue ?? c.defaultPhoneNumber,
|
|
1321
|
-
(
|
|
1322
|
-
|
|
1323
|
-
newPhoneNumber:
|
|
1327
|
+
(a, S) => {
|
|
1328
|
+
a && a !== S && a !== m.value && h({
|
|
1329
|
+
newPhoneNumber: a,
|
|
1324
1330
|
autoFormat: c.autoFormat,
|
|
1325
1331
|
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1326
1332
|
});
|
|
@@ -1330,9 +1336,9 @@ const Jo = {
|
|
|
1330
1336
|
}
|
|
1331
1337
|
), he(
|
|
1332
1338
|
() => c.countryCode ?? c.defaultCountryCode,
|
|
1333
|
-
(
|
|
1334
|
-
|
|
1335
|
-
countryCode:
|
|
1339
|
+
(a, S) => {
|
|
1340
|
+
a && a !== S && a !== f.value && B({
|
|
1341
|
+
countryCode: a,
|
|
1336
1342
|
autoFormat: c.autoFormat,
|
|
1337
1343
|
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1338
1344
|
});
|
|
@@ -1341,65 +1347,66 @@ const Jo = {
|
|
|
1341
1347
|
immediate: !0
|
|
1342
1348
|
}
|
|
1343
1349
|
), he(
|
|
1344
|
-
|
|
1345
|
-
(
|
|
1346
|
-
o("update",
|
|
1350
|
+
n,
|
|
1351
|
+
(a) => {
|
|
1352
|
+
o("update", a), o("data", a), a.e164 && a.isValid ? o("update:model-value", a.e164) : o("update:model-value", m.value), o("country-code", f.value), o("update:country-code", f.value);
|
|
1347
1353
|
},
|
|
1348
1354
|
{
|
|
1349
1355
|
immediate: !0
|
|
1350
1356
|
}
|
|
1351
|
-
), (
|
|
1357
|
+
), (a, S) => {
|
|
1352
1358
|
var Z;
|
|
1353
|
-
return C(),
|
|
1359
|
+
return C(), P(
|
|
1354
1360
|
"div",
|
|
1355
1361
|
{
|
|
1356
|
-
class: E(["m-phone-number-input", [c.class]]),
|
|
1357
|
-
style: _(
|
|
1362
|
+
class: E(["m-phone-number-input", [c.class, { "--block": a.block }]]),
|
|
1363
|
+
style: _(a.style)
|
|
1358
1364
|
},
|
|
1359
1365
|
[
|
|
1360
|
-
|
|
1366
|
+
a.noCountrySelector ? V("v-if", !0) : (C(), K(Zo, {
|
|
1361
1367
|
key: 0,
|
|
1362
1368
|
id: b(d),
|
|
1363
1369
|
"model-value": b(f),
|
|
1364
|
-
color:
|
|
1365
|
-
size:
|
|
1366
|
-
"country-locale":
|
|
1367
|
-
"country-selector-display-name":
|
|
1368
|
-
"custom-countries-list":
|
|
1369
|
-
"ignored-countries":
|
|
1370
|
-
"list-position":
|
|
1371
|
-
"no-flags":
|
|
1372
|
-
"no-search":
|
|
1373
|
-
error:
|
|
1374
|
-
success:
|
|
1370
|
+
color: a.color,
|
|
1371
|
+
size: a.size,
|
|
1372
|
+
"country-locale": a.countryLocale,
|
|
1373
|
+
"country-selector-display-name": a.countrySelectorDisplayName,
|
|
1374
|
+
"custom-countries-list": a.customCountriesList,
|
|
1375
|
+
"ignored-countries": a.ignoredCountries,
|
|
1376
|
+
"list-position": a.listPosition,
|
|
1377
|
+
"no-flags": a.noFlags,
|
|
1378
|
+
"no-search": a.noSearch,
|
|
1379
|
+
error: a.error || (a.noValidationError ? !1 : !!b(m) && !b(f)),
|
|
1380
|
+
success: a.success || (a.noValidationSuccess ? !1 : (Z = b(n)) == null ? void 0 : Z.isValid),
|
|
1375
1381
|
locales: g.value,
|
|
1376
|
-
disabled:
|
|
1377
|
-
"show-code-on-list":
|
|
1378
|
-
"only-countries":
|
|
1379
|
-
"preferred-countries":
|
|
1380
|
-
width:
|
|
1381
|
-
"onUpdate:modelValue":
|
|
1382
|
+
disabled: a.disabled,
|
|
1383
|
+
"show-code-on-list": a.showCodeOnList,
|
|
1384
|
+
"only-countries": a.onlyCountries,
|
|
1385
|
+
"preferred-countries": a.preferredCountries,
|
|
1386
|
+
width: a.countrySelectorWidth,
|
|
1387
|
+
"onUpdate:modelValue": $
|
|
1382
1388
|
}, null, 8, ["id", "model-value", "color", "size", "country-locale", "country-selector-display-name", "custom-countries-list", "ignored-countries", "list-position", "no-flags", "no-search", "error", "success", "locales", "disabled", "show-code-on-list", "only-countries", "preferred-countries", "width"])),
|
|
1383
|
-
q(
|
|
1389
|
+
q(xo, {
|
|
1384
1390
|
id: b(d),
|
|
1385
1391
|
ref_key: "PhoneInputRef",
|
|
1386
1392
|
ref: y,
|
|
1387
1393
|
"model-value": b(m),
|
|
1388
|
-
color:
|
|
1389
|
-
size:
|
|
1390
|
-
"no-example":
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1394
|
+
color: a.color,
|
|
1395
|
+
size: a.size,
|
|
1396
|
+
"no-example": a.noExample,
|
|
1397
|
+
block: "",
|
|
1398
|
+
disabled: a.disabled,
|
|
1399
|
+
"has-radius": !a.noCountrySelector,
|
|
1400
|
+
success: a.success || (a.noValidationSuccess ? !1 : b(n).isValid),
|
|
1401
|
+
error: a.error || (a.noValidationError ? !1 : !!b(m) && !b(n).isValid),
|
|
1395
1402
|
locales: g.value,
|
|
1396
|
-
"no-formatting-as-you-type":
|
|
1397
|
-
"auto-format":
|
|
1398
|
-
label:
|
|
1399
|
-
"onUpdate:modelValue":
|
|
1403
|
+
"no-formatting-as-you-type": a.noFormattingAsYouType,
|
|
1404
|
+
"auto-format": a.autoFormat,
|
|
1405
|
+
label: a.placeholder,
|
|
1406
|
+
"onUpdate:modelValue": S[0] || (S[0] = (N) => b(h)({
|
|
1400
1407
|
newPhoneNumber: N,
|
|
1401
|
-
autoFormat:
|
|
1402
|
-
noFormattingAsYouType:
|
|
1408
|
+
autoFormat: a.autoFormat,
|
|
1409
|
+
noFormattingAsYouType: a.noFormattingAsYouType
|
|
1403
1410
|
}))
|
|
1404
1411
|
}, null, 8, ["id", "model-value", "color", "size", "no-example", "disabled", "has-radius", "success", "error", "locales", "no-formatting-as-you-type", "auto-format", "label"])
|
|
1405
1412
|
],
|
|
@@ -1408,9 +1415,9 @@ const Jo = {
|
|
|
1408
1415
|
);
|
|
1409
1416
|
};
|
|
1410
1417
|
}
|
|
1411
|
-
}), lt = /* @__PURE__ */ se(
|
|
1418
|
+
}), lt = /* @__PURE__ */ se(et, [["__scopeId", "data-v-5481a936"]]);
|
|
1412
1419
|
export {
|
|
1413
1420
|
lt as M,
|
|
1414
1421
|
se as _,
|
|
1415
|
-
|
|
1422
|
+
ke as u
|
|
1416
1423
|
};
|