@behavioral-agentic-design-system/core 0.29.0 → 0.32.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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +2 -1
  3. package/scripts/build-tokens.cjs +59 -10
  4. package/scripts/wcag-audit.cjs +30 -4
  5. package/src/app/preview/components/page.tsx +305 -1
  6. package/src/app/preview/health/page.tsx +201 -0
  7. package/src/app/shell.tsx +40 -4
  8. package/src/components/docs-tab.tsx +26 -9
  9. package/src/components/home-tab.tsx +12 -3
  10. package/src/components/ui/badge.tsx +16 -2
  11. package/src/components/ui/button.tsx +10 -0
  12. package/src/components/ui/checkbox.tsx +21 -6
  13. package/src/components/ui/index.ts +1 -0
  14. package/src/components/ui/input-clear-button.tsx +52 -0
  15. package/src/components/ui/input.tsx +5 -21
  16. package/src/components/ui/multi-select.tsx +20 -6
  17. package/src/components/ui/progress.tsx +23 -1
  18. package/src/components/ui/questionnaire.tsx +352 -0
  19. package/src/components/ui/sidebar.tsx +5 -0
  20. package/src/components/ui/skeleton.tsx +83 -1
  21. package/src/components/ui/tabs.tsx +34 -0
  22. package/src/components/ui/textarea.tsx +5 -0
  23. package/src/components/ui/toggle-tip.tsx +125 -0
  24. package/src/data/docs-index.ts +51 -3
  25. package/src/fonts-cdn.css +25 -0
  26. package/src/lib/fork.ts +21 -0
  27. package/src/lib/get-icon-color.ts +66 -0
  28. package/src/stories/Badge.stories.tsx +66 -0
  29. package/src/stories/Button.stories.tsx +3 -0
  30. package/src/stories/Checkbox.stories.tsx +58 -4
  31. package/src/stories/Input.stories.tsx +3 -0
  32. package/src/stories/InputClearButton.stories.tsx +53 -0
  33. package/src/stories/MultiSelect.stories.tsx +6 -2
  34. package/src/stories/Progress.stories.tsx +56 -4
  35. package/src/stories/Questionnaire.stories.tsx +287 -0
  36. package/src/stories/Sidebar.stories.tsx +2 -0
  37. package/src/stories/SkeletonTable.stories.tsx +97 -0
  38. package/src/stories/Stack.stories.tsx +2 -1
  39. package/src/stories/Tabs.stories.tsx +56 -8
  40. package/src/stories/Textarea.stories.tsx +2 -0
  41. package/src/stories/ToggleTip.stories.tsx +106 -0
  42. package/src/styles.css +22 -10
