@m3ui-vue/m3ui-vue 0.7.0 → 0.8.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 (92) hide show
  1. package/README.md +5 -5
  2. package/dist/{MMenuItem-B_5um6tj.js → MMenuItem-vSLbJGqe.js} +314 -230
  3. package/dist/MMenuItem-vSLbJGqe.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/MCard.vue.d.ts +2 -0
  8. package/dist/components/MChatBubble.vue.d.ts +0 -1
  9. package/dist/components/MCheckbox.vue.d.ts +2 -0
  10. package/dist/components/MCircleProgressBar.vue.d.ts +0 -1
  11. package/dist/components/MCodeEditor.vue.d.ts +1 -1
  12. package/dist/components/MConfirmDialog.vue.d.ts +3 -0
  13. package/dist/components/MDialog.vue.d.ts +23 -7
  14. package/dist/components/MFab.vue.d.ts +2 -2
  15. package/dist/components/MListItem.vue.d.ts +11 -6
  16. package/dist/components/MNavigationRail.vue.d.ts +17 -1
  17. package/dist/components/MSelect.vue.d.ts +1 -0
  18. package/dist/components/MSwitch.vue.d.ts +10 -0
  19. package/dist/components/MTabs.vue.d.ts +3 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/m3ui-vue.css +1 -1
  22. package/dist/m3ui.js +2393 -2005
  23. package/dist/m3ui.js.map +1 -1
  24. package/dist/rich-text-editor.js +1 -1
  25. package/dist/styles/palettes.css +659 -0
  26. package/dist/styles/theme.css +2 -0
  27. package/dist/styles.css +1 -1
  28. package/package.json +13 -1
  29. package/src/__tests__/useColorPalette.test.ts +2 -2
  30. package/src/code-editor.ts +1 -0
  31. package/src/components/MAutocomplete.vue +35 -26
  32. package/src/components/MBadge.vue +1 -1
  33. package/src/components/MBottomSheet.vue +4 -4
  34. package/src/components/MButton.vue +48 -15
  35. package/src/components/MButtonGroup.vue +2 -2
  36. package/src/components/MCard.vue +83 -9
  37. package/src/components/MChatBubble.vue +0 -1
  38. package/src/components/MCheckbox.vue +78 -18
  39. package/src/components/MChip.vue +33 -4
  40. package/src/components/MCircleProgressBar.vue +7 -4
  41. package/src/components/MCodeEditor.vue +54 -8
  42. package/src/components/MColorPicker.vue +9 -8
  43. package/src/components/MColorPickerModal.vue +2 -2
  44. package/src/components/MCommandPalette.vue +1 -1
  45. package/src/components/MConfirmDialog.vue +4 -0
  46. package/src/components/MContextMenu.vue +23 -2
  47. package/src/components/MDatePicker.vue +11 -11
  48. package/src/components/MDatePickerModal.vue +5 -5
  49. package/src/components/MDateRangePicker.vue +12 -12
  50. package/src/components/MDateRangePickerModal.vue +3 -3
  51. package/src/components/MDialog.vue +103 -12
  52. package/src/components/MFab.vue +13 -8
  53. package/src/components/MFabMenu.vue +1 -1
  54. package/src/components/MIconButton.vue +50 -14
  55. package/src/components/MListItem.vue +35 -17
  56. package/src/components/MLoadingIndicator.vue +14 -7
  57. package/src/components/MMaskField.vue +14 -6
  58. package/src/components/MMenu.vue +28 -3
  59. package/src/components/MMenuItem.vue +2 -2
  60. package/src/components/MMultiAutocomplete.vue +41 -26
  61. package/src/components/MMultiSelect.vue +40 -22
  62. package/src/components/MNavigationBar.vue +5 -10
  63. package/src/components/MNavigationDrawer.vue +10 -9
  64. package/src/components/MNavigationRail.vue +335 -22
  65. package/src/components/MNumberField.vue +14 -6
  66. package/src/components/MOverlay.vue +1 -1
  67. package/src/components/MPinInput.vue +7 -4
  68. package/src/components/MProgressBar.vue +16 -10
  69. package/src/components/MRadio.vue +74 -30
  70. package/src/components/MSearchBar.vue +3 -2
  71. package/src/components/MSegmentedButton.vue +14 -9
  72. package/src/components/MSelect.vue +44 -32
  73. package/src/components/MSideSheet.vue +1 -1
  74. package/src/components/MSlider.vue +42 -20
  75. package/src/components/MSnackbar.vue +4 -4
  76. package/src/components/MSplitButton.vue +32 -17
  77. package/src/components/MSpotlightSearch.vue +1 -1
  78. package/src/components/MSwitch.vue +138 -33
  79. package/src/components/MTabs.vue +16 -12
  80. package/src/components/MTagInput.vue +33 -22
  81. package/src/components/MTextField.vue +14 -6
  82. package/src/components/MTimePicker.vue +9 -9
  83. package/src/components/MTimePickerModal.vue +16 -16
  84. package/src/components/MToolbar.vue +5 -3
  85. package/src/components/MTooltip.vue +4 -4
  86. package/src/components/MTopAppBar.vue +14 -6
  87. package/src/components/MTour.vue +1 -1
  88. package/src/composables/useColorPalette.ts +10 -0
  89. package/src/index.ts +1 -0
  90. package/src/styles/palettes.css +659 -0
  91. package/src/styles/theme.css +2 -0
  92. package/dist/MMenuItem-B_5um6tj.js.map +0 -1
