@m3ui-vue/m3ui-vue 0.8.0 → 0.8.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.
Files changed (67) hide show
  1. package/README.md +9 -1
  2. package/dist/{MMenuItem-vSLbJGqe.js → MMenuItem-BAWmUTT3.js} +367 -189
  3. package/dist/MMenuItem-BAWmUTT3.js.map +1 -0
  4. package/dist/code-editor.js +1 -1
  5. package/dist/code-editor.js.map +1 -1
  6. package/dist/components/MButton.vue.d.ts +7 -0
  7. package/dist/components/MCalendar.vue.d.ts +0 -1
  8. package/dist/components/MCarousel.vue.d.ts +12 -14
  9. package/dist/components/MContextMenu.vue.d.ts +25 -4
  10. package/dist/components/MDatePicker.vue.d.ts +1 -3
  11. package/dist/components/MDatePickerModal.vue.d.ts +0 -1
  12. package/dist/components/MDateRangePicker.vue.d.ts +1 -3
  13. package/dist/components/MDateRangePickerModal.vue.d.ts +0 -1
  14. package/dist/components/MKanban.vue.d.ts +1 -0
  15. package/dist/components/MMenu.vue.d.ts +20 -2
  16. package/dist/components/MMenuDivider.vue.d.ts +13 -1
  17. package/dist/components/MMenuItem.vue.d.ts +3 -0
  18. package/dist/components/MScheduler.vue.d.ts +0 -1
  19. package/dist/components/MShape.vue.d.ts +51 -0
  20. package/dist/components/MShortNavigationBar.vue.d.ts +34 -0
  21. package/dist/components/MSimpleCarousel.vue.d.ts +45 -0
  22. package/dist/components/MToggleButton.vue.d.ts +29 -0
  23. package/dist/components/MTree.vue.d.ts +0 -1
  24. package/dist/components/MTreeTable.vue.d.ts +1 -0
  25. package/dist/index.d.ts +8 -1
  26. package/dist/m3ui-vue.css +1 -1
  27. package/dist/m3ui.js +5599 -3973
  28. package/dist/m3ui.js.map +1 -1
  29. package/dist/rich-text-editor.js +8 -8
  30. package/dist/styles/palettes.css +22 -22
  31. package/dist/styles.css +1 -1
  32. package/package.json +4 -1
  33. package/src/__tests__/MCarousel.test.ts +33 -0
  34. package/src/__tests__/MShape.test.ts +36 -0
  35. package/src/__tests__/MToggleButton.test.ts +27 -0
  36. package/src/components/MAutocomplete.vue +5 -1
  37. package/src/components/MButton.vue +15 -2
  38. package/src/components/MCalendar.vue +9 -5
  39. package/src/components/MCarousel.vue +123 -173
  40. package/src/components/MCodeEditor.vue +6 -1
  41. package/src/components/MCommandPalette.vue +4 -0
  42. package/src/components/MContextMenu.vue +287 -13
  43. package/src/components/MDatePicker.vue +12 -9
  44. package/src/components/MDatePickerModal.vue +9 -4
  45. package/src/components/MDateRangePicker.vue +12 -9
  46. package/src/components/MDateRangePickerModal.vue +9 -4
  47. package/src/components/MKanban.vue +5 -1
  48. package/src/components/MMenu.vue +308 -20
  49. package/src/components/MMenuDivider.vue +16 -0
  50. package/src/components/MMenuItem.vue +60 -18
  51. package/src/components/MMultiAutocomplete.vue +5 -1
  52. package/src/components/MMultiSelect.vue +5 -1
  53. package/src/components/MScheduler.vue +10 -6
  54. package/src/components/MSearchBar.vue +5 -1
  55. package/src/components/MSelect.vue +5 -1
  56. package/src/components/MShape.vue +107 -0
  57. package/src/components/MShortNavigationBar.vue +113 -0
  58. package/src/components/MSimpleCarousel.vue +325 -0
  59. package/src/components/MSpotlightSearch.vue +6 -0
  60. package/src/components/MToggleButton.vue +188 -0
  61. package/src/components/MTopAppBar.vue +6 -2
  62. package/src/components/MTree.vue +4 -2
  63. package/src/components/MTreeTable.vue +5 -1
  64. package/src/composables/useColorPalette.ts +1 -1
  65. package/src/index.ts +8 -1
  66. package/src/styles/palettes.css +22 -22
  67. package/dist/MMenuItem-vSLbJGqe.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, 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";
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, renderList as w, renderSlot as T, resolveDynamicComponent as E, toDisplayString as D, unref as O, useId as k, useSlots as A, watch as j, withCtx as M, withModifiers as N } from "vue";
5
5
  //#region src/components/MSpinner.vue?vue&type=script&setup=true&lang.ts
