@m3ui-vue/m3ui-vue 0.7.1 → 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-xQ1x6-DH.js → MMenuItem-vSLbJGqe.js} +299 -232
- 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/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 +8 -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 +1798 -1432
- 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 +1 -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 +36 -19
- package/src/components/MButtonGroup.vue +2 -2
- package/src/components/MCard.vue +76 -11
- package/src/components/MChatBubble.vue +0 -1
- package/src/components/MCheckbox.vue +58 -13
- package/src/components/MChip.vue +26 -6
- 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 +10 -7
- package/src/components/MFabMenu.vue +1 -1
- package/src/components/MIconButton.vue +41 -19
- 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 +54 -12
- 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/MSnackbar.vue +4 -4
- package/src/components/MSplitButton.vue +32 -17
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MSwitch.vue +96 -18
- 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 +1 -0
- package/dist/MMenuItem-xQ1x6-DH.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,35 +169,40 @@ 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)
|
|
197
|
+
icon: Math.round(n.size * .55),
|
|
198
|
+
squareRadius: "rounded-md"
|
|
193
199
|
} : i[n.size] ?? i.sm), c = o(() => {
|
|
194
200
|
switch (n.variant) {
|
|
195
201
|
case "filled":
|
|
196
|
-
case "tonal": return "disabled:bg-on-surface/
|
|
197
|
-
case "outlined": return "disabled:border-on-surface/12";
|
|
202
|
+
case "tonal": return "disabled:bg-on-surface/10";
|
|
198
203
|
default: return "";
|
|
199
204
|
}
|
|
200
|
-
}), l = o(() => n.shape === "squared" ?
|
|
205
|
+
}), l = o(() => n.shape === "squared" ? a.value.squareRadius : "rounded-full");
|
|
201
206
|
function u(e) {
|
|
202
207
|
if (n.disabled) return;
|
|
203
208
|
let t = e.currentTarget, r = t.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = document.createElement("span");
|
|
@@ -205,31 +210,30 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
205
210
|
}
|
|
206
211
|
let d = o(() => {
|
|
207
212
|
switch (n.variant) {
|
|
208
|
-
case "filled": return "bg-primary text-on-primary
|
|
209
|
-
case "tonal": return "bg-secondary-container text-on-secondary-container
|
|
210
|
-
case "outlined": return "border border-
|
|
211
|
-
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";
|
|
212
217
|
}
|
|
213
218
|
});
|
|
214
|
-
return (n, i) => (
|
|
219
|
+
return (n, i) => (x(), s(T(r.value), {
|
|
215
220
|
to: e.to || void 0,
|
|
216
221
|
type: e.to ? void 0 : "button",
|
|
217
222
|
"aria-label": e.label || void 0,
|
|
218
223
|
disabled: e.disabled,
|
|
219
|
-
class:
|
|
220
|
-
|
|
224
|
+
class: g([
|
|
225
|
+
W,
|
|
221
226
|
l.value,
|
|
222
227
|
d.value,
|
|
223
|
-
c.value
|
|
224
|
-
"relative overflow-hidden"
|
|
228
|
+
c.value
|
|
225
229
|
]),
|
|
226
|
-
style:
|
|
230
|
+
style: _({
|
|
227
231
|
width: `${a.value.px}px`,
|
|
228
232
|
height: `${a.value.px}px`
|
|
229
233
|
}),
|
|
230
234
|
onPointerdown: u
|
|
231
235
|
}, {
|
|
232
|
-
default:
|
|
236
|
+
default: j(() => [f(t, {
|
|
233
237
|
name: e.icon,
|
|
234
238
|
size: a.value.icon
|
|
235
239
|
}, null, 8, ["name", "size"])]),
|
|
@@ -243,7 +247,7 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
243
247
|
"style"
|
|
244
248
|
]));
|
|
245
249
|
}
|
|
246
|
-
}),
|
|
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({
|
|
247
251
|
__name: "MButton",
|
|
248
252
|
props: {
|
|
249
253
|
variant: { default: "filled" },
|
|
@@ -274,95 +278,100 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
274
278
|
switch (r.variant) {
|
|
275
279
|
case "filled":
|
|
276
280
|
case "tonal":
|
|
277
|
-
case "elevated": return "disabled:bg-on-surface/
|
|
278
|
-
case "outlined": return "disabled:border-
|
|
281
|
+
case "elevated": return "disabled:bg-on-surface/10";
|
|
282
|
+
case "outlined": return u.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
|
|
279
283
|
default: return "";
|
|
280
284
|
}
|
|
281
|
-
}), f =
|
|
285
|
+
}), f = {
|
|
282
286
|
xs: {
|
|
283
287
|
h: "h-8",
|
|
284
|
-
text: "text-label-
|
|
285
|
-
icon:
|
|
286
|
-
spinner:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
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"
|
|
290
295
|
},
|
|
291
296
|
sm: {
|
|
292
297
|
h: "h-10",
|
|
293
298
|
text: "text-label-large",
|
|
294
299
|
icon: 20,
|
|
295
300
|
spinner: 16,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
pxText: "px-3"
|
|
301
|
+
gap: "gap-2",
|
|
302
|
+
px: "px-4",
|
|
303
|
+
pxText: "px-3",
|
|
304
|
+
squareRadius: "rounded-md"
|
|
299
305
|
},
|
|
300
306
|
md: {
|
|
301
307
|
h: "h-14",
|
|
302
308
|
text: "text-title-medium",
|
|
303
|
-
icon:
|
|
309
|
+
icon: 24,
|
|
304
310
|
spinner: 18,
|
|
311
|
+
gap: "gap-2",
|
|
305
312
|
px: "px-6",
|
|
306
|
-
|
|
307
|
-
|
|
313
|
+
pxText: "px-3",
|
|
314
|
+
squareRadius: "rounded-lg"
|
|
308
315
|
},
|
|
309
316
|
lg: {
|
|
310
|
-
h: "h-
|
|
311
|
-
text: "text-
|
|
312
|
-
icon:
|
|
313
|
-
spinner:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
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"
|
|
317
325
|
},
|
|
318
326
|
xl: {
|
|
319
|
-
h: "h-
|
|
320
|
-
text: "text-headline-
|
|
321
|
-
icon:
|
|
322
|
-
spinner:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
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"
|
|
326
335
|
}
|
|
327
|
-
},
|
|
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(() => {
|
|
328
337
|
let e = u.value;
|
|
329
338
|
switch (r.variant) {
|
|
330
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";
|
|
331
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";
|
|
332
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";
|
|
333
|
-
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";
|
|
334
343
|
case "text": return e ? "text-error" : "text-primary";
|
|
335
344
|
default: return "";
|
|
336
345
|
}
|
|
337
346
|
});
|
|
338
|
-
function
|
|
347
|
+
function C(e) {
|
|
339
348
|
if (r.disabled || r.loading) return;
|
|
340
349
|
let t = e.currentTarget, n = t.getBoundingClientRect(), i = Math.max(n.width, n.height) * 2, a = document.createElement("span");
|
|
341
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 });
|
|
342
351
|
}
|
|
343
|
-
return (n, r) => (
|
|
352
|
+
return (n, r) => (x(), s(T(i.value), {
|
|
344
353
|
to: e.to || void 0,
|
|
345
354
|
type: e.to ? void 0 : e.type,
|
|
346
355
|
disabled: e.disabled || e.loading,
|
|
347
|
-
class:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
356
|
+
class: g([
|
|
357
|
+
K,
|
|
358
|
+
b.value,
|
|
359
|
+
m.value,
|
|
360
|
+
y.value,
|
|
352
361
|
S.value,
|
|
353
362
|
d.value
|
|
354
363
|
]),
|
|
355
|
-
style:
|
|
356
|
-
onPointerdown:
|
|
364
|
+
style: _(l.value),
|
|
365
|
+
onPointerdown: C
|
|
357
366
|
}, {
|
|
358
|
-
default:
|
|
367
|
+
default: j(() => [e.loading ? (x(), s(z, {
|
|
359
368
|
key: 0,
|
|
360
|
-
size:
|
|
361
|
-
}, null, 8, ["size"])) : e.icon ? (
|
|
369
|
+
size: v.value
|
|
370
|
+
}, null, 8, ["size"])) : e.icon ? (x(), s(t, {
|
|
362
371
|
key: 1,
|
|
363
372
|
name: e.icon,
|
|
364
|
-
size:
|
|
365
|
-
}, null, 8, ["name", "size"])) : c("", !0),
|
|
373
|
+
size: h.value
|
|
374
|
+
}, null, 8, ["name", "size"])) : c("", !0), w(n.$slots, "default")]),
|
|
366
375
|
_: 3
|
|
367
376
|
}, 40, [
|
|
368
377
|
"to",
|
|
@@ -372,21 +381,31 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
372
381
|
"style"
|
|
373
382
|
]));
|
|
374
383
|
}
|
|
375
|
-
}),
|
|
384
|
+
}), J = { class: "relative px-6 pt-6 pb-2" }, Y = {
|
|
376
385
|
key: 0,
|
|
377
|
-
class: "
|
|
386
|
+
class: "absolute right-4 top-4"
|
|
387
|
+
}, X = {
|
|
388
|
+
key: 1,
|
|
389
|
+
class: "mb-4 flex justify-center text-secondary"
|
|
378
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 = {
|
|
379
397
|
key: 0,
|
|
380
398
|
class: "dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"
|
|
381
|
-
},
|
|
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 = {
|
|
382
400
|
key: 1,
|
|
383
401
|
class: "flex items-center gap-2"
|
|
384
|
-
},
|
|
402
|
+
}, ae = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, oe = /*#__PURE__*/ n(/* @__PURE__ */ p({
|
|
385
403
|
__name: "MDialog",
|
|
386
404
|
props: {
|
|
387
405
|
modelValue: { type: Boolean },
|
|
388
406
|
title: {},
|
|
389
|
-
maxWidth: { default: "max-w-
|
|
407
|
+
maxWidth: { default: "max-w-[560px]" },
|
|
408
|
+
maxHeight: { default: "max-h-[90vh]" },
|
|
390
409
|
persistent: {
|
|
391
410
|
type: Boolean,
|
|
392
411
|
default: !1
|
|
@@ -395,81 +414,108 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
395
414
|
type: Boolean,
|
|
396
415
|
default: !1
|
|
397
416
|
},
|
|
398
|
-
closeLabel: {}
|
|
417
|
+
closeLabel: {},
|
|
418
|
+
closable: {
|
|
419
|
+
type: Boolean,
|
|
420
|
+
default: !0
|
|
421
|
+
}
|
|
399
422
|
},
|
|
400
423
|
emits: ["update:modelValue"],
|
|
401
424
|
setup(t, { emit: n }) {
|
|
402
|
-
let r = t, o = e(),
|
|
403
|
-
function
|
|
404
|
-
r.persistent ||
|
|
425
|
+
let r = t, o = e(), p = n;
|
|
426
|
+
function m() {
|
|
427
|
+
r.persistent || p("update:modelValue", !1);
|
|
405
428
|
}
|
|
406
|
-
function
|
|
407
|
-
e.key === "Escape" &&
|
|
429
|
+
function _(e) {
|
|
430
|
+
e.key === "Escape" && m();
|
|
408
431
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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;
|
|
440
|
+
}
|
|
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, {
|
|
412
446
|
key: 1,
|
|
413
447
|
name: "m3-dialog-fs"
|
|
414
448
|
}, {
|
|
415
|
-
default:
|
|
416
|
-
t.persistent ? c("", !0) : (
|
|
449
|
+
default: j(() => [t.modelValue ? (x(), l("div", te, [u("div", ne, [
|
|
450
|
+
t.persistent ? c("", !0) : (x(), s(G, {
|
|
417
451
|
key: 0,
|
|
418
452
|
icon: "close",
|
|
419
|
-
label: t.closeLabel ??
|
|
420
|
-
onClick:
|
|
453
|
+
label: t.closeLabel ?? D(o).close,
|
|
454
|
+
onClick: m
|
|
421
455
|
}, null, 8, ["label"])),
|
|
422
|
-
u("h2",
|
|
423
|
-
e.$slots.actions ? (
|
|
424
|
-
]), 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)]),
|
|
425
459
|
_: 3
|
|
426
|
-
})) : (
|
|
460
|
+
})) : (x(), s(a, {
|
|
427
461
|
key: 0,
|
|
428
462
|
name: "m3-dialog"
|
|
429
463
|
}, {
|
|
430
|
-
default:
|
|
464
|
+
default: j(() => [t.modelValue ? (x(), l("div", {
|
|
431
465
|
key: 0,
|
|
432
|
-
class: "fixed inset-0 z-50 flex items-center justify-center bg-scrim/
|
|
433
|
-
onClick:
|
|
434
|
-
}, [u("div", { class:
|
|
435
|
-
u("div",
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
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)
|
|
443
489
|
], 2)])) : c("", !0)]),
|
|
444
490
|
_: 3
|
|
445
491
|
}))]));
|
|
446
492
|
}
|
|
447
|
-
}), [["__scopeId", "data-v-
|
|
493
|
+
}), [["__scopeId", "data-v-be5c35b4"]]), se = { class: "flex flex-col gap-1" }, ce = [
|
|
448
494
|
"id",
|
|
449
495
|
"value",
|
|
450
496
|
"rows",
|
|
451
497
|
"disabled",
|
|
452
498
|
"required"
|
|
453
|
-
],
|
|
499
|
+
], le = [
|
|
454
500
|
"id",
|
|
455
501
|
"type",
|
|
456
502
|
"value",
|
|
457
503
|
"disabled",
|
|
458
504
|
"required",
|
|
459
505
|
"autocomplete"
|
|
460
|
-
],
|
|
506
|
+
], ue = ["for"], de = {
|
|
461
507
|
key: 0,
|
|
462
508
|
class: "text-error"
|
|
463
|
-
},
|
|
509
|
+
}, fe = {
|
|
464
510
|
key: 3,
|
|
465
511
|
class: "absolute right-2 top-1/2 -translate-y-1/2"
|
|
466
|
-
},
|
|
512
|
+
}, pe = {
|
|
467
513
|
key: 0,
|
|
468
514
|
class: "px-4 text-body-small text-error"
|
|
469
|
-
},
|
|
515
|
+
}, $ = {
|
|
470
516
|
key: 1,
|
|
471
517
|
class: "px-4 text-body-small text-on-surface-variant"
|
|
472
|
-
},
|
|
518
|
+
}, me = /* @__PURE__ */ p({
|
|
473
519
|
__name: "MTextField",
|
|
474
520
|
props: {
|
|
475
521
|
modelValue: {},
|
|
@@ -494,25 +540,28 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
494
540
|
},
|
|
495
541
|
emits: ["update:modelValue", "debounced"],
|
|
496
542
|
setup(e, { emit: n }) {
|
|
497
|
-
let r = e, i = n, a =
|
|
498
|
-
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 = [
|
|
499
545
|
"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
|
|
500
546
|
"transition-[border-color,border-width] duration-150",
|
|
501
|
-
"disabled:cursor-not-allowed disabled:
|
|
502
|
-
r.
|
|
547
|
+
"disabled:cursor-not-allowed disabled:text-on-surface/38",
|
|
548
|
+
r.error ? "caret-error" : "caret-primary",
|
|
549
|
+
i,
|
|
503
550
|
t,
|
|
504
551
|
n
|
|
505
552
|
];
|
|
506
553
|
return r.variant === "outlined" ? [
|
|
507
|
-
...
|
|
508
|
-
"rounded-
|
|
509
|
-
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"
|
|
510
558
|
].join(" ") : [
|
|
511
|
-
...
|
|
512
|
-
"rounded-t-
|
|
513
|
-
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))]"
|
|
514
563
|
].join(" ");
|
|
515
|
-
}),
|
|
564
|
+
}), S = o(() => {
|
|
516
565
|
let e = [
|
|
517
566
|
"pointer-events-none absolute truncate transition-all duration-200",
|
|
518
567
|
r.leadingIcon ? r.variant === "outlined" ? "left-11" : "left-12" : r.variant === "outlined" ? "left-3" : "left-4",
|
|
@@ -524,118 +573,136 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
524
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",
|
|
525
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)]",
|
|
526
575
|
"peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
|
|
527
|
-
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"
|
|
528
578
|
].join(" ") : [
|
|
529
579
|
...e,
|
|
530
580
|
"peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
|
|
531
581
|
"peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
|
|
532
|
-
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"
|
|
533
584
|
].join(" ");
|
|
534
585
|
});
|
|
535
|
-
function
|
|
586
|
+
function T(e) {
|
|
536
587
|
let t = e.target;
|
|
537
|
-
i("update:modelValue", t.value), r.debounce > 0 &&
|
|
588
|
+
i("update:modelValue", t.value), r.debounce > 0 && h(t.value);
|
|
538
589
|
}
|
|
539
|
-
return (n, r) => (
|
|
590
|
+
return (n, r) => (x(), l("div", se, [u("div", {
|
|
540
591
|
ref_key: "fieldBgEl",
|
|
541
592
|
ref: p,
|
|
542
|
-
class:
|
|
543
|
-
style:
|
|
593
|
+
class: g(["relative", e.variant === "outlined" ? "mt-2" : ""]),
|
|
594
|
+
style: _(e.variant === "outlined" ? { "--field-bg": D(m) } : void 0)
|
|
544
595
|
}, [
|
|
545
|
-
e.leadingIcon ? (
|
|
596
|
+
e.leadingIcon ? (x(), l("div", {
|
|
546
597
|
key: 0,
|
|
547
|
-
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"]])
|
|
548
599
|
}, [f(t, {
|
|
549
600
|
name: e.leadingIcon,
|
|
550
|
-
size:
|
|
601
|
+
size: 24
|
|
551
602
|
}, null, 8, ["name"])], 2)) : c("", !0),
|
|
552
|
-
e.multiline ? (
|
|
603
|
+
e.multiline ? (x(), l("textarea", {
|
|
553
604
|
key: 1,
|
|
554
|
-
id:
|
|
605
|
+
id: D(a),
|
|
555
606
|
value: String(e.modelValue),
|
|
556
607
|
rows: e.rows,
|
|
557
608
|
disabled: e.disabled,
|
|
558
609
|
required: e.required,
|
|
559
610
|
placeholder: " ",
|
|
560
|
-
class:
|
|
561
|
-
onInput:
|
|
562
|
-
}, null, 42,
|
|
611
|
+
class: g(b.value),
|
|
612
|
+
onInput: T
|
|
613
|
+
}, null, 42, ce)) : (x(), l("input", {
|
|
563
614
|
key: 2,
|
|
564
|
-
id:
|
|
615
|
+
id: D(a),
|
|
565
616
|
type: e.type,
|
|
566
617
|
value: e.modelValue,
|
|
567
618
|
disabled: e.disabled,
|
|
568
619
|
required: e.required,
|
|
569
620
|
autocomplete: e.autocomplete,
|
|
570
621
|
placeholder: " ",
|
|
571
|
-
class:
|
|
572
|
-
onInput:
|
|
573
|
-
}, null, 42,
|
|
622
|
+
class: g(b.value),
|
|
623
|
+
onInput: T
|
|
624
|
+
}, null, 42, le)),
|
|
574
625
|
u("label", {
|
|
575
|
-
for:
|
|
576
|
-
class:
|
|
577
|
-
}, [d(
|
|
578
|
-
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", {
|
|
579
630
|
key: 4,
|
|
580
631
|
type: "button",
|
|
581
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",
|
|
582
633
|
onClick: r[0] ||= (e) => {
|
|
583
|
-
|
|
634
|
+
D(v)(), i("update:modelValue", "");
|
|
584
635
|
}
|
|
585
636
|
}, [f(t, {
|
|
586
637
|
name: "close",
|
|
587
638
|
size: 18
|
|
588
639
|
})])) : c("", !0)
|
|
589
|
-
], 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)]));
|
|
590
641
|
}
|
|
591
|
-
}),
|
|
642
|
+
}), he = /* @__PURE__ */ p({
|
|
592
643
|
__name: "MMenu",
|
|
593
644
|
props: { align: { default: "right" } },
|
|
594
645
|
setup(e, { expose: t }) {
|
|
595
|
-
let n = e, d =
|
|
596
|
-
function
|
|
646
|
+
let n = e, d = C(!1), p = C(null), m = C(null), g = C({});
|
|
647
|
+
function v() {
|
|
597
648
|
if (!p.value) return;
|
|
598
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` };
|
|
599
|
-
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`,
|
|
600
|
-
}
|
|
601
|
-
function w() {
|
|
602
|
-
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;
|
|
603
651
|
}
|
|
604
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() {
|
|
605
668
|
d.value = !1;
|
|
606
669
|
}
|
|
607
|
-
|
|
608
|
-
close:
|
|
670
|
+
S("m-menu-close", k), t({
|
|
671
|
+
close: k,
|
|
609
672
|
open: d
|
|
610
673
|
});
|
|
611
|
-
function
|
|
674
|
+
function A(e) {
|
|
612
675
|
let t = e.target;
|
|
613
|
-
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();
|
|
614
677
|
}
|
|
615
|
-
function
|
|
678
|
+
function M(e) {
|
|
616
679
|
if (!d.value || m.value?.contains(e.target) || !p.value) return;
|
|
617
680
|
let t = p.value.getBoundingClientRect();
|
|
618
681
|
if (t.bottom < 0 || t.top > window.innerHeight) {
|
|
619
|
-
|
|
682
|
+
k();
|
|
620
683
|
return;
|
|
621
684
|
}
|
|
622
|
-
|
|
685
|
+
v();
|
|
623
686
|
}
|
|
624
|
-
function
|
|
625
|
-
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)));
|
|
626
693
|
}
|
|
627
|
-
|
|
628
|
-
document.addEventListener("mousedown",
|
|
629
|
-
}),
|
|
630
|
-
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);
|
|
631
698
|
});
|
|
632
|
-
let
|
|
633
|
-
return (e, t) => (
|
|
699
|
+
let P = o(() => n.align === "right" ? "top right" : "top left");
|
|
700
|
+
return (e, t) => (x(), l(r, null, [u("div", {
|
|
634
701
|
ref_key: "triggerEl",
|
|
635
702
|
ref: p,
|
|
636
703
|
class: "inline-block",
|
|
637
|
-
onClick:
|
|
638
|
-
}, [
|
|
704
|
+
onClick: O
|
|
705
|
+
}, [w(e.$slots, "trigger", { open: d.value })], 512), (x(), s(i, { to: "body" }, [f(a, {
|
|
639
706
|
"enter-active-class": "transition-[opacity,transform] duration-100 ease-out",
|
|
640
707
|
"enter-from-class": "opacity-0 scale-95",
|
|
641
708
|
"enter-to-class": "opacity-100 scale-100",
|
|
@@ -643,26 +710,26 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
643
710
|
"leave-from-class": "opacity-100 scale-100",
|
|
644
711
|
"leave-to-class": "opacity-0 scale-95"
|
|
645
712
|
}, {
|
|
646
|
-
default:
|
|
713
|
+
default: j(() => [d.value ? (x(), l("div", {
|
|
647
714
|
key: 0,
|
|
648
715
|
ref_key: "dropdownEl",
|
|
649
716
|
ref: m,
|
|
650
|
-
class: "fixed z-500 min-w-48 overflow-hidden rounded-
|
|
651
|
-
style:
|
|
652
|
-
...
|
|
653
|
-
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
|
|
654
721
|
})
|
|
655
722
|
}, [u("div", {
|
|
656
723
|
class: "overflow-y-auto py-1",
|
|
657
|
-
style:
|
|
658
|
-
}, [
|
|
724
|
+
style: _({ maxHeight: g.value.maxHeight })
|
|
725
|
+
}, [w(e.$slots, "default", { close: k })], 4)], 4)) : c("", !0)]),
|
|
659
726
|
_: 3
|
|
660
727
|
})]))], 64));
|
|
661
728
|
}
|
|
662
|
-
}),
|
|
729
|
+
}), ge = { class: "flex-1" }, _e = {
|
|
663
730
|
key: 1,
|
|
664
731
|
class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
|
|
665
|
-
},
|
|
732
|
+
}, ve = /* @__PURE__ */ p({
|
|
666
733
|
__name: "MMenuItem",
|
|
667
734
|
props: {
|
|
668
735
|
icon: {},
|
|
@@ -679,15 +746,15 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
679
746
|
},
|
|
680
747
|
emits: ["click"],
|
|
681
748
|
setup(e, { emit: n }) {
|
|
682
|
-
let r = e, d = n, p =
|
|
683
|
-
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() {
|
|
684
751
|
r.disabled || v.value || (d("click"), y?.());
|
|
685
752
|
}
|
|
686
|
-
let
|
|
687
|
-
function
|
|
688
|
-
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;
|
|
689
756
|
let e = D.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
|
|
690
|
-
|
|
757
|
+
O.value = {
|
|
691
758
|
position: "fixed",
|
|
692
759
|
top: `${e.top}px`,
|
|
693
760
|
...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
|
|
@@ -695,38 +762,38 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
695
762
|
};
|
|
696
763
|
}
|
|
697
764
|
function M(e) {
|
|
698
|
-
e.relatedTarget?.closest(".m3-submenu") || (
|
|
765
|
+
e.relatedTarget?.closest(".m3-submenu") || (S.value = !1);
|
|
699
766
|
}
|
|
700
767
|
function N(e) {
|
|
701
768
|
let t = e.relatedTarget;
|
|
702
|
-
t?.closest(".m3-submenu") || D.value?.contains(t) || (
|
|
769
|
+
t?.closest(".m3-submenu") || D.value?.contains(t) || (S.value = !1);
|
|
703
770
|
}
|
|
704
|
-
return (n, r) => (
|
|
771
|
+
return (n, r) => (x(), l("div", {
|
|
705
772
|
ref_key: "itemEl",
|
|
706
773
|
ref: D,
|
|
707
|
-
onMouseenter:
|
|
774
|
+
onMouseenter: A,
|
|
708
775
|
onMouseleave: M
|
|
709
|
-
}, [(
|
|
776
|
+
}, [(x(), s(T(h.value), {
|
|
710
777
|
to: e.to || void 0,
|
|
711
778
|
type: e.to ? void 0 : "button",
|
|
712
|
-
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", [
|
|
713
780
|
e.disabled ? "cursor-not-allowed opacity-[0.38] text-on-surface" : "cursor-pointer",
|
|
714
781
|
!e.disabled && e.danger ? "text-error hover:bg-error/8" : "",
|
|
715
782
|
!e.disabled && !e.danger ? "text-on-surface hover:bg-on-surface/8" : ""
|
|
716
783
|
]]),
|
|
717
784
|
disabled: e.disabled || void 0,
|
|
718
|
-
onClick:
|
|
785
|
+
onClick: b
|
|
719
786
|
}, {
|
|
720
|
-
default:
|
|
721
|
-
e.icon ? (
|
|
787
|
+
default: j(() => [
|
|
788
|
+
e.icon ? (x(), s(t, {
|
|
722
789
|
key: 0,
|
|
723
790
|
name: e.icon,
|
|
724
791
|
size: 20,
|
|
725
|
-
class:
|
|
792
|
+
class: g(["shrink-0", e.danger ? "text-error" : "text-on-surface-variant"])
|
|
726
793
|
}, null, 8, ["name", "class"])) : c("", !0),
|
|
727
|
-
u("span",
|
|
728
|
-
e.shortcut && !v.value ? (
|
|
729
|
-
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, {
|
|
730
797
|
key: 2,
|
|
731
798
|
name: "chevron_right",
|
|
732
799
|
size: 18,
|
|
@@ -739,7 +806,7 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
739
806
|
"type",
|
|
740
807
|
"class",
|
|
741
808
|
"disabled"
|
|
742
|
-
])), v.value ? (
|
|
809
|
+
])), v.value ? (x(), s(i, {
|
|
743
810
|
key: 0,
|
|
744
811
|
to: "body"
|
|
745
812
|
}, [f(a, {
|
|
@@ -748,17 +815,17 @@ var U = "inline-flex shrink-0 items-center justify-center transition-colors dura
|
|
|
748
815
|
"leave-active-class": "transition-opacity duration-75",
|
|
749
816
|
"leave-to-class": "opacity-0"
|
|
750
817
|
}, {
|
|
751
|
-
default:
|
|
818
|
+
default: j(() => [S.value ? (x(), l("div", {
|
|
752
819
|
key: 0,
|
|
753
|
-
class: "m3-submenu min-w-44 overflow-hidden rounded-
|
|
754
|
-
style:
|
|
820
|
+
class: "m3-submenu min-w-44 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
821
|
+
style: _(O.value),
|
|
755
822
|
onMouseleave: N
|
|
756
|
-
}, [
|
|
823
|
+
}, [w(n.$slots, "children")], 36)) : c("", !0)]),
|
|
757
824
|
_: 3
|
|
758
825
|
})])) : c("", !0)], 544));
|
|
759
826
|
}
|
|
760
827
|
});
|
|
761
828
|
//#endregion
|
|
762
|
-
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 };
|
|
763
830
|
|
|
764
|
-
//# sourceMappingURL=MMenuItem-
|
|
831
|
+
//# sourceMappingURL=MMenuItem-vSLbJGqe.js.map
|