magoo 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -0
- package/README.pt-BR.md +167 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.d.ts +1 -0
- package/dist/magoo.css +2 -0
- package/dist/magoo.es.js +2084 -0
- package/dist/magoo.umd.js +1 -0
- package/dist/src/App.vue.d.ts +2 -0
- package/dist/src/components/MButton/MButton.spec.d.ts +1 -0
- package/dist/src/components/MButton/MButton.stories.d.ts +8 -0
- package/dist/src/components/MButton/MButton.vue.d.ts +31 -0
- package/dist/src/components/MButton/index.d.ts +1 -0
- package/dist/src/components/MCheckbox/MCheckbox.spec.d.ts +1 -0
- package/dist/src/components/MCheckbox/MCheckbox.stories.d.ts +8 -0
- package/dist/src/components/MCheckbox/MCheckbox.vue.d.ts +35 -0
- package/dist/src/components/MCheckbox/index.d.ts +1 -0
- package/dist/src/components/MCheckboxList/MCheckboxList.spec.d.ts +1 -0
- package/dist/src/components/MCheckboxList/MCheckboxList.stories.d.ts +8 -0
- package/dist/src/components/MCheckboxList/MCheckboxList.vue.d.ts +45 -0
- package/dist/src/components/MCheckboxList/index.d.ts +1 -0
- package/dist/src/components/MErrorMessage/MErrorMessage.spec.d.ts +1 -0
- package/dist/src/components/MErrorMessage/MErrorMessage.stories.d.ts +8 -0
- package/dist/src/components/MErrorMessage/MErrorMessage.vue.d.ts +8 -0
- package/dist/src/components/MErrorMessage/index.d.ts +1 -0
- package/dist/src/components/MFieldsetPanel/MFieldsetPanel.spec.d.ts +1 -0
- package/dist/src/components/MFieldsetPanel/MFieldsetPanel.stories.d.ts +7 -0
- package/dist/src/components/MFieldsetPanel/MFieldsetPanel.vue.d.ts +26 -0
- package/dist/src/components/MFieldsetPanel/index.d.ts +1 -0
- package/dist/src/components/MFileUpload/MFileUpload.spec.d.ts +1 -0
- package/dist/src/components/MFileUpload/MFileUpload.stories.d.ts +10 -0
- package/dist/src/components/MFileUpload/MFileUpload.vue.d.ts +65 -0
- package/dist/src/components/MFileUpload/index.d.ts +1 -0
- package/dist/src/components/MForm/MForm.spec.d.ts +1 -0
- package/dist/src/components/MForm/MForm.stories.d.ts +7 -0
- package/dist/src/components/MForm/MForm.vue.d.ts +46 -0
- package/dist/src/components/MForm/index.d.ts +1 -0
- package/dist/src/components/MInput/MInput.spec.d.ts +1 -0
- package/dist/src/components/MInput/MInput.stories.d.ts +12 -0
- package/dist/src/components/MInput/MInput.vue.d.ts +39 -0
- package/dist/src/components/MInput/index.d.ts +1 -0
- package/dist/src/components/MList/MList.spec.d.ts +1 -0
- package/dist/src/components/MList/MList.stories.d.ts +15 -0
- package/dist/src/components/MList/MList.vue.d.ts +142 -0
- package/dist/src/components/MList/index.d.ts +1 -0
- package/dist/src/components/MNumber/MNumber.spec.d.ts +1 -0
- package/dist/src/components/MNumber/MNumber.stories.d.ts +9 -0
- package/dist/src/components/MNumber/MNumber.vue.d.ts +41 -0
- package/dist/src/components/MNumber/index.d.ts +1 -0
- package/dist/src/components/MPassword/MPassword.spec.d.ts +1 -0
- package/dist/src/components/MPassword/MPassword.stories.d.ts +8 -0
- package/dist/src/components/MPassword/MPassword.vue.d.ts +43 -0
- package/dist/src/components/MPassword/index.d.ts +1 -0
- package/dist/src/components/MRadio/MRadio.spec.d.ts +1 -0
- package/dist/src/components/MRadio/MRadio.stories.d.ts +8 -0
- package/dist/src/components/MRadio/MRadio.vue.d.ts +33 -0
- package/dist/src/components/MRadio/index.d.ts +1 -0
- package/dist/src/components/MRadioList/MRadioList.spec.d.ts +1 -0
- package/dist/src/components/MRadioList/MRadioList.stories.d.ts +8 -0
- package/dist/src/components/MRadioList/MRadioList.vue.d.ts +45 -0
- package/dist/src/components/MRadioList/index.d.ts +1 -0
- package/dist/src/components/MSelect/MSelect.spec.d.ts +1 -0
- package/dist/src/components/MSelect/MSelect.stories.d.ts +8 -0
- package/dist/src/components/MSelect/MSelect.vue.d.ts +43 -0
- package/dist/src/components/MSelect/index.d.ts +1 -0
- package/dist/src/components/MSwitch/MSwitch.spec.d.ts +1 -0
- package/dist/src/components/MSwitch/MSwitch.stories.d.ts +11 -0
- package/dist/src/components/MSwitch/MSwitch.vue.d.ts +41 -0
- package/dist/src/components/MSwitch/index.d.ts +1 -0
- package/dist/src/components/MTextarea/MTextarea.spec.d.ts +1 -0
- package/dist/src/components/MTextarea/MTextarea.stories.d.ts +8 -0
- package/dist/src/components/MTextarea/MTextarea.vue.d.ts +37 -0
- package/dist/src/components/MTextarea/index.d.ts +1 -0
- package/dist/src/components/MValidationSummary/MValidationSummary.spec.d.ts +1 -0
- package/dist/src/components/MValidationSummary/MValidationSummary.stories.d.ts +8 -0
- package/dist/src/components/MValidationSummary/MValidationSummary.vue.d.ts +25 -0
- package/dist/src/components/MValidationSummary/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +17 -0
- package/dist/src/composables/useFieldDescribedBy.d.ts +4 -0
- package/dist/src/composables/useFieldErrors.d.ts +7 -0
- package/dist/src/composables/useFieldIds.d.ts +6 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/main.d.ts +0 -0
- package/dist/src/themes/theme.d.ts +3 -0
- package/dist/src/types/forms.d.ts +32 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/validation/index.d.ts +4 -0
- package/dist/src/validation/types.d.ts +40 -0
- package/dist/src/validation/useFormValidation.d.ts +56 -0
- package/dist/src/validation/useFormValidation.spec.d.ts +1 -0
- package/dist/src/validation/utils.d.ts +17 -0
- package/dist/src/validation/utils.spec.d.ts +1 -0
- package/package.json +72 -0
package/dist/magoo.es.js
ADDED
|
@@ -0,0 +1,2084 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, inject as c, isReactive as l, isRef as u, mergeProps as d, nextTick as f, normalizeClass as p, onBeforeUnmount as m, onMounted as h, openBlock as g, provide as _, reactive as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, shallowRef as C, toDisplayString as w, toRaw as T, toValue as E, unref as D, useAttrs as O, useId as k, watch as A, withCtx as j, withModifiers as M } from "vue";
|
|
2
|
+
//#region src/components/MButton/MButton.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var N = [
|
|
4
|
+
"type",
|
|
5
|
+
"disabled",
|
|
6
|
+
"aria-busy",
|
|
7
|
+
"aria-label"
|
|
8
|
+
], P = /*@__PURE__*/ s({
|
|
9
|
+
name: "MButton",
|
|
10
|
+
__name: "MButton",
|
|
11
|
+
props: {
|
|
12
|
+
label: { default: "Button" },
|
|
13
|
+
type: { default: "button" },
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
loading: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
ariaLabel: { default: "" }
|
|
23
|
+
},
|
|
24
|
+
setup(e) {
|
|
25
|
+
let n = e, r = t(() => ({
|
|
26
|
+
"m-button--loading": n.loading,
|
|
27
|
+
"m-button--disabled": n.disabled || n.loading
|
|
28
|
+
})), a = t(() => n.ariaLabel || void 0);
|
|
29
|
+
return (t, n) => (g(), i("button", {
|
|
30
|
+
class: p(["m-button", r.value]),
|
|
31
|
+
type: e.type,
|
|
32
|
+
disabled: e.disabled || e.loading,
|
|
33
|
+
"aria-busy": e.loading ? "true" : void 0,
|
|
34
|
+
"aria-label": a.value
|
|
35
|
+
}, [e.loading ? x(t.$slots, "loading", {}, () => [n[0] ||= o("Carregando...", -1)], !0, 0) : x(t.$slots, "default", {}, () => [o(w(e.label), 1)], !0, 1)], 10, N));
|
|
36
|
+
}
|
|
37
|
+
}), F = (e, t) => {
|
|
38
|
+
let n = e.__vccOpts || e;
|
|
39
|
+
for (let [e, r] of t) n[e] = r;
|
|
40
|
+
return n;
|
|
41
|
+
}, I = /*#__PURE__*/ F(P, [["__scopeId", "data-v-2090cb52"]]);
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/composables/useFieldIds.ts
|
|
44
|
+
function L(e) {
|
|
45
|
+
let n = k(), r = t(() => E(e) || n);
|
|
46
|
+
return {
|
|
47
|
+
fieldId: r,
|
|
48
|
+
hintId: t(() => `${r.value}-hint`),
|
|
49
|
+
errorId: t(() => `${r.value}-error`)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/composables/useFieldDescribedBy.ts
|
|
54
|
+
function R(e, n, r, i) {
|
|
55
|
+
let a = O();
|
|
56
|
+
return { describedBy: t(() => {
|
|
57
|
+
let t = typeof a["aria-describedby"] == "string" ? a["aria-describedby"].split(/\s+/) : [], o = [E(e) ? E(n) : "", E(i) ? E(r) : ""];
|
|
58
|
+
return [...new Set([...t, ...o].filter(Boolean))].join(" ");
|
|
59
|
+
}) };
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/composables/useFieldErrors.ts
|
|
63
|
+
function z(e) {
|
|
64
|
+
return (Array.isArray(e) ? e : e ? [e] : []).filter(Boolean);
|
|
65
|
+
}
|
|
66
|
+
function B(e, n) {
|
|
67
|
+
let r = c("m-form-errors", {}), i = c("m-form-submit-triggered", y(!1)), a = t(() => u(r) ? r.value : r);
|
|
68
|
+
return {
|
|
69
|
+
formSubmitTriggered: i,
|
|
70
|
+
resolvedErrors: t(() => {
|
|
71
|
+
let t = E(e) || "", r = [...z(a.value[t]), ...z(E(n))];
|
|
72
|
+
return [...new Set(r)];
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/MCheckbox/MCheckbox.vue?vue&type=script&setup=true&lang.ts
|
|
78
|
+
var V = { class: "m-checkbox-group" }, H = ["for"], U = [
|
|
79
|
+
"id",
|
|
80
|
+
"name",
|
|
81
|
+
"required",
|
|
82
|
+
"checked",
|
|
83
|
+
"disabled",
|
|
84
|
+
"aria-busy",
|
|
85
|
+
"aria-invalid",
|
|
86
|
+
"aria-describedby"
|
|
87
|
+
], W = { class: "m-checkbox__label" }, G = ["id"], K = ["id"], q = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
88
|
+
name: "MCheckbox",
|
|
89
|
+
inheritAttrs: !1,
|
|
90
|
+
__name: "MCheckbox",
|
|
91
|
+
props: {
|
|
92
|
+
modelValue: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !1
|
|
95
|
+
},
|
|
96
|
+
label: { default: "Option" },
|
|
97
|
+
id: { default: "" },
|
|
98
|
+
name: { default: "" },
|
|
99
|
+
required: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: !1
|
|
102
|
+
},
|
|
103
|
+
disabled: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !1
|
|
106
|
+
},
|
|
107
|
+
error: { default: "" },
|
|
108
|
+
hint: { default: "" },
|
|
109
|
+
invalid: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: !1
|
|
112
|
+
},
|
|
113
|
+
loading: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: !1
|
|
116
|
+
},
|
|
117
|
+
submitTriggered: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: !1
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
emits: [
|
|
123
|
+
"update:modelValue",
|
|
124
|
+
"blur",
|
|
125
|
+
"focus"
|
|
126
|
+
],
|
|
127
|
+
setup(n, { emit: o }) {
|
|
128
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => p.value || s.submitTriggered || m.value ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
129
|
+
function S(e) {
|
|
130
|
+
c("focus", e);
|
|
131
|
+
}
|
|
132
|
+
function C(e) {
|
|
133
|
+
p.value = !0, c("blur", e);
|
|
134
|
+
}
|
|
135
|
+
return (t, o) => (g(), i("div", V, [
|
|
136
|
+
a("label", {
|
|
137
|
+
class: "m-checkbox",
|
|
138
|
+
for: D(l)
|
|
139
|
+
}, [a("input", d(t.$attrs, {
|
|
140
|
+
id: D(l),
|
|
141
|
+
class: "m-checkbox__input",
|
|
142
|
+
type: "checkbox",
|
|
143
|
+
name: n.name,
|
|
144
|
+
required: n.required,
|
|
145
|
+
checked: n.modelValue,
|
|
146
|
+
disabled: n.disabled || n.loading,
|
|
147
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
148
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
149
|
+
"aria-describedby": D(x) || void 0,
|
|
150
|
+
onChange: o[0] ||= (e) => c("update:modelValue", e.target.checked),
|
|
151
|
+
onBlur: C,
|
|
152
|
+
onFocus: S
|
|
153
|
+
}), null, 16, U), a("span", W, w(n.label), 1)], 8, H),
|
|
154
|
+
n.hint ? (g(), i("p", {
|
|
155
|
+
key: 0,
|
|
156
|
+
id: D(u),
|
|
157
|
+
class: "m-checkbox__hint"
|
|
158
|
+
}, w(n.hint), 9, G)) : r("", !0),
|
|
159
|
+
_.value.length ? (g(), i("ul", {
|
|
160
|
+
key: 1,
|
|
161
|
+
id: D(f),
|
|
162
|
+
class: "m-checkbox__errors",
|
|
163
|
+
role: "alert"
|
|
164
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
165
|
+
key: `${e}-${t}`,
|
|
166
|
+
class: "m-checkbox__error"
|
|
167
|
+
}, w(e), 1))), 128))], 8, K)) : r("", !0)
|
|
168
|
+
]));
|
|
169
|
+
}
|
|
170
|
+
}), [["__scopeId", "data-v-9f2587a4"]]), ee = {
|
|
171
|
+
key: 0,
|
|
172
|
+
class: "m-checkbox-list__legend"
|
|
173
|
+
}, te = ["for"], ne = [
|
|
174
|
+
"id",
|
|
175
|
+
"name",
|
|
176
|
+
"required",
|
|
177
|
+
"checked",
|
|
178
|
+
"disabled",
|
|
179
|
+
"aria-busy",
|
|
180
|
+
"aria-invalid",
|
|
181
|
+
"aria-describedby",
|
|
182
|
+
"onChange"
|
|
183
|
+
], re = ["id"], ie = ["id"], ae = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
184
|
+
name: "MCheckboxList",
|
|
185
|
+
inheritAttrs: !1,
|
|
186
|
+
__name: "MCheckboxList",
|
|
187
|
+
props: {
|
|
188
|
+
modelValue: { default: () => [] },
|
|
189
|
+
legend: { default: "" },
|
|
190
|
+
label: { default: "" },
|
|
191
|
+
id: { default: "" },
|
|
192
|
+
name: { default: "" },
|
|
193
|
+
required: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: !1
|
|
196
|
+
},
|
|
197
|
+
options: { default: () => [] },
|
|
198
|
+
disabled: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: !1
|
|
201
|
+
},
|
|
202
|
+
error: { default: "" },
|
|
203
|
+
hint: { default: "" },
|
|
204
|
+
invalid: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: !1
|
|
207
|
+
},
|
|
208
|
+
loading: {
|
|
209
|
+
type: Boolean,
|
|
210
|
+
default: !1
|
|
211
|
+
},
|
|
212
|
+
submitTriggered: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default: !1
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
emits: [
|
|
218
|
+
"update:modelValue",
|
|
219
|
+
"blur",
|
|
220
|
+
"focus"
|
|
221
|
+
],
|
|
222
|
+
setup(n, { emit: o }) {
|
|
223
|
+
let s = n, c = o, l = t(() => s.legend || s.label || "Options"), { fieldId: u, hintId: f, errorId: p } = L(() => s.id), m = y(!1), { formSubmitTriggered: h, resolvedErrors: _ } = B(() => s.name, () => s.error), v = t(() => m.value || s.submitTriggered || h.value ? _.value : []), x = t(() => s.invalid || v.value.length > 0), { describedBy: S } = R(() => s.hint, f, p, () => v.value.length > 0);
|
|
224
|
+
function C(e) {
|
|
225
|
+
return s.modelValue.includes(e);
|
|
226
|
+
}
|
|
227
|
+
function T(e, t) {
|
|
228
|
+
let n = Array.isArray(s.modelValue) ? s.modelValue : [], r = t ? Array.from(/* @__PURE__ */ new Set([...n, e])) : n.filter((t) => t !== e);
|
|
229
|
+
m.value = !0, c("update:modelValue", r);
|
|
230
|
+
}
|
|
231
|
+
function E(e) {
|
|
232
|
+
c("focus", e);
|
|
233
|
+
}
|
|
234
|
+
function O(e) {
|
|
235
|
+
m.value = !0, c("blur", e);
|
|
236
|
+
}
|
|
237
|
+
return (t, o) => (g(), i("fieldset", d(t.$attrs, { class: "m-checkbox-list" }), [
|
|
238
|
+
l.value ? (g(), i("legend", ee, w(l.value), 1)) : r("", !0),
|
|
239
|
+
(g(!0), i(e, null, b(n.options, (e) => (g(), i("div", {
|
|
240
|
+
key: e.value,
|
|
241
|
+
class: "m-checkbox-list__item"
|
|
242
|
+
}, [a("label", {
|
|
243
|
+
class: "m-checkbox-list__option",
|
|
244
|
+
for: `${D(u)}-${e.value}`
|
|
245
|
+
}, [a("input", {
|
|
246
|
+
id: `${D(u)}-${e.value}`,
|
|
247
|
+
class: "m-checkbox-list__input",
|
|
248
|
+
type: "checkbox",
|
|
249
|
+
name: n.name,
|
|
250
|
+
required: n.required,
|
|
251
|
+
checked: C(e.value),
|
|
252
|
+
disabled: n.disabled || n.loading,
|
|
253
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
254
|
+
"aria-invalid": x.value ? "true" : void 0,
|
|
255
|
+
"aria-describedby": D(S) || void 0,
|
|
256
|
+
onChange: (t) => T(e.value, t.target.checked),
|
|
257
|
+
onFocus: E,
|
|
258
|
+
onBlur: o[0] ||= (e) => O(e)
|
|
259
|
+
}, null, 40, ne), a("span", null, w(e.label), 1)], 8, te)]))), 128)),
|
|
260
|
+
n.hint ? (g(), i("p", {
|
|
261
|
+
key: 1,
|
|
262
|
+
id: D(f),
|
|
263
|
+
class: "m-checkbox-list__hint"
|
|
264
|
+
}, w(n.hint), 9, re)) : r("", !0),
|
|
265
|
+
v.value.length ? (g(), i("ul", {
|
|
266
|
+
key: 2,
|
|
267
|
+
id: D(p),
|
|
268
|
+
class: "m-checkbox-list__errors",
|
|
269
|
+
role: "alert"
|
|
270
|
+
}, [(g(!0), i(e, null, b(v.value, (e, t) => (g(), i("li", {
|
|
271
|
+
key: `${e}-${t}`,
|
|
272
|
+
class: "m-checkbox-list__error"
|
|
273
|
+
}, w(e), 1))), 128))], 8, ie)) : r("", !0)
|
|
274
|
+
], 16));
|
|
275
|
+
}
|
|
276
|
+
}), [["__scopeId", "data-v-97a198c2"]]), oe = {
|
|
277
|
+
key: 0,
|
|
278
|
+
class: "m-error-message",
|
|
279
|
+
role: "alert"
|
|
280
|
+
}, se = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
281
|
+
name: "MErrorMessage",
|
|
282
|
+
__name: "MErrorMessage",
|
|
283
|
+
props: { message: { default: "" } },
|
|
284
|
+
setup(n) {
|
|
285
|
+
let a = n, o = t(() => z(a.message));
|
|
286
|
+
return (t, n) => o.value.length ? (g(), i("ul", oe, [(g(!0), i(e, null, b(o.value, (e, t) => (g(), i("li", { key: `${e}-${t}` }, w(e), 1))), 128))])) : r("", !0);
|
|
287
|
+
}
|
|
288
|
+
}), [["__scopeId", "data-v-07d4b185"]]), ce = ["id", "aria-describedby"], le = {
|
|
289
|
+
key: 0,
|
|
290
|
+
class: "m-fieldset-panel__legend"
|
|
291
|
+
}, J = { class: "m-fieldset-panel__content" }, ue = ["id"], Y = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
292
|
+
name: "MFieldsetPanel",
|
|
293
|
+
__name: "MFieldsetPanel",
|
|
294
|
+
props: {
|
|
295
|
+
id: { default: "" },
|
|
296
|
+
legend: { default: "" },
|
|
297
|
+
hint: { default: "" }
|
|
298
|
+
},
|
|
299
|
+
setup(e) {
|
|
300
|
+
let t = e, { fieldId: n, hintId: o } = L(() => t.id);
|
|
301
|
+
return (t, s) => (g(), i("fieldset", {
|
|
302
|
+
id: D(n),
|
|
303
|
+
class: "m-fieldset-panel",
|
|
304
|
+
"aria-describedby": e.hint ? D(o) : void 0
|
|
305
|
+
}, [
|
|
306
|
+
e.legend ? (g(), i("legend", le, w(e.legend), 1)) : r("", !0),
|
|
307
|
+
a("div", J, [x(t.$slots, "default", {}, void 0, !0)]),
|
|
308
|
+
e.hint ? (g(), i("p", {
|
|
309
|
+
key: 1,
|
|
310
|
+
id: D(o),
|
|
311
|
+
class: "m-fieldset-panel__hint"
|
|
312
|
+
}, w(e.hint), 9, ue)) : r("", !0)
|
|
313
|
+
], 8, ce));
|
|
314
|
+
}
|
|
315
|
+
}), [["__scopeId", "data-v-665adfd6"]]), X = "$form", Z = (e) => e == null || e === !0 || e === !1 || e === "" ? [] : typeof e == "string" ? [e] : Array.isArray(e) ? e.flatMap((e) => Z(e)) : typeof e == "object" && "message" in e && typeof e.message == "string" ? [e.message] : [];
|
|
316
|
+
function Q(e) {
|
|
317
|
+
return Object.values(e).some((e) => e.length > 0);
|
|
318
|
+
}
|
|
319
|
+
function $(e) {
|
|
320
|
+
let t = {};
|
|
321
|
+
for (let [n, r] of Object.entries(e)) {
|
|
322
|
+
let e = [...new Set(r.filter(Boolean))];
|
|
323
|
+
e.length && (t[n] = e);
|
|
324
|
+
}
|
|
325
|
+
return t;
|
|
326
|
+
}
|
|
327
|
+
function de(...e) {
|
|
328
|
+
let t = {};
|
|
329
|
+
for (let n of e) for (let [e, r] of Object.entries(n)) t[e] = [...t[e] ?? [], ...r];
|
|
330
|
+
return $(t);
|
|
331
|
+
}
|
|
332
|
+
function fe(e, t) {
|
|
333
|
+
if (!e) return null;
|
|
334
|
+
let n = e.querySelector("[aria-invalid=\"true\"]");
|
|
335
|
+
if (n) return n.focus(), n;
|
|
336
|
+
if (!t) return null;
|
|
337
|
+
for (let [n, r] of Object.entries(t)) {
|
|
338
|
+
if (!r.length) continue;
|
|
339
|
+
let t = e.querySelector(`[name="${pe(n)}"]`) ?? e.querySelector(`#${pe(n)}`);
|
|
340
|
+
if (t) return t.focus(), t;
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
function pe(e) {
|
|
345
|
+
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/validation/useFormValidation.ts
|
|
349
|
+
var me = ["blur", "submit"];
|
|
350
|
+
function he(e) {
|
|
351
|
+
let n = l(e.values) ? e.values : v(e.values), r = { ...T(n) }, i = e.schema ?? {}, a = e.formRules ?? [], o = e.adapter ?? Z, s = e.validateOn ?? me, c = e.revalidateOnInput ?? !0, u = C({}), d = C({}), f = C({}), p = v({}), m = y(!1), h = y(0), g = {}, _ = t(() => de(u.value, d.value, f.value)), b = t(() => _.value.$form ?? []), x = t(() => !Q(_.value)), S = t(() => Object.values(p).some((e) => e.validating)), w = t(() => {
|
|
352
|
+
if (m.value) return _.value;
|
|
353
|
+
let e = {};
|
|
354
|
+
for (let [t, n] of Object.entries(_.value)) (f.value[t]?.length || p[t]?.touched) && (e[t] = n);
|
|
355
|
+
return e;
|
|
356
|
+
});
|
|
357
|
+
function E(e) {
|
|
358
|
+
return p[e] || (p[e] = {
|
|
359
|
+
touched: !1,
|
|
360
|
+
dirty: !1,
|
|
361
|
+
validating: !1,
|
|
362
|
+
validated: !1
|
|
363
|
+
}), p[e];
|
|
364
|
+
}
|
|
365
|
+
function D(t) {
|
|
366
|
+
let n = i[t], r = Array.isArray(n) ? { rules: n } : n;
|
|
367
|
+
return {
|
|
368
|
+
rules: r?.rules ?? [],
|
|
369
|
+
dependsOn: r?.dependsOn ?? [],
|
|
370
|
+
validateOn: r?.validateOn ?? s,
|
|
371
|
+
bail: r?.bail ?? e.bail ?? !1
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function O() {
|
|
375
|
+
return Object.keys(i);
|
|
376
|
+
}
|
|
377
|
+
function k(e, t, n) {
|
|
378
|
+
let r = { ...e.value };
|
|
379
|
+
n.length ? r[t] = [...new Set(n)] : delete r[t], e.value = r;
|
|
380
|
+
}
|
|
381
|
+
async function A(e) {
|
|
382
|
+
let { rules: t, bail: r } = D(e), i = E(e), a = g[e] = (g[e] ?? 0) + 1, s = [];
|
|
383
|
+
i.validating = !0;
|
|
384
|
+
try {
|
|
385
|
+
for (let i of t) {
|
|
386
|
+
let t = await i(n[e], {
|
|
387
|
+
field: e,
|
|
388
|
+
values: n
|
|
389
|
+
});
|
|
390
|
+
if (g[e] !== a) return u.value[e] ?? [];
|
|
391
|
+
let c = o(t);
|
|
392
|
+
if (s.push(...c), c.length && r) break;
|
|
393
|
+
}
|
|
394
|
+
} finally {
|
|
395
|
+
g[e] === a && (i.validating = !1);
|
|
396
|
+
}
|
|
397
|
+
return i.validated = !0, k(u, e, s), s;
|
|
398
|
+
}
|
|
399
|
+
async function j() {
|
|
400
|
+
let e = {};
|
|
401
|
+
for (let t of a) {
|
|
402
|
+
let r = await t(n);
|
|
403
|
+
if (r && typeof r == "object" && !Array.isArray(r)) for (let [t, n] of Object.entries(r)) e[t] = [...e[t] ?? [], ...o(n)];
|
|
404
|
+
else e[X] = [...e.$form ?? [], ...o(r)];
|
|
405
|
+
}
|
|
406
|
+
d.value = $(e);
|
|
407
|
+
}
|
|
408
|
+
async function M() {
|
|
409
|
+
return await Promise.all(O().map((e) => A(e))), await j(), x.value;
|
|
410
|
+
}
|
|
411
|
+
function N(e) {
|
|
412
|
+
for (let t of O()) {
|
|
413
|
+
if (t === e) continue;
|
|
414
|
+
let { dependsOn: n } = D(t);
|
|
415
|
+
n.includes(e) && p[t]?.validated && A(t);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function P(e, t) {
|
|
419
|
+
n[e] = t, E(e).dirty = t !== r[e];
|
|
420
|
+
}
|
|
421
|
+
function F(e, t) {
|
|
422
|
+
P(e, t), H(e), d.value[e] && k(d, e, []);
|
|
423
|
+
let { validateOn: n } = D(e);
|
|
424
|
+
(n.includes("input") || c && u.value[e]?.length) && A(e), N(e);
|
|
425
|
+
}
|
|
426
|
+
function I(e) {
|
|
427
|
+
E(e).touched = !0;
|
|
428
|
+
}
|
|
429
|
+
function L(e) {
|
|
430
|
+
I(e), D(e).validateOn.includes("blur") && A(e);
|
|
431
|
+
}
|
|
432
|
+
async function R(e) {
|
|
433
|
+
m.value = !0, h.value += 1, O().forEach(I);
|
|
434
|
+
let t = await M();
|
|
435
|
+
return t && e && await e(n), t;
|
|
436
|
+
}
|
|
437
|
+
function B(e, t) {
|
|
438
|
+
k(u, e, z(t));
|
|
439
|
+
}
|
|
440
|
+
function V(e) {
|
|
441
|
+
let t = {};
|
|
442
|
+
for (let [n, r] of Object.entries(e)) t[n] = z(r);
|
|
443
|
+
f.value = $(t);
|
|
444
|
+
}
|
|
445
|
+
function H(e) {
|
|
446
|
+
if (e == null) {
|
|
447
|
+
f.value = {};
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
f.value[e] && k(f, e, []);
|
|
451
|
+
}
|
|
452
|
+
function U(e) {
|
|
453
|
+
let t = p[e], n = _.value[e] ?? [];
|
|
454
|
+
return {
|
|
455
|
+
error: n,
|
|
456
|
+
invalid: n.length > 0,
|
|
457
|
+
touched: t?.touched ?? !1,
|
|
458
|
+
dirty: t?.dirty ?? !1,
|
|
459
|
+
validating: t?.validating ?? !1,
|
|
460
|
+
submitted: m.value
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function W(e) {
|
|
464
|
+
return {
|
|
465
|
+
name: e,
|
|
466
|
+
modelValue: n[e],
|
|
467
|
+
"onUpdate:modelValue": (t) => F(e, t),
|
|
468
|
+
onBlur: () => L(e),
|
|
469
|
+
error: _.value[e] ?? [],
|
|
470
|
+
submitTriggered: m.value
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function G(e) {
|
|
474
|
+
for (let e of Object.keys(n)) delete n[e];
|
|
475
|
+
Object.assign(n, r, e ?? {});
|
|
476
|
+
for (let e of Object.keys(p)) delete p[e];
|
|
477
|
+
for (let e of Object.keys(g)) g[e] = (g[e] ?? 0) + 1;
|
|
478
|
+
u.value = {}, d.value = {}, f.value = {}, m.value = !1;
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
values: n,
|
|
482
|
+
errors: u,
|
|
483
|
+
serverErrors: f,
|
|
484
|
+
allErrors: _,
|
|
485
|
+
visibleErrors: w,
|
|
486
|
+
formErrors: b,
|
|
487
|
+
isValid: x,
|
|
488
|
+
isValidating: S,
|
|
489
|
+
submitted: m,
|
|
490
|
+
submitCount: h,
|
|
491
|
+
fieldState: U,
|
|
492
|
+
field: W,
|
|
493
|
+
setValue: P,
|
|
494
|
+
handleInput: F,
|
|
495
|
+
handleBlur: L,
|
|
496
|
+
touch: I,
|
|
497
|
+
validateField: A,
|
|
498
|
+
validateForm: M,
|
|
499
|
+
handleSubmit: R,
|
|
500
|
+
setFieldErrors: B,
|
|
501
|
+
setServerErrors: V,
|
|
502
|
+
clearServerErrors: H,
|
|
503
|
+
reset: G
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/components/MForm/MForm.vue?vue&type=script&setup=true&lang.ts
|
|
508
|
+
var ge = ["novalidate"], _e = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
509
|
+
name: "MForm",
|
|
510
|
+
__name: "MForm",
|
|
511
|
+
props: {
|
|
512
|
+
values: { default: () => ({}) },
|
|
513
|
+
errors: { default: () => ({}) },
|
|
514
|
+
validation: { default: null },
|
|
515
|
+
focusFirstInvalid: {
|
|
516
|
+
type: Boolean,
|
|
517
|
+
default: !0
|
|
518
|
+
},
|
|
519
|
+
novalidate: {
|
|
520
|
+
type: Boolean,
|
|
521
|
+
default: !1
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
emits: ["submit", "invalid"],
|
|
525
|
+
setup(e, { expose: n, emit: r }) {
|
|
526
|
+
let a = e, o = r, s = y(), c = v({}), l = v({}), u = y(!1);
|
|
527
|
+
A(() => a.values, (e) => {
|
|
528
|
+
for (let e of Object.keys(c)) delete c[e];
|
|
529
|
+
Object.assign(c, e);
|
|
530
|
+
}, {
|
|
531
|
+
deep: !0,
|
|
532
|
+
immediate: !0
|
|
533
|
+
}), A([() => a.errors, () => a.validation?.allErrors.value], ([e, t]) => {
|
|
534
|
+
for (let e of Object.keys(l)) delete l[e];
|
|
535
|
+
Object.assign(l, e, t ?? {});
|
|
536
|
+
}, {
|
|
537
|
+
deep: !0,
|
|
538
|
+
immediate: !0
|
|
539
|
+
});
|
|
540
|
+
let d = t(() => {
|
|
541
|
+
let e = {};
|
|
542
|
+
for (let [t, n] of Object.entries(l)) {
|
|
543
|
+
let r = z(n);
|
|
544
|
+
r.length && (e[t] = r);
|
|
545
|
+
}
|
|
546
|
+
return e;
|
|
547
|
+
});
|
|
548
|
+
function p() {
|
|
549
|
+
return fe(s.value, d.value);
|
|
550
|
+
}
|
|
551
|
+
async function m() {
|
|
552
|
+
a.focusFirstInvalid && (await f(), Object.keys(d.value).length && p());
|
|
553
|
+
}
|
|
554
|
+
async function h() {
|
|
555
|
+
if (u.value = !0, a.validation) {
|
|
556
|
+
if (!await a.validation.handleSubmit()) {
|
|
557
|
+
o("invalid", a.validation.allErrors.value), await m();
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
o("submit", { ...T(a.validation.values) });
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
o("submit", c), await m();
|
|
564
|
+
}
|
|
565
|
+
return _("m-form-values", c), _("m-form-errors", l), _("m-form-submit-triggered", u), n({
|
|
566
|
+
focusFirstInvalid: p,
|
|
567
|
+
formElement: s
|
|
568
|
+
}), (t, n) => (g(), i("form", {
|
|
569
|
+
ref_key: "formElement",
|
|
570
|
+
ref: s,
|
|
571
|
+
class: "m-form",
|
|
572
|
+
novalidate: e.validation || e.novalidate ? !0 : void 0,
|
|
573
|
+
onSubmit: M(h, ["prevent"])
|
|
574
|
+
}, [x(t.$slots, "default", {}, void 0, !0)], 40, ge));
|
|
575
|
+
}
|
|
576
|
+
}), [["__scopeId", "data-v-2de65f24"]]), ve = { class: "m-input" }, ye = ["for"], be = [
|
|
577
|
+
"id",
|
|
578
|
+
"type",
|
|
579
|
+
"name",
|
|
580
|
+
"required",
|
|
581
|
+
"disabled",
|
|
582
|
+
"aria-busy",
|
|
583
|
+
"autocomplete",
|
|
584
|
+
"value",
|
|
585
|
+
"aria-invalid",
|
|
586
|
+
"aria-describedby"
|
|
587
|
+
], xe = ["id"], Se = ["id"], Ce = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
588
|
+
name: "MInput",
|
|
589
|
+
inheritAttrs: !1,
|
|
590
|
+
__name: "MInput",
|
|
591
|
+
props: {
|
|
592
|
+
label: { default: "" },
|
|
593
|
+
id: { default: "" },
|
|
594
|
+
modelValue: { default: "" },
|
|
595
|
+
type: { default: "text" },
|
|
596
|
+
name: { default: "" },
|
|
597
|
+
required: {
|
|
598
|
+
type: Boolean,
|
|
599
|
+
default: !1
|
|
600
|
+
},
|
|
601
|
+
disabled: {
|
|
602
|
+
type: Boolean,
|
|
603
|
+
default: !1
|
|
604
|
+
},
|
|
605
|
+
error: { default: "" },
|
|
606
|
+
hint: { default: "" },
|
|
607
|
+
invalid: {
|
|
608
|
+
type: Boolean,
|
|
609
|
+
default: !1
|
|
610
|
+
},
|
|
611
|
+
loading: {
|
|
612
|
+
type: Boolean,
|
|
613
|
+
default: !1
|
|
614
|
+
},
|
|
615
|
+
autocomplete: { default: "off" },
|
|
616
|
+
submitTriggered: {
|
|
617
|
+
type: Boolean,
|
|
618
|
+
default: !1
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
emits: [
|
|
622
|
+
"update:modelValue",
|
|
623
|
+
"blur",
|
|
624
|
+
"focus"
|
|
625
|
+
],
|
|
626
|
+
setup(n, { emit: o }) {
|
|
627
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => p.value || s.submitTriggered || m.value ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
628
|
+
function S(e) {
|
|
629
|
+
c("focus", e);
|
|
630
|
+
}
|
|
631
|
+
function C(e) {
|
|
632
|
+
p.value = !0, c("blur", e);
|
|
633
|
+
}
|
|
634
|
+
return (t, o) => (g(), i("div", ve, [
|
|
635
|
+
n.label ? (g(), i("label", {
|
|
636
|
+
key: 0,
|
|
637
|
+
class: "m-input__label",
|
|
638
|
+
for: D(l)
|
|
639
|
+
}, w(n.label), 9, ye)) : r("", !0),
|
|
640
|
+
a("input", d(t.$attrs, {
|
|
641
|
+
id: D(l),
|
|
642
|
+
class: ["m-input__field", { "m-input__field--error": v.value }],
|
|
643
|
+
type: n.type,
|
|
644
|
+
name: n.name,
|
|
645
|
+
required: n.required,
|
|
646
|
+
disabled: n.disabled || n.loading,
|
|
647
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
648
|
+
autocomplete: n.autocomplete,
|
|
649
|
+
value: n.modelValue,
|
|
650
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
651
|
+
"aria-describedby": D(x) || void 0,
|
|
652
|
+
onInput: o[0] ||= (e) => c("update:modelValue", e.target.value),
|
|
653
|
+
onBlur: o[1] ||= (e) => C(e),
|
|
654
|
+
onFocus: o[2] ||= (e) => S(e)
|
|
655
|
+
}), null, 16, be),
|
|
656
|
+
n.hint ? (g(), i("p", {
|
|
657
|
+
key: 1,
|
|
658
|
+
id: D(u),
|
|
659
|
+
class: "m-input__hint"
|
|
660
|
+
}, w(n.hint), 9, xe)) : r("", !0),
|
|
661
|
+
_.value.length ? (g(), i("ul", {
|
|
662
|
+
key: 2,
|
|
663
|
+
id: D(f),
|
|
664
|
+
class: "m-input__errors",
|
|
665
|
+
role: "alert"
|
|
666
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
667
|
+
key: `${e}-${t}`,
|
|
668
|
+
class: "m-input__error"
|
|
669
|
+
}, w(e), 1))), 128))], 8, Se)) : r("", !0)
|
|
670
|
+
]));
|
|
671
|
+
}
|
|
672
|
+
}), [["__scopeId", "data-v-829056e7"]]), we = { class: "m-number" }, Te = ["for"], Ee = [
|
|
673
|
+
"id",
|
|
674
|
+
"name",
|
|
675
|
+
"min",
|
|
676
|
+
"max",
|
|
677
|
+
"step",
|
|
678
|
+
"required",
|
|
679
|
+
"disabled",
|
|
680
|
+
"aria-busy",
|
|
681
|
+
"value",
|
|
682
|
+
"aria-invalid",
|
|
683
|
+
"aria-describedby"
|
|
684
|
+
], De = ["id"], Oe = ["id"], ke = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
685
|
+
name: "MNumber",
|
|
686
|
+
inheritAttrs: !1,
|
|
687
|
+
__name: "MNumber",
|
|
688
|
+
props: {
|
|
689
|
+
modelValue: { default: null },
|
|
690
|
+
label: { default: "" },
|
|
691
|
+
id: { default: "" },
|
|
692
|
+
name: { default: "" },
|
|
693
|
+
min: { default: void 0 },
|
|
694
|
+
max: { default: void 0 },
|
|
695
|
+
step: { default: 1 },
|
|
696
|
+
required: {
|
|
697
|
+
type: Boolean,
|
|
698
|
+
default: !1
|
|
699
|
+
},
|
|
700
|
+
disabled: {
|
|
701
|
+
type: Boolean,
|
|
702
|
+
default: !1
|
|
703
|
+
},
|
|
704
|
+
error: { default: "" },
|
|
705
|
+
hint: { default: "" },
|
|
706
|
+
invalid: {
|
|
707
|
+
type: Boolean,
|
|
708
|
+
default: !1
|
|
709
|
+
},
|
|
710
|
+
loading: {
|
|
711
|
+
type: Boolean,
|
|
712
|
+
default: !1
|
|
713
|
+
},
|
|
714
|
+
submitTriggered: {
|
|
715
|
+
type: Boolean,
|
|
716
|
+
default: !1
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
emits: [
|
|
720
|
+
"update:modelValue",
|
|
721
|
+
"blur",
|
|
722
|
+
"focus"
|
|
723
|
+
],
|
|
724
|
+
setup(n, { emit: o }) {
|
|
725
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => p.value || s.submitTriggered || m.value ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
726
|
+
function S(e) {
|
|
727
|
+
let t = e.target.value;
|
|
728
|
+
c("update:modelValue", t === "" ? null : Number(t));
|
|
729
|
+
}
|
|
730
|
+
function C(e) {
|
|
731
|
+
c("focus", e);
|
|
732
|
+
}
|
|
733
|
+
function T(e) {
|
|
734
|
+
p.value = !0, c("blur", e);
|
|
735
|
+
}
|
|
736
|
+
return (t, o) => (g(), i("div", we, [
|
|
737
|
+
n.label ? (g(), i("label", {
|
|
738
|
+
key: 0,
|
|
739
|
+
class: "m-number__label",
|
|
740
|
+
for: D(l)
|
|
741
|
+
}, w(n.label), 9, Te)) : r("", !0),
|
|
742
|
+
a("input", d(t.$attrs, {
|
|
743
|
+
id: D(l),
|
|
744
|
+
class: ["m-number__field", { "m-number__field--error": v.value }],
|
|
745
|
+
type: "number",
|
|
746
|
+
name: n.name,
|
|
747
|
+
min: n.min,
|
|
748
|
+
max: n.max,
|
|
749
|
+
step: n.step,
|
|
750
|
+
required: n.required,
|
|
751
|
+
disabled: n.disabled || n.loading,
|
|
752
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
753
|
+
value: n.modelValue ?? "",
|
|
754
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
755
|
+
"aria-describedby": D(x) || void 0,
|
|
756
|
+
onInput: S,
|
|
757
|
+
onBlur: T,
|
|
758
|
+
onFocus: C
|
|
759
|
+
}), null, 16, Ee),
|
|
760
|
+
n.hint ? (g(), i("p", {
|
|
761
|
+
key: 1,
|
|
762
|
+
id: D(u),
|
|
763
|
+
class: "m-number__hint"
|
|
764
|
+
}, w(n.hint), 9, De)) : r("", !0),
|
|
765
|
+
_.value.length ? (g(), i("ul", {
|
|
766
|
+
key: 2,
|
|
767
|
+
id: D(f),
|
|
768
|
+
class: "m-number__errors",
|
|
769
|
+
role: "alert"
|
|
770
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
771
|
+
key: `${e}-${t}`,
|
|
772
|
+
class: "m-number__error"
|
|
773
|
+
}, w(e), 1))), 128))], 8, Oe)) : r("", !0)
|
|
774
|
+
]));
|
|
775
|
+
}
|
|
776
|
+
}), [["__scopeId", "data-v-70635ebe"]]), Ae = { class: "m-password" }, je = ["for"], Me = { class: "m-password__control" }, Ne = [
|
|
777
|
+
"id",
|
|
778
|
+
"type",
|
|
779
|
+
"name",
|
|
780
|
+
"required",
|
|
781
|
+
"disabled",
|
|
782
|
+
"aria-busy",
|
|
783
|
+
"autocomplete",
|
|
784
|
+
"value",
|
|
785
|
+
"aria-invalid",
|
|
786
|
+
"aria-describedby"
|
|
787
|
+
], Pe = [
|
|
788
|
+
"disabled",
|
|
789
|
+
"aria-label",
|
|
790
|
+
"aria-pressed"
|
|
791
|
+
], Fe = ["id"], Ie = ["id"], Le = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
792
|
+
name: "MPassword",
|
|
793
|
+
inheritAttrs: !1,
|
|
794
|
+
__name: "MPassword",
|
|
795
|
+
props: {
|
|
796
|
+
label: { default: "" },
|
|
797
|
+
id: { default: "" },
|
|
798
|
+
modelValue: { default: "" },
|
|
799
|
+
name: { default: "" },
|
|
800
|
+
required: {
|
|
801
|
+
type: Boolean,
|
|
802
|
+
default: !1
|
|
803
|
+
},
|
|
804
|
+
disabled: {
|
|
805
|
+
type: Boolean,
|
|
806
|
+
default: !1
|
|
807
|
+
},
|
|
808
|
+
error: { default: "" },
|
|
809
|
+
hint: { default: "" },
|
|
810
|
+
invalid: {
|
|
811
|
+
type: Boolean,
|
|
812
|
+
default: !1
|
|
813
|
+
},
|
|
814
|
+
loading: {
|
|
815
|
+
type: Boolean,
|
|
816
|
+
default: !1
|
|
817
|
+
},
|
|
818
|
+
autocomplete: { default: "current-password" },
|
|
819
|
+
submitTriggered: {
|
|
820
|
+
type: Boolean,
|
|
821
|
+
default: !1
|
|
822
|
+
},
|
|
823
|
+
showPasswordLabel: { default: "Mostrar senha" },
|
|
824
|
+
hidePasswordLabel: { default: "Ocultar senha" }
|
|
825
|
+
},
|
|
826
|
+
emits: [
|
|
827
|
+
"update:modelValue",
|
|
828
|
+
"blur",
|
|
829
|
+
"focus"
|
|
830
|
+
],
|
|
831
|
+
setup(n, { emit: o }) {
|
|
832
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: p } = L(() => s.id), m = y(), h = y(!1), _ = t(() => s.disabled || s.loading), v = y(!1), x = y(s.modelValue);
|
|
833
|
+
A(() => s.modelValue, (e) => {
|
|
834
|
+
e !== x.value && (x.value = e);
|
|
835
|
+
});
|
|
836
|
+
let { formSubmitTriggered: S, resolvedErrors: C } = B(() => s.name, () => s.error), T = t(() => v.value || s.submitTriggered || S.value ? C.value : []), E = t(() => s.invalid || T.value.length > 0), { describedBy: O } = R(() => s.hint, u, p, () => T.value.length > 0);
|
|
837
|
+
function k(e) {
|
|
838
|
+
let t = e.target.value;
|
|
839
|
+
x.value = t, c("update:modelValue", t);
|
|
840
|
+
}
|
|
841
|
+
function j(e) {
|
|
842
|
+
if (_.value) {
|
|
843
|
+
e.target.blur();
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
c("focus", e);
|
|
847
|
+
}
|
|
848
|
+
function N(e) {
|
|
849
|
+
v.value = !0, c("blur", e);
|
|
850
|
+
}
|
|
851
|
+
async function P() {
|
|
852
|
+
if (_.value) return;
|
|
853
|
+
let e = m.value, t = document.activeElement === e, n = e?.selectionStart, r = e?.selectionEnd;
|
|
854
|
+
if (h.value = !h.value, !t) return;
|
|
855
|
+
await f();
|
|
856
|
+
let i = m.value;
|
|
857
|
+
i && (i.focus(), n != null && r != null && i.setSelectionRange(n, r));
|
|
858
|
+
}
|
|
859
|
+
return A(_, (e) => {
|
|
860
|
+
e && m.value === document.activeElement && m.value.blur();
|
|
861
|
+
}), (t, o) => (g(), i("div", Ae, [
|
|
862
|
+
n.label ? (g(), i("label", {
|
|
863
|
+
key: 0,
|
|
864
|
+
class: "m-password__label",
|
|
865
|
+
for: D(l)
|
|
866
|
+
}, w(n.label), 9, je)) : r("", !0),
|
|
867
|
+
a("div", Me, [a("input", d(t.$attrs, {
|
|
868
|
+
id: D(l),
|
|
869
|
+
ref_key: "passwordInput",
|
|
870
|
+
ref: m,
|
|
871
|
+
class: ["m-password__field", { "m-password__field--error": E.value }],
|
|
872
|
+
type: h.value ? "text" : "password",
|
|
873
|
+
name: n.name,
|
|
874
|
+
required: n.required,
|
|
875
|
+
disabled: n.disabled || n.loading,
|
|
876
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
877
|
+
autocomplete: n.autocomplete,
|
|
878
|
+
value: x.value,
|
|
879
|
+
"aria-invalid": E.value ? "true" : void 0,
|
|
880
|
+
"aria-describedby": D(O) || void 0,
|
|
881
|
+
onInput: o[0] ||= (e) => k(e),
|
|
882
|
+
onBlur: o[1] ||= (e) => N(e),
|
|
883
|
+
onFocus: o[2] ||= (e) => j(e)
|
|
884
|
+
}), null, 16, Ne), a("button", {
|
|
885
|
+
class: "m-password__toggle",
|
|
886
|
+
type: "button",
|
|
887
|
+
disabled: n.disabled || n.loading,
|
|
888
|
+
"aria-label": h.value ? n.hidePasswordLabel : n.showPasswordLabel,
|
|
889
|
+
"aria-pressed": h.value,
|
|
890
|
+
onMousedown: o[3] ||= M(() => {}, ["prevent"]),
|
|
891
|
+
onClick: P
|
|
892
|
+
}, w(h.value ? n.hidePasswordLabel : n.showPasswordLabel), 41, Pe)]),
|
|
893
|
+
n.hint ? (g(), i("p", {
|
|
894
|
+
key: 1,
|
|
895
|
+
id: D(u),
|
|
896
|
+
class: "m-password__hint"
|
|
897
|
+
}, w(n.hint), 9, Fe)) : r("", !0),
|
|
898
|
+
T.value.length ? (g(), i("ul", {
|
|
899
|
+
key: 2,
|
|
900
|
+
id: D(p),
|
|
901
|
+
class: "m-password__errors",
|
|
902
|
+
role: "alert"
|
|
903
|
+
}, [(g(!0), i(e, null, b(T.value, (e, t) => (g(), i("li", {
|
|
904
|
+
key: `${e}-${t}`,
|
|
905
|
+
class: "m-password__error"
|
|
906
|
+
}, w(e), 1))), 128))], 8, Ie)) : r("", !0)
|
|
907
|
+
]));
|
|
908
|
+
}
|
|
909
|
+
}), [["__scopeId", "data-v-f6042b04"]]), Re = { class: "m-file-upload" }, ze = {
|
|
910
|
+
key: 0,
|
|
911
|
+
class: "m-file-upload__label"
|
|
912
|
+
}, Be = [
|
|
913
|
+
"id",
|
|
914
|
+
"name",
|
|
915
|
+
"accept",
|
|
916
|
+
"multiple",
|
|
917
|
+
"required",
|
|
918
|
+
"disabled",
|
|
919
|
+
"aria-busy",
|
|
920
|
+
"aria-invalid",
|
|
921
|
+
"aria-describedby"
|
|
922
|
+
], Ve = { class: "m-file-upload__dropzone-content" }, He = { class: "m-file-upload__button-label" }, Ue = { class: "m-file-upload__drop-hint" }, We = ["value"], Ge = {
|
|
923
|
+
key: 2,
|
|
924
|
+
class: "m-file-upload__list",
|
|
925
|
+
"aria-live": "polite"
|
|
926
|
+
}, Ke = { class: "m-file-upload__item-name" }, qe = { class: "m-file-upload__item-size" }, Je = [
|
|
927
|
+
"disabled",
|
|
928
|
+
"aria-label",
|
|
929
|
+
"onClick"
|
|
930
|
+
], Ye = ["id"], Xe = ["id"], Ze = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
931
|
+
name: "MFileUpload",
|
|
932
|
+
inheritAttrs: !1,
|
|
933
|
+
__name: "MFileUpload",
|
|
934
|
+
props: {
|
|
935
|
+
label: { default: "" },
|
|
936
|
+
id: { default: "" },
|
|
937
|
+
name: { default: "" },
|
|
938
|
+
modelValue: { default: () => [] },
|
|
939
|
+
accept: { default: "" },
|
|
940
|
+
multiple: {
|
|
941
|
+
type: Boolean,
|
|
942
|
+
default: !1
|
|
943
|
+
},
|
|
944
|
+
maxSize: { default: void 0 },
|
|
945
|
+
maxFiles: { default: void 0 },
|
|
946
|
+
required: {
|
|
947
|
+
type: Boolean,
|
|
948
|
+
default: !1
|
|
949
|
+
},
|
|
950
|
+
disabled: {
|
|
951
|
+
type: Boolean,
|
|
952
|
+
default: !1
|
|
953
|
+
},
|
|
954
|
+
loading: {
|
|
955
|
+
type: Boolean,
|
|
956
|
+
default: !1
|
|
957
|
+
},
|
|
958
|
+
progress: { default: 0 },
|
|
959
|
+
error: { default: "" },
|
|
960
|
+
hint: { default: "" },
|
|
961
|
+
invalid: {
|
|
962
|
+
type: Boolean,
|
|
963
|
+
default: !1
|
|
964
|
+
},
|
|
965
|
+
submitTriggered: {
|
|
966
|
+
type: Boolean,
|
|
967
|
+
default: !1
|
|
968
|
+
},
|
|
969
|
+
buttonLabel: { default: "" },
|
|
970
|
+
dropHint: { default: "ou arraste e solte aqui" },
|
|
971
|
+
removeLabel: { default: "Remover" }
|
|
972
|
+
},
|
|
973
|
+
emits: [
|
|
974
|
+
"update:modelValue",
|
|
975
|
+
"blur",
|
|
976
|
+
"focus",
|
|
977
|
+
"reject",
|
|
978
|
+
"remove"
|
|
979
|
+
],
|
|
980
|
+
setup(n, { emit: o }) {
|
|
981
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: m } = L(() => s.id), h = y(), _ = y([]), v = y(!1), x = y(!1), S = y([]), C = t(() => s.disabled || s.loading), T = t(() => s.buttonLabel || (s.multiple ? "Selecionar arquivos" : "Selecionar arquivo")), E = y([...s.modelValue]);
|
|
982
|
+
A(() => s.modelValue, (e) => {
|
|
983
|
+
E.value = [...e];
|
|
984
|
+
});
|
|
985
|
+
let { formSubmitTriggered: O, resolvedErrors: k } = B(() => s.name, () => s.error), j = t(() => {
|
|
986
|
+
let e = x.value || s.submitTriggered || O.value ? k.value : [];
|
|
987
|
+
return [...S.value, ...e];
|
|
988
|
+
}), N = t(() => s.invalid || j.value.length > 0), { describedBy: P } = R(() => s.hint, u, m, () => j.value.length > 0);
|
|
989
|
+
function F(e) {
|
|
990
|
+
if (!Number.isFinite(e) || e < 0) return "";
|
|
991
|
+
if (e < 1024) return `${e} B`;
|
|
992
|
+
let t = [
|
|
993
|
+
"KB",
|
|
994
|
+
"MB",
|
|
995
|
+
"GB",
|
|
996
|
+
"TB"
|
|
997
|
+
], n = e / 1024, r = 0;
|
|
998
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
999
|
+
return `${n.toFixed(+(n < 10))} ${t[r]}`;
|
|
1000
|
+
}
|
|
1001
|
+
function I(e, t) {
|
|
1002
|
+
let n = t.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
1003
|
+
if (!n.length) return !0;
|
|
1004
|
+
let r = e.name.toLowerCase(), i = (e.type || "").toLowerCase();
|
|
1005
|
+
return n.some((e) => e.startsWith(".") ? r.endsWith(e) : e.endsWith("/*") ? i.startsWith(e.slice(0, -1)) : i === e);
|
|
1006
|
+
}
|
|
1007
|
+
function z(e) {
|
|
1008
|
+
if (C.value || !e.length) return;
|
|
1009
|
+
let t = [], n = [];
|
|
1010
|
+
for (let r of e) {
|
|
1011
|
+
if (s.accept && !I(r, s.accept)) {
|
|
1012
|
+
t.push({
|
|
1013
|
+
file: r,
|
|
1014
|
+
reason: "type"
|
|
1015
|
+
});
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
if (s.maxSize != null && r.size > s.maxSize) {
|
|
1019
|
+
t.push({
|
|
1020
|
+
file: r,
|
|
1021
|
+
reason: "size"
|
|
1022
|
+
});
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
n.push(r);
|
|
1026
|
+
}
|
|
1027
|
+
let r = s.multiple ? [...E.value, ...n] : n, i = s.multiple ? s.maxFiles : 1;
|
|
1028
|
+
i != null && r.length > i && (r.slice(i).forEach((e) => t.push({
|
|
1029
|
+
file: e,
|
|
1030
|
+
reason: "count"
|
|
1031
|
+
})), r = r.slice(0, i)), S.value = t.map(({ file: e, reason: t }) => t === "type" ? `${e.name}: tipo de arquivo não permitido.` : t === "size" ? `${e.name}: excede o tamanho máximo de ${F(s.maxSize ?? 0)}.` : `${e.name}: limite de ${i} arquivo(s) excedido.`), t.length && c("reject", t), E.value = r, c("update:modelValue", r);
|
|
1032
|
+
}
|
|
1033
|
+
function V(e) {
|
|
1034
|
+
let t = e.target;
|
|
1035
|
+
z(t.files ? Array.from(t.files) : []), t.value = "";
|
|
1036
|
+
}
|
|
1037
|
+
function H() {
|
|
1038
|
+
C.value || (v.value = !0);
|
|
1039
|
+
}
|
|
1040
|
+
function U() {
|
|
1041
|
+
v.value = !1;
|
|
1042
|
+
}
|
|
1043
|
+
function W(e) {
|
|
1044
|
+
if (v.value = !1, C.value) return;
|
|
1045
|
+
let t = e.dataTransfer?.files ? Array.from(e.dataTransfer.files) : [];
|
|
1046
|
+
t.length && z(t);
|
|
1047
|
+
}
|
|
1048
|
+
async function G(e) {
|
|
1049
|
+
if (C.value) return;
|
|
1050
|
+
let t = E.value[e], n = E.value.filter((t, n) => n !== e);
|
|
1051
|
+
if (S.value = [], E.value = n, c("update:modelValue", n), c("remove", t, e), await f(), n.length === 0) {
|
|
1052
|
+
h.value?.focus();
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
let r = Math.min(e, n.length - 1);
|
|
1056
|
+
_.value[r]?.focus();
|
|
1057
|
+
}
|
|
1058
|
+
function K(e) {
|
|
1059
|
+
if (C.value) {
|
|
1060
|
+
e.target.blur();
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
c("focus", e);
|
|
1064
|
+
}
|
|
1065
|
+
function q(e) {
|
|
1066
|
+
x.value = !0, c("blur", e);
|
|
1067
|
+
}
|
|
1068
|
+
return A(C, (e) => {
|
|
1069
|
+
e && h.value === document.activeElement && h.value.blur();
|
|
1070
|
+
}), (t, o) => (g(), i("div", Re, [
|
|
1071
|
+
n.label ? (g(), i("span", ze, w(n.label), 1)) : r("", !0),
|
|
1072
|
+
a("label", {
|
|
1073
|
+
class: p(["m-file-upload__dropzone", {
|
|
1074
|
+
"m-file-upload__dropzone--dragging": v.value,
|
|
1075
|
+
"m-file-upload__dropzone--error": N.value,
|
|
1076
|
+
"m-file-upload__dropzone--disabled": C.value
|
|
1077
|
+
}]),
|
|
1078
|
+
onDragover: M(H, ["prevent"]),
|
|
1079
|
+
onDragleave: U,
|
|
1080
|
+
onDrop: M(W, ["prevent"])
|
|
1081
|
+
}, [a("input", d(t.$attrs, {
|
|
1082
|
+
id: D(l),
|
|
1083
|
+
ref_key: "fileInput",
|
|
1084
|
+
ref: h,
|
|
1085
|
+
class: "m-file-upload__input",
|
|
1086
|
+
type: "file",
|
|
1087
|
+
name: n.name,
|
|
1088
|
+
accept: n.accept || void 0,
|
|
1089
|
+
multiple: n.multiple,
|
|
1090
|
+
required: n.required && E.value.length === 0,
|
|
1091
|
+
disabled: C.value,
|
|
1092
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1093
|
+
"aria-invalid": N.value ? "true" : void 0,
|
|
1094
|
+
"aria-describedby": D(P) || void 0,
|
|
1095
|
+
onChange: V,
|
|
1096
|
+
onBlur: q,
|
|
1097
|
+
onFocus: K
|
|
1098
|
+
}), null, 16, Be), a("span", Ve, [a("span", He, w(T.value), 1), a("span", Ue, w(n.dropHint), 1)])], 34),
|
|
1099
|
+
n.loading ? (g(), i("progress", {
|
|
1100
|
+
key: 1,
|
|
1101
|
+
class: "m-file-upload__progress",
|
|
1102
|
+
value: n.progress,
|
|
1103
|
+
max: "100"
|
|
1104
|
+
}, w(n.progress) + "%", 9, We)) : r("", !0),
|
|
1105
|
+
E.value.length ? (g(), i("ul", Ge, [(g(!0), i(e, null, b(E.value, (e, t) => (g(), i("li", {
|
|
1106
|
+
key: `${e.name}-${e.lastModified}-${t}`,
|
|
1107
|
+
class: "m-file-upload__item"
|
|
1108
|
+
}, [
|
|
1109
|
+
a("span", Ke, w(e.name), 1),
|
|
1110
|
+
a("span", qe, w(F(e.size)), 1),
|
|
1111
|
+
a("button", {
|
|
1112
|
+
ref_for: !0,
|
|
1113
|
+
ref_key: "removeButtons",
|
|
1114
|
+
ref: _,
|
|
1115
|
+
type: "button",
|
|
1116
|
+
class: "m-file-upload__remove",
|
|
1117
|
+
disabled: C.value,
|
|
1118
|
+
"aria-label": `${n.removeLabel} ${e.name}`,
|
|
1119
|
+
onClick: (e) => G(t)
|
|
1120
|
+
}, " × ", 8, Je)
|
|
1121
|
+
]))), 128))])) : r("", !0),
|
|
1122
|
+
n.hint ? (g(), i("p", {
|
|
1123
|
+
key: 3,
|
|
1124
|
+
id: D(u),
|
|
1125
|
+
class: "m-file-upload__hint"
|
|
1126
|
+
}, w(n.hint), 9, Ye)) : r("", !0),
|
|
1127
|
+
j.value.length ? (g(), i("ul", {
|
|
1128
|
+
key: 4,
|
|
1129
|
+
id: D(m),
|
|
1130
|
+
class: "m-file-upload__errors",
|
|
1131
|
+
role: "alert"
|
|
1132
|
+
}, [(g(!0), i(e, null, b(j.value, (e, t) => (g(), i("li", {
|
|
1133
|
+
key: `${e}-${t}`,
|
|
1134
|
+
class: "m-file-upload__error"
|
|
1135
|
+
}, w(e), 1))), 128))], 8, Xe)) : r("", !0)
|
|
1136
|
+
]));
|
|
1137
|
+
}
|
|
1138
|
+
}), [["__scopeId", "data-v-b3bc0fc7"]]), Qe = { class: "m-switch-group" }, $e = ["for"], et = {
|
|
1139
|
+
key: 0,
|
|
1140
|
+
class: "m-switch__label"
|
|
1141
|
+
}, tt = { class: "m-switch__control" }, nt = [
|
|
1142
|
+
"id",
|
|
1143
|
+
"name",
|
|
1144
|
+
"required",
|
|
1145
|
+
"checked",
|
|
1146
|
+
"disabled",
|
|
1147
|
+
"aria-busy",
|
|
1148
|
+
"aria-invalid",
|
|
1149
|
+
"aria-describedby"
|
|
1150
|
+
], rt = {
|
|
1151
|
+
key: 0,
|
|
1152
|
+
class: "m-switch__state",
|
|
1153
|
+
"aria-hidden": "true"
|
|
1154
|
+
}, it = ["id"], at = ["id"], ot = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1155
|
+
name: "MSwitch",
|
|
1156
|
+
inheritAttrs: !1,
|
|
1157
|
+
__name: "MSwitch",
|
|
1158
|
+
props: {
|
|
1159
|
+
modelValue: {
|
|
1160
|
+
type: Boolean,
|
|
1161
|
+
default: !1
|
|
1162
|
+
},
|
|
1163
|
+
label: { default: "" },
|
|
1164
|
+
id: { default: "" },
|
|
1165
|
+
name: { default: "" },
|
|
1166
|
+
required: {
|
|
1167
|
+
type: Boolean,
|
|
1168
|
+
default: !1
|
|
1169
|
+
},
|
|
1170
|
+
disabled: {
|
|
1171
|
+
type: Boolean,
|
|
1172
|
+
default: !1
|
|
1173
|
+
},
|
|
1174
|
+
loading: {
|
|
1175
|
+
type: Boolean,
|
|
1176
|
+
default: !1
|
|
1177
|
+
},
|
|
1178
|
+
error: { default: "" },
|
|
1179
|
+
hint: { default: "" },
|
|
1180
|
+
invalid: {
|
|
1181
|
+
type: Boolean,
|
|
1182
|
+
default: !1
|
|
1183
|
+
},
|
|
1184
|
+
submitTriggered: {
|
|
1185
|
+
type: Boolean,
|
|
1186
|
+
default: !1
|
|
1187
|
+
},
|
|
1188
|
+
onLabel: { default: "" },
|
|
1189
|
+
offLabel: { default: "" }
|
|
1190
|
+
},
|
|
1191
|
+
emits: [
|
|
1192
|
+
"update:modelValue",
|
|
1193
|
+
"blur",
|
|
1194
|
+
"focus"
|
|
1195
|
+
],
|
|
1196
|
+
setup(n, { emit: o }) {
|
|
1197
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), m = y(), h = y(!1), _ = t(() => s.disabled || s.loading), v = y(s.modelValue);
|
|
1198
|
+
A(() => s.modelValue, (e) => {
|
|
1199
|
+
v.value = e;
|
|
1200
|
+
});
|
|
1201
|
+
let x = t(() => v.value ? s.onLabel : s.offLabel), { formSubmitTriggered: S, resolvedErrors: C } = B(() => s.name, () => s.error), T = t(() => h.value || s.submitTriggered || S.value ? C.value : []), E = t(() => s.invalid || T.value.length > 0), { describedBy: O } = R(() => s.hint, u, f, () => T.value.length > 0);
|
|
1202
|
+
function k(e) {
|
|
1203
|
+
v.value = e, c("update:modelValue", e);
|
|
1204
|
+
}
|
|
1205
|
+
function j(e) {
|
|
1206
|
+
k(e.target.checked);
|
|
1207
|
+
}
|
|
1208
|
+
function M(e) {
|
|
1209
|
+
e.key !== "Enter" || _.value || (e.preventDefault(), k(!v.value));
|
|
1210
|
+
}
|
|
1211
|
+
function N(e) {
|
|
1212
|
+
if (_.value) {
|
|
1213
|
+
e.target.blur();
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
c("focus", e);
|
|
1217
|
+
}
|
|
1218
|
+
function P(e) {
|
|
1219
|
+
h.value = !0, c("blur", e);
|
|
1220
|
+
}
|
|
1221
|
+
return A(_, (e) => {
|
|
1222
|
+
e && m.value === document.activeElement && m.value.blur();
|
|
1223
|
+
}), (t, o) => (g(), i("div", Qe, [
|
|
1224
|
+
a("label", {
|
|
1225
|
+
class: p(["m-switch", { "m-switch--disabled": _.value }]),
|
|
1226
|
+
for: D(l)
|
|
1227
|
+
}, [n.label ? (g(), i("span", et, w(n.label), 1)) : r("", !0), a("span", tt, [a("input", d(t.$attrs, {
|
|
1228
|
+
id: D(l),
|
|
1229
|
+
ref_key: "switchInput",
|
|
1230
|
+
ref: m,
|
|
1231
|
+
class: ["m-switch__input", { "m-switch__input--error": E.value }],
|
|
1232
|
+
type: "checkbox",
|
|
1233
|
+
role: "switch",
|
|
1234
|
+
name: n.name,
|
|
1235
|
+
required: n.required,
|
|
1236
|
+
checked: v.value,
|
|
1237
|
+
disabled: _.value,
|
|
1238
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1239
|
+
"aria-invalid": E.value ? "true" : void 0,
|
|
1240
|
+
"aria-describedby": D(O) || void 0,
|
|
1241
|
+
onChange: j,
|
|
1242
|
+
onKeydown: M,
|
|
1243
|
+
onBlur: P,
|
|
1244
|
+
onFocus: N
|
|
1245
|
+
}), null, 16, nt), x.value ? (g(), i("span", rt, w(x.value), 1)) : r("", !0)])], 10, $e),
|
|
1246
|
+
n.hint ? (g(), i("p", {
|
|
1247
|
+
key: 0,
|
|
1248
|
+
id: D(u),
|
|
1249
|
+
class: "m-switch__hint"
|
|
1250
|
+
}, w(n.hint), 9, it)) : r("", !0),
|
|
1251
|
+
T.value.length ? (g(), i("ul", {
|
|
1252
|
+
key: 1,
|
|
1253
|
+
id: D(f),
|
|
1254
|
+
class: "m-switch__errors",
|
|
1255
|
+
role: "alert"
|
|
1256
|
+
}, [(g(!0), i(e, null, b(T.value, (e, t) => (g(), i("li", {
|
|
1257
|
+
key: `${e}-${t}`,
|
|
1258
|
+
class: "m-switch__error"
|
|
1259
|
+
}, w(e), 1))), 128))], 8, at)) : r("", !0)
|
|
1260
|
+
]));
|
|
1261
|
+
}
|
|
1262
|
+
}), [["__scopeId", "data-v-5a12d26e"]]), st = { class: "m-radio-group" }, ct = ["for"], lt = [
|
|
1263
|
+
"id",
|
|
1264
|
+
"name",
|
|
1265
|
+
"checked",
|
|
1266
|
+
"disabled",
|
|
1267
|
+
"aria-busy",
|
|
1268
|
+
"aria-invalid",
|
|
1269
|
+
"aria-describedby"
|
|
1270
|
+
], ut = { class: "m-radio__label" }, dt = ["id"], ft = ["id"], pt = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1271
|
+
name: "MRadio",
|
|
1272
|
+
inheritAttrs: !1,
|
|
1273
|
+
__name: "MRadio",
|
|
1274
|
+
props: {
|
|
1275
|
+
modelValue: {
|
|
1276
|
+
type: Boolean,
|
|
1277
|
+
default: !1
|
|
1278
|
+
},
|
|
1279
|
+
label: { default: "Option" },
|
|
1280
|
+
id: { default: "" },
|
|
1281
|
+
name: { default: "radio-group" },
|
|
1282
|
+
disabled: {
|
|
1283
|
+
type: Boolean,
|
|
1284
|
+
default: !1
|
|
1285
|
+
},
|
|
1286
|
+
error: { default: "" },
|
|
1287
|
+
hint: { default: "" },
|
|
1288
|
+
invalid: {
|
|
1289
|
+
type: Boolean,
|
|
1290
|
+
default: !1
|
|
1291
|
+
},
|
|
1292
|
+
loading: {
|
|
1293
|
+
type: Boolean,
|
|
1294
|
+
default: !1
|
|
1295
|
+
},
|
|
1296
|
+
submitTriggered: {
|
|
1297
|
+
type: Boolean,
|
|
1298
|
+
default: !1
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1301
|
+
emits: [
|
|
1302
|
+
"update:modelValue",
|
|
1303
|
+
"blur",
|
|
1304
|
+
"focus"
|
|
1305
|
+
],
|
|
1306
|
+
setup(n, { emit: o }) {
|
|
1307
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => p.value || s.submitTriggered || m.value ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
1308
|
+
function S(e) {
|
|
1309
|
+
c("focus", e);
|
|
1310
|
+
}
|
|
1311
|
+
function C(e) {
|
|
1312
|
+
p.value = !0, c("blur", e);
|
|
1313
|
+
}
|
|
1314
|
+
return (t, o) => (g(), i("div", st, [
|
|
1315
|
+
a("label", {
|
|
1316
|
+
class: "m-radio",
|
|
1317
|
+
for: D(l)
|
|
1318
|
+
}, [a("input", d(t.$attrs, {
|
|
1319
|
+
id: D(l),
|
|
1320
|
+
class: "m-radio__input",
|
|
1321
|
+
type: "radio",
|
|
1322
|
+
name: n.name,
|
|
1323
|
+
checked: n.modelValue,
|
|
1324
|
+
disabled: n.disabled || n.loading,
|
|
1325
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1326
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
1327
|
+
"aria-describedby": D(x) || void 0,
|
|
1328
|
+
onChange: o[0] ||= (e) => c("update:modelValue", !0),
|
|
1329
|
+
onBlur: C,
|
|
1330
|
+
onFocus: S
|
|
1331
|
+
}), null, 16, lt), a("span", ut, w(n.label), 1)], 8, ct),
|
|
1332
|
+
n.hint ? (g(), i("p", {
|
|
1333
|
+
key: 0,
|
|
1334
|
+
id: D(u),
|
|
1335
|
+
class: "m-radio__hint"
|
|
1336
|
+
}, w(n.hint), 9, dt)) : r("", !0),
|
|
1337
|
+
_.value.length ? (g(), i("ul", {
|
|
1338
|
+
key: 1,
|
|
1339
|
+
id: D(f),
|
|
1340
|
+
class: "m-radio__errors",
|
|
1341
|
+
role: "alert"
|
|
1342
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
1343
|
+
key: `${e}-${t}`,
|
|
1344
|
+
class: "m-radio__error"
|
|
1345
|
+
}, w(e), 1))), 128))], 8, ft)) : r("", !0)
|
|
1346
|
+
]));
|
|
1347
|
+
}
|
|
1348
|
+
}), [["__scopeId", "data-v-9820cd2e"]]), mt = {
|
|
1349
|
+
key: 0,
|
|
1350
|
+
class: "m-radio-list__legend"
|
|
1351
|
+
}, ht = ["for"], gt = [
|
|
1352
|
+
"id",
|
|
1353
|
+
"name",
|
|
1354
|
+
"required",
|
|
1355
|
+
"checked",
|
|
1356
|
+
"disabled",
|
|
1357
|
+
"aria-busy",
|
|
1358
|
+
"aria-invalid",
|
|
1359
|
+
"aria-describedby",
|
|
1360
|
+
"onChange"
|
|
1361
|
+
], _t = ["id"], vt = ["id"], yt = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1362
|
+
name: "MRadioList",
|
|
1363
|
+
inheritAttrs: !1,
|
|
1364
|
+
__name: "MRadioList",
|
|
1365
|
+
props: {
|
|
1366
|
+
modelValue: { default: "" },
|
|
1367
|
+
legend: { default: "" },
|
|
1368
|
+
label: { default: "" },
|
|
1369
|
+
id: { default: "" },
|
|
1370
|
+
name: { default: "m-radio-list" },
|
|
1371
|
+
required: {
|
|
1372
|
+
type: Boolean,
|
|
1373
|
+
default: !1
|
|
1374
|
+
},
|
|
1375
|
+
options: { default: () => [] },
|
|
1376
|
+
disabled: {
|
|
1377
|
+
type: Boolean,
|
|
1378
|
+
default: !1
|
|
1379
|
+
},
|
|
1380
|
+
error: { default: "" },
|
|
1381
|
+
hint: { default: "" },
|
|
1382
|
+
invalid: {
|
|
1383
|
+
type: Boolean,
|
|
1384
|
+
default: !1
|
|
1385
|
+
},
|
|
1386
|
+
loading: {
|
|
1387
|
+
type: Boolean,
|
|
1388
|
+
default: !1
|
|
1389
|
+
},
|
|
1390
|
+
submitTriggered: {
|
|
1391
|
+
type: Boolean,
|
|
1392
|
+
default: !1
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
emits: [
|
|
1396
|
+
"update:modelValue",
|
|
1397
|
+
"blur",
|
|
1398
|
+
"focus"
|
|
1399
|
+
],
|
|
1400
|
+
setup(n, { emit: o }) {
|
|
1401
|
+
let s = n, c = o, l = t(() => s.legend || s.label || "Options"), { fieldId: u, hintId: f, errorId: p } = L(() => s.id), m = y(!1), { formSubmitTriggered: h, resolvedErrors: _ } = B(() => s.name, () => s.error), v = t(() => m.value || s.submitTriggered || h.value ? _.value : []), x = t(() => s.invalid || v.value.length > 0), { describedBy: S } = R(() => s.hint, f, p, () => v.value.length > 0);
|
|
1402
|
+
function C(e) {
|
|
1403
|
+
m.value = !0, c("update:modelValue", e);
|
|
1404
|
+
}
|
|
1405
|
+
function T(e) {
|
|
1406
|
+
m.value = !0, c("focus", e);
|
|
1407
|
+
}
|
|
1408
|
+
return (t, o) => (g(), i("fieldset", d(t.$attrs, { class: "m-radio-list" }), [
|
|
1409
|
+
l.value ? (g(), i("legend", mt, w(l.value), 1)) : r("", !0),
|
|
1410
|
+
(g(!0), i(e, null, b(n.options, (e) => (g(), i("div", {
|
|
1411
|
+
key: e.value,
|
|
1412
|
+
class: "m-radio-list__item"
|
|
1413
|
+
}, [a("label", {
|
|
1414
|
+
class: "m-radio-list__option",
|
|
1415
|
+
for: `${D(u)}-${e.value}`
|
|
1416
|
+
}, [a("input", {
|
|
1417
|
+
id: `${D(u)}-${e.value}`,
|
|
1418
|
+
class: "m-radio-list__input",
|
|
1419
|
+
type: "radio",
|
|
1420
|
+
name: n.name,
|
|
1421
|
+
required: n.required,
|
|
1422
|
+
checked: n.modelValue === e.value,
|
|
1423
|
+
disabled: n.disabled || n.loading,
|
|
1424
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1425
|
+
"aria-invalid": x.value ? "true" : void 0,
|
|
1426
|
+
"aria-describedby": D(S) || void 0,
|
|
1427
|
+
onChange: (t) => C(e.value),
|
|
1428
|
+
onBlur: o[0] ||= (e) => c("blur", e),
|
|
1429
|
+
onFocus: o[1] ||= (e) => T(e)
|
|
1430
|
+
}, null, 40, gt), a("span", null, w(e.label), 1)], 8, ht)]))), 128)),
|
|
1431
|
+
n.hint ? (g(), i("p", {
|
|
1432
|
+
key: 1,
|
|
1433
|
+
id: D(f),
|
|
1434
|
+
class: "m-radio-list__hint"
|
|
1435
|
+
}, w(n.hint), 9, _t)) : r("", !0),
|
|
1436
|
+
v.value.length ? (g(), i("ul", {
|
|
1437
|
+
key: 2,
|
|
1438
|
+
id: D(p),
|
|
1439
|
+
class: "m-radio-list__errors",
|
|
1440
|
+
role: "alert"
|
|
1441
|
+
}, [(g(!0), i(e, null, b(v.value, (e, t) => (g(), i("li", {
|
|
1442
|
+
key: `${e}-${t}`,
|
|
1443
|
+
class: "m-radio-list__error"
|
|
1444
|
+
}, w(e), 1))), 128))], 8, vt)) : r("", !0)
|
|
1445
|
+
], 16));
|
|
1446
|
+
}
|
|
1447
|
+
}), [["__scopeId", "data-v-d21c3236"]]), bt = { class: "m-select" }, xt = ["for"], St = [
|
|
1448
|
+
"id",
|
|
1449
|
+
"name",
|
|
1450
|
+
"value",
|
|
1451
|
+
"disabled",
|
|
1452
|
+
"aria-busy",
|
|
1453
|
+
"required",
|
|
1454
|
+
"aria-invalid",
|
|
1455
|
+
"aria-describedby"
|
|
1456
|
+
], Ct = ["value"], wt = ["id"], Tt = ["id"], Et = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1457
|
+
name: "MSelect",
|
|
1458
|
+
inheritAttrs: !1,
|
|
1459
|
+
__name: "MSelect",
|
|
1460
|
+
props: {
|
|
1461
|
+
modelValue: { default: "" },
|
|
1462
|
+
label: { default: "" },
|
|
1463
|
+
id: { default: "" },
|
|
1464
|
+
name: { default: "" },
|
|
1465
|
+
options: { default: () => [] },
|
|
1466
|
+
required: {
|
|
1467
|
+
type: Boolean,
|
|
1468
|
+
default: !1
|
|
1469
|
+
},
|
|
1470
|
+
disabled: {
|
|
1471
|
+
type: Boolean,
|
|
1472
|
+
default: !1
|
|
1473
|
+
},
|
|
1474
|
+
error: { default: "" },
|
|
1475
|
+
hint: { default: "" },
|
|
1476
|
+
invalid: {
|
|
1477
|
+
type: Boolean,
|
|
1478
|
+
default: !1
|
|
1479
|
+
},
|
|
1480
|
+
loading: {
|
|
1481
|
+
type: Boolean,
|
|
1482
|
+
default: !1
|
|
1483
|
+
},
|
|
1484
|
+
submitTriggered: {
|
|
1485
|
+
type: Boolean,
|
|
1486
|
+
default: !1
|
|
1487
|
+
}
|
|
1488
|
+
},
|
|
1489
|
+
emits: [
|
|
1490
|
+
"update:modelValue",
|
|
1491
|
+
"blur",
|
|
1492
|
+
"focus"
|
|
1493
|
+
],
|
|
1494
|
+
setup(n, { emit: o }) {
|
|
1495
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => (p.value || s.submitTriggered || m.value) && h.value.length ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
1496
|
+
function S(e) {
|
|
1497
|
+
let t = e.target.value;
|
|
1498
|
+
p.value = !0, c("update:modelValue", t);
|
|
1499
|
+
}
|
|
1500
|
+
function C(e) {
|
|
1501
|
+
c("focus", e);
|
|
1502
|
+
}
|
|
1503
|
+
function T(e) {
|
|
1504
|
+
p.value = !0, c("blur", e);
|
|
1505
|
+
}
|
|
1506
|
+
return (t, o) => (g(), i("div", bt, [
|
|
1507
|
+
n.label ? (g(), i("label", {
|
|
1508
|
+
key: 0,
|
|
1509
|
+
class: "m-select__label",
|
|
1510
|
+
for: D(l)
|
|
1511
|
+
}, w(n.label), 9, xt)) : r("", !0),
|
|
1512
|
+
a("select", d(t.$attrs, {
|
|
1513
|
+
id: D(l),
|
|
1514
|
+
class: ["m-select__field", { "m-select__field--error": v.value }],
|
|
1515
|
+
name: n.name,
|
|
1516
|
+
value: n.modelValue,
|
|
1517
|
+
disabled: n.disabled || n.loading,
|
|
1518
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1519
|
+
required: n.required,
|
|
1520
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
1521
|
+
"aria-describedby": D(x) || void 0,
|
|
1522
|
+
onChange: o[0] ||= (e) => S(e),
|
|
1523
|
+
onBlur: T,
|
|
1524
|
+
onFocus: C
|
|
1525
|
+
}), [(g(!0), i(e, null, b(n.options, (e) => (g(), i("option", {
|
|
1526
|
+
key: e.value,
|
|
1527
|
+
value: e.value
|
|
1528
|
+
}, w(e.label), 9, Ct))), 128))], 16, St),
|
|
1529
|
+
n.hint ? (g(), i("p", {
|
|
1530
|
+
key: 1,
|
|
1531
|
+
id: D(u),
|
|
1532
|
+
class: "m-select__hint"
|
|
1533
|
+
}, w(n.hint), 9, wt)) : r("", !0),
|
|
1534
|
+
_.value.length ? (g(), i("ul", {
|
|
1535
|
+
key: 2,
|
|
1536
|
+
id: D(f),
|
|
1537
|
+
class: "m-select__errors",
|
|
1538
|
+
role: "alert"
|
|
1539
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
1540
|
+
key: `${e}-${t}`,
|
|
1541
|
+
class: "m-select__error"
|
|
1542
|
+
}, w(e), 1))), 128))], 8, Tt)) : r("", !0)
|
|
1543
|
+
]));
|
|
1544
|
+
}
|
|
1545
|
+
}), [["__scopeId", "data-v-9e2fad3b"]]), Dt = { class: "m-textarea" }, Ot = ["for"], kt = [
|
|
1546
|
+
"id",
|
|
1547
|
+
"name",
|
|
1548
|
+
"value",
|
|
1549
|
+
"disabled",
|
|
1550
|
+
"aria-busy",
|
|
1551
|
+
"rows",
|
|
1552
|
+
"required",
|
|
1553
|
+
"aria-invalid",
|
|
1554
|
+
"aria-describedby"
|
|
1555
|
+
], At = ["id"], jt = ["id"], Mt = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1556
|
+
name: "MTextarea",
|
|
1557
|
+
inheritAttrs: !1,
|
|
1558
|
+
__name: "MTextarea",
|
|
1559
|
+
props: {
|
|
1560
|
+
modelValue: { default: "" },
|
|
1561
|
+
label: { default: "" },
|
|
1562
|
+
id: { default: "" },
|
|
1563
|
+
name: { default: "" },
|
|
1564
|
+
rows: { default: 4 },
|
|
1565
|
+
required: {
|
|
1566
|
+
type: Boolean,
|
|
1567
|
+
default: !1
|
|
1568
|
+
},
|
|
1569
|
+
disabled: {
|
|
1570
|
+
type: Boolean,
|
|
1571
|
+
default: !1
|
|
1572
|
+
},
|
|
1573
|
+
error: { default: "" },
|
|
1574
|
+
hint: { default: "" },
|
|
1575
|
+
invalid: {
|
|
1576
|
+
type: Boolean,
|
|
1577
|
+
default: !1
|
|
1578
|
+
},
|
|
1579
|
+
loading: {
|
|
1580
|
+
type: Boolean,
|
|
1581
|
+
default: !1
|
|
1582
|
+
},
|
|
1583
|
+
submitTriggered: {
|
|
1584
|
+
type: Boolean,
|
|
1585
|
+
default: !1
|
|
1586
|
+
}
|
|
1587
|
+
},
|
|
1588
|
+
emits: [
|
|
1589
|
+
"update:modelValue",
|
|
1590
|
+
"blur",
|
|
1591
|
+
"focus"
|
|
1592
|
+
],
|
|
1593
|
+
setup(n, { emit: o }) {
|
|
1594
|
+
let s = n, c = o, { fieldId: l, hintId: u, errorId: f } = L(() => s.id), p = y(!1), { formSubmitTriggered: m, resolvedErrors: h } = B(() => s.name, () => s.error), _ = t(() => p.value || s.submitTriggered || m.value ? h.value : []), v = t(() => s.invalid || _.value.length > 0), { describedBy: x } = R(() => s.hint, u, f, () => _.value.length > 0);
|
|
1595
|
+
function S(e) {
|
|
1596
|
+
c("focus", e);
|
|
1597
|
+
}
|
|
1598
|
+
function C(e) {
|
|
1599
|
+
p.value = !0, c("blur", e);
|
|
1600
|
+
}
|
|
1601
|
+
return (t, o) => (g(), i("div", Dt, [
|
|
1602
|
+
n.label ? (g(), i("label", {
|
|
1603
|
+
key: 0,
|
|
1604
|
+
class: "m-textarea__label",
|
|
1605
|
+
for: D(l)
|
|
1606
|
+
}, w(n.label), 9, Ot)) : r("", !0),
|
|
1607
|
+
a("textarea", d(t.$attrs, {
|
|
1608
|
+
id: D(l),
|
|
1609
|
+
class: ["m-textarea__field", { "m-textarea__field--error": v.value }],
|
|
1610
|
+
name: n.name,
|
|
1611
|
+
value: n.modelValue,
|
|
1612
|
+
disabled: n.disabled || n.loading,
|
|
1613
|
+
"aria-busy": n.loading ? "true" : void 0,
|
|
1614
|
+
rows: n.rows,
|
|
1615
|
+
required: n.required,
|
|
1616
|
+
"aria-invalid": v.value ? "true" : void 0,
|
|
1617
|
+
"aria-describedby": D(x) || void 0,
|
|
1618
|
+
onInput: o[0] ||= (e) => c("update:modelValue", e.target.value),
|
|
1619
|
+
onBlur: C,
|
|
1620
|
+
onFocus: S
|
|
1621
|
+
}), null, 16, kt),
|
|
1622
|
+
n.hint ? (g(), i("p", {
|
|
1623
|
+
key: 1,
|
|
1624
|
+
id: D(u),
|
|
1625
|
+
class: "m-textarea__hint"
|
|
1626
|
+
}, w(n.hint), 9, At)) : r("", !0),
|
|
1627
|
+
_.value.length ? (g(), i("ul", {
|
|
1628
|
+
key: 2,
|
|
1629
|
+
id: D(f),
|
|
1630
|
+
class: "m-textarea__errors",
|
|
1631
|
+
role: "alert"
|
|
1632
|
+
}, [(g(!0), i(e, null, b(_.value, (e, t) => (g(), i("li", {
|
|
1633
|
+
key: `${e}-${t}`,
|
|
1634
|
+
class: "m-textarea__error"
|
|
1635
|
+
}, w(e), 1))), 128))], 8, jt)) : r("", !0)
|
|
1636
|
+
]));
|
|
1637
|
+
}
|
|
1638
|
+
}), [["__scopeId", "data-v-7787cf8d"]]), Nt = ["aria-labelledby"], Pt = { class: "m-validation-summary__list" }, Ft = ["href", "onClick"], It = {
|
|
1639
|
+
key: 0,
|
|
1640
|
+
class: "m-validation-summary__label"
|
|
1641
|
+
}, Lt = { key: 1 }, Rt = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1642
|
+
name: "MValidationSummary",
|
|
1643
|
+
__name: "MValidationSummary",
|
|
1644
|
+
props: {
|
|
1645
|
+
errors: { default: () => ({}) },
|
|
1646
|
+
labels: { default: () => ({}) },
|
|
1647
|
+
fieldIds: { default: () => ({}) },
|
|
1648
|
+
title: { default: "Corrija os erros abaixo para continuar." },
|
|
1649
|
+
headingLevel: { default: 2 },
|
|
1650
|
+
autofocus: {
|
|
1651
|
+
type: Boolean,
|
|
1652
|
+
default: !1
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
setup(s, { expose: c }) {
|
|
1656
|
+
let l = s, u = y(), d = k(), p = t(() => `h${l.headingLevel}`), m = t(() => Object.entries(l.errors).map(([e, t]) => ({
|
|
1657
|
+
name: e,
|
|
1658
|
+
messages: z(t)
|
|
1659
|
+
})).filter(({ messages: e }) => e.length > 0).map(({ name: e, messages: t }) => ({
|
|
1660
|
+
name: e,
|
|
1661
|
+
messages: t,
|
|
1662
|
+
label: l.labels[e] ?? "",
|
|
1663
|
+
targetId: l.fieldIds[e] ?? e,
|
|
1664
|
+
linkable: e !== X
|
|
1665
|
+
})));
|
|
1666
|
+
function h(e) {
|
|
1667
|
+
return document.getElementById(e.targetId) || (u.value?.closest("form") ?? document).querySelector(`[name="${e.name.replace(/["\\]/g, "\\$&")}"]`);
|
|
1668
|
+
}
|
|
1669
|
+
function _(e, t) {
|
|
1670
|
+
let n = h(e);
|
|
1671
|
+
n && (t.preventDefault(), n.focus());
|
|
1672
|
+
}
|
|
1673
|
+
return A(() => m.value.length, async (e, t) => {
|
|
1674
|
+
!l.autofocus || !e || t || (await f(), u.value?.focus());
|
|
1675
|
+
}), c({ focus: () => u.value?.focus() }), (t, c) => m.value.length ? (g(), i("div", {
|
|
1676
|
+
key: 0,
|
|
1677
|
+
ref_key: "root",
|
|
1678
|
+
ref: u,
|
|
1679
|
+
class: "m-validation-summary",
|
|
1680
|
+
role: "alert",
|
|
1681
|
+
tabindex: "-1",
|
|
1682
|
+
"aria-labelledby": D(d)
|
|
1683
|
+
}, [(g(), n(S(p.value), {
|
|
1684
|
+
id: D(d),
|
|
1685
|
+
class: "m-validation-summary__title"
|
|
1686
|
+
}, {
|
|
1687
|
+
default: j(() => [o(w(s.title), 1)]),
|
|
1688
|
+
_: 1
|
|
1689
|
+
}, 8, ["id"])), a("ul", Pt, [(g(!0), i(e, null, b(m.value, (t) => (g(), i(e, { key: t.name }, [(g(!0), i(e, null, b(t.messages, (e, n) => (g(), i("li", {
|
|
1690
|
+
key: `${t.name}-${n}`,
|
|
1691
|
+
class: "m-validation-summary__item"
|
|
1692
|
+
}, [t.linkable ? (g(), i("a", {
|
|
1693
|
+
key: 0,
|
|
1694
|
+
class: "m-validation-summary__link",
|
|
1695
|
+
href: `#${t.targetId}`,
|
|
1696
|
+
onClick: (e) => _(t, e)
|
|
1697
|
+
}, [t.label ? (g(), i("span", It, w(t.label) + ": ", 1)) : r("", !0), o(w(e), 1)], 8, Ft)) : (g(), i("span", Lt, w(e), 1))]))), 128))], 64))), 128))])], 8, Nt)) : r("", !0);
|
|
1698
|
+
}
|
|
1699
|
+
}), [["__scopeId", "data-v-78af1d0d"]]), zt = ["aria-labelledby", "aria-busy"], Bt = {
|
|
1700
|
+
key: 0,
|
|
1701
|
+
class: "m-list__header"
|
|
1702
|
+
}, Vt = ["id"], Ht = ["id"], Ut = {
|
|
1703
|
+
key: 1,
|
|
1704
|
+
class: "m-list__toolbar"
|
|
1705
|
+
}, Wt = {
|
|
1706
|
+
key: 0,
|
|
1707
|
+
class: "m-list__control m-list__control--search"
|
|
1708
|
+
}, Gt = ["for"], Kt = { class: "m-list__search-wrap" }, qt = [
|
|
1709
|
+
"id",
|
|
1710
|
+
"value",
|
|
1711
|
+
"placeholder",
|
|
1712
|
+
"autocomplete",
|
|
1713
|
+
"disabled",
|
|
1714
|
+
"aria-controls"
|
|
1715
|
+
], Jt = ["disabled", "aria-label"], Yt = {
|
|
1716
|
+
key: 1,
|
|
1717
|
+
class: "m-list__control"
|
|
1718
|
+
}, Xt = ["for"], Zt = [
|
|
1719
|
+
"id",
|
|
1720
|
+
"value",
|
|
1721
|
+
"disabled",
|
|
1722
|
+
"aria-controls"
|
|
1723
|
+
], Qt = { value: "" }, $t = ["value"], en = {
|
|
1724
|
+
key: 2,
|
|
1725
|
+
class: "m-list__control"
|
|
1726
|
+
}, tn = ["for"], nn = [
|
|
1727
|
+
"id",
|
|
1728
|
+
"value",
|
|
1729
|
+
"disabled",
|
|
1730
|
+
"aria-controls"
|
|
1731
|
+
], rn = ["value"], an = {
|
|
1732
|
+
key: 3,
|
|
1733
|
+
class: "m-list__control"
|
|
1734
|
+
}, on = ["for"], sn = [
|
|
1735
|
+
"id",
|
|
1736
|
+
"value",
|
|
1737
|
+
"disabled",
|
|
1738
|
+
"aria-controls"
|
|
1739
|
+
], cn = { value: "asc" }, ln = { value: "desc" }, un = {
|
|
1740
|
+
key: 2,
|
|
1741
|
+
class: "m-list__status",
|
|
1742
|
+
role: "status",
|
|
1743
|
+
"aria-live": "polite"
|
|
1744
|
+
}, dn = {
|
|
1745
|
+
key: 3,
|
|
1746
|
+
class: "m-list__load-error",
|
|
1747
|
+
role: "alert"
|
|
1748
|
+
}, fn = ["disabled"], pn = [
|
|
1749
|
+
"id",
|
|
1750
|
+
"aria-label",
|
|
1751
|
+
"aria-describedby"
|
|
1752
|
+
], mn = {
|
|
1753
|
+
key: 0,
|
|
1754
|
+
class: "m-list__empty"
|
|
1755
|
+
}, hn = {
|
|
1756
|
+
key: 1,
|
|
1757
|
+
class: "m-list__loading"
|
|
1758
|
+
}, gn = ["aria-label"], _n = ["disabled", "aria-label"], vn = {
|
|
1759
|
+
class: "m-list__page-status",
|
|
1760
|
+
"aria-live": "polite"
|
|
1761
|
+
}, yn = ["disabled", "aria-label"], bn = "Direção da ordenação", xn = /*#__PURE__*/ F(/* @__PURE__ */ s({
|
|
1762
|
+
name: "MList",
|
|
1763
|
+
inheritAttrs: !1,
|
|
1764
|
+
__name: "MList",
|
|
1765
|
+
props: {
|
|
1766
|
+
items: { default: () => [] },
|
|
1767
|
+
id: { default: "" },
|
|
1768
|
+
label: { default: "" },
|
|
1769
|
+
hint: { default: "" },
|
|
1770
|
+
ariaLabel: { default: "" },
|
|
1771
|
+
itemKey: {
|
|
1772
|
+
type: [String, Function],
|
|
1773
|
+
default: ""
|
|
1774
|
+
},
|
|
1775
|
+
itemLabel: {
|
|
1776
|
+
type: [String, Function],
|
|
1777
|
+
default: ""
|
|
1778
|
+
},
|
|
1779
|
+
searchable: {
|
|
1780
|
+
type: Boolean,
|
|
1781
|
+
default: !1
|
|
1782
|
+
},
|
|
1783
|
+
searchLabel: { default: "Filtrar lista" },
|
|
1784
|
+
searchPlaceholder: { default: "Buscar" },
|
|
1785
|
+
searchAutocomplete: { default: "off" },
|
|
1786
|
+
searchFields: { default: () => [] },
|
|
1787
|
+
searchDebounce: { default: 0 },
|
|
1788
|
+
clearSearchLabel: { default: "Limpar busca" },
|
|
1789
|
+
sortable: {
|
|
1790
|
+
type: Boolean,
|
|
1791
|
+
default: !1
|
|
1792
|
+
},
|
|
1793
|
+
sortLabel: { default: "Ordenar por" },
|
|
1794
|
+
sortPlaceholder: { default: "Selecione uma ordenação" },
|
|
1795
|
+
ascendingLabel: { default: "Crescente" },
|
|
1796
|
+
descendingLabel: { default: "Decrescente" },
|
|
1797
|
+
sortOptions: { default: () => [] },
|
|
1798
|
+
sort: { default: "" },
|
|
1799
|
+
sortDirection: { default: "asc" },
|
|
1800
|
+
page: { default: 1 },
|
|
1801
|
+
pageSize: { default: 10 },
|
|
1802
|
+
pageSizeOptions: { default: () => [] },
|
|
1803
|
+
pageSizeLabel: { default: "Itens por página" },
|
|
1804
|
+
allPageSizeLabel: { default: "Todos" },
|
|
1805
|
+
density: { default: "compact" },
|
|
1806
|
+
serverSide: {
|
|
1807
|
+
type: Boolean,
|
|
1808
|
+
default: !1
|
|
1809
|
+
},
|
|
1810
|
+
totalItems: { default: void 0 },
|
|
1811
|
+
loadError: { default: "" },
|
|
1812
|
+
retryLabel: { default: "Tentar novamente" },
|
|
1813
|
+
loading: {
|
|
1814
|
+
type: Boolean,
|
|
1815
|
+
default: !1
|
|
1816
|
+
},
|
|
1817
|
+
emptyLabel: { default: "Nenhum item encontrado." },
|
|
1818
|
+
loadingLabel: { default: "Carregando lista..." },
|
|
1819
|
+
paginationLabel: { default: "Paginação da lista" },
|
|
1820
|
+
previousPageLabel: { default: "Anterior" },
|
|
1821
|
+
nextPageLabel: { default: "Próxima" }
|
|
1822
|
+
},
|
|
1823
|
+
emits: [
|
|
1824
|
+
"update:page",
|
|
1825
|
+
"update:sort",
|
|
1826
|
+
"update:sortDirection",
|
|
1827
|
+
"update:pageSize",
|
|
1828
|
+
"search",
|
|
1829
|
+
"query",
|
|
1830
|
+
"retry"
|
|
1831
|
+
],
|
|
1832
|
+
setup(n, { emit: o }) {
|
|
1833
|
+
let s = n, c = o, { fieldId: l, hintId: u } = L(() => s.id), _ = t(() => `${l.value}-label`), v = t(() => `${l.value}-search`), S = t(() => `${l.value}-sort`), C = t(() => `${l.value}-sort-direction`), T = t(() => `${l.value}-page-size`), E = y(), O = y(), k = y(""), j = y(""), M, N = y(s.page), P = y(s.sort), F = y(s.sortDirection), I = y(s.pageSize), R = t(() => Math.max(1, N.value)), z = t(() => P.value), B = t(() => F.value), V = t(() => String(I.value)), H = t(() => {
|
|
1834
|
+
if (s.serverSide) return [...s.items];
|
|
1835
|
+
let e = j.value.trim().toLocaleLowerCase();
|
|
1836
|
+
if (!e) return [...s.items];
|
|
1837
|
+
let t = s.searchFields.length ? s.searchFields : Object.keys(s.items[0] ?? {});
|
|
1838
|
+
return s.items.filter((n, r) => {
|
|
1839
|
+
let i = ce(n, r);
|
|
1840
|
+
return t.map((e) => String(n[e] ?? "")).concat(i).some((t) => t.toLocaleLowerCase().includes(e));
|
|
1841
|
+
});
|
|
1842
|
+
}), U = t(() => {
|
|
1843
|
+
if (s.serverSide) return H.value;
|
|
1844
|
+
let e = [...H.value];
|
|
1845
|
+
if (!P.value) return e;
|
|
1846
|
+
let t = s.sortOptions.find((e) => e.value === P.value);
|
|
1847
|
+
if (!t) return e;
|
|
1848
|
+
let n = F.value === "asc" ? 1 : -1;
|
|
1849
|
+
return e.sort((e, r) => (t.compare ? t.compare(e, r) : oe(e[P.value], r[P.value])) * n);
|
|
1850
|
+
}), W = t(() => s.serverSide ? Math.max(0, s.totalItems ?? s.items.length) : U.value.length), G = t(() => I.value === "all" ? Math.max(1, W.value) : Math.max(1, I.value)), K = t(() => {
|
|
1851
|
+
let e = W.value, t = [...new Set(s.pageSizeOptions)].filter((t) => t === "all" || Number.isInteger(t) && t > 0 && t <= e), n = t.some((t) => t !== "all" && t >= e), r = I.value === "all";
|
|
1852
|
+
return t.filter((e) => e !== "all" || !n || r);
|
|
1853
|
+
}), q = t(() => Math.max(1, Math.ceil(W.value / G.value))), ee = t(() => {
|
|
1854
|
+
if (s.serverSide) return U.value;
|
|
1855
|
+
let e = (Math.min(R.value, q.value) - 1) * G.value;
|
|
1856
|
+
return U.value.slice(e, e + G.value);
|
|
1857
|
+
}), te = t(() => W.value === 0 ? 0 : (Math.min(R.value, q.value) - 1) * G.value + 1), ne = t(() => Math.min(te.value + G.value - 1, W.value)), re = t(() => W.value === 1 ? "item" : "itens"), ie = t(() => s.loading ? "" : W.value === 0 ? `0 ${re.value}` : q.value <= 1 ? `${W.value} ${re.value}` : `Mostrando ${te.value}–${ne.value} de ${W.value} ${re.value}`), ae = t(() => `Página ${Math.min(R.value, q.value)} de ${q.value}`);
|
|
1858
|
+
A(() => s.page, (e) => {
|
|
1859
|
+
N.value = e;
|
|
1860
|
+
}), A(() => s.sort, (e) => {
|
|
1861
|
+
P.value = e;
|
|
1862
|
+
}), A(() => s.sortDirection, (e) => {
|
|
1863
|
+
F.value = e;
|
|
1864
|
+
}), A(() => s.pageSize, (e) => {
|
|
1865
|
+
I.value = e;
|
|
1866
|
+
}), A([W, G], () => {
|
|
1867
|
+
R.value > q.value && J(q.value, void 0, !1);
|
|
1868
|
+
}), m(() => {
|
|
1869
|
+
M && clearTimeout(M);
|
|
1870
|
+
}), h(() => {
|
|
1871
|
+
s.serverSide && X();
|
|
1872
|
+
});
|
|
1873
|
+
function oe(e, t) {
|
|
1874
|
+
let n = String(e ?? "").toLocaleLowerCase(), r = String(t ?? "").toLocaleLowerCase();
|
|
1875
|
+
return n.localeCompare(r, void 0, {
|
|
1876
|
+
numeric: !0,
|
|
1877
|
+
sensitivity: "base"
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
function se(e) {
|
|
1881
|
+
let t = s.items.indexOf(e);
|
|
1882
|
+
return typeof s.itemKey == "function" ? s.itemKey(e, t) : s.itemKey ? String(e[s.itemKey] ?? t) : t;
|
|
1883
|
+
}
|
|
1884
|
+
function ce(e, t = s.items.indexOf(e)) {
|
|
1885
|
+
return typeof s.itemLabel == "function" ? s.itemLabel(e, t) : s.itemLabel ? String(e[s.itemLabel] ?? "") : String(e.label ?? e.name ?? e.title ?? "");
|
|
1886
|
+
}
|
|
1887
|
+
function le(e) {
|
|
1888
|
+
return s.items.indexOf(e);
|
|
1889
|
+
}
|
|
1890
|
+
function J(e, t, n = !0) {
|
|
1891
|
+
let r = Math.min(Math.max(1, e), q.value);
|
|
1892
|
+
if (r === R.value) return;
|
|
1893
|
+
let i = t?.currentTarget;
|
|
1894
|
+
N.value = r, c("update:page", r), X(), n && ue(i);
|
|
1895
|
+
}
|
|
1896
|
+
async function ue(e) {
|
|
1897
|
+
if (await f(), e?.isConnected && !e.disabled) {
|
|
1898
|
+
e.focus();
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
O.value?.querySelector("button:not(:disabled)")?.focus();
|
|
1902
|
+
}
|
|
1903
|
+
function Y(e) {
|
|
1904
|
+
j.value = e, N.value = 1, c("search", e), c("update:page", 1), X();
|
|
1905
|
+
}
|
|
1906
|
+
function X() {
|
|
1907
|
+
c("query", {
|
|
1908
|
+
page: R.value,
|
|
1909
|
+
pageSize: I.value,
|
|
1910
|
+
search: k.value,
|
|
1911
|
+
sort: P.value,
|
|
1912
|
+
sortDirection: F.value
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
function Z(e) {
|
|
1916
|
+
let t = e.target.value;
|
|
1917
|
+
k.value = t, M && clearTimeout(M), s.searchDebounce > 0 ? M = setTimeout(() => Y(t), s.searchDebounce) : Y(t);
|
|
1918
|
+
}
|
|
1919
|
+
function Q() {
|
|
1920
|
+
M && clearTimeout(M), k.value = "", Y(""), f(() => E.value?.focus());
|
|
1921
|
+
}
|
|
1922
|
+
function $() {
|
|
1923
|
+
c("retry"), s.serverSide && X();
|
|
1924
|
+
}
|
|
1925
|
+
function de(e) {
|
|
1926
|
+
P.value = e.target.value, N.value = 1, c("update:sort", P.value), c("update:page", 1), X();
|
|
1927
|
+
}
|
|
1928
|
+
function fe(e) {
|
|
1929
|
+
let t = e.target.value, n = t === "all" ? "all" : Number(t);
|
|
1930
|
+
n !== "all" && (!Number.isInteger(n) || n < 1) || (I.value = n, N.value = 1, c("update:pageSize", n), c("update:page", 1), X());
|
|
1931
|
+
}
|
|
1932
|
+
function pe(e) {
|
|
1933
|
+
F.value = e.target.value, N.value = 1, c("update:sortDirection", F.value), c("update:page", 1), X();
|
|
1934
|
+
}
|
|
1935
|
+
function me(e) {
|
|
1936
|
+
e.key === "Escape" && k.value && Q();
|
|
1937
|
+
}
|
|
1938
|
+
return (t, o) => (g(), i("section", {
|
|
1939
|
+
class: p(["m-list", `m-list--${n.density}`]),
|
|
1940
|
+
"aria-labelledby": n.label ? _.value : void 0,
|
|
1941
|
+
"aria-busy": n.loading ? "true" : void 0
|
|
1942
|
+
}, [
|
|
1943
|
+
n.label || t.$slots.header ? (g(), i("header", Bt, [a("div", null, [n.label ? (g(), i("h2", {
|
|
1944
|
+
key: 0,
|
|
1945
|
+
id: _.value,
|
|
1946
|
+
class: "m-list__label"
|
|
1947
|
+
}, w(n.label), 9, Vt)) : r("", !0), n.hint ? (g(), i("p", {
|
|
1948
|
+
key: 1,
|
|
1949
|
+
id: D(u),
|
|
1950
|
+
class: "m-list__hint"
|
|
1951
|
+
}, w(n.hint), 9, Ht)) : r("", !0)]), x(t.$slots, "header", { total: W.value }, void 0, !0)])) : r("", !0),
|
|
1952
|
+
n.searchable || n.sortable || K.value.length ? (g(), i("div", Ut, [
|
|
1953
|
+
n.searchable ? (g(), i("div", Wt, [a("label", {
|
|
1954
|
+
class: "m-list__search-label",
|
|
1955
|
+
for: v.value
|
|
1956
|
+
}, w(n.searchLabel), 9, Gt), a("div", Kt, [a("input", d(t.$attrs, {
|
|
1957
|
+
id: v.value,
|
|
1958
|
+
ref_key: "searchInput",
|
|
1959
|
+
ref: E,
|
|
1960
|
+
class: "m-list__search",
|
|
1961
|
+
type: "search",
|
|
1962
|
+
value: k.value,
|
|
1963
|
+
placeholder: n.searchPlaceholder,
|
|
1964
|
+
autocomplete: n.searchAutocomplete,
|
|
1965
|
+
disabled: n.loading,
|
|
1966
|
+
"aria-controls": D(l),
|
|
1967
|
+
onInput: Z,
|
|
1968
|
+
onKeydown: me
|
|
1969
|
+
}), null, 16, qt), k.value ? (g(), i("button", {
|
|
1970
|
+
key: 0,
|
|
1971
|
+
type: "button",
|
|
1972
|
+
class: "m-list__search-clear",
|
|
1973
|
+
disabled: n.loading,
|
|
1974
|
+
"aria-label": n.clearSearchLabel,
|
|
1975
|
+
onClick: Q
|
|
1976
|
+
}, " × ", 8, Jt)) : r("", !0)])])) : r("", !0),
|
|
1977
|
+
n.sortable && n.sortOptions.length ? (g(), i("div", Yt, [a("label", {
|
|
1978
|
+
class: "m-list__sort-label",
|
|
1979
|
+
for: S.value
|
|
1980
|
+
}, w(n.sortLabel), 9, Xt), a("select", {
|
|
1981
|
+
id: S.value,
|
|
1982
|
+
ref: "sortSelect",
|
|
1983
|
+
class: "m-list__sort",
|
|
1984
|
+
value: z.value,
|
|
1985
|
+
disabled: n.loading,
|
|
1986
|
+
"aria-controls": D(l),
|
|
1987
|
+
onChange: de,
|
|
1988
|
+
onKeydown: me
|
|
1989
|
+
}, [a("option", Qt, w(n.sortPlaceholder), 1), (g(!0), i(e, null, b(n.sortOptions, (e) => (g(), i("option", {
|
|
1990
|
+
key: e.value,
|
|
1991
|
+
value: e.value
|
|
1992
|
+
}, w(e.label), 9, $t))), 128))], 40, Zt)])) : r("", !0),
|
|
1993
|
+
K.value.length ? (g(), i("div", en, [a("label", {
|
|
1994
|
+
class: "m-list__page-size-label",
|
|
1995
|
+
for: T.value
|
|
1996
|
+
}, w(n.pageSizeLabel), 9, tn), a("select", {
|
|
1997
|
+
id: T.value,
|
|
1998
|
+
ref: "pageSizeSelect",
|
|
1999
|
+
class: "m-list__page-size",
|
|
2000
|
+
value: V.value,
|
|
2001
|
+
disabled: n.loading,
|
|
2002
|
+
"aria-controls": D(l),
|
|
2003
|
+
onChange: fe
|
|
2004
|
+
}, [(g(!0), i(e, null, b(K.value, (e) => (g(), i("option", {
|
|
2005
|
+
key: String(e),
|
|
2006
|
+
value: String(e)
|
|
2007
|
+
}, w(e === "all" ? n.allPageSizeLabel : e), 9, rn))), 128))], 40, nn)])) : r("", !0),
|
|
2008
|
+
n.sortable && z.value ? (g(), i("div", an, [a("label", {
|
|
2009
|
+
class: "m-list__sort-direction-label",
|
|
2010
|
+
for: C.value
|
|
2011
|
+
}, w(bn), 8, on), a("select", {
|
|
2012
|
+
id: C.value,
|
|
2013
|
+
class: "m-list__sort-direction",
|
|
2014
|
+
value: B.value,
|
|
2015
|
+
disabled: n.loading,
|
|
2016
|
+
"aria-controls": D(l),
|
|
2017
|
+
onChange: pe
|
|
2018
|
+
}, [a("option", cn, w(n.ascendingLabel), 1), a("option", ln, w(n.descendingLabel), 1)], 40, sn)])) : r("", !0)
|
|
2019
|
+
])) : r("", !0),
|
|
2020
|
+
ie.value ? (g(), i("p", un, w(ie.value), 1)) : r("", !0),
|
|
2021
|
+
n.loadError ? (g(), i("div", dn, [a("span", null, w(n.loadError), 1), a("button", {
|
|
2022
|
+
type: "button",
|
|
2023
|
+
class: "m-list__retry",
|
|
2024
|
+
disabled: n.loading,
|
|
2025
|
+
onClick: $
|
|
2026
|
+
}, w(n.retryLabel), 9, fn)])) : r("", !0),
|
|
2027
|
+
a("ul", {
|
|
2028
|
+
id: D(l),
|
|
2029
|
+
class: "m-list__items",
|
|
2030
|
+
"aria-label": n.ariaLabel || void 0,
|
|
2031
|
+
"aria-describedby": n.hint ? D(u) : void 0
|
|
2032
|
+
}, [
|
|
2033
|
+
(g(!0), i(e, null, b(ee.value, (e) => (g(), i("li", {
|
|
2034
|
+
key: se(e),
|
|
2035
|
+
class: "m-list__item"
|
|
2036
|
+
}, [x(t.$slots, "item", {
|
|
2037
|
+
item: e,
|
|
2038
|
+
index: le(e)
|
|
2039
|
+
}, () => [a("span", null, w(ce(e)), 1)], !0)]))), 128)),
|
|
2040
|
+
!n.loading && !ee.value.length ? (g(), i("li", mn, w(n.emptyLabel), 1)) : r("", !0),
|
|
2041
|
+
n.loading ? (g(), i("li", hn, w(n.loadingLabel), 1)) : r("", !0)
|
|
2042
|
+
], 8, pn),
|
|
2043
|
+
q.value > 1 ? (g(), i("nav", {
|
|
2044
|
+
key: 4,
|
|
2045
|
+
ref_key: "paginationNav",
|
|
2046
|
+
ref: O,
|
|
2047
|
+
class: "m-list__pagination",
|
|
2048
|
+
"aria-label": n.paginationLabel
|
|
2049
|
+
}, [
|
|
2050
|
+
a("button", {
|
|
2051
|
+
type: "button",
|
|
2052
|
+
class: "m-list__page-button",
|
|
2053
|
+
disabled: n.loading || R.value === 1,
|
|
2054
|
+
"aria-label": n.previousPageLabel,
|
|
2055
|
+
onClick: o[0] ||= (e) => J(R.value - 1, e)
|
|
2056
|
+
}, w(n.previousPageLabel), 9, _n),
|
|
2057
|
+
a("span", vn, w(ae.value), 1),
|
|
2058
|
+
a("button", {
|
|
2059
|
+
type: "button",
|
|
2060
|
+
class: "m-list__page-button",
|
|
2061
|
+
disabled: n.loading || R.value === q.value,
|
|
2062
|
+
"aria-label": n.nextPageLabel,
|
|
2063
|
+
onClick: o[1] ||= (e) => J(R.value + 1, e)
|
|
2064
|
+
}, w(n.nextPageLabel), 9, yn)
|
|
2065
|
+
], 8, gn)) : r("", !0)
|
|
2066
|
+
], 10, zt));
|
|
2067
|
+
}
|
|
2068
|
+
}), [["__scopeId", "data-v-fbf64959"]]);
|
|
2069
|
+
//#endregion
|
|
2070
|
+
//#region src/themes/theme.ts
|
|
2071
|
+
function Sn(e) {
|
|
2072
|
+
return e === "light" || e === "dark" ? e : typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2073
|
+
}
|
|
2074
|
+
function Cn(e, t = document.documentElement) {
|
|
2075
|
+
let n = Sn(e);
|
|
2076
|
+
t.setAttribute("data-theme", n), t.style.colorScheme = n;
|
|
2077
|
+
}
|
|
2078
|
+
//#endregion
|
|
2079
|
+
//#region src/index.ts
|
|
2080
|
+
var wn = { install(e) {
|
|
2081
|
+
e.component("MButton", I), e.component("MCheckbox", q), e.component("MCheckboxList", ae), e.component("MErrorMessage", se), e.component("MFieldsetPanel", Y), e.component("MForm", _e), e.component("MInput", Ce), e.component("MNumber", ke), e.component("MPassword", Le), e.component("MFileUpload", Ze), e.component("MSwitch", ot), e.component("MRadioList", yt), e.component("MRadio", pt), e.component("MSelect", Et), e.component("MTextarea", Mt), e.component("MValidationSummary", Rt), e.component("MList", xn);
|
|
2082
|
+
} };
|
|
2083
|
+
//#endregion
|
|
2084
|
+
export { X as MAGOO_FORM_ERROR_KEY, I as MButton, q as MCheckbox, ae as MCheckboxList, se as MErrorMessage, Y as MFieldsetPanel, Ze as MFileUpload, _e as MForm, Ce as MInput, xn as MList, ke as MNumber, Le as MPassword, pt as MRadio, yt as MRadioList, Et as MSelect, ot as MSwitch, Mt as MTextarea, Rt as MValidationSummary, Cn as applyTheme, $ as compactErrors, wn as default, Z as defaultRuleResultAdapter, fe as focusFirstInvalidField, Q as hasErrors, de as mergeErrors, he as useFormValidation };
|