@behavioral-agentic-design-system/core 0.27.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 (113) hide show
  1. package/package.json +5 -5
  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 +5735 -2500
  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 +91 -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/ai-badge.tsx +74 -0
  17. package/src/components/ui/alert.tsx +12 -0
  18. package/src/components/ui/badge.tsx +19 -0
  19. package/src/components/ui/chat-bubble.tsx +298 -0
  20. package/src/components/ui/chat-marker.tsx +120 -0
  21. package/src/components/ui/checkbox.tsx +9 -1
  22. package/src/components/ui/clipboard.tsx +291 -0
  23. package/src/components/ui/close-button.tsx +71 -0
  24. package/src/components/ui/combobox.tsx +62 -3
  25. package/src/components/ui/container.tsx +65 -0
  26. package/src/components/ui/copy-button.tsx +5 -1
  27. package/src/components/ui/data-table.tsx +388 -0
  28. package/src/components/ui/date-field.tsx +368 -0
  29. package/src/components/ui/drawer.tsx +334 -0
  30. package/src/components/ui/file-button.tsx +145 -0
  31. package/src/components/ui/floating-indicator.tsx +217 -0
  32. package/src/components/ui/focus-trap.tsx +184 -0
  33. package/src/components/ui/format-byte.tsx +113 -0
  34. package/src/components/ui/index.ts +28 -0
  35. package/src/components/ui/input.tsx +38 -3
  36. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  37. package/src/components/ui/loading-dots.tsx +99 -0
  38. package/src/components/ui/mark.tsx +69 -0
  39. package/src/components/ui/month-picker.tsx +296 -0
  40. package/src/components/ui/multi-select.tsx +15 -13
  41. package/src/components/ui/nav-link.tsx +200 -0
  42. package/src/components/ui/navigation-rail.tsx +256 -0
  43. package/src/components/ui/notification.tsx +20 -0
  44. package/src/components/ui/password-input.tsx +34 -1
  45. package/src/components/ui/progress.tsx +15 -1
  46. package/src/components/ui/prose.tsx +62 -0
  47. package/src/components/ui/result.tsx +151 -0
  48. package/src/components/ui/rolling-number.tsx +201 -0
  49. package/src/components/ui/simple-grid.tsx +110 -0
  50. package/src/components/ui/skeleton.tsx +52 -3
  51. package/src/components/ui/squircle.tsx +274 -0
  52. package/src/components/ui/stack.tsx +105 -0
  53. package/src/components/ui/status-badge.tsx +93 -0
  54. package/src/components/ui/tabs.tsx +34 -7
  55. package/src/components/ui/tag.tsx +46 -5
  56. package/src/components/ui/theme-icon.tsx +138 -0
  57. package/src/components/ui/timeline.tsx +27 -10
  58. package/src/components/ui/tooltip.tsx +12 -1
  59. package/src/components/ui/tree-select.tsx +386 -0
  60. package/src/components/ui/typing-indicator.tsx +2 -2
  61. package/src/components/ui/word-rotate.tsx +6 -1
  62. package/src/components/ui/year-picker.tsx +307 -0
  63. package/src/data/docs-index.ts +10 -0
  64. package/src/hooks/use-global-primary-color.ts +57 -6
  65. package/src/stories/AiBadge.stories.tsx +67 -0
  66. package/src/stories/Alert.stories.tsx +31 -1
  67. package/src/stories/Badge.stories.tsx +63 -6
  68. package/src/stories/ChatBubble.stories.tsx +222 -0
  69. package/src/stories/ChatMarker.stories.tsx +59 -0
  70. package/src/stories/Checkbox.stories.tsx +5 -0
  71. package/src/stories/Clipboard.stories.tsx +136 -0
  72. package/src/stories/CloseButton.stories.tsx +65 -0
  73. package/src/stories/Combobox.stories.tsx +74 -3
  74. package/src/stories/Container.stories.tsx +134 -0
  75. package/src/stories/CopyButton.stories.tsx +2 -0
  76. package/src/stories/DataTable.stories.tsx +271 -0
  77. package/src/stories/DateField.stories.tsx +114 -0
  78. package/src/stories/Drawer.stories.tsx +211 -0
  79. package/src/stories/FileButton.stories.tsx +117 -0
  80. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  81. package/src/stories/FocusTrap.stories.tsx +218 -0
  82. package/src/stories/FormatByte.stories.tsx +142 -0
  83. package/src/stories/Input.stories.tsx +91 -0
  84. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  85. package/src/stories/LoadingDots.stories.tsx +73 -0
  86. package/src/stories/Mark.stories.tsx +84 -0
  87. package/src/stories/MonthPicker.stories.tsx +99 -0
  88. package/src/stories/MultiSelect.stories.tsx +3 -1
  89. package/src/stories/NavLink.stories.tsx +213 -0
  90. package/src/stories/NavigationRail.stories.tsx +413 -0
  91. package/src/stories/Notification.stories.tsx +53 -0
  92. package/src/stories/PasswordInput.stories.tsx +21 -0
  93. package/src/stories/Progress.stories.tsx +38 -0
  94. package/src/stories/Prose.stories.tsx +232 -0
  95. package/src/stories/Result.stories.tsx +145 -0
  96. package/src/stories/RollingNumber.stories.tsx +226 -0
  97. package/src/stories/SimpleGrid.stories.tsx +130 -0
  98. package/src/stories/Skeleton.stories.tsx +62 -1
  99. package/src/stories/Squircle.stories.tsx +127 -0
  100. package/src/stories/Stack.stories.tsx +139 -0
  101. package/src/stories/StatusBadge.stories.tsx +125 -0
  102. package/src/stories/Tabs.stories.tsx +56 -1
  103. package/src/stories/Tag.stories.tsx +31 -0
  104. package/src/stories/ThemeIcon.stories.tsx +97 -0
  105. package/src/stories/Timeline.stories.tsx +69 -0
  106. package/src/stories/Tooltip.stories.tsx +18 -0
  107. package/src/stories/TreeSelect.stories.tsx +222 -0
  108. package/src/stories/TypingIndicator.stories.tsx +1 -0
  109. package/src/stories/WordRotate.stories.tsx +1 -0
  110. package/src/stories/YearPicker.stories.tsx +100 -0
  111. package/src/styles.css +289 -15
  112. package/src/tokens.json +96 -1
  113. package/LICENSE +0 -21
