@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
@@ -13,7 +13,9 @@ const props = withDefaults(defineProps<{
13
13
  modelValue: string | number
14
14
  tabs: Tab[]
15
15
  variant?: 'primary' | 'secondary'
16
- }>(), { variant: 'primary' })
16
+ /** Fixed (default, M3 `TabRow`): tabs evenly share the available width, no scrolling — use for 2-5 tabs. Scrollable (M3 `ScrollableTabRow`): tabs keep their natural width and the row scrolls horizontally when they overflow — use for many tabs. */
17
+ scrollable?: boolean
18
+ }>(), { variant: 'primary', scrollable: false })
17
19
 
18
20
  const emit = defineEmits<{ 'update:modelValue': [string | number] }>()
19
21
 
@@ -120,15 +122,16 @@ function select(tab: Tab) {
120
122
  <template>
121
123
  <!-- ── Primary: sliding short indicator with stretch ──────────────── -->
122
124
  <div v-if="variant === 'primary'" class="border-b border-outline-variant">
123
- <div class="relative flex overflow-x-auto" style="scrollbar-width: none">
125
+ <div class="relative flex" :class="scrollable ? 'overflow-x-auto' : 'overflow-x-hidden'" style="scrollbar-width: none">
124
126
  <button
125
127
  v-for="tab in tabs"
126
128
  :key="tab.value"
127
129
  :ref="(el) => { if (el) tabEls[tabs.indexOf(tab)] = el as HTMLElement }"
128
130
  type="button"
129
- class="relative flex shrink-0 flex-col items-center justify-center gap-1 px-6 text-label-large transition-colors duration-150 focus-visible:outline-none"
131
+ class="relative flex flex-col items-center justify-center gap-1 px-6 text-title-small transition-colors duration-150 focus-visible:outline-none"
130
132
  :class="[
131
- tab.icon ? 'h-14 pb-1.5' : 'h-12 pb-1.5',
133
+ scrollable ? 'shrink-0' : 'flex-1 min-w-0',
134
+ tab.icon ? 'h-16 pb-1.5' : 'h-12 pb-1.5',
132
135
  tab.value === modelValue
133
136
  ? 'text-primary'
134
137
  : tab.disabled
@@ -138,7 +141,7 @@ function select(tab: Tab) {
138
141
  :disabled="tab.disabled"
139
142
  @click="select(tab)"
140
143
  >
141
- <MIcon v-if="tab.icon" :name="tab.icon" :size="20" />
144
+ <MIcon v-if="tab.icon" :name="tab.icon" :size="24" />
142
145
  <span>{{ tab.label }}</span>
143
146
  </button>
144
147
  <div
@@ -150,28 +153,29 @@ function select(tab: Tab) {
150
153
 
151
154
  <!-- ── Secondary: full-width underline indicator ─────────────────── -->
152
155
  <div v-else class="border-b border-outline-variant">
153
- <div class="relative flex overflow-x-auto" style="scrollbar-width: none">
156
+ <div class="relative flex" :class="scrollable ? 'overflow-x-auto' : 'overflow-x-hidden'" style="scrollbar-width: none">
154
157
  <button
155
158
  v-for="tab in tabs"
156
159
  :key="tab.value"
157
160
  :ref="(el) => { if (el) tabEls[tabs.indexOf(tab)] = el as HTMLElement }"
158
161
  type="button"
159
- class="relative flex h-12 shrink-0 items-center justify-center gap-2 px-6 text-label-large transition-colors duration-150 focus-visible:outline-none"
160
- :class="
162
+ class="relative flex h-12 items-center justify-center gap-2 px-6 text-title-small transition-colors duration-150 focus-visible:outline-none"
163
+ :class="[
164
+ scrollable ? 'shrink-0' : 'flex-1 min-w-0',
161
165
  tab.value === modelValue
162
166
  ? 'text-on-surface'
163
167
  : tab.disabled
164
168
  ? 'cursor-not-allowed text-on-surface/38'
165
- : 'cursor-pointer text-on-surface-variant hover:text-on-surface'
166
- "
169
+ : 'cursor-pointer text-on-surface-variant hover:text-on-surface',
170
+ ]"
167
171
  :disabled="tab.disabled"
168
172
  @click="select(tab)"
169
173
  >
170
- <MIcon v-if="tab.icon" :name="tab.icon" :size="18" />
174
+ <MIcon v-if="tab.icon" :name="tab.icon" :size="24" />
171
175
  {{ tab.label }}
172
176
  </button>
173
177
  <div
174
- class="absolute bottom-0 h-[2px] bg-primary"
178
+ class="absolute bottom-0 h-[3px] bg-primary"
175
179
  :style="{ left: `${indicatorLeft}px`, width: `${indicatorWidth}px` }"
176
180
  />
177
181
  </div>
@@ -116,29 +116,30 @@ function focusInput() {
116
116
 
117
117
  const triggerClasses = computed(() => {
118
118
  const base = [
119
- 'flex min-h-[56px] w-full cursor-text items-center gap-1.5 flex-wrap',
119
+ 'flex min-h-[56px] w-full items-center gap-1.5 flex-wrap',
120
120
  'transition-[border-color,border-width] duration-150',
121
+ props.disabled ? 'cursor-not-allowed' : 'cursor-text',
121
122
  props.leadingIcon ? 'pl-12 pr-10' : 'pl-4 pr-10',
122
123
  ]
123
124
 
124
125
  if (props.variant === 'outlined') {
125
- return [
126
- ...base,
127
- 'rounded-sm border bg-transparent py-2',
128
- focused.value
126
+ const border = props.disabled
127
+ ? 'border-on-surface/12'
128
+ : focused.value
129
129
  ? (props.error ? 'border-2 border-error' : 'border-2 border-primary')
130
- : (props.error ? 'border-error' : 'border-outline hover:border-on-surface'),
131
- ].join(' ')
130
+ : (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
131
+ return [...base, 'rounded-xs border bg-transparent py-2', border].join(' ')
132
132
  }
133
133
 
134
- return [
135
- ...base,
136
- 'rounded-t-sm bg-surface-container-highest border-b pb-2',
137
- hasValue.value || focused.value ? 'pt-7' : 'pt-4',
138
- focused.value
134
+ const border = props.disabled
135
+ ? 'border-on-surface/38'
136
+ : focused.value
139
137
  ? (props.error ? 'border-b-2 border-error' : 'border-b-2 border-primary')
140
- : (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface'),
141
- ].join(' ')
138
+ : (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface')
139
+ const bg = props.disabled
140
+ ? 'bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]'
141
+ : 'bg-surface-container-highest'
142
+ return [...base, 'rounded-t-xs border-b pb-2', hasValue.value || focused.value ? 'pt-7' : 'pt-4', bg, border].join(' ')
142
143
  })
143
144
 
144
145
  const labelClasses = computed(() => {
@@ -159,9 +160,11 @@ const labelClasses = computed(() => {
159
160
  'pointer-events-none absolute right-10 truncate transition-all duration-200',
160
161
  left,
161
162
  active ? floated : unFloated,
162
- focused.value
163
- ? (props.error ? 'text-error' : 'text-primary')
164
- : (props.error ? 'text-error' : 'text-on-surface-variant'),
163
+ props.disabled
164
+ ? 'text-on-surface/38'
165
+ : focused.value
166
+ ? (props.error ? 'text-error' : 'text-primary')
167
+ : (props.error ? 'text-error' : 'text-on-surface-variant'),
165
168
  ].join(' ')
166
169
  })
167
170
  </script>
@@ -176,10 +179,13 @@ const labelClasses = computed(() => {
176
179
  >
177
180
  <div
178
181
  v-if="leadingIcon"
179
- class="pointer-events-none absolute left-3.5 text-on-surface-variant"
180
- :class="variant === 'filled' ? 'top-5' : 'top-4.5'"
182
+ class="pointer-events-none absolute left-3.5"
183
+ :class="[
184
+ variant === 'filled' ? 'top-4.5' : 'top-4',
185
+ disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
186
+ ]"
181
187
  >
182
- <MIcon :name="leadingIcon" :size="20" />
188
+ <MIcon :name="leadingIcon" :size="24" />
183
189
  </div>
184
190
 
185
191
  <!-- Trigger field -->
@@ -191,7 +197,8 @@ const labelClasses = computed(() => {
191
197
  <span
192
198
  v-for="(tag, i) in modelValue"
193
199
  :key="i"
194
- class="inline-flex items-center gap-1 rounded-full bg-secondary-container px-2 py-0.5 text-label-small text-on-secondary-container"
200
+ class="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-label-small"
201
+ :class="disabled ? 'bg-on-surface/12 text-on-surface/38' : 'bg-secondary-container text-on-secondary-container'"
195
202
  >
196
203
  {{ tag }}
197
204
  <button
@@ -210,7 +217,11 @@ const labelClasses = computed(() => {
210
217
  type="text"
211
218
  enterkeyhint="done"
212
219
  autocomplete="off"
213
- class="min-w-[60px] flex-1 bg-transparent text-body-large text-on-surface outline-none placeholder:text-on-surface-variant"
220
+ :class="[
221
+ 'min-w-[60px] flex-1 bg-transparent text-body-large outline-none placeholder:text-on-surface-variant',
222
+ error ? 'caret-error' : 'caret-primary',
223
+ disabled ? 'text-on-surface/38' : 'text-on-surface',
224
+ ]"
214
225
  :placeholder="!hasValue && (!label || focused) ? placeholder : ''"
215
226
  :disabled="disabled"
216
227
  :readonly="!canAddMore"
@@ -52,7 +52,8 @@ const inputClasses = computed(() => {
52
52
  const base = [
53
53
  "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
54
54
  "transition-[border-color,border-width] duration-150",
55
- "disabled:cursor-not-allowed disabled:opacity-[0.38]",
55
+ "disabled:cursor-not-allowed disabled:text-on-surface/38",
56
+ props.error ? "caret-error" : "caret-primary",
56
57
  size,
57
58
  pl,
58
59
  pr,
@@ -61,19 +62,21 @@ const inputClasses = computed(() => {
61
62
  if (props.variant === "outlined") {
62
63
  return [
63
64
  ...base,
64
- "rounded-sm border bg-transparent py-4",
65
+ "rounded-xs border bg-transparent py-4",
65
66
  props.error
66
67
  ? "border-error focus:border-2 focus:border-error"
67
68
  : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
69
+ "disabled:border-on-surface/12",
68
70
  ].join(" ");
69
71
  }
70
72
 
71
73
  return [
72
74
  ...base,
73
- "rounded-t-sm bg-surface-container-highest border-b pt-6 pb-2",
75
+ "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
74
76
  props.error
75
77
  ? "border-error focus:border-b-2 focus:border-error"
76
78
  : "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary",
79
+ "disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]",
77
80
  ].join(" ");
78
81
  });
79
82
 
@@ -106,6 +109,7 @@ const labelClasses = computed(() => {
106
109
  props.error
107
110
  ? "text-error peer-focus:text-error"
108
111
  : "text-on-surface-variant peer-focus:text-primary",
112
+ "peer-disabled:text-on-surface/38",
109
113
  ].join(" ");
110
114
  }
111
115
 
@@ -117,6 +121,7 @@ const labelClasses = computed(() => {
117
121
  props.error
118
122
  ? "text-error peer-focus:text-error"
119
123
  : "text-on-surface-variant peer-focus:text-primary",
124
+ "peer-disabled:text-on-surface/38",
120
125
  ].join(" ");
121
126
  });
122
127
 
@@ -142,10 +147,13 @@ function onInput(event: Event) {
142
147
  >
143
148
  <div
144
149
  v-if="leadingIcon"
145
- class="pointer-events-none absolute left-3.5 text-on-surface-variant"
146
- :class="multiline ? 'top-[55%] -translate-y-1/2' : variant === 'filled' ? 'top-5' : 'top-4.5'"
150
+ class="pointer-events-none absolute left-3.5"
151
+ :class="[
152
+ multiline ? 'top-[55%] -translate-y-1/2' : variant === 'filled' ? 'top-4.5' : 'top-4',
153
+ disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
154
+ ]"
147
155
  >
148
- <MIcon :name="leadingIcon" :size="20" />
156
+ <MIcon :name="leadingIcon" :size="24" />
149
157
  </div>
150
158
 
151
159
  <textarea
@@ -121,18 +121,18 @@ onUnmounted(() => {
121
121
  <div ref="triggerEl" class="relative mt-2" :style="{ '--field-bg': resolvedFieldBg }">
122
122
  <button
123
123
  type="button"
124
- class="flex h-14 w-full items-center gap-2 rounded-sm border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
124
+ class="flex h-14 w-full items-center gap-2 rounded-xs border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
125
125
  :class="[
126
- disabled ? 'pointer-events-none opacity-[0.38]' : 'cursor-pointer',
127
- open
126
+ disabled ? 'pointer-events-none cursor-not-allowed border-on-surface/12' : 'cursor-pointer',
127
+ !disabled && (open
128
128
  ? error ? 'border-2 border-error' : 'border-2 border-primary'
129
- : error ? 'border-error' : 'border-outline hover:border-on-surface',
129
+ : error ? 'border-error' : 'border-outline hover:border-on-surface'),
130
130
  ]"
131
131
  @click="!disabled && (open = !open)"
132
132
  >
133
- <MIcon name="schedule" :size="20" class="shrink-0 text-on-surface-variant" />
134
- <span v-if="displayValue" class="flex-1 font-mono text-on-surface">{{ displayValue }}</span>
135
- <span v-else class="flex-1 text-on-surface-variant">{{ label || placeholder || locale.selectTime }}</span>
133
+ <MIcon name="schedule" :size="24" class="shrink-0" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'" />
134
+ <span v-if="displayValue" class="flex-1 font-mono" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ displayValue }}</span>
135
+ <span v-else class="flex-1" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'">{{ label || placeholder || locale.selectTime }}</span>
136
136
  <MIcon
137
137
  v-if="modelValue"
138
138
  name="close"
@@ -144,7 +144,7 @@ onUnmounted(() => {
144
144
  <label
145
145
  v-if="label"
146
146
  class="pointer-events-none absolute -top-2.5 left-3 bg-(--field-bg) px-1 text-label-small transition-colors"
147
- :class="open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
147
+ :class="disabled ? 'text-on-surface/38' : open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
148
148
  >
149
149
  {{ label }}
150
150
  </label>
@@ -163,7 +163,7 @@ onUnmounted(() => {
163
163
  <div
164
164
  v-if="open"
165
165
  ref="panelEl"
166
- class="fixed z-500 w-[280px] rounded-lg bg-surface-container shadow-elevation-3"
166
+ class="fixed z-500 w-[280px] rounded-[28px] bg-surface-container-high shadow-elevation-3"
167
167
  :style="dropPos"
168
168
  >
169
169
  <!-- Display -->
@@ -65,7 +65,7 @@ const SIZE = 256
65
65
  const CX = SIZE / 2
66
66
  const OUTER_R = 100
67
67
  const INNER_R = 64
68
- const NUM_R = 20
68
+ const NUM_R = 24
69
69
 
70
70
  function posAt(idx: number, of: number, r: number) {
71
71
  const a = (idx / of) * Math.PI * 2 - Math.PI / 2
@@ -237,7 +237,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
237
237
  <Transition name="m3-tp-modal">
238
238
  <div
239
239
  v-if="show"
240
- class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/40 p-4"
240
+ class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
241
241
  @click.self="cancel"
242
242
  >
243
243
  <div class="tp-box w-[328px] rounded-[28px] bg-surface-container-high px-6 pt-6 pb-4 shadow-elevation-3">
@@ -252,7 +252,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
252
252
  <div class="mb-5 flex items-center justify-center gap-2">
253
253
  <button
254
254
  type="button"
255
- class="flex h-[72px] min-w-[96px] items-center justify-center rounded-lg text-display-medium transition-colors"
255
+ class="flex h-20 min-w-[96px] items-center justify-center rounded-sm text-display-large transition-colors"
256
256
  :class="
257
257
  step === 'hour'
258
258
  ? 'bg-primary-container text-on-primary-container'
@@ -263,11 +263,11 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
263
263
  {{ pad(selectedHour) }}
264
264
  </button>
265
265
 
266
- <span class="text-display-medium text-on-surface">:</span>
266
+ <span class="text-display-large text-on-surface">:</span>
267
267
 
268
268
  <button
269
269
  type="button"
270
- class="flex h-[72px] min-w-[96px] items-center justify-center rounded-lg text-display-medium transition-colors"
270
+ class="flex h-20 min-w-[96px] items-center justify-center rounded-sm text-display-large transition-colors"
271
271
  :class="
272
272
  step === 'minute'
273
273
  ? 'bg-primary-container text-on-primary-container'
@@ -281,11 +281,11 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
281
281
  <!-- AM / PM toggle -->
282
282
  <div
283
283
  v-if="!use24h"
284
- class="ml-2 flex h-[72px] flex-col overflow-hidden rounded-lg border border-outline"
284
+ class="ml-2 flex h-20 flex-col overflow-hidden rounded-sm border border-outline"
285
285
  >
286
286
  <button
287
287
  type="button"
288
- class="flex flex-1 items-center justify-center px-3 text-label-large transition-colors"
288
+ class="flex flex-1 items-center justify-center px-3 text-title-medium transition-colors"
289
289
  :class="
290
290
  period === 'AM'
291
291
  ? 'bg-tertiary-container text-on-tertiary-container'
@@ -296,7 +296,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
296
296
  <div class="h-px bg-outline" />
297
297
  <button
298
298
  type="button"
299
- class="flex flex-1 items-center justify-center px-3 text-label-large transition-colors"
299
+ class="flex flex-1 items-center justify-center px-3 text-title-medium transition-colors"
300
300
  :class="
301
301
  period === 'PM'
302
302
  ? 'bg-tertiary-container text-on-tertiary-container'
@@ -331,7 +331,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
331
331
  v-for="item in hourItems"
332
332
  :key="'h' + item.value"
333
333
  type="button"
334
- class="pointer-events-auto absolute flex h-10 w-10 items-center justify-center rounded-full text-body-medium transition-colors"
334
+ class="pointer-events-auto absolute flex h-10 w-10 items-center justify-center rounded-full text-body-large transition-colors"
335
335
  :class="
336
336
  item.value === selectedHour
337
337
  ? 'text-on-primary font-medium'
@@ -353,7 +353,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
353
353
  v-for="item in minuteItems"
354
354
  :key="'m' + item.value"
355
355
  type="button"
356
- class="pointer-events-auto absolute flex h-10 w-10 items-center justify-center rounded-full text-body-medium transition-colors"
356
+ class="pointer-events-auto absolute flex h-10 w-10 items-center justify-center rounded-full text-body-large transition-colors"
357
357
  :class="
358
358
  item.value === selectedMinute
359
359
  ? 'text-on-primary font-medium'
@@ -379,26 +379,26 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
379
379
  v-model="inputHour"
380
380
  type="text"
381
381
  maxlength="2"
382
- class="h-[72px] w-[96px] rounded-lg border border-outline bg-surface-container-highest text-center text-display-medium text-on-surface outline-none transition-colors focus:border-2 focus:border-primary"
382
+ class="h-20 w-[96px] rounded-sm border border-outline bg-surface-container-highest text-center text-display-large text-on-surface outline-none transition-colors focus:border-2 focus:border-primary"
383
383
  @blur="clampInput"
384
384
  />
385
- <span class="text-display-medium text-on-surface">:</span>
385
+ <span class="text-display-large text-on-surface">:</span>
386
386
  <input
387
387
  ref="inputMinuteEl"
388
388
  v-model="inputMinute"
389
389
  type="text"
390
390
  maxlength="2"
391
- class="h-[72px] w-[96px] rounded-lg border border-outline bg-surface-container-highest text-center text-display-medium text-on-surface outline-none transition-colors focus:border-2 focus:border-primary"
391
+ class="h-20 w-[96px] rounded-sm border border-outline bg-surface-container-highest text-center text-display-large text-on-surface outline-none transition-colors focus:border-2 focus:border-primary"
392
392
  @blur="clampInput"
393
393
  />
394
394
  <!-- AM / PM toggle -->
395
395
  <div
396
396
  v-if="!use24h"
397
- class="ml-2 flex h-[72px] flex-col overflow-hidden rounded-lg border border-outline"
397
+ class="ml-2 flex h-20 flex-col overflow-hidden rounded-sm border border-outline"
398
398
  >
399
399
  <button
400
400
  type="button"
401
- class="flex flex-1 items-center justify-center px-3 text-label-large transition-colors"
401
+ class="flex flex-1 items-center justify-center px-3 text-title-medium transition-colors"
402
402
  :class="
403
403
  period === 'AM'
404
404
  ? 'bg-tertiary-container text-on-tertiary-container'
@@ -409,7 +409,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
409
409
  <div class="h-px bg-outline" />
410
410
  <button
411
411
  type="button"
412
- class="flex flex-1 items-center justify-center px-3 text-label-large transition-colors"
412
+ class="flex flex-1 items-center justify-center px-3 text-title-medium transition-colors"
413
413
  :class="
414
414
  period === 'PM'
415
415
  ? 'bg-tertiary-container text-on-tertiary-container'
@@ -0,0 +1,188 @@
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
3
+ import MIcon from './MIcon.vue'
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ /** Whether the toggle button is checked/selected — v-model. */
8
+ checked: boolean
9
+ variant?: 'filled' | 'tonal' | 'outlined' | 'elevated'
10
+ disabled?: boolean
11
+ icon?: string
12
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
13
+ }>(),
14
+ {
15
+ variant: 'filled',
16
+ disabled: false,
17
+ size: 'sm',
18
+ },
19
+ )
20
+
21
+ const emit = defineEmits<{ 'update:checked': [boolean] }>()
22
+
23
+ // Same 5-tier expressive sizing as MButton — ToggleButton.kt reuses the exact same
24
+ // Button{XSmall,Small,Medium,Large,XLarge}Tokens (ContainerHeight/IconSize/IconLabelSpace all
25
+ // verbatim identical), confirmed against the real source rather than assumed. Padding is
26
+ // deliberately reused from MButton's own (already-audited) px values rather than porting
27
+ // ToggleButtonDefaults' own separate ToggleButtonStartPadding/EndPadding constants, which
28
+ // resolve to the same pixel values at every tier this library implements.
29
+ // pillRadius is each tier's exact half-height (32/40/56/96/136 ÷ 2), not an arbitrarily huge
30
+ // stand-in like 9999 — CSS clamps border-radius at 50% of the box's smaller dimension anyway,
31
+ // so anything past that is wasted, invisible spring travel. With 9999 as the target, unchecking
32
+ // (small radius → 9999) spent its entire *visible* range right at the start of the trajectory,
33
+ // exactly where a spring aimed at something 9987px away is accelerating hardest — it blew
34
+ // through the visible range in a couple of frames and looked like a snap instead of a spring.
35
+ // Checking happened to look fine only because its visible range fell in the spring's slow,
36
+ // already-decelerating tail. Using the real clamp value makes the whole trajectory visible and
37
+ // symmetric in both directions.
38
+ const sizeMap = {
39
+ xs: { h: 'h-8', text: 'text-label-large', icon: 20, gap: 'gap-1', px: 'px-3', checkedRadius: 12, pressedRadius: 8, pillRadius: 16 },
40
+ sm: { h: 'h-10', text: 'text-label-large', icon: 20, gap: 'gap-2', px: 'px-4', checkedRadius: 12, pressedRadius: 6, pillRadius: 20 },
41
+ md: { h: 'h-14', text: 'text-title-medium', icon: 24, gap: 'gap-2', px: 'px-6', checkedRadius: 16, pressedRadius: 12, pillRadius: 28 },
42
+ lg: { h: 'h-24', text: 'text-headline-small', icon: 32, gap: 'gap-3', px: 'px-12', checkedRadius: 28, pressedRadius: 16, pillRadius: 48 },
43
+ xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, gap: 'gap-4', px: 'px-16', checkedRadius: 28, pressedRadius: 16, pillRadius: 68 },
44
+ }
45
+
46
+ const s = computed(() => sizeMap[props.size] ?? sizeMap.sm)
47
+ const sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap} ${s.value.px}`)
48
+
49
+ const base =
50
+ 'relative inline-flex items-center justify-center font-medium ' +
51
+ 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +
52
+ 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +
53
+ "before:content-[''] before:pointer-events-none before:absolute before:inset-0 " +
54
+ 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +
55
+ 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'
56
+
57
+ // FilledButtonTokens/TonalButtonTokens/ElevatedButtonTokens/OutlinedButtonTokens: unchecked
58
+ // containers are neutral (SurfaceContainer / SecondaryContainer / SurfaceContainerLow /
59
+ // transparent-with-border), NOT the same tone the checked state uses — despite the class doc
60
+ // comment loosely saying it "switches between primary and tonal colors", the actual unchecked
61
+ // token for the filled variant is SurfaceContainer, not a tonal color at all. Checked outlined
62
+ // is the odd one out: it fills solid with InverseSurface/InverseOnSurface, not Primary.
63
+ const containerClasses = computed(() => {
64
+ switch (props.variant) {
65
+ case 'filled':
66
+ return props.checked
67
+ ? 'bg-primary text-on-primary'
68
+ : 'bg-surface-container text-on-surface-variant'
69
+ case 'tonal':
70
+ return props.checked
71
+ ? 'bg-secondary text-on-secondary'
72
+ : 'bg-secondary-container text-on-secondary-container'
73
+ case 'elevated':
74
+ return props.checked
75
+ ? 'bg-primary text-on-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'
76
+ : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'
77
+ case 'outlined':
78
+ return props.checked
79
+ ? 'bg-inverse-surface text-inverse-on-surface'
80
+ : 'border border-outline-variant text-on-surface-variant'
81
+ default:
82
+ return ''
83
+ }
84
+ })
85
+
86
+ // DisabledContainerOpacity = 0.1 across every variant's tokens. OutlinedButtonTokens has no
87
+ // container color at all when unchecked (border-only), so its disabled treatment dims the
88
+ // border instead — same distinction MButton's own outlined variant already makes.
89
+ const disabledContainerClasses = computed(() => {
90
+ if (props.variant === 'outlined' && !props.checked) return 'disabled:border-outline-variant/10'
91
+ return 'disabled:bg-on-surface/10'
92
+ })
93
+
94
+ const rootEl = ref<HTMLElement | null>(null)
95
+ const pressed = ref(false)
96
+
97
+ function onPointerDown(e: PointerEvent) {
98
+ if (props.disabled) return
99
+ pressed.value = true
100
+ createRipple(e)
101
+ }
102
+ function onPointerUp() { pressed.value = false }
103
+
104
+ function createRipple(event: PointerEvent) {
105
+ const button = event.currentTarget as HTMLElement
106
+ const rect = button.getBoundingClientRect()
107
+ const d = Math.max(rect.width, rect.height) * 2
108
+ const el = document.createElement('span')
109
+ el.className = 'm3-ripple'
110
+ el.style.cssText = `width:${d}px;height:${d}px;top:${event.clientY - rect.top - d / 2}px;left:${event.clientX - rect.left - d / 2}px`
111
+ button.appendChild(el)
112
+ el.addEventListener('animationend', () => el.remove(), { once: true })
113
+ }
114
+
115
+ function toggle() {
116
+ if (props.disabled) return
117
+ emit('update:checked', !props.checked)
118
+ }
119
+
120
+ // Real per-frame spring, not a CSS transition — matches this library's established convention
121
+ // (MShape, MProgressBar, MTabs, etc.) for anything the real M3 source drives with an actual
122
+ // spring. ToggleButton.kt isn't gated behind @ExperimentalMaterial3ExpressiveApi (it's a stable,
123
+ // non-experimental composable despite belonging to the Expressive redesign), so its shape-morph
124
+ // spec is MotionSchemeKeyTokens.FastSpatial resolved from the *Standard* scheme: dampingRatio
125
+ // 0.9, stiffness 1400. damping = 2 × dampingRatio × √stiffness ≈ 67.5.
126
+ const STIFFNESS = 1400
127
+ const DAMPING = 2 * 0.9 * Math.sqrt(STIFFNESS)
128
+
129
+ const targetRadius = computed(() => {
130
+ if (pressed.value) return s.value.pressedRadius
131
+ return props.checked ? s.value.checkedRadius : s.value.pillRadius
132
+ })
133
+
134
+ let currentRadius = targetRadius.value
135
+ let velocity = 0
136
+ let rafId = 0
137
+
138
+ function applyRadius() {
139
+ if (rootEl.value) rootEl.value.style.borderRadius = `${currentRadius}px`
140
+ }
141
+
142
+ function animate() {
143
+ if (rafId) return
144
+ let last = performance.now()
145
+ const step = (now: number) => {
146
+ const dt = Math.min((now - last) / 1000, 1 / 30)
147
+ last = now
148
+ const target = targetRadius.value
149
+ const force = STIFFNESS * (target - currentRadius)
150
+ const friction = DAMPING * velocity
151
+ velocity += (force - friction) * dt
152
+ currentRadius += velocity * dt
153
+ if (Math.abs(target - currentRadius) < 0.1 && Math.abs(velocity) < 0.1) {
154
+ currentRadius = target
155
+ velocity = 0
156
+ applyRadius()
157
+ rafId = 0
158
+ return
159
+ }
160
+ applyRadius()
161
+ rafId = requestAnimationFrame(step)
162
+ }
163
+ rafId = requestAnimationFrame(step)
164
+ }
165
+
166
+ watch(targetRadius, animate)
167
+ onMounted(applyRadius)
168
+ onUnmounted(() => cancelAnimationFrame(rafId))
169
+ </script>
170
+
171
+ <template>
172
+ <button
173
+ ref="rootEl"
174
+ type="button"
175
+ role="button"
176
+ :aria-pressed="checked"
177
+ :disabled="disabled"
178
+ :class="[base, sizeClasses, containerClasses, disabledContainerClasses]"
179
+ @pointerdown="onPointerDown"
180
+ @pointerup="onPointerUp"
181
+ @pointerleave="onPointerUp"
182
+ @pointercancel="onPointerUp"
183
+ @click="toggle"
184
+ >
185
+ <MIcon v-if="icon" :name="icon" :size="s.icon" />
186
+ <slot />
187
+ </button>
188
+ </template>
@@ -56,12 +56,14 @@ const isVertical = computed(() => props.orientation === 'vertical')
56
56
  <div
57
57
  class="flex items-center gap-1"
58
58
  :class="[
59
- isVertical ? 'flex-col py-3 px-2' : 'flex-row px-3 py-2',
59
+ isVertical ? 'flex-col w-16' : 'flex-row h-16',
60
+ isVertical ? (variant === 'floating' ? 'py-2' : 'py-4') : (variant === 'floating' ? 'px-2' : 'px-4'),
60
61
  alignClass,
61
62
  colorClasses,
62
- variant === 'floating' ? 'rounded-2xl shadow-elevation-2' : '',
63
+ variant === 'floating' ? 'rounded-full' : '',
64
+ variant === 'floating' && fabPosition !== 'none' ? 'shadow-elevation-1' : '',
63
65
  variant === 'docked' ? 'w-full border-t border-outline-variant' : '',
64
- variant === 'docked' && isVertical ? 'h-full w-auto border-t-0 border-r border-outline-variant' : '',
66
+ variant === 'docked' && isVertical ? 'h-full w-16 border-t-0 border-r border-outline-variant' : '',
65
67
  ]"
66
68
  >
67
69
  <slot />
@@ -60,7 +60,7 @@ function reposition() {
60
60
  if (!triggerEl.value || !tipEl.value) return
61
61
  const tr = triggerEl.value.getBoundingClientRect()
62
62
  const tt = tipEl.value.getBoundingClientRect()
63
- const GAP = 8
63
+ const GAP = 4
64
64
 
65
65
  let top = 0, left = 0
66
66
  switch (props.placement) {
@@ -107,7 +107,7 @@ onUnmounted(() => {
107
107
  <div
108
108
  v-if="visible && !rich && text"
109
109
  ref="tipEl"
110
- class="pointer-events-none fixed z-400 max-w-[220px] rounded bg-inverse-surface px-3 py-1.5 text-label-medium text-inverse-on-surface shadow-elevation-2"
110
+ class="pointer-events-none fixed z-400 min-h-6 min-w-10 max-w-[200px] rounded bg-inverse-surface px-2 py-1 text-body-small text-inverse-on-surface"
111
111
  :style="tipStyle"
112
112
  role="tooltip"
113
113
  >
@@ -118,13 +118,13 @@ onUnmounted(() => {
118
118
  <div
119
119
  v-else-if="visible && rich"
120
120
  ref="tipEl"
121
- class="fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-3 ring-1 ring-outline-variant"
121
+ class="fixed z-400 max-w-[320px] rounded-xl bg-surface-container shadow-elevation-2"
122
122
  :style="tipStyle"
123
123
  role="tooltip"
124
124
  @mouseenter="onTipEnter"
125
125
  @mouseleave="onTipLeave"
126
126
  >
127
- <div v-if="text" class="px-4 pt-3 pb-1 text-title-small font-medium text-on-surface">
127
+ <div v-if="text" class="px-4 pt-3 pb-1 text-title-small font-medium text-on-surface-variant">
128
128
  {{ text }}
129
129
  </div>
130
130
  <div class="px-4 py-2 text-body-medium text-on-surface-variant">