@m3ui-vue/m3ui-vue 0.7.1 → 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 (90) hide show
  1. package/README.md +5 -5
  2. package/dist/{MMenuItem-xQ1x6-DH.js → MMenuItem-vSLbJGqe.js} +299 -232
  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/MCircleProgressBar.vue.d.ts +0 -1
  10. package/dist/components/MCodeEditor.vue.d.ts +1 -1
  11. package/dist/components/MConfirmDialog.vue.d.ts +3 -0
  12. package/dist/components/MDialog.vue.d.ts +23 -7
  13. package/dist/components/MFab.vue.d.ts +2 -2
  14. package/dist/components/MListItem.vue.d.ts +11 -6
  15. package/dist/components/MNavigationRail.vue.d.ts +17 -1
  16. package/dist/components/MSelect.vue.d.ts +1 -0
  17. package/dist/components/MSwitch.vue.d.ts +8 -0
  18. package/dist/components/MTabs.vue.d.ts +3 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/m3ui-vue.css +1 -1
  21. package/dist/m3ui.js +1798 -1432
  22. package/dist/m3ui.js.map +1 -1
  23. package/dist/rich-text-editor.js +1 -1
  24. package/dist/styles/palettes.css +659 -0
  25. package/dist/styles/theme.css +1 -0
  26. package/dist/styles.css +1 -1
  27. package/package.json +13 -1
  28. package/src/__tests__/useColorPalette.test.ts +2 -2
  29. package/src/code-editor.ts +1 -0
  30. package/src/components/MAutocomplete.vue +35 -26
  31. package/src/components/MBadge.vue +1 -1
  32. package/src/components/MBottomSheet.vue +4 -4
  33. package/src/components/MButton.vue +36 -19
  34. package/src/components/MButtonGroup.vue +2 -2
  35. package/src/components/MCard.vue +76 -11
  36. package/src/components/MChatBubble.vue +0 -1
  37. package/src/components/MCheckbox.vue +58 -13
  38. package/src/components/MChip.vue +26 -6
  39. package/src/components/MCircleProgressBar.vue +7 -4
  40. package/src/components/MCodeEditor.vue +54 -8
  41. package/src/components/MColorPicker.vue +9 -8
  42. package/src/components/MColorPickerModal.vue +2 -2
  43. package/src/components/MCommandPalette.vue +1 -1
  44. package/src/components/MConfirmDialog.vue +4 -0
  45. package/src/components/MContextMenu.vue +23 -2
  46. package/src/components/MDatePicker.vue +11 -11
  47. package/src/components/MDatePickerModal.vue +5 -5
  48. package/src/components/MDateRangePicker.vue +12 -12
  49. package/src/components/MDateRangePickerModal.vue +3 -3
  50. package/src/components/MDialog.vue +103 -12
  51. package/src/components/MFab.vue +10 -7
  52. package/src/components/MFabMenu.vue +1 -1
  53. package/src/components/MIconButton.vue +41 -19
  54. package/src/components/MListItem.vue +35 -17
  55. package/src/components/MLoadingIndicator.vue +14 -7
  56. package/src/components/MMaskField.vue +14 -6
  57. package/src/components/MMenu.vue +28 -3
  58. package/src/components/MMenuItem.vue +2 -2
  59. package/src/components/MMultiAutocomplete.vue +41 -26
  60. package/src/components/MMultiSelect.vue +40 -22
  61. package/src/components/MNavigationBar.vue +5 -10
  62. package/src/components/MNavigationDrawer.vue +10 -9
  63. package/src/components/MNavigationRail.vue +335 -22
  64. package/src/components/MNumberField.vue +14 -6
  65. package/src/components/MOverlay.vue +1 -1
  66. package/src/components/MPinInput.vue +7 -4
  67. package/src/components/MProgressBar.vue +16 -10
  68. package/src/components/MRadio.vue +54 -12
  69. package/src/components/MSearchBar.vue +3 -2
  70. package/src/components/MSegmentedButton.vue +14 -9
  71. package/src/components/MSelect.vue +44 -32
  72. package/src/components/MSideSheet.vue +1 -1
  73. package/src/components/MSnackbar.vue +4 -4
  74. package/src/components/MSplitButton.vue +32 -17
  75. package/src/components/MSpotlightSearch.vue +1 -1
  76. package/src/components/MSwitch.vue +96 -18
  77. package/src/components/MTabs.vue +16 -12
  78. package/src/components/MTagInput.vue +33 -22
  79. package/src/components/MTextField.vue +14 -6
  80. package/src/components/MTimePicker.vue +9 -9
  81. package/src/components/MTimePickerModal.vue +16 -16
  82. package/src/components/MToolbar.vue +5 -3
  83. package/src/components/MTooltip.vue +4 -4
  84. package/src/components/MTopAppBar.vue +14 -6
  85. package/src/components/MTour.vue +1 -1
  86. package/src/composables/useColorPalette.ts +10 -0
  87. package/src/index.ts +1 -0
  88. package/src/styles/palettes.css +659 -0
  89. package/src/styles/theme.css +1 -0
  90. package/dist/MMenuItem-xQ1x6-DH.js.map +0 -1