6
- var N = ["aria-label"], P = {
6
+ var P = ["aria-label"], F = {
7
7
  key: 0,
8
8
  class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
9
- }, F = [
9
+ }, I = [
10
10
  "width",
11
11
  "height",
12
12
  "viewBox"
13
- ], I = ["d", "stroke-dasharray"], L = 3, R = 9, z = /* @__PURE__ */ p({
13
+ ], ee = ["d", "stroke-dasharray"], L = 3, te = 9, R = /* @__PURE__ */ p({
14
14
  __name: "MSpinner",
15
15
  props: {
16
16
  size: { default: 20 },
@@ -24,7 +24,7 @@ var N = ["aria-label"], P = {
24
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(R * a), u = e + l * Math.cos(a), d = e + l * Math.sin(a);
27
+ let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(te * 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)}`;
@@ -41,7 +41,7 @@ var N = ["aria-label"], P = {
41
41
  height: `${t.size}px`
42
42
  }),
43
43
  role: "status",
44
- "aria-label": t.label ?? D(r).loading
44
+ "aria-label": t.label ?? O(r).loading
45
45
  }, [t.wavy ? (x(), l("svg", {
46
46
  key: 1,
47
47
  width: t.size,
@@ -58,9 +58,9 @@ var N = ["aria-label"], P = {
58
58
  "stroke-dasharray": s.value.dash,
59
59
  class: "animate-[m3-wavy-travel_2s_linear_infinite]",
60
60
  style: _({ "--m3-wave-len": s.value.len })
61
- }, null, 12, I)], 12, F)) : (x(), l("span", P))], 12, N));
61
+ }, null, 12, ee)], 12, I)) : (x(), l("span", F))], 12, P));
62
62
  }
63
- }), ee = [
63
+ }), z = [
64
64
  "bg-surface-container-highest",
65
65
  "bg-surface-container-high",
66
66
  "bg-surface-container-low",
@@ -82,10 +82,10 @@ var N = ["aria-label"], P = {
82
82
  "bg-error"
83
83
  ];
84
84
  function B(e) {
85
- for (let t of ee) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
85
+ for (let t of z) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
86
86
  return null;
87
87
  }
88
- function V(e) {
88
+ function ne(e) {
89
89
  if (!e || e === "transparent") return !0;
90
90
  let t = e.match(/^rgba?\(([^)]+)\)$/);
91
91
  if (t) {
@@ -94,7 +94,7 @@ function V(e) {
94
94
  }
95
95
  return !1;
96
96
  }
97
- function H(e, t) {
97
+ function V(e, t) {
98
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);
@@ -112,7 +112,7 @@ function H(e, t) {
112
112
  return;
113
113
  }
114
114
  let n = getComputedStyle(t).backgroundColor;
115
- if (!V(n)) {
115
+ if (!ne(n)) {
116
116
  r(n);
117
117
  return;
118
118
  }
@@ -134,7 +134,7 @@ function H(e, t) {
134
134
  }
135
135
  //#endregion
136
136
  //#region src/composables/useDebounce.ts
137
- function U(e, t) {
137
+ function H(e, t) {
138
138
  let n = null;
139
139
  function r(...r) {
140
140
  n && clearTimeout(n), n = setTimeout(() => {
@@ -151,7 +151,7 @@ function U(e, t) {
151
151
  }
152
152
  //#endregion
153
153
  //#region src/components/MIconButton.vue?vue&type=script&setup=true&lang.ts
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({
154
+ var re = "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]", U = /* @__PURE__ */ p({
155
155
  __name: "MIconButton",
156
156
  props: {
157
157
  icon: {},
@@ -216,13 +216,13 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
216
216
  default: return "text-on-surface-variant";
217
217
  }
218
218
  });
219
- return (n, i) => (x(), s(T(r.value), {
219
+ return (n, i) => (x(), s(E(r.value), {
220
220
  to: e.to || void 0,
221
221
  type: e.to ? void 0 : "button",
222
222
  "aria-label": e.label || void 0,
223
223
  disabled: e.disabled,
224
224
  class: g([
225
- W,
225
+ re,
226
226
  l.value,
227
227
  d.value,
228
228
  c.value
@@ -233,7 +233,7 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
233
233
  }),
234
234
  onPointerdown: u
235
235
  }, {
236
- default: j(() => [f(t, {
236
+ default: M(() => [f(t, {
237
237
  name: e.icon,
238
238
  size: a.value.icon
239
239
  }, null, 8, ["name", "size"])]),
@@ -247,7 +247,7 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
247
247
  "style"
248
248
  ]));
249
249
  }
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({
250
+ }), W = "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]", G = /* @__PURE__ */ p({
251
251
  __name: "MButton",
252
252
  props: {
253
253
  variant: { default: "filled" },
@@ -262,27 +262,28 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
262
262
  default: !1
263
263
  },
264
264
  icon: {},
265
+ iconPos: { default: "leading" },
265
266
  size: { default: "sm" },
266
267
  shape: { default: "rounded" },
267
268
  to: {}
268
269
  },
269
270
  setup(e) {
270
- let n = ["primary", "error"], r = e, i = o(() => r.to ? "RouterLink" : "button"), a = o(() => !!r.color && !n.includes(r.color)), l = o(() => {
271
- if (a.value) return {
272
- "--color-primary": r.color,
271
+ let n = ["primary", "error"], i = e, a = o(() => i.to ? "RouterLink" : "button"), u = o(() => !!i.color && !n.includes(i.color)), d = o(() => {
272
+ if (u.value) return {
273
+ "--color-primary": i.color,
273
274
  "--color-on-primary": "#ffffff",
274
- "--color-primary-container": r.color + "33",
275
- "--color-on-primary-container": r.color
275
+ "--color-primary-container": i.color + "33",
276
+ "--color-on-primary-container": i.color
276
277
  };
277
- }), u = o(() => r.color === "error"), d = o(() => {
278
- switch (r.variant) {
278
+ }), f = o(() => i.color === "error"), p = o(() => {
279
+ switch (i.variant) {
279
280
  case "filled":
280
281
  case "tonal":
281
282
  case "elevated": return "disabled:bg-on-surface/10";
282
- case "outlined": return u.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
283
+ case "outlined": return f.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
283
284
  default: return "";
284
285
  }
285
- }), f = {
286
+ }), m = {
286
287
  xs: {
287
288
  h: "h-8",
288
289
  text: "text-label-large",
@@ -333,9 +334,9 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
333
334
  pxText: "px-4",
334
335
  squareRadius: "rounded-xl"
335
336
  }
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(() => {
337
- let e = u.value;
338
- switch (r.variant) {
337
+ }, h = o(() => m[i.size] ?? m.sm), v = o(() => `${h.value.h} ${h.value.text} ${h.value.gap}`), y = o(() => h.value.icon), b = o(() => h.value.spinner), S = o(() => i.variant === "text" ? h.value.pxText : h.value.px), C = o(() => i.shape === "squared" ? h.value.squareRadius : "rounded-full"), w = o(() => {
338
+ let e = f.value;
339
+ switch (i.variant) {
339
340
  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";
340
341
  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";
341
342
  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";
@@ -344,34 +345,45 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
344
345
  default: return "";
345
346
  }
346
347
  });
347
- function C(e) {
348
- if (r.disabled || r.loading) return;
349
- let t = e.currentTarget, n = t.getBoundingClientRect(), i = Math.max(n.width, n.height) * 2, a = document.createElement("span");
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 });
348
+ function D(e) {
349
+ if (i.disabled || i.loading) return;
350
+ let t = e.currentTarget, n = t.getBoundingClientRect(), r = Math.max(n.width, n.height) * 2, a = document.createElement("span");
351
+ a.className = "m3-ripple", a.style.cssText = `width:${r}px;height:${r}px;top:${e.clientY - n.top - r / 2}px;left:${e.clientX - n.left - r / 2}px`, t.appendChild(a), a.addEventListener("animationend", () => a.remove(), { once: !0 });
351
352
  }
352
- return (n, r) => (x(), s(T(i.value), {
353
+ return (n, i) => (x(), s(E(a.value), {
353
354
  to: e.to || void 0,
354
355
  type: e.to ? void 0 : e.type,
355
356
  disabled: e.disabled || e.loading,
356
357
  class: g([
357
- K,
358
- b.value,
359
- m.value,
360
- y.value,
358
+ W,
359
+ C.value,
360
+ v.value,
361
361
  S.value,
362
- d.value
362
+ w.value,
363
+ p.value
363
364
  ]),
364
- style: _(l.value),
365
- onPointerdown: C
365
+ style: _(d.value),
366
+ onPointerdown: D
366
367
  }, {
367
- default: j(() => [e.loading ? (x(), s(z, {
368
- key: 0,
369
- size: v.value
370
- }, null, 8, ["size"])) : e.icon ? (x(), s(t, {
371
- key: 1,
372
- name: e.icon,
373
- size: h.value
374
- }, null, 8, ["name", "size"])) : c("", !0), w(n.$slots, "default")]),
368
+ default: M(() => [
369
+ e.iconPos === "leading" ? (x(), l(r, { key: 0 }, [e.loading ? (x(), s(R, {
370
+ key: 0,
371
+ size: b.value
372
+ }, null, 8, ["size"])) : e.icon ? (x(), s(t, {
373
+ key: 1,
374
+ name: e.icon,
375
+ size: y.value
376
+ }, null, 8, ["name", "size"])) : c("", !0)], 64)) : c("", !0),
377
+ T(n.$slots, "default"),
378
+ e.iconPos === "trailing" ? (x(), l(r, { key: 1 }, [e.loading ? (x(), s(R, {
379
+ key: 0,
380
+ size: b.value
381
+ }, null, 8, ["size"])) : e.icon ? (x(), s(t, {
382
+ key: 1,
383
+ name: e.icon,
384
+ size: y.value
385
+ }, null, 8, ["name", "size"])) : c("", !0)], 64)) : c("", !0)
386
+ ]),
375
387
  _: 3
376
388
  }, 40, [
377
389
  "to",
@@ -381,25 +393,25 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
381
393
  "style"
382
394
  ]));
383
395
  }
384
- }), J = { class: "relative px-6 pt-6 pb-2" }, Y = {
396
+ }), K = { class: "relative px-6 pt-6 pb-2" }, q = {
385
397
  key: 0,
386
398
  class: "absolute right-4 top-4"
387
- }, X = {
399
+ }, J = {
388
400
  key: 1,
389
401
  class: "mb-4 flex justify-center text-secondary"
390
- }, Z = {
402
+ }, ie = {
391
403
  key: 0,
392
404
  class: "shrink-0 border-t border-outline-variant"
393
- }, Q = {
405
+ }, Y = {
394
406
  key: 1,
395
407
  class: "flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6"
396
- }, te = {
408
+ }, X = {
397
409
  key: 0,
398
410
  class: "dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"
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 = {
411
+ }, Z = { class: "flex h-14 shrink-0 items-center gap-2 px-2" }, ae = { class: "flex-1 text-title-large font-medium text-on-surface" }, Q = {
400
412
  key: 1,
401
413
  class: "flex items-center gap-2"
402
- }, ae = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, oe = /*#__PURE__*/ n(/* @__PURE__ */ p({
414
+ }, oe = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, se = /*#__PURE__*/ n(/* @__PURE__ */ p({
403
415
  __name: "MDialog",
404
416
  props: {
405
417
  modelValue: { type: Boolean },
@@ -429,8 +441,8 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
429
441
  function _(e) {
430
442
  e.key === "Escape" && m();
431
443
  }
432
- let v = C(), y = C(), S = C(!1), T;
433
- function O() {
444
+ let v = C(), y = C(), S = C(!1), w;
445
+ function E() {
434
446
  let e = v.value;
435
447
  if (!e) {
436
448
  S.value = !1;
@@ -438,84 +450,93 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
438
450
  }
439
451
  S.value = e.scrollHeight - e.scrollTop - e.clientHeight > 1;
440
452
  }
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);
453
+ return j(() => r.modelValue, async (e) => {
454
+ e ? (document.addEventListener("keydown", _), document.body.style.overflow = "hidden", await h(), E(), w = new ResizeObserver(E), v.value && w.observe(v.value), y.value && w.observe(y.value)) : (document.removeEventListener("keydown", _), document.body.style.overflow = "", w?.disconnect(), w = void 0);
443
455
  }), b(() => {
444
- document.removeEventListener("keydown", _), T?.disconnect();
456
+ document.removeEventListener("keydown", _), w?.disconnect();
445
457
  }), (e, n) => (x(), s(i, { to: "body" }, [t.fullscreen ? (x(), s(a, {
446
458
  key: 1,
447
459
  name: "m3-dialog-fs"
448
460
  }, {
449
- default: j(() => [t.modelValue ? (x(), l("div", te, [u("div", ne, [
450
- t.persistent ? c("", !0) : (x(), s(G, {
461
+ default: M(() => [t.modelValue ? (x(), l("div", X, [u("div", Z, [
462
+ t.persistent ? c("", !0) : (x(), s(U, {
451
463
  key: 0,
452
464
  icon: "close",
453
- label: t.closeLabel ?? D(o).close,
465
+ label: t.closeLabel ?? O(o).close,
454
466
  onClick: m
455
467
  }, null, 8, ["label"])),
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)]),
468
+ u("h2", ae, [T(e.$slots, "title", {}, () => [d(D(t.title), 1)], !0)]),
469
+ e.$slots.actions ? (x(), l("div", Q, [T(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
470
+ ]), u("div", oe, [T(e.$slots, "default", {}, void 0, !0)])])) : c("", !0)]),
459
471
  _: 3
460
472
  })) : (x(), s(a, {
461
473
  key: 0,
462
474
  name: "m3-dialog"
463
475
  }, {
464
- default: j(() => [t.modelValue ? (x(), l("div", {
476
+ default: M(() => [t.modelValue ? (x(), l("div", {
465
477
  key: 0,
466
478
  class: "fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4",
467
- onClick: M(m, ["self"])
479
+ onClick: N(m, ["self"])
468
480
  }, [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, {
481
+ u("div", K, [
482
+ t.closable && !t.persistent ? (x(), l("div", q, [f(U, {
471
483
  icon: "close",
472
- label: t.closeLabel ?? D(o).close,
484
+ label: t.closeLabel ?? O(o).close,
473
485
  onClick: m
474
486
  }, 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)
487
+ e.$slots.icon ? (x(), l("div", J, [T(e.$slots, "icon", {}, void 0, !0)])) : c("", !0),
488
+ 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" : ""]]) }, [T(e.$slots, "title", {}, () => [d(D(t.title), 1)], !0)], 2)
477
489
  ]),
478
490
  u("div", {
479
491
  ref_key: "contentEl",
480
492
  ref: v,
481
493
  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
494
+ onScroll: E
483
495
  }, [u("div", {
484
496
  ref_key: "contentInnerEl",
485
497
  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)
498
+ }, [T(e.$slots, "default", {}, void 0, !0)], 512)], 34),
499
+ S.value && e.$slots.actions ? (x(), l("div", ie)) : c("", !0),
500
+ e.$slots.actions ? (x(), l("div", Y, [T(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
489
501
  ], 2)])) : c("", !0)]),
490
502
  _: 3
491
503
  }))]));
492
504
  }
493
- }), [["__scopeId", "data-v-be5c35b4"]]), se = { class: "flex flex-col gap-1" }, ce = [
505
+ }), [["__scopeId", "data-v-be5c35b4"]]), ce = { class: "my-1 border-outline-variant" }, le = /* @__PURE__ */ p({
506
+ __name: "MMenuDivider",
507
+ props: { gap: {
508
+ type: Boolean,
509
+ default: !1
510
+ } },
511
+ setup(e) {
512
+ return (e, t) => (x(), l("hr", ce));
513
+ }
514
+ }), ue = { class: "flex flex-col gap-1" }, de = [
494
515
  "id",
495
516
  "value",
496
517
  "rows",
497
518
  "disabled",
498
519
  "required"
499
- ], le = [
520
+ ], fe = [
500
521
  "id",
501
522
  "type",
502
523
  "value",
503
524
  "disabled",
504
525
  "required",
505
526
  "autocomplete"
506
- ], ue = ["for"], de = {
527
+ ], pe = ["for"], me = {
507
528
  key: 0,
508
529
  class: "text-error"
509
- }, fe = {
530
+ }, he = {
510
531
  key: 3,
511
532
  class: "absolute right-2 top-1/2 -translate-y-1/2"
512
- }, pe = {
533
+ }, ge = {
513
534
  key: 0,
514
535
  class: "px-4 text-body-small text-error"
515
- }, $ = {
536
+ }, _e = {
516
537
  key: 1,
517
538
  class: "px-4 text-body-small text-on-surface-variant"
518
- }, me = /* @__PURE__ */ p({
539
+ }, ve = /* @__PURE__ */ p({
519
540
  __name: "MTextField",
520
541
  props: {
521
542
  modelValue: {},
@@ -540,7 +561,7 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
540
561
  },
541
562
  emits: ["update:modelValue", "debounced"],
542
563
  setup(e, { emit: n }) {
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(() => {
564
+ let r = e, i = n, a = k(), s = A(), p = C(null), { resolvedFieldBg: m } = V(p, () => r.fieldBg), { debounced: h, cancel: v } = H((e) => i("debounced", e), r.debounce), y = o(() => r.clearable && String(r.modelValue).length > 0 && !r.disabled), b = o(() => {
544
565
  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 = [
545
566
  "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
546
567
  "transition-[border-color,border-width] duration-150",
@@ -583,15 +604,15 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
583
604
  "peer-disabled:text-on-surface/38"
584
605
  ].join(" ");
585
606
  });
586
- function T(e) {
607
+ function w(e) {
587
608
  let t = e.target;
588
609
  i("update:modelValue", t.value), r.debounce > 0 && h(t.value);
589
610
  }
590
- return (n, r) => (x(), l("div", se, [u("div", {
611
+ return (n, r) => (x(), l("div", ue, [u("div", {
591
612
  ref_key: "fieldBgEl",
592
613
  ref: p,
593
614
  class: g(["relative", e.variant === "outlined" ? "mt-2" : ""]),
594
- style: _(e.variant === "outlined" ? { "--field-bg": D(m) } : void 0)
615
+ style: _(e.variant === "outlined" ? { "--field-bg": O(m) } : void 0)
595
616
  }, [
596
617
  e.leadingIcon ? (x(), l("div", {
597
618
  key: 0,
@@ -602,17 +623,17 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
602
623
  }, null, 8, ["name"])], 2)) : c("", !0),
603
624
  e.multiline ? (x(), l("textarea", {
604
625
  key: 1,
605
- id: D(a),
626
+ id: O(a),
606
627
  value: String(e.modelValue),
607
628
  rows: e.rows,
608
629
  disabled: e.disabled,
609
630
  required: e.required,
610
631
  placeholder: " ",
611
632
  class: g(b.value),
612
- onInput: T
613
- }, null, 42, ce)) : (x(), l("input", {
633
+ onInput: w
634
+ }, null, 42, de)) : (x(), l("input", {
614
635
  key: 2,
615
- id: D(a),
636
+ id: O(a),
616
637
  type: e.type,
617
638
  value: e.modelValue,
618
639
  disabled: e.disabled,
@@ -620,116 +641,245 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
620
641
  autocomplete: e.autocomplete,
621
642
  placeholder: " ",
622
643
  class: g(b.value),
623
- onInput: T
624
- }, null, 42, le)),
644
+ onInput: w
645
+ }, null, 42, fe)),
625
646
  u("label", {
626
- for: D(a),
647
+ for: O(a),
627
648
  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", {
649
+ }, [d(D(e.label), 1), e.required ? (x(), l("span", me, "\xA0*")) : c("", !0)], 10, pe),
650
+ n.$slots.trailing ? (x(), l("div", he, [T(n.$slots, "trailing")])) : y.value ? (x(), l("button", {
630
651
  key: 4,
631
652
  type: "button",
632
653
  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",
633
654
  onClick: r[0] ||= (e) => {
634
- D(v)(), i("update:modelValue", "");
655
+ O(v)(), i("update:modelValue", "");
635
656
  }
636
657
  }, [f(t, {
637
658
  name: "close",
638
659
  size: 18
639
660
  })])) : c("", !0)
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)]));
661
+ ], 6), e.error && e.errorLabel ? (x(), l("p", ge, D(e.errorLabel), 1)) : e.hint ? (x(), l("p", _e, D(e.hint), 1)) : c("", !0)]));
641
662
  }
642
- }), he = /* @__PURE__ */ p({
663
+ }), ye = { class: "flex-1 truncate" }, be = { key: "root" }, xe = {
664
+ key: 0,
665
+ class: "flex flex-col gap-1 px-1.5"
666
+ }, Se = { class: "overflow-hidden rounded-lg bg-surface-container" }, Ce = 220, $ = 1 / 240, we = /* @__PURE__ */ p({
643
667
  __name: "MMenu",
644
- props: { align: { default: "right" } },
645
- setup(e, { expose: t }) {
646
- let n = e, d = C(!1), p = C(null), m = C(null), g = C({});
647
- function v() {
648
- if (!p.value) return;
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` };
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;
668
+ props: {
669
+ align: { default: "right" },
670
+ submenuMode: { default: "flyout" },
671
+ variant: { default: "standard" }
672
+ },
673
+ setup(e, { expose: n }) {
674
+ let d = e, p = A();
675
+ function v(e) {
676
+ let t = [];
677
+ for (let n of e) n.type === r && Array.isArray(n.children) ? t.push(...v(n.children)) : t.push(n);
678
+ return t;
651
679
  }
652
- function T() {
653
- return m.value ? Array.from(m.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
680
+ function D(e) {
681
+ if (e.type !== le) return !1;
682
+ let t = e.props?.gap;
683
+ return t === "" || t === !0 || t === "true";
654
684
  }
655
- function E() {
656
- h(() => T()[0]?.focus());
685
+ let O = o(() => {
686
+ if (d.variant !== "expressive") return null;
687
+ let e = v(p.default?.({ close: Q }) ?? []), t = [[]];
688
+ for (let n of e) D(n) ? t.push([]) : t[t.length - 1].push(n);
689
+ return t.filter((e) => e.length > 0);
690
+ }), k = o(() => !!O.value && O.value.length > 1), N = C([]), P = o(() => N.value[N.value.length - 1]), F = C("forward");
691
+ function I(e, t) {
692
+ let n = F.value === "forward" ? 1 : -1, r = e.animate([{
693
+ transform: `translateX(${n * 100}%)`,
694
+ opacity: .4
695
+ }, {
696
+ transform: "translateX(0%)",
697
+ opacity: 1
698
+ }], {
699
+ duration: Ce,
700
+ easing: "cubic-bezier(0.05,0.7,0.1,1)"
701
+ });
702
+ r.onfinish = t;
657
703
  }
658
- function D(e) {
659
- let t = T();
704
+ function ee(e, t) {
705
+ let n = F.value === "forward" ? -1 : 1, r = e;
706
+ r.style.position = "absolute", r.style.insetInline = "0", r.style.top = "0";
707
+ let i = r.animate([{
708
+ transform: "translateX(0%)",
709
+ opacity: 1
710
+ }, {
711
+ transform: `translateX(${n * 100}%)`,
712
+ opacity: .4
713
+ }], {
714
+ duration: Ce,
715
+ easing: "cubic-bezier(0.3,0,0.8,0.15)"
716
+ });
717
+ i.onfinish = t;
718
+ }
719
+ let L = null;
720
+ function te() {
721
+ if (L) return L;
722
+ let e = [], t = .8, n = 0, r = 0, i = 0;
723
+ for (let a = 0; a < 1 && (e.push({
724
+ scale: t,
725
+ alpha: r
726
+ }), n += (-1400 * (t - 1) - 1.8 * Math.sqrt(1400) * n) * $, t += n * $, i += (-3800 * (r - 1) - 2 * Math.sqrt(3800) * i) * $, r += i * $, !(Math.abs(t - 1) < .003 && Math.abs(r - 1) < .003)); a += $);
727
+ return e.push({
728
+ scale: 1,
729
+ alpha: 1
730
+ }), L = e, e;
731
+ }
732
+ let R = 0, z = null;
733
+ function B(e, t, n) {
734
+ z?.();
735
+ let r = e, i = te(), a = i.length - 1, o = n ? 1 : -1, s = n ? a : 0, c = 0, l = 0, u = !1;
736
+ function d(e) {
737
+ let t = i[Math.round(Math.max(0, Math.min(a, e)))];
738
+ r.style.transform = `scale(${t.scale})`, r.style.opacity = String(Math.min(1, Math.max(0, t.alpha)));
739
+ }
740
+ function f(e) {
741
+ if (u) return;
742
+ let r = c ? (e - c) / 1e3 / $ : 1;
743
+ if (c = e, R = Math.max(0, Math.min(a, R + o * r)), d(R), n && R >= s || !n && R <= s) {
744
+ z = null, t();
745
+ return;
746
+ }
747
+ l = requestAnimationFrame(f);
748
+ }
749
+ z = () => {
750
+ u = !0, cancelAnimationFrame(l);
751
+ }, d(R), l = requestAnimationFrame(f);
752
+ }
753
+ function ne(e, t) {
754
+ B(e, t, !0);
755
+ }
756
+ function V(e, t) {
757
+ B(e, t, !1);
758
+ }
759
+ function H(e) {
760
+ F.value = "forward", N.value.push(e), h(() => X());
761
+ }
762
+ function re() {
763
+ F.value = "backward", N.value.pop(), h(() => X());
764
+ }
765
+ let U = C(!1), W = C(null), G = C(null), K = C({}), q = m("m-menu-panel-registry", /* @__PURE__ */ new Set());
766
+ S("m-menu-panel-registry", q), j(G, (e, t) => {
767
+ t && q.delete(t), e && q.add(e);
768
+ }), b(() => {
769
+ G.value && q.delete(G.value);
770
+ });
771
+ let J = m("m-menu-sibling-group", null);
772
+ S("m-menu-sibling-group", { current: null });
773
+ function ie() {
774
+ if (!W.value) return;
775
+ let e = W.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` };
776
+ n ? r.bottom = `${window.innerHeight - e.top + 4}px` : r.top = `${e.bottom + 4}px`, d.align === "right" ? r.right = `${window.innerWidth - e.right}px` : r.left = `${e.left}px`, K.value = r;
777
+ }
778
+ function Y() {
779
+ return G.value ? Array.from(G.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
780
+ }
781
+ function X() {
782
+ h(() => Y()[0]?.focus());
783
+ }
784
+ function Z(e) {
785
+ let t = Y();
660
786
  if (!t.length) return;
661
787
  let n = t.indexOf(document.activeElement);
662
788
  (n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
663
789
  }
664
- function O() {
665
- d.value || v(), d.value = !d.value, d.value && E();
790
+ function ae() {
791
+ U.value ? J?.current === Q && (J.current = null) : (J && J.current && J.current !== Q && J.current(), J && (J.current = Q), ie(), N.value = []), U.value = !U.value, U.value && X();
666
792
  }
667
- function k() {
668
- d.value = !1;
793
+ function Q() {
794
+ J?.current === Q && (J.current = null), U.value = !1;
669
795
  }
670
- S("m-menu-close", k), t({
671
- close: k,
672
- open: d
796
+ S("m-menu-close", Q), S("m-menu-nav", {
797
+ mode: d.submenuMode,
798
+ push: H
799
+ }), n({
800
+ close: Q,
801
+ open: U
673
802
  });
674
- function A(e) {
803
+ function oe(e) {
675
804
  let t = e.target;
676
- p.value?.contains(t) || m.value?.contains(t) || t.closest?.(".m3-submenu") || k();
677
- }
678
- function M(e) {
679
- if (!d.value || m.value?.contains(e.target) || !p.value) return;
680
- let t = p.value.getBoundingClientRect();
681
- if (t.bottom < 0 || t.top > window.innerHeight) {
682
- k();
683
- return;
805
+ if (!W.value?.contains(t)) {
806
+ for (let e of q) if (e.contains(t)) return;
807
+ t.closest?.(".m3-submenu") || Q();
684
808
  }
685
- v();
686
809
  }
687
- function N(e) {
810
+ function se(e) {
811
+ U.value && (G.value?.contains(e.target) || Q());
812
+ }
813
+ function ce(e) {
688
814
  if (e.key === "Escape") {
689
- k();
815
+ N.value.length ? re() : Q();
690
816
  return;
691
817
  }
692
- d.value && (e.key === "ArrowDown" ? (e.preventDefault(), D(1)) : e.key === "ArrowUp" && (e.preventDefault(), D(-1)));
818
+ U.value && (e.key === "ArrowDown" ? (e.preventDefault(), Z(1)) : e.key === "ArrowUp" && (e.preventDefault(), Z(-1)));
693
819
  }
694
820
  y(() => {
695
- document.addEventListener("mousedown", A), document.addEventListener("keydown", N), window.addEventListener("scroll", M, !0);
821
+ document.addEventListener("mousedown", oe), document.addEventListener("keydown", ce), window.addEventListener("scroll", se, !0);
696
822
  }), b(() => {
697
- document.removeEventListener("mousedown", A), document.removeEventListener("keydown", N), window.removeEventListener("scroll", M, !0);
823
+ document.removeEventListener("mousedown", oe), document.removeEventListener("keydown", ce), window.removeEventListener("scroll", se, !0), z?.();
698
824
  });
699
- let P = o(() => n.align === "right" ? "top right" : "top left");
700
- return (e, t) => (x(), l(r, null, [u("div", {
825
+ let ue = o(() => d.align === "right" ? "top right" : "top left");
826
+ return (n, o) => (x(), l(r, null, [u("div", {
701
827
  ref_key: "triggerEl",
702
- ref: p,
828
+ ref: W,
703
829
  class: "inline-block",
704
- onClick: O
705
- }, [w(e.$slots, "trigger", { open: d.value })], 512), (x(), s(i, { to: "body" }, [f(a, {
706
- "enter-active-class": "transition-[opacity,transform] duration-100 ease-out",
707
- "enter-from-class": "opacity-0 scale-95",
708
- "enter-to-class": "opacity-100 scale-100",
709
- "leave-active-class": "transition-[opacity,transform] duration-75 ease-in",
710
- "leave-from-class": "opacity-100 scale-100",
711
- "leave-to-class": "opacity-0 scale-95"
830
+ onClick: ae
831
+ }, [T(n.$slots, "trigger", { open: U.value })], 512), (x(), s(i, { to: "body" }, [f(a, {
832
+ css: !1,
833
+ onEnter: ne,
834
+ onLeave: V
712
835
  }, {
713
- default: j(() => [d.value ? (x(), l("div", {
836
+ default: M(() => [U.value ? (x(), l("div", {
714
837
  key: 0,
715
838
  ref_key: "dropdownEl",
716
- ref: m,
717
- class: "fixed z-500 min-w-48 overflow-hidden rounded-xs bg-surface-container shadow-elevation-2",
839
+ ref: G,
840
+ class: g(["fixed z-500 min-w-48", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", k.value ? "" : "shadow-elevation-2"]]),
718
841
  style: _({
719
- ...g.value,
720
- transformOrigin: P.value
842
+ ...K.value,
843
+ transformOrigin: ue.value
721
844
  })
722
- }, [u("div", {
723
- class: "overflow-y-auto py-1",
724
- style: _({ maxHeight: g.value.maxHeight })
725
- }, [w(e.$slots, "default", { close: k })], 4)], 4)) : c("", !0)]),
845
+ }, [u("div", { class: g(["overflow-hidden", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", k.value ? "" : "bg-surface-container"]]) }, [u("div", {
846
+ class: "relative overflow-y-auto py-1",
847
+ style: _({ maxHeight: K.value.maxHeight })
848
+ }, [f(a, {
849
+ css: !1,
850
+ onEnter: I,
851
+ onLeave: ee
852
+ }, {
853
+ default: M(() => [P.value ? (x(), l("div", { key: N.value.length }, [u("button", {
854
+ type: "button",
855
+ class: "flex w-full items-center gap-3 border-b border-outline-variant px-4 py-2.5 text-left text-body-large text-on-surface outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary",
856
+ onClick: re
857
+ }, [
858
+ f(t, {
859
+ name: "chevron_left",
860
+ size: 20,
861
+ class: "shrink-0 text-on-surface-variant"
862
+ }),
863
+ P.value.icon ? (x(), s(t, {
864
+ key: 0,
865
+ name: P.value.icon,
866
+ size: 20,
867
+ class: "shrink-0 text-on-surface-variant"
868
+ }, null, 8, ["name"])) : c("", !0),
869
+ u("span", ye, [(x(), s(E(() => P.value?.header?.())))])
870
+ ]), (x(), s(E(() => P.value?.content?.())))])) : (x(), l("div", be, [k.value ? (x(), l("div", xe, [(x(!0), l(r, null, w(O.value, (e, t) => (x(), l("div", {
871
+ key: t,
872
+ class: "rounded-lg shadow-elevation-2"
873
+ }, [u("div", Se, [(x(), s(E(() => e)))])]))), 128))])) : T(n.$slots, "default", { close: Q }, void 0, void 0, 1)]))]),
874
+ _: 3
875
+ })], 4)], 2)], 6)) : c("", !0)]),
726
876
  _: 3
727
877
  })]))], 64));
728
878
  }
729
- }), ge = { class: "flex-1" }, _e = {
879
+ }), Te = { class: "flex-1" }, Ee = {
730
880
  key: 1,
731
881
  class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
732
- }, ve = /* @__PURE__ */ p({
882
+ }, De = { class: "overflow-hidden rounded-xs bg-surface-container py-1" }, Oe = /* @__PURE__ */ p({
733
883
  __name: "MMenuItem",
734
884
  props: {
735
885
  icon: {},
@@ -742,38 +892,62 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
742
892
  danger: {
743
893
  type: Boolean,
744
894
  default: !1
895
+ },
896
+ keepOpen: {
897
+ type: Boolean,
898
+ default: !1
745
899
  }
746
900
  },
747
901
  emits: ["click"],
748
902
  setup(e, { emit: n }) {
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() {
751
- r.disabled || v.value || (d("click"), y?.());
752
- }
753
- let S = C(!1), D = C(), O = C({});
754
- function A() {
755
- if (!v.value || r.disabled || (S.value = !0, !D.value)) return;
756
- let e = D.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
757
- O.value = {
903
+ let r = e, d = n, p = A(), h = o(() => r.to ? "RouterLink" : "button"), v = o(() => !!p.children), y = m("m-menu-close", null), b = m("m-menu-nav", null), S = C(), w = C(!1), k = C({});
904
+ function j() {
905
+ if (!S.value) return;
906
+ let e = S.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
907
+ k.value = {
758
908
  position: "fixed",
759
909
  top: `${e.top}px`,
760
910
  ...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
761
911
  zIndex: "501"
762
912
  };
763
913
  }
764
- function M(e) {
765
- e.relatedTarget?.closest(".m3-submenu") || (S.value = !1);
914
+ function N() {
915
+ if (w.value) {
916
+ w.value = !1;
917
+ return;
918
+ }
919
+ j(), w.value = !0;
920
+ }
921
+ function P() {
922
+ if (!r.disabled) {
923
+ if (v.value) {
924
+ b?.mode === "push" ? b.push({
925
+ icon: r.icon,
926
+ header: p.default,
927
+ content: p.children
928
+ }) : N();
929
+ return;
930
+ }
931
+ d("click"), r.keepOpen || y?.();
932
+ }
766
933
  }
767
- function N(e) {
934
+ function F(e) {
935
+ e.pointerType === "mouse" && v.value && !r.disabled && (j(), w.value = !0);
936
+ }
937
+ function I(e) {
938
+ e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (w.value = !1));
939
+ }
940
+ function ee(e) {
941
+ if (e.pointerType !== "mouse") return;
768
942
  let t = e.relatedTarget;
769
- t?.closest(".m3-submenu") || D.value?.contains(t) || (S.value = !1);
943
+ t?.closest(".m3-submenu") || S.value?.contains(t) || (w.value = !1);
770
944
  }
771
945
  return (n, r) => (x(), l("div", {
772
946
  ref_key: "itemEl",
773
- ref: D,
774
- onMouseenter: A,
775
- onMouseleave: M
776
- }, [(x(), s(T(h.value), {
947
+ ref: S,
948
+ onPointerenter: F,
949
+ onPointerleave: I
950
+ }, [(x(), s(E(h.value), {
777
951
  to: e.to || void 0,
778
952
  type: e.to ? void 0 : "button",
779
953
  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", [
@@ -782,17 +956,19 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
782
956
  !e.disabled && !e.danger ? "text-on-surface hover:bg-on-surface/8" : ""
783
957
  ]]),
784
958
  disabled: e.disabled || void 0,
785
- onClick: b
959
+ "aria-haspopup": v.value ? "menu" : void 0,
960
+ "aria-expanded": v.value ? w.value : void 0,
961
+ onClick: P
786
962
  }, {
787
- default: j(() => [
963
+ default: M(() => [
788
964
  e.icon ? (x(), s(t, {
789
965
  key: 0,
790
966
  name: e.icon,
791
967
  size: 20,
792
968
  class: g(["shrink-0", e.danger ? "text-error" : "text-on-surface-variant"])
793
969
  }, null, 8, ["name", "class"])) : c("", !0),
794
- u("span", ge, [w(n.$slots, "default")]),
795
- e.shortcut && !v.value ? (x(), l("span", _e, E(e.shortcut), 1)) : c("", !0),
970
+ u("span", Te, [T(n.$slots, "default")]),
971
+ e.shortcut && !v.value ? (x(), l("span", Ee, D(e.shortcut), 1)) : c("", !0),
796
972
  v.value ? (x(), s(t, {
797
973
  key: 2,
798
974
  name: "chevron_right",
@@ -805,8 +981,10 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
805
981
  "to",
806
982
  "type",
807
983
  "class",
808
- "disabled"
809
- ])), v.value ? (x(), s(i, {
984
+ "disabled",
985
+ "aria-haspopup",
986
+ "aria-expanded"
987
+ ])), v.value && O(b)?.mode !== "push" ? (x(), s(i, {
810
988
  key: 0,
811
989
  to: "body"
812
990
  }, [f(a, {
@@ -815,17 +993,17 @@ var W = "relative inline-flex shrink-0 items-center justify-center overflow-hidd
815
993
  "leave-active-class": "transition-opacity duration-75",
816
994
  "leave-to-class": "opacity-0"
817
995
  }, {
818
- default: j(() => [S.value ? (x(), l("div", {
996
+ default: M(() => [w.value ? (x(), l("div", {
819
997
  key: 0,
820
- class: "m3-submenu min-w-44 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2",
821
- style: _(O.value),
822
- onMouseleave: N
823
- }, [w(n.$slots, "children")], 36)) : c("", !0)]),
998
+ class: "m3-submenu min-w-44 rounded-xs shadow-elevation-2",
999
+ style: _(k.value),
1000
+ onPointerleave: ee
1001
+ }, [u("div", De, [T(n.$slots, "children")])], 36)) : c("", !0)]),
824
1002
  _: 3
825
1003
  })])) : c("", !0)], 544));
826
1004
  }
827
1005
  });
828
1006
  //#endregion
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 };
1007
+ export { se as a, H as c, le as i, V as l, we as n, G as o, ve as r, U as s, Oe as t, R as u };
830
1008
 
831
- //# sourceMappingURL=MMenuItem-vSLbJGqe.js.map
1009
+ //# sourceMappingURL=MMenuItem-BAWmUTT3.js.map