@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
@@ -0,0 +1,84 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Mark } from "@behavioral-agentic-design-system/core/components/ui/mark";
4
+
5
+ const meta: Meta<typeof Mark> = {
6
+ title: "Components/Mark",
7
+ component: Mark,
8
+ parameters: { layout: "centered" },
9
+ tags: ["autodocs"],
10
+ argTypes: {
11
+ variant: { control: "select", options: ["default", "primary", "secondary"] },
12
+ },
13
+ };
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ export const Default: Story = {
19
+ render: () => (
20
+ <p className="max-w-prose text-base">
21
+ The most important constraint in BADS is{" "}
22
+ <Mark>token discipline</Mark> — every color, spacing value, and
23
+ border radius traces back to a single authoritative source.
24
+ </p>
25
+ ),
26
+ };
27
+
28
+ export const Variant_Primary: Story = {
29
+ render: () => (
30
+ <p className="max-w-prose text-base">
31
+ Use <Mark variant="primary">primary tint</Mark> for branded or
32
+ navigational emphasis — a phrase the reader should associate with
33
+ the product&apos;s core action.
34
+ </p>
35
+ ),
36
+ };
37
+
38
+ export const Variant_Secondary: Story = {
39
+ render: () => (
40
+ <p className="max-w-prose text-base">
41
+ A <Mark variant="secondary">secondary surface mark</Mark> reads as
42
+ neutral annotation — useful for glossary terms or non-semantic
43
+ editorial callouts where color association isn&apos;t the goal.
44
+ </p>
45
+ ),
46
+ };
47
+
48
+ export const InParagraph: Story = {
49
+ render: () => (
50
+ <div className="max-w-prose space-y-3 text-base">
51
+ <p>
52
+ Sir runs the <Mark>Night Shift</Mark> every day at 06:00 CDT.
53
+ It audits the system, web-researches improvements, builds{" "}
54
+ <Mark>three new components</Mark>, and posts a morning brief to
55
+ Slack <Mark variant="primary">#bads</Mark>.
56
+ </p>
57
+ <p>
58
+ Multiple marks in a single paragraph stay legible because the
59
+ background is a pale wash — never a solid fill competing with the
60
+ surrounding text.
61
+ </p>
62
+ </div>
63
+ ),
64
+ };
65
+
66
+ export const RealisticUse: Story = {
67
+ render: () => (
68
+ <div className="max-w-prose space-y-4">
69
+ <h3 className="text-lg font-semibold">Release notes — v2.4.0</h3>
70
+ <p className="text-sm text-muted-foreground">
71
+ The <Mark>Mark</Mark> primitive ships in this release alongside{" "}
72
+ <Mark variant="primary">FocusTrap</Mark> and{" "}
73
+ <Mark variant="primary">TreeSelect</Mark>. Together they close the
74
+ last three gaps in the editorial-text and form-interaction surface.
75
+ See the component-builds ledger for build notes.
76
+ </p>
77
+ <p className="text-sm text-muted-foreground">
78
+ Note: <Mark variant="secondary">Highlight</Mark> and{" "}
79
+ <Mark>Mark</Mark> are distinct. Highlight dynamically marks
80
+ search-query matches at runtime; Mark is a static author annotation.
81
+ </p>
82
+ </div>
83
+ ),
84
+ };
@@ -0,0 +1,99 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { useState } from "react";
3
+ import { MonthPicker } from "@behavioral-agentic-design-system/core/components/ui/month-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 MonthPicker> = {
14
+ title: "Components/MonthPicker",
15
+ component: MonthPicker,
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: () => <MonthPicker className="rounded-md border" />,
25
+ };
26
+
27
+ export const Selected: Story = {
28
+ render: () => {
29
+ // Persona pool date (content/personas/bads.json → primary.dates): 2026-05-26,
30
+ // normalized by the component to the first of the month.
31
+ const [month, setMonth] = useState<Date>(new Date(2026, 4, 26));
32
+ return (
33
+ <MonthPicker
34
+ value={month}
35
+ onChange={setMonth}
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 text uses
46
+ // text-muted-foreground instead of opacity-50 to maintain AA contrast.
47
+ <MonthPicker
48
+ disabled
49
+ defaultValue={new Date(2026, 4, 1)}
50
+ className="rounded-md border"
51
+ />
52
+ ),
53
+ };
54
+
55
+ export const WithDisabledMonths: Story = {
56
+ render: () => {
57
+ // Months before the engagement kickoff (persona pool date 2026-01-15)
58
+ // are not selectable.
59
+ const kickoff = new Date(2026, 0, 1);
60
+ const [month, setMonth] = useState<Date | undefined>(undefined);
61
+ return (
62
+ <MonthPicker
63
+ value={month ?? undefined}
64
+ onChange={setMonth}
65
+ disabledMonths={(date) => date < kickoff}
66
+ className="rounded-md border"
67
+ />
68
+ );
69
+ },
70
+ };
71
+
72
+ export const RealisticUse: Story = {
73
+ render: () => {
74
+ const [period, setPeriod] = useState<Date>(new Date(2026, 4, 1));
75
+ const label = period.toLocaleString("en-US", {
76
+ month: "long",
77
+ year: "numeric",
78
+ });
79
+ return (
80
+ <Card className="w-fit">
81
+ <CardHeader>
82
+ <CardTitle>Billing period</CardTitle>
83
+ <CardDescription>
84
+ Jordan Reeves — invoice for the {label} retainer ($12,500.00).
85
+ </CardDescription>
86
+ </CardHeader>
87
+ <CardContent className="space-y-3">
88
+ <Label htmlFor="billing-period">Statement month</Label>
89
+ <MonthPicker
90
+ id="billing-period"
91
+ value={period}
92
+ onChange={setPeriod}
93
+ className="rounded-md border"
94
+ />
95
+ </CardContent>
96
+ </Card>
97
+ );
98
+ },
99
+ };
@@ -24,7 +24,9 @@ const meta: Meta<typeof MultiSelect> = {
24
24
  // relative container div. aria-expanded / aria-controls from Radix land on the
25
25
  // <button> (valid per ARIA). X-remove pill buttons live in a sibling z-10 span —
26
26
  // not nested inside the trigger button — so axe nested-interactive never fires.
27
- component: "Multi-value combobox. Transparent full-area trigger <button> ensures aria-expanded is ARIA-valid; pill X-remove buttons are siblings (not nested) so no axe nested-interactive violation. Pill badges use py-0 min-h-6 so the content area is exactly 24px; X buttons use h-6 w-6 to meet the 24×24 WCAG 2.2 SC 2.5.8 target-size minimum (self-stretch would only fill the inner content-box, which is 20px when py-0.5 is present).",
27
+ // When disabled=true the X buttons are not rendered (disabled form controls must
28
+ // not contain interactive elements that are still reachable).
29
+ component: "Multi-value combobox. Transparent full-area trigger <button> ensures aria-expanded is ARIA-valid; pill X-remove buttons are siblings (not nested) so no axe nested-interactive violation. Pill badges use py-0 min-h-6 so the content area is exactly 24px; X buttons use h-6 w-6 to meet the 24×24 WCAG 2.2 SC 2.5.8 target-size minimum (self-stretch would only fill the inner content-box, which is 20px when py-0.5 is present). When disabled, X-remove buttons are hidden — a disabled field cannot have interactive children.",
28
30
  },
29
31
  },