@@ -0,0 +1,287 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import * as React from "react"
3
+ import {
4
+ Questionnaire,
5
+ type QuestionnaireQuestion,
6
+ } from "@behavioral-agentic-design-system/core/components/ui/questionnaire"
7
+
8
+ const meta: Meta<typeof Questionnaire> = {
9
+ title: "Components/Questionnaire",
10
+ component: Questionnaire,
11
+ parameters: {
12
+ layout: "centered",
13
+ docs: {
14
+ description: {
15
+ component:
16
+ "One-question-at-a-time form primitive for agentic clarification prompts, onboarding flows, intake forms, and configuration wizards. Supports single-choice (radio), multiple-choice (checkboxes), freeform (textarea), and skippable questions. Questions animate in from the travel direction on each step change. Completion announces via role=status + aria-live=polite.",
17
+ },
18
+ },
19
+ },
20
+ }
21
+ export default meta
22
+ type Story = StoryObj<typeof Questionnaire>
23
+
24
+ // ─── Single question ──────────────────────────────────────────────────────────
25
+
26
+ export const Default: Story = {
27
+ render: () => (
28
+ <div className="w-96">
29
+ <Questionnaire
30
+ questions={[
31
+ {
32
+ id: "role",
33
+ prompt: "What best describes your current role?",
34
+ type: "single",
35
+ options: [
36
+ { value: "designer", label: "Designer" },
37
+ { value: "engineer", label: "Engineer" },
38
+ { value: "product", label: "Product manager" },
39
+ { value: "founder", label: "Founder or executive" },
40
+ ],
41
+ },
42
+ ]}
43
+ onComplete={(answers) => console.log("Done", answers)}
44
+ />
45
+ </div>
46
+ ),
47
+ }
48
+
49
+ // ─── Variant: single choice multi-step ───────────────────────────────────────
50
+
51
+ const ONBOARDING_SINGLE: QuestionnaireQuestion[] = [
52
+ {
53
+ id: "team-size",
54
+ prompt: "How large is your design team?",
55
+ type: "single",
56
+ options: [
57
+ { value: "solo", label: "Just me" },
58
+ { value: "small", label: "2 – 5 people" },
59
+ { value: "medium", label: "6 – 20 people" },
60
+ { value: "large", label: "20+ people" },
61
+ ],
62
+ },
63
+ {
64
+ id: "ship-cadence",
65
+ prompt: "How often does your team ship design-system updates?",
66
+ type: "single",
67
+ options: [
68
+ { value: "daily", label: "Daily or continuously" },
69
+ { value: "weekly", label: "Weekly" },
70
+ { value: "monthly", label: "Monthly" },
71
+ { value: "quarterly", label: "Quarterly or less" },
72
+ ],
73
+ },
74
+ {
75
+ id: "priority",
76
+ prompt: "What's your top design-system priority right now?",
77
+ type: "single",
78
+ options: [
79
+ { value: "tokens", label: "Token governance" },
80
+ { value: "a11y", label: "Accessibility compliance" },
81
+ { value: "onboarding", label: "Engineer onboarding speed" },
82
+ { value: "coverage", label: "Component coverage" },
83
+ ],
84
+ },
85
+ ]
86
+
87
+ export const Variant_Single: Story = {
88
+ render: () => {
89
+ const [answers, setAnswers] = React.useState<Record<string, string | string[] | null> | null>(null)
90
+ return (
91
+ <div className="w-96 space-y-4">
92
+ {answers ? (
93
+ <pre className="rounded-md bg-muted p-3 text-xs">{JSON.stringify(answers, null, 2)}</pre>
94
+ ) : (
95
+ <Questionnaire questions={ONBOARDING_SINGLE} onComplete={(a) => setAnswers(a)} />
96
+ )}
97
+ </div>
98
+ )
99
+ },
100
+ }
101
+
102
+ // ─── Variant: multiple choice ─────────────────────────────────────────────────
103
+
104
+ export const Variant_Multiple: Story = {
105
+ render: () => (
106
+ <div className="w-96">
107
+ <Questionnaire
108
+ questions={[
109
+ {
110
+ id: "frameworks",
111
+ prompt: "Which frameworks does your team use? Select all that apply.",
112
+ type: "multiple",
113
+ options: [
114
+ { value: "react", label: "React" },
115
+ { value: "vue", label: "Vue" },
116
+ { value: "svelte", label: "Svelte" },
117
+ { value: "angular", label: "Angular" },
118
+ { value: "other", label: "Other" },
119
+ ],
120
+ },
121
+ ]}
122
+ onComplete={(answers) => console.log("Done", answers)}
123
+ />
124
+ </div>
125
+ ),
126
+ }
127
+
128
+ // ─── Variant: freeform ────────────────────────────────────────────────────────
129
+
130
+ export const Variant_Freeform: Story = {
131
+ render: () => (
132
+ <div className="w-96">
133
+ <Questionnaire
134
+ questions={[
135
+ {
136
+ id: "challenge",
137
+ prompt: "What's your biggest design-system challenge right now?",
138
+ type: "freeform",
139
+ },
140
+ ]}
141
+ onComplete={(answers) => console.log("Done", answers)}
142
+ />
143
+ </div>
144
+ ),
145
+ }
146
+
147
+ // ─── Variant: skippable ───────────────────────────────────────────────────────
148
+
149
+ export const Variant_Skippable: Story = {
150
+ render: () => (
151
+ <div className="w-96">
152
+ <Questionnaire
153
+ questions={[
154
+ {
155
+ id: "role",
156
+ prompt: "What best describes your current role?",
157
+ type: "single",
158
+ options: [
159
+ { value: "designer", label: "Designer" },
160
+ { value: "engineer", label: "Engineer" },
161
+ { value: "product", label: "Product manager" },
162
+ { value: "founder", label: "Founder or executive" },
163
+ ],
164
+ },
165
+ {
166
+ id: "company",
167
+ prompt: "Which company are you at? (optional)",
168
+ type: "freeform",
169
+ skippable: true,
170
+ skipLabel: "Prefer not to say",
171
+ },
172
+ ]}
173
+ onComplete={(answers) => console.log("Done", answers)}
174
+ onSkip={(id) => console.log("Skipped", id)}
175
+ />
176
+ </div>
177
+ ),
178
+ }
179
+
180
+ // ─── Variant: mixed types ─────────────────────────────────────────────────────
181
+
182
+ const MIXED_QUESTIONS: QuestionnaireQuestion[] = [
183
+ {
184
+ id: "role",
185
+ prompt: "What best describes your current role?",
186
+ type: "single",
187
+ options: [
188
+ { value: "designer", label: "Designer" },
189
+ { value: "engineer", label: "Engineer" },
190
+ { value: "product", label: "Product manager" },
191
+ { value: "founder", label: "Founder or executive" },
192
+ ],
193
+ },
194
+ {
195
+ id: "tools",
196
+ prompt: "Which design tools does your team use? Select all that apply.",
197
+ type: "multiple",
198
+ options: [
199
+ { value: "figma", label: "Figma" },
200
+ { value: "sketch", label: "Sketch" },
201
+ { value: "framer", label: "Framer" },
202
+ { value: "storybook", label: "Storybook" },
203
+ ],
204
+ },
205
+ {
206
+ id: "goal",
207
+ prompt: "What would make BADS most useful for your team?",
208
+ type: "freeform",
209
+ skippable: true,
210
+ },
211
+ ]
212
+
213
+ export const Variant_Mixed: Story = {
214
+ render: () => {
215
+ const [answers, setAnswers] = React.useState<Record<string, string | string[] | null> | null>(null)
216
+ return (
217
+ <div className="w-96 space-y-4">
218
+ {answers ? (
219
+ <pre className="rounded-md bg-muted p-3 text-xs">{JSON.stringify(answers, null, 2)}</pre>
220
+ ) : (
221
+ <Questionnaire questions={MIXED_QUESTIONS} onComplete={(a) => setAnswers(a)} />
222
+ )}
223
+ </div>
224
+ )
225
+ },
226
+ }
227
+
228
+ // ─── RealisticUse: agent clarification prompt ─────────────────────────────────
229
+
230
+ const AGENT_QUESTIONS: QuestionnaireQuestion[] = [
231
+ {
232
+ id: "intent",
233
+ prompt: "What would you like to do with the tokens v2 proposal?",
234
+ type: "single",
235
+ options: [
236
+ { value: "review", label: "Schedule a review with the full team" },
237
+ { value: "approve", label: "Approve it as-is and move to implementation" },
238
+ { value: "revise", label: "Request revisions before moving forward" },
239
+ { value: "defer", label: "Defer until Q4 planning" },
240
+ ],
241
+ },
242
+ {
243
+ id: "stakeholders",
244
+ prompt: "Who else needs to be in the loop?",
245
+ type: "multiple",
246
+ options: [
247
+ { value: "riley", label: "Riley Okafor — brand lead" },
248
+ { value: "jordan", label: "Jordan Reeves — design systems" },
249
+ { value: "avery", label: "Avery Nakamura — engineering" },
250
+ { value: "morgan", label: "Morgan Castellano — product" },
251
+ ],
252
+ },
253
+ {
254
+ id: "notes",
255
+ prompt: "Any context you'd like added to the calendar invite? (optional)",
256
+ type: "freeform",
257
+ skippable: true,
258
+ skipLabel: "No context needed",
259
+ },
260
+ ]
261
+
262
+ export const RealisticUse: Story = {
263
+ render: () => {
264
+ const [answers, setAnswers] = React.useState<Record<string, string | string[] | null> | null>(null)
265
+ return (
266
+ <div className="w-[420px] rounded-xl border border-border bg-card p-6 shadow-sm">
267
+ <p className="mb-1 text-xs font-medium text-muted-foreground uppercase tracking-wide">
268
+ Agent · Clarify intent
269
+ </p>
270
+ {answers ? (
271
+ <div className="space-y-3">
272
+ <p className="text-sm font-medium text-foreground">
273
+ Got it. Scheduling the review with the selected stakeholders.
274
+ </p>
275
+ <pre className="rounded-md bg-muted p-3 text-xs">{JSON.stringify(answers, null, 2)}</pre>
276
+ </div>
277
+ ) : (
278
+ <Questionnaire
279
+ questions={AGENT_QUESTIONS}
280
+ onComplete={(a) => setAnswers(a)}
281
+ onSkip={(id) => console.log("Skipped", id)}
282
+ />
283
+ )}
284
+ </div>
285
+ )
286
+ },
287
+ }
@@ -1,3 +1,5 @@
1
+ // Sidebar is a client component — it builds a React context and drives its
2
+ // open/collapsed state through hooks, none of which exist on the server.
1
3
  // Motion: rail hover narrowed transition-all → transition-colors (only the after-bg animates; explicit-properties rule).
