@m3ui-vue/m3ui-vue 0.4.1 → 0.4.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/dist/{MMenuItem-FyttjOj_.js → MMenuItem-BsZO5XuL.js} +105 -106
- package/dist/MMenuItem-BsZO5XuL.js.map +1 -0
- package/dist/composables/useLocale.d.ts +2 -2
- package/dist/m3ui.js +2 -2
- package/dist/m3ui.js.map +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/rich-text-editor.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/useLocale.test.ts +17 -1
- package/src/components/MSlider.vue +1 -1
- package/src/composables/useLocale.ts +9 -3
- package/src/plugin.ts +2 -2
- package/dist/MMenuItem-FyttjOj_.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./MIcon-CaEooCmZ.js";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
3
|
-
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, inject as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, onMounted as _, onUnmounted as v, openBlock as y, provide as b,
|
|
3
|
+
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, inject as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, onMounted as _, onUnmounted as v, openBlock as y, provide as b, reactive as x, ref as S, renderSlot as C, resolveDynamicComponent as w, toDisplayString as T, toValue as E, unref as D, useId as O, useSlots as k, watch as A, watchEffect as j, withCtx as M, withModifiers as N } from "vue";
|
|
4
4
|
//#region src/composables/useLocale.ts
|
|
5
|
-
var
|
|
5
|
+
var P = {
|
|
6
6
|
search: "Search...",
|
|
7
7
|
noResults: "No results",
|
|
8
8
|
close: "Close",
|
|
@@ -71,24 +71,23 @@ var j = {
|
|
|
71
71
|
insertImage: "Insert image",
|
|
72
72
|
imageUrlLabel: "Image URL",
|
|
73
73
|
insert: "Insert"
|
|
74
|
-
},
|
|
75
|
-
function
|
|
76
|
-
let e = p(
|
|
77
|
-
return {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
74
|
+
}, F = Symbol("m3-locale");
|
|
75
|
+
function I() {
|
|
76
|
+
let e = p(F, {}), t = x({ ...P });
|
|
77
|
+
return j(() => {
|
|
78
|
+
Object.assign(t, P, E(e));
|
|
79
|
+
}), t;
|
|
81
80
|
}
|
|
82
81
|
//#endregion
|
|
83
82
|
//#region src/components/MSpinner.vue?vue&type=script&setup=true&lang.ts
|
|
84
|
-
var
|
|
83
|
+
var ee = ["aria-label"], L = {
|
|
85
84
|
key: 0,
|
|
86
85
|
class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
87
|
-
},
|
|
86
|
+
}, R = [
|
|
88
87
|
"width",
|
|
89
88
|
"height",
|
|
90
89
|
"viewBox"
|
|
91
|
-
],
|
|
90
|
+
], z = ["d", "stroke-dasharray"], B = 3, V = 9, H = /* @__PURE__ */ f({
|
|
92
91
|
__name: "MSpinner",
|
|
93
92
|
props: {
|
|
94
93
|
size: { default: 20 },
|
|
@@ -99,10 +98,10 @@ var P = ["aria-label"], F = {
|
|
|
99
98
|
label: {}
|
|
100
99
|
},
|
|
101
100
|
setup(e) {
|
|
102
|
-
let t = e, n =
|
|
103
|
-
let e = i.value, t = r.value, n = t * .08, a =
|
|
101
|
+
let t = e, n = I(), r = a(() => (t.size / 2 - 1 - B / 2) / 1.25), i = a(() => t.size / 2), o = a(() => {
|
|
102
|
+
let e = i.value, t = r.value, n = t * .08, a = V * 24, o = [], s = 0, c = 0, l = 0;
|
|
104
103
|
for (let r = 0; r <= a; r++) {
|
|
105
|
-
let i = 2 * Math.PI * r / a - Math.PI / 2, u = t + n * Math.sin(
|
|
104
|
+
let i = 2 * Math.PI * r / a - Math.PI / 2, u = t + n * Math.sin(V * i), d = e + u * Math.cos(i), f = e + u * Math.sin(i);
|
|
106
105
|
r > 0 && (s += Math.sqrt((d - c) ** 2 + (f - l) ** 2)), o.push(`${r === 0 ? "M" : "L"}${d.toFixed(2)},${f.toFixed(2)}`), c = d, l = f;
|
|
107
106
|
}
|
|
108
107
|
let u = s * .58, d = s - u, f = `${u.toFixed(1)} ${d.toFixed(1)}`;
|
|
@@ -119,7 +118,7 @@ var P = ["aria-label"], F = {
|
|
|
119
118
|
height: `${e.size}px`
|
|
120
119
|
}),
|
|
121
120
|
role: "status",
|
|
122
|
-
"aria-label": e.label ??
|
|
121
|
+
"aria-label": e.label ?? D(n).loading
|
|
123
122
|
}, [e.wavy ? (y(), c("svg", {
|
|
124
123
|
key: 1,
|
|
125
124
|
width: e.size,
|
|
@@ -131,14 +130,14 @@ var P = ["aria-label"], F = {
|
|
|
131
130
|
}, [l("path", {
|
|
132
131
|
d: o.value.path,
|
|
133
132
|
stroke: "currentColor",
|
|
134
|
-
"stroke-width":
|
|
133
|
+
"stroke-width": B,
|
|
135
134
|
"stroke-linecap": "round",
|
|
136
135
|
"stroke-dasharray": o.value.dash,
|
|
137
136
|
class: "animate-[m3-wavy-travel_2s_linear_infinite]",
|
|
138
137
|
style: h({ "--m3-wave-len": o.value.len })
|
|
139
|
-
}, null, 12,
|
|
138
|
+
}, null, 12, z)], 12, R)) : (y(), c("span", L))], 12, ee));
|
|
140
139
|
}
|
|
141
|
-
}),
|
|
140
|
+
}), U = [
|
|
142
141
|
"bg-surface-container-highest",
|
|
143
142
|
"bg-surface-container-high",
|
|
144
143
|
"bg-surface-container-low",
|
|
@@ -159,11 +158,11 @@ var P = ["aria-label"], F = {
|
|
|
159
158
|
"bg-tertiary",
|
|
160
159
|
"bg-error"
|
|
161
160
|
];
|
|
162
|
-
function
|
|
163
|
-
for (let t of
|
|
161
|
+
function W(e) {
|
|
162
|
+
for (let t of U) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
|
|
164
163
|
return null;
|
|
165
164
|
}
|
|
166
|
-
function
|
|
165
|
+
function G(e) {
|
|
167
166
|
if (!e || e === "transparent") return !0;
|
|
168
167
|
let t = e.match(/^rgba?\(([^)]+)\)$/);
|
|
169
168
|
if (t) {
|
|
@@ -172,15 +171,15 @@ function U(e) {
|
|
|
172
171
|
}
|
|
173
172
|
return !1;
|
|
174
173
|
}
|
|
175
|
-
function
|
|
176
|
-
let n =
|
|
174
|
+
function K(e, t) {
|
|
175
|
+
let n = S("var(--color-surface)");
|
|
177
176
|
function r(r) {
|
|
178
177
|
n.value = r, e.value?.style.setProperty("--field-bg", t() ?? r);
|
|
179
178
|
}
|
|
180
179
|
function i() {
|
|
181
180
|
let t = e.value?.parentElement ?? null;
|
|
182
181
|
for (; t;) {
|
|
183
|
-
let e =
|
|
182
|
+
let e = W(t);
|
|
184
183
|
if (e) {
|
|
185
184
|
r(e);
|
|
186
185
|
return;
|
|
@@ -190,7 +189,7 @@ function W(e, t) {
|
|
|
190
189
|
return;
|
|
191
190
|
}
|
|
192
191
|
let n = getComputedStyle(t).backgroundColor;
|
|
193
|
-
if (!
|
|
192
|
+
if (!G(n)) {
|
|
194
193
|
r(n);
|
|
195
194
|
return;
|
|
196
195
|
}
|
|
@@ -212,7 +211,7 @@ function W(e, t) {
|
|
|
212
211
|
}
|
|
213
212
|
//#endregion
|
|
214
213
|
//#region src/components/MIconButton.vue?vue&type=script&setup=true&lang.ts
|
|
215
|
-
var
|
|
214
|
+
var q = "inline-flex shrink-0 items-center justify-center transition-colors duration-150 cursor-pointer disabled:cursor-not-allowed disabled:opacity-[0.38]", J = /* @__PURE__ */ f({
|
|
216
215
|
__name: "MIconButton",
|
|
217
216
|
props: {
|
|
218
217
|
icon: {},
|
|
@@ -265,13 +264,13 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
265
264
|
default: return "text-on-surface-variant hover:bg-on-surface/8 active:bg-on-surface/12";
|
|
266
265
|
}
|
|
267
266
|
});
|
|
268
|
-
return (n, i) => (y(), o(
|
|
267
|
+
return (n, i) => (y(), o(w(r.value), {
|
|
269
268
|
to: t.to || void 0,
|
|
270
269
|
type: t.to ? void 0 : "button",
|
|
271
270
|
"aria-label": t.label || void 0,
|
|
272
271
|
disabled: t.disabled,
|
|
273
272
|
class: m([
|
|
274
|
-
|
|
273
|
+
q,
|
|
275
274
|
c.value,
|
|
276
275
|
u.value,
|
|
277
276
|
"relative overflow-hidden"
|
|
@@ -282,7 +281,7 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
282
281
|
}),
|
|
283
282
|
onPointerdown: l
|
|
284
283
|
}, {
|
|
285
|
-
default:
|
|
284
|
+
default: M(() => [d(e, {
|
|
286
285
|
name: t.icon,
|
|
287
286
|
size: s.value.icon
|
|
288
287
|
}, null, 8, ["name", "size"])]),
|
|
@@ -296,7 +295,7 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
296
295
|
"style"
|
|
297
296
|
]));
|
|
298
297
|
}
|
|
299
|
-
}),
|
|
298
|
+
}), Y = "relative inline-flex items-center justify-center gap-2 font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-[0.38] disabled:shadow-none before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", X = /* @__PURE__ */ f({
|
|
300
299
|
__name: "MButton",
|
|
301
300
|
props: {
|
|
302
301
|
variant: { default: "filled" },
|
|
@@ -380,33 +379,33 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
380
379
|
default: return "";
|
|
381
380
|
}
|
|
382
381
|
});
|
|
383
|
-
function
|
|
382
|
+
function S(e) {
|
|
384
383
|
if (r.disabled || r.loading) return;
|
|
385
384
|
let t = e.currentTarget, n = t.getBoundingClientRect(), i = Math.max(n.width, n.height) * 2, a = document.createElement("span");
|
|
386
385
|
a.className = "m3-ripple", a.style.cssText = `width:${i}px;height:${i}px;top:${e.clientY - n.top - i / 2}px;left:${e.clientX - n.left - i / 2}px`, t.appendChild(a), a.addEventListener("animationend", () => a.remove(), { once: !0 });
|
|
387
386
|
}
|
|
388
|
-
return (n, r) => (y(), o(
|
|
387
|
+
return (n, r) => (y(), o(w(i.value), {
|
|
389
388
|
to: t.to || void 0,
|
|
390
389
|
type: t.to ? void 0 : t.type,
|
|
391
390
|
disabled: t.disabled || t.loading,
|
|
392
391
|
class: m([
|
|
393
|
-
|
|
392
|
+
Y,
|
|
394
393
|
d.value,
|
|
395
394
|
g.value,
|
|
396
395
|
b.value,
|
|
397
396
|
x.value
|
|
398
397
|
]),
|
|
399
398
|
style: h(l.value),
|
|
400
|
-
onPointerdown:
|
|
399
|
+
onPointerdown: S
|
|
401
400
|
}, {
|
|
402
|
-
default:
|
|
401
|
+
default: M(() => [t.loading ? (y(), o(H, {
|
|
403
402
|
key: 0,
|
|
404
403
|
size: v.value
|
|
405
404
|
}, null, 8, ["size"])) : t.icon ? (y(), o(e, {
|
|
406
405
|
key: 1,
|
|
407
406
|
name: t.icon,
|
|
408
407
|
size: _.value
|
|
409
|
-
}, null, 8, ["name", "size"])) : s("", !0),
|
|
408
|
+
}, null, 8, ["name", "size"])) : s("", !0), C(n.$slots, "default")]),
|
|
410
409
|
_: 3
|
|
411
410
|
}, 40, [
|
|
412
411
|
"to",
|
|
@@ -416,16 +415,16 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
416
415
|
"style"
|
|
417
416
|
]));
|
|
418
417
|
}
|
|
419
|
-
}),
|
|
418
|
+
}), Z = { class: "flex items-start justify-between gap-4 px-6 pt-6 pb-2" }, Q = { class: "text-headline-small text-on-surface" }, te = { class: "overflow-y-auto px-6 py-2 text-body-medium text-on-surface-variant" }, ne = {
|
|
420
419
|
key: 0,
|
|
421
420
|
class: "flex justify-end gap-2 px-6 py-4"
|
|
422
|
-
},
|
|
421
|
+
}, re = {
|
|
423
422
|
key: 0,
|
|
424
423
|
class: "dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"
|
|
425
|
-
},
|
|
424
|
+
}, ie = { class: "flex h-14 shrink-0 items-center gap-2 px-2" }, ae = { class: "flex-1 text-title-large font-medium text-on-surface" }, oe = {
|
|
426
425
|
key: 1,
|
|
427
426
|
class: "flex items-center gap-2"
|
|
428
|
-
},
|
|
427
|
+
}, se = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, ce = /*#__PURE__*/ t(/* @__PURE__ */ f({
|
|
429
428
|
__name: "MDialog",
|
|
430
429
|
props: {
|
|
431
430
|
modelValue: { type: Boolean },
|
|
@@ -443,77 +442,77 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
443
442
|
},
|
|
444
443
|
emits: ["update:modelValue"],
|
|
445
444
|
setup(e, { emit: t }) {
|
|
446
|
-
let n = e, a =
|
|
445
|
+
let n = e, a = I(), d = t;
|
|
447
446
|
function f() {
|
|
448
447
|
n.persistent || d("update:modelValue", !1);
|
|
449
448
|
}
|
|
450
449
|
function p(e) {
|
|
451
450
|
e.key === "Escape" && f();
|
|
452
451
|
}
|
|
453
|
-
return
|
|
452
|
+
return A(() => n.modelValue, (e) => {
|
|
454
453
|
e ? (document.addEventListener("keydown", p), document.body.style.overflow = "hidden") : (document.removeEventListener("keydown", p), document.body.style.overflow = "");
|
|
455
454
|
}), (t, n) => (y(), o(r, { to: "body" }, [e.fullscreen ? (y(), o(i, {
|
|
456
455
|
key: 1,
|
|
457
456
|
name: "m3-dialog-fs"
|
|
458
457
|
}, {
|
|
459
|
-
default:
|
|
460
|
-
e.persistent ? s("", !0) : (y(), o(
|
|
458
|
+
default: M(() => [e.modelValue ? (y(), c("div", re, [l("div", ie, [
|
|
459
|
+
e.persistent ? s("", !0) : (y(), o(J, {
|
|
461
460
|
key: 0,
|
|
462
461
|
icon: "close",
|
|
463
|
-
label: e.closeLabel ??
|
|
462
|
+
label: e.closeLabel ?? D(a).close,
|
|
464
463
|
onClick: f
|
|
465
464
|
}, null, 8, ["label"])),
|
|
466
|
-
l("h2",
|
|
467
|
-
t.$slots.actions ? (y(), c("div",
|
|
468
|
-
]), l("div",
|
|
465
|
+
l("h2", ae, [C(t.$slots, "title", {}, () => [u(T(e.title), 1)], !0)]),
|
|
466
|
+
t.$slots.actions ? (y(), c("div", oe, [C(t.$slots, "actions", {}, void 0, !0)])) : s("", !0)
|
|
467
|
+
]), l("div", se, [C(t.$slots, "default", {}, void 0, !0)])])) : s("", !0)]),
|
|
469
468
|
_: 3
|
|
470
469
|
})) : (y(), o(i, {
|
|
471
470
|
key: 0,
|
|
472
471
|
name: "m3-dialog"
|
|
473
472
|
}, {
|
|
474
|
-
default:
|
|
473
|
+
default: M(() => [e.modelValue ? (y(), c("div", {
|
|
475
474
|
key: 0,
|
|
476
475
|
class: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
477
|
-
onClick:
|
|
476
|
+
onClick: N(f, ["self"])
|
|
478
477
|
}, [l("div", { class: m(["dialog-box flex max-h-[90vh] w-full flex-col rounded-xl bg-surface-container-high shadow-elevation-3", e.maxWidth]) }, [
|
|
479
|
-
l("div",
|
|
478
|
+
l("div", Z, [l("h2", Q, [C(t.$slots, "title", {}, () => [u(T(e.title), 1)], !0)]), e.persistent ? s("", !0) : (y(), o(J, {
|
|
480
479
|
key: 0,
|
|
481
480
|
icon: "close",
|
|
482
|
-
label: e.closeLabel ??
|
|
481
|
+
label: e.closeLabel ?? D(a).close,
|
|
483
482
|
onClick: f
|
|
484
483
|
}, null, 8, ["label"]))]),
|
|
485
|
-
l("div",
|
|
486
|
-
t.$slots.actions ? (y(), c("div",
|
|
484
|
+
l("div", te, [C(t.$slots, "default", {}, void 0, !0)]),
|
|
485
|
+
t.$slots.actions ? (y(), c("div", ne, [C(t.$slots, "actions", {}, void 0, !0)])) : s("", !0)
|
|
487
486
|
], 2)])) : s("", !0)]),
|
|
488
487
|
_: 3
|
|
489
488
|
}))]));
|
|
490
489
|
}
|
|
491
|
-
}), [["__scopeId", "data-v-2e3c3567"]]),
|
|
490
|
+
}), [["__scopeId", "data-v-2e3c3567"]]), le = { class: "flex flex-col gap-1" }, $ = [
|
|
492
491
|
"id",
|
|
493
492
|
"value",
|
|
494
493
|
"rows",
|
|
495
494
|
"disabled",
|
|
496
495
|
"required"
|
|
497
|
-
],
|
|
496
|
+
], ue = [
|
|
498
497
|
"id",
|
|
499
498
|
"type",
|
|
500
499
|
"value",
|
|
501
500
|
"disabled",
|
|
502
501
|
"required",
|
|
503
502
|
"autocomplete"
|
|
504
|
-
],
|
|
503
|
+
], de = ["for"], fe = {
|
|
505
504
|
key: 0,
|
|
506
505
|
class: "text-error"
|
|
507
|
-
},
|
|
506
|
+
}, pe = {
|
|
508
507
|
key: 3,
|
|
509
508
|
class: "absolute right-2 top-1/2 -translate-y-1/2"
|
|
510
|
-
},
|
|
509
|
+
}, me = {
|
|
511
510
|
key: 0,
|
|
512
511
|
class: "px-4 text-body-small text-error"
|
|
513
|
-
},
|
|
512
|
+
}, he = {
|
|
514
513
|
key: 1,
|
|
515
514
|
class: "px-4 text-body-small text-on-surface-variant"
|
|
516
|
-
},
|
|
515
|
+
}, ge = /* @__PURE__ */ f({
|
|
517
516
|
__name: "MTextField",
|
|
518
517
|
props: {
|
|
519
518
|
modelValue: {},
|
|
@@ -536,7 +535,7 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
536
535
|
},
|
|
537
536
|
emits: ["update:modelValue"],
|
|
538
537
|
setup(t, { emit: n }) {
|
|
539
|
-
let r = t, i = n, o =
|
|
538
|
+
let r = t, i = n, o = O(), f = k(), p = S(null), { resolvedFieldBg: g } = K(p, () => r.fieldBg), _ = a(() => r.clearable && String(r.modelValue).length > 0 && !r.disabled), v = a(() => {
|
|
540
539
|
let e = !!f.trailing || r.clearable, t = r.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", i = [
|
|
541
540
|
"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
|
|
542
541
|
"transition-[border-color,border-width] duration-150",
|
|
@@ -574,15 +573,15 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
574
573
|
r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary"
|
|
575
574
|
].join(" ");
|
|
576
575
|
});
|
|
577
|
-
function
|
|
576
|
+
function x(e) {
|
|
578
577
|
let t = e.target;
|
|
579
578
|
i("update:modelValue", t.value);
|
|
580
579
|
}
|
|
581
|
-
return (n, r) => (y(), c("div",
|
|
580
|
+
return (n, r) => (y(), c("div", le, [l("div", {
|
|
582
581
|
ref_key: "fieldBgEl",
|
|
583
582
|
ref: p,
|
|
584
583
|
class: m(["relative", t.variant === "outlined" ? "mt-2" : ""]),
|
|
585
|
-
style: h(t.variant === "outlined" ? { "--field-bg":
|
|
584
|
+
style: h(t.variant === "outlined" ? { "--field-bg": D(g) } : void 0)
|
|
586
585
|
}, [
|
|
587
586
|
t.leadingIcon ? (y(), c("div", {
|
|
588
587
|
key: 0,
|
|
@@ -593,17 +592,17 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
593
592
|
}, null, 8, ["name"])], 2)) : s("", !0),
|
|
594
593
|
t.multiline ? (y(), c("textarea", {
|
|
595
594
|
key: 1,
|
|
596
|
-
id:
|
|
595
|
+
id: D(o),
|
|
597
596
|
value: String(t.modelValue),
|
|
598
597
|
rows: t.rows,
|
|
599
598
|
disabled: t.disabled,
|
|
600
599
|
required: t.required,
|
|
601
600
|
placeholder: " ",
|
|
602
601
|
class: m(v.value),
|
|
603
|
-
onInput:
|
|
604
|
-
}, null, 42,
|
|
602
|
+
onInput: x
|
|
603
|
+
}, null, 42, $)) : (y(), c("input", {
|
|
605
604
|
key: 2,
|
|
606
|
-
id:
|
|
605
|
+
id: D(o),
|
|
607
606
|
type: t.type,
|
|
608
607
|
value: t.modelValue,
|
|
609
608
|
disabled: t.disabled,
|
|
@@ -611,13 +610,13 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
611
610
|
autocomplete: t.autocomplete,
|
|
612
611
|
placeholder: " ",
|
|
613
612
|
class: m(v.value),
|
|
614
|
-
onInput:
|
|
615
|
-
}, null, 42,
|
|
613
|
+
onInput: x
|
|
614
|
+
}, null, 42, ue)),
|
|
616
615
|
l("label", {
|
|
617
|
-
for:
|
|
616
|
+
for: D(o),
|
|
618
617
|
class: m(b.value)
|
|
619
|
-
}, [u(
|
|
620
|
-
n.$slots.trailing ? (y(), c("div",
|
|
618
|
+
}, [u(T(t.label), 1), t.required ? (y(), c("span", fe, "\xA0*")) : s("", !0)], 10, de),
|
|
619
|
+
n.$slots.trailing ? (y(), c("div", pe, [C(n.$slots, "trailing")])) : _.value ? (y(), c("button", {
|
|
621
620
|
key: 4,
|
|
622
621
|
type: "button",
|
|
623
622
|
class: "absolute right-3 top-1/2 -translate-y-1/2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8 hover:text-on-surface",
|
|
@@ -626,20 +625,20 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
626
625
|
name: "close",
|
|
627
626
|
size: 18
|
|
628
627
|
})])) : s("", !0)
|
|
629
|
-
], 6), t.error ? (y(), c("p",
|
|
628
|
+
], 6), t.error ? (y(), c("p", me, T(t.error), 1)) : t.hint ? (y(), c("p", he, T(t.hint), 1)) : s("", !0)]));
|
|
630
629
|
}
|
|
631
|
-
}),
|
|
630
|
+
}), _e = /* @__PURE__ */ f({
|
|
632
631
|
__name: "MMenu",
|
|
633
632
|
props: { align: { default: "right" } },
|
|
634
633
|
setup(e, { expose: t }) {
|
|
635
|
-
let u = e, f =
|
|
636
|
-
function
|
|
634
|
+
let u = e, f = S(!1), p = S(null), m = S(null), g = S({});
|
|
635
|
+
function x() {
|
|
637
636
|
if (!p.value) return;
|
|
638
637
|
let e = p.value.getBoundingClientRect(), t = window.innerHeight - e.bottom - 8, n = t < 200 && e.top > t, r = { maxHeight: `${Math.min(n ? e.top - 12 : t, 400)}px` };
|
|
639
638
|
n ? r.bottom = `${window.innerHeight - e.top + 4}px` : r.top = `${e.bottom + 4}px`, u.align === "right" ? r.right = `${window.innerWidth - e.right}px` : r.left = `${e.left}px`, g.value = r;
|
|
640
639
|
}
|
|
641
640
|
function w() {
|
|
642
|
-
f.value ||
|
|
641
|
+
f.value || x(), f.value = !f.value;
|
|
643
642
|
}
|
|
644
643
|
function T() {
|
|
645
644
|
f.value = !1;
|
|
@@ -659,7 +658,7 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
659
658
|
T();
|
|
660
659
|
return;
|
|
661
660
|
}
|
|
662
|
-
|
|
661
|
+
x();
|
|
663
662
|
}
|
|
664
663
|
function O(e) {
|
|
665
664
|
e.key === "Escape" && T();
|
|
@@ -669,13 +668,13 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
669
668
|
}), v(() => {
|
|
670
669
|
document.removeEventListener("mousedown", E), document.removeEventListener("keydown", O), window.removeEventListener("scroll", D, !0);
|
|
671
670
|
});
|
|
672
|
-
let
|
|
671
|
+
let k = a(() => u.align === "right" ? "top right" : "top left");
|
|
673
672
|
return (e, t) => (y(), c(n, null, [l("div", {
|
|
674
673
|
ref_key: "triggerEl",
|
|
675
674
|
ref: p,
|
|
676
675
|
class: "inline-block",
|
|
677
676
|
onClick: w
|
|
678
|
-
}, [
|
|
677
|
+
}, [C(e.$slots, "trigger", { open: f.value })], 512), (y(), o(r, { to: "body" }, [d(i, {
|
|
679
678
|
"enter-active-class": "transition-[opacity,transform] duration-100 ease-out",
|
|
680
679
|
"enter-from-class": "opacity-0 scale-95",
|
|
681
680
|
"enter-to-class": "opacity-100 scale-100",
|
|
@@ -683,23 +682,23 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
683
682
|
"leave-from-class": "opacity-100 scale-100",
|
|
684
683
|
"leave-to-class": "opacity-0 scale-95"
|
|
685
684
|
}, {
|
|
686
|
-
default:
|
|
685
|
+
default: M(() => [f.value ? (y(), c("div", {
|
|
687
686
|
key: 0,
|
|
688
687
|
ref_key: "dropdownEl",
|
|
689
688
|
ref: m,
|
|
690
689
|
class: "fixed z-500 min-w-48 overflow-hidden rounded-lg bg-surface-container shadow-elevation-2",
|
|
691
690
|
style: h({
|
|
692
691
|
...g.value,
|
|
693
|
-
transformOrigin:
|
|
692
|
+
transformOrigin: k.value
|
|
694
693
|
})
|
|
695
694
|
}, [l("div", {
|
|
696
695
|
class: "overflow-y-auto py-1",
|
|
697
696
|
style: h({ maxHeight: g.value.maxHeight })
|
|
698
|
-
}, [
|
|
697
|
+
}, [C(e.$slots, "default", { close: T })], 4)], 4)) : s("", !0)]),
|
|
699
698
|
_: 3
|
|
700
699
|
})]))], 64));
|
|
701
700
|
}
|
|
702
|
-
}),
|
|
701
|
+
}), ve = { class: "flex-1" }, ye = /* @__PURE__ */ f({
|
|
703
702
|
__name: "MMenuItem",
|
|
704
703
|
props: {
|
|
705
704
|
icon: {},
|
|
@@ -715,34 +714,34 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
715
714
|
},
|
|
716
715
|
emits: ["click"],
|
|
717
716
|
setup(t, { emit: n }) {
|
|
718
|
-
let u = t, f = n, g =
|
|
719
|
-
function
|
|
717
|
+
let u = t, f = n, g = k(), _ = a(() => u.to ? "RouterLink" : "button"), v = a(() => !!g.children), b = p("m-menu-close", null);
|
|
718
|
+
function x() {
|
|
720
719
|
u.disabled || v.value || (f("click"), b?.());
|
|
721
720
|
}
|
|
722
|
-
let T =
|
|
723
|
-
function
|
|
721
|
+
let T = S(!1), E = S(), D = S({});
|
|
722
|
+
function O() {
|
|
724
723
|
if (!v.value || u.disabled || (T.value = !0, !E.value)) return;
|
|
725
724
|
let e = E.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
|
|
726
|
-
|
|
725
|
+
D.value = {
|
|
727
726
|
position: "fixed",
|
|
728
727
|
top: `${e.top}px`,
|
|
729
728
|
...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
|
|
730
729
|
zIndex: "501"
|
|
731
730
|
};
|
|
732
731
|
}
|
|
733
|
-
function
|
|
732
|
+
function A(e) {
|
|
734
733
|
e.relatedTarget?.closest(".m3-submenu") || (T.value = !1);
|
|
735
734
|
}
|
|
736
|
-
function
|
|
735
|
+
function j(e) {
|
|
737
736
|
let t = e.relatedTarget;
|
|
738
737
|
t?.closest(".m3-submenu") || E.value?.contains(t) || (T.value = !1);
|
|
739
738
|
}
|
|
740
739
|
return (n, a) => (y(), c("div", {
|
|
741
740
|
ref_key: "itemEl",
|
|
742
741
|
ref: E,
|
|
743
|
-
onMouseenter:
|
|
744
|
-
onMouseleave:
|
|
745
|
-
}, [(y(), o(
|
|
742
|
+
onMouseenter: O,
|
|
743
|
+
onMouseleave: A
|
|
744
|
+
}, [(y(), o(w(_.value), {
|
|
746
745
|
to: t.to || void 0,
|
|
747
746
|
type: t.to ? void 0 : "button",
|
|
748
747
|
class: m(["flex w-full items-center gap-3 px-4 py-2.5 text-left text-body-large transition-colors", [
|
|
@@ -751,16 +750,16 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
751
750
|
!t.disabled && !t.danger ? "text-on-surface hover:bg-on-surface/8" : ""
|
|
752
751
|
]]),
|
|
753
752
|
disabled: t.disabled || void 0,
|
|
754
|
-
onClick:
|
|
753
|
+
onClick: x
|
|
755
754
|
}, {
|
|
756
|
-
default:
|
|
755
|
+
default: M(() => [
|
|
757
756
|
t.icon ? (y(), o(e, {
|
|
758
757
|
key: 0,
|
|
759
758
|
name: t.icon,
|
|
760
759
|
size: 20,
|
|
761
760
|
class: m(["shrink-0", t.danger ? "text-error" : "text-on-surface-variant"])
|
|
762
761
|
}, null, 8, ["name", "class"])) : s("", !0),
|
|
763
|
-
l("span",
|
|
762
|
+
l("span", ve, [C(n.$slots, "default")]),
|
|
764
763
|
v.value ? (y(), o(e, {
|
|
765
764
|
key: 1,
|
|
766
765
|
name: "chevron_right",
|
|
@@ -783,17 +782,17 @@ var G = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
783
782
|
"leave-active-class": "transition-opacity duration-75",
|
|
784
783
|
"leave-to-class": "opacity-0"
|
|
785
784
|
}, {
|
|
786
|
-
default:
|
|
785
|
+
default: M(() => [T.value ? (y(), c("div", {
|
|
787
786
|
key: 0,
|
|
788
787
|
class: "m3-submenu min-w-44 overflow-hidden rounded-lg bg-surface-container py-1 shadow-elevation-2",
|
|
789
|
-
style: h(
|
|
790
|
-
onMouseleave:
|
|
791
|
-
}, [
|
|
788
|
+
style: h(D.value),
|
|
789
|
+
onMouseleave: j
|
|
790
|
+
}, [C(n.$slots, "children")], 36)) : s("", !0)]),
|
|
792
791
|
_: 3
|
|
793
792
|
})])) : s("", !0)], 544));
|
|
794
793
|
}
|
|
795
794
|
});
|
|
796
795
|
//#endregion
|
|
797
|
-
export {
|
|
796
|
+
export { X as a, H as c, I as d, ce as i, F as l, _e as n, J as o, ge as r, K as s, ye as t, P as u };
|
|
798
797
|
|
|
799
|
-
//# sourceMappingURL=MMenuItem-
|
|
798
|
+
//# sourceMappingURL=MMenuItem-BsZO5XuL.js.map
|