@@ -23,53 +23,97 @@ const checkedColor: Record<string, string> = {
23
23
  tertiary: "text-tertiary",
24
24
  error: "text-error",
25
25
  };
26
+
27
+ // Just the fill color, reused for the hover/press state layer's tint below.
28
+ const checkedBgColor: Record<string, string> = {
29
+ primary: "bg-primary",
30
+ secondary: "bg-secondary",
31
+ tertiary: "bg-tertiary",
32
+ error: "bg-error",
33
+ };
34
+
35
+ /*
36
+ * RadioButtonTokens: UnselectedIconColor = OnSurfaceVariant at rest, but
37
+ * Unselected{Focus,Hover,Pressed}IconColor are all OnSurface — the ring+dot darkens on
38
+ * interaction, same as MCheckbox's unselected border does. SelectedIconColor stays Primary
39
+ * through every interaction state (no darkening once checked). Disabled dims via the
40
+ * blanket `opacity-[0.38]` already on <label> below (equivalent to the real
41
+ * Disabled{Selected,Unselected}IconOpacity = 0.38, just applied to the whole row rather
42
+ * than the icon specifically — numerically the same result for the icon itself).
43
+ */
44
+ const iconColorClasses = computed(() => {
45
+ if (props.disabled) return "text-on-surface-variant";
46
+ if (isChecked.value) return checkedColor[props.color];
47
+ return "text-on-surface-variant group-hover:text-on-surface group-active:text-on-surface peer-focus-visible:text-on-surface";
48
+ });
26
49
  </script>
27
50
 
28
51
  <template>
29
52
  <label
30
53
  :for="id"
31
- class="inline-flex items-center gap-3 select-none"
54
+ class="group inline-flex items-center gap-3 select-none"
32
55
  :class="disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer'"
33
56
  >
34
- <span class="relative flex h-5 w-5 shrink-0">
57
+ <!--
58
+ RadioButtonTokens.StateLayerSize = 40dp (was 48px). Unlike MCheckbox/MChip,
59
+ RadioButtonTokens has NO FocusIndicatorColor at all — the real radio doesn't get a
60
+ separate colored ring on focus, only this state-layer circle (which also reacts to
61
+ focus, not just hover/press) plus the icon color darkening above. So no focus-ring
62
+ span here, just `peer-focus-visible:` added to this same state-layer's opacity.
63
+ -->
64
+ <span class="relative -m-2.5 inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full">
65
+ <!--
66
+ Input stays nested inside this `relative` span (a true sibling of the state-layer
67
+ span below, satisfying `peer-*`'s sibling-combinator requirement) rather than hoisted
68
+ up to <label> — moving a sr-only, `position: absolute` input away from a nearby
69
+ positioned ancestor breaks the browser's native focus-scroll behavior (see MCheckbox's
70
+ CHANGELOG entry for the real bug this caused there).
71
+ -->
35
72
  <input
36
73
  :id="id"
37
74
  type="radio"
38
- class="sr-only"
75
+ class="peer sr-only"
39
76
  :checked="isChecked"
40
77
  :disabled="disabled"
41
78
  @change="emit('update:modelValue', value)"
42
79
  />
80
+ <span
81
+ v-if="!disabled"
82
+ class="pointer-events-none absolute inset-0 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] group-active:opacity-[0.12] peer-focus-visible:opacity-[0.08]"
83
+ :class="isChecked ? checkedBgColor[color] : 'bg-on-surface'"
84
+ />
43
85
 
44
- <!--
45
- SVG radio: vector circles sharing center (10,10) stay round + concentric
46
- at any zoom. Outer ring uses r=8 (not 9) so the 2px stroke (7..9) leaves
47
- ~1px of clearance to the viewBox edge — prevents the border getting
48
- clipped at certain zoom levels.
49
- -->
50
- <svg
51
- viewBox="0 0 20 20"
52
- class="h-full w-full transition-colors duration-150"
53
- :class="isChecked ? checkedColor[color] : 'text-on-surface-variant'"
54
- aria-hidden="true"
55
- >
56
- <circle cx="10" cy="10" r="8" fill="none" stroke="currentColor" stroke-width="2" />
86
+ <span class="relative flex h-5 w-5">
57
87
  <!--
58
- Dot scaled via CSS, but the transform-origin is pinned to the circle's
59
- own bounding box center (transform-box: fill-box). Without this, the SVG
60
- element origin is (0,0) of the viewBox, so scale() grows from a corner
61
- and the dot visibly slides to the center. fill-box fixes the origin to
62
- the dot itself, so it grows symmetrically in place.
88
+ SVG radio: vector circles sharing center (10,10) stay round + concentric
89
+ at any zoom. Outer ring uses r=8 (not 9) so the 2px stroke (7..9) leaves
90
+ ~1px of clearance to the viewBox edge — prevents the border getting
91
+ clipped at certain zoom levels.
63
92
  -->