2
4
  // Sidebar sticky container gained `h-svh` so the bg always spans the
3
5
  // viewport even when the menu is shorter than the screen. No new variants
@@ -0,0 +1,97 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { SkeletonTable } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
3
+ import {
4
+ Table,
5
+ TableBody,
6
+ TableCell,
7
+ TableHead,
8
+ TableHeader,
9
+ TableRow,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/table";
11
+
12
+ // SkeletonTable ships in skeleton.tsx alongside Skeleton and SkeletonRegion, but
13
+ // it gets its OWN stories file rather than extra exports on Skeleton.stories.tsx.
14
+ // A stories file has exactly one default export, so a second `Meta` const in the
15
+ // same file is inert: its `title` is ignored and every story it claims renders
16
+ // under the file's real meta instead — mis-titled and impossible to find under
17
+ // its own name in the sidebar.
18
+ const meta: Meta<typeof SkeletonTable> = {
19
+ title: "Components/SkeletonTable",
20
+ component: SkeletonTable,
21
+ parameters: { layout: "padded" },
22
+ tags: ["autodocs"],
23
+ argTypes: {
24
+ rows: { control: { type: "number", min: 1, max: 20 } },
25
+ columns: { control: { type: "number", min: 1, max: 12 } },
26
+ showHeader: { control: "boolean" },
27
+ animation: { control: "select", options: ["pulse", "wave", false] },
28
+ },
29
+ };
30
+
31
+ export default meta;
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const Default: Story = {
35
+ render: () => <SkeletonTable />,
36
+ };
37
+
38
+ /** For tables whose header renders separately, or is sticky outside the scroll area. */
39
+ export const NoHeader: Story = {
40
+ render: () => <SkeletonTable showHeader={false} />,
41
+ };
42
+
43
+ export const CustomShape: Story = {
44
+ render: () => <SkeletonTable rows={3} columns={6} />,
45
+ };
46
+
47
+ export const Animation_Wave: Story = {
48
+ render: () => <SkeletonTable animation="wave" />,
49
+ };
50
+
51
+ export const Animation_None: Story = {
52
+ render: () => <SkeletonTable animation={false} />,
53
+ };
54
+
55
+ /**
56
+ * The placeholder and the table it stands in for, one above the other. Row and
57
+ * column counts should match the real table's shape — a 5×4 skeleton that
58
+ * resolves into a 3×6 table reads as a layout bug rather than a load.
59
+ */
60
+ export const RealisticUse: Story = {
61
+ render: () => (
62
+ <div className="w-full max-w-[720px] space-y-8">
63
+ <div>
64
+ <p className="mb-3 text-sm text-muted-foreground">
65
+ Loading — 4 rows × 3 columns, matching the table below.
66
+ </p>
67
+ <SkeletonTable rows={4} columns={3} />
68
+ </div>
69
+ <div>
70
+ <p className="mb-3 text-sm text-muted-foreground">Loaded</p>
71
+ <Table>
72
+ <TableHeader>
73
+ <TableRow>
74
+ <TableHead>Reviewer</TableHead>
75
+ <TableHead>Component</TableHead>
76
+ <TableHead>Status</TableHead>
77
+ </TableRow>
78
+ </TableHeader>
79
+ <TableBody>
80
+ {[
81
+ ["Seo-yun Park", "MultiSelect", "Approved"],
82
+ ["Marcus Lindqvist", "TreeSelect", "Changes requested"],
83
+ ["Anika Patel", "DataTable", "Approved"],
84
+ ["Chloé Dubois-Martin", "TagsInput", "In review"],
85
+ ].map(([reviewer, component, status]) => (
86
+ <TableRow key={reviewer}>
87
+ <TableCell className="font-medium">{reviewer}</TableCell>
88
+ <TableCell>{component}</TableCell>
89
+ <TableCell className="text-muted-foreground">{status}</TableCell>
90
+ </TableRow>
91
+ ))}
92
+ </TableBody>
93
+ </Table>
94
+ </div>
95
+ </div>
96
+ ),
97
+ };
@@ -90,7 +90,8 @@ export const Group_JustifyVariants: StoryObj = {
90
90
 
91
91
  export const Group_NoWrap: StoryObj = {
92
92
  render: () => (
93
- <Group wrap={false} gap="sm" className="overflow-x-auto max-w-xs">
93
+ // tabIndex={0} makes the scrollable region keyboard-accessible (axe scrollable-region-focusable)
94
+ <Group wrap={false} gap="sm" className="overflow-x-auto max-w-xs" tabIndex={0} aria-label="Workflow step progress">
94
95
  <Badge variant="secondary">Step 1</Badge>
95
96
  <Badge variant="secondary">Step 2</Badge>
96
97
  <Badge variant="secondary">Step 3</Badge>
@@ -105,20 +105,68 @@ export const Default: Story = {
105
105
  // New TabsPanels primitive — cross-fades between forceMount'd panels instead of
106
106
  // unmount/remount. Use when switching tabs would cause a flash (iframes, charts,
107
107
  // anything with expensive first render).
108
+ //
109
+ // The panels here SCROLL on purpose, and the default panel is deliberately NOT
110
+ // the last sibling. Every forceMount'd panel is absolutely stacked at inset-0,
111
+ // so before TabsPanels set an explicit z-order the later siblings sat on top of
112
+ // the active one. Invisible in Chromium — but Safari's async scrolling tree
113
+ // hit-tests those overlapping scroll containers without honouring
114
+ // `pointer-events: none`, so the transparent sibling ate the wheel gesture and
115
+ // the visible panel refused to scroll. Keep this story's shape (scrollable
116
+ // content + a non-last default) so a regression is reproducible by hand.
108
117
  export const RealisticUse: Story = {
109
118
  render: () => (
110
- <Tabs defaultValue="cards" className="w-[600px] h-[200px]">
119
+ <Tabs defaultValue="reviewers" className="w-[600px] h-[240px]">
111
120
  <TabsList>
112
- <TabsTrigger value="cards">Cards</TabsTrigger>
113
- <TabsTrigger value="dashboard">Dashboard</TabsTrigger>
121
+ <TabsTrigger value="reviewers">Reviewers</TabsTrigger>
122
+ <TabsTrigger value="activity">Activity</TabsTrigger>
114
123
  </TabsList>
115
- <div className="relative flex-1 mt-4 border rounded-lg overflow-hidden h-[140px]">
124
+ <div className="relative flex-1 mt-4 border rounded-lg overflow-hidden h-[180px]">
116
125
  <TabsPanels>
117
- <TabsContent value="cards" forceMount className="m-0 size-full p-4">
118
- Cards panel — cross-fades in.
126
+ <TabsContent
127
+ value="reviewers"
128
+ forceMount
129
+ className="m-0 size-full overflow-y-auto p-4"
130
+ >
131
+ <ul className="flex flex-col gap-3 text-sm">
132
+ {[
133
+ ["Jordan Reeves", "jordan@reeves.design"],
134
+ ["Seo-yun Park", "seoyun.park@figma.com"],
135
+ ["Marcus Lindqvist", "marcus@lindqvist.dev"],
136
+ ["Anika Patel", "anika.patel@stripe.com"],
137
+ ["Tomás Herrera", "tomas.herrera@vercel.com"],
138
+ ["Yuki Tanaka", "yuki.tanaka@linear.app"],
139
+ ["Chloé Dubois-Martin", "chloe@dubois-martin.fr"],
140
+ ["Kofi Asante", "kofi.asante@gmail.com"],
141
+ ].map(([name, email]) => (
142
+ <li key={email} className="flex min-w-0 flex-col">
143
+ <span className="truncate font-medium">{name}</span>
144
+ <span className="truncate text-muted-foreground">{email}</span>
145
+ </li>
146
+ ))}
147
+ </ul>
119
148
  </TabsContent>
120
- <TabsContent value="dashboard" forceMount className="m-0 size-full p-4">
121
- Dashboard panel — cross-fades in.
149
+ <TabsContent
150
+ value="activity"
151
+ forceMount
152
+ className="m-0 size-full overflow-y-auto p-4"
153
+ >
154
+ <ol className="flex flex-col gap-3 text-sm">
155
+ {[
156
+ "Seo-yun Park opened tokens-v2-proposal",
157
+ "Marcus Lindqvist approved the semantic token rename",
158
+ "Anika Patel flagged a AAA contrast miss on --muted-foreground",
159
+ "Jordan Reeves published v0.28.0 to the registry",
160
+ "Kofi Asante forked the system for a new engagement",
161
+ "Yuki Tanaka requested a dark-mode review",
162
+ "Tomás Herrera closed the chart palette thread",
163
+ "Chloé Dubois-Martin added the French microcopy pass",
164
+ ].map((entry) => (
165
+ <li key={entry} className="text-muted-foreground">
166
+ {entry}
167
+ </li>
168
+ ))}
169
+ </ol>
122
170
  </TabsContent>
123
171
  </TabsPanels>
124
172
  </div>
@@ -1,3 +1,5 @@
1
+ // Textarea is a client component — the character count lives in useState, so it
2
+ // cannot be rendered from a React Server Component.
1
3
  import type { Meta, StoryObj } from "@storybook/react";
2
4
  import { Textarea } from "@behavioral-agentic-design-system/core/components/ui/textarea";
3
5
  import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
@@ -0,0 +1,106 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Info } from "lucide-react";
4
+ import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
5
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
6
+ import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
7
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
8
+
9
+ const meta: Meta<typeof ToggleTip> = {
10
+ title: "Components/ToggleTip",
11
+ component: ToggleTip,
12
+ parameters: { layout: "centered" },
13
+ tags: ["autodocs"],
14
+ };
15
+
16
+ export default meta;
17
+
18
+ export const Default: StoryObj = {
19
+ render: () => (
20
+ <ToggleTip content="Semantic tokens alias primitives, so one brand change propagates everywhere.">
21
+ <Button variant="ghost" size="icon" aria-label="More about semantic tokens">
22
+ <Info strokeWidth={1.5} className="size-4" />
23
+ </Button>
24
+ </ToggleTip>
25
+ ),
26
+ };
27
+
28
+ export const Disabled: StoryObj = {
29
+ render: () => (
30
+ <ToggleTip
31
+ disabled
32
+ content="This tip never opens while the trigger is disabled."
33
+ >
34
+ <Button variant="ghost" size="icon" aria-label="More about semantic tokens">
35
+ <Info strokeWidth={1.5} className="size-4" />
36
+ </Button>
37
+ </ToggleTip>
38
+ ),
39
+ };
40
+
41
+ export const WithFormLabel: StoryObj = {
42
+ render: () => (
43
+ <div className="w-80 space-y-3">
44
+ <div className="flex items-center gap-1">
45
+ <Label htmlFor="npm-scope">npm scope</Label>
46
+ <ToggleTip
47
+ side="right"
48
+ content="The package prefix your forks import from. The npm package name stays @behavioral-agentic-design-system/core even after a rename."
49
+ >
50
+ <Button
51
+ variant="ghost"
52
+ size="icon-sm"
53
+ aria-label="What is an npm scope?"
54
+ >
55
+ <Info strokeWidth={1.5} className="size-4" />
56
+ </Button>
57
+ </ToggleTip>
58
+ </div>
59
+ <Input id="npm-scope" defaultValue="@behavioral-agentic-design-system" />
60
+ </div>
61
+ ),
62
+ };
63
+
64
+ export const RealisticUse: StoryObj = {
65
+ render: () => (
66
+ <div className="w-96 space-y-4 rounded-lg border border-border bg-card p-4">
67
+ <p className="text-sm font-medium text-foreground">Fork settings</p>
68
+ <div className="flex items-center justify-between gap-3">
69
+ <div className="flex items-center gap-1">
70
+ <span className="text-sm text-foreground">Client savings to date</span>
71
+ <ToggleTip
72
+ side="top"
73
+ content="Computed by pnpm roi:report from the registry's costModel hours at the rates in roi/rates.json. Jordan Reeves' fork is at $182,450."
74
+ >
75
+ <Button
76
+ variant="ghost"
77
+ size="icon-sm"
78
+ aria-label="How is client savings calculated?"
79
+ >
80
+ <Info strokeWidth={1.5} className="size-4" />
81
+ </Button>
82
+ </ToggleTip>
83
+ </div>
84
+ <span className="text-sm font-medium text-foreground">$182,450</span>
85
+ </div>
86
+ <div className="flex items-center justify-between gap-3">
87
+ <div className="flex items-center gap-1">
88
+ <span className="text-sm text-foreground">Components shipped</span>
89
+ <ToggleTip
90
+ side="bottom"
91
+ content="Primitives published from packages/core. Run pnpm build:tokens after any token change so the count reflects reality."
92
+ >
93
+ <Button
94
+ variant="ghost"
95
+ size="icon-sm"
96
+ aria-label="What counts as a shipped component?"
97
+ >
98
+ <Info strokeWidth={1.5} className="size-4" />
99
+ </Button>
100
+ </ToggleTip>
101
+ </div>
102
+ <span className="text-sm font-medium text-foreground">36 components</span>
103
+ </div>
104
+ </div>
105
+ ),
106
+ };
package/src/styles.css CHANGED
@@ -4,20 +4,31 @@
4
4
  /* @behavioral-agentic-design-system/core — single-file theme import.
5
5
  *
6
6
  * Usage in your app's global stylesheet:
7
+ * @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
7
8
  * @import "tailwindcss";
8
9
  * @import "tw-animate-css";
9
10
  * @import "@behavioral-agentic-design-system/core/styles.css";
10
11
  *
11
- * Atkinson Hyperlegible loaded from Google Fonts; zero font setup required.
12
- * Override any token by re-declaring it after this @import.
12
+ * fonts-cdn.css goes FIRST and is optional — skip it if the app loads Inter
13
+ * and Atkinson Hyperlegible itself (next/font, self-hosted woff2). Everything
14
+ * else about font setup is zero-config. Override any token by re-declaring it
15
+ * after this @import.
13
16
  */
14
17
 
15
- /* Inter Variable leads (the default sans) as the zero-setup CDN fallback;
16
- * Atkinson Hyperlegible stays as the accessibility-preserving secondary.
17
- * Self-hosted equivalents in fonts.css win when consumers copy the binaries
18
- * (see note below). */
19
- @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
20
- @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
18
+ /* This file deliberately contains NO remote `@import url(...)`.
19
+ *
20
+ * CSS only allows @import ahead of all rules. A consumer imports this file
21
+ * AFTER `@import "tailwindcss"`, which expands into real rules — so a remote
22
+ * @import here parses as invalid CSS, lightningcss/Turbopack fails the whole
23
+ * stylesheet, and every route 500s. It went unnoticed for a long time because
24
+ * the preview app in this repo never imports this file the way a consumer
25
+ * does; it reads styles/globals.css, where the font imports lead. The Google
26
+ * Fonts CDN faces now live in the separate fonts-cdn.css, which a consumer
27
+ * places before Tailwind. check:consumer-css compiles the documented usage
28
+ * above and fails if this ever regresses.
29
+ *
30
+ * The relative imports below are fine: the bundler inlines them rather than
31
+ * leaving an @import statement in the output. */
21
32
 
22
33
  /* Self-hosted brand faces shipped inside this package. fonts.css holds the
23
34
  * canonical SIL OFL defaults (Hyperlegible Sans, 6 weights). brand-fonts.css
@@ -26,8 +37,9 @@
26
37
  * — consumers copy the binaries from
27
38
  * `node_modules/@behavioral-agentic-design-system/core/fonts/` into their own
28
39
  * `public/fonts/` so the URLs resolve. See CLIENT_ONBOARDING.md → Shipping
29
- * fonts. CSS @import order: Google Fonts first (lowest priority fallback),
30
- * then local @font-face rules so the brand stack wins.
40
+ * fonts. Load order still puts the CDN faces first (lowest priority fallback)
41
+ * and these local @font-face rules after, so the brand stack wins — that
42
+ * ordering is now the consumer's import order, not this file's.
31
43
  */
32
44
  @import "./fonts.css";
33
45
  @import "./brand-fonts.css";