@m3ui-vue/m3ui-vue 1.9.0 → 1.10.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.
Files changed (154) hide show
  1. package/README.md +2 -0
  2. package/dist/API.md +305 -12
  3. package/dist/{MButton-LiZRRP4h.js → MButton-B9RCM06i.js} +4 -4
  4. package/dist/MButton-B9RCM06i.js.map +1 -0
  5. package/dist/{MColorPickerModal-IjciC8zh.js → MColorPickerModal-ChRtcZOo.js} +5 -5
  6. package/dist/{MColorPickerModal-IjciC8zh.js.map → MColorPickerModal-ChRtcZOo.js.map} +1 -1
  7. package/dist/{MDialog-BLpfgIA3.js → MDialog-dk07tify.js} +3 -3
  8. package/dist/{MDialog-BLpfgIA3.js.map → MDialog-dk07tify.js.map} +1 -1
  9. package/dist/{MIconButton-CNjN0xwW.js → MIconButton-CrBPZidd.js} +46 -39
  10. package/dist/MIconButton-CrBPZidd.js.map +1 -0
  11. package/dist/MListItem-h9H223vx.js +1239 -0
  12. package/dist/MListItem-h9H223vx.js.map +1 -0
  13. package/dist/{MLoadingIndicator-dejdXpu8.js → MLoadingIndicator-YTV1Ov5w.js} +2 -2
  14. package/dist/{MLoadingIndicator-dejdXpu8.js.map → MLoadingIndicator-YTV1Ov5w.js.map} +1 -1
  15. package/dist/MMenuItem-US0Zbglq.js +596 -0
  16. package/dist/MMenuItem-US0Zbglq.js.map +1 -0
  17. package/dist/{MPdfViewer-B5Q9Xs9d.js → MPdfViewer-DL9mRsd2.js} +8 -8
  18. package/dist/{MPdfViewer-B5Q9Xs9d.js.map → MPdfViewer-DL9mRsd2.js.map} +1 -1
  19. package/dist/MProgressBar-BzZMxq7M.js +254 -0
  20. package/dist/MProgressBar-BzZMxq7M.js.map +1 -0
  21. package/dist/{MSeekBar-NwkuAzx-.js → MSeekBar-JFZcoJ8y.js} +2 -2
  22. package/dist/{MSeekBar-NwkuAzx-.js.map → MSeekBar-JFZcoJ8y.js.map} +1 -1
  23. package/dist/MSegmentedButton-DMou-8sG.js +106 -0
  24. package/dist/MSegmentedButton-DMou-8sG.js.map +1 -0
  25. package/dist/{MSignaturePad-Bqr-1R9f.js → MSignaturePad-WuvE_Cyl.js} +2 -2
  26. package/dist/{MSignaturePad-Bqr-1R9f.js.map → MSignaturePad-WuvE_Cyl.js.map} +1 -1
  27. package/dist/{MSlider-B7dIcHVn.js → MSlider-7TzhFHKS.js} +3 -3
  28. package/dist/{MSlider-B7dIcHVn.js.map → MSlider-7TzhFHKS.js.map} +1 -1
  29. package/dist/{MSpinner-CXLY7lWw.js → MSpinner-CkIVBuGE.js} +2 -2
  30. package/dist/{MSpinner-CXLY7lWw.js.map → MSpinner-CkIVBuGE.js.map} +1 -1
  31. package/dist/{MTextField-CryHMs8-.js → MTextField-B6_iOczK.js} +3 -3
  32. package/dist/{MTextField-CryHMs8-.js.map → MTextField-B6_iOczK.js.map} +1 -1
  33. package/dist/{_useFieldValidation-CvZnZfl-.js → _useFieldValidation-COBJ1tWr.js} +2 -2
  34. package/dist/{_useFieldValidation-CvZnZfl-.js.map → _useFieldValidation-COBJ1tWr.js.map} +1 -1
  35. package/dist/api.json +1 -1
  36. package/dist/code-editor.js +2 -2
  37. package/dist/components/MAvatarGroup.vue.d.ts +48 -0
  38. package/dist/components/MCommentThread.vue.d.ts +42 -0
  39. package/dist/components/MContainer.vue.d.ts +1 -1
  40. package/dist/components/MContextMenu.vue.d.ts +7 -0
  41. package/dist/components/MDataTable.vue.d.ts +7 -0
  42. package/dist/components/MList.vue.d.ts +11 -0
  43. package/dist/components/MListDetail.vue.d.ts +22 -0
  44. package/dist/components/MListItem.vue.d.ts +9 -1
  45. package/dist/components/MMenu.vue.d.ts +10 -0
  46. package/dist/components/MReactions.vue.d.ts +35 -0
  47. package/dist/components/MScaffold.vue.d.ts +45 -0
  48. package/dist/components/MScrollField.vue.d.ts +4 -1
  49. package/dist/components/MScrollable.vue.d.ts +5 -4
  50. package/dist/components/MSpreadsheet.vue.d.ts +1 -1
  51. package/dist/components/MSupportingPane.vue.d.ts +22 -0
  52. package/dist/components/MTable.vue.d.ts +7 -0
  53. package/dist/components/MVirtualList.vue.d.ts +51 -0
  54. package/dist/components/_MComment.vue.d.ts +8 -0
  55. package/dist/components/_MCommentComposer.vue.d.ts +23 -0
  56. package/dist/components/_commentThread.d.ts +41 -0
  57. package/dist/composables/_menuGroups.d.ts +7 -0
  58. package/dist/composables/_usePaneResize.d.ts +45 -0
  59. package/dist/composables/useLocale.d.ts +22 -0
  60. package/dist/composables/useUndo.d.ts +45 -0
  61. package/dist/directives/vRipple.d.ts +4 -0
  62. package/dist/draw.js +4 -4
  63. package/dist/flow.js +2 -2
  64. package/dist/gantt.js +3 -3
  65. package/dist/index.d.ts +12 -0
  66. package/dist/locales/index.js +128 -0
  67. package/dist/locales/index.js.map +1 -1
  68. package/dist/m3ui-vue.css +1 -1
  69. package/dist/m3ui.js +11027 -9741
  70. package/dist/m3ui.js.map +1 -1
  71. package/dist/map.js +7 -7
  72. package/dist/media.js +6 -6
  73. package/dist/pdf-sign.js +8 -8
  74. package/dist/pdf.js +1 -1
  75. package/dist/plugin.d.ts +6 -0
  76. package/dist/rich-text-editor.js +6 -6
  77. package/dist/styles/theme.css +43 -6
  78. package/dist/styles.css +1 -1
  79. package/dist/{useLocale-ybIju59R.js → useLocale-YRaOT12S.js} +17 -1
  80. package/dist/useLocale-YRaOT12S.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/__tests__/MListItemNestedControl.test.ts +1 -1
  83. package/src/__tests__/MListMultiSelect.test.ts +132 -0
  84. package/src/__tests__/MMenu.test.ts +152 -0
  85. package/src/__tests__/MProgressBar.test.ts +84 -1
  86. package/src/__tests__/MScrollField.test.ts +16 -0
  87. package/src/__tests__/MScrollable.test.ts +61 -5
  88. package/src/__tests__/MSwitch.test.ts +83 -0
  89. package/src/__tests__/adaptiveLayouts.test.ts +167 -0
  90. package/src/__tests__/backlogComponents.test.ts +249 -0
  91. package/src/__tests__/popupPosition.test.ts +4 -0
  92. package/src/__tests__/stateLayerOpacity.test.ts +65 -0
  93. package/src/__tests__/tableCheckboxReveal.test.ts +35 -0
  94. package/src/__tests__/vRipple.test.ts +62 -0
  95. package/src/components/MAvatarGroup.vue +150 -0
  96. package/src/components/MButton.vue +1 -1
  97. package/src/components/MButtonGroup.vue +1 -1
  98. package/src/components/MCard.vue +4 -2
  99. package/src/components/MCheckbox.vue +13 -2
  100. package/src/components/MChip.vue +7 -4
  101. package/src/components/MCircleProgressBar.vue +69 -21
  102. package/src/components/MCommentThread.vue +131 -0
  103. package/src/components/MContextMenu.vue +18 -31
  104. package/src/components/MDataTable.vue +16 -6
  105. package/src/components/MFab.vue +2 -2
  106. package/src/components/MIconButton.vue +2 -2
  107. package/src/components/MList.vue +163 -5
  108. package/src/components/MListDetail.vue +100 -14
  109. package/src/components/MListItem.vue +66 -6
  110. package/src/components/MMenu.vue +48 -41
  111. package/src/components/MMenuItem.vue +48 -14
  112. package/src/components/MProgressBar.vue +183 -50
  113. package/src/components/MRadio.vue +14 -2
  114. package/src/components/MReactions.vue +161 -0
  115. package/src/components/MScaffold.vue +213 -0
  116. package/src/components/MScrollField.vue +15 -12
  117. package/src/components/MScrollable.vue +187 -46
  118. package/src/components/MSegmentedButton.vue +3 -1
  119. package/src/components/MSupportingPane.vue +102 -12
  120. package/src/components/MSwitch.vue +92 -9
  121. package/src/components/MTable.vue +17 -4
  122. package/src/components/MTimeScroll.vue +1 -1
  123. package/src/components/MToggleButton.vue +2 -2
  124. package/src/components/MVirtualList.vue +222 -0
  125. package/src/components/_MComment.vue +142 -0
  126. package/src/components/_MCommentComposer.vue +68 -0
  127. package/src/components/_commentThread.ts +46 -0
  128. package/src/composables/_menuGroups.ts +31 -0
  129. package/src/composables/_usePaneResize.ts +271 -0
  130. package/src/composables/useLocale.ts +38 -0
  131. package/src/composables/useUndo.ts +170 -0
  132. package/src/directives/vRipple.ts +18 -5
  133. package/src/index.ts +12 -0
  134. package/src/locales/ar.ts +16 -0
  135. package/src/locales/de.ts +16 -0
  136. package/src/locales/es.ts +16 -0
  137. package/src/locales/fr.ts +16 -0
  138. package/src/locales/ja.ts +16 -0
  139. package/src/locales/ko.ts +16 -0
  140. package/src/locales/pt.ts +16 -0
  141. package/src/locales/zh.ts +16 -0
  142. package/src/plugin.ts +7 -0
  143. package/src/styles/theme.css +43 -6
  144. package/dist/MButton-LiZRRP4h.js.map +0 -1
  145. package/dist/MIconButton-CNjN0xwW.js.map +0 -1
  146. package/dist/MListItem-BBQ-6i3v.js +0 -991
  147. package/dist/MListItem-BBQ-6i3v.js.map +0 -1
  148. package/dist/MMenuItem-E31tMzOt.js +0 -577
  149. package/dist/MMenuItem-E31tMzOt.js.map +0 -1
  150. package/dist/MProgressBar-CPrZhQbA.js +0 -179
  151. package/dist/MProgressBar-CPrZhQbA.js.map +0 -1
  152. package/dist/MSegmentedButton-DZuZLBML.js +0 -105
  153. package/dist/MSegmentedButton-DZuZLBML.js.map +0 -1
  154. package/dist/useLocale-ybIju59R.js.map +0 -1
