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