64
- <circle
65
- class="m3-radio-dot"
66
- :class="{ 'is-checked': isChecked }"
67
- cx="10"
68
- cy="10"
69
- r="4.5"
70
- fill="currentColor"
71
- />
72
- </svg>
93
+ <svg
94
+ viewBox="0 0 20 20"
95
+ class="h-full w-full transition-colors duration-150"
96
+ :class="iconColorClasses"
97
+ aria-hidden="true"
98
+ >
99
+ <circle cx="10" cy="10" r="8" fill="none" stroke="currentColor" stroke-width="2" />
100
+ <!--
101
+ Dot scaled via CSS, but the transform-origin is pinned to the circle's
102
+ own bounding box center (transform-box: fill-box). Without this, the SVG
103
+ element origin is (0,0) of the viewBox, so scale() grows from a corner
104
+ and the dot visibly slides to the center. fill-box fixes the origin to
105
+ the dot itself, so it grows symmetrically in place.
106
+ -->
107
+ <circle
108
+ class="m3-radio-dot"
109
+ :class="{ 'is-checked': isChecked }"
110
+ cx="10"
111
+ cy="10"
112
+ r="4.5"
113
+ fill="currentColor"
114
+ />
115
+ </svg>
116
+ </span>
73
117
  </span>
74
118
 
75
119
  <span v-if="label" class="text-body-large text-on-surface">{{ label }}</span>
@@ -129,7 +129,7 @@ onUnmounted(() => { document.body.style.overflow = '' })
129
129
  <div ref="barEl" class="relative w-full">
130
130
  <div
131
131
  v-show="!expanded"
132
- class="flex h-14 items-center gap-3 rounded-full bg-surface-container-high px-4 shadow-elevation-1 transition-shadow duration-150"
132
+ class="flex h-14 items-center gap-3 rounded-full bg-surface-container-high px-4 shadow-elevation-3 transition-shadow duration-150 focus-within:outline focus-within:outline-2 focus-within:outline-secondary focus-within:-outline-offset-2"
133
133
  :class="disabled ? 'pointer-events-none opacity-[0.38]' : ''"
134
134
  >
135
135
  <span class="inline-flex shrink-0 items-center" :class="iconPosition === 'end' ? 'order-last' : ''">
@@ -180,6 +180,7 @@ onUnmounted(() => { document.body.style.overflow = '' })
180
180
  icon="arrow_back"
181
181
  :label="locale.close"
182
182
  variant="standard"
183
+ style="color: var(--color-on-surface)"
183
184
  @click="close"
184
185
  />
185
186
  <input
@@ -205,7 +206,7 @@ onUnmounted(() => { document.body.style.overflow = '' })
205
206
  <slot name="trailing" />
206
207
  </div>
207
208
 
208
- <div class="h-px shrink-0 bg-outline-variant" />
209
+ <div class="h-px shrink-0 bg-outline" />
209
210
 
210
211
  <div class="flex-1 overflow-y-auto">
211
212
  <slot />
