@m3ui-vue/m3ui-vue 0.7.1 → 0.8.1

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