@behavioral-agentic-design-system/core 0.24.0 → 0.27.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 (137) hide show
  1. package/package.json +5 -2
  2. package/scripts/build-tokens.cjs +87 -5
  3. package/src/app/preview/components/page.tsx +4745 -244
  4. package/src/app/shell.tsx +18 -6
  5. package/src/components/customize/brand-mark-section.tsx +1 -1
  6. package/src/components/customize-tab.tsx +2 -2
  7. package/src/components/home-tab.tsx +2 -2
  8. package/src/components/ui/action-bar.tsx +142 -0
  9. package/src/components/ui/affix.tsx +109 -0
  10. package/src/components/ui/alert.tsx +37 -3
  11. package/src/components/ui/anchor.tsx +136 -0
  12. package/src/components/ui/angle-slider.tsx +265 -0
  13. package/src/components/ui/autocomplete.tsx +223 -0
  14. package/src/components/ui/avatar.tsx +8 -2
  15. package/src/components/ui/blockquote.tsx +112 -0
  16. package/src/components/ui/bottom-navigation.tsx +144 -0
  17. package/src/components/ui/burger.tsx +117 -0
  18. package/src/components/ui/button.tsx +101 -3
  19. package/src/components/ui/calendar.tsx +1 -1
  20. package/src/components/ui/card.tsx +43 -5
  21. package/src/components/ui/carousel.tsx +10 -5
  22. package/src/components/ui/cascader.tsx +253 -0
  23. package/src/components/ui/checkbox-card.tsx +176 -0
  24. package/src/components/ui/checkbox-group.tsx +231 -0
  25. package/src/components/ui/checkbox.tsx +14 -3
  26. package/src/components/ui/chip.tsx +143 -0
  27. package/src/components/ui/circular-progress.tsx +2 -2
  28. package/src/components/ui/color-swatch.tsx +73 -0
  29. package/src/components/ui/copy-button.tsx +21 -4
  30. package/src/components/ui/date-picker.tsx +6 -3
  31. package/src/components/ui/date-range-picker.tsx +6 -3
  32. package/src/components/ui/float-label.tsx +114 -0
  33. package/src/components/ui/floating-action-button.tsx +179 -0
  34. package/src/components/ui/floating-panel.tsx +129 -0
  35. package/src/components/ui/format-number.tsx +122 -0
  36. package/src/components/ui/highlight.tsx +85 -0
  37. package/src/components/ui/image.tsx +195 -0
  38. package/src/components/ui/index.ts +51 -0
  39. package/src/components/ui/indicator.tsx +2 -2
  40. package/src/components/ui/input.tsx +48 -4
  41. package/src/components/ui/kbd.tsx +1 -1
  42. package/src/components/ui/link.tsx +158 -0
  43. package/src/components/ui/listbox.tsx +426 -0
  44. package/src/components/ui/loading-overlay.tsx +80 -0
  45. package/src/components/ui/marquee.tsx +193 -0
  46. package/src/components/ui/masonry.tsx +164 -0
  47. package/src/components/ui/meter.tsx +186 -0
  48. package/src/components/ui/motion-toggle.tsx +170 -0
  49. package/src/components/ui/notification.tsx +175 -0
  50. package/src/components/ui/overlay.tsx +63 -0
  51. package/src/components/ui/progress.tsx +95 -4
  52. package/src/components/ui/rating-group.tsx +1 -0
  53. package/src/components/ui/separator.tsx +57 -1
  54. package/src/components/ui/sidebar.tsx +1 -1
  55. package/src/components/ui/signature-pad.tsx +381 -0
  56. package/src/components/ui/skeleton.tsx +59 -2
  57. package/src/components/ui/skip-link.tsx +117 -0
  58. package/src/components/ui/slider.tsx +86 -1
  59. package/src/components/ui/spoiler.tsx +131 -0
  60. package/src/components/ui/tabs.tsx +1 -1
  61. package/src/components/ui/text.tsx +135 -0
  62. package/src/components/ui/textarea.tsx +66 -2
  63. package/src/components/ui/timeline.tsx +71 -14
  64. package/src/components/ui/timer.tsx +183 -0
  65. package/src/components/ui/tour.tsx +332 -0
  66. package/src/components/ui/transfer-list.tsx +343 -0
  67. package/src/components/ui/typing-indicator.tsx +96 -0
  68. package/src/components/ui/visually-hidden.tsx +42 -0
  69. package/src/components/ui/watermark.tsx +0 -0
  70. package/src/components/ui/word-rotate.tsx +82 -0
  71. package/src/data/docs-index.ts +10 -2
  72. package/src/stories/ActionBar.stories.tsx +201 -0
  73. package/src/stories/Affix.stories.tsx +165 -0
  74. package/src/stories/Alert.stories.tsx +58 -0
  75. package/src/stories/Anchor.stories.tsx +236 -0
  76. package/src/stories/AngleSlider.stories.tsx +128 -0
  77. package/src/stories/Autocomplete.stories.tsx +216 -0
  78. package/src/stories/Avatar.stories.tsx +73 -1
  79. package/src/stories/Blockquote.stories.tsx +148 -0
  80. package/src/stories/BottomNavigation.stories.tsx +195 -0
  81. package/src/stories/Burger.stories.tsx +79 -0
  82. package/src/stories/Button.stories.tsx +103 -2
  83. package/src/stories/Calendar.stories.tsx +4 -0
  84. package/src/stories/Card.stories.tsx +30 -0
  85. package/src/stories/Carousel.stories.tsx +2 -1
  86. package/src/stories/Cascader.stories.tsx +285 -0
  87. package/src/stories/Checkbox.stories.tsx +13 -0
  88. package/src/stories/CheckboxCard.stories.tsx +210 -0
  89. package/src/stories/CheckboxGroup.stories.tsx +186 -0
  90. package/src/stories/Chip.stories.tsx +173 -0
  91. package/src/stories/CircularProgress.stories.tsx +3 -0
  92. package/src/stories/ColorSwatch.stories.tsx +81 -0
  93. package/src/stories/CopyButton.stories.tsx +3 -3
  94. package/src/stories/DatePicker.stories.tsx +3 -0
  95. package/src/stories/DateRangePicker.stories.tsx +3 -0
  96. package/src/stories/Editable.stories.tsx +14 -0
  97. package/src/stories/FloatLabel.stories.tsx +148 -0
  98. package/src/stories/FloatingActionButton.stories.tsx +215 -0
  99. package/src/stories/FloatingPanel.stories.tsx +176 -0
  100. package/src/stories/FormatNumber.stories.tsx +308 -0
  101. package/src/stories/Highlight.stories.tsx +140 -0
  102. package/src/stories/Image.stories.tsx +141 -0
  103. package/src/stories/Indicator.stories.tsx +3 -0
  104. package/src/stories/Input.stories.tsx +33 -0
  105. package/src/stories/Kbd.stories.tsx +3 -0
  106. package/src/stories/Link.stories.tsx +198 -0
  107. package/src/stories/Listbox.stories.tsx +240 -0
  108. package/src/stories/LoadingOverlay.stories.tsx +148 -0
  109. package/src/stories/Marquee.stories.tsx +170 -0
  110. package/src/stories/Masonry.stories.tsx +227 -0
  111. package/src/stories/Meter.stories.tsx +150 -0
  112. package/src/stories/MotionToggle.stories.tsx +85 -0
  113. package/src/stories/Notification.stories.tsx +264 -0
  114. package/src/stories/Overlay.stories.tsx +169 -0
  115. package/src/stories/PasswordInput.stories.tsx +4 -0
  116. package/src/stories/Progress.stories.tsx +70 -27
  117. package/src/stories/RatingGroup.stories.tsx +5 -0
  118. package/src/stories/Separator.stories.tsx +41 -5
  119. package/src/stories/Sidebar.stories.tsx +2 -1
  120. package/src/stories/SignaturePad.stories.tsx +112 -0
  121. package/src/stories/Skeleton.stories.tsx +23 -4
  122. package/src/stories/SkipLink.stories.tsx +137 -0
  123. package/src/stories/Slider.stories.tsx +28 -0
  124. package/src/stories/Spoiler.stories.tsx +122 -0
  125. package/src/stories/Tabs.stories.tsx +2 -1
  126. package/src/stories/Text.stories.tsx +191 -0
  127. package/src/stories/Textarea.stories.tsx +58 -6
  128. package/src/stories/Timeline.stories.tsx +82 -0
  129. package/src/stories/Timer.stories.tsx +160 -0
  130. package/src/stories/Tour.stories.tsx +191 -0
  131. package/src/stories/TransferList.stories.tsx +190 -0
  132. package/src/stories/TypingIndicator.stories.tsx +139 -0
  133. package/src/stories/VisuallyHidden.stories.tsx +105 -0
  134. package/src/stories/Watermark.stories.tsx +212 -0
  135. package/src/stories/WordRotate.stories.tsx +101 -0
  136. package/src/styles.css +88 -6
  137. package/src/tokens.json +3 -3