@@ -48,15 +48,20 @@ function toggle(opt: SegmentedOption, modelValue: string | number | (string | nu
48
48
  class="relative inline-flex items-center justify-center gap-2 text-label-large font-medium transition-[background-color,color] duration-150 outline-none 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]"
49
49
  :class="[
50
50
  density === 'compact' ? 'h-8 px-3' : density === 'comfortable' ? 'h-10 px-4' : 'h-10 px-6',
51
- i > 0 ? 'border-l border-outline' : '',
52
- opt.disabled ? 'cursor-not-allowed opacity-[0.38]' : 'cursor-pointer',
53
- isSelected(opt.value, modelValue)
54
- ? color === 'secondary'
55
- ? 'bg-secondary-container text-on-secondary-container'
56
- : color === 'tertiary'
57
- ? 'bg-tertiary-container text-on-tertiary-container'
58
- : 'bg-secondary-container text-on-secondary-container'
59
- : 'text-on-surface',
51
+ i > 0 ? (opt.disabled ? 'border-l border-outline/12' : 'border-l border-outline') : '',
52
+ opt.disabled ? 'cursor-not-allowed' : 'cursor-pointer',
53
+ isSelected(opt.value, modelValue) && (
54
+ color === 'secondary' ? 'bg-secondary-container'
55
+ : color === 'tertiary' ? 'bg-tertiary-container'
56
+ : 'bg-primary-container'
57
+ ),
58
+ opt.disabled
59
+ ? 'text-on-surface/38'
60
+ : isSelected(opt.value, modelValue)
61
+ ? color === 'secondary' ? 'text-on-secondary-container'
62
+ : color === 'tertiary' ? 'text-on-tertiary-container'
63
+ : 'text-on-primary-container'
64
+ : 'text-on-surface',
60
65
  ]"
61
66
  :disabled="opt.disabled"
62
67
  :aria-pressed="isSelected(opt.value, modelValue)"
@@ -27,6 +27,7 @@ const props = withDefaults(
27
27
  leadingIcon?: string
28
28
  clearable?: boolean
29
29
  fieldBg?: string
30
+ noResultsText?: string
30
31
  }>(),
31
32
  {
32
33
  modelValue: undefined,
@@ -59,6 +60,7 @@ const hasValue = computed(() => props.modelValue != null && props.modelValue !==
59
60
  const selectedLabel = computed(
60
61
  () => props.options.find((o) => eq(o.value, props.modelValue))?.label ?? '',
61
62
  )
63
+ const resolvedNoResultsText = computed(() => props.noResultsText ?? locale.noResults)
62
64
 
63
65
  function computeDropPos() {
64
66
  if (!fieldEl.value) return
@@ -142,27 +144,29 @@ onUnmounted(() => {
142
144
  const triggerClasses = computed(() => {
143
145
  const pl = props.leadingIcon ? 'pl-12' : 'pl-4'
144
146
  const base = [
145
- 'flex w-full cursor-pointer items-center pr-10 text-body-large transition-[border-color,border-width] duration-150',
147
+ 'flex w-full items-center pr-10 text-body-large transition-[border-color,border-width] duration-150',
148
+ props.disabled ? 'cursor-not-allowed' : 'cursor-pointer',
146
149
  pl,
147
150
  ]
148
151
 
149
152
  if (props.variant === 'outlined') {
150
- return [
151
- ...base,
152
- 'h-14 rounded-sm border bg-transparent',
153
- open.value
153
+ const border = props.disabled
154
+ ? 'border-on-surface/12'
155
+ : open.value
154
156
  ? (props.error ? 'border-2 border-error' : 'border-2 border-primary')
155
- : (props.error ? 'border-error' : 'border-outline hover:border-on-surface'),
156
- ].join(' ')
157
+ : (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
158
+ return [...base, 'h-14 rounded-xs border bg-transparent', border].join(' ')
157
159
  }
158
160
 
159
- return [
160
- ...base,
161
- 'h-14 rounded-t-sm bg-surface-container-highest border-b pt-6 pb-2',
162
- open.value
161
+ const border = props.disabled
162
+ ? 'border-on-surface/38'
163
+ : open.value
163
164
  ? (props.error ? 'border-b-2 border-error' : 'border-b-2 border-primary')
164
- : (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface'),
165
- ].join(' ')
165
+ : (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface')
166
+ const bg = props.disabled
167
+ ? 'bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]'
168
+ : 'bg-surface-container-highest'
169
+ return [...base, 'h-14 rounded-t-xs border-b pt-6 pb-2', bg, border].join(' ')
166
170
  })
167
171
 
168
172
  const isFloated = computed(() => hasValue.value || open.value)
@@ -184,9 +188,11 @@ const labelClasses = computed(() => {
184
188
  'pointer-events-none absolute right-10 truncate transition-all duration-200',
185
189
  left,
186
190
  isFloated.value ? floated : unFloated,
187
- open.value
188
- ? (props.error ? 'text-error' : 'text-primary')
189
- : (props.error ? 'text-error' : 'text-on-surface-variant'),
191
+ props.disabled
192
+ ? 'text-on-surface/38'
193
+ : open.value
194
+ ? (props.error ? 'text-error' : 'text-primary')
195
+ : (props.error ? 'text-error' : 'text-on-surface-variant'),
190
196
  ].join(' ')
191
197
  })
192
198
  </script>
@@ -202,10 +208,13 @@ const labelClasses = computed(() => {
202
208
  <!-- Leading icon -->
203
209
  <div
204
210
  v-if="leadingIcon"
205
- class="pointer-events-none absolute left-3.5 text-on-surface-variant"
206
- :class="variant === 'filled' ? 'top-5' : 'top-4.5'"
211
+ class="pointer-events-none absolute left-3.5"
212
+ :class="[
213
+ variant === 'filled' ? 'top-4.5' : 'top-4',
214
+ disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
215
+ ]"
207
216
  >
208
- <MIcon :name="leadingIcon" :size="20" />
217
+ <MIcon :name="leadingIcon" :size="24" />
209
218
  </div>
210
219
 
211
220
  <!-- Custom trigger -->
@@ -215,11 +224,11 @@ const labelClasses = computed(() => {
215
224
  role="combobox"
216
225
  :aria-expanded="open"
217
226
  :aria-disabled="disabled"
218
- :class="[triggerClasses, disabled ? 'pointer-events-none opacity-[0.38]' : '']"
227
+ :class="[triggerClasses, disabled ? 'pointer-events-none' : '']"
219
228
  @click="toggle"
220
229
  @keydown="onKeydown"
221
230
  >
222
- <span v-if="hasValue" class="text-on-surface">{{ selectedLabel }}</span>
231
+ <span v-if="hasValue" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ selectedLabel }}</span>
223
232
  </div>
224
233
 
225
234
  <!-- Floating label -->
@@ -242,8 +251,11 @@ const labelClasses = computed(() => {
242
251
  <MIcon
243
252
  name="arrow_drop_down"
244
253
  :size="24"
245
- class="text-on-surface-variant transition-transform duration-200"
246
- :class="open || modalOpen ? 'rotate-180' : ''"
254
+ class="transition-transform duration-200"
255
+ :class="[
256
+ open || modalOpen ? 'rotate-180' : '',
257
+ disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
258
+ ]"
247
259
  />
248
260
  </div>
249
261
  </div>
@@ -265,7 +277,7 @@ const labelClasses = computed(() => {
265
277
  <div
266
278
  v-if="open && mode === 'docked'"
267
279
  ref="dropdownEl"
268
- class="fixed z-500 max-h-60 overflow-auto rounded-sm bg-surface-container py-1 shadow-elevation-2"
280
+ class="fixed z-500 max-h-60 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2"
269
281
  :style="dropPos"
270
282
  >
271
283
  <div
@@ -276,7 +288,7 @@ const labelClasses = computed(() => {
276
288
  opt.disabled
277
289
  ? 'cursor-not-allowed opacity-38 text-on-surface'
278
290
  : 'text-on-surface hover:bg-on-surface/8',
279
- eq(opt.value, modelValue) ? 'bg-primary/8 text-primary font-medium' : '',
291
+ eq(opt.value, modelValue) ? 'bg-secondary-container text-on-secondary-container font-medium' : '',
280
292
  ]"
281
293
  @click="select(opt)"
282
294
  >
@@ -284,7 +296,7 @@ const labelClasses = computed(() => {
284
296
  v-if="eq(opt.value, modelValue)"
285
297
  name="check"
286
298
  :size="18"
287
- class="shrink-0 text-primary"
299
+ class="shrink-0 text-on-secondary-container"
288
300
  />
289
301
  <span v-else class="w-[18px] shrink-0" />
290
302
  {{ opt.label }}
@@ -293,7 +305,7 @@ const labelClasses = computed(() => {
293
305
  v-if="!options.length"
294
306
  class="px-4 py-3 text-center text-body-small text-on-surface-variant"
295
307
  >
296
- Sin opciones
308
+ {{ resolvedNoResultsText }}
297
309
  </p>
298
310
  </div>
299
311
  </Transition>
@@ -302,7 +314,7 @@ const labelClasses = computed(() => {
302
314
  <Transition name="m3-select-modal">
303
315
  <div
304
316
  v-if="modalOpen && mode === 'modal'"
305
- class="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4"
317
+ class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
306
318
  @click.self="closeModal"
307
319
  >
308
320
  <div class="select-modal-box flex max-h-[80vh] w-full max-w-sm flex-col overflow-hidden rounded-[28px] bg-surface-container-high shadow-elevation-3">
@@ -324,16 +336,16 @@ const labelClasses = computed(() => {
324
336
  opt.disabled
325
337
  ? 'cursor-not-allowed opacity-38 text-on-surface'
326
338
  : 'text-on-surface hover:bg-on-surface/8',
327
- eq(opt.value, modelValue) ? 'bg-primary/8' : '',
339
+ eq(opt.value, modelValue) ? 'bg-secondary-container' : '',
328
340
  ]"
329
341
  @click="select(opt)"
330
342
  >
331
343
  <MIcon
332
344
  :name="eq(opt.value, modelValue) ? 'radio_button_checked' : 'radio_button_unchecked'"
333
345
  :size="20"
334
- :class="eq(opt.value, modelValue) ? 'text-primary' : 'text-on-surface-variant'"
346
+ :class="eq(opt.value, modelValue) ? 'text-on-secondary-container' : 'text-on-surface-variant'"
335
347
  />
336
- <span :class="eq(opt.value, modelValue) ? 'text-primary font-medium' : ''">
348
+ <span :class="eq(opt.value, modelValue) ? 'text-on-secondary-container font-medium' : ''">
337
349
  {{ opt.label }}
338
350
  </span>
339
351
  </div>
@@ -341,7 +353,7 @@ const labelClasses = computed(() => {
341
353
  v-if="!options.length"
342
354
  class="px-6 py-4 text-center text-body-medium text-on-surface-variant"
343
355
  >
344
- Sin opciones
356
+ {{ resolvedNoResultsText }}
345
357
  </p>
346
358
  </div>
347
359
  </div>
@@ -42,7 +42,7 @@ const panelStyle = computed(() => ({
42
42
  <Transition name="ss" :duration="{ enter: 320, leave: 280 }">
43
43
  <div v-if="modelValue" class="fixed inset-0 z-200 flex justify-end">
44
44
  <!-- Scrim -->
45
- <div class="ss-scrim absolute inset-0 bg-black/40" @click="close" />
45
+ <div class="ss-scrim absolute inset-0 bg-scrim/32" @click="close" />
46
46
 
47
47
  <!-- Panel -->
48
48
  <aside
@@ -44,6 +44,7 @@ const emit = defineEmits<{ 'update:modelValue': [number | [number, number]] }>()
44
44
 
45
45
  const trackEl = ref<HTMLElement>()
46
46
  const dragging = ref<false | 'single' | 0 | 1>(false)
47
+ const focused = ref(false)
47
48
  const isVertical = computed(() => props.orientation === 'vertical')
48
49
  const isRange = computed(() => props.variant === 'range')
49
50
  const isCentered = computed(() => props.variant === 'centered')
@@ -81,7 +82,9 @@ const endDotHidden = computed(() => {
81
82
  })
82
83
 
83
84
  const sizeMap = {
84
- xs: { track: 16, thumbW: 4, thumbH: 32, dot: 4, gap: 7, hitArea: 38, radius: 6, dotInset: 12, thumbInset: 5, iconSize: 14, thumbIconSize: 22 },
85
+ // thumbH 44 matches SliderTokens.HandleHeight exactly — hitArea bumped from
86
+ // 38 to 46 to keep containing it (was sized for the old 32px handle).
87
+ xs: { track: 16, thumbW: 4, thumbH: 44, dot: 4, gap: 6, hitArea: 46, radius: 6, dotInset: 12, thumbInset: 5, iconSize: 14, thumbIconSize: 22 },
85
88
  sm: { track: 28, thumbW: 4, thumbH: 40, dot: 5, gap: 7, hitArea: 46, radius: 8, dotInset: 13, thumbInset: 6, iconSize: 16, thumbIconSize: 28 },
86
89
  md: { track: 54, thumbW: 5, thumbH: 62, dot: 5, gap: 8, hitArea: 66, radius: 12, dotInset: 15, thumbInset: 7, iconSize: 20, thumbIconSize: 42 },
87
90
  lg: { track: 72, thumbW: 5, thumbH: 78, dot: 6, gap: 10, hitArea: 82, radius: 14, dotInset: 17, thumbInset: 8, iconSize: 24, thumbIconSize: 52 },
@@ -105,26 +108,37 @@ const gap = computed(() => {
105
108
  return Math.max(s.value.gap, s.value.thumbIconSize / 2 + 4)
106
109
  })
107
110
 
108
- const paletteMap: Record<string, { active: string; inactive: string }> = {
109
- primary: { active: 'var(--color-primary)', inactive: 'var(--color-primary-container)' },
110
- secondary: { active: 'var(--color-secondary)', inactive: 'var(--color-secondary-container)' },
111
- tertiary: { active: 'var(--color-tertiary)', inactive: 'var(--color-tertiary-container)' },
112
- error: { active: 'var(--color-error)', inactive: 'var(--color-error-container)' },
111
+ const activeColorMap: Record<string, string> = {
112
+ primary: 'var(--color-primary)',
113
+ secondary: 'var(--color-secondary)',
114
+ tertiary: 'var(--color-tertiary)',
115
+ error: 'var(--color-error)',
113
116
  }
114
117
  // `fillColor`/`thumbColor` accept a custom CSS color (hex, rgb(), a var, …) —
115
118
  // not just an M3 role — that's the point of a "custom color" prop, otherwise
116
119
  // it'd just duplicate `color`. A known role name still works as a shortcut.
117
- // For a custom color there's no ready-made "container" tone, so the inactive
118
- // shade is derived by mixing it down against the current surface.
119
- function resolvePalette(custom: string | undefined, base: 'primary' | 'secondary' | 'tertiary' | 'error') {
120
+ function resolveActive(custom: string | undefined, base: 'primary' | 'secondary' | 'tertiary' | 'error') {
120
121
  const value = custom ?? base
121
- if (value in paletteMap) return paletteMap[value]!
122
- return { active: value, inactive: `color-mix(in srgb, ${value} 30%, var(--color-surface-container-highest))` }
122
+ return activeColorMap[value] ?? value
123
123
  }
124
+
125
+ // M3's SliderTokens fix the inactive track/stop-indicator color to
126
+ // secondary-container regardless of the active track's color (Inactive/Focus/
127
+ // Pressed TrackColor are all SecondaryContainer) — never derived from the
128
+ // active hue the way MCheckbox/MChip's containers are. Disabled state also
129
+ // isn't a single blanket opacity: DisabledActiveTrackOpacity/DisabledHandleOpacity
130
+ // = 38% on-surface, DisabledInactiveTrackOpacity = 12% on-surface.
131
+ const DISABLED_ACTIVE = 'color-mix(in srgb, var(--color-on-surface) 38%, transparent)'
132
+ const DISABLED_INACTIVE = 'color-mix(in srgb, var(--color-on-surface) 12%, transparent)'
133
+
124
134
  // `ct` (fill + corner dot) and `thumbCt` (thumb bar/icon) each fall back to the
125
135
  // base `color` prop, but can be overridden independently via `fillColor`/`thumbColor`.
126
- const ct = computed(() => resolvePalette(props.fillColor, props.color))
127
- const thumbCt = computed(() => resolvePalette(props.thumbColor, props.color))
136
+ const ct = computed(() => props.disabled
137
+ ? { active: DISABLED_ACTIVE, inactive: DISABLED_INACTIVE }
138
+ : { active: resolveActive(props.fillColor, props.color), inactive: 'var(--color-secondary-container)' })
139
+ const thumbCt = computed(() => props.disabled
140
+ ? { active: DISABLED_ACTIVE, inactive: DISABLED_INACTIVE }
141
+ : { active: resolveActive(props.thumbColor, props.color), inactive: 'var(--color-secondary-container)' })
128
142
 
129
143
  function clamp(v: number) {
130
144
  const stepped = Math.round((v - props.min) / props.step) * props.step + props.min
@@ -330,9 +344,13 @@ function thumbPos(pct: number) {
330
344
  transition: nd.value ? 'left 75ms ease, bottom 75ms ease, transform 80ms ease' : 'transform 80ms ease',
331
345
  }
332
346
  // Pressed state pinches the thumb thinner along the travel axis (like the
333
- // official M3 slider handle) while slightly growing the cross axis.
347
+ // official M3 slider handle) while slightly growing the cross axis. Exact
348
+ // ratio matches SliderTokens.PressedHandleWidth/FocusHandleWidth = 2dp,
349
+ // i.e. half of the base 4dp width — applies on keyboard focus too, not
350
+ // just an active pointer drag (Compose's isFocused covers both).
351
+ const isNarrowed = isDragging || focused.value
334
352
  const grow = isDragging ? 1.08 : 1
335
- const narrow = isDragging ? 0.6 : 1
353
+ const narrow = isNarrowed ? 0.5 : 1
336
354
  if (isVertical.value) {
337
355
  base.left = '50%'
338
356
  base.bottom = clampedPos(pct)
@@ -413,14 +431,16 @@ const tooltipPct = computed(() => {
413
431
  :aria-valuemax="max"
414
432
  :aria-disabled="disabled || undefined"
415
433
  :aria-orientation="orientation"
416
- class="relative touch-none cursor-pointer outline-none"
417
- :class="disabled && 'cursor-not-allowed opacity-[0.38]'"
434
+ class="group relative touch-none cursor-pointer outline-none"
435
+ :class="disabled && 'cursor-not-allowed'"
418
436
  :style="isVertical
419
437
  ? { width: `${s.hitArea}px`, minHeight: '160px', height: '100%' }
420
438
  : { height: `${s.hitArea}px`, width: '100%' }
421
439
  "
422
440
  @pointerdown="onPointerDown"
423
441
  @keydown="onKeyDown"
442
+ @focus="focused = true"
443
+ @blur="focused = false"
424
444
  >
425
445
  <!-- Track container -->
426
446
  <div
@@ -565,13 +585,15 @@ const tooltipPct = computed(() => {
565
585
  </template>
566
586
  </div>
567
587
 
568
- <!-- Thumb(s) -->
588
+ <!-- Thumb(s) — only the pctLo thumb takes keyboard input (arrow keys only
589
+ move index 0 in range mode, see onKeyDown), so it's the only one that
590
+ gets the focus-visible ring. -->
569
591
  <template v-if="thumbIcon">
570
- <MIcon :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none" :style="thumbIconPos(pctLo)" />
592
+ <MIcon :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbIconPos(pctLo)" />
571
593
  <MIcon v-if="isRange" :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none" :style="thumbIconPos(pctHi)" />
572
594
  </template>
573
595
  <template v-else>
574
- <div class="pointer-events-none" :style="thumbPos(pctLo)" />
596
+ <div class="pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbPos(pctLo)" />
575
597
  <div v-if="isRange" class="pointer-events-none" :style="thumbPos(pctHi)" />
576
598
  </template>
577
599
 
@@ -103,15 +103,15 @@ const getVariantStyle = (variant: string): VariantStyle =>
103
103
  </Transition>
104
104
 
105
105
  <div
106
- class="toast-inner pointer-events-auto relative flex items-center gap-3 overflow-hidden rounded-2xl px-4 py-4 shadow-elevation-2"
106
+ class="toast-inner pointer-events-auto relative flex min-h-12 items-center gap-3 overflow-hidden rounded px-4 py-4 shadow-elevation-3"
107
107
  :class="t.color ? 'text-white ring-1 ring-inset ring-white/10' : getVariantStyle(t.variant).container"
108
108
  :style="t.color ? { backgroundColor: t.color } : undefined"
109
109
  >
110
- <MSpinner v-if="t.loading" :size="20" class="shrink-0" />
110
+ <MSpinner v-if="t.loading" :size="24" class="shrink-0" />
111
111
  <MIcon
112
112
  v-else-if="t.icon !== null"
113
113
  :name="t.icon ?? getVariantStyle(t.variant).iconName"
114
- :size="20"
114
+ :size="24"
115
115
  class="shrink-0"
116
116
  :class="t.color ? '' : getVariantStyle(t.variant).icon"
117
117
  />
@@ -122,7 +122,7 @@ const getVariantStyle = (variant: string): VariantStyle =>
122
122
  <button
123
123
  v-if="t.action"
124
124
  type="button"
125
- class="cursor-pointer rounded px-2 py-1 text-label-medium font-semibold transition-colors"
125
+ class="cursor-pointer rounded px-2 py-1 text-label-large font-semibold transition-colors"
126
126
  :class="t.color ? 'text-white/90 hover:bg-white/15' : getVariantStyle(t.variant).action"
127
127
  @click="
128
128
  () => {
@@ -61,17 +61,40 @@ const containerClasses = computed(() => {
61
61
  return 'inline-flex items-center gap-0.5'
62
62
  })
63
63
 
64
+ // Dimensions matched to SplitButton{XSmall,Small,Medium,Large,XLarge}Tokens.kt: ContainerHeight,
65
+ // TrailingIconSize, LeadingButton*Space (symmetric padding here vs the real tokens' slightly
66
+ // asymmetric leading/trailing split — simplification, not worth separate left/right padding
67
+ // classes), and resting InnerCorner*CornerSize (`ri`). `r` is always height/2 to keep the outer
68
+ // shape a true pill (ContainerShape = CornerFull) regardless of tier.
64
69
  const sizeConfig = computed(() => {
65
70
  const map = {
66
- xs: { h: 'h-8', w: 'w-8', px: 'px-3', text: 'text-label-medium', icon: 16, arrow: 16, r: 16, ri: 4 },
67
- sm: { h: 'h-10', w: 'w-10', px: 'px-4', text: 'text-label-large', icon: 18, arrow: 18, r: 20, ri: 6 },
68
- md: { h: 'h-14', w: 'w-14', px: 'px-5', text: 'text-title-medium', icon: 20, arrow: 20, r: 28, ri: 6 },
69
- lg: { h: 'h-16', w: 'w-16', px: 'px-6', text: 'text-title-large', icon: 22, arrow: 22, r: 32, ri: 7 },
70
- xl: { h: 'h-20', w: 'w-20', px: 'px-7', text: 'text-headline-small', icon: 24, arrow: 24, r: 40, ri: 8 },
71
+ xs: { h: 'h-8', w: 'w-8', px: 'px-3', text: 'text-label-medium', icon: 20, arrow: 22, r: 16, ri: 4 },
72
+ sm: { h: 'h-10', w: 'w-10', px: 'px-4', text: 'text-label-large', icon: 20, arrow: 22, r: 20, ri: 4 },
73
+ md: { h: 'h-14', w: 'w-14', px: 'px-6', text: 'text-title-medium', icon: 24, arrow: 26, r: 28, ri: 4 },
74
+ lg: { h: 'h-24', w: 'w-24', px: 'px-12', text: 'text-title-large', icon: 32, arrow: 38, r: 48, ri: 8 },
75
+ xl: { h: 'h-[136px]', w: 'w-[136px]', px: 'px-16', text: 'text-headline-small', icon: 40, arrow: 50, r: 68, ri: 12 },
71
76
  }
72
77
  return map[props.size] ?? map.sm
73
78
  })
74
79
 
80
+ // M3 disabled tokens: content at 38% on-surface opacity, container at 10% (same split already
81
+ // established for MButton) — replaces a blanket 38% opacity that was applied to the whole button.
82
+ const buttonStateClasses = computed(() => {
83
+ if (props.disabled) {
84
+ return [
85
+ 'text-on-surface/38',
86
+ props.variant === 'outlined' ? 'border border-outline-variant/10' : 'bg-on-surface/10',
87
+ ]
88
+ }
89
+ return [
90
+ colorStyles.value.bg,
91
+ colorStyles.value.text,
92
+ colorStyles.value.hover,
93
+ props.variant === 'outlined' ? 'border border-outline' : '',
94
+ props.variant === 'elevated' ? 'shadow-elevation-1' : '',
95
+ ]
96
+ })
97
+
75
98
  function computeMenuPos() {
76
99
  if (!containerEl.value) return
77
100
  const rect = containerEl.value.getBoundingClientRect()
@@ -143,12 +166,8 @@ onUnmounted(() => {
143
166
  class="relative flex cursor-pointer items-center gap-2 overflow-hidden font-medium transition-colors"
144
167
  :class="[
145
168
  sizeConfig.h, sizeConfig.px, sizeConfig.text,
146
- colorStyles.bg,
147
- colorStyles.text,
148
- colorStyles.hover,
149
- variant === 'outlined' ? 'border border-outline' : '',
150
- variant === 'elevated' ? 'shadow-elevation-1' : '',
151
- disabled ? 'pointer-events-none opacity-[0.38]' : '',
169
+ buttonStateClasses,
170
+ disabled ? 'pointer-events-none' : '',
152
171
  ]"
153
172
  :style="{ borderRadius: `${sizeConfig.r}px ${sizeConfig.ri}px ${sizeConfig.ri}px ${sizeConfig.r}px` }"
154
173
  :disabled="disabled"
@@ -165,12 +184,8 @@ onUnmounted(() => {
165
184
  class="toggle-btn relative flex cursor-pointer items-center justify-center overflow-hidden"
166
185
  :class="[
167
186
  sizeConfig.h, sizeConfig.w,
168
- colorStyles.bg,
169
- colorStyles.text,
170
- colorStyles.hover,
171
- variant === 'outlined' ? 'border border-outline' : '',
172
- variant === 'elevated' ? 'shadow-elevation-1' : '',
173
- disabled ? 'pointer-events-none opacity-[0.38]' : '',
187
+ buttonStateClasses,
188
+ disabled ? 'pointer-events-none' : '',
174
189
  ]"
175
190
  :style="{ borderRadius: open ? `${sizeConfig.r}px` : `${sizeConfig.ri}px ${sizeConfig.r}px ${sizeConfig.r}px ${sizeConfig.ri}px` }"
176
191
  :disabled="disabled"
@@ -141,7 +141,7 @@ onBeforeUnmount(() => {
141
141
  <Transition name="m3-spot">
142
142
  <div
143
143
  v-if="modelValue"
144
- class="fixed inset-0 z-50 flex items-start justify-center bg-black/50 pt-[12vh]"
144
+ class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/32 pt-[12vh]"
145
145
  @click.self="close"
146
146
  >
147
147
  <div class="spot-box flex w-full max-w-xl flex-col overflow-hidden rounded-2xl bg-surface-container-high shadow-elevation-3">