@@ -0,0 +1,596 @@
1
+ import { r as e, t } from "./MIcon-BSsJZhK7.js";
2
+ import { a as n, f as r, i, l as a, p as o, s, u as c } from "./MIconButton-CrBPZidd.js";
3
+ import { i as l } from "./motion-BcejVTeX.js";
4
+ import { n as u, r as d, t as f } from "./_popupPosition-C_lxj9qU.js";
5
+ import { Fragment as p, Teleport as ee, Transition as m, computed as h, createBlock as g, createCommentVNode as _, createElementBlock as v, createElementVNode as y, createVNode as b, defineComponent as x, inject as S, mergeProps as C, nextTick as w, normalizeClass as T, normalizeStyle as te, onMounted as ne, onUnmounted as re, openBlock as E, provide as D, ref as O, renderList as ie, renderSlot as k, resolveDynamicComponent as A, toDisplayString as ae, unref as j, useSlots as oe, watch as se, withCtx as ce, withDirectives as le } from "vue";
6
+ // src/components/MMenuDivider.vue?vue&type=script&setup=true&lang.ts
7
+ var M = { class: "my-1 border-outline-variant" }, N = /* @__PURE__ */ x({
8
+ __name: "MMenuDivider",
9
+ props: { gap: {
10
+ type: Boolean,
11
+ default: !1
12
+ } },
13
+ setup(e) {
14
+ return (e, t) => (E(), v("hr", M));
15
+ }
16
+ });
17
+ // src/composables/_menuGroups.ts
18
+ function P(e) {
19
+ let t = [];
20
+ for (let n of e) n.type === p && Array.isArray(n.children) ? t.push(...P(n.children)) : t.push(n);
21
+ return t;
22
+ }
23
+ function ue(e) {
24
+ if (e.type !== N) return !1;
25
+ let t = e.props?.gap;
26
+ return t === "" || t === !0 || t === "true";
27
+ }
28
+ function de(e) {
29
+ let t = [[]];
30
+ for (let n of P(e)) ue(n) ? t.push([]) : t[t.length - 1].push(n);
31
+ return t.filter((e) => e.length > 0);
32
+ }
33
+ // src/composables/_useMenuNav.ts
34
+ var F = 30, I = 380, L = 8, R = 1 / 3, fe = .5;
35
+ function pe(t) {
36
+ let n = O([]), i = h(() => n.value[n.value.length - 1]), o = O("forward"), s = O(), u = 0, d = 1, f = () => e(s.value) ? -1 : 1;
37
+ function p(e, t) {
38
+ let n = (o.value === "forward" ? 1 : -1) * f(), r = e.animate([{
39
+ transform: `translateX(${n * F}px)`,
40
+ opacity: 0
41
+ }, {
42
+ transform: "translateX(0)",
43
+ opacity: 1
44
+ }], {
45
+ duration: 300,
46
+ delay: 60,
47
+ easing: "cubic-bezier(0.05,0.7,0.1,1)",
48
+ fill: "backwards"
49
+ });
50
+ r.onfinish = t;
51
+ }
52
+ function ee(e, t) {
53
+ let n = (o.value === "forward" ? -1 : 1) * f(), r = e;
54
+ r.style.position = "absolute", r.style.insetInline = "0", r.style.top = "0";
55
+ let i = u, a = d;
56
+ u = 0, d = 1;
57
+ let s = r.animate([{
58
+ transform: `translateX(${i}px)`,
59
+ opacity: a
60
+ }, {
61
+ transform: `translateX(${i + n * F}px)`,
62
+ opacity: 0
63
+ }], {
64
+ duration: 90,
65
+ easing: "cubic-bezier(0.3,0,0.8,0.15)",
66
+ fill: "forwards"
67
+ });
68
+ s.onfinish = t;
69
+ }
70
+ function m(e) {
71
+ let t = s.value, n = t?.offsetHeight ?? 0, i = t?.style.overflowY ?? "";
72
+ t && (t.style.overflowY = "hidden");
73
+ let o = () => {
74
+ t && (t.style.overflowY = i);
75
+ };
76
+ if (e(), !t || c()) return o();
77
+ w(() => {
78
+ let e = t.offsetHeight, i = Math.abs(e - n) < 1 ? null : a(t, r(n, e, 0, l.standard.defaultSpatial, .5), (e) => ({ height: `${e}px` })), s = new Promise((e) => setTimeout(e, I));
79
+ Promise.all([s, i?.finished.catch(() => {})]).then(o);
80
+ });
81
+ }
82
+ function g(e) {
83
+ o.value = "forward", m(() => n.value.push(e)), w(t);
84
+ }
85
+ function _() {
86
+ o.value = "backward", m(() => n.value.pop()), w(t);
87
+ }
88
+ function v() {
89
+ n.value = [];
90
+ }
91
+ let y = null;
92
+ function b() {
93
+ return s.value?.querySelector(`:scope > [data-menu-level="${n.value.length}"]`) ?? null;
94
+ }
95
+ function x(e) {
96
+ if (e.pointerType !== "touch" || !n.value.length || y) return;
97
+ let t = b();
98
+ if (!t) return;
99
+ let r = f();
100
+ y = {
101
+ id: e.pointerId,
102
+ x: e.clientX * r,
103
+ y: e.clientY,
104
+ level: t,
105
+ width: s.value.clientWidth,
106
+ active: !1,
107
+ lastX: e.clientX * r,
108
+ lastT: e.timeStamp,
109
+ vel: 0,
110
+ sign: r
111
+ }, window.addEventListener("pointermove", C), window.addEventListener("pointerup", T), window.addEventListener("pointercancel", te);
112
+ }
113
+ function S(e) {
114
+ y && (y.level.style.transform = `translateX(${e * y.sign}px)`, y.level.style.opacity = String(1 - .5 * Math.min(1, e / y.width)));
115
+ }
116
+ function C(e) {
117
+ if (!y || e.pointerId !== y.id) return;
118
+ let t = e.clientX * y.sign, n = t - y.x, r = e.clientY - y.y;
119
+ if (!y.active) {
120
+ if (Math.hypot(n, r) < L) return;
121
+ if (Math.abs(r) > Math.abs(n) || n < 0) return k();
122
+ y.active = !0, y.x = t, y.level.getAnimations().forEach((e) => e.finish());
123
+ }
124
+ let i = e.timeStamp - y.lastT;
125
+ i > 0 && (y.vel = .8 * ((t - y.lastX) / i) + .2 * y.vel), y.lastX = t, y.lastT = e.timeStamp, S(Math.max(0, t - y.x));
126
+ }
127
+ function T(e) {
128
+ if (!y || e.pointerId !== y.id) return;
129
+ let t = y;
130
+ if (k(), !t.active) return;
131
+ window.addEventListener("click", ie, {
132
+ capture: !0,
133
+ once: !0
134
+ }), clearTimeout(E), E = setTimeout(D, 400);
135
+ let n = Math.max(0, e.clientX * t.sign - t.x);
136
+ n > t.width * R || t.vel > fe ? (u = n * t.sign, d = Number(t.level.style.opacity || 1), _()) : ne(t.level, n, t.sign);
137
+ }
138
+ function te(e) {
139
+ if (!y || e.pointerId !== y.id) return;
140
+ let t = y;
141
+ k(), t.active && ne(t.level, Math.max(0, t.lastX - t.x), t.sign);
142
+ }
143
+ function ne(e, t, n) {
144
+ if (e.style.transform = "", e.style.opacity = "", c() || t < 1) return;
145
+ let i = s.value?.clientWidth || 1;
146
+ a(e, r(t, 0, 0, l.standard.defaultSpatial, .5), (e) => ({
147
+ transform: `translateX(${e * n}px)`,
148
+ opacity: String(1 - .5 * Math.min(1, e / i))
149
+ }));
150
+ }
151
+ let E;
152
+ function D() {
153
+ clearTimeout(E), window.removeEventListener("click", ie, { capture: !0 });
154
+ }
155
+ function ie(e) {
156
+ e.stopPropagation(), e.preventDefault();
157
+ }
158
+ function k() {
159
+ y = null, window.removeEventListener("pointermove", C), window.removeEventListener("pointerup", T), window.removeEventListener("pointercancel", te);
160
+ }
161
+ return re(() => {
162
+ k(), D();
163
+ }), {
164
+ navStack: n,
165
+ currentNav: i,
166
+ navBox: s,
167
+ navSlideEnter: p,
168
+ navSlideLeave: ee,
169
+ pushNav: g,
170
+ popNav: _,
171
+ resetNav: v,
172
+ onNavPointerDown: x
173
+ };
174
+ }
175
+ // src/components/MMenu.vue?vue&type=script&setup=true&lang.ts
176
+ var z = ["data-menu-level"], me = { class: "flex-1 truncate" }, B = { key: "root" }, he = {
177
+ key: 0,
178
+ class: "flex flex-col gap-1 px-1.5"
179
+ }, V = 1 / 240, H = 4, ge = /* @__PURE__ */ x({
180
+ inheritAttrs: !1,
181
+ __name: "MMenu",
182
+ props: {
183
+ align: { default: "end" },
184
+ submenuMode: { default: "flyout" },
185
+ variant: { default: "standard" },
186
+ color: { default: "standard" },
187
+ maxHeight: { default: 400 }
188
+ },
189
+ setup(n, { expose: r }) {
190
+ let i = n, a = oe(), o = h(() => i.variant === "expressive" ? de(a.default?.({ close: $ }) ?? []) : null), s = h(() => !!o.value && o.value.length > 1), { navStack: c, currentNav: l, navBox: u, navSlideEnter: x, navSlideLeave: ae, pushNav: le, popNav: M, onNavPointerDown: N } = pe(() => be()), P = null;
191
+ function ue() {
192
+ if (P) return P;
193
+ let e = [], t = .8, n = 0, r = 0, i = 0;
194
+ for (let a = 0; a < 1 && (e.push({
195
+ scale: t,
196
+ alpha: r
197
+ }), n += (-1400 * (t - 1) - 1.8 * Math.sqrt(1400) * n) * V, t += n * V, i += (-3800 * (r - 1) - 2 * Math.sqrt(3800) * i) * V, r += i * V, !(Math.abs(t - 1) < .003 && Math.abs(r - 1) < .003)); a += V);
198
+ return e.push({
199
+ scale: 1,
200
+ alpha: 1
201
+ }), P = e, e;
202
+ }
203
+ let F = 0, I = null, L = null;
204
+ function R(e, t, n) {
205
+ I?.();
206
+ let r = e, i = ue(), a = i.length - 1, o = Math.round(Math.max(0, Math.min(a, F))), s = n ? a : 0, c = n ? 1 : -1, l = [];
207
+ for (let e = o; n ? e <= s : e >= s; e += c) l.push(i[e]);
208
+ let u = (e) => ({
209
+ transform: `scale(${e.scale})`,
210
+ opacity: String(Math.min(1, Math.max(0, e.alpha)))
211
+ });
212
+ Object.assign(r.style, u(i[s]));
213
+ let d = !1;
214
+ function f() {
215
+ d || (d = !0, F = s, I = null, L = null, t());
216
+ }
217
+ if (l.length < 2 || typeof r.animate != "function") return f();
218
+ let p = r.animate(l.map(u), {
219
+ duration: (l.length - 1) * V * 1e3,
220
+ easing: "linear"
221
+ });
222
+ p.finished.catch(() => {}), p.onfinish = f, I = () => {
223
+ let e = Number(p.currentTime ?? 0) / (V * 1e3);
224
+ F = Math.max(0, Math.min(a, o + c * e)), d = !0, p.cancel();
225
+ }, L = n ? null : () => {
226
+ I?.(), I = null, L = null, t();
227
+ };
228
+ }
229
+ function fe(e, t) {
230
+ Z(e), ve(e), R(e, t, !0);
231
+ }
232
+ function ge(e, t) {
233
+ R(e, t, !1);
234
+ }
235
+ let U = O(!1), _e = O(null), W = O(null), G = O({}), K = S("m-menu-panel-registry", /* @__PURE__ */ new Set());
236
+ D("m-menu-panel-registry", K), se(W, (e, t) => {
237
+ t && K.delete(t), e && K.add(e);
238
+ }), re(() => {
239
+ W.value && K.delete(W.value);
240
+ });
241
+ let q = S("m-menu-sibling-group", null);
242
+ D("m-menu-sibling-group", { current: null });
243
+ let J = null, Y = O(!1);
244
+ function X() {
245
+ if (!_e.value) return;
246
+ let e = _e.value.getBoundingClientRect();
247
+ J = e, Y.value = !1, G.value = {
248
+ maxHeight: `${i.maxHeight}px`,
249
+ maxWidth: `${window.innerWidth - 16}px`,
250
+ left: "0px",
251
+ top: `${e.bottom + H}px`
252
+ };
253
+ }
254
+ function Z(e) {
255
+ if (!J || !u.value) return;
256
+ let t = Math.min(u.value.scrollHeight, i.maxHeight), n = window.innerHeight - J.bottom - H - 8, r = J.top - H - 8;
257
+ Y.value = t > n && (t <= r || r > n);
258
+ let a = {
259
+ ...G.value,
260
+ maxHeight: `${Math.min(Y.value ? r : n, i.maxHeight)}px`
261
+ };
262
+ delete a.top, delete a.bottom, Y.value ? a.bottom = `${window.innerHeight - J.top + H}px` : a.top = `${J.bottom + H}px`, G.value = a, e.style.top = a.top ?? "", e.style.bottom = a.bottom ?? "", u.value.style.maxHeight = a.maxHeight;
263
+ }
264
+ let Q = O(i.align === "right" || i.align === "end" && !e() || i.align === "start" && e() ? "right" : "left");
265
+ function ve(t) {
266
+ if (!J) return;
267
+ let n = t.offsetWidth, r = e(), a = i.align === "left" ? r ? "end" : "start" : i.align === "right" ? r ? "start" : "end" : i.align, o = f(J, n, window.innerWidth, a, void 0, r), s = Math.min(n, Math.max(0, (J.left + J.right) / 2 - o)), c = Math.abs(o - J.left) < 1 ? "left" : Math.abs(o + n - J.right) < 1 ? "right" : `${s}px`;
268
+ Q.value = c, G.value = {
269
+ ...G.value,
270
+ left: `${o}px`
271
+ }, t.style.left = `${o}px`, t.style.transformOrigin = `${c} ${Y.value ? "bottom" : "top"}`;
272
+ }
273
+ function ye() {
274
+ return W.value ? Array.from(W.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
275
+ }
276
+ function be() {
277
+ w(() => ye()[0]?.focus());
278
+ }
279
+ function xe(e) {
280
+ let t = ye();
281
+ if (!t.length) return;
282
+ let n = t.indexOf(document.activeElement);
283
+ (n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
284
+ }
285
+ function Se() {
286
+ U.value ? q?.current === $ && (q.current = null) : (q && q.current && q.current !== $ && q.current(), q && (q.current = $), X(), c.value = []), U.value = !U.value, U.value && be();
287
+ }
288
+ function $() {
289
+ q?.current === $ && (q.current = null), U.value = !1;
290
+ }
291
+ D("m-menu-close", $), D("m-menu-color", h(() => i.color)), D("m-menu-variant", h(() => i.variant));
292
+ let Ce = h(() => i.color === "vibrant" ? "bg-tertiary-container" : i.variant === "expressive" ? "bg-surface-container-low" : "bg-surface-container");
293
+ D("m-menu-nav", {
294
+ mode: i.submenuMode,
295
+ push: le
296
+ }), r({
297
+ close: $,
298
+ open: U
299
+ });
300
+ function we(e) {
301
+ let t = e.target;
302
+ if (!_e.value?.contains(t)) {
303
+ for (let e of K) if (e.contains(t)) return;
304
+ t.closest?.(".m3-submenu") || $();
305
+ }
306
+ }
307
+ function Te(e) {
308
+ if (!U.value) return;
309
+ let t = e.target;
310
+ for (let e of K) if (e.contains(t)) return;
311
+ t.closest?.(".m3-submenu") || $();
312
+ }
313
+ d(() => U.value, () => c.value.length ? M() : $());
314
+ function Ee(e) {
315
+ U.value && (e.key === "ArrowDown" ? (e.preventDefault(), xe(1)) : e.key === "ArrowUp" && (e.preventDefault(), xe(-1)));
316
+ }
317
+ ne(() => {
318
+ document.addEventListener("mousedown", we), document.addEventListener("keydown", Ee), window.addEventListener("scroll", Te, !0);
319
+ }), re(() => {
320
+ document.removeEventListener("mousedown", we), document.removeEventListener("keydown", Ee), window.removeEventListener("scroll", Te, !0), L ? L() : I?.();
321
+ });
322
+ let De = h(() => `${Q.value} ${Y.value ? "bottom" : "top"}`);
323
+ return (e, r) => (E(), v(p, null, [y("div", C({
324
+ ref_key: "triggerEl",
325
+ ref: _e
326
+ }, e.$attrs, {
327
+ class: "inline-block",
328
+ onClick: Se
329
+ }), [k(e.$slots, "trigger", { open: U.value })], 16), (E(), g(ee, { to: "body" }, [b(m, {
330
+ css: !1,
331
+ onEnter: fe,
332
+ onLeave: ge
333
+ }, {
334
+ default: ce(() => [U.value ? (E(), v("div", {
335
+ key: 0,
336
+ ref_key: "dropdownEl",
337
+ ref: W,
338
+ class: T(["fixed z-500 min-w-48", [n.variant === "expressive" ? "rounded-lg" : "rounded-xs", s.value ? "" : "shadow-elevation-2"]]),
339
+ style: te({
340
+ ...G.value,
341
+ transformOrigin: De.value
342
+ })
343
+ }, [y("div", { class: T(["overflow-hidden", [n.variant === "expressive" ? "rounded-lg" : "rounded-xs", s.value ? "" : Ce.value]]) }, [y("div", {
344
+ ref_key: "navBox",
345
+ ref: u,
346
+ class: "relative overflow-x-hidden overflow-y-auto overscroll-contain py-1",
347
+ style: te({
348
+ maxHeight: G.value.maxHeight,
349
+ touchAction: j(l) ? "pan-y" : void 0
350
+ }),
351
+ onPointerdown: r[1] ||= (...e) => j(N) && j(N)(...e)
352
+ }, [b(m, {
353
+ css: !1,
354
+ onEnter: j(x),
355
+ onLeave: j(ae)
356
+ }, {
357
+ default: ce(() => [j(l) ? (E(), v("div", {
358
+ key: j(c).length,
359
+ "data-menu-level": j(c).length
360
+ }, [
361
+ y("button", {
362
+ type: "button",
363
+ class: T(["flex w-full items-center gap-3 px-4 py-2.5 text-start text-label-large outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", n.color === "vibrant" ? "text-on-tertiary-container hover:bg-on-tertiary-container/8" : "text-on-surface-variant hover:bg-on-surface/8"]),
364
+ onClick: r[0] ||= (...e) => j(M) && j(M)(...e)
365
+ }, [b(t, {
366
+ name: "arrow_back",
367
+ size: 20,
368
+ class: "shrink-0"
369
+ }), y("span", me, [(E(), g(A(() => j(l)?.header?.())))])], 2),
370
+ r[2] ||= y("hr", { class: "my-1 border-outline-variant" }, null, -1),
371
+ (E(), g(A(() => j(l)?.content?.())))
372
+ ], 8, z)) : (E(), v("div", B, [s.value ? (E(), v("div", he, [(E(!0), v(p, null, ie(o.value, (e, t) => (E(), v("div", {
373
+ key: t,
374
+ class: "rounded-lg shadow-elevation-2"
375
+ }, [y("div", { class: T(["overflow-hidden rounded-lg", Ce.value]) }, [(E(), g(A(() => e)))], 2)]))), 128))])) : k(e.$slots, "default", { close: $ }, void 0, void 0, 1)]))]),
376
+ _: 3
377
+ }, 8, ["onEnter", "onLeave"])], 36)], 2)], 6)) : _("", !0)]),
378
+ _: 3
379
+ })]))], 64));
380
+ }
381
+ }), U = ["data-m3-menu-choice"], _e = { class: "flex-1" }, W = {
382
+ key: 0,
383
+ class: "flex flex-col gap-1 px-1.5"
384
+ }, G = 32, K = /* @__PURE__ */ x({
385
+ __name: "MMenuItem",
386
+ props: {
387
+ icon: {},
388
+ shortcut: {},
389
+ to: {},
390
+ disabled: {
391
+ type: Boolean,
392
+ default: !1
393
+ },
394
+ danger: {
395
+ type: Boolean,
396
+ default: !1
397
+ },
398
+ keepOpen: {
399
+ type: Boolean,
400
+ default: void 0
401
+ },
402
+ selected: {
403
+ type: Boolean,
404
+ default: void 0
405
+ },
406
+ checked: {
407
+ type: Boolean,
408
+ default: void 0
409
+ },
410
+ selectedIcon: {}
411
+ },
412
+ emits: ["click", "update:checked"],
413
+ setup(r, { emit: a }) {
414
+ let c = r, l = a, d = oe(), f = h(() => c.checked !== void 0), x = h(() => f.value || c.selected !== void 0), C = h(() => !!(c.checked ?? c.selected)), D = h(() => x.value && !c.icon && !d.icon), M = h(() => c.selectedIcon ?? (c.icon ? void 0 : "check")), N = O("single");
415
+ function P() {
416
+ let e = J.value;
417
+ if (!e || !x.value) return;
418
+ let t = (e) => !!e?.hasAttribute("data-m3-menu-choice"), n = t(e.previousElementSibling), r = t(e.nextElementSibling);
419
+ N.value = n && r ? "middle" : n ? "last" : r ? "first" : "single";
420
+ }
421
+ function ue() {
422
+ if (C.value) return [
423
+ 12,
424
+ 12,
425
+ 12,
426
+ 12
427
+ ];
428
+ let e = N.value === "first" ? 12 : 4, t = N.value === "last" ? 12 : 4;
429
+ return [
430
+ e,
431
+ e,
432
+ t,
433
+ t
434
+ ];
435
+ }
436
+ let { snap: F } = s(() => x.value ? [...ue(), D.value && C.value ? G : 0] : [], ([e, t, n, r, i]) => {
437
+ let a = Y.value instanceof HTMLElement ? Y.value : Y.value?.$el;
438
+ a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`), X.value && i !== void 0 && (X.value.style.width = `${i}px`);
439
+ }, n);
440
+ se(N, () => F());
441
+ let I = null;
442
+ ne(() => {
443
+ P();
444
+ let e = J.value?.parentElement;
445
+ e && (I = new MutationObserver(P), I.observe(e, { childList: !0 }));
446
+ }), re(() => I?.disconnect()), se(x, () => w(P)), s(() => D.value ? [+!!C.value] : [], ([e]) => {
447
+ X.value && e !== void 0 && (X.value.style.opacity = String(e));
448
+ }, i);
449
+ let L = h(() => c.to ? "RouterLink" : "button"), R = h(() => !!d.children), fe = S("m-menu-close", null), pe = S("m-menu-color", null), z = h(() => pe?.value === "vibrant"), me = S("m-menu-variant", null), B = h(() => me?.value === "expressive"), he = h(() => z.value ? "bg-tertiary-container" : B.value ? "bg-surface-container-low" : "bg-surface-container"), V = h(() => B.value ? de(d.children?.() ?? []) : null), H = h(() => !!V.value && V.value.length > 1), ge = h(() => x.value && C.value ? "" : !x.value && c.danger ? "text-error" : z.value ? c.disabled ? "text-on-tertiary-container" : "text-on-tertiary-container group-hover:text-tertiary group-active:text-tertiary" : "text-on-surface-variant"), K = h(() => z.value ? "text-on-tertiary-container" : "text-on-surface-variant"), q = S("m-menu-nav", null), J = O(), Y = O(), X = O(), Z = O(!1), Q = O({});
450
+ function ve() {
451
+ if (!J.value) return;
452
+ let e = J.value.getBoundingClientRect();
453
+ Q.value = {
454
+ position: "fixed",
455
+ top: `${e.top}px`,
456
+ left: `${e.right}px`,
457
+ maxWidth: `${window.innerWidth - 16}px`,
458
+ zIndex: "501"
459
+ };
460
+ }
461
+ function ye(t) {
462
+ if (!J.value) return;
463
+ let n = t, r = J.value.getBoundingClientRect();
464
+ n.style.left = "0px";
465
+ let i = n.offsetWidth, a = n.offsetHeight, o = u(e(J.value) ? [r.left - i, r.right] : [r.right, r.left - i], i, window.innerWidth), s = u([r.top, r.bottom - a], a, window.innerHeight);
466
+ Q.value = {
467
+ ...Q.value,
468
+ left: `${o}px`,
469
+ top: `${s}px`
470
+ }, n.style.left = `${o}px`, n.style.top = `${s}px`;
471
+ }
472
+ function be() {
473
+ Z.value ? Z.value = !1 : (ve(), Z.value = !0);
474
+ }
475
+ function xe() {
476
+ c.disabled || (R.value ? q?.mode === "push" ? q.push({
477
+ icon: c.icon,
478
+ header: d.default,
479
+ content: d.children
480
+ }) : be() : (f.value && l("update:checked", !c.checked), l("click"), (c.keepOpen ?? f.value) || fe?.()));
481
+ }
482
+ function Se(e) {
483
+ e.pointerType === "mouse" && R.value && !c.disabled && (ve(), Z.value = !0);
484
+ }
485
+ function $(e) {
486
+ e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (Z.value = !1));
487
+ }
488
+ function Ce(e) {
489
+ if (e.pointerType !== "mouse") return;
490
+ let t = e.relatedTarget;
491
+ t?.closest(".m3-submenu") || J.value?.contains(t) || (Z.value = !1);
492
+ }
493
+ return (e, n) => (E(), v("div", {
494
+ ref_key: "itemEl",
495
+ ref: J,
496
+ "data-m3-menu-choice": x.value || void 0,
497
+ onPointerenter: Se,
498
+ onPointerleave: $
499
+ }, [le((E(), g(A(L.value), {
500
+ ref_key: "controlEl",
501
+ ref: Y,
502
+ to: r.to || void 0,
503
+ type: r.to ? void 0 : "button",
504
+ role: x.value ? f.value ? "menuitemcheckbox" : "menuitemradio" : void 0,
505
+ "aria-checked": x.value ? C.value : void 0,
506
+ class: T(["group flex items-center gap-3 py-2.5 text-start text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", x.value ? [
507
+ "relative mx-1 w-[calc(100%-0.5rem)] px-3 duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity",
508
+ C.value ? z.value ? "bg-tertiary text-on-tertiary" : "bg-tertiary-container text-on-tertiary-container" : z.value ? "text-on-tertiary-container" : "text-on-surface",
509
+ r.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer hover:before:opacity-[0.08] focus-visible:before:opacity-[0.1] active:before:opacity-[0.1]"
510
+ ] : [
511
+ "w-full px-4",
512
+ r.disabled ? ["cursor-not-allowed opacity-[0.38]", z.value ? "text-on-tertiary-container" : "text-on-surface"] : "cursor-pointer",
513
+ !r.disabled && r.danger ? "text-error hover:bg-error/8 focus-visible:bg-error/10 active:bg-error/10" : "",
514
+ !r.disabled && !r.danger ? z.value ? "text-on-tertiary-container hover:bg-on-tertiary-container/8 focus-visible:bg-on-tertiary-container/10 active:bg-on-tertiary-container/10" : "text-on-surface hover:bg-on-surface/8 focus-visible:bg-on-surface/10 active:bg-on-surface/10" : ""
515
+ ]]),
516
+ disabled: r.disabled || void 0,
517
+ "aria-haspopup": R.value ? "menu" : void 0,
518
+ "aria-expanded": R.value ? Z.value : void 0,
519
+ onClick: xe
520
+ }, {
521
+ default: ce(() => [
522
+ D.value ? (E(), v("span", {
523
+ key: 0,
524
+ ref_key: "iconSlotEl",
525
+ ref: X,
526
+ class: "-me-3 flex shrink-0 overflow-hidden",
527
+ style: {
528
+ width: "0",
529
+ opacity: "0"
530
+ }
531
+ }, [b(t, {
532
+ name: M.value,
533
+ size: 20,
534
+ class: "shrink-0"
535
+ }, null, 8, ["name"])], 512)) : e.$slots.icon ? (E(), v("span", {
536
+ key: 1,
537
+ class: T(["flex size-5 shrink-0 items-center justify-center", ge.value])
538
+ }, [k(e.$slots, "icon", { on: C.value })], 2)) : r.icon ? (E(), g(t, {
539
+ key: 2,
540
+ name: C.value && M.value ? M.value : r.icon,
541
+ filled: C.value && !M.value,
542
+ size: 20,
543
+ class: T(["shrink-0", ge.value])
544
+ }, null, 8, [
545
+ "name",
546
+ "filled",
547
+ "class"
548
+ ])) : _("", !0),
549
+ y("span", _e, [k(e.$slots, "default")]),
550
+ r.shortcut && !R.value ? (E(), v("span", {
551
+ key: 3,
552
+ class: T(["ms-4 shrink-0 text-label-small opacity-60", K.value])
553
+ }, ae(r.shortcut), 3)) : _("", !0),
554
+ R.value ? (E(), g(t, {
555
+ key: 4,
556
+ name: "chevron_right",
557
+ size: 18,
558
+ class: T(["shrink-0", K.value])
559
+ }, null, 8, ["class"])) : _("", !0)
560
+ ]),
561
+ _: 3
562
+ }, 8, [
563
+ "to",
564
+ "type",
565
+ "role",
566
+ "aria-checked",
567
+ "class",
568
+ "disabled",
569
+ "aria-haspopup",
570
+ "aria-expanded"
571
+ ])), [[j(o), { disabled: r.disabled }]]), R.value && j(q)?.mode !== "push" ? (E(), g(ee, {
572
+ key: 0,
573
+ to: "body"
574
+ }, [b(m, {
575
+ "enter-active-class": "transition-opacity duration-100",
576
+ "enter-from-class": "opacity-0",
577
+ "leave-active-class": "transition-opacity duration-75",
578
+ "leave-to-class": "opacity-0",
579
+ onEnter: ye
580
+ }, {
581
+ default: ce(() => [Z.value ? (E(), v("div", {
582
+ key: 0,
583
+ class: T(["m3-submenu min-w-44", [B.value ? "rounded-lg" : "rounded-xs", H.value ? "" : "shadow-elevation-2"]]),
584
+ style: te(Q.value),
585
+ onPointerleave: Ce
586
+ }, [y("div", { class: T(["overflow-hidden py-1", [B.value ? "rounded-lg" : "rounded-xs", H.value ? "" : he.value]]) }, [H.value ? (E(), v("div", W, [(E(!0), v(p, null, ie(V.value, (e, t) => (E(), v("div", {
587
+ key: t,
588
+ class: "rounded-lg shadow-elevation-2"
589
+ }, [y("div", { class: T(["overflow-hidden rounded-lg", he.value]) }, [(E(), g(A(() => e)))], 2)]))), 128))])) : k(e.$slots, "children", {}, void 0, void 0, 1)], 2)], 38)) : _("", !0)]),
590
+ _: 3
591
+ })])) : _("", !0)], 40, U));
592
+ }
593
+ });
594
+ export { N as a, de as i, ge as n, pe as r, K as t };
595
+
596
+ //# sourceMappingURL=MMenuItem-US0Zbglq.js.map