@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,170 @@
1
+ import { computed, getCurrentInstance, getCurrentScope, onMounted, onScopeDispose, shallowRef, toValue, type MaybeRefOrGetter } from 'vue'
2
+ import { useToast } from './useToast'
3
+ import { useLocale } from './useLocale'
4
+
5
+ /** One undoable action for `useUndo().run()` */
6
+ export interface UndoableAction {
7
+ /** Does it (also called again on redo) */
8
+ do: () => void | Promise<void>
9
+ /** Reverts it */
10
+ undo: () => void | Promise<void>
11
+ /** What it did, shown in the snackbar with an "Undo" button ("Message archived"). Without it, no snackbar */
12
+ label?: string
13
+ /**
14
+ * Makes it final once it can't be undone from the snackbar any more (the snackbar closed, or another action
15
+ * replaced it): the call to your server, say, while `do` only hid the item. Not called if it was undone
16
+ */
17
+ commit?: () => void | Promise<void>
18
+ }
19
+
20
+ export interface UseUndoOptions {
21
+ /** Most actions kept for undo (default 50) */
22
+ limit?: number
23
+ /**
24
+ * Ctrl/Cmd+Z undoes and Ctrl/Cmd+Shift+Z or Ctrl+Y redo, unless the focus is in a text field (which keeps its
25
+ * own undo). `true` listens on the window; pass an element (or ref) to listen only inside it. Default true
26
+ */
27
+ keyboard?: boolean | MaybeRefOrGetter<HTMLElement | null | undefined>
28
+ /** How long the snackbar stays, in ms (default 6000) */
29
+ duration?: number
30
+ /**
31
+ * Shows the snackbar yourself, e.g. with `MScaffold`'s `showSnackbar()`: resolve to true if the user pressed
32
+ * Undo. Defaults to `useToast()`
33
+ */
34
+ notify?: (label: string, undoLabel: string, duration: number) => Promise<boolean>
35
+ }
36
+
37
+ interface Entry extends UndoableAction { committed: boolean }
38
+
39
+ /**
40
+ * Undo and redo for your app's actions, with M3's "Undo" snackbar after each one (Gmail's "Conversation
41
+ * archived · Undo"). `run()` does an action and remembers how to revert it; `undo()`/`redo()` walk the history,
42
+ * also from the keyboard. With `commit`, an action can wait to become final until its snackbar is gone.
43
+ */
44
+ export function useUndo(options: UseUndoOptions = {}) {
45
+ const limit = options.limit ?? 50
46
+ const duration = options.duration ?? 6000
47
+ const locale = useLocale()
48
+ const toast = useToast()
49
+ const past = shallowRef<Entry[]>([])
50
+ const future = shallowRef<Entry[]>([])
51
+ // The action whose snackbar is on screen: committing waits for it
52
+ let pending: Entry | null = null
53
+ let pendingToast: number | null = null
54
+
55
+ async function commit(entry: Entry | null) {
56
+ if (!entry || entry.committed) return
57
+ entry.committed = true
58
+ await entry.commit?.()
59
+ }
60
+
61
+ function defaultNotify(label: string, undoLabel: string, ms: number) {
62
+ return new Promise<boolean>((resolve) => {
63
+ let undone = false
64
+ pendingToast = toast.show(label, 'info', {
65
+ duration: ms,
66
+ icon: null,
67
+ action: { label: undoLabel, onClick: () => { undone = true; resolve(true) } },
68
+ })
69
+ setTimeout(() => { if (!undone) resolve(false) }, ms + 50)
70
+ })
71
+ }
72
+
73
+ /** Does the action and adds it to the history (clearing what could be redone) */
74
+ async function run(action: UndoableAction) {
75
+ // A new action ends the previous one's chance to be undone from its snackbar
76
+ if (pending) {
77
+ await commit(pending)
78
+ if (pendingToast != null) toast.dismiss(pendingToast)
79
+ pending = null
80
+ pendingToast = null
81
+ }
82
+ await action.do()
83
+ const entry: Entry = { ...action, committed: !action.commit }
84
+ past.value = [...past.value, entry].slice(-limit)
85
+ future.value = []
86
+ if (!action.label) {
87
+ await commit(entry)
88
+ return
89
+ }
90
+ pending = entry
91
+ const undone = await (options.notify ?? defaultNotify)(action.label, locale.undo, duration)
92
+ if (pending !== entry) return
93
+ pending = null
94
+ pendingToast = null
95
+ if (undone) await undo()
96
+ else await commit(entry)
97
+ }
98
+
99
+ /** Reverts the last action */
100
+ async function undo() {
101
+ const entry = past.value[past.value.length - 1]
102
+ if (!entry) return
103
+ past.value = past.value.slice(0, -1)
104
+ if (pending === entry) {
105
+ pending = null
106
+ if (pendingToast != null) toast.dismiss(pendingToast)
107
+ pendingToast = null
108
+ }
109
+ await entry.undo()
110
+ future.value = [...future.value, entry]
111
+ }
112
+
113
+ /** Does again the last undone action */
114
+ async function redo() {
115
+ const entry = future.value[future.value.length - 1]
116
+ if (!entry) return
117
+ future.value = future.value.slice(0, -1)
118
+ await entry.do()
119
+ past.value = [...past.value, entry]
120
+ // Redone, it's final straight away (there's no snackbar to wait for)
121
+ entry.committed = false
122
+ await commit(entry)
123
+ }
124
+
125
+ /** Forgets the history, committing whatever is still waiting */
126
+ async function clear() {
127
+ await commit(pending)
128
+ pending = null
129
+ past.value = []
130
+ future.value = []
131
+ }
132
+
133
+ // Keyboard
134
+ function onKeydown(e: KeyboardEvent) {
135
+ if (!(e.ctrlKey || e.metaKey) || e.altKey) return
136
+ const target = e.target as HTMLElement | null
137
+ if (target?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])')) return
138
+ const key = e.key.toLowerCase()
139
+ if (key === 'z' && !e.shiftKey) { e.preventDefault(); undo() }
140
+ else if ((key === 'z' && e.shiftKey) || (key === 'y' && e.ctrlKey)) { e.preventDefault(); redo() }
141
+ }
142
+ const keyboard = options.keyboard ?? true
143
+ let listening: EventTarget | null = null
144
+ if (keyboard !== false && typeof window !== 'undefined') {
145
+ const listen = () => {
146
+ listening = keyboard === true ? window : (toValue(keyboard) ?? null)
147
+ listening?.addEventListener('keydown', onKeydown as EventListener)
148
+ }
149
+ // An element ref exists once the component is mounted
150
+ if (keyboard !== true && getCurrentInstance()) onMounted(listen)
151
+ else listen()
152
+ }
153
+ if (getCurrentScope()) {
154
+ onScopeDispose(() => {
155
+ listening?.removeEventListener('keydown', onKeydown as EventListener)
156
+ listening = null
157
+ commit(pending)
158
+ })
159
+ }
160
+
161
+ return {
162
+ run,
163
+ undo,
164
+ redo,
165
+ clear,
166
+ /** Whether there's something to undo / redo */
167
+ canUndo: computed(() => past.value.length > 0),
168
+ canRedo: computed(() => future.value.length > 0),
169
+ }
170
+ }
@@ -6,6 +6,10 @@ export interface RippleOptions {
6
6
  disabled?: boolean
7
7
  /** Any CSS color for the ripple; defaults to the element's text color (`currentColor`). */
8
8
  color?: string
9
+ /** Draw it in this element instead (e.g. the round state layer of a checkbox), clipped to its shape */
10
+ layer?: () => HTMLElement | null | undefined
11
+ /** Grow from the center instead of from the pointer (with `layer`, a selection control's unbounded ripple) */
12
+ centered?: boolean
9
13
  }
