@m3ui-vue/m3ui-vue 0.7.0 → 0.8.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 +5 -5
- package/dist/{MMenuItem-B_5um6tj.js → MMenuItem-vSLbJGqe.js} +314 -230
- package/dist/MMenuItem-vSLbJGqe.js.map +1 -0
- package/dist/code-editor.d.ts +1 -0
- package/dist/code-editor.js +22 -7
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MCard.vue.d.ts +2 -0
- package/dist/components/MChatBubble.vue.d.ts +0 -1
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +0 -1
- package/dist/components/MCodeEditor.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +3 -0
- package/dist/components/MDialog.vue.d.ts +23 -7
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MListItem.vue.d.ts +11 -6
- package/dist/components/MNavigationRail.vue.d.ts +17 -1
- package/dist/components/MSelect.vue.d.ts +1 -0
- package/dist/components/MSwitch.vue.d.ts +10 -0
- package/dist/components/MTabs.vue.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2393 -2005
- package/dist/m3ui.js.map +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/styles/palettes.css +659 -0
- package/dist/styles/theme.css +2 -0
- package/dist/styles.css +1 -1
- package/package.json +13 -1
- package/src/__tests__/useColorPalette.test.ts +2 -2
- package/src/code-editor.ts +1 -0
- package/src/components/MAutocomplete.vue +35 -26
- package/src/components/MBadge.vue +1 -1
- package/src/components/MBottomSheet.vue +4 -4
- package/src/components/MButton.vue +48 -15
- package/src/components/MButtonGroup.vue +2 -2
- package/src/components/MCard.vue +83 -9
- package/src/components/MChatBubble.vue +0 -1
- package/src/components/MCheckbox.vue +78 -18
- package/src/components/MChip.vue +33 -4
- package/src/components/MCircleProgressBar.vue +7 -4
- package/src/components/MCodeEditor.vue +54 -8
- package/src/components/MColorPicker.vue +9 -8
- package/src/components/MColorPickerModal.vue +2 -2
- package/src/components/MCommandPalette.vue +1 -1
- package/src/components/MConfirmDialog.vue +4 -0
- package/src/components/MContextMenu.vue +23 -2
- package/src/components/MDatePicker.vue +11 -11
- package/src/components/MDatePickerModal.vue +5 -5
- package/src/components/MDateRangePicker.vue +12 -12
- package/src/components/MDateRangePickerModal.vue +3 -3
- package/src/components/MDialog.vue +103 -12
- package/src/components/MFab.vue +13 -8
- package/src/components/MFabMenu.vue +1 -1
- package/src/components/MIconButton.vue +50 -14
- package/src/components/MListItem.vue +35 -17
- package/src/components/MLoadingIndicator.vue +14 -7
- package/src/components/MMaskField.vue +14 -6
- package/src/components/MMenu.vue +28 -3
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMultiAutocomplete.vue +41 -26
- package/src/components/MMultiSelect.vue +40 -22
- package/src/components/MNavigationBar.vue +5 -10
- package/src/components/MNavigationDrawer.vue +10 -9
- package/src/components/MNavigationRail.vue +335 -22
- package/src/components/MNumberField.vue +14 -6
- package/src/components/MOverlay.vue +1 -1
- package/src/components/MPinInput.vue +7 -4
- package/src/components/MProgressBar.vue +16 -10
- package/src/components/MRadio.vue +74 -30
- package/src/components/MSearchBar.vue +3 -2
- package/src/components/MSegmentedButton.vue +14 -9
- package/src/components/MSelect.vue +44 -32
- package/src/components/MSideSheet.vue +1 -1
- package/src/components/MSlider.vue +42 -20
- package/src/components/MSnackbar.vue +4 -4
- package/src/components/MSplitButton.vue +32 -17
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MSwitch.vue +138 -33
- package/src/components/MTabs.vue +16 -12
- package/src/components/MTagInput.vue +33 -22
- package/src/components/MTextField.vue +14 -6
- package/src/components/MTimePicker.vue +9 -9
- package/src/components/MTimePickerModal.vue +16 -16
- package/src/components/MToolbar.vue +5 -3
- package/src/components/MTooltip.vue +4 -4
- package/src/components/MTopAppBar.vue +14 -6
- package/src/components/MTour.vue +1 -1
- package/src/composables/useColorPalette.ts +10 -0
- package/src/index.ts +1 -0
- package/src/styles/palettes.css +659 -0
- package/src/styles/theme.css +2 -0
- package/dist/MMenuItem-B_5um6tj.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { r as e } from "./useLocale-DbREg9Zn.js";
|
|
2
2
|
import { t } from "./MIcon-CaEooCmZ.js";
|
|
3
3
|
import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
4
|
-
import { Fragment as r, Teleport as i, Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, inject as m,
|
|
4
|
+
import { Fragment as r, Teleport as i, Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, inject as m, nextTick as h, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, onUnmounted as b, openBlock as x, provide as S, ref as C, renderSlot as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, useId as O, useSlots as k, watch as A, withCtx as j, withModifiers as M } from "vue";
|
|
5
5
|
//#region src/components/MSpinner.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var N = ["aria-label"], P = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
9
|
-
},
|
|
9
|
+
}, F = [
|
|
10
10
|
"width",
|
|
11
11
|
"height",
|
|
12
12
|
"viewBox"
|
|
13
|
-
],
|
|
13
|
+
], I = ["d", "stroke-dasharray"], L = 3, R = 9, z = /* @__PURE__ */ p({
|
|
14
14
|
__name: "MSpinner",
|
|
15
15
|
props: {
|
|
16
16
|
size: { default: 20 },
|
|
@@ -21,10 +21,10 @@ var M = ["aria-label"], N = {
|
|
|
21
21
|
label: {}
|
|
22
22
|
},
|
|
23
23
|
setup(t) {
|
|
24
|
-
let n = t, r = e(), i = o(() => (n.size / 2 - 1 -
|
|
24
|
+
let n = t, r = e(), i = o(() => (n.size / 2 - 1 - L / 2) / 1.25), a = o(() => n.size / 2), s = o(() => {
|
|
25
25
|
let e = a.value, t = i.value, n = t * .08, r = [], o = 0, s = 0, c = 0;
|
|
26
26
|
for (let i = 0; i <= 216; i++) {
|
|
27
|
-
let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(
|
|
27
|
+
let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(R * a), u = e + l * Math.cos(a), d = e + l * Math.sin(a);
|
|
28
28
|
i > 0 && (o += Math.sqrt((u - s) ** 2 + (d - c) ** 2)), r.push(`${i === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), s = u, c = d;
|
|
29
29
|
}
|
|
30
30
|
let l = o * .58, u = o - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
|
|
@@ -34,33 +34,33 @@ var M = ["aria-label"], N = {
|
|
|
34
34
|
len: o.toFixed(1)
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
|
-
return (e, n) => (
|
|
37
|
+
return (e, n) => (x(), l("span", {
|
|
38
38
|
class: "inline-flex shrink-0 items-center justify-center",
|
|
39
|
-
style:
|
|
39
|
+
style: _({
|
|
40
40
|
width: `${t.size}px`,
|
|
41
41
|
height: `${t.size}px`
|
|
42
42
|
}),
|
|
43
43
|
role: "status",
|
|
44
|
-
"aria-label": t.label ??
|
|
45
|
-
}, [t.wavy ? (
|
|
44
|
+
"aria-label": t.label ?? D(r).loading
|
|
45
|
+
}, [t.wavy ? (x(), l("svg", {
|
|
46
46
|
key: 1,
|
|
47
47
|
width: t.size,
|
|
48
48
|
height: t.size,
|
|
49
49
|
viewBox: `0 0 ${t.size} ${t.size}`,
|
|
50
50
|
fill: "none",
|
|
51
51
|
class: "animate-[m3-wavy-spin_2.8s_linear_infinite]",
|
|
52
|
-
style:
|
|
52
|
+
style: _(`transform-origin: ${a.value}px ${a.value}px`)
|
|
53
53
|
}, [u("path", {
|
|
54
54
|
d: s.value.path,
|
|
55
55
|
stroke: "currentColor",
|
|
56
|
-
"stroke-width":
|
|
56
|
+
"stroke-width": L,
|
|
57
57
|
"stroke-linecap": "round",
|
|
58
58
|
"stroke-dasharray": s.value.dash,
|
|
59
59
|
class: "animate-[m3-wavy-travel_2s_linear_infinite]",
|
|
60
|
-
style:
|
|
61
|
-
}, null, 12,
|
|
60
|
+
style: _({ "--m3-wave-len": s.value.len })
|
|
61
|
+
}, null, 12, I)], 12, F)) : (x(), l("span", P))], 12, N));
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
63
|
+
}), ee = [
|
|
64
64
|
"bg-surface-container-highest",
|
|
65
65
|
"bg-surface-container-high",
|
|
66
66
|
"bg-surface-container-low",
|
|
@@ -81,11 +81,11 @@ var M = ["aria-label"], N = {
|
|
|
81
81
|
"bg-tertiary",
|
|
82
82
|
"bg-error"
|
|
83
83
|
];
|
|
84
|
-
function
|
|
85
|
-
for (let t of
|
|
84
|
+
function B(e) {
|
|
85
|
+
for (let t of ee) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function V(e) {
|
|
89
89
|
if (!e || e === "transparent") return !0;
|
|
90
90
|
let t = e.match(/^rgba?\(([^)]+)\)$/);
|
|
91
91
|
if (t) {
|
|
@@ -94,15 +94,15 @@ function B(e) {
|
|
|
94
94
|
}
|
|
95
95
|
return !1;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let n =
|
|
97
|
+
function H(e, t) {
|
|
98
|
+
let n = C("var(--color-surface)");
|
|
99
99
|
function r(r) {
|
|
100
100
|
n.value = r, e.value?.style.setProperty("--field-bg", t() ?? r);
|
|
101
101
|
}
|
|
102
102
|
function i() {
|
|
103
103
|
let t = e.value?.parentElement ?? null;
|
|
104
104
|
for (; t;) {
|
|
105
|
-
let e =
|
|
105
|
+
let e = B(t);
|
|
106
106
|
if (e) {
|
|
107
107
|
r(e);
|
|
108
108
|
return;
|
|
@@ -112,7 +112,7 @@ function V(e, t) {
|
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
let n = getComputedStyle(t).backgroundColor;
|
|
115
|
-
if (!
|
|
115
|
+
if (!V(n)) {
|
|
116
116
|
r(n);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -121,7 +121,7 @@ function V(e, t) {
|
|
|
121
121
|
r("var(--color-surface)");
|
|
122
122
|
}
|
|
123
123
|
let a = null;
|
|
124
|
-
return
|
|
124
|
+
return y(() => {
|
|
125
125
|
i(), a = new MutationObserver(() => i()), a.observe(document.documentElement, {
|
|
126
126
|
attributes: !0,
|
|
127
127
|
attributeFilter: [
|
|
@@ -130,11 +130,11 @@ function V(e, t) {
|
|
|
130
130
|
"data-theme"
|
|
131
131
|
]
|
|
132
132
|
});
|
|
133
|
-
}),
|
|
133
|
+
}), v(() => a?.disconnect()), { resolvedFieldBg: o(() => t() ?? n.value) };
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/composables/useDebounce.ts
|
|
137
|
-
function
|
|
137
|
+
function U(e, t) {
|
|
138
138
|
let n = null;
|
|
139
139
|
function r(...r) {
|
|
140
140
|
n && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -144,14 +144,14 @@ function H(e, t) {
|
|
|
144
144
|
function i() {
|
|
145
145
|
n &&= (clearTimeout(n), null);
|
|
146
146
|
}
|
|
147
|
-
return
|
|
147
|
+
return v(i), {
|
|
148
148
|
debounced: r,
|
|
149
149
|
cancel: i
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/components/MIconButton.vue?vue&type=script&setup=true&lang.ts
|
|
154
|
-
var
|
|
154
|
+
var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer disabled:cursor-not-allowed disabled:text-on-surface/38 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]", G = /* @__PURE__ */ p({
|
|
155
155
|
__name: "MIconButton",
|
|
156
156
|
props: {
|
|
157
157
|
icon: {},
|
|
@@ -169,59 +169,71 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
169
169
|
let n = e, r = o(() => n.to ? "RouterLink" : "button"), i = {
|
|
170
170
|
xs: {
|
|
171
171
|
px: 32,
|
|
172
|
-
icon:
|
|
172
|
+
icon: 20,
|
|
173
|
+
squareRadius: "rounded-md"
|
|
173
174
|
},
|
|
174
175
|
sm: {
|
|
175
176
|
px: 40,
|
|
176
|
-
icon:
|
|
177
|
+
icon: 24,
|
|
178
|
+
squareRadius: "rounded-md"
|
|
177
179
|
},
|
|
178
180
|
md: {
|
|
179
|
-
px:
|
|
180
|
-
icon: 24
|
|
181
|
+
px: 56,
|
|
182
|
+
icon: 24,
|
|
183
|
+
squareRadius: "rounded-lg"
|
|
181
184
|
},
|
|
182
185
|
lg: {
|
|
183
|
-
px:
|
|
184
|
-
icon:
|
|
186
|
+
px: 96,
|
|
187
|
+
icon: 32,
|
|
188
|
+
squareRadius: "rounded-xl"
|
|
185
189
|
},
|
|
186
190
|
xl: {
|
|
187
|
-
px:
|
|
188
|
-
icon:
|
|
191
|
+
px: 136,
|
|
192
|
+
icon: 40,
|
|
193
|
+
squareRadius: "rounded-xl"
|
|
189
194
|
}
|
|
190
195
|
}, a = o(() => typeof n.size == "number" ? {
|
|
191
196
|
px: n.size,
|
|
192
|
-
icon: Math.round(n.size * .55)
|
|
193
|
-
|
|
194
|
-
|
|
197
|
+
icon: Math.round(n.size * .55),
|
|
198
|
+
squareRadius: "rounded-md"
|
|
199
|
+
} : i[n.size] ?? i.sm), c = o(() => {
|
|
200
|
+
switch (n.variant) {
|
|
201
|
+
case "filled":
|
|
202
|
+
case "tonal": return "disabled:bg-on-surface/10";
|
|
203
|
+
default: return "";
|
|
204
|
+
}
|
|
205
|
+
}), l = o(() => n.shape === "squared" ? a.value.squareRadius : "rounded-full");
|
|
206
|
+
function u(e) {
|
|
195
207
|
if (n.disabled) return;
|
|
196
208
|
let t = e.currentTarget, r = t.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = document.createElement("span");
|
|
197
209
|
a.className = "m3-ripple", a.style.cssText = `width:${i}px;height:${i}px;top:${e.clientY - r.top - i / 2}px;left:${e.clientX - r.left - i / 2}px`, t.appendChild(a), a.addEventListener("animationend", () => a.remove(), { once: !0 });
|
|
198
210
|
}
|
|
199
|
-
let
|
|
211
|
+
let d = o(() => {
|
|
200
212
|
switch (n.variant) {
|
|
201
|
-
case "filled": return "bg-primary text-on-primary
|
|
202
|
-
case "tonal": return "bg-secondary-container text-on-secondary-container
|
|
203
|
-
case "outlined": return "border border-
|
|
204
|
-
default: return "text-on-surface-variant
|
|
213
|
+
case "filled": return "bg-primary text-on-primary";
|
|
214
|
+
case "tonal": return "bg-secondary-container text-on-secondary-container";
|
|
215
|
+
case "outlined": return "border border-current text-on-surface-variant";
|
|
216
|
+
default: return "text-on-surface-variant";
|
|
205
217
|
}
|
|
206
218
|
});
|
|
207
|
-
return (n, i) => (
|
|
219
|
+
return (n, i) => (x(), s(T(r.value), {
|
|
208
220
|
to: e.to || void 0,
|
|
209
221
|
type: e.to ? void 0 : "button",
|
|
210
222
|
"aria-label": e.label || void 0,
|
|
211
223
|
disabled: e.disabled,
|
|
212
|
-
class:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
class: g([
|
|
225
|
+
W,
|
|
226
|
+
l.value,
|
|
227
|
+
d.value,
|
|
228
|
+
c.value
|
|
217
229
|
]),
|
|
218
|
-
style:
|
|
230
|
+
style: _({
|
|
219
231
|
width: `${a.value.px}px`,
|
|
220
232
|
height: `${a.value.px}px`
|
|
221
233
|
}),
|
|
222
|
-
onPointerdown:
|
|
234
|
+
onPointerdown: u
|
|
223
235
|
}, {
|
|
224
|
-
default:
|
|
236
|
+
default: j(() => [f(t, {
|
|
225
237
|
name: e.icon,
|
|
226
238
|
size: a.value.icon
|
|
227
239
|
}, null, 8, ["name", "size"])]),
|
|
@@ -235,7 +247,7 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
235
247
|
"style"
|
|
236
248
|
]));
|
|
237
249
|
}
|
|
238
|
-
}),
|
|
250
|
+
}), K = "relative inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 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]", q = /* @__PURE__ */ p({
|
|
239
251
|
__name: "MButton",
|
|
240
252
|
props: {
|
|
241
253
|
variant: { default: "filled" },
|
|
@@ -262,90 +274,104 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
262
274
|
"--color-primary-container": r.color + "33",
|
|
263
275
|
"--color-on-primary-container": r.color
|
|
264
276
|
};
|
|
265
|
-
}), u = o(() => r.color === "error"), d = o(() =>
|
|
277
|
+
}), u = o(() => r.color === "error"), d = o(() => {
|
|
278
|
+
switch (r.variant) {
|
|
279
|
+
case "filled":
|
|
280
|
+
case "tonal":
|
|
281
|
+
case "elevated": return "disabled:bg-on-surface/10";
|
|
282
|
+
case "outlined": return u.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
|
|
283
|
+
default: return "";
|
|
284
|
+
}
|
|
285
|
+
}), f = {
|
|
266
286
|
xs: {
|
|
267
287
|
h: "h-8",
|
|
268
|
-
text: "text-label-
|
|
269
|
-
icon:
|
|
270
|
-
spinner:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
pxText: "px-2"
|
|
288
|
+
text: "text-label-large",
|
|
289
|
+
icon: 20,
|
|
290
|
+
spinner: 16,
|
|
291
|
+
gap: "gap-1",
|
|
292
|
+
px: "px-3",
|
|
293
|
+
pxText: "px-2",
|
|
294
|
+
squareRadius: "rounded-md"
|
|
274
295
|
},
|
|
275
296
|
sm: {
|
|
276
297
|
h: "h-10",
|
|
277
298
|
text: "text-label-large",
|
|
278
299
|
icon: 20,
|
|
279
300
|
spinner: 16,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
pxText: "px-3"
|
|
301
|
+
gap: "gap-2",
|
|
302
|
+
px: "px-4",
|
|
303
|
+
pxText: "px-3",
|
|
304
|
+
squareRadius: "rounded-md"
|
|
283
305
|
},
|
|
284
306
|
md: {
|
|
285
307
|
h: "h-14",
|
|
286
308
|
text: "text-title-medium",
|
|
287
|
-
icon:
|
|
309
|
+
icon: 24,
|
|
288
310
|
spinner: 18,
|
|
311
|
+
gap: "gap-2",
|
|
289
312
|
px: "px-6",
|
|
290
|
-
|
|
291
|
-
|
|
313
|
+
pxText: "px-3",
|
|
314
|
+
squareRadius: "rounded-lg"
|
|
292
315
|
},
|
|
293
316
|
lg: {
|
|
294
|
-
h: "h-
|
|
295
|
-
text: "text-
|
|
296
|
-
icon:
|
|
297
|
-
spinner:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
pxText: "px-4"
|
|
317
|
+
h: "h-24",
|
|
318
|
+
text: "text-headline-small",
|
|
319
|
+
icon: 32,
|
|
320
|
+
spinner: 26,
|
|
321
|
+
gap: "gap-3",
|
|
322
|
+
px: "px-12",
|
|
323
|
+
pxText: "px-4",
|
|
324
|
+
squareRadius: "rounded-xl"
|
|
301
325
|
},
|
|
302
326
|
xl: {
|
|
303
|
-
h: "h-
|
|
304
|
-
text: "text-headline-
|
|
305
|
-
icon:
|
|
306
|
-
spinner:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
pxText: "px-4"
|
|
327
|
+
h: "h-[136px]",
|
|
328
|
+
text: "text-headline-large",
|
|
329
|
+
icon: 40,
|
|
330
|
+
spinner: 34,
|
|
331
|
+
gap: "gap-4",
|
|
332
|
+
px: "px-16",
|
|
333
|
+
pxText: "px-4",
|
|
334
|
+
squareRadius: "rounded-xl"
|
|
310
335
|
}
|
|
311
|
-
}, p = o(() => f[r.size] ?? f.sm), m = o(() => `${p.value.h} ${p.value.text}`),
|
|
336
|
+
}, p = o(() => f[r.size] ?? f.sm), m = o(() => `${p.value.h} ${p.value.text} ${p.value.gap}`), h = o(() => p.value.icon), v = o(() => p.value.spinner), y = o(() => r.variant === "text" ? p.value.pxText : p.value.px), b = o(() => r.shape === "squared" ? p.value.squareRadius : "rounded-full"), S = o(() => {
|
|
312
337
|
let e = u.value;
|
|
313
338
|
switch (r.variant) {
|
|
314
339
|
case "filled": return e ? "bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
|
|
315
340
|
case "tonal": return e ? "bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
|
|
316
341
|
case "elevated": return e ? "bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2" : "bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2";
|
|
317
|
-
case "outlined": return e ? "border border-error text-error" : "border border-outline text-primary";
|
|
342
|
+
case "outlined": return e ? "border border-error text-error" : "border border-outline-variant text-primary";
|
|
318
343
|
case "text": return e ? "text-error" : "text-primary";
|
|
319
344
|
default: return "";
|
|
320
345
|
}
|
|
321
346
|
});
|
|
322
|
-
function
|
|
347
|
+
function C(e) {
|
|
323
348
|
if (r.disabled || r.loading) return;
|
|
324
349
|
let t = e.currentTarget, n = t.getBoundingClientRect(), i = Math.max(n.width, n.height) * 2, a = document.createElement("span");
|
|
325
350
|
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 });
|
|
326
351
|
}
|
|
327
|
-
return (n, r) => (
|
|
352
|
+
return (n, r) => (x(), s(T(i.value), {
|
|
328
353
|
to: e.to || void 0,
|
|
329
354
|
type: e.to ? void 0 : e.type,
|
|
330
355
|
disabled: e.disabled || e.loading,
|
|
331
|
-
class:
|
|
332
|
-
|
|
333
|
-
|
|
356
|
+
class: g([
|
|
357
|
+
K,
|
|
358
|
+
b.value,
|
|
334
359
|
m.value,
|
|
335
360
|
y.value,
|
|
336
|
-
|
|
361
|
+
S.value,
|
|
362
|
+
d.value
|
|
337
363
|
]),
|
|
338
|
-
style:
|
|
339
|
-
onPointerdown:
|
|
364
|
+
style: _(l.value),
|
|
365
|
+
onPointerdown: C
|
|
340
366
|
}, {
|
|
341
|
-
default:
|
|
367
|
+
default: j(() => [e.loading ? (x(), s(z, {
|
|
342
368
|
key: 0,
|
|
343
369
|
size: v.value
|
|
344
|
-
}, null, 8, ["size"])) : e.icon ? (
|
|
370
|
+
}, null, 8, ["size"])) : e.icon ? (x(), s(t, {
|
|
345
371
|
key: 1,
|
|
346
372
|
name: e.icon,
|
|
347
|
-
size:
|
|
348
|
-
}, null, 8, ["name", "size"])) : c("", !0),
|
|
373
|
+
size: h.value
|
|
374
|
+
}, null, 8, ["name", "size"])) : c("", !0), w(n.$slots, "default")]),
|
|
349
375
|
_: 3
|
|
350
376
|
}, 40, [
|
|
351
377
|
"to",
|
|
@@ -355,21 +381,31 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
355
381
|
"style"
|
|
356
382
|
]));
|
|
357
383
|
}
|
|
358
|
-
}),
|
|
384
|
+
}), J = { class: "relative px-6 pt-6 pb-2" }, Y = {
|
|
359
385
|
key: 0,
|
|
360
|
-
class: "
|
|
386
|
+
class: "absolute right-4 top-4"
|
|
387
|
+
}, X = {
|
|
388
|
+
key: 1,
|
|
389
|
+
class: "mb-4 flex justify-center text-secondary"
|
|
361
390
|
}, Z = {
|
|
391
|
+
key: 0,
|
|
392
|
+
class: "shrink-0 border-t border-outline-variant"
|
|
393
|
+
}, Q = {
|
|
394
|
+
key: 1,
|
|
395
|
+
class: "flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6"
|
|
396
|
+
}, te = {
|
|
362
397
|
key: 0,
|
|
363
398
|
class: "dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"
|
|
364
|
-
},
|
|
399
|
+
}, ne = { class: "flex h-14 shrink-0 items-center gap-2 px-2" }, re = { class: "flex-1 text-title-large font-medium text-on-surface" }, ie = {
|
|
365
400
|
key: 1,
|
|
366
401
|
class: "flex items-center gap-2"
|
|
367
|
-
},
|
|
402
|
+
}, ae = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, oe = /*#__PURE__*/ n(/* @__PURE__ */ p({
|
|
368
403
|
__name: "MDialog",
|
|
369
404
|
props: {
|
|
370
405
|
modelValue: { type: Boolean },
|
|
371
406
|
title: {},
|
|
372
|
-
maxWidth: { default: "max-w-
|
|
407
|
+
maxWidth: { default: "max-w-[560px]" },
|
|
408
|
+
maxHeight: { default: "max-h-[90vh]" },
|
|
373
409
|
persistent: {
|
|
374
410
|
type: Boolean,
|
|
375
411
|
default: !1
|
|
@@ -378,81 +414,108 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
378
414
|
type: Boolean,
|
|
379
415
|
default: !1
|
|
380
416
|
},
|
|
381
|
-
closeLabel: {}
|
|
417
|
+
closeLabel: {},
|
|
418
|
+
closable: {
|
|
419
|
+
type: Boolean,
|
|
420
|
+
default: !0
|
|
421
|
+
}
|
|
382
422
|
},
|
|
383
423
|
emits: ["update:modelValue"],
|
|
384
424
|
setup(t, { emit: n }) {
|
|
385
|
-
let r = t, o = e(),
|
|
386
|
-
function
|
|
387
|
-
r.persistent ||
|
|
425
|
+
let r = t, o = e(), p = n;
|
|
426
|
+
function m() {
|
|
427
|
+
r.persistent || p("update:modelValue", !1);
|
|
428
|
+
}
|
|
429
|
+
function _(e) {
|
|
430
|
+
e.key === "Escape" && m();
|
|
388
431
|
}
|
|
389
|
-
|
|
390
|
-
|
|
432
|
+
let v = C(), y = C(), S = C(!1), T;
|
|
433
|
+
function O() {
|
|
434
|
+
let e = v.value;
|
|
435
|
+
if (!e) {
|
|
436
|
+
S.value = !1;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
S.value = e.scrollHeight - e.scrollTop - e.clientHeight > 1;
|
|
391
440
|
}
|
|
392
|
-
return
|
|
393
|
-
e ? (document.addEventListener("keydown",
|
|
394
|
-
}),
|
|
441
|
+
return A(() => r.modelValue, async (e) => {
|
|
442
|
+
e ? (document.addEventListener("keydown", _), document.body.style.overflow = "hidden", await h(), O(), T = new ResizeObserver(O), v.value && T.observe(v.value), y.value && T.observe(y.value)) : (document.removeEventListener("keydown", _), document.body.style.overflow = "", T?.disconnect(), T = void 0);
|
|
443
|
+
}), b(() => {
|
|
444
|
+
document.removeEventListener("keydown", _), T?.disconnect();
|
|
445
|
+
}), (e, n) => (x(), s(i, { to: "body" }, [t.fullscreen ? (x(), s(a, {
|
|
395
446
|
key: 1,
|
|
396
447
|
name: "m3-dialog-fs"
|
|
397
448
|
}, {
|
|
398
|
-
default:
|
|
399
|
-
t.persistent ? c("", !0) : (
|
|
449
|
+
default: j(() => [t.modelValue ? (x(), l("div", te, [u("div", ne, [
|
|
450
|
+
t.persistent ? c("", !0) : (x(), s(G, {
|
|
400
451
|
key: 0,
|
|
401
452
|
icon: "close",
|
|
402
|
-
label: t.closeLabel ??
|
|
403
|
-
onClick:
|
|
453
|
+
label: t.closeLabel ?? D(o).close,
|
|
454
|
+
onClick: m
|
|
404
455
|
}, null, 8, ["label"])),
|
|
405
|
-
u("h2",
|
|
406
|
-
e.$slots.actions ? (
|
|
407
|
-
]), u("div",
|
|
456
|
+
u("h2", re, [w(e.$slots, "title", {}, () => [d(E(t.title), 1)], !0)]),
|
|
457
|
+
e.$slots.actions ? (x(), l("div", ie, [w(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
|
|
458
|
+
]), u("div", ae, [w(e.$slots, "default", {}, void 0, !0)])])) : c("", !0)]),
|
|
408
459
|
_: 3
|
|
409
|
-
})) : (
|
|
460
|
+
})) : (x(), s(a, {
|
|
410
461
|
key: 0,
|
|
411
462
|
name: "m3-dialog"
|
|
412
463
|
}, {
|
|
413
|
-
default:
|
|
464
|
+
default: j(() => [t.modelValue ? (x(), l("div", {
|
|
414
465
|
key: 0,
|
|
415
|
-
class: "fixed inset-0 z-50 flex items-center justify-center bg-
|
|
416
|
-
onClick:
|
|
417
|
-
}, [u("div", { class:
|
|
418
|
-
u("div",
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
466
|
+
class: "fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4",
|
|
467
|
+
onClick: M(m, ["self"])
|
|
468
|
+
}, [u("div", { class: g(["dialog-box flex min-w-[280px] w-full flex-col rounded-xl bg-surface-container-high shadow-elevation-3", [t.maxWidth, t.maxHeight]]) }, [
|
|
469
|
+
u("div", J, [
|
|
470
|
+
t.closable && !t.persistent ? (x(), l("div", Y, [f(G, {
|
|
471
|
+
icon: "close",
|
|
472
|
+
label: t.closeLabel ?? D(o).close,
|
|
473
|
+
onClick: m
|
|
474
|
+
}, null, 8, ["label"])])) : c("", !0),
|
|
475
|
+
e.$slots.icon ? (x(), l("div", X, [w(e.$slots, "icon", {}, void 0, !0)])) : c("", !0),
|
|
476
|
+
u("h2", { class: g(["text-headline-small text-on-surface", [e.$slots.icon ? "text-center" : "text-left", t.closable && !t.persistent ? e.$slots.icon ? "px-10" : "pr-10" : ""]]) }, [w(e.$slots, "title", {}, () => [d(E(t.title), 1)], !0)], 2)
|
|
477
|
+
]),
|
|
478
|
+
u("div", {
|
|
479
|
+
ref_key: "contentEl",
|
|
480
|
+
ref: v,
|
|
481
|
+
class: g(["overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant", e.$slots.actions ? "pb-2" : "pb-6"]),
|
|
482
|
+
onScroll: O
|
|
483
|
+
}, [u("div", {
|
|
484
|
+
ref_key: "contentInnerEl",
|
|
485
|
+
ref: y
|
|
486
|
+
}, [w(e.$slots, "default", {}, void 0, !0)], 512)], 34),
|
|
487
|
+
S.value && e.$slots.actions ? (x(), l("div", Z)) : c("", !0),
|
|
488
|
+
e.$slots.actions ? (x(), l("div", Q, [w(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
|
|
426
489
|
], 2)])) : c("", !0)]),
|
|
427
490
|
_: 3
|
|
428
491
|
}))]));
|
|
429
492
|
}
|
|
430
|
-
}), [["__scopeId", "data-v-
|
|
493
|
+
}), [["__scopeId", "data-v-be5c35b4"]]), se = { class: "flex flex-col gap-1" }, ce = [
|
|
431
494
|
"id",
|
|
432
495
|
"value",
|
|
433
496
|
"rows",
|
|
434
497
|
"disabled",
|
|
435
498
|
"required"
|
|
436
|
-
],
|
|
499
|
+
], le = [
|
|
437
500
|
"id",
|
|
438
501
|
"type",
|
|
439
502
|
"value",
|
|
440
503
|
"disabled",
|
|
441
504
|
"required",
|
|
442
505
|
"autocomplete"
|
|
443
|
-
],
|
|
506
|
+
], ue = ["for"], de = {
|
|
444
507
|
key: 0,
|
|
445
508
|
class: "text-error"
|
|
446
|
-
},
|
|
509
|
+
}, fe = {
|
|
447
510
|
key: 3,
|
|
448
511
|
class: "absolute right-2 top-1/2 -translate-y-1/2"
|
|
449
|
-
},
|
|
512
|
+
}, pe = {
|
|
450
513
|
key: 0,
|
|
451
514
|
class: "px-4 text-body-small text-error"
|
|
452
|
-
},
|
|
515
|
+
}, $ = {
|
|
453
516
|
key: 1,
|
|
454
517
|
class: "px-4 text-body-small text-on-surface-variant"
|
|
455
|
-
},
|
|
518
|
+
}, me = /* @__PURE__ */ p({
|
|
456
519
|
__name: "MTextField",
|
|
457
520
|
props: {
|
|
458
521
|
modelValue: {},
|
|
@@ -477,25 +540,28 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
477
540
|
},
|
|
478
541
|
emits: ["update:modelValue", "debounced"],
|
|
479
542
|
setup(e, { emit: n }) {
|
|
480
|
-
let r = e, i = n, a =
|
|
481
|
-
let e = !!s.trailing || r.clearable, t = r.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", i = [
|
|
543
|
+
let r = e, i = n, a = O(), s = k(), p = C(null), { resolvedFieldBg: m } = H(p, () => r.fieldBg), { debounced: h, cancel: v } = U((e) => i("debounced", e), r.debounce), y = o(() => r.clearable && String(r.modelValue).length > 0 && !r.disabled), b = o(() => {
|
|
544
|
+
let e = !!s.trailing || r.clearable, t = r.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", i = r.multiline ? "resize-y min-h-[56px]" : "h-14", a = [
|
|
482
545
|
"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
|
|
483
546
|
"transition-[border-color,border-width] duration-150",
|
|
484
|
-
"disabled:cursor-not-allowed disabled:
|
|
485
|
-
r.
|
|
547
|
+
"disabled:cursor-not-allowed disabled:text-on-surface/38",
|
|
548
|
+
r.error ? "caret-error" : "caret-primary",
|
|
549
|
+
i,
|
|
486
550
|
t,
|
|
487
551
|
n
|
|
488
552
|
];
|
|
489
553
|
return r.variant === "outlined" ? [
|
|
490
|
-
...
|
|
491
|
-
"rounded-
|
|
492
|
-
r.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary"
|
|
554
|
+
...a,
|
|
555
|
+
"rounded-xs border bg-transparent py-4",
|
|
556
|
+
r.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
|
|
557
|
+
"disabled:border-on-surface/12"
|
|
493
558
|
].join(" ") : [
|
|
494
|
-
...
|
|
495
|
-
"rounded-t-
|
|
496
|
-
r.error ? "border-error focus:border-b-2 focus:border-error" : "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary"
|
|
559
|
+
...a,
|
|
560
|
+
"rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
|
|
561
|
+
r.error ? "border-error focus:border-b-2 focus:border-error" : "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary",
|
|
562
|
+
"disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
|
|
497
563
|
].join(" ");
|
|
498
|
-
}),
|
|
564
|
+
}), S = o(() => {
|
|
499
565
|
let e = [
|
|
500
566
|
"pointer-events-none absolute truncate transition-all duration-200",
|
|
501
567
|
r.leadingIcon ? r.variant === "outlined" ? "left-11" : "left-12" : r.variant === "outlined" ? "left-3" : "left-4",
|
|
@@ -507,118 +573,136 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
507
573
|
"peer-focus:-top-2.5 peer-focus:translate-y-0 peer-focus:text-label-small peer-focus:right-auto peer-focus:max-w-[calc(100%-1.5rem)] peer-focus:bg-[var(--field-bg)] peer-focus:px-1",
|
|
508
574
|
"peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]",
|
|
509
575
|
"peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
|
|
510
|
-
r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary"
|
|
576
|
+
r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
|
|
577
|
+
"peer-disabled:text-on-surface/38"
|
|
511
578
|
].join(" ") : [
|
|
512
579
|
...e,
|
|
513
580
|
"peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
|
|
514
581
|
"peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
|
|
515
|
-
r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary"
|
|
582
|
+
r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
|
|
583
|
+
"peer-disabled:text-on-surface/38"
|
|
516
584
|
].join(" ");
|
|
517
585
|
});
|
|
518
|
-
function
|
|
586
|
+
function T(e) {
|
|
519
587
|
let t = e.target;
|
|
520
|
-
i("update:modelValue", t.value), r.debounce > 0 &&
|
|
588
|
+
i("update:modelValue", t.value), r.debounce > 0 && h(t.value);
|
|
521
589
|
}
|
|
522
|
-
return (n, r) => (
|
|
590
|
+
return (n, r) => (x(), l("div", se, [u("div", {
|
|
523
591
|
ref_key: "fieldBgEl",
|
|
524
592
|
ref: p,
|
|
525
|
-
class:
|
|
526
|
-
style:
|
|
593
|
+
class: g(["relative", e.variant === "outlined" ? "mt-2" : ""]),
|
|
594
|
+
style: _(e.variant === "outlined" ? { "--field-bg": D(m) } : void 0)
|
|
527
595
|
}, [
|
|
528
|
-
e.leadingIcon ? (
|
|
596
|
+
e.leadingIcon ? (x(), l("div", {
|
|
529
597
|
key: 0,
|
|
530
|
-
class:
|
|
598
|
+
class: g(["pointer-events-none absolute left-3.5", [e.multiline ? "top-[55%] -translate-y-1/2" : e.variant === "filled" ? "top-4.5" : "top-4", e.disabled ? "text-on-surface/38" : "text-on-surface-variant"]])
|
|
531
599
|
}, [f(t, {
|
|
532
600
|
name: e.leadingIcon,
|
|
533
|
-
size:
|
|
601
|
+
size: 24
|
|
534
602
|
}, null, 8, ["name"])], 2)) : c("", !0),
|
|
535
|
-
e.multiline ? (
|
|
603
|
+
e.multiline ? (x(), l("textarea", {
|
|
536
604
|
key: 1,
|
|
537
|
-
id:
|
|
605
|
+
id: D(a),
|
|
538
606
|
value: String(e.modelValue),
|
|
539
607
|
rows: e.rows,
|
|
540
608
|
disabled: e.disabled,
|
|
541
609
|
required: e.required,
|
|
542
610
|
placeholder: " ",
|
|
543
|
-
class:
|
|
544
|
-
onInput:
|
|
545
|
-
}, null, 42,
|
|
611
|
+
class: g(b.value),
|
|
612
|
+
onInput: T
|
|
613
|
+
}, null, 42, ce)) : (x(), l("input", {
|
|
546
614
|
key: 2,
|
|
547
|
-
id:
|
|
615
|
+
id: D(a),
|
|
548
616
|
type: e.type,
|
|
549
617
|
value: e.modelValue,
|
|
550
618
|
disabled: e.disabled,
|
|
551
619
|
required: e.required,
|
|
552
620
|
autocomplete: e.autocomplete,
|
|
553
621
|
placeholder: " ",
|
|
554
|
-
class:
|
|
555
|
-
onInput:
|
|
556
|
-
}, null, 42,
|
|
622
|
+
class: g(b.value),
|
|
623
|
+
onInput: T
|
|
624
|
+
}, null, 42, le)),
|
|
557
625
|
u("label", {
|
|
558
|
-
for:
|
|
559
|
-
class:
|
|
560
|
-
}, [d(
|
|
561
|
-
n.$slots.trailing ? (
|
|
626
|
+
for: D(a),
|
|
627
|
+
class: g(S.value)
|
|
628
|
+
}, [d(E(e.label), 1), e.required ? (x(), l("span", de, "\xA0*")) : c("", !0)], 10, ue),
|
|
629
|
+
n.$slots.trailing ? (x(), l("div", fe, [w(n.$slots, "trailing")])) : y.value ? (x(), l("button", {
|
|
562
630
|
key: 4,
|
|
563
631
|
type: "button",
|
|
564
632
|
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",
|
|
565
633
|
onClick: r[0] ||= (e) => {
|
|
566
|
-
|
|
634
|
+
D(v)(), i("update:modelValue", "");
|
|
567
635
|
}
|
|
568
636
|
}, [f(t, {
|
|
569
637
|
name: "close",
|
|
570
638
|
size: 18
|
|
571
639
|
})])) : c("", !0)
|
|
572
|
-
], 6), e.error && e.errorLabel ? (
|
|
640
|
+
], 6), e.error && e.errorLabel ? (x(), l("p", pe, E(e.errorLabel), 1)) : e.hint ? (x(), l("p", $, E(e.hint), 1)) : c("", !0)]));
|
|
573
641
|
}
|
|
574
|
-
}),
|
|
642
|
+
}), he = /* @__PURE__ */ p({
|
|
575
643
|
__name: "MMenu",
|
|
576
644
|
props: { align: { default: "right" } },
|
|
577
645
|
setup(e, { expose: t }) {
|
|
578
|
-
let n = e, d =
|
|
579
|
-
function
|
|
646
|
+
let n = e, d = C(!1), p = C(null), m = C(null), g = C({});
|
|
647
|
+
function v() {
|
|
580
648
|
if (!p.value) return;
|
|
581
649
|
let e = p.value.getBoundingClientRect(), t = window.innerHeight - e.bottom - 8, r = t < 200 && e.top > t, i = { maxHeight: `${Math.min(r ? e.top - 12 : t, 400)}px` };
|
|
582
|
-
r ? i.bottom = `${window.innerHeight - e.top + 4}px` : i.top = `${e.bottom + 4}px`, n.align === "right" ? i.right = `${window.innerWidth - e.right}px` : i.left = `${e.left}px`,
|
|
583
|
-
}
|
|
584
|
-
function w() {
|
|
585
|
-
d.value || _(), d.value = !d.value;
|
|
650
|
+
r ? i.bottom = `${window.innerHeight - e.top + 4}px` : i.top = `${e.bottom + 4}px`, n.align === "right" ? i.right = `${window.innerWidth - e.right}px` : i.left = `${e.left}px`, g.value = i;
|
|
586
651
|
}
|
|
587
652
|
function T() {
|
|
653
|
+
return m.value ? Array.from(m.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
|
|
654
|
+
}
|
|
655
|
+
function E() {
|
|
656
|
+
h(() => T()[0]?.focus());
|
|
657
|
+
}
|
|
658
|
+
function D(e) {
|
|
659
|
+
let t = T();
|
|
660
|
+
if (!t.length) return;
|
|
661
|
+
let n = t.indexOf(document.activeElement);
|
|
662
|
+
(n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
|
|
663
|
+
}
|
|
664
|
+
function O() {
|
|
665
|
+
d.value || v(), d.value = !d.value, d.value && E();
|
|
666
|
+
}
|
|
667
|
+
function k() {
|
|
588
668
|
d.value = !1;
|
|
589
669
|
}
|
|
590
|
-
|
|
591
|
-
close:
|
|
670
|
+
S("m-menu-close", k), t({
|
|
671
|
+
close: k,
|
|
592
672
|
open: d
|
|
593
673
|
});
|
|
594
|
-
function
|
|
674
|
+
function A(e) {
|
|
595
675
|
let t = e.target;
|
|
596
|
-
p.value?.contains(t) || m.value?.contains(t) || t.closest?.(".m3-submenu") ||
|
|
676
|
+
p.value?.contains(t) || m.value?.contains(t) || t.closest?.(".m3-submenu") || k();
|
|
597
677
|
}
|
|
598
|
-
function
|
|
678
|
+
function M(e) {
|
|
599
679
|
if (!d.value || m.value?.contains(e.target) || !p.value) return;
|
|
600
680
|
let t = p.value.getBoundingClientRect();
|
|
601
681
|
if (t.bottom < 0 || t.top > window.innerHeight) {
|
|
602
|
-
|
|
682
|
+
k();
|
|
603
683
|
return;
|
|
604
684
|
}
|
|
605
|
-
|
|
685
|
+
v();
|
|
606
686
|
}
|
|
607
|
-
function
|
|
608
|
-
e.key === "Escape"
|
|
687
|
+
function N(e) {
|
|
688
|
+
if (e.key === "Escape") {
|
|
689
|
+
k();
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
d.value && (e.key === "ArrowDown" ? (e.preventDefault(), D(1)) : e.key === "ArrowUp" && (e.preventDefault(), D(-1)));
|
|
609
693
|
}
|
|
610
|
-
|
|
611
|
-
document.addEventListener("mousedown",
|
|
612
|
-
}),
|
|
613
|
-
document.removeEventListener("mousedown",
|
|
694
|
+
y(() => {
|
|
695
|
+
document.addEventListener("mousedown", A), document.addEventListener("keydown", N), window.addEventListener("scroll", M, !0);
|
|
696
|
+
}), b(() => {
|
|
697
|
+
document.removeEventListener("mousedown", A), document.removeEventListener("keydown", N), window.removeEventListener("scroll", M, !0);
|
|
614
698
|
});
|
|
615
|
-
let
|
|
616
|
-
return (e, t) => (
|
|
699
|
+
let P = o(() => n.align === "right" ? "top right" : "top left");
|
|
700
|
+
return (e, t) => (x(), l(r, null, [u("div", {
|
|
617
701
|
ref_key: "triggerEl",
|
|
618
702
|
ref: p,
|
|
619
703
|
class: "inline-block",
|
|
620
|
-
onClick:
|
|
621
|
-
}, [
|
|
704
|
+
onClick: O
|
|
705
|
+
}, [w(e.$slots, "trigger", { open: d.value })], 512), (x(), s(i, { to: "body" }, [f(a, {
|
|
622
706
|
"enter-active-class": "transition-[opacity,transform] duration-100 ease-out",
|
|
623
707
|
"enter-from-class": "opacity-0 scale-95",
|
|
624
708
|
"enter-to-class": "opacity-100 scale-100",
|
|
@@ -626,26 +710,26 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
626
710
|
"leave-from-class": "opacity-100 scale-100",
|
|
627
711
|
"leave-to-class": "opacity-0 scale-95"
|
|
628
712
|
}, {
|
|
629
|
-
default:
|
|
713
|
+
default: j(() => [d.value ? (x(), l("div", {
|
|
630
714
|
key: 0,
|
|
631
715
|
ref_key: "dropdownEl",
|
|
632
716
|
ref: m,
|
|
633
|
-
class: "fixed z-500 min-w-48 overflow-hidden rounded-
|
|
634
|
-
style:
|
|
635
|
-
...
|
|
636
|
-
transformOrigin:
|
|
717
|
+
class: "fixed z-500 min-w-48 overflow-hidden rounded-xs bg-surface-container shadow-elevation-2",
|
|
718
|
+
style: _({
|
|
719
|
+
...g.value,
|
|
720
|
+
transformOrigin: P.value
|
|
637
721
|
})
|
|
638
722
|
}, [u("div", {
|
|
639
723
|
class: "overflow-y-auto py-1",
|
|
640
|
-
style:
|
|
641
|
-
}, [
|
|
724
|
+
style: _({ maxHeight: g.value.maxHeight })
|
|
725
|
+
}, [w(e.$slots, "default", { close: k })], 4)], 4)) : c("", !0)]),
|
|
642
726
|
_: 3
|
|
643
727
|
})]))], 64));
|
|
644
728
|
}
|
|
645
|
-
}),
|
|
729
|
+
}), ge = { class: "flex-1" }, _e = {
|
|
646
730
|
key: 1,
|
|
647
731
|
class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
|
|
648
|
-
},
|
|
732
|
+
}, ve = /* @__PURE__ */ p({
|
|
649
733
|
__name: "MMenuItem",
|
|
650
734
|
props: {
|
|
651
735
|
icon: {},
|
|
@@ -662,15 +746,15 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
662
746
|
},
|
|
663
747
|
emits: ["click"],
|
|
664
748
|
setup(e, { emit: n }) {
|
|
665
|
-
let r = e, d = n, p =
|
|
666
|
-
function
|
|
749
|
+
let r = e, d = n, p = k(), h = o(() => r.to ? "RouterLink" : "button"), v = o(() => !!p.children), y = m("m-menu-close", null);
|
|
750
|
+
function b() {
|
|
667
751
|
r.disabled || v.value || (d("click"), y?.());
|
|
668
752
|
}
|
|
669
|
-
let
|
|
670
|
-
function
|
|
671
|
-
if (!v.value || r.disabled || (
|
|
753
|
+
let S = C(!1), D = C(), O = C({});
|
|
754
|
+
function A() {
|
|
755
|
+
if (!v.value || r.disabled || (S.value = !0, !D.value)) return;
|
|
672
756
|
let e = D.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
|
|
673
|
-
|
|
757
|
+
O.value = {
|
|
674
758
|
position: "fixed",
|
|
675
759
|
top: `${e.top}px`,
|
|
676
760
|
...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
|
|
@@ -678,38 +762,38 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
678
762
|
};
|
|
679
763
|
}
|
|
680
764
|
function M(e) {
|
|
681
|
-
e.relatedTarget?.closest(".m3-submenu") || (
|
|
765
|
+
e.relatedTarget?.closest(".m3-submenu") || (S.value = !1);
|
|
682
766
|
}
|
|
683
767
|
function N(e) {
|
|
684
768
|
let t = e.relatedTarget;
|
|
685
|
-
t?.closest(".m3-submenu") || D.value?.contains(t) || (
|
|
769
|
+
t?.closest(".m3-submenu") || D.value?.contains(t) || (S.value = !1);
|
|
686
770
|
}
|
|
687
|
-
return (n, r) => (
|
|
771
|
+
return (n, r) => (x(), l("div", {
|
|
688
772
|
ref_key: "itemEl",
|
|
689
773
|
ref: D,
|
|
690
|
-
onMouseenter:
|
|
774
|
+
onMouseenter: A,
|
|
691
775
|
onMouseleave: M
|
|
692
|
-
}, [(
|
|
776
|
+
}, [(x(), s(T(h.value), {
|
|
693
777
|
to: e.to || void 0,
|
|
694
778
|
type: e.to ? void 0 : "button",
|
|
695
|
-
class:
|
|
779
|
+
class: g(["flex w-full items-center gap-3 px-4 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", [
|
|
696
780
|
e.disabled ? "cursor-not-allowed opacity-[0.38] text-on-surface" : "cursor-pointer",
|
|
697
781
|
!e.disabled && e.danger ? "text-error hover:bg-error/8" : "",
|
|
698
782
|
!e.disabled && !e.danger ? "text-on-surface hover:bg-on-surface/8" : ""
|
|
699
783
|
]]),
|
|
700
784
|
disabled: e.disabled || void 0,
|
|
701
|
-
onClick:
|
|
785
|
+
onClick: b
|
|
702
786
|
}, {
|
|
703
|
-
default:
|
|
704
|
-
e.icon ? (
|
|
787
|
+
default: j(() => [
|
|
788
|
+
e.icon ? (x(), s(t, {
|
|
705
789
|
key: 0,
|
|
706
790
|
name: e.icon,
|
|
707
791
|
size: 20,
|
|
708
|
-
class:
|
|
792
|
+
class: g(["shrink-0", e.danger ? "text-error" : "text-on-surface-variant"])
|
|
709
793
|
}, null, 8, ["name", "class"])) : c("", !0),
|
|
710
|
-
u("span",
|
|
711
|
-
e.shortcut && !v.value ? (
|
|
712
|
-
v.value ? (
|
|
794
|
+
u("span", ge, [w(n.$slots, "default")]),
|
|
795
|
+
e.shortcut && !v.value ? (x(), l("span", _e, E(e.shortcut), 1)) : c("", !0),
|
|
796
|
+
v.value ? (x(), s(t, {
|
|
713
797
|
key: 2,
|
|
714
798
|
name: "chevron_right",
|
|
715
799
|
size: 18,
|
|
@@ -722,7 +806,7 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
722
806
|
"type",
|
|
723
807
|
"class",
|
|
724
808
|
"disabled"
|
|
725
|
-
])), v.value ? (
|
|
809
|
+
])), v.value ? (x(), s(i, {
|
|
726
810
|
key: 0,
|
|
727
811
|
to: "body"
|
|
728
812
|
}, [f(a, {
|
|
@@ -731,17 +815,17 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
731
815
|
"leave-active-class": "transition-opacity duration-75",
|
|
732
816
|
"leave-to-class": "opacity-0"
|
|
733
817
|
}, {
|
|
734
|
-
default:
|
|
818
|
+
default: j(() => [S.value ? (x(), l("div", {
|
|
735
819
|
key: 0,
|
|
736
|
-
class: "m3-submenu min-w-44 overflow-hidden rounded-
|
|
737
|
-
style:
|
|
820
|
+
class: "m3-submenu min-w-44 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
821
|
+
style: _(O.value),
|
|
738
822
|
onMouseleave: N
|
|
739
|
-
}, [
|
|
823
|
+
}, [w(n.$slots, "children")], 36)) : c("", !0)]),
|
|
740
824
|
_: 3
|
|
741
825
|
})])) : c("", !0)], 544));
|
|
742
826
|
}
|
|
743
827
|
});
|
|
744
828
|
//#endregion
|
|
745
|
-
export {
|
|
829
|
+
export { q as a, H as c, oe as i, z as l, he as n, G as o, me as r, U as s, ve as t };
|
|
746
830
|
|
|
747
|
-
//# sourceMappingURL=MMenuItem-
|
|
831
|
+
//# sourceMappingURL=MMenuItem-vSLbJGqe.js.map
|