@@ -42,6 +42,37 @@ export const Variant_Info: Story = {
42
42
  render: () => <Tag variant="info" label="Info" />,
43
43
  };
44
44
 
45
+ // Size stories use real strings from content/personas/bads.json → primary.jargon
46
+ // (the real-content rule — no placeholder labels). Each size shows a plain tag
47
+ // and a dismissible one so the scaled close button is covered by Chromatic.
48
+ export const Size_XS: Story = {
49
+ render: () => (<div className="flex items-center gap-2 flex-wrap">
50
+ <Tag size="xs" label="token drift" />
51
+ <Tag size="xs" variant="info" label="visual regression" onClose={() => {}} />
52
+ </div>),
53
+ };
54
+
55
+ export const Size_SM: Story = {
56
+ render: () => (<div className="flex items-center gap-2 flex-wrap">
57
+ <Tag size="sm" label="design tokens" />
58
+ <Tag size="sm" variant="success" label="a11y contract" onClose={() => {}} />
59
+ </div>),
60
+ };
61
+
62
+ export const Size_MD: Story = {
63
+ render: () => (<div className="flex items-center gap-2 flex-wrap">
64
+ <Tag size="md" label="semantic layer" />
65
+ <Tag size="md" variant="warning" label="anti-pattern" onClose={() => {}} />
66
+ </div>),
67
+ };
68
+
69
+ export const Size_LG: Story = {
70
+ render: () => (<div className="flex items-center gap-2 flex-wrap">
71
+ <Tag size="lg" label="Radix primitive" />
72
+ <Tag size="lg" variant="error" label="focus trap" onClose={() => {}} />
73
+ </div>),
74
+ };
75
+
45
76
  export const RealisticUse: Story = {
46
77
  render: () => (<div className="flex items-center gap-2 flex-wrap">
47
78
  <Tag label="Design" onClose={() => {}} />
@@ -0,0 +1,97 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { PaletteIcon, StarIcon } from "lucide-react";
4
+ import { ThemeIcon } from "@behavioral-agentic-design-system/core/components/ui/theme-icon";
5
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
6
+
7
+ const meta: Meta<typeof ThemeIcon> = {
8
+ title: "Components/ThemeIcon",
9
+ component: ThemeIcon,
10
+ parameters: {
11
+ layout: "centered",
12
+ docs: {
13
+ description: {
14
+ component:
15
+ "Renders the icon for the active theme — Sun in light mode, Moon in dark mode — with a token-driven spring crossfade on theme change. Reads `data-theme` on <html>, then the `dark` class, then `prefers-color-scheme`; renders a neutral placeholder on the server so hydration never flashes the wrong icon. Decorative (`aria-hidden`) — the wrapping toggle carries the accessible label. Toggle Storybook's theme (or the story below) to see it flip.",
16
+ },
17
+ },
18
+ },
19
+ tags: ["autodocs"],
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const Default: Story = {
26
+ render: () => <ThemeIcon />,
27
+ };
28
+
29
+ export const Size_Small: Story = {
30
+ render: () => <ThemeIcon size={12} />,
31
+ };
32
+
33
+ export const Size_Large: Story = {
34
+ render: () => <ThemeIcon size={24} />,
35
+ };
36
+
37
+ export const WithCustomIcons: Story = {
38
+ render: () => (
39
+ <ThemeIcon
40
+ size={24}
41
+ lightIcon={<PaletteIcon size={24} strokeWidth={1.5} />}
42
+ darkIcon={<StarIcon size={24} strokeWidth={1.5} />}
43
+ />
44
+ ),
45
+ };
46
+
47
+ /**
48
+ * ThemeIcon has no disabled state — it is display-only and never interactive.
49
+ * The frozen equivalent: pass the same node to both slots so the icon never
50
+ * swaps, e.g. for a "follows system" row where the mode is not a choice.
51
+ */
52
+ export const Static: Story = {
53
+ render: () => (
54
+ <ThemeIcon
55
+ size={24}
56
+ lightIcon={<StarIcon size={24} strokeWidth={1.5} />}
57
+ darkIcon={<StarIcon size={24} strokeWidth={1.5} />}
58
+ />
59
+ ),
60
+ };
61
+
62
+ function ThemeToggleDemo() {
63
+ const [dark, setDark] = React.useState(
64
+ () =>
65
+ typeof document !== "undefined" &&
66
+ document.documentElement.classList.contains("dark"),
67
+ );
68
+ const toggle = () => {
69
+ const next = !dark;
70
+ document.documentElement.classList.toggle("dark", next);
71
+ setDark(next);
72
+ };
73
+ return (
74
+ <div className="flex w-72 items-center justify-between rounded-lg border border-border bg-card p-4">
75
+ <div className="space-y-0.5">
76
+ <p className="text-sm font-medium text-foreground">Appearance</p>
77
+ <p className="text-xs text-muted-foreground">
78
+ Currently {dark ? "dark" : "light"} for seoyun.park@figma.com
79
+ </p>
80
+ </div>
81
+ <Button
82
+ variant="outline"
83
+ size="icon-xl"
84
+ aria-label={dark ? "Switch to light mode" : "Switch to dark mode"}
85
+ aria-pressed={dark}
86
+ onClick={toggle}
87
+ >
88
+ {/* size 20 matches the icon-xl Button's forced svg size (size-5) */}
89
+ <ThemeIcon size={20} />
90
+ </Button>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ export const RealisticUse: Story = {
96
+ render: () => <ThemeToggleDemo />,
97
+ };
@@ -296,6 +296,75 @@ export const Variant_AlternateWithIcons: Story = {
296
296
  ),
297
297
  };
298
298
 
299
+ // Horizontal orientation: step-progress row, dots above content.
300
+ // Connector line runs through all dot centers; last item's connector hidden.
301
+ export const Variant_Horizontal: Story = {
302
+ render: () => (
303
+ <div className="w-full max-w-2xl">
304
+ <Timeline orientation="horizontal">
305
+ <TimelineItem
306
+ status="complete"
307
+ title="Branch cut"
308
+ description="release/2.5.0 branched"
309
+ time="Jun 20"
310
+ />
311
+ <TimelineItem
312
+ status="complete"
313
+ title="Token sync"
314
+ description="142 variables pulled"
315
+ time="Jun 21"
316
+ />
317
+ <TimelineItem
318
+ status="active"
319
+ title="Audit"
320
+ description="12 of 18 done"
321
+ time="Jun 25"
322
+ />
323
+ <TimelineItem
324
+ status="pending"
325
+ title="Release"
326
+ description="npm + Storybook"
327
+ time="Jun 28"
328
+ />
329
+ </Timeline>
330
+ </div>
331
+ ),
332
+ };
333
+
334
+ // Horizontal with icons — same step-indicator pattern, custom dot icons.
335
+ export const Variant_HorizontalWithIcons: Story = {
336
+ render: () => (
337
+ <div className="w-full max-w-2xl">
338
+ <Timeline orientation="horizontal">
339
+ <TimelineItem
340
+ status="complete"
341
+ icon={<UserCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
342
+ title="Account created"
343
+ time="Step 1"
344
+ />
345
+ <TimelineItem
346
+ status="complete"
347
+ icon={<CreditCardIcon className="size-3" strokeWidth={1.5} aria-hidden />}
348
+ title="Plan selected"
349
+ time="Step 2"
350
+ />
351
+ <TimelineItem
352
+ status="active"
353
+ icon={<ClipboardCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
354
+ title="Configuring"
355
+ time="Step 3"
356
+ />
357
+ <TimelineItem
358
+ status="pending"
359
+ icon={<TrophyIcon className="size-3" strokeWidth={1.5} aria-hidden />}
360
+ title="You're live"
361
+ time="Step 4"
362
+ />
363
+ </Timeline>
364
+ </div>
365
+ ),
366
+ };
367
+
299
368
  // Realistic use: BADS Design System, v2.4.0 release journey
300
369
  export const RealisticUse: Story = {
301
370
  render: () => (
@@ -35,3 +35,21 @@ export const RealisticUse: Story = {
35
35
  </Tooltip>
36
36
  </TooltipProvider>),
37
37
  };
38
+
39
+ // TooltipContent is an INVERTED surface (bg-foreground text-background). A
40
+ // de-emphasized second line must use `text-background/70`, NOT
41
+ // `text-muted-foreground` — the latter is calibrated to pair against the normal
42
+ // background and collapses to ~2:1 (fails WCAG) on the inverted box. This story
43
+ // is the canonical demonstration of the correct pattern; see tooltip.tsx's
44
+ // inverted-surface note and the Tooltip registry antiPattern.
45
+ export const DeEmphasizedText: Story = {
46
+ render: () => (<TooltipProvider>
47
+ <Tooltip>
48
+ <TooltipTrigger asChild><Button variant="outline">Contrast ratio</Button></TooltipTrigger>
49
+ <TooltipContent className="flex flex-col gap-0.5">
50
+ <span className="font-medium">7.36:1 — passes AAA</span>
51
+ <span className="text-background/70">WCAG 1.4.6 requires 7:1 for normal text</span>
52
+ </TooltipContent>
53
+ </Tooltip>
54
+ </TooltipProvider>),
55
+ };
@@ -0,0 +1,222 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import {
4
+ TreeSelect,
5
+ type TreeSelectNode,
6
+ } from "@behavioral-agentic-design-system/core/components/ui/tree-select";
7
+
8
+ const meta: Meta<typeof TreeSelect> = {
9
+ title: "Components/TreeSelect",
10
+ component: TreeSelect,
11
+ parameters: { layout: "centered" },
12
+ tags: ["autodocs"],
13
+ };
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof TreeSelect>;
17
+
18
+ // Real content: the BADS 10-layer stack as a browsable taxonomy
19
+ // (content/personas/bads.json — jargon + system vocabulary).
20
+ const systemLayers: TreeSelectNode[] = [
21
+ {
22
+ value: "foundation",
23
+ label: "Foundation",
24
+ children: [
25
+ { value: "voice-and-tone", label: "Voice & tone" },
26
+ { value: "language", label: "Language" },
27
+ { value: "microcopy", label: "Microcopy" },
28
+ { value: "personas", label: "Personas" },
29
+ ],
30
+ },
31
+ {
32
+ value: "tokens",
33
+ label: "Design tokens",
34
+ children: [
35
+ { value: "primitive-tokens", label: "Primitive tokens" },
36
+ { value: "semantic-tokens", label: "Semantic tokens" },
37
+ {
38
+ value: "motion-tokens",
39
+ label: "Motion",
40
+ children: [
41
+ { value: "durations", label: "Durations (180ms transition)" },
42
+ { value: "easings", label: "Easings" },
43
+ ],
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ value: "components",
49
+ label: "Component registry",
50
+ children: [
51
+ { value: "a11y-contracts", label: "A11y contracts" },
52
+ { value: "cva-variants", label: "CVA variants" },
53
+ { value: "anti-patterns", label: "Anti-patterns" },
54
+ ],
55
+ },
56
+ ];
57
+
58
+ // Team structure for the multi-select review-request scenario
59
+ // (names from the primary persona pool).
60
+ const reviewers: TreeSelectNode[] = [
61
+ {
62
+ value: "design-systems",
63
+ label: "Design systems",
64
+ children: [
65
+ { value: "jordan-reeves", label: "Jordan Reeves" },
66
+ { value: "seoyun-park", label: "Seo-yun Park" },
67
+ { value: "anika-patel", label: "Anika Patel" },
68
+ ],
69
+ },
70
+ {
71
+ value: "platform",
72
+ label: "Platform engineering",
73
+ children: [
74
+ { value: "marcus-lindqvist", label: "Marcus Lindqvist" },
75
+ { value: "tomas-herrera", label: "Tomás Herrera" },
76
+ ],
77
+ },
78
+ {
79
+ value: "product",
80
+ label: "Product",
81
+ children: [
82
+ { value: "yuki-tanaka", label: "Yuki Tanaka" },
83
+ { value: "kofi-asante", label: "Kofi Asante", disabled: true },
84
+ ],
85
+ },
86
+ ];
87
+
88
+ // Docs destination tree for RealisticUse (urls from the persona pool).
89
+ const docsTree: TreeSelectNode[] = [
90
+ {
91
+ value: "docs",
92
+ label: "Docs",
93
+ children: [
94
+ { value: "getting-started", label: "Getting started" },
95
+ {
96
+ value: "guides",
97
+ label: "Guides",
98
+ children: [
99
+ { value: "token-pipeline", label: "Token pipeline" },
100
+ { value: "storybook-coverage", label: "Storybook coverage" },
101
+ ],
102
+ },
103
+ { value: "proposals", label: "Proposals" },
104
+ ],
105
+ },
106
+ {
107
+ value: "shared",
108
+ label: "Shared with team",
109
+ children: [
110
+ { value: "reviews", label: "Reviews" },
111
+ { value: "archive", label: "Archive" },
112
+ ],
113
+ },
114
+ ];
115
+
116
+ export const Default: Story = {
117
+ render: () => {
118
+ const [value, setValue] = React.useState<string | string[]>("");
119
+ return (
120
+ <div className="w-80">
121
+ <TreeSelect
122
+ data={systemLayers}
123
+ value={value}
124
+ onChange={setValue}
125
+ placeholder="Select a layer…"
126
+ aria-label="System layer"
127
+ defaultExpanded={["foundation"]}
128
+ />
129
+ {typeof value === "string" && value && (
130
+ <p className="mt-2 text-sm text-muted-foreground">Selected: {value}</p>
131
+ )}
132
+ </div>
133
+ );
134
+ },
135
+ };
136
+
137
+ export const Multiple: Story = {
138
+ render: () => {
139
+ const [value, setValue] = React.useState<string | string[]>([
140
+ "jordan-reeves",
141
+ "seoyun-park",
142
+ ]);
143
+ return (
144
+ <div className="w-80">
145
+ <TreeSelect
146
+ multiple
147
+ data={reviewers}
148
+ value={value}
149
+ onChange={setValue}
150
+ placeholder="Add reviewers…"
151
+ aria-label="Reviewers"
152
+ defaultExpanded={["design-systems", "platform"]}
153
+ />
154
+ {Array.isArray(value) && (
155
+ <p className="mt-2 text-sm text-muted-foreground">
156
+ {value.length} reviewer{value.length === 1 ? "" : "s"} selected
157
+ </p>
158
+ )}
159
+ </div>
160
+ );
161
+ },
162
+ };
163
+
164
+ export const Disabled: Story = {
165
+ render: () => (
166
+ <div className="w-80">
167
+ <TreeSelect
168
+ disabled
169
+ data={systemLayers}
170
+ value="semantic-tokens"
171
+ onChange={() => {}}
172
+ aria-label="System layer"
173
+ />
174
+ </div>
175
+ ),
176
+ };
177
+
178
+ export const RealisticUse: Story = {
179
+ render: () => {
180
+ const [destination, setDestination] = React.useState<string | string[]>("");
181
+ const [reviewerValues, setReviewerValues] = React.useState<string | string[]>(
182
+ []
183
+ );
184
+ return (
185
+ <div className="w-[420px] rounded-lg border bg-card p-6 shadow-sm">
186
+ <h3 className="text-base font-semibold">Move proposal</h3>
187
+ <p className="mt-1 text-sm text-muted-foreground">
188
+ tokens-v2-proposal — shared by Jordan Reeves via
189
+ design.bads.com/share/tokens-v2-proposal
190
+ </p>
191
+ <div className="mt-4 space-y-4">
192
+ <div className="space-y-1.5">
193
+ <label id="destination-label" className="text-sm font-medium">
194
+ Destination folder
195
+ </label>
196
+ <TreeSelect
197
+ data={docsTree}
198
+ value={destination}
199
+ onChange={setDestination}
200
+ placeholder="Choose a folder…"
201
+ aria-labelledby="destination-label"
202
+ defaultExpanded={["docs"]}
203
+ />
204
+ </div>
205
+ <div className="space-y-1.5">
206
+ <label id="notify-label" className="text-sm font-medium">
207
+ Notify reviewers
208
+ </label>
209
+ <TreeSelect
210
+ multiple
211
+ data={reviewers}
212
+ value={reviewerValues}
213
+ onChange={setReviewerValues}
214
+ placeholder="Add reviewers…"
215
+ aria-labelledby="notify-label"
216
+ />
217
+ </div>
218
+ </div>
219
+ </div>
220
+ );
221
+ },
222
+ };
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ // sm/default vertical padding bumped (py-1→py-1.5, py-1.5→py-2) for breathing room, 2026-08-06
2
3
  import type { Meta, StoryObj } from "@storybook/react";
3
4
  import { TypingIndicator } from "@behavioral-agentic-design-system/core/components/ui/typing-indicator";
4
5
  import { Avatar, AvatarFallback, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react"
2
+ // word-rotate baseline (inline-block+overflow-hidden dropped the baseline; fixed to align-baseline, 2026-08-06)
2
3
  import { WordRotate } from "@behavioral-agentic-design-system/core/components/ui/word-rotate"
3
4
 
4
5
  const meta: Meta<typeof WordRotate> = {
@@ -0,0 +1,100 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { useState } from "react";
3
+ import { YearPicker } from "@behavioral-agentic-design-system/core/components/ui/year-picker";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
12
+
13
+ const meta: Meta<typeof YearPicker> = {
14
+ title: "Components/YearPicker",
15
+ component: YearPicker,
16
+ parameters: { layout: "centered" },
17
+ tags: ["autodocs"],
18
+ };
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {
24
+ render: () => <YearPicker className="rounded-md border" />,
25
+ };
26
+
27
+ export const Prefilled: Story = {
28
+ render: () => {
29
+ // Persona pool date (content/personas/bads.json → primary.dates): 2026-05-26.
30
+ const [year, setYear] = useState<number | undefined>(2026);
31
+ return (
32
+ <YearPicker
33
+ value={year}
34
+ onValueChange={setYear}
35
+ defaultValue={2026}
36
+ className="rounded-md border"
37
+ />
38
+ );
39
+ },
40
+ };
41
+
42
+ export const Disabled: Story = {
43
+ render: () => (
44
+ // When disabled: grid div gets tabIndex=0 (keyboard-reachable without
45
+ // placing tabIndex=0 on a non-focusable button); year label uses
46
+ // text-muted-foreground instead of opacity-50 to maintain contrast.
47
+ <YearPicker
48
+ disabled
49
+ defaultValue={2026}
50
+ className="rounded-md border"
51
+ />
52
+ ),
53
+ };
54
+
55
+ export const WithMinMax: Story = {
56
+ render: () => {
57
+ // Engagement range: minYear=2020, maxYear=2030. Out-of-range cells
58
+ // render at opacity-40 and are pointer-events-none.
59
+ const [year, setYear] = useState<number | undefined>(2026);
60
+ return (
61
+ <YearPicker
62
+ value={year}
63
+ onValueChange={setYear}
64
+ minYear={2020}
65
+ maxYear={2030}
66
+ className="rounded-md border"
67
+ />
68
+ );
69
+ },
70
+ };
71
+
72
+ export const RealisticUse: Story = {
73
+ render: () => {
74
+ // Persona: Jordan Reeves (content/personas/bads.json → primary.names[0]).
75
+ // Use case: graduation year for a professional profile.
76
+ const [year, setYear] = useState<number | undefined>(2026);
77
+ return (
78
+ <Card className="w-fit">
79
+ <CardHeader>
80
+ <CardTitle>Select graduation year</CardTitle>
81
+ <CardDescription>
82
+ Jordan Reeves — design systems lead, Cohort{" "}
83
+ {year ?? "—"}.
84
+ </CardDescription>
85
+ </CardHeader>
86
+ <CardContent className="space-y-3">
87
+ <Label htmlFor="graduation-year">Graduation year</Label>
88
+ <YearPicker
89
+ id="graduation-year"
90
+ value={year}
91
+ onValueChange={setYear}
92
+ minYear={2000}
93
+ maxYear={2030}
94
+ className="rounded-md border"
95
+ />
96
+ </CardContent>
97
+ </Card>
98
+ );
99
+ },
100
+ };