@@ -10,7 +10,6 @@ const props = withDefaults(
10
10
  time?: string
11
11
  side?: 'left' | 'right'
12
12
  avatar?: string
13
- avatarSrc?: string
14
13
  status?: 'sent' | 'delivered' | 'read'
15
14
  color?: 'primary' | 'secondary' | 'tertiary'
16
15
  tail?: boolean
@@ -14,39 +14,84 @@ withDefaults(
14
14
 
15
15
  const emit = defineEmits<{ "update:modelValue": [boolean] }>();
16
16
 
17
- // Same 4 named colors + fallback shape as MRadio's checkedColor map.
17
+ // Same 4 named colors + fallback shape as MRadio's checkedColor map. M3's real
18
+ // CheckboxTokens only define Primary (SelectedContainerColor) and Error (as an error
19
+ // STATE, not a color variant) — secondary/tertiary are a deliberate library extension on
20
+ // top of the spec, same status as MSlider's `color`/`icon` props.
18
21
  const checkedClasses: Record<string, string> = {
19
22
  primary: "border-primary bg-primary text-on-primary",
20
23
  secondary: "border-secondary bg-secondary text-on-secondary",
21
24
  tertiary: "border-tertiary bg-tertiary text-on-tertiary",
22
25
  error: "border-error bg-error text-on-error",
23
26
  };
27
+
28
+ // Just the fill color, reused for the hover/press state layer's tint below.
29
+ const checkedBgClasses: Record<string, string> = {
30
+ primary: "bg-primary",
31
+ secondary: "bg-secondary",
32
+ tertiary: "bg-tertiary",
33
+ error: "bg-error",
34
+ };
24
35
  </script>
25
36
 
26
37
  <template>
27
38
  <label
28
- class="inline-flex items-center gap-2 select-none"
39
+ class="group inline-flex items-center gap-2 select-none"
29
40
  :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'"
30
41
  >
31
- <span class="relative -m-[15px] inline-flex h-12 w-12 shrink-0 items-center justify-center">
42
+ <!--
43
+ CheckboxTokens.StateLayerSize = 40dp (was 48px), StateLayerShape = CornerFull. The
44
+ negative margin cancels the touch target's own overhang past the visible 18px box
45
+ (40-18)/2 = 11px per side, so it doesn't push the label text over.
46
+ -->
47
+ <span class="relative -m-[11px] inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full">
48
+ <!--
49
+ Input must stay nested INSIDE this `relative` span (a true sibling of the state-layer
50
+ /focus-ring spans below, satisfying `peer-*`'s sibling-combinator requirement, but not
51
+ hoisted all the way up to be a direct child of <label>): a sr-only, `position: absolute`
52
+ input with no nearby positioned ancestor made the browser's native focus-scroll
53
+ algorithm treat a distant `overflow: hidden` ancestor as the thing to scroll into view
54
+ on click, which — since that ancestor wasn't meant to scroll at all — blew out to its
55
+ max scrollTop and pushed the entire page off-screen. Real bug, found by testing in the
56
+ docs site; MSwitch's input, nested the same way this one now is again, never had it.
57
+ -->
58
+ <input
59
+ type="checkbox"
60
+ class="peer sr-only"
61
+ :checked="modelValue"
62
+ :disabled="disabled"
63
+ @change="emit('update:modelValue', !modelValue)"
64
+ />
65
+ <!--
66
+ Hover/press state layer (8%/12%), tinted with the checkbox's own indicator color
67
+ (primary/color prop when checked, on-surface when not) — same `before:`-overlay
68
+ spirit as MButton/MCard/MIconButton, just a real sibling span here since the parent
69
+ span is already used for centering/sizing. `group-*` (not a plain `hover:`) so
70
+ hovering anywhere over the row (including the label text) triggers it, not just
71
+ the small 18px glyph itself.
72
+ -->
73
+ <span
74
+ v-if="!disabled"
75
+ 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]"
76
+ :class="modelValue || indeterminate ? checkedBgClasses[color] : 'bg-on-surface'"
77
+ />
78
+ <!-- Keyboard-focus ring (FocusIndicatorColor = secondary) -->
32
79
  <span
33
- class="relative inline-flex h-4.5 w-4.5 items-center justify-center rounded-[3px] border-2 transition-colors"
80
+ v-if="!disabled"
81
+ class="pointer-events-none absolute inset-0 rounded-full ring-0 ring-secondary transition-[box-shadow] duration-150 peer-focus-visible:ring-2"
82
+ />
83
+
84
+ <span
85
+ class="relative inline-flex h-4.5 w-4.5 items-center justify-center rounded-[2px] border-2 transition-colors"
34
86
  :class="
35
87
  disabled
36
88
  ? (modelValue || indeterminate ? 'border-on-surface/38 bg-on-surface/38 text-surface' : 'border-on-surface/38 text-transparent')
37
- : (modelValue || indeterminate ? checkedClasses[color] : 'border-on-surface-variant text-transparent')
89
+ : (modelValue || indeterminate ? checkedClasses[color] : 'border-on-surface-variant text-transparent group-hover:border-on-surface group-active:border-on-surface')
38
90
  "
39
91
  >
40
- <input
41
- type="checkbox"
42
- class="sr-only"
43
- :checked="modelValue"
44
- :disabled="disabled"
45
- @change="emit('update:modelValue', !modelValue)"
46
- />
47
92
  <MIcon
48
93
  :name="indeterminate ? 'remove' : 'check'"
49
- :size="14"
94
+ :size="18"
50
95
  class="transition-[opacity,transform] duration-150"
51
96
  :class="modelValue || indeterminate ? 'scale-100 opacity-100' : 'scale-0 opacity-0'"
52
97
  />
@@ -39,12 +39,13 @@ const customStyle = computed(() => {
39
39
  })
40
40
 
41
41
  // M3 disabled tokens: label/icon always at 38% on-surface. Container: neutral/unselected
42
- // chips are outline-only (no fill), so the outline fades to 12%; every other tone has a
43
- // filled container, so the fill fades to 12% instead (and any border is dropped).
42
+ // chips are outline-only (no fill), so the outline fades to 10% (UnselectedDisabledOutlineOpacity);
43
+ // every other tone/selected chip has a filled container, so the fill fades to 12%
44
+ // (SelectedDisabledContainerOpacity) instead, with any border dropped.
44
45
  const toneClasses = computed(() => {
45
46
  if (props.disabled) {
46
47
  if (props.tone === 'neutral' && !props.selected && !isCustomColor.value) {
47
- return 'border border-on-surface/12 bg-transparent text-on-surface/38'
48
+ return 'border border-on-surface/10 bg-transparent text-on-surface/38'
48
49
  }
49
50
  return 'border border-transparent bg-on-surface/12 text-on-surface/38'
50
51
  }
@@ -52,7 +53,8 @@ const toneClasses = computed(() => {
52
53
  return 'border border-transparent bg-[var(--chip-bg)] text-[var(--chip-color)]'
53
54
  }
54
55
  if (props.tone === 'neutral' && !props.selected) {
55
- return 'border border-outline bg-transparent text-on-surface-variant'
56
+ // ChipsTokens.UnselectedOutlineColor = OutlineVariant, not Outline
57
+ return 'border border-outline-variant bg-transparent text-on-surface-variant'
56
58
  }
57
59
  const map: Record<string, string> = {
58
60
  neutral: 'border border-transparent bg-secondary-container text-on-secondary-container',
@@ -64,6 +66,23 @@ const toneClasses = computed(() => {
64
66
  }
65
67
  return map[props.tone ?? 'neutral'] ?? map.neutral
66
68
  })
69
+
70
+ // ChipsTokens: UnselectedShape = CornerMedium (12dp), SelectedShape = CornerFull — a chip
71
+ // becomes a full pill once selected, it doesn't keep the same small corner radius.
72
+ const shapeClass = computed(() => props.selected ? 'rounded-full' : 'rounded-md')
73
+
74
+ // Hover/press state layer (8%/12%, ChipsTokens has no dedicated token but this matches the
75
+ // universal M3 state-layer convention used everywhere else in this library) via the same
76
+ // `before:`-overlay technique as MButton/MCard/MIconButton — a plain `hover:bg-*` would just
77
+ // replace a filled/selected chip's own background outright instead of overlaying on top of
78
+ // it. `ring-inset` on the focus ring (FocusedIndicatorColor = secondary) because `overflow-
79
+ // hidden` on this same element (needed to clip the state-layer to the chip's shape) would
80
+ // otherwise clip an outset ring's box-shadow too.
81
+ const interactiveClasses =
82
+ "relative cursor-pointer before:content-[''] before:pointer-events-none before:absolute before:inset-0 " +
83
+ 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +
84
+ 'hover:before:opacity-[0.08] active:before:opacity-[0.12] ' +
85
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary'
67
86
  </script>
68
87
 
69
88
  <template>
@@ -71,10 +90,11 @@ const toneClasses = computed(() => {
71
90
  :is="clickable ? 'button' : 'span'"
72
91
  :type="clickable ? 'button' : undefined"
73
92
  :disabled="clickable && disabled ? true : undefined"
74
- class="inline-flex h-8 items-center gap-1.5 rounded-sm px-3 text-label-large transition-colors"
93
+ class="inline-flex h-8 items-center gap-1.5 overflow-hidden px-3 text-label-large transition-colors"
75
94
  :class="[
95
+ shapeClass,
76
96
  toneClasses,
77
- clickable && !disabled ? 'cursor-pointer hover:bg-on-surface/8' : '',
97
+ clickable && !disabled ? interactiveClasses : '',
78
98
  disabled ? 'cursor-not-allowed' : '',
79
99
  ]"
80
100
  :style="customStyle"
@@ -14,13 +14,16 @@ const props = withDefaults(
14
14
  {
15
15
  color: "primary",
16
16
  variant: "wavy",
17
- size: 80,
18
- thickness: 3,
17
+ thickness: 4,
19
18
  },
20
19
  );
21
20
 
22
21
  const clampedValue = computed(() => Math.min(100, Math.max(0, props.value ?? 0)));
23
22
 
23
+ // CircularProgressIndicatorTokens: Size=40dp (circle) / WaveSize=48dp (wavy) — the wavy
24
+ // variant's default is intentionally larger to fit the wave amplitude without clipping.
25
+ const effectiveSize = computed(() => props.size ?? (props.variant === "wavy" ? 48 : 40));
26
+
24
27
  const svgColorMap: Record<"primary" | "secondary" | "tertiary" | "error", { fill: string; track: string }> = {
25
28
  primary: { fill: "var(--color-primary)", track: "var(--color-primary-container)" },
26
29
  secondary: { fill: "var(--color-secondary)", track: "var(--color-secondary-container)" },
@@ -239,7 +242,7 @@ const maskId = useId();
239
242
 
240
243
  <div class="relative">
241
244
  <svg
242
- :width="size" :height="size"
245
+ :width="effectiveSize" :height="effectiveSize"
243
246
  viewBox="0 0 100 100"
244
247
  fill="none"
245
248
  role="progressbar"
@@ -315,7 +318,7 @@ const maskId = useId();
315
318
  text-anchor="middle" dominant-baseline="middle"
316
319
  :style="{
317
320
  fill: svgColor.fill,
318
- fontSize: `${size < 60 ? 11 : 14}px`,
321
+ fontSize: `${effectiveSize < 60 ? 11 : 14}px`,
319
322
  fontWeight: '600',
320
323
  fontFamily: 'Roboto, sans-serif',
321
324
  }"
@@ -2,7 +2,7 @@
2
2
  import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'
3
3
  import MIcon from './MIcon.vue'
4
4
 
5
- type Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'plain'
5
+ type Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'c' | 'cpp' | 'rust' | 'asm' | 'plain'
6
6
 
7
7
  const props = withDefaults(
8
8
  defineProps<{
@@ -49,6 +49,10 @@ const langLabel = computed(() => {
49
49
  css: 'CSS',
50
50
  python: 'Python',
51
51
  vue: 'Vue',
52
+ c: 'C',
53
+ cpp: 'C++',
54
+ rust: 'Rust',
55
+ asm: 'Assembly',
52
56
  plain: 'Texto',
53
57
  }
54
58
  return labels[props.language]
@@ -57,7 +61,7 @@ const langLabel = computed(() => {
57
61
  async function loadModules() {
58
62
  if (cmModules) return cmModules
59
63
 
60
- const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod] = await Promise.all([
64
+ const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod] = await Promise.all([
61
65
  import('@codemirror/view'),
62
66
  import('@codemirror/state'),
63
67
  import('@codemirror/commands'),
@@ -70,9 +74,12 @@ async function loadModules() {
70
74
  import('@codemirror/lang-css'),
71
75
  import('@codemirror/lang-python'),
72
76
  import('@codemirror/lang-vue'),
77
+ import('@codemirror/lang-cpp'),
78
+ import('@codemirror/lang-rust'),
79
+ import('@codemirror/legacy-modes/mode/gas'),
73
80
  ])
74
81
 
75
- cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod }
82
+ cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod }
76
83
  return cmModules
77
84
  }
78
85
 
@@ -131,6 +138,9 @@ function getLangExtension(mods: any) {
131
138
  case 'css': return mods.cssMod.css()
132
139
  case 'python': return mods.pyMod.python()
133
140
  case 'vue': return mods.vueMod.vue()
141
+ case 'c': case 'cpp': return mods.cppMod.cpp()
142
+ case 'rust': return mods.rustMod.rust()
143
+ case 'asm': return mods.languageMod.StreamLanguage.define(mods.asmMod.gas)
134
144
  default: return []
135
145
  }
136
146
  }
@@ -161,6 +171,7 @@ function buildExtensions(mods: any) {
161
171
  if (props.wrap) exts.push(viewMod.EditorView.lineWrapping)
162
172
  if (props.lineNumbers) exts.push(viewMod.lineNumbers())
163
173
  if (props.theme === 'dark') exts.push(oneDarkMod.oneDark)
174
+ if (props.placeholder) exts.push(viewMod.placeholder(props.placeholder))
164
175
 
165
176
  return exts
166
177
  }
@@ -189,13 +200,13 @@ watch(() => props.modelValue, (val) => {
189
200
  }
190
201
  })
191
202
 
192
- watch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap], createEditor)
203
+ watch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap, () => props.placeholder], createEditor)
193
204
 
194
205
  onBeforeUnmount(() => view?.destroy())
195
206
  </script>
196
207
 
197
208
  <template>
198
- <div class="overflow-hidden rounded-lg border border-outline-variant">
209
+ <div class="flex flex-col overflow-hidden rounded-lg border border-outline-variant">
199
210
  <!-- Header bar -->
200
211
  <div class="flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2">
201
212
  <span class="text-label-medium text-on-surface-variant">{{ langLabel }}</span>
@@ -223,9 +234,27 @@ onBeforeUnmount(() => view?.destroy())
223
234
  </template>
224
235
 
225
236
  <style scoped>
237
+ .code-editor-container {
238
+ /* .cm-editor/.cm-scroller/.cm-gutters all use height:100%, which only ever
239
+ resolves against a genuinely definite ancestor height — a min-height (what
240
+ this container has, so it can grow with content up to maxHeight) doesn't
241
+ count as definite for that percentage chain, so .cm-gutters silently fell
242
+ back to sizing off its own content instead of the real editor height.
243
+ Making this a flex column and letting .cm-editor grow via flex instead of
244
+ a % height gives the whole chain a real definite size to resolve against. */
245
+ display: flex;
246
+ flex-direction: column;
247
+ /* Also grow to fill the outer wrapper (see the root element's own flex-col
248
+ above) rather than just sitting at minHeight, whenever a consumer stretches
249
+ the whole component taller than that — e.g. `class="h-full"` in a grid
250
+ cell next to taller content. Still hard-capped by maxHeight either way. */
251
+ flex: 1 1 auto;
252
+ min-height: 0;
253
+ }
254
+
226
255
  .code-editor-container :deep(.cm-editor) {
227
- height: 100%;
228
- min-height: inherit;
256
+ flex: 1;
257
+ min-height: 0;
229
258
  font-family: 'Roboto Mono', 'Fira Code', 'Consolas', monospace;
230
259
  font-size: 0.8125rem;
231
260
  line-height: 1.6;
@@ -236,7 +265,18 @@ onBeforeUnmount(() => view?.destroy())
236
265
  }
237
266
 
238
267
  .code-editor-container :deep(.cm-scroller) {
239
- min-height: inherit;
268
+ /* .cm-scroller normally sizes itself off a height:100% against .cm-editor,
269
+ but that's a percentage-height-in-nested-flex-column case that browsers
270
+ don't reliably resolve — grow it directly instead so it has a real,
271
+ laid-out height for .cm-gutters to stretch against below. */
272
+ flex: 1 !important;
273
+ min-height: 0;
274
+ /* .cm-scroller lays out .cm-gutters/.cm-content in a row (gutter | content),
275
+ so .cm-gutters' height comes from cross-axis stretch, not flex-grow —
276
+ CodeMirror's own base theme sets align-items: flex-start !important here,
277
+ which is exactly what stops the gutter from stretching to full height in
278
+ the first place. */
279
+ align-items: stretch !important;
240
280
  }
241
281
 
242
282
  .code-editor-container :deep(.cm-content) {
@@ -253,6 +293,12 @@ onBeforeUnmount(() => view?.destroy())
253
293
  color: var(--color-outline);
254
294
  font-size: 0.75rem;
255
295
  padding: 0 4px;
296
+ /* .cm-gutters ships with an explicit height:100% rather than auto, so the
297
+ align-items:stretch above (on .cm-scroller) never actually kicks in —
298
+ stretch only applies to items whose cross-size computes to auto. Forcing
299
+ height back to auto here is what makes that stretch take effect. */
300
+ height: auto !important;
301
+ align-self: stretch !important;
256
302
  }
257
303
 
258
304
  .code-editor-container :deep(.cm-activeLineGutter) {
@@ -172,26 +172,27 @@ onUnmounted(() => {
172
172
  <div ref="triggerEl" class="relative mt-2" :style="{ '--field-bg': resolvedFieldBg }">
173
173
  <button
174
174
  type="button"
175
- class="flex h-14 w-full items-center gap-3 rounded-sm border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
175
+ class="flex h-14 w-full items-center gap-3 rounded-xs border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
176
176
  :class="[
177
- disabled ? 'pointer-events-none opacity-[0.38]' : 'cursor-pointer',
178
- open
177
+ disabled ? 'pointer-events-none cursor-not-allowed border-on-surface/12' : 'cursor-pointer',
178
+ !disabled && (open
179
179
  ? error ? 'border-2 border-error' : 'border-2 border-primary'
180
- : error ? 'border-error' : 'border-outline hover:border-on-surface',
180
+ : error ? 'border-error' : 'border-outline hover:border-on-surface'),
181
181
  ]"
182
182
  @click="!disabled && (open = !open)"
183
183
  >
184
184
  <span
185
185
  class="h-6 w-6 shrink-0 rounded-full border border-outline-variant"
186
+ :class="disabled ? 'opacity-38' : ''"
186
187
  :style="{ backgroundColor: modelValue }"
187
188
  />
188
- <span class="flex-1 font-mono text-on-surface">{{ modelValue }}</span>
189
- <MIcon name="palette" :size="20" class="shrink-0 text-on-surface-variant" />
189
+ <span class="flex-1 font-mono" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ modelValue }}</span>
190
+ <MIcon name="palette" :size="24" class="shrink-0" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'" />
190
191
  </button>
191
192
  <label
192
193
  v-if="label"
193
194
  class="pointer-events-none absolute -top-2.5 left-3 bg-(--field-bg) px-1 text-label-small transition-colors"
194
- :class="open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
195
+ :class="disabled ? 'text-on-surface/38' : open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
195
196
  >
196
197
  {{ label }}
197
198
  </label>
@@ -254,7 +255,7 @@ onUnmounted(() => {
254
255
  type="text"
255
256
  :value="modelValue"
256
257
  maxlength="7"
257
- class="flex-1 rounded-sm border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface outline-none transition-colors focus:border-primary"
258
+ class="flex-1 rounded-xs border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface outline-none caret-primary transition-colors focus:border-primary"
258
259
  @input="onHexInput"
259
260
  />
260
261
  </div>
@@ -150,7 +150,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
150
150
  <Transition name="m3-cp-modal">
151
151
  <div
152
152
  v-if="show"
153
- class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/40 p-4"
153
+ class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
154
154
  @click.self="cancel"
155
155
  >
156
156
  <div class="cp-box w-[328px] rounded-[28px] bg-surface-container-high px-6 pt-6 pb-4 shadow-elevation-3">
@@ -205,7 +205,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
205
205
  type="text"
206
206
  :value="hexInput"
207
207
  maxlength="7"
208
- class="w-full rounded-sm border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface outline-none transition-colors focus:border-primary"
208
+ class="w-full rounded-xs border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface caret-primary outline-none transition-colors focus:border-primary"
209
209
  @input="onHexFieldInput"
210
210
  />
211
211
  </div>
@@ -129,7 +129,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onGlobalKeydown))
129
129
  <Transition name="m3-cmd">
130
130
  <div
131
131
  v-if="modelValue"
132
- class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/40 pt-[15vh]"
132
+ class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/32 pt-[15vh]"
133
133
  @click.self="close"
134
134
  >
135
135
  <div class="cmd-box flex w-full max-w-lg flex-col overflow-hidden rounded-xl bg-surface-container-high shadow-elevation-3">
@@ -12,10 +12,13 @@ const props = withDefaults(
12
12
  cancelLabel?: string
13
13
  danger?: boolean
14
14
  loading?: boolean
15
+ /** Passed straight through to MDialog's `closable` — show/hide the header close (X) button. */
16
+ closable?: boolean
15
17
  }>(),
16
18
  {
17
19
  danger: false,
18
20
  loading: false,
21
+ closable: true,
19
22
  },
20
23
  )
21
24
 
@@ -29,6 +32,7 @@ const emit = defineEmits<{ 'update:modelValue': [boolean]; confirm: [] }>()
29
32
  :model-value="modelValue"
30
33
  :title="title"
31
34
  max-width="max-w-sm"
35
+ :closable="closable"
32
36
  @update:model-value="emit('update:modelValue', $event)"
33
37
  >
34
38
  <p class="text-body-medium text-on-surface-variant">{{ message }}</p>
@@ -15,6 +15,24 @@ async function showAt(x: number, y: number) {
15
15
  x: Math.min(x, window.innerWidth - el.offsetWidth - 8),
16
16
  y: Math.min(y, window.innerHeight - el.offsetHeight - 8),
17
17
  }
18
+ focusableItems()[0]?.focus()
19
+ }
20
+
21
+ function focusableItems() {
22
+ if (!panelEl.value) return []
23
+ return Array.from(
24
+ panelEl.value.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]'),
25
+ )
26
+ }
27
+
28
+ function moveFocus(dir: 1 | -1) {
29
+ const items = focusableItems()
30
+ if (!items.length) return
31
+ const idx = items.indexOf(document.activeElement as HTMLElement)
32
+ const next = idx === -1
33
+ ? (dir === 1 ? items[0] : items[items.length - 1])
34
+ : items[(idx + dir + items.length) % items.length]
35
+ next?.focus()
18
36
  }