10
14
 
11
15
  /** `v-ripple` value: nothing or `true` (on), `false` (off), a CSS color, or an options object. */
@@ -20,9 +24,10 @@ function normalize(value: RippleValue): RippleOptions {
20
24
 
21
25
  // The ripple sits in its own clipping layer (`border-radius: inherit`), so the host only needs to be
22
26
  // positioned, not `overflow: hidden`.
23
- function spawnRipple(host: HTMLElement, event: { clientX: number; clientY: number }, color?: string) {
27
+ function spawnRipple(host: HTMLElement, event: { clientX: number; clientY: number }, color?: string, centered = false) {
24
28
  const rect = host.getBoundingClientRect()
25
29
  const d = Math.max(rect.width, rect.height) * 2
30
+ if (centered) event = { clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2 }
26
31
  const layer = document.createElement('span')
27
32
  layer.className = 'm3-ripple-layer'
28
33
  const el = document.createElement('span')
@@ -41,6 +46,10 @@ interface RippleState {
41
46
 
42
47
  const states = new WeakMap<HTMLElement, RippleState>()
43
48
 
49
+ const NESTED_CONTROLS = 'button, a[href], input, select, textarea, [role="button"], [role="checkbox"], [role="switch"], [contenteditable], [data-no-ripple]'
50
+ // App-wide off switch: `createM3UI({ ripple: false })`, or data-m3-ripple="off" on <html>
51
+ const rippleOff = () => document.documentElement.dataset.m3Ripple === 'off'
52
+
44
53
  /**
45
54
  * The M3 press ripple for any element: `<div v-ripple>`, `v-ripple="false"`, `v-ripple="'#e91e63'"`
46
55
  * or `v-ripple="{ disabled, color }"`. A statically positioned element is made `position: relative`.
@@ -51,11 +60,15 @@ export const vRipple: Directive<HTMLElement, RippleValue> = {
51
60
  const state: RippleState = {
52
61
  options: normalize(binding.value),
53
62
  onPointerDown(e) {
54
- if (state.options.disabled || e.button !== 0) return
63
+ if (state.options.disabled || e.button !== 0 || rippleOff()) return
64
+ // A control inside it (a button in a card, a list row's trailing switch) gets its own press, not this one
65
+ const control = (e.target as Element | null)?.closest?.(NESTED_CONTROLS)
66
+ if (control && control !== el && el.contains(control)) return
67
+ const host = state.options.layer?.() ?? el
55
68
  // Checked on press, not on mount: the element may not be in the document yet when mounted.
56
- const { position } = getComputedStyle(el)
57
- if (!position || position === 'static') el.style.position = 'relative'
58
- spawnRipple(el, e, state.options.color)
69
+ const { position } = getComputedStyle(host)
70
+ if (!position || position === 'static') host.style.position = 'relative'
71
+ spawnRipple(host, e, state.options.color, state.options.centered)
59
72
  },
60
73
  }
61
74
  states.set(el, state)
package/src/index.ts CHANGED
@@ -25,6 +25,8 @@ export { generateScheme, schemeToCss, schemeRoles, seedFromImage, seedFromPixels
25
25
  export type { SchemeVariant, SeedOptions, GeneratedScheme } from './composables/dynamicColor'
26
26
  export { useToast } from './composables/useToast'
27
27
  export type { Toast, ToastVariant, ToastPosition, ToastAction, ToastOptions } from './composables/useToast'
28
+ export { useUndo } from './composables/useUndo'
29
+ export type { UndoableAction, UseUndoOptions } from './composables/useUndo'
28
30
  export { useFieldBg } from './composables/useFieldBg'
29
31
  export { useLocale, defaultLocale } from './composables/useLocale'
30
32
  export type { M3Locale } from './composables/useLocale'
@@ -211,6 +213,16 @@ export { default as MNavigationSuite } from './components/MNavigationSuite.vue'
211
213
  export type { NavigationSuiteItem, NavigationSuiteLayout } from './components/MNavigationSuite.vue'
212
214
  export { default as MListDetail } from './components/MListDetail.vue'
213
215
  export { default as MSupportingPane } from './components/MSupportingPane.vue'
216
+ export { default as MScaffold } from './components/MScaffold.vue'
217
+ export type { ScaffoldSnackbarOptions, ScaffoldSnackbarResult } from './components/MScaffold.vue'
218
+ export { default as MVirtualList } from './components/MVirtualList.vue'
219
+ export { default as MCommentThread } from './components/MCommentThread.vue'
220
+ export type { CommentItem, CommentAuthor } from './components/_commentThread'
221
+ export { default as MReactions } from './components/MReactions.vue'
222
+ export type { Reaction } from './components/MReactions.vue'
223
+ export { default as MAvatarGroup } from './components/MAvatarGroup.vue'
224
+ export type { AvatarGroupItem } from './components/MAvatarGroup.vue'
225
+ export type { PaneAnchor } from './composables/_usePaneResize'
214
226
  export { default as MOverlay } from './components/MOverlay.vue'
215
227
  export { default as MPageProgress } from './components/MPageProgress.vue'
216
228
  export { default as MPagination } from './components/MPagination.vue'
package/src/locales/ar.ts CHANGED
@@ -292,6 +292,22 @@ export const arLocale: M3Locale = {
292
292
  formBuilderCopied: 'تم النسخ',
293
293
  codeCopy: 'نسخ الرمز',
294
294
  codeCopied: 'تم النسخ',
295
+ paneResize: 'تغيير حجم الأجزاء',
296
+ commentPlaceholder: 'أضف تعليقًا…',
297
+ commentReplyTo: 'الرد على {name}…',
298
+ commentReply: 'رد',
299
+ commentEdit: 'تعديل',
300
+ commentDelete: 'حذف',
301
+ commentSave: 'حفظ',
302
+ commentSend: 'إرسال',
303
+ commentEdited: 'معدّل',
304
+ commentActions: 'إجراءات التعليق',
305
+ commentShowReply: 'عرض رد واحد',
306
+ commentShowReplies: 'عرض {count} من الردود',
307
+ commentHideReplies: 'إخفاء الردود',
308
+ reactionAdd: 'إضافة تفاعل',
309
+ reactionCount: '{emoji}: {count}',
310
+ avatarGroupMore: '{count} آخرون',
295
311
  formBuilderSubmitted: 'القيم المرسلة',
296
312
  formBuilderSelectField: 'اختر حقلًا لتحريره',
297
313
  formFieldText: 'نص',
package/src/locales/de.ts CHANGED
@@ -287,6 +287,22 @@ export const deLocale: M3Locale = {
287
287
  formBuilderCopied: 'Kopiert',
288
288
  codeCopy: 'Code kopieren',
289
289
  codeCopied: 'Kopiert',
290
+ paneResize: 'Bereiche anpassen',
291
+ commentPlaceholder: 'Kommentar hinzufügen…',
292
+ commentReplyTo: '{name} antworten…',
293
+ commentReply: 'Antworten',
294
+ commentEdit: 'Bearbeiten',
295
+ commentDelete: 'Löschen',
296
+ commentSave: 'Speichern',
297
+ commentSend: 'Senden',
298
+ commentEdited: 'bearbeitet',
299
+ commentActions: 'Kommentaraktionen',
300
+ commentShowReply: '1 Antwort ansehen',
301
+ commentShowReplies: '{count} Antworten ansehen',
302
+ commentHideReplies: 'Antworten ausblenden',
303
+ reactionAdd: 'Reaktion hinzufügen',
304
+ reactionCount: '{emoji}: {count}',
305
+ avatarGroupMore: '{count} weitere',
290
306
  formBuilderSubmitted: 'Gesendete Werte',
291
307
  formBuilderSelectField: 'Wähle ein Feld zum Bearbeiten',
292
308
  formFieldText: 'Text',
package/src/locales/es.ts CHANGED
@@ -287,6 +287,22 @@ export const esLocale: M3Locale = {
287
287
  formBuilderCopied: 'Copiado',
288
288
  codeCopy: 'Copiar código',
289
289
  codeCopied: 'Copiado',
290
+ paneResize: 'Redimensionar paneles',
291
+ commentPlaceholder: 'Agregá un comentario…',
292
+ commentReplyTo: 'Responder a {name}…',
293
+ commentReply: 'Responder',
294
+ commentEdit: 'Editar',
295
+ commentDelete: 'Eliminar',
296
+ commentSave: 'Guardar',
297
+ commentSend: 'Enviar',
298
+ commentEdited: 'editado',
299
+ commentActions: 'Acciones del comentario',
300
+ commentShowReply: 'Ver 1 respuesta',
301
+ commentShowReplies: 'Ver {count} respuestas',
302
+ commentHideReplies: 'Ocultar respuestas',
303
+ reactionAdd: 'Agregar reacción',
304
+ reactionCount: '{emoji}: {count}',
305
+ avatarGroupMore: '{count} más',
290
306
  formBuilderSubmitted: 'Valores enviados',
291
307
  formBuilderSelectField: 'Elegí un campo para editarlo',
292
308
  formFieldText: 'Texto',
package/src/locales/fr.ts CHANGED
@@ -287,6 +287,22 @@ export const frLocale: M3Locale = {
287
287
  formBuilderCopied: 'Copié',
288
288
  codeCopy: 'Copier le code',
289
289
  codeCopied: 'Copié',
290
+ paneResize: 'Redimensionner les volets',
291
+ commentPlaceholder: 'Ajouter un commentaire…',
292
+ commentReplyTo: 'Répondre à {name}…',
293
+ commentReply: 'Répondre',
294
+ commentEdit: 'Modifier',
295
+ commentDelete: 'Supprimer',
296
+ commentSave: 'Enregistrer',
297
+ commentSend: 'Envoyer',
298
+ commentEdited: 'modifié',
299
+ commentActions: 'Actions du commentaire',
300
+ commentShowReply: 'Voir 1 réponse',
301
+ commentShowReplies: 'Voir {count} réponses',
302
+ commentHideReplies: 'Masquer les réponses',
303
+ reactionAdd: 'Ajouter une réaction',
304
+ reactionCount: '{emoji} : {count}',
305
+ avatarGroupMore: '{count} de plus',
290
306
  formBuilderSubmitted: 'Valeurs envoyées',
291
307
  formBuilderSelectField: 'Sélectionnez un champ pour le modifier',
292
308
  formFieldText: 'Texte',
package/src/locales/ja.ts CHANGED
@@ -287,6 +287,22 @@ export const jaLocale: M3Locale = {
287
287
  formBuilderCopied: 'コピーしました',
288
288
  codeCopy: 'コードをコピー',
289
289
  codeCopied: 'コピーしました',
290
+ paneResize: 'ペインのサイズを変更',
291
+ commentPlaceholder: 'コメントを追加…',
292
+ commentReplyTo: '{name} さんに返信…',
293
+ commentReply: '返信',
294
+ commentEdit: '編集',
295
+ commentDelete: '削除',
296
+ commentSave: '保存',
297
+ commentSend: '送信',
298
+ commentEdited: '編集済み',
299
+ commentActions: 'コメントの操作',
300
+ commentShowReply: '1 件の返信を表示',
301
+ commentShowReplies: '{count} 件の返信を表示',
302
+ commentHideReplies: '返信を非表示',
303
+ reactionAdd: 'リアクションを追加',
304
+ reactionCount: '{emoji}: {count}',
305
+ avatarGroupMore: '他 {count} 人',
290
306
  formBuilderSubmitted: '送信された値',
291
307
  formBuilderSelectField: '編集するフィールドを選択してください',
292
308
  formFieldText: 'テキスト',
package/src/locales/ko.ts CHANGED
@@ -287,6 +287,22 @@ export const koLocale: M3Locale = {
287
287
  formBuilderCopied: '복사됨',
288
288
  codeCopy: '코드 복사',
289
289
  codeCopied: '복사됨',
290
+ paneResize: '창 크기 조절',
291
+ commentPlaceholder: '댓글 추가…',
292
+ commentReplyTo: '{name}님에게 답글…',
293
+ commentReply: '답글',
294
+ commentEdit: '수정',
295
+ commentDelete: '삭제',
296
+ commentSave: '저장',
297
+ commentSend: '보내기',
298
+ commentEdited: '수정됨',
299
+ commentActions: '댓글 작업',
300
+ commentShowReply: '답글 1개 보기',
301
+ commentShowReplies: '답글 {count}개 보기',
302
+ commentHideReplies: '답글 숨기기',
303
+ reactionAdd: '반응 추가',
304
+ reactionCount: '{emoji}: {count}',
305
+ avatarGroupMore: '외 {count}명',
290
306
  formBuilderSubmitted: '제출된 값',
291
307
  formBuilderSelectField: '편집할 필드를 선택하세요',
292
308
  formFieldText: '텍스트',
package/src/locales/pt.ts CHANGED
@@ -287,6 +287,22 @@ export const ptLocale: M3Locale = {
287
287
  formBuilderCopied: 'Copiado',
288
288
  codeCopy: 'Copiar código',
289
289
  codeCopied: 'Copiado',
290
+ paneResize: 'Redimensionar painéis',
291
+ commentPlaceholder: 'Adicione um comentário…',
292
+ commentReplyTo: 'Responder a {name}…',
293
+ commentReply: 'Responder',
294
+ commentEdit: 'Editar',
295
+ commentDelete: 'Excluir',
296
+ commentSave: 'Salvar',
297
+ commentSend: 'Enviar',
298
+ commentEdited: 'editado',
299
+ commentActions: 'Ações do comentário',
300
+ commentShowReply: 'Ver 1 resposta',
301
+ commentShowReplies: 'Ver {count} respostas',
302
+ commentHideReplies: 'Ocultar respostas',
303
+ reactionAdd: 'Adicionar reação',
304
+ reactionCount: '{emoji}: {count}',
305
+ avatarGroupMore: 'Mais {count}',
290
306
  formBuilderSubmitted: 'Valores enviados',
291
307
  formBuilderSelectField: 'Selecione um campo para editá-lo',
292
308
  formFieldText: 'Texto',
package/src/locales/zh.ts CHANGED
@@ -287,6 +287,22 @@ export const zhLocale: M3Locale = {
287
287
  formBuilderCopied: '已复制',
288
288
  codeCopy: '复制代码',
289
289
  codeCopied: '已复制',
290
+ paneResize: '调整窗格大小',
291
+ commentPlaceholder: '添加评论…',
292
+ commentReplyTo: '回复 {name}…',
293
+ commentReply: '回复',
294
+ commentEdit: '编辑',
295
+ commentDelete: '删除',
296
+ commentSave: '保存',
297
+ commentSend: '发送',
298
+ commentEdited: '已编辑',
299
+ commentActions: '评论操作',
300
+ commentShowReply: '查看 1 条回复',
301
+ commentShowReplies: '查看 {count} 条回复',
302
+ commentHideReplies: '隐藏回复',
303
+ reactionAdd: '添加回应',
304
+ reactionCount: '{emoji}:{count}',
305
+ avatarGroupMore: '另外 {count} 位',
290
306
  formBuilderSubmitted: '提交的值',
291
307
  formBuilderSelectField: '选择一个字段进行编辑',
292
308
  formFieldText: '文本',
package/src/plugin.ts CHANGED
@@ -104,6 +104,12 @@ export interface M3UIOptions {
104
104
  * followed by layout either way.
105
105
  */
106
106
  dir?: 'ltr' | 'rtl'
107
+ /**
108
+ * `false` turns off the press ripple everywhere (buttons, chips, cards, list and menu items, selection
109
+ * controls, `v-ripple`), leaving the state layer as the only press feedback. Same as `data-m3-ripple="off"`
110
+ * on `<html>`, which a server-rendered page can set itself.
111
+ */
112
+ ripple?: boolean
107
113
  }
108
114
 
109
115
  function readStored(key: string): string | null {
@@ -144,6 +150,7 @@ export function createM3UI(options: M3UIOptions = {}) {
144
150
  app.directive('click-outside', vClickOutside)
145
151
  app.directive('skeleton', vSkeleton)
146
152
  app.directive('sparkle', vSparkle)
153
+ if (options.ripple === false && typeof document !== 'undefined') document.documentElement.dataset.m3Ripple = 'off'
147
154
  // First: the stored choices below (and those the modules read when they loaded) are this app's own
148
155
  if (typeof window !== 'undefined') setStoragePrefix(options.storagePrefix ?? '')
149
156
  if (options.isHydrating) app.provide(M3_HYDRATING_KEY, options.isHydrating)
@@ -91,6 +91,28 @@
91
91
  --radius-xl-increased: 32px;
92
92
  --radius-xxl: 48px;
93
93
 
94
+ /* Spacing (MeasurementTokens, md.sys.measurement.space*): M3's 8dp scale, space-100 = 8px. Tailwind
95
+ builds every spacing utility from these (p-space-200, gap-space-100, ms-space-300, w-space-600…), on top
96
+ of its own numeric scale, which stays as it is. */
97
+ --spacing-space-0: 0px;
98
+ --spacing-space-25: 2px;
99
+ --spacing-space-50: 4px;
100
+ --spacing-space-75: 6px;
101
+ --spacing-space-100: 8px;
102
+ --spacing-space-125: 10px;
103
+ --spacing-space-150: 12px;
104
+ --spacing-space-175: 14px;
105
+ --spacing-space-200: 16px;
106
+ --spacing-space-250: 20px;
107
+ --spacing-space-300: 24px;
108
+ --spacing-space-400: 32px;
109
+ --spacing-space-450: 36px;
110
+ --spacing-space-500: 40px;
111
+ --spacing-space-600: 48px;
112
+ --spacing-space-700: 56px;
113
+ --spacing-space-800: 64px;
114
+ --spacing-space-900: 72px;
115
+
94
116
  /* Motion (MotionTokens): easings as Tailwind ease-* utilities, durations as variables
95
117
  (duration-(--duration-medium-2), or var(--duration-medium-2) in your own CSS). The springs are in JS:
96
118
  motionSprings / useSpring. */
@@ -127,47 +149,62 @@
127
149
  --shadow-elevation-4: 0px 2px 3px 0px rgb(0 0 0 / 0.3), 0px 6px 10px 4px rgb(0 0 0 / 0.15);
128
150
  --shadow-elevation-5: 0px 4px 4px 0px rgb(0 0 0 / 0.3), 0px 8px 12px 6px rgb(0 0 0 / 0.15);
129
151
 
130
- /* Type scale */
152
+ /* Type scale (TypeScaleTokens 41.1.19: sizes, line heights and tracking; sp → rem at 16px) */
131
153
  --text-display-large: 3.5625rem;
132
154
  --text-display-large--line-height: 4rem;
155
+ --text-display-large--letter-spacing: -0.015625rem;
133
156
  --text-display-medium: 2.8125rem;
134
157
  --text-display-medium--line-height: 3.25rem;
158
+ --text-display-medium--letter-spacing: 0;
135
159
  --text-display-small: 2.25rem;
136
160
  --text-display-small--line-height: 2.75rem;
161
+ --text-display-small--letter-spacing: 0;
137
162
 
138
163
  --text-headline-large: 2rem;
139
164
  --text-headline-large--line-height: 2.5rem;
165
+ --text-headline-large--letter-spacing: 0;
140
166
  --text-headline-medium: 1.75rem;
141
167
  --text-headline-medium--line-height: 2.25rem;
168
+ --text-headline-medium--letter-spacing: 0;
142
169
  --text-headline-small: 1.5rem;
143
170
  --text-headline-small--line-height: 2rem;
171
+ --text-headline-small--letter-spacing: 0;
144
172
 
145
173
  --text-title-large: 1.375rem;
146
174
  --text-title-large--line-height: 1.75rem;
175
+ --text-title-large--letter-spacing: 0;
147
176
  --text-title-medium: 1rem;
148
177
  --text-title-medium--line-height: 1.5rem;
178
+ --text-title-medium--letter-spacing: 0.009375rem;
149
179
  --text-title-small: 0.875rem;
150
180
  --text-title-small--line-height: 1.25rem;
181
+ --text-title-small--letter-spacing: 0.00625rem;
151
182
 
152
183
  --text-body-large: 1rem;
153
184
  --text-body-large--line-height: 1.5rem;
185
+ --text-body-large--letter-spacing: 0.03125rem;
154
186
  --text-body-medium: 0.875rem;
155
187
  --text-body-medium--line-height: 1.25rem;
188
+ --text-body-medium--letter-spacing: 0.015625rem;
156
189
  --text-body-small: 0.75rem;
157
190
  --text-body-small--line-height: 1rem;
191
+ --text-body-small--letter-spacing: 0.025rem;
158
192
 
159
193
  --text-label-large: 0.875rem;
160
194
  --text-label-large--line-height: 1.25rem;
195
+ --text-label-large--letter-spacing: 0.00625rem;
161
196
  --text-label-medium: 0.75rem;
162
197
  --text-label-medium--line-height: 1rem;
198
+ --text-label-medium--letter-spacing: 0.03125rem;
163
199
  --text-label-small: 0.6875rem;
164
200
  --text-label-small--line-height: 1rem;
201
+ --text-label-small--letter-spacing: 0.03125rem;
165
202
 
166
- /* Emphasized type scale (M3 Expressive): the same sizes, heavier, with their own tracking */
203
+ /* Emphasized type scale (M3 Expressive): the same sizes and tracking, heavier */
167
204
  --text-display-large-emphasized: 3.5625rem;
168
205
  --text-display-large-emphasized--line-height: 4rem;
169
206
  --text-display-large-emphasized--font-weight: 500;
170
- --text-display-large-emphasized--letter-spacing: 0;
207
+ --text-display-large-emphasized--letter-spacing: -0.015625rem;
171
208
  --text-display-medium-emphasized: 2.8125rem;
172
209
  --text-display-medium-emphasized--line-height: 3.25rem;
173
210
  --text-display-medium-emphasized--font-weight: 500;
@@ -195,7 +232,7 @@
195
232
  --text-title-medium-emphasized: 1rem;
196
233
  --text-title-medium-emphasized--line-height: 1.5rem;
197
234
  --text-title-medium-emphasized--font-weight: 700;
198
- --text-title-medium-emphasized--letter-spacing: 0.00937rem;
235
+ --text-title-medium-emphasized--letter-spacing: 0.009375rem;
199
236
  --text-title-small-emphasized: 0.875rem;
200
237
  --text-title-small-emphasized--line-height: 1.25rem;
201
238
  --text-title-small-emphasized--font-weight: 700;
@@ -203,11 +240,11 @@
203
240
  --text-body-large-emphasized: 1rem;
204
241
  --text-body-large-emphasized--line-height: 1.5rem;
205
242
  --text-body-large-emphasized--font-weight: 500;
206
- --text-body-large-emphasized--letter-spacing: 0.00937rem;
243
+ --text-body-large-emphasized--letter-spacing: 0.03125rem;
207
244
  --text-body-medium-emphasized: 0.875rem;
208
245
  --text-body-medium-emphasized--line-height: 1.25rem;
209
246
  --text-body-medium-emphasized--font-weight: 500;
210
- --text-body-medium-emphasized--letter-spacing: 0.01562rem;
247
+ --text-body-medium-emphasized--letter-spacing: 0.015625rem;
211
248
  --text-body-small-emphasized: 0.75rem;
212
249
  --text-body-small-emphasized--line-height: 1rem;
213
250
  --text-body-small-emphasized--font-weight: 500;
@@ -1 +0,0 @@
1
- {"version":3,"file":"MButton-LiZRRP4h.js","names":["_withDirectives","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withCtx","_createElementBlock","_Fragment","MSpinner","MIcon","_renderSlot","_unref","MSpinner_default","vRipple","base","MButton_default","defineComponent","NAMED_COLORS","props","__props","tag","computed","isCustomColor","customStyle","isError","ROLE","style","c","disabledContainerClasses","sizeMap","s","sizeClasses","iconSize","spinnerSize","px","shapeClass","variantClasses","err","withDirectives","openBlock","createBlock","resolveDynamicComponent","normalizeClass","normalizeStyle","withCtx","createElementBlock","Fragment","MIcon_default","createCommentVNode","renderSlot","_ctx","unref"],"sources":["../src/components/MButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":"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"}