@@ -6,9 +6,12 @@
6
6
  // read as one family. (Accent/border colors use arbitrary `border-[var(--token)]!`
7
7
  // because the named border-color utilities don't emit a rule in this Tailwind v4
8
8
  // setup.) Any change to alertVariants should re-snapshot here in Chromatic.
9
+ // Dismissible + WithAction: onDismiss renders a top-right × button; action
10
+ // renders a row below AlertDescription. Both are optional and compose freely.
9
11
  import type { Meta, StoryObj } from "@storybook/react";
10
12
  import { AlertCircleIcon } from "lucide-react";
11
13
  import { Alert, AlertTitle, AlertDescription } from "@behavioral-agentic-design-system/core/components/ui/alert";
14
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
12
15
  import { Card, CardContent, CardHeader, CardTitle } from "@behavioral-agentic-design-system/core/components/ui/card";
13
16
 
14
17
  const meta: Meta<typeof Alert> = {
@@ -100,3 +103,58 @@ export const RealisticUse: Story = {
100
103
  </div>),
101
104
  };
102
105
 
106
+ export const Dismissible: Story = {
107
+ render: () => (<div className="w-[420px] flex flex-col gap-3">
108
+ <Alert onDismiss={() => {}}>
109
+ <AlertCircleIcon className="h-5 w-5" />
110
+ <AlertTitle>Email not verified</AlertTitle>
111
+ <AlertDescription>Check your inbox or resend the link.</AlertDescription>
112
+ </Alert>
113
+ <Alert variant="destructive" onDismiss={() => {}}>
114
+ <AlertCircleIcon className="h-5 w-5" />
115
+ <AlertTitle>Connection lost</AlertTitle>
116
+ <AlertDescription>Changes may not have been saved.</AlertDescription>
117
+ </Alert>
118
+ </div>),
119
+ };
120
+
121
+ export const WithAction: Story = {
122
+ render: () => (<div className="w-[420px] flex flex-col gap-3">
123
+ <Alert
124
+ action={<Button size="sm" variant="outline">Resend link</Button>}
125
+ >
126
+ <AlertCircleIcon className="h-5 w-5" />
127
+ <AlertTitle>Email not verified</AlertTitle>
128
+ <AlertDescription>We sent a link to your address 3 days ago.</AlertDescription>
129
+ </Alert>
130
+ <Alert
131
+ variant="destructive"
132
+ action={<Button size="sm" variant="outline">Try again</Button>}
133
+ >
134
+ <AlertCircleIcon className="h-5 w-5" />
135
+ <AlertTitle>Save failed</AlertTitle>
136
+ <AlertDescription>Couldn&apos;t reach the server.</AlertDescription>
137
+ </Alert>
138
+ </div>),
139
+ };
140
+
141
+ export const DismissibleWithAction: Story = {
142
+ render: () => (<div className="w-[420px]">
143
+ <Alert
144
+ onDismiss={() => {}}
145
+ action={
146
+ <>
147
+ <Button size="sm" variant="outline">Resend link</Button>
148
+ <Button size="sm" variant="ghost">Remind me later</Button>
149
+ </>
150
+ }
151
+ >
152
+ <AlertCircleIcon className="h-5 w-5" />
153
+ <AlertTitle>Email not verified</AlertTitle>
154
+ <AlertDescription>
155
+ Verify your email to unlock sharing and export features.
156
+ </AlertDescription>
157
+ </Alert>
158
+ </div>),
159
+ };
160
+
@@ -0,0 +1,236 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Anchor } from "@behavioral-agentic-design-system/core/components/ui/anchor";
4
+
5
+ const meta: Meta<typeof Anchor> = {
6
+ title: "Components/Anchor",
7
+ component: Anchor,
8
+ parameters: { layout: "padded" },
9
+ tags: ["autodocs"],
10
+ };
11
+
12
+ export default meta;
13
+ type Story = StoryObj<typeof Anchor>;
14
+
15
+ // Ids are prefixed per story so the autodocs page (which renders every story
16
+ // at once) never produces duplicate DOM ids.
17
+
18
+ function DemoSection({
19
+ id,
20
+ title,
21
+ children,
22
+ }: {
23
+ id: string;
24
+ title: string;
25
+ children: React.ReactNode;
26
+ }) {
27
+ return (
28
+ <section id={id} className="scroll-mt-4 space-y-2 pb-10">
29
+ <h3 className="text-lg font-semibold tracking-tight">{title}</h3>
30
+ <p className="text-sm text-muted-foreground">{children}</p>
31
+ </section>
32
+ );
33
+ }
34
+
35
+ export const Default: Story = {
36
+ render: () => (
37
+ <div className="flex w-[640px] max-w-full gap-8">
38
+ <div className="h-72 min-w-0 flex-1 overflow-y-auto rounded-lg border border-border p-5" tabIndex={0}>
39
+ <DemoSection id="anc-default-overview" title="Overview">
40
+ BADS ships tokens, components, and accessibility contracts as one
41
+ portable system. Fork it, rename it, and every client engagement
42
+ starts from the same AAA baseline.
43
+ </DemoSection>
44
+ <DemoSection id="anc-default-install" title="Installation">
45
+ Run pnpm install, then pnpm build:tokens. The generated styles.css
46
+ carries the full theme — 36 components, 7:1 contrast, 14px minimum
47
+ type, 180ms transitions.
48
+ </DemoSection>
49
+ <DemoSection id="anc-default-tokens" title="Tokens">
50
+ tokens.json is the single source of truth. Edit a value, rebuild, and
51
+ both the published package and the local preview regenerate — never
52
+ hand-edit the CSS.
53
+ </DemoSection>
54
+ <DemoSection id="anc-default-registry" title="Component registry">
55
+ Every primitive declares its props, a11y contract, anti-patterns, and
56
+ cost model in the machine-readable registry that agents read before
57
+ building anything.
58
+ </DemoSection>
59
+ </div>
60
+ <Anchor
61
+ className="w-44 shrink-0"
62
+ items={[
63
+ { id: "anc-default-overview", label: "Overview" },
64
+ { id: "anc-default-install", label: "Installation" },
65
+ { id: "anc-default-tokens", label: "Tokens" },
66
+ { id: "anc-default-registry", label: "Component registry" },
67
+ ]}
68
+ />
69
+ </div>
70
+ ),
71
+ };
72
+
73
+ export const WithGroups: Story = {
74
+ render: () => (
75
+ <div className="flex w-[640px] max-w-full gap-8">
76
+ <div className="h-72 min-w-0 flex-1 overflow-y-auto rounded-lg border border-border p-5" tabIndex={0}>
77
+ <DemoSection id="anc-groups-foundation" title="Foundation">
78
+ Voice, tone, language, and personas — the layer every piece of copy
79
+ checks against before it ships.
80
+ </DemoSection>
81
+ <DemoSection id="anc-groups-voice" title="Voice and tone">
82
+ Four axes: Friendly, Daring, Radiant, Genuine. The voice-check prompt
83
+ scores copy against them.
84
+ </DemoSection>
85
+ <DemoSection id="anc-groups-microcopy" title="Microcopy bank">
86
+ Canonical strings agents reach for first — empty states, errors,
87
+ confirmations.
88
+ </DemoSection>
89
+ <DemoSection id="anc-groups-ethics" title="Ethics and responsibility">
90
+ Ethical floors, anti-patterns, the 10 Core Drives, and the futures
91
+ check that runs before any consent or data surface ships.
92
+ </DemoSection>
93
+ <DemoSection id="anc-groups-futures" title="Futures thinking">
94
+ Six lenses — Scale, Time, Adversary, Behavior, Drift, Equity — run
95
+ against every mandatory-list feature.
96
+ </DemoSection>
97
+ </div>
98
+ <Anchor
99
+ className="w-52 shrink-0"
100
+ label="Sections in this guide"
101
+ items={[
102
+ { id: "anc-groups-foundation", label: "Foundation" },
103
+ { id: "anc-groups-voice", label: "Voice and tone", depth: 1 },
104
+ { id: "anc-groups-microcopy", label: "Microcopy bank", depth: 2 },
105
+ { id: "anc-groups-ethics", label: "Ethics and responsibility" },
106
+ { id: "anc-groups-futures", label: "Futures thinking", depth: 1 },
107
+ ]}
108
+ />
109
+ </div>
110
+ ),
111
+ };
112
+
113
+ export const Sticky: Story = {
114
+ render: () => (
115
+ <div className="h-80 w-[640px] max-w-full overflow-y-auto rounded-lg border border-border">
116
+ <div className="flex gap-8 p-5">
117
+ <div className="min-w-0 flex-1">
118
+ <DemoSection id="anc-sticky-audit" title="Accessibility audit">
119
+ pnpm wcag:audit checks every shipped token pair against the AAA
120
+ floor — 7:1 for text, 3:1 for non-text — and fails CI on any miss.
121
+ </DemoSection>
122
+ <DemoSection id="anc-sticky-contrast" title="Contrast grades">
123
+ The Brand Color picker shows AAA / AA / AA Large / Fail pills so a
124
+ custom color never silently drops below the floor.
125
+ </DemoSection>
126
+ <DemoSection id="anc-sticky-targets" title="Touch targets">
127
+ Every flow-changing control clears 44 by 44 pixels. Compact chrome
128
+ uses the documented dense exception, never a shrunken CTA.
129
+ </DemoSection>
130
+ <DemoSection id="anc-sticky-motion" title="Reduced motion">
131
+ One base-layer media query collapses every animation to 0.01ms for
132
+ users who opt out — components never need their own guard.
133
+ </DemoSection>
134
+ </div>
135
+ <div className="w-44 shrink-0">
136
+ <Anchor
137
+ className="sticky top-4"
138
+ offset={16}
139
+ items={[
140
+ { id: "anc-sticky-audit", label: "Accessibility audit" },
141
+ { id: "anc-sticky-contrast", label: "Contrast grades" },
142
+ { id: "anc-sticky-targets", label: "Touch targets" },
143
+ { id: "anc-sticky-motion", label: "Reduced motion" },
144
+ ]}
145
+ />
146
+ </div>
147
+ </div>
148
+ </div>
149
+ ),
150
+ };
151
+
152
+ export const Customized: Story = {
153
+ render: () => (
154
+ <div className="flex w-[640px] max-w-full gap-8">
155
+ <div className="h-64 min-w-0 flex-1 overflow-y-auto rounded-lg border border-border p-5" tabIndex={0}>
156
+ <DemoSection id="anc-custom-savings" title="Client savings">
157
+ The ROI report prices what an in-house team would have charged to
158
+ build the system from scratch — $182,450 to date.
159
+ </DemoSection>
160
+ <DemoSection id="anc-custom-defects" title="Defect exposure avoided">
161
+ A conservative $24,500 expected value from public accessibility
162
+ filings, sourced line by line in rates.json.
163
+ </DemoSection>
164
+ <DemoSection id="anc-custom-hours" title="Build hours avoided">
165
+ 1,432 engineering and design hours the registry cost models add up
166
+ to across active forks.
167
+ </DemoSection>
168
+ </div>
169
+ <Anchor
170
+ className="w-56 shrink-0 rounded-lg bg-muted/50 p-3"
171
+ label="Report contents"
172
+ items={[
173
+ { id: "anc-custom-savings", label: "Client savings" },
174
+ { id: "anc-custom-defects", label: "Defect exposure avoided" },
175
+ { id: "anc-custom-hours", label: "Build hours avoided" },
176
+ ]}
177
+ />
178
+ </div>
179
+ ),
180
+ };
181
+
182
+ export const RealisticUse: Story = {
183
+ render: () => (
184
+ <div className="w-[720px] max-w-full rounded-lg border border-border bg-card p-6">
185
+ <div className="mb-4 space-y-1">
186
+ <p className="text-lg font-semibold tracking-tight">
187
+ Getting started with BADS
188
+ </p>
189
+ <p className="text-sm text-muted-foreground">
190
+ design.bads.com/docs/getting-started · updated by Jordan Reeves
191
+ </p>
192
+ </div>
193
+ <div className="flex gap-8">
194
+ <div className="h-80 min-w-0 flex-1 overflow-y-auto pr-2" tabIndex={0}>
195
+ <DemoSection id="anc-real-fork" title="Fork and rename">
196
+ Every engagement starts by forking BADS and running pnpm rename
197
+ with the client display name and slug. The npm package name stays
198
+ stable; the localStorage prefix and header follow the new brand.
199
+ </DemoSection>
200
+ <DemoSection id="anc-real-brief" title="Write the brief">
201
+ BRIEF.md is the AI-readable one-pager — mission, audience,
202
+ surfaces, tone, refusals. Until it exists, generated UI reads as
203
+ generic SaaS. Run the onboarding prompts before any client work.
204
+ </DemoSection>
205
+ <DemoSection id="anc-real-tokens" title="Customize tokens">
206
+ Edit tokens.json, run pnpm build:tokens, and both the published
207
+ theme and the local preview regenerate. The wcag audit keeps every
208
+ pair at the 7:1 AAA floor while you tune.
209
+ </DemoSection>
210
+ <DemoSection id="anc-real-components" title="Adopt the components">
211
+ 105 primitives ship with a11y contracts, stories, and cost models.
212
+ The readiness audit gates anything new so the registry never
213
+ grows past what earns its keep.
214
+ </DemoSection>
215
+ <DemoSection id="anc-real-verify" title="Verify and ship">
216
+ pnpm a11y runs the contrast audit, the static lint, and the size
217
+ contract in one pass. Chromatic baselines every story on the next
218
+ push to main.
219
+ </DemoSection>
220
+ </div>
221
+ <div className="w-48 shrink-0">
222
+ <Anchor
223
+ className="sticky top-0"
224
+ items={[
225
+ { id: "anc-real-fork", label: "Fork and rename" },
226
+ { id: "anc-real-brief", label: "Write the brief" },
227
+ { id: "anc-real-tokens", label: "Customize tokens" },
228
+ { id: "anc-real-components", label: "Adopt the components" },
229
+ { id: "anc-real-verify", label: "Verify and ship" },
230
+ ]}
231
+ />
232
+ </div>
233
+ </div>
234
+ </div>
235
+ ),
236
+ };
@@ -0,0 +1,128 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { AngleSlider } from "@behavioral-agentic-design-system/core/components/ui/angle-slider";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardHeader,
8
+ CardTitle,
9
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
10
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
11
+
12
+ const meta: Meta<typeof AngleSlider> = {
13
+ title: "Components/AngleSlider",
14
+ component: AngleSlider,
15
+ parameters: {
16
+ layout: "centered",
17
+ docs: {
18
+ description: {
19
+ component:
20
+ "Circular drag input for selecting angles 0–360°. The whole circle is the focusable role=slider node (every size ≥ 64px, clearing the 44px target floor). Keyboard: arrows ±step, Shift+Arrow ±10×step, Home/End. Value changes ease via var(--duration-base) + var(--ease-out) on keyboard steps and pointer release; tracking is instant during drag. Not for linear ranges — use Slider.",
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof AngleSlider>;
28
+
29
+ function ControlledAngleSlider(
30
+ props: React.ComponentProps<typeof AngleSlider>
31
+ ) {
32
+ const [angle, setAngle] = React.useState(props.defaultValue ?? 45);
33
+ return (
34
+ <div className="flex flex-col items-center gap-3">
35
+ <AngleSlider {...props} value={angle} onChange={setAngle} />
36
+ <p className="text-sm font-medium tabular-nums text-foreground">
37
+ {angle}°
38
+ </p>
39
+ </div>
40
+ );
41
+ }
42
+
43
+ export const Default: Story = {
44
+ render: () => (
45
+ <ControlledAngleSlider defaultValue={45} aria-label="Angle" />
46
+ ),
47
+ };
48
+
49
+ export const Size_Sm: Story = {
50
+ render: () => (
51
+ <ControlledAngleSlider size="sm" defaultValue={45} aria-label="Angle" />
52
+ ),
53
+ };
54
+
55
+ export const Size_Md: Story = {
56
+ render: () => (
57
+ <ControlledAngleSlider size="md" defaultValue={45} aria-label="Angle" />
58
+ ),
59
+ };
60
+
61
+ export const Size_Lg: Story = {
62
+ render: () => (
63
+ <ControlledAngleSlider size="lg" defaultValue={45} aria-label="Angle" />
64
+ ),
65
+ };
66
+
67
+ export const Sizes: Story = {
68
+ render: () => (
69
+ <div className="flex items-end gap-8">
70
+ <ControlledAngleSlider size="sm" defaultValue={45} aria-label="Small angle" />
71
+ <ControlledAngleSlider size="md" defaultValue={135} aria-label="Medium angle" />
72
+ <ControlledAngleSlider size="lg" defaultValue={270} aria-label="Large angle" />
73
+ </div>
74
+ ),
75
+ };
76
+
77
+ export const Disabled: Story = {
78
+ render: () => (
79
+ <AngleSlider disabled defaultValue={135} aria-label="Angle (disabled)" />
80
+ ),
81
+ };
82
+
83
+ export const RealisticUse: Story = {
84
+ render: function RealisticUseStory() {
85
+ // Real content: Jordan Reeves' tokens-v2-proposal share surface
86
+ // (content/personas/bads.json) — tuning the brand gradient angle.
87
+ const [angle, setAngle] = React.useState(135);
88
+ return (
89
+ <Card className="w-80">
90
+ <CardHeader>
91
+ <CardTitle className="text-2xl">Rotation</CardTitle>
92
+ <p className="text-xs text-muted-foreground">
93
+ tokens-v2-proposal · Jordan Reeves
94
+ </p>
95
+ </CardHeader>
96
+ <CardContent className="space-y-4">
97
+ <div className="flex items-center justify-between gap-6">
98
+ <div className="space-y-1">
99
+ <Label htmlFor="gradient-angle-display">Gradient angle</Label>
100
+ <p
101
+ id="gradient-angle-display"
102
+ className="text-sm font-medium tabular-nums text-foreground"
103
+ aria-live="polite"
104
+ >
105
+ {angle}°
106
+ </p>
107
+ <p className="text-xs text-muted-foreground">
108
+ Drives --brand-gradient across hero and share surfaces.
109
+ </p>
110
+ </div>
111
+ <AngleSlider
112
+ value={angle}
113
+ onChange={setAngle}
114
+ aria-label="Gradient angle"
115
+ />
116
+ </div>
117
+ <div
118
+ aria-hidden="true"
119
+ className="h-16 rounded-md border border-border"
120
+ style={{
121
+ backgroundImage: `linear-gradient(${angle}deg, var(--primary), var(--muted))`,
122
+ }}
123
+ />
124
+ </CardContent>
125
+ </Card>
126
+ );
127
+ },
128
+ };
@@ -0,0 +1,216 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Autocomplete } from "@behavioral-agentic-design-system/core/components/ui/autocomplete";
4
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
5
+
6
+ const meta: Meta<typeof Autocomplete> = {
7
+ title: "Components/Autocomplete",
8
+ component: Autocomplete,
9
+ parameters: { layout: "centered" },
10
+ tags: ["autodocs"],
11
+ argTypes: {
12
+ disabled: { control: "boolean" },
13
+ placeholder: { control: "text" },
14
+ size: {
15
+ control: "select",
16
+ options: ["sm", "default", "lg", "xl", "2xl"],
17
+ },
18
+ },
19
+ };
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof Autocomplete>;
23
+
24
+ // Real content from content/personas/bads.json — the primary persona's
25
+ // jargon pool (docs-topic search is the canonical use).
26
+ const TOPICS = [
27
+ "design tokens",
28
+ "semantic layer",
29
+ "a11y contract",
30
+ "CVA variants",
31
+ "Radix primitive",
32
+ "anti-pattern",
33
+ "token drift",
34
+ "visual regression",
35
+ "forced colors",
36
+ "focus trap",
37
+ ];
38
+
39
+ const TEAMMATES = [
40
+ "Jordan Reeves",
41
+ "Seo-yun Park",
42
+ "Marcus Lindqvist",
43
+ "Anika Patel",
44
+ "Tomás Herrera",
45
+ "Yuki Tanaka",
46
+ "Chloé Dubois-Martin",
47
+ "Kofi Asante",
48
+ ];
49
+
50
+ function Controlled({
51
+ initialValue = "",
52
+ ...props
53
+ }: Omit<
54
+ React.ComponentProps<typeof Autocomplete>,
55
+ "value" | "onValueChange"
56
+ > & {
57
+ initialValue?: string;
58
+ }) {
59
+ const [value, setValue] = React.useState(initialValue);
60
+ return (
61
+ <div className="w-80">
62
+ <Autocomplete
63
+ value={value}
64
+ onValueChange={setValue}
65
+ aria-label={props.placeholder ?? "Search"}
66
+ {...props}
67
+ />
68
+ </div>
69
+ );
70
+ }
71
+
72
+ export const Default: Story = {
73
+ render: () => (
74
+ <Controlled options={TOPICS} placeholder="Search docs topics…" />
75
+ ),
76
+ };
77
+
78
+ export const Size_Sm: Story = {
79
+ render: () => (
80
+ <Controlled size="sm" options={TOPICS} placeholder="Search docs topics…" />
81
+ ),
82
+ };
83
+
84
+ export const Size_Lg: Story = {
85
+ render: () => (
86
+ <Controlled size="lg" options={TOPICS} placeholder="Search docs topics…" />
87
+ ),
88
+ };
89
+
90
+ export const Size_Xl: Story = {
91
+ render: () => (
92
+ <Controlled size="xl" options={TOPICS} placeholder="Search docs topics…" />
93
+ ),
94
+ };
95
+
96
+ export const Size_2xl: Story = {
97
+ render: () => (
98
+ <Controlled
99
+ size="2xl"
100
+ options={TOPICS}
101
+ placeholder="Search docs topics…"
102
+ />
103
+ ),
104
+ };
105
+
106
+ // Disabled: the list never opens; Input's disabled styles apply.
107
+ export const Disabled: Story = {
108
+ render: () => (
109
+ <Controlled
110
+ disabled
111
+ initialValue="design tokens"
112
+ options={TOPICS}
113
+ placeholder="Search docs topics…"
114
+ />
115
+ ),
116
+ };
117
+
118
+ // Free text + picked-from-list are distinguishable: onOptionSelect fires
119
+ // only when a suggestion is committed, never on plain typing.
120
+ export const WithOptionSelect: Story = {
121
+ render: function WithOptionSelectStory() {
122
+ const [value, setValue] = React.useState("");
123
+ const [picked, setPicked] = React.useState<string | null>(null);
124
+ return (
125
+ <div className="w-80 space-y-2">
126
+ <Autocomplete
127
+ value={value}
128
+ onValueChange={(v) => {
129
+ setValue(v);
130
+ setPicked(null);
131
+ }}
132
+ onOptionSelect={setPicked}
133
+ options={TEAMMATES}
134
+ placeholder="Reviewer name…"
135
+ aria-label="Reviewer name"
136
+ />
137
+ <p className="text-xs text-muted-foreground">
138
+ {picked
139
+ ? `Picked from list: ${picked}`
140
+ : value
141
+ ? `Typed (free text): ${value}`
142
+ : "Type a name or pick a suggestion"}
143
+ </p>
144
+ </div>
145
+ );
146
+ },
147
+ };
148
+
149
+ // Long-label overflow contract: unbroken strings (emails) truncate with
150
+ // min-w-0 + truncate instead of bleeding out of a narrow container.
151
+ export const LongOptions: Story = {
152
+ render: function LongOptionsStory() {
153
+ const [value, setValue] = React.useState("");
154
+ return (
155
+ <div className="w-56 space-y-2">
156
+ <p className="text-xs text-muted-foreground">
157
+ 224px container — type “.” to open
158
+ </p>
159
+ <Autocomplete
160
+ value={value}
161
+ onValueChange={setValue}
162
+ options={[
163
+ "seoyun.park@figma.com",
164
+ "chloe@dubois-martin.fr",
165
+ "tomas.herrera@vercel.com",
166
+ "marcus@lindqvist.dev",
167
+ "anika.patel@stripe.com",
168
+ ]}
169
+ placeholder="Reviewer email…"
170
+ aria-label="Reviewer email"
171
+ />
172
+ </div>
173
+ );
174
+ },
175
+ };
176
+
177
+ // Realistic use: assign a design review — pick a teammate or type any name.
178
+ export const RealisticUse: Story = {
179
+ render: function RealisticUseStory() {
180
+ const [value, setValue] = React.useState("");
181
+ const [picked, setPicked] = React.useState<string | null>(null);
182
+ const inputId = React.useId();
183
+ return (
184
+ <div className="w-96 space-y-4">
185
+ <div className="space-y-1.5">
186
+ <p className="text-xs text-muted-foreground">
187
+ Button · v2.4.0 release · Design review
188
+ </p>
189
+ <Label htmlFor={inputId}>Assign reviewer</Label>
190
+ <Autocomplete
191
+ id={inputId}
192
+ value={value}
193
+ onValueChange={(v) => {
194
+ setValue(v);
195
+ setPicked(null);
196
+ }}
197
+ onOptionSelect={setPicked}
198
+ options={TEAMMATES}
199
+ size="xl"
200
+ placeholder="Start typing a name…"
201
+ />
202
+ <p className="text-xs text-muted-foreground">
203
+ Pick a teammate or type any name — free text is accepted.
204
+ </p>
205
+ </div>
206
+ {value && (
207
+ <p className="text-sm text-muted-foreground">
208
+ Review will be assigned to{" "}
209
+ <span className="font-medium text-foreground">{value}</span>
210
+ {picked === null && value.trim() !== "" ? " (external)" : ""}
211
+ </p>
212
+ )}
213
+ </div>
214
+ );
215
+ },
216
+ };