@behavioral-agentic-design-system/core 0.28.0 → 0.29.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 (95) hide show
  1. package/package.json +2 -2
  2. package/scripts/a11y-lint.cjs +78 -9
  3. package/scripts/build-tokens.cjs +273 -15
  4. package/scripts/wcag-audit.cjs +37 -7
  5. package/src/api/layers/file.ts +1 -0
  6. package/src/app/font-ready.tsx +6 -5
  7. package/src/app/layout.tsx +54 -3
  8. package/src/app/preview/components/page.tsx +5532 -3044
  9. package/src/app/preview/layout.tsx +4 -1
  10. package/src/app/preview/showcase-filter.tsx +66 -0
  11. package/src/app/preview/tab-replay.tsx +63 -0
  12. package/src/app/shell.tsx +74 -18
  13. package/src/components/customize/save-bar.tsx +19 -6
  14. package/src/components/docs-tab.tsx +36 -24
  15. package/src/components/layers-tab.tsx +37 -5
  16. package/src/components/ui/alert.tsx +12 -0
  17. package/src/components/ui/badge.tsx +19 -0
  18. package/src/components/ui/chat-marker.tsx +120 -0
  19. package/src/components/ui/checkbox.tsx +9 -1
  20. package/src/components/ui/close-button.tsx +71 -0
  21. package/src/components/ui/combobox.tsx +62 -3
  22. package/src/components/ui/container.tsx +65 -0
  23. package/src/components/ui/date-field.tsx +368 -0
  24. package/src/components/ui/drawer.tsx +334 -0
  25. package/src/components/ui/file-button.tsx +145 -0
  26. package/src/components/ui/floating-indicator.tsx +217 -0
  27. package/src/components/ui/format-byte.tsx +113 -0
  28. package/src/components/ui/index.ts +21 -0
  29. package/src/components/ui/input.tsx +38 -3
  30. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  31. package/src/components/ui/loading-dots.tsx +99 -0
  32. package/src/components/ui/month-picker.tsx +296 -0
  33. package/src/components/ui/multi-select.tsx +15 -13
  34. package/src/components/ui/nav-link.tsx +200 -0
  35. package/src/components/ui/navigation-rail.tsx +256 -0
  36. package/src/components/ui/notification.tsx +20 -0
  37. package/src/components/ui/password-input.tsx +34 -1
  38. package/src/components/ui/progress.tsx +15 -1
  39. package/src/components/ui/prose.tsx +62 -0
  40. package/src/components/ui/result.tsx +151 -0
  41. package/src/components/ui/rolling-number.tsx +1 -0
  42. package/src/components/ui/simple-grid.tsx +110 -0
  43. package/src/components/ui/skeleton.tsx +52 -3
  44. package/src/components/ui/squircle.tsx +274 -0
  45. package/src/components/ui/stack.tsx +105 -0
  46. package/src/components/ui/status-badge.tsx +93 -0
  47. package/src/components/ui/tabs.tsx +34 -7
  48. package/src/components/ui/tag.tsx +46 -5
  49. package/src/components/ui/theme-icon.tsx +138 -0
  50. package/src/components/ui/timeline.tsx +27 -10
  51. package/src/components/ui/tooltip.tsx +12 -1
  52. package/src/components/ui/tree-select.tsx +386 -0
  53. package/src/components/ui/year-picker.tsx +307 -0
  54. package/src/data/docs-index.ts +10 -0
  55. package/src/hooks/use-global-primary-color.ts +57 -6
  56. package/src/stories/Alert.stories.tsx +31 -1
  57. package/src/stories/Badge.stories.tsx +63 -6
  58. package/src/stories/ChatMarker.stories.tsx +59 -0
  59. package/src/stories/Checkbox.stories.tsx +5 -0
  60. package/src/stories/CloseButton.stories.tsx +65 -0
  61. package/src/stories/Combobox.stories.tsx +74 -3
  62. package/src/stories/Container.stories.tsx +134 -0
  63. package/src/stories/DateField.stories.tsx +114 -0
  64. package/src/stories/Drawer.stories.tsx +211 -0
  65. package/src/stories/FileButton.stories.tsx +117 -0
  66. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  67. package/src/stories/FormatByte.stories.tsx +142 -0
  68. package/src/stories/Input.stories.tsx +91 -0
  69. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  70. package/src/stories/LoadingDots.stories.tsx +73 -0
  71. package/src/stories/MonthPicker.stories.tsx +99 -0
  72. package/src/stories/MultiSelect.stories.tsx +3 -1
  73. package/src/stories/NavLink.stories.tsx +213 -0
  74. package/src/stories/NavigationRail.stories.tsx +413 -0
  75. package/src/stories/Notification.stories.tsx +53 -0
  76. package/src/stories/PasswordInput.stories.tsx +21 -0
  77. package/src/stories/Progress.stories.tsx +38 -0
  78. package/src/stories/Prose.stories.tsx +232 -0
  79. package/src/stories/Result.stories.tsx +145 -0
  80. package/src/stories/RollingNumber.stories.tsx +1 -1
  81. package/src/stories/SimpleGrid.stories.tsx +130 -0
  82. package/src/stories/Skeleton.stories.tsx +62 -1
  83. package/src/stories/Squircle.stories.tsx +127 -0
  84. package/src/stories/Stack.stories.tsx +139 -0
  85. package/src/stories/StatusBadge.stories.tsx +125 -0
  86. package/src/stories/Tabs.stories.tsx +56 -1
  87. package/src/stories/Tag.stories.tsx +31 -0
  88. package/src/stories/ThemeIcon.stories.tsx +97 -0
  89. package/src/stories/Timeline.stories.tsx +69 -0
  90. package/src/stories/Tooltip.stories.tsx +18 -0
  91. package/src/stories/TreeSelect.stories.tsx +222 -0
  92. package/src/stories/YearPicker.stories.tsx +100 -0
  93. package/src/styles.css +289 -15
  94. package/src/tokens.json +96 -1
  95. package/LICENSE +0 -21
@@ -0,0 +1,146 @@
1
+ "use client"
2
+
3
+ /**
4
+ * KeyboardShortcut — displays a keyboard shortcut as a sequence of Kbd keys
5
+ * separated by a "+" or "then" separator.
6
+ *
7
+ * Composes the existing Kbd primitive. Handles platform-specific modifier
8
+ * symbols (⌘, ⌃, ⌥, ⇧ on Mac; Ctrl, Alt, Shift on Windows/Linux).
9
+ *
10
+ * Sources: Linear, Raycast, VS Code, GitHub command palette shortcut display
11
+ * patterns. Kbd is the single-key primitive; KeyboardShortcut is the
12
+ * multi-key composition with correct semantic markup and platform awareness.
13
+ *
14
+ * Accessibility: wraps in <kbd> with aria-label describing the full
15
+ * combination in plain text so screen readers announce "Command K" rather
16
+ * than reading each symbol separately.
17
+ *
18
+ * Motion: none — shortcut labels are presentational, no interaction.
19
+ */
20
+
21
+ import * as React from "react"
22
+
23
+ import { cn } from "../../lib/utils"
24
+ import { Kbd, type KbdProps } from "./kbd"
25
+
26
+ /** Canonical key names that map to platform-specific display symbols. */
27
+ export type ModifierKey = "meta" | "ctrl" | "alt" | "shift"
28
+
29
+ const macSymbols: Record<ModifierKey, string> = {
30
+ meta: "⌘",
31
+ ctrl: "⌃",
32
+ alt: "⌥",
33
+ shift: "⇧",
34
+ }
35
+
36
+ const windowsLabels: Record<ModifierKey, string> = {
37
+ meta: "Win",
38
+ ctrl: "Ctrl",
39
+ alt: "Alt",
40
+ shift: "Shift",
41
+ }
42
+
43
+ function isModifier(key: string): key is ModifierKey {
44
+ return key === "meta" || key === "ctrl" || key === "alt" || key === "shift"
45
+ }
46
+
47
+ export interface KeyboardShortcutProps extends React.ComponentProps<"kbd"> {
48
+ /**
49
+ * Array of key strings. Use lowercase modifier names ("meta", "ctrl",
50
+ * "alt", "shift") and literal key characters ("K", "Enter", "Tab", "↑").
51
+ * Order: modifiers first, then the main key.
52
+ * @example ["meta", "K"] → ⌘K
53
+ * @example ["ctrl", "shift", "P"] → Ctrl+Shift+P
54
+ */
55
+ keys: string[]
56
+ /**
57
+ * Separator rendered between keys.
58
+ * @default "+"
59
+ */
60
+ separator?: string
61
+ /**
62
+ * Controls modifier display style.
63
+ * - "mac" renders ⌘⌃⌥⇧ symbols (default)
64
+ * - "windows" renders Ctrl/Alt/Shift/Win labels
65
+ * - "auto" detects via navigator.platform (SSR-safe: falls back to "mac")
66
+ */
67
+ platform?: "mac" | "windows" | "auto"
68
+ /** Size forwarded to each Kbd element. */
69
+ size?: KbdProps["size"]
70
+ /** Variant forwarded to each Kbd element. */
71
+ variant?: KbdProps["variant"]
72
+ }
73
+
74
+ function resolveKey(
75
+ key: string,
76
+ platform: "mac" | "windows"
77
+ ): string {
78
+ if (isModifier(key)) {
79
+ return platform === "mac" ? macSymbols[key] : windowsLabels[key]
80
+ }
81
+ return key
82
+ }
83
+
84
+ function buildAriaLabel(keys: string[]): string {
85
+ return keys
86
+ .map((k) =>
87
+ isModifier(k)
88
+ ? k === "meta"
89
+ ? "Command"
90
+ : k === "ctrl"
91
+ ? "Control"
92
+ : k === "alt"
93
+ ? "Alt"
94
+ : "Shift"
95
+ : k
96
+ )
97
+ .join(" ")
98
+ }
99
+
100
+ function KeyboardShortcut({
101
+ keys,
102
+ separator = "+",
103
+ platform = "mac",
104
+ size,
105
+ variant,
106
+ className,
107
+ ...props
108
+ }: KeyboardShortcutProps) {
109
+ const resolvedPlatform: "mac" | "windows" =
110
+ platform === "auto"
111
+ ? typeof navigator !== "undefined" &&
112
+ navigator.platform.toLowerCase().includes("win")
113
+ ? "windows"
114
+ : "mac"
115
+ : platform
116
+
117
+ const displayKeys = keys.map((k) => resolveKey(k, resolvedPlatform))
118
+ const ariaLabel = buildAriaLabel(keys)
119
+
120
+ return (
121
+ <kbd
122
+ aria-label={ariaLabel}
123
+ data-slot="keyboard-shortcut"
124
+ className={cn("inline-flex items-center gap-0.5", className)}
125
+ {...props}
126
+ >
127
+ {displayKeys.map((key, i) => (
128
+ <React.Fragment key={i}>
129
+ {i > 0 && (
130
+ <span
131
+ aria-hidden="true"
132
+ className="text-[0.65em] text-muted-foreground select-none"
133
+ >
134
+ {separator}
135
+ </span>
136
+ )}
137
+ <Kbd size={size} variant={variant}>
138
+ {key}
139
+ </Kbd>
140
+ </React.Fragment>
141
+ ))}
142
+ </kbd>
143
+ )
144
+ }
145
+
146
+ export { KeyboardShortcut }
@@ -0,0 +1,99 @@
1
+ "use client"
2
+
3
+ /**
4
+ * LoadingDots — three-dot inline loading indicator for async states.
5
+ *
6
+ * Distinct from TypingIndicator (chat-specific "person is typing" widget).
7
+ * LoadingDots is a general-purpose inline spinner substitute — used inside
8
+ * buttons during submission, in list placeholders, in nav items that are
9
+ * fetching, and anywhere a compact animated signal replaces a full spinner.
10
+ *
11
+ * Sources: common cross-library pattern (GitHub, Vercel, Linear, Notion);
12
+ * inline button-loading convention established in shadcn/ui + Base UI.
13
+ *
14
+ * Motion (spec §4):
15
+ * - reuses the `typing-dot` @keyframe from styles.css (pattern b delivery,
16
+ * keyed off [data-slot="chat-bubble-typing"] → we use the same keyframe
17
+ * by name, with inline animationDelay per dot for stagger — pattern c).
18
+ * - reduced-motion: base layer forces animation-duration to 0.01ms.
19
+ *
20
+ * Accessibility: aria-label defaults to "Loading" — override when the
21
+ * context is more specific ("Saving", "Sending"). role="status" surfaces
22
+ * it as a live region so screen readers announce the state.
23
+ */
24
+
25
+ import * as React from "react"
26
+ import { cva, type VariantProps } from "class-variance-authority"
27
+
28
+ import { cn } from "../../lib/utils"
29
+
30
+ const loadingDotsVariants = cva(
31
+ "inline-flex items-center gap-[0.2em]",
32
+ {
33
+ variants: {
34
+ size: {
35
+ xs: "h-3",
36
+ sm: "h-4",
37
+ default: "h-5",
38
+ lg: "h-6",
39
+ },
40
+ tone: {
41
+ current: "",
42
+ muted: "text-muted-foreground",
43
+ primary: "text-primary",
44
+ },
45
+ },
46
+ defaultVariants: {
47
+ size: "default",
48
+ tone: "current",
49
+ },
50
+ }
51
+ )
52
+
53
+ const dotSizeMap: Record<string, string> = {
54
+ xs: "size-1",
55
+ sm: "size-1.5",
56
+ default: "size-2",
57
+ lg: "size-2.5",
58
+ }
59
+
60
+ export interface LoadingDotsProps
61
+ extends React.ComponentProps<"span">,
62
+ VariantProps<typeof loadingDotsVariants> {
63
+ /** Accessible label for the loading state. */
64
+ "aria-label"?: string
65
+ }
66
+
67
+ function LoadingDots({
68
+ size = "default",
69
+ tone = "current",
70
+ className,
71
+ "aria-label": ariaLabel = "Loading",
72
+ ...props
73
+ }: LoadingDotsProps) {
74
+ const dotClass = dotSizeMap[size ?? "default"]
75
+
76
+ return (
77
+ <span
78
+ role="status"
79
+ aria-label={ariaLabel}
80
+ data-slot="loading-dots"
81
+ className={cn(loadingDotsVariants({ size, tone }), className)}
82
+ {...props}
83
+ >
84
+ {[0, 1, 2].map((i) => (
85
+ <span
86
+ key={i}
87
+ aria-hidden="true"
88
+ className={cn("rounded-full bg-current", dotClass)}
89
+ style={{
90
+ animation: "typing-dot 1.2s ease-in-out infinite",
91
+ animationDelay: `${i * 0.2}s`,
92
+ }}
93
+ />
94
+ ))}
95
+ </span>
96
+ )
97
+ }
98
+
99
+ export { LoadingDots, loadingDotsVariants }
@@ -0,0 +1,296 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
5
+
6
+ import { cn } from "../../lib/utils"
7
+ import { Button } from "./button"
8
+
9
+ export interface MonthPickerProps {
10
+ /** Controlled selected month. The day-of-month is normalized to the 1st. */
11
+ value?: Date
12
+ /** Uncontrolled initial selection. */
13
+ defaultValue?: Date
14
+ /** Fires with the first day of the picked month (local time). */
15
+ onChange?: (date: Date) => void
16
+ /** Disables the entire control — year navigation and every month cell. */
17
+ disabled?: boolean
18
+ /**
19
+ * Predicate disabling specific months. Receives the first day of the
20
+ * candidate month (local time) — never rely on the day-of-month.
21
+ */
22
+ disabledMonths?: (date: Date) => boolean
23
+ className?: string
24
+ id?: string
25
+ }
26
+
27
+ // Explicit locale so server and client render identical labels (no hydration
28
+ // mismatch) — same convention as FormatNumber.
29
+ const MONTH_SHORT = Array.from({ length: 12 }, (_, m) =>
30
+ new Date(2000, m, 1).toLocaleString("en-US", { month: "short" })
31
+ )
32
+ const MONTH_LONG = Array.from({ length: 12 }, (_, m) =>
33
+ new Date(2000, m, 1).toLocaleString("en-US", { month: "long" })
34
+ )
35
+
36
+ // 3-column × 4-row month grid — the cross-library consensus shape
37
+ // (Mantine MonthPicker, MUI-X MonthCalendar, Ant Design picker="month",
38
+ // Ark UI DatePicker view=month).
39
+ const ROWS = [
40
+ [0, 1, 2],
41
+ [3, 4, 5],
42
+ [6, 7, 8],
43
+ [9, 10, 11],
44
+ ]
45
+
46
+ /**
47
+ * Calendar grid of 12 month cells for a given year — yields a month + year
48
+ * selection without drilling into individual dates. Use for billing periods,
49
+ * report month filters, and archive navigation; for a specific day, use
50
+ * DatePicker instead.
51
+ *
52
+ * ARIA grid pattern: grid → row → gridcell buttons with roving tabindex.
53
+ * Arrow keys move ±1 / ±3 months, Home/End jump to first/last enabled month,
54
+ * PageUp/PageDown page the displayed year.
55
+ */
56
+ function MonthPicker({
57
+ value,
58
+ defaultValue,
59
+ onChange,
60
+ disabled = false,
61
+ disabledMonths,
62
+ className,
63
+ id,
64
+ }: MonthPickerProps) {
65
+ const isControlled = value !== undefined
66
+ const [internalValue, setInternalValue] = React.useState<Date | undefined>(
67
+ defaultValue
68
+ )
69
+ const selected = isControlled ? value : internalValue
70
+
71
+ const [viewYear, setViewYear] = React.useState<number>(() =>
72
+ (selected ?? new Date()).getFullYear()
73
+ )
74
+ // Roving tabindex: the month index the user last focused, if any.
75
+ const [focusedMonth, setFocusedMonth] = React.useState<number | null>(null)
76
+ const cellRefs = React.useRef<Array<HTMLButtonElement | null>>([])
77
+
78
+ // Follow a controlled value into its year so the selection stays visible.
79
+ const valueTime = value?.getTime()
80
+ React.useEffect(() => {
81
+ if (valueTime !== undefined) {
82
+ setViewYear(new Date(valueTime).getFullYear())
83
+ }
84
+ }, [valueTime])
85
+
86
+ const isMonthDisabled = React.useCallback(
87
+ (month: number) =>
88
+ disabled || (disabledMonths?.(new Date(viewYear, month, 1)) ?? false),
89
+ [disabled, disabledMonths, viewYear]
90
+ )
91
+
92
+ const today = new Date()
93
+ const selectedMonthInView =
94
+ selected && selected.getFullYear() === viewYear ? selected.getMonth() : null
95
+ const todayMonthInView =
96
+ today.getFullYear() === viewYear ? today.getMonth() : null
97
+
98
+ // Which cell carries tabIndex=0: last-focused, else selected, else today's
99
+ // month, else the first enabled month in the displayed year.
100
+ // When every cell is disabled (disabled prop or disabledMonths covers all 12)
101
+ // no button can carry tabIndex=0 — the grid div itself becomes the tab stop.
102
+ const allDisabled = React.useMemo(
103
+ () => Array.from({ length: 12 }, (_, m) => m).every((m) => isMonthDisabled(m)),
104
+ [isMonthDisabled]
105
+ )
106
+
107
+ const defaultTabbable = React.useMemo(() => {
108
+ if (selectedMonthInView !== null && !isMonthDisabled(selectedMonthInView)) {
109
+ return selectedMonthInView
110
+ }
111
+ if (todayMonthInView !== null && !isMonthDisabled(todayMonthInView)) {
112
+ return todayMonthInView
113
+ }
114
+ for (let m = 0; m < 12; m++) {
115
+ if (!isMonthDisabled(m)) return m
116
+ }
117
+ return 0
118
+ }, [selectedMonthInView, todayMonthInView, isMonthDisabled])
119
+ const tabbableMonth =
120
+ focusedMonth !== null && !isMonthDisabled(focusedMonth)
121
+ ? focusedMonth
122
+ : defaultTabbable
123
+
124
+ function selectMonth(month: number) {
125
+ if (isMonthDisabled(month)) return
126
+ const next = new Date(viewYear, month, 1)
127
+ if (!isControlled) setInternalValue(next)
128
+ onChange?.(next)
129
+ }
130
+
131
+ function focusCell(month: number) {
132
+ cellRefs.current[month]?.focus()
133
+ }
134
+
135
+ function handleGridKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
136
+ const from = focusedMonth ?? tabbableMonth
137
+ let delta = 0
138
+ switch (event.key) {
139
+ case "ArrowLeft":
140
+ delta = -1
141
+ break
142
+ case "ArrowRight":
143
+ delta = 1
144
+ break
145
+ case "ArrowUp":
146
+ delta = -3
147
+ break
148
+ case "ArrowDown":
149
+ delta = 3
150
+ break
151
+ case "Home": {
152
+ event.preventDefault()
153
+ for (let m = 0; m < 12; m++) {
154
+ if (!isMonthDisabled(m)) {
155
+ focusCell(m)
156
+ return
157
+ }
158
+ }
159
+ return
160
+ }
161
+ case "End": {
162
+ event.preventDefault()
163
+ for (let m = 11; m >= 0; m--) {
164
+ if (!isMonthDisabled(m)) {
165
+ focusCell(m)
166
+ return
167
+ }
168
+ }
169
+ return
170
+ }
171
+ case "PageUp":
172
+ event.preventDefault()
173
+ if (!disabled) setViewYear((y) => y - 1)
174
+ return
175
+ case "PageDown":
176
+ event.preventDefault()
177
+ if (!disabled) setViewYear((y) => y + 1)
178
+ return
179
+ default:
180
+ return
181
+ }
182
+ event.preventDefault()
183
+ // Skip over disabled cells in the direction of travel.
184
+ let next = from + delta
185
+ while (next >= 0 && next <= 11 && isMonthDisabled(next)) {
186
+ next += delta
187
+ }
188
+ if (next < 0 || next > 11) return
189
+ focusCell(next)
190
+ }
191
+
192
+ return (
193
+ <div
194
+ id={id}
195
+ data-slot="month-picker"
196
+ data-disabled={disabled || undefined}
197
+ className={cn("w-fit bg-background p-3", className)}
198
+ >
199
+ <div
200
+ data-slot="month-picker-header"
201
+ className="mb-2 flex items-center justify-between gap-1"
202
+ >
203
+ <Button
204
+ type="button"
205
+ variant="ghost"
206
+ size="icon-xl"
207
+ aria-label="Previous year"
208
+ disabled={disabled}
209
+ onClick={() => setViewYear((y) => y - 1)}
210
+ >
211
+ <ChevronLeftIcon strokeWidth={1.5} aria-hidden="true" />
212
+ </Button>
213
+ <span
214
+ aria-live="polite"
215
+ className={cn(
216
+ "text-sm font-medium tabular-nums select-none",
217
+ disabled ? "text-muted-foreground" : "text-foreground"
218
+ )}
219
+ >
220
+ {viewYear}
221
+ </span>
222
+ <Button
223
+ type="button"
224
+ variant="ghost"
225
+ size="icon-xl"
226
+ aria-label="Next year"
227
+ disabled={disabled}
228
+ onClick={() => setViewYear((y) => y + 1)}
229
+ >
230
+ <ChevronRightIcon strokeWidth={1.5} aria-hidden="true" />
231
+ </Button>
232
+ </div>
233
+ <div
234
+ role="grid"
235
+ aria-label="Month picker"
236
+ aria-disabled={disabled || undefined}
237
+ data-slot="month-picker-grid"
238
+ tabIndex={allDisabled ? 0 : -1}
239
+ onKeyDown={handleGridKeyDown}
240
+ className="w-64 space-y-1"
241
+ >
242
+ {ROWS.map((row) => (
243
+ <div key={row[0]} role="row" className="grid grid-cols-3 gap-1">
244
+ {row.map((month) => {
245
+ const isSelected = selectedMonthInView === month
246
+ const isToday = todayMonthInView === month
247
+ const isDisabled = isMonthDisabled(month)
248
+ return (
249
+ <button
250
+ key={month}
251
+ ref={(el) => {
252
+ cellRefs.current[month] = el
253
+ }}
254
+ type="button"
255
+ role="gridcell"
256
+ data-slot="month-picker-cell"
257
+ data-selected={isSelected || undefined}
258
+ data-today={isToday || undefined}
259
+ aria-label={`${MONTH_LONG[month]} ${viewYear}`}
260
+ aria-selected={isSelected}
261
+ aria-disabled={isDisabled || undefined}
262
+ disabled={isDisabled}
263
+ tabIndex={!isDisabled && month === tabbableMonth ? 0 : -1}
264
+ onClick={() => selectMonth(month)}
265
+ onFocus={() => setFocusedMonth(month)}
266
+ // Motion pattern (c): token-driven one-off transition —
267
+ // never Tailwind duration-* classes (silent failure in v4).
268
+ style={{
269
+ transitionDuration: "var(--duration-fast)",
270
+ transitionTimingFunction: "var(--ease-out)",
271
+ }}
272
+ className={cn(
273
+ "inline-flex min-h-11 items-center justify-center rounded-md px-2 py-2 text-sm select-none",
274
+ "transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
275
+ "disabled:pointer-events-none disabled:opacity-50",
276
+ isSelected
277
+ ? "bg-primary text-primary-foreground hover:bg-primary/90"
278
+ : "text-foreground hover:bg-accent hover:text-accent-foreground",
279
+ // Today's month: underline + weight, never color alone.
280
+ isToday &&
281
+ !isSelected &&
282
+ "font-medium text-primary underline underline-offset-4"
283
+ )}
284
+ >
285
+ {MONTH_SHORT[month]}
286
+ </button>
287
+ )
288
+ })}
289
+ </div>
290
+ ))}
291
+ </div>
292
+ </div>
293
+ )
294
+ }
295
+
296
+ export { MonthPicker }
@@ -120,21 +120,23 @@ function MultiSelect({
120
120
  <Badge
121
121
  key={opt.value}
122
122
  variant="secondary"
123
- className="gap-1 pr-1 font-normal py-0 min-h-6"
123
+ className={cn("gap-1 font-normal py-0 min-h-6", !disabled && "pr-1")}
124
124
  >
125
125
  <span className="truncate max-w-[120px]">{opt.label}</span>
126
- <button
127
- type="button"
128
- aria-label={`Remove ${opt.label}`}
129
- onClick={(e) => removeAt(opt.value, e)}
130
- className="pointer-events-auto h-6 w-6 flex items-center justify-center rounded-sm opacity-60 hover:opacity-100 outline-none focus-visible:ring-1 focus-visible:ring-ring transition-opacity"
131
- style={{
132
- transitionDuration: "var(--duration-fast)",
133
- transitionTimingFunction: "var(--ease-out)",
134
- }}
135
- >
136
- <XIcon size={10} strokeWidth={1.5} />
137
- </button>
126
+ {!disabled && (
127
+ <button
128
+ type="button"
129
+ aria-label={`Remove ${opt.label}`}
130
+ onClick={(e) => removeAt(opt.value, e)}
131
+ className="pointer-events-auto h-6 w-6 flex items-center justify-center rounded-sm opacity-60 hover:opacity-100 outline-none focus-visible:ring-1 focus-visible:ring-ring transition-opacity"
132
+ style={{
133
+ transitionDuration: "var(--duration-fast)",
134
+ transitionTimingFunction: "var(--ease-out)",
135
+ }}
136
+ >
137
+ <XIcon size={10} strokeWidth={1.5} />
138
+ </button>
139
+ )}
138
140
  </Badge>
139
141
  ))}
140
142
  {overflowCount > 0 && (