30
32
  },
@@ -0,0 +1,213 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import {
3
+ LayoutDashboard,
4
+ Settings,
5
+ Bell,
6
+ BarChart3,
7
+ FolderKanban,
8
+ FileText,
9
+ } from "lucide-react";
10
+ import { NavLink } from "@behavioral-agentic-design-system/core/components/ui/nav-link";
11
+ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
12
+
13
+ const meta: Meta<typeof NavLink> = {
14
+ title: "Components/NavLink",
15
+ component: NavLink,
16
+ parameters: { layout: "centered" },
17
+ tags: ["autodocs"],
18
+ };
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ /** Default inactive link — Dashboard in Jordan Reeves's BADS workspace. */
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="w-60">
27
+ <NavLink href="/dashboard" icon={<LayoutDashboard aria-hidden="true" />}>
28
+ Dashboard
29
+ </NavLink>
30
+ </div>
31
+ ),
32
+ };
33
+
34
+ /**
35
+ * Active / current-page link — `active` sets `aria-current="page"` and the
36
+ * CSS attribute selector applies the accent-background styling. No JS class
37
+ * toggling: the active mark survives SSR and static export.
38
+ */
39
+ export const Active: Story = {
40
+ render: () => (
41
+ <div className="w-60">
42
+ <NavLink
43
+ href="/settings"
44
+ icon={<Settings aria-hidden="true" />}
45
+ active
46
+ >
47
+ Settings
48
+ </NavLink>
49
+ </div>
50
+ ),
51
+ };
52
+
53
+ /**
54
+ * Link with a badge count — the badge slot is pushed to the trailing edge
55
+ * via `ml-auto`. Pass a BADS `<Badge>`, a plain string, or any ReactNode.
56
+ * Counts that lack visible label text should carry `aria-label`.
57
+ */
58
+ export const WithBadge: Story = {
59
+ render: () => (
60
+ <div className="w-60 space-y-1">
61
+ <NavLink
62
+ href="/inbox"
63
+ icon={<Bell aria-hidden="true" />}
64
+ badge={
65
+ <Badge
66
+ variant="secondary"
67
+ className="h-5 min-w-5 justify-center px-1.5 text-xs"
68
+ aria-label="3 unread notifications"
69
+ >
70
+ 3
71
+ </Badge>
72
+ }
73
+ >
74
+ Notifications
75
+ </NavLink>
76
+ <NavLink
77
+ href="/reports"
78
+ icon={<FileText aria-hidden="true" />}
79
+ badge={
80
+ <Badge
81
+ variant="outline"
82
+ className="h-5 min-w-5 justify-center px-1.5 text-xs"
83
+ aria-label="12 pending reports"
84
+ >
85
+ 12
86
+ </Badge>
87
+ }
88
+ >
89
+ Reports
90
+ </NavLink>
91
+ </div>
92
+ ),
93
+ };
94
+
95
+ /**
96
+ * Nested / indented sub-navigation items — `nested` adds `pl-8` indent to
97
+ * convey hierarchy. No JavaScript state: the indent is a layout-only signal.
98
+ */
99
+ export const Nested: Story = {
100
+ render: () => (
101
+ <div className="w-60 space-y-0.5">
102
+ <NavLink href="/reports" icon={<BarChart3 aria-hidden="true" />}>
103
+ Reports
104
+ </NavLink>
105
+ <NavLink href="/reports/monthly" nested>
106
+ Monthly
107
+ </NavLink>
108
+ <NavLink href="/reports/quarterly" nested active>
109
+ Quarterly
110
+ </NavLink>
111
+ <NavLink href="/reports/annual" nested>
112
+ Annual
113
+ </NavLink>
114
+ </div>
115
+ ),
116
+ };
117
+
118
+ /**
119
+ * asChild — renders the BADS NavLink styles on a child element (e.g. a
120
+ * Next.js `<Link>`) via the Radix Slot + Slottable idiom. The child must be
121
+ * a single element; all NavLink props are merged onto it, and the icon/badge
122
+ * slots are injected as children of the merged element via Slottable.
123
+ */
124
+ export const AsChild: Story = {
125
+ render: () => (
126
+ <div className="w-60 space-y-0.5">
127
+ {/* Simulated with a plain <a> — in a Next.js app replace with <NextLink> */}
128
+ <NavLink asChild active icon={<LayoutDashboard aria-hidden="true" />}>
129
+ <a href="/dashboard">Dashboard</a>
130
+ </NavLink>
131
+ <NavLink asChild icon={<Settings aria-hidden="true" />}>
132
+ <a href="/settings">Settings</a>
133
+ </NavLink>
134
+ </div>
135
+ ),
136
+ };
137
+
138
+ /**
139
+ * Disabled nav item — `pointer-events-none opacity-50`. Use sparingly:
140
+ * disabled nav items should stay visible so the IA stays legible, but
141
+ * consider whether removing the item entirely is clearer.
142
+ */
143
+ export const Disabled: Story = {
144
+ render: () => (
145
+ <div className="w-60 space-y-0.5">
146
+ <NavLink href="/dashboard" icon={<LayoutDashboard aria-hidden="true" />}>
147
+ Dashboard
148
+ </NavLink>
149
+ <NavLink
150
+ href="/analytics"
151
+ icon={<BarChart3 aria-hidden="true" />}
152
+ disabled
153
+ >
154
+ Analytics
155
+ </NavLink>
156
+ </div>
157
+ ),
158
+ };
159
+
160
+ /**
161
+ * Realistic use — full navigation list for Jordan Reeves's BADS design system
162
+ * workspace: one active item, one with a badge count, a Reports item with
163
+ * nested sub-items expanded inline.
164
+ */
165
+ export const RealisticUse: Story = {
166
+ render: () => (
167
+ <nav
168
+ aria-label="Main navigation — BADS workspace"
169
+ className="w-60 space-y-0.5"
170
+ >
171
+ <NavLink
172
+ href="/dashboard"
173
+ icon={<LayoutDashboard aria-hidden="true" />}
174
+ active
175
+ >
176
+ Dashboard
177
+ </NavLink>
178
+ <NavLink href="/analytics" icon={<BarChart3 aria-hidden="true" />}>
179
+ Analytics
180
+ </NavLink>
181
+ <NavLink
182
+ href="/inbox"
183
+ icon={<Bell aria-hidden="true" />}
184
+ badge={
185
+ <Badge
186
+ variant="secondary"
187
+ className="h-5 min-w-5 justify-center px-1.5 text-xs"
188
+ aria-label="5 unread"
189
+ >
190
+ 5
191
+ </Badge>
192
+ }
193
+ >
194
+ Notifications
195
+ </NavLink>
196
+ <NavLink href="/reports" icon={<FolderKanban aria-hidden="true" />}>
197
+ Reports
198
+ </NavLink>
199
+ <NavLink href="/reports/monthly" nested>
200
+ Monthly
201
+ </NavLink>
202
+ <NavLink href="/reports/quarterly" nested>
203
+ Quarterly
204
+ </NavLink>
205
+ <NavLink href="/reports/annual" nested>
206
+ Annual
207
+ </NavLink>
208
+ <NavLink href="/settings" icon={<Settings aria-hidden="true" />}>
209
+ Settings
210
+ </NavLink>
211
+ </nav>
212
+ ),
213
+ };