19
37
 
20
38
  function show(e: MouseEvent) {
@@ -38,7 +56,10 @@ function onDocMouseDown(e: MouseEvent) {
38
56
  }
39
57
 
40
58
  function onKeydown(e: KeyboardEvent) {
41
- if (e.key === 'Escape') hide()
59
+ if (e.key === 'Escape') { hide(); return }
60
+ if (!visible.value) return
61
+ if (e.key === 'ArrowDown') { e.preventDefault(); moveFocus(1) }
62
+ else if (e.key === 'ArrowUp') { e.preventDefault(); moveFocus(-1) }
42
63
  }
43
64
 
44
65
  function onScroll() {
@@ -75,7 +96,7 @@ onUnmounted(() => {
75
96
  <div
76
97
  v-if="visible"
77
98
  ref="panelEl"
78
- class="fixed z-[500] min-w-48 overflow-hidden rounded-lg bg-surface-container py-1 shadow-elevation-2"
99
+ class="fixed z-[500] min-w-48 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2"
79
100
  :style="{ left: `${adjustedPos.x}px`, top: `${adjustedPos.y}px`, transformOrigin: 'top left' }"
80
101
  @contextmenu.prevent
81
102
  >
@@ -167,18 +167,18 @@ onUnmounted(() => {
167
167
  <div ref="triggerEl" class="relative mt-2" :style="{ '--field-bg': resolvedFieldBg }">
168
168
  <button
169
169
  type="button"
170
- 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"
170
+ 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"
171
171
  :class="[
172
- disabled ? 'pointer-events-none opacity-[0.38]' : 'cursor-pointer',
173
- open
172
+ disabled ? 'pointer-events-none cursor-not-allowed border-on-surface/12' : 'cursor-pointer',
173
+ !disabled && (open
174
174
  ? error ? 'border-2 border-error' : 'border-2 border-primary'
175
- : error ? 'border-error' : 'border-outline hover:border-on-surface',
175
+ : error ? 'border-error' : 'border-outline hover:border-on-surface'),
176
176
  ]"
177
177
  @click="!disabled && (open = !open)"
178
178
  >
179
- <MIcon name="calendar_today" :size="20" class="shrink-0 text-on-surface-variant" />
180
- <span v-if="displayValue" class="flex-1 text-on-surface">{{ displayValue }}</span>
181
- <span v-else class="flex-1 text-on-surface-variant">{{ placeholder || label || localeStrings.selectDate }}</span>
179
+ <MIcon name="calendar_today" :size="24" class="shrink-0" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'" />
180
+ <span v-if="displayValue" class="flex-1" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ displayValue }}</span>
181
+ <span v-else class="flex-1" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'">{{ placeholder || label || localeStrings.selectDate }}</span>
182
182
  <MIcon
183
183
  v-if="modelValue"
184
184
  name="close"
@@ -190,7 +190,7 @@ onUnmounted(() => {
190
190
  <label
191
191
  v-if="label"
192
192
  class="pointer-events-none absolute -top-2.5 left-3 bg-(--field-bg) px-1 text-label-small transition-colors"
193
- :class="open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
193
+ :class="disabled ? 'text-on-surface/38' : open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
194
194
  >
195
195
  {{ label }}
196
196
  </label>
@@ -210,7 +210,7 @@ onUnmounted(() => {
210
210
  <div
211
211
  v-if="open"
212
212
  ref="panelEl"
213
- class="fixed z-500 w-[320px] rounded-lg bg-surface-container p-4 shadow-elevation-3"
213
+ class="fixed z-500 w-[360px] rounded-[28px] bg-surface-container-high p-4 shadow-elevation-3"
214
214
  :style="dropPos"
215
215
  >
216
216
  <!-- Header -->
@@ -222,7 +222,7 @@ onUnmounted(() => {
222
222
 
223
223
  <!-- Weekday headers -->
224
224
  <div class="mb-1 grid grid-cols-7 gap-0.5 text-center">
225
- <span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-label-small font-medium text-on-surface-variant">
225
+ <span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-body-large font-medium text-on-surface">
226
226
  {{ wd }}
227
227
  </span>
228
228
  </div>
@@ -233,7 +233,7 @@ onUnmounted(() => {
233
233
  v-for="(day, i) in calendarDays"
234
234
  :key="i"
235
235
  type="button"
236
- class="flex h-9 w-full items-center justify-center rounded-full text-body-medium transition-colors duration-100"
236
+ class="flex h-10 w-full items-center justify-center rounded-full text-body-medium transition-colors duration-100"
237
237
  :class="[
238
238
  day.disabled
239
239
  ? 'cursor-not-allowed text-on-surface/25'
@@ -155,17 +155,17 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
155
155
  <Transition name="m3-dp-modal">
156
156
  <div
157
157
  v-if="show"
158
- class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/40 p-4"
158
+ class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
159
159
  @click.self="cancel"
160
160
  >
161
161
  <div class="dp-box w-[360px] rounded-[28px] bg-surface-container-high shadow-elevation-3">
162
162
  <!-- Header -->
163
163
  <div class="px-6 pt-6 pb-4">
164
- <p class="mb-3 text-label-medium text-on-surface-variant">
164
+ <p class="mb-3 text-label-large text-on-surface-variant">
165
165
  {{ title || locale.selectDate }}
166
166
  </p>
167
167
  <div class="flex items-center justify-between">
168
- <span class="text-headline-medium font-medium capitalize text-on-surface">
168
+ <span class="text-headline-large font-medium capitalize text-on-surface-variant">
169
169
  {{ headerDate }}
170
170
  </span>
171
171
  <MIconButton
@@ -189,7 +189,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
189
189
 
190
190
  <!-- Weekday headers -->
191
191
  <div class="mb-1 grid grid-cols-7 gap-0.5 text-center">
192
- <span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-label-small font-medium text-on-surface-variant">
192
+ <span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-body-large font-medium text-on-surface">
193
193
  {{ wd }}
194
194
  </span>
195
195
  </div>
@@ -228,7 +228,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
228
228
  type="text"
229
229
  placeholder="23/06/2026"
230
230
  maxlength="10"
231
- class="h-14 w-full rounded-sm border border-outline bg-transparent px-4 text-body-large text-on-surface outline-none transition-colors focus:border-2 focus:border-primary"
231
+ class="h-14 w-full rounded-xs border border-outline bg-transparent px-4 text-body-large text-on-surface caret-primary outline-none transition-colors focus:border-2 focus:border-primary"
232
232
  @keydown.enter="applyInput"
233
233
  @blur="applyInput"
234
234
  />