@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
@@ -0,0 +1,173 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Palette, Accessibility, GitBranch } from "lucide-react";
4
+ import { Chip } from "@behavioral-agentic-design-system/core/components/ui/chip";
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+
12
+ const meta: Meta<typeof Chip> = {
13
+ title: "Components/Chip",
14
+ component: Chip,
15
+ parameters: {
16
+ layout: "centered",
17
+ docs: {
18
+ description: {
19
+ component:
20
+ "Interactive filter/facet toggle pill with role=\"checkbox\" semantics. Distinct from Tag (a passive display label): Chip is a stateful selector the user toggles on/off. Each chip is an independent toggle and its own tab stop — not a radiogroup, so arrow keys are deliberately not wired; Space (and Enter) toggles. A leading check icon marks the selected state so it never reads by color alone; a custom leading icon is swapped for the check while selected (the MUI/Mantine chip idiom — slight width shift on toggle is expected). Motion: background/text/border ease via var(--duration-fast) + var(--ease-out); the focus ring is excluded from the transition list so it appears instantly.",
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof Chip>;
28
+
29
+ export const Default: Story = {
30
+ render: () => <Chip>design tokens</Chip>,
31
+ };
32
+
33
+ export const Selected: Story = {
34
+ render: () => <Chip defaultSelected>design tokens</Chip>,
35
+ };
36
+
37
+ export const Variant_Default: Story = {
38
+ render: () => (
39
+ <div className="flex flex-wrap gap-2">
40
+ <Chip variant="default">a11y contract</Chip>
41
+ <Chip variant="default" defaultSelected>
42
+ a11y contract
43
+ </Chip>
44
+ </div>
45
+ ),
46
+ };
47
+
48
+ export const Variant_Outline: Story = {
49
+ render: () => (
50
+ <div className="flex flex-wrap gap-2">
51
+ <Chip variant="outline">visual regression</Chip>
52
+ <Chip variant="outline" defaultSelected>
53
+ visual regression
54
+ </Chip>
55
+ </div>
56
+ ),
57
+ };
58
+
59
+ export const Size_Sm: Story = {
60
+ render: () => (
61
+ <Chip size="sm" defaultSelected>
62
+ token drift
63
+ </Chip>
64
+ ),
65
+ };
66
+
67
+ export const Size_Default: Story = {
68
+ render: () => <Chip defaultSelected>token drift</Chip>,
69
+ };
70
+
71
+ export const Size_Lg: Story = {
72
+ render: () => (
73
+ <Chip size="lg" defaultSelected>
74
+ token drift
75
+ </Chip>
76
+ ),
77
+ };
78
+
79
+ export const WithIcon: Story = {
80
+ render: () => (
81
+ <div className="flex flex-wrap gap-2">
82
+ <Chip icon={<Palette strokeWidth={1.5} />}>design tokens</Chip>
83
+ <Chip icon={<Accessibility strokeWidth={1.5} />} defaultSelected>
84
+ a11y contract
85
+ </Chip>
86
+ </div>
87
+ ),
88
+ };
89
+
90
+ export const Disabled: Story = {
91
+ render: () => <Chip disabled>forced colors</Chip>,
92
+ };
93
+
94
+ export const DisabledSelected: Story = {
95
+ render: () => (
96
+ <Chip disabled defaultSelected>
97
+ forced colors
98
+ </Chip>
99
+ ),
100
+ };
101
+
102
+ export const Controlled: Story = {
103
+ render: function ControlledStory() {
104
+ const [selected, setSelected] = React.useState(true);
105
+ return (
106
+ <div className="flex flex-col items-center gap-3">
107
+ <Chip
108
+ selected={selected}
109
+ onSelectedChange={setSelected}
110
+ icon={<GitBranch strokeWidth={1.5} />}
111
+ >
112
+ Radix primitive
113
+ </Chip>
114
+ <p className="text-sm text-muted-foreground" aria-live="polite">
115
+ {selected ? "Filter active" : "Filter inactive"}
116
+ </p>
117
+ </div>
118
+ );
119
+ },
120
+ };
121
+
122
+ export const RealisticUse: Story = {
123
+ render: function RealisticUseStory() {
124
+ // Real content: registry-docs topic facets from the BADS jargon pool
125
+ // (content/personas/bads.json → jargon) — Jordan Reeves filtering the
126
+ // component docs before a token review.
127
+ const topics = [
128
+ "design tokens",
129
+ "a11y contract",
130
+ "CVA variants",
131
+ "visual regression",
132
+ "token drift",
133
+ "focus trap",
134
+ ];
135
+ const [active, setActive] = React.useState<string[]>([
136
+ "design tokens",
137
+ "a11y contract",
138
+ ]);
139
+ const toggle = (topic: string, next: boolean) =>
140
+ setActive((prev) =>
141
+ next ? [...prev, topic] : prev.filter((t) => t !== topic)
142
+ );
143
+ return (
144
+ <Card className="w-96">
145
+ <CardHeader>
146
+ <CardTitle className="text-2xl">Filter docs</CardTitle>
147
+ <p className="text-sm text-muted-foreground">
148
+ Showing guides matching {active.length} of {topics.length} topics
149
+ </p>
150
+ </CardHeader>
151
+ <CardContent>
152
+ <div
153
+ role="group"
154
+ aria-label="Filter docs by topic"
155
+ className="flex flex-wrap gap-2"
156
+ >
157
+ {topics.map((topic) => (
158
+ <Chip
159
+ key={topic}
160
+ size="sm"
161
+ variant="outline"
162
+ selected={active.includes(topic)}
163
+ onSelectedChange={(next) => toggle(topic, next)}
164
+ >
165
+ {topic}
166
+ </Chip>
167
+ ))}
168
+ </div>
169
+ </CardContent>
170
+ </Card>
171
+ );
172
+ },
173
+ };
@@ -30,6 +30,9 @@ export const Variant_Muted: Story = {
30
30
  ),
31
31
  }
32
32
 
33
+ // success/warning now paint the real oklch token: the class was
34
+ // text-[hsl(var(--success))] — hsl() wrapping an oklch value is invalid CSS and
35
+ // silently fell back — fixed to text-[var(--success)] (2026-07-24 paydown).
33
36
  export const Variant_Success: Story = {
34
37
  render: () => (
35
38
  <CircularProgress value={100} variant="success" label="Complete" />
@@ -0,0 +1,81 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Check } from "lucide-react";
3
+ import { ColorSwatch } from "@behavioral-agentic-design-system/core/components/ui/color-swatch";
4
+
5
+ /**
6
+ * ColorSwatch is a display-only chip that renders any CSS color. It is
7
+ * presentational by default (`aria-hidden`) because a swatch usually sits
8
+ * beside a text label that already names the color; pass `aria-label` when it
9
+ * stands alone. CVA axes: `size` (sm/default/lg) and `shape`
10
+ * (rounded/circle/square). Not interactive — wrap in a Button to make it click.
11
+ */
12
+ const meta: Meta<typeof ColorSwatch> = {
13
+ title: "Components/ColorSwatch",
14
+ component: ColorSwatch,
15
+ parameters: {
16
+ layout: "centered",
17
+ },
18
+ tags: ["autodocs"],
19
+ };
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ export const Default: Story = {
25
+ args: { color: "#2563eb", "aria-label": "Blue" },
26
+ };
27
+
28
+ export const Variant_Rounded: Story = {
29
+ args: { color: "#2563eb", shape: "rounded", "aria-label": "Blue" },
30
+ };
31
+
32
+ export const Variant_Circle: Story = {
33
+ args: { color: "#16a34a", shape: "circle", "aria-label": "Green" },
34
+ };
35
+
36
+ export const Variant_Square: Story = {
37
+ args: { color: "#ea580c", shape: "square", "aria-label": "Orange" },
38
+ };
39
+
40
+ export const Size_Sm: Story = {
41
+ args: { color: "#2563eb", size: "sm", "aria-label": "Blue" },
42
+ };
43
+
44
+ export const Size_Default: Story = {
45
+ args: { color: "#2563eb", size: "default", "aria-label": "Blue" },
46
+ };
47
+
48
+ export const Size_Lg: Story = {
49
+ args: { color: "#2563eb", size: "lg", "aria-label": "Blue" },
50
+ };
51
+
52
+ /**
53
+ * A brand palette row plus a "selected" swatch that composes a check icon as a
54
+ * child. The check inherits `currentColor`; here it is forced white for
55
+ * contrast against the dark selected swatch.
56
+ */
57
+ export const RealisticUse: Story = {
58
+ render: () => (
59
+ <div className="flex flex-col gap-6">
60
+ <div className="flex items-center gap-2">
61
+ {[
62
+ { c: "#ef4444", n: "Red" },
63
+ { c: "#f97316", n: "Orange" },
64
+ { c: "#eab308", n: "Amber" },
65
+ { c: "#22c55e", n: "Green" },
66
+ { c: "#06b6d4", n: "Cyan" },
67
+ { c: "#3b82f6", n: "Blue" },
68
+ { c: "#8b5cf6", n: "Violet" },
69
+ ].map((s) => (
70
+ <ColorSwatch key={s.c} color={s.c} shape="circle" aria-label={s.n} />
71
+ ))}
72
+ </div>
73
+ <div className="flex items-center gap-3 text-sm">
74
+ <ColorSwatch color="#171717" size="lg" aria-label="Selected: near-black">
75
+ <Check strokeWidth={1.5} className="text-white" />
76
+ </ColorSwatch>
77
+ <span className="text-muted-foreground tabular-nums">#171717 · selected</span>
78
+ </div>
79
+ </div>
80
+ ),
81
+ };
@@ -1,3 +1,4 @@
1
+ // Motion: the copy↔copied swap narrowed transition-all → transition-[opacity,transform] (explicit-properties rule).
1
2
  import type { Meta, StoryObj } from "@storybook/react"
2
3
  import * as React from "react"
3
4
  import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button"
@@ -10,7 +11,7 @@ const meta: Meta<typeof CopyButton> = {
10
11
  docs: {
11
12
  description: {
12
13
  component:
13
- "Button that copies a string to the clipboard. Idle → Copied state swap via opacity + scale transition (var(--duration-fast) + var(--ease-out)). Announces 'Copied to clipboard' via aria-live=polite. The visible Copied state renders in the success (green) color with the check + label at gap-1.5 (the confirmation is aria-hidden, so the color is decorative and the state is announced via the live region). Icon-only mode requires aria-label. Gracefully falls back to document.execCommand in non-secure contexts. Not a form submit — always type=button via Button primitive.",
14
+ "Button that copies a string to the clipboard. Idle → Copied state swap via opacity + scale transition (var(--duration-fast) + var(--ease-out)). Announces 'Copied to clipboard' via aria-live=polite. The Copied state inherits the button variant's own foreground color (no success-green override) so it reads on any variant — green on a dark default button fails WCAG AAA. The confirmation overlay is centered over the button face (an earlier right-aligned treatment clipped against overflow-hidden on non-px-4 sizes). Compact labeled sizes (sm/xs) drop the check icon in the Copied state — the text alone confirms, and icon+text overflows the tighter padding; icon-only mode always keeps the check. The confirmation is aria-hidden; state is announced via the live region. Icon-only mode requires aria-label. Gracefully falls back to document.execCommand in non-secure contexts. Not a form submit — always type=button via Button primitive.",
14
15
  },
15
16
  },
16
17
  },
@@ -107,5 +108,4 @@ export const AllVariants: Story = {
107
108
  <CopyButton value="ghost" variant="ghost">Ghost</CopyButton>
108
109
  </div>
109
110
  ),
110
- }
111
-
111
+ }
@@ -2,6 +2,9 @@ import * as React from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
  import { DatePicker } from "@behavioral-agentic-design-system/core/components/ui/date-picker";
4
4
 
5
+ // react-day-picker v10 migration (2026-07-07): fromDate/toDate props preserved
6
+ // on DatePicker — they now map to startMonth/endMonth + disabled internally.
7
+ // Story coverage is unchanged; the public API is backward-compatible.
5
8
  const meta: Meta<typeof DatePicker> = {
6
9
  title: "Components/DatePicker",
7
10
  component: DatePicker,
@@ -5,6 +5,9 @@ import {
5
5
  DateRangeValue,
6
6
  } from "@behavioral-agentic-design-system/core/components/ui/date-range-picker"
7
7
 
8
+ // react-day-picker v10 migration (2026-07-07): fromDate/toDate props preserved
9
+ // on DateRangePicker — they now map to startMonth/endMonth + disabled internally.
10
+ // Story coverage is unchanged; the public API is backward-compatible.
8
11
  const meta: Meta<typeof DateRangePicker> = {
9
12
  title: "Components/DateRangePicker",
10
13
  component: DateRangePicker,
@@ -70,6 +70,20 @@ export const SubmitMode_Enter: Story = {
70
70
  ),
71
71
  }
72
72
 
73
+ export const SubmitMode_Both: Story = {
74
+ render: () => (
75
+ <div className="w-64">
76
+ <Editable defaultValue="Blur or press Enter to save" submitMode="both">
77
+ <EditablePreview />
78
+ <EditableControl>
79
+ <EditableSubmit>Save</EditableSubmit>
80
+ <EditableCancel>Cancel</EditableCancel>
81
+ </EditableControl>
82
+ </Editable>
83
+ </div>
84
+ ),
85
+ }
86
+
73
87
  // Disabled renders as a single dimmed (opacity-50) preview label — the overlay
74
88
  // input stays hidden, so the value is not ghosted over itself.
75
89
  export const Disabled: Story = {
@@ -0,0 +1,148 @@
1
+ import * as React from "react";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { FloatLabel } from "@behavioral-agentic-design-system/core/components/ui/float-label";
4
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
12
+
13
+ const meta: Meta<typeof FloatLabel> = {
14
+ title: "Components/FloatLabel",
15
+ component: FloatLabel,
16
+ parameters: {
17
+ layout: "centered",
18
+ },
19
+ tags: ["autodocs"],
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const Default: Story = {
26
+ args: {
27
+ label: "Email",
28
+ type: "email",
29
+ containerClassName: "w-72",
30
+ },
31
+ };
32
+
33
+ export const Focused: Story = {
34
+ name: "Focused (label floated)",
35
+ render: () => (
36
+ <FloatLabel
37
+ label="Display name"
38
+ type="text"
39
+ autoFocus
40
+ containerClassName="w-72"
41
+ />
42
+ ),
43
+ };
44
+
45
+ export const Filled: Story = {
46
+ name: "Filled (label stays floated on blur)",
47
+ args: {
48
+ label: "Email",
49
+ type: "email",
50
+ defaultValue: "jordan@reeves.design",
51
+ containerClassName: "w-72",
52
+ },
53
+ };
54
+
55
+ export const WithError: Story = {
56
+ render: () => (
57
+ <div className="grid w-72 gap-2">
58
+ <FloatLabel
59
+ label="Email"
60
+ type="email"
61
+ defaultValue="not-an-email"
62
+ aria-invalid
63
+ aria-describedby="float-label-email-error"
64
+ />
65
+ <p id="float-label-email-error" className="text-sm text-destructive">
66
+ Enter a valid email address.
67
+ </p>
68
+ </div>
69
+ ),
70
+ };
71
+
72
+ export const Disabled: Story = {
73
+ args: {
74
+ label: "Workspace slug",
75
+ type: "text",
76
+ defaultValue: "bads-core",
77
+ disabled: true,
78
+ containerClassName: "w-72",
79
+ },
80
+ };
81
+
82
+ export const Required: Story = {
83
+ args: {
84
+ label: "Full name",
85
+ type: "text",
86
+ required: true,
87
+ containerClassName: "w-72",
88
+ },
89
+ };
90
+
91
+ export const Size_SM: Story = {
92
+ args: {
93
+ label: "Search handle",
94
+ size: "sm",
95
+ type: "text",
96
+ containerClassName: "w-72",
97
+ },
98
+ };
99
+
100
+ export const Size_LG: Story = {
101
+ args: {
102
+ label: "Phone",
103
+ size: "lg",
104
+ type: "tel",
105
+ autoComplete: "tel",
106
+ containerClassName: "w-72",
107
+ },
108
+ };
109
+
110
+ export const RealisticUse: Story = {
111
+ name: "RealisticUse (sign-in form)",
112
+ render: () => (
113
+ <Card className="w-80">
114
+ <CardHeader>
115
+ <CardTitle className="text-2xl">Sign in</CardTitle>
116
+ <CardDescription>
117
+ Pick up where you left off in the token workspace.
118
+ </CardDescription>
119
+ </CardHeader>
120
+ <CardContent>
121
+ <form
122
+ className="grid gap-5"
123
+ onSubmit={(e) => e.preventDefault()}
124
+ aria-label="Sign in"
125
+ >
126
+ <div className="grid gap-4">
127
+ <FloatLabel
128
+ label="Email"
129
+ type="email"
130
+ autoComplete="email"
131
+ defaultValue="anika.patel@stripe.com"
132
+ required
133
+ />
134
+ <FloatLabel
135
+ label="Password"
136
+ type="password"
137
+ autoComplete="current-password"
138
+ required
139
+ />
140
+ </div>
141
+ <Button type="submit" size="xl">
142
+ Sign in
143
+ </Button>
144
+ </form>
145
+ </CardContent>
146
+ </Card>
147
+ ),
148
+ };
@@ -0,0 +1,215 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { MessageCircle, Pencil, Plus } from "lucide-react";
4
+ import { FloatingActionButton } from "@behavioral-agentic-design-system/core/components/ui/floating-action-button";
5
+ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
6
+
7
+ const meta: Meta<typeof FloatingActionButton> = {
8
+ title: "Components/FloatingActionButton",
9
+ component: FloatingActionButton,
10
+ parameters: {
11
+ layout: "centered",
12
+ docs: {
13
+ description: {
14
+ component:
15
+ "Fixed-position circular button that triggers a single primary action — the single-action counterpart to SpeedDial (which opens a 2–5 item submenu). Wraps Button, so focus ring, loading, and disabled ship from the primitive. md (56px) is the recommended thumb-target size; sm (40px) sits below the 44px floor and is for dense secondary chrome only. Icon-only FABs REQUIRE aria-label. Stories render inside a [transform:translateZ(0)] frame so position:fixed pins to the demo frame instead of the Storybook viewport.",
16
+ },
17
+ },
18
+ },
19
+ tags: ["autodocs"],
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ /**
26
+ * Demo frame: `transform: translateZ(0)` makes this box the containing block
27
+ * for `position: fixed` descendants, so the FAB pins to the frame instead of
28
+ * the Storybook viewport (same trick as the Affix stories). In a real app the
29
+ * FAB pins to the true viewport.
30
+ */
31
+ function DemoFrame({ children }: { children: React.ReactNode }) {
32
+ return (
33
+ <div className="relative h-64 w-96 overflow-hidden rounded-lg border border-border bg-card [transform:translateZ(0)]">
34
+ <div className="p-4">
35
+ <p className="text-sm font-medium text-foreground">design.bads.com</p>
36
+ <p className="text-sm text-muted-foreground">
37
+ The frame stands in for the viewport — the FAB stays pinned to its
38
+ corner while everything else scrolls.
39
+ </p>
40
+ </div>
41
+ {children}
42
+ </div>
43
+ );
44
+ }
45
+
46
+ export const Default: Story = {
47
+ render: () => (
48
+ <DemoFrame>
49
+ <FloatingActionButton
50
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
51
+ aria-label="Create new"
52
+ />
53
+ </DemoFrame>
54
+ ),
55
+ };
56
+
57
+ export const Variant_Secondary: Story = {
58
+ render: () => (
59
+ <DemoFrame>
60
+ <FloatingActionButton
61
+ variant="secondary"
62
+ icon={<MessageCircle strokeWidth={1.5} aria-hidden="true" />}
63
+ aria-label="Open chat with Jordan Reeves"
64
+ />
65
+ </DemoFrame>
66
+ ),
67
+ };
68
+
69
+ export const WithLabel: Story = {
70
+ render: () => (
71
+ <DemoFrame>
72
+ {/* Extended (pill) form — the visible label IS the accessible name. */}
73
+ <FloatingActionButton
74
+ icon={<Pencil strokeWidth={1.5} aria-hidden="true" />}
75
+ label="New proposal"
76
+ />
77
+ </DemoFrame>
78
+ ),
79
+ };
80
+
81
+ export const Size_Sm: Story = {
82
+ render: () => (
83
+ <DemoFrame>
84
+ {/* 40px — below the 44px SC 2.5.5 floor. Dense/desktop-secondary
85
+ chrome only; never the primary CTA (see registry antiPatterns). */}
86
+ <FloatingActionButton
87
+ size="sm"
88
+ variant="secondary"
89
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
90
+ aria-label="Add token"
91
+ />
92
+ </DemoFrame>
93
+ ),
94
+ };
95
+
96
+ export const Size_Md: Story = {
97
+ render: () => (
98
+ <DemoFrame>
99
+ <FloatingActionButton
100
+ size="md"
101
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
102
+ aria-label="Create new"
103
+ />
104
+ </DemoFrame>
105
+ ),
106
+ };
107
+
108
+ export const Size_Lg: Story = {
109
+ render: () => (
110
+ <DemoFrame>
111
+ <FloatingActionButton
112
+ size="lg"
113
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
114
+ aria-label="Create new"
115
+ />
116
+ </DemoFrame>
117
+ ),
118
+ };
119
+
120
+ export const Corner_BottomLeft: Story = {
121
+ render: () => (
122
+ <DemoFrame>
123
+ <FloatingActionButton
124
+ corner="bottom-left"
125
+ icon={<MessageCircle strokeWidth={1.5} aria-hidden="true" />}
126
+ aria-label="Open support chat"
127
+ />
128
+ </DemoFrame>
129
+ ),
130
+ };
131
+
132
+ export const Loading: Story = {
133
+ render: () => (
134
+ <DemoFrame>
135
+ {/* Spinner replaces the icon; aria-busy + disabled via Button. The
136
+ min-h/min-w frame keeps dimensions stable while loading. */}
137
+ <FloatingActionButton
138
+ loading
139
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
140
+ aria-label="Creating proposal"
141
+ />
142
+ </DemoFrame>
143
+ ),
144
+ };
145
+
146
+ export const Disabled: Story = {
147
+ render: () => (
148
+ <DemoFrame>
149
+ <FloatingActionButton
150
+ disabled
151
+ icon={<Plus strokeWidth={1.5} aria-hidden="true" />}
152
+ aria-label="Create new (unavailable)"
153
+ />
154
+ </DemoFrame>
155
+ ),
156
+ };
157
+
158
+ // Real content from content/personas/bads.json (primary persona pool).
159
+ const reviewQueue = [
160
+ {
161
+ author: "Jordan Reeves",
162
+ date: "2026-05-26",
163
+ entry:
164
+ "Shared 36 components for review at design.bads.com/share/tokens-v2-proposal.",
165
+ },
166
+ {
167
+ author: "Seo-yun Park",
168
+ date: "2026-01-15",
169
+ entry: "Raised the contrast floor to 7:1 across every shipped token pair.",
170
+ },
171
+ {
172
+ author: "Marcus Lindqvist",
173
+ date: "2025-11-20",
174
+ entry: "Moved the touch-target audit to the 44×44px target across all CTAs.",
175
+ },
176
+ {
177
+ author: "Anika Patel",
178
+ date: "2027-03-01",
179
+ entry:
180
+ "Scheduled the semantic-layer migration — token drift lint goes strict.",
181
+ },
182
+ ];
183
+
184
+ export const RealisticUse: Story = {
185
+ render: () => (
186
+ <div className="relative h-80 w-[420px] overflow-hidden rounded-lg border border-border bg-card [transform:translateZ(0)]">
187
+ <div className="h-full overflow-y-auto p-4" tabIndex={0}>
188
+ <div className="flex items-center justify-between gap-3">
189
+ <h3 className="min-w-0 truncate text-base font-semibold text-foreground">
190
+ Tokens v2 proposal — review queue
191
+ </h3>
192
+ <Badge variant="secondary">4 open</Badge>
193
+ </div>
194
+ <ul className="mt-3 space-y-4">
195
+ {reviewQueue.map((item, i) => (
196
+ <li key={i} className="space-y-1">
197
+ <p className="text-sm font-medium text-foreground">
198
+ {item.author}{" "}
199
+ <span className="font-normal text-muted-foreground">
200
+ · {item.date}
201
+ </span>
202
+ </p>
203
+ <p className="text-sm text-muted-foreground">{item.entry}</p>
204
+ </li>
205
+ ))}
206
+ </ul>
207
+ </div>
208
+ {/* The single primary action on this surface: start a new review. */}
209
+ <FloatingActionButton
210
+ icon={<Pencil strokeWidth={1.5} aria-hidden="true" />}
211
+ label="New review"
212
+ />
213
+ </div>
214
+ ),
215
+ };