@behavioral-agentic-design-system/core 0.30.0 → 0.32.1

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.
@@ -10,7 +10,7 @@ const codeVariants = cva("font-mono text-muted-foreground bg-muted", {
10
10
  variant: {
11
11
  inline: "inline rounded px-[0.3em] py-[0.1em] text-xs",
12
12
  block:
13
- "block w-full rounded-md border border-border px-3 py-2.5 text-sm leading-relaxed overflow-x-auto whitespace-pre outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
13
+ "block w-full rounded-md border border-border px-3 py-2.5 text-sm leading-relaxed overflow-x-auto scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent whitespace-pre outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
14
14
  },
15
15
  size: {
16
16
  sm: "",
@@ -143,3 +143,4 @@ export * from "./stack";
143
143
  export * from "./container";
144
144
  export * from "./simple-grid";
145
145
  export * from "./close-button";
146
+ export * from "./toggle-tip";
@@ -31,6 +31,15 @@ type ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root> & {
31
31
  * className still wins for one-off values.
32
32
  */
33
33
  size?: "sm" | "default" | "lg"
34
+ /**
35
+ * Semantic color intent for the indicator fill (peer parity: Mantine
36
+ * Progress `color`, MUI LinearProgress `color`, Chakra `colorScheme`,
37
+ * Ant Design Progress `status`). Changes only the filled portion — the
38
+ * track stays primary-tinted so the empty rail is always neutral.
39
+ * Intent is purely visual: never use it as the sole signal of status;
40
+ * pair with a label or aria-label that names the state.
41
+ */
42
+ intent?: "default" | "success" | "warning" | "error" | "info"
34
43
  }
35
44
 
36
45
  // Mirrors Radix Progress's built-in getValueLabel default so the visible
@@ -39,6 +48,14 @@ function defaultGetValueLabel(value: number, max: number) {
39
48
  return `${Math.round((value / max) * 100)}%`
40
49
  }
41
50
 
51
+ const intentIndicatorClass = {
52
+ default: "bg-primary",
53
+ success: "bg-success",
54
+ warning: "bg-warning",
55
+ error: "bg-destructive",
56
+ info: "bg-info",
57
+ } as const
58
+
42
59
  function Progress({
43
60
  className,
44
61
  value,
@@ -47,6 +64,7 @@ function Progress({
47
64
  label,
48
65
  showValue,
49
66
  size = "default",
67
+ intent = "default",
50
68
  ...props
51
69
  }: ProgressProps) {
52
70
  const labelId = React.useId()
@@ -100,7 +118,11 @@ function Progress({
100
118
  >
101
119
  <ProgressPrimitive.Indicator
102
120
  data-slot="progress-indicator"
103
- className="h-full w-full flex-1 bg-primary transition-transform"
121
+ data-intent={intent}
122
+ className={cn(
123
+ "h-full w-full flex-1 transition-transform",
124
+ intentIndicatorClass[intent]
125
+ )}
104
126
  style={{ transform: `translateX(-${100 - fillPercent}%)` }}
105
127
  />
106
128
  </ProgressPrimitive.Root>
@@ -288,26 +288,43 @@ export function Questionnaire({
288
288
  onAdvance={() => canAdvance && advance(false)}
289
289
  />
290
290
 
291
- {/* Navigation */}
292
- <div className="flex items-center gap-2 pt-1">
293
- {step > 0 ? (
294
- <Button
295
- variant="ghost"
296
- size="xl"
297
- onClick={goBack}
298
- aria-label="Previous question"
299
- >
300
- <ChevronLeftIcon className="size-4" strokeWidth={1.5} />
301
- Back
302
- </Button>
303
- ) : (
304
- <div />
305
- )}
306
- <div className="flex-1" />
291
+ {/* Navigation
292
+ *
293
+ * Two groups with justify-between, and flex-wrap, rather than one row
294
+ * with a flex-1 spacer. On the final step of a skippable question all
295
+ * three controls are present at once (Back + the skip label + Finish),
296
+ * and a skip label is author-supplied prose — "No context needed" in the
297
+ * showcase. Flex children default to min-width:auto, so none of the
298
+ * three would shrink; without wrapping the row simply overflowed its
299
+ * card and Finish rendered outside the border.
300
+ *
301
+ * Not solved with min-w-0 + truncate: these are the CTA labels, and a
302
+ * clipped "No context need…" is worse than a second line. Not solved by
303
+ * shortening the label either — the component cannot bound what a
304
+ * consumer passes. Wrapping is the only fix that holds for any label
305
+ * length, which is what CLAUDE.md's long-label contract asks for.
306
+ */}
307
+ <div className="flex flex-wrap items-center justify-between gap-2 pt-1">
308
+ <div className="flex min-w-0 items-center gap-2">
309
+ {step > 0 && (
310
+ <Button
311
+ variant="ghost"
312
+ size="default"
313
+ className="min-h-11"
314
+ onClick={goBack}
315
+ aria-label="Previous question"
316
+ >
317
+ <ChevronLeftIcon className="size-4" strokeWidth={1.5} />
318
+ Back
319
+ </Button>
320
+ )}
321
+ </div>
322
+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-2">
307
323
  {question.skippable && (
308
324
  <Button
309
325
  variant="ghost"
310
- size="xl"
326
+ size="default"
327
+ className="min-h-11"
311
328
  onClick={() => advance(true)}
312
329
  >
313
330
  {question.skipLabel ?? "Skip"}
@@ -328,6 +345,7 @@ export function Questionnaire({
328
345
  "Finish"
329
346
  )}
330
347
  </Button>
348
+ </div>
331
349
  </div>
332
350
  </div>
333
351
  )
@@ -116,4 +116,86 @@ function SkeletonRegion({
116
116
  )
117
117
  }
118
118
 
119
- export { Skeleton, SkeletonRegion }
119
+ // Pre-seeded width pattern so cells look organic across rows and columns.
120
+ const CELL_WIDTHS = ["75%", "90%", "60%", "80%", "70%", "85%", "65%", "95%"]
121
+
122
+ type SkeletonTableProps = React.ComponentProps<"div"> & {
123
+ /**
124
+ * Number of data rows (not counting the header). Default 5.
125
+ */
126
+ rows?: number
127
+ /**
128
+ * Number of columns. Default 4.
129
+ */
130
+ columns?: number
131
+ /**
132
+ * Render a header row above the data rows. Default true.
133
+ */
134
+ showHeader?: boolean
135
+ /** Loading motion — same contract as Skeleton. */
136
+ animation?: "pulse" | "wave" | false
137
+ }
138
+
139
+ function SkeletonTable({
140
+ className,
141
+ rows = 5,
142
+ columns = 4,
143
+ showHeader = true,
144
+ animation = "pulse",
145
+ ...props
146
+ }: SkeletonTableProps) {
147
+ const rowCount = Math.max(1, Math.floor(rows))
148
+ const colCount = Math.max(1, Math.floor(columns))
149
+ const dataAnimation =
150
+ animation === "pulse" ? undefined : animation === false ? "none" : "wave"
151
+ const baseClass =
152
+ animation === "pulse" ? "animate-pulse rounded-md bg-accent" : "rounded-md bg-accent"
153
+
154
+ return (
155
+ <div
156
+ data-slot="skeleton-table"
157
+ role="status"
158
+ aria-label="Loading table data"
159
+ className={cn("w-full overflow-x-auto", className)}
160
+ {...props}
161
+ >
162
+ <span className="sr-only">Loading…</span>
163
+ <div className="min-w-full" aria-hidden>
164
+ {showHeader && (
165
+ <div className="flex gap-3 border-b border-border pb-3 mb-3">
166
+ {Array.from({ length: colCount }, (_, i) => (
167
+ <div key={i} className="min-w-0 flex-1">
168
+ <div
169
+ data-slot="skeleton-line"
170
+ data-animation={dataAnimation}
171
+ className={cn(baseClass, "h-4")}
172
+ style={{ width: CELL_WIDTHS[i % CELL_WIDTHS.length] }}
173
+ />
174
+ </div>
175
+ ))}
176
+ </div>
177
+ )}
178
+ <div className="flex flex-col divide-y divide-border">
179
+ {Array.from({ length: rowCount }, (_, r) => (
180
+ <div key={r} className="flex gap-3 py-2.5">
181
+ {Array.from({ length: colCount }, (_, c) => (
182
+ <div key={c} className="min-w-0 flex-1">
183
+ <div
184
+ data-slot="skeleton-line"
185
+ data-animation={dataAnimation}
186
+ className={cn(baseClass, "h-4")}
187
+ style={{
188
+ width: CELL_WIDTHS[(r * colCount + c) % CELL_WIDTHS.length],
189
+ }}
190
+ />
191
+ </div>
192
+ ))}
193
+ </div>
194
+ ))}
195
+ </div>
196
+ </div>
197
+ </div>
198
+ )
199
+ }
200
+
201
+ export { Skeleton, SkeletonRegion, SkeletonTable }
@@ -8,7 +8,20 @@ function Table({ className, ...props }: React.ComponentProps<"table">) {
8
8
  return (
9
9
  <div
10
10
  data-slot="table-container"
11
- className="relative w-full overflow-x-auto"
11
+ // The container scrolls horizontally, so it must be keyboard-reachable:
12
+ // axe fails an unfocusable scroll region as `scrollable-region-focusable`
13
+ // (serious), and a pointer-free user otherwise cannot reach the columns
14
+ // past the fold at all. Same treatment `code.tsx` already applies to its
15
+ // block variant. Unconditional rather than measured: a table's width
16
+ // depends on its content and its container, neither of which is known
17
+ // here, and a tab stop that is occasionally redundant is a far smaller
18
+ // cost than columns that are sometimes unreachable.
19
+ tabIndex={0}
20
+ // scrollbar-thin + a token-coloured thumb, so the scroller reads as part
21
+ // of the system instead of the OS default. First-party Tailwind v4.3
22
+ // utilities — no plugin. --border is the quiet mid-grey already audited
23
+ // at 3.79:1 against the page, clearing SC 1.4.11's 3:1 non-text floor.
24
+ className="relative w-full overflow-x-auto scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent"
12
25
  >
13
26
  <table
14
27
  data-slot="table"
@@ -191,6 +191,21 @@ function TabsContent({
191
191
  * unreliable across browsers; absolute-fill of an explicit-size relative
192
192
  * ancestor is the bulletproof pattern.
193
193
  *
194
+ * Scrolling requirement:
195
+ * When a panel's content overflows, put the overflow on the TabsContent
196
+ * ITSELF (`className="size-full overflow-y-auto"`) — never on a child div
197
+ * inside it. Radix gives TabsContent `role="tabpanel"`, `tabindex="0"`, and
198
+ * an accessible name from its trigger, so a scrollable TabsContent is
199
+ * keyboard-reachable and announced for free. A nested `overflow-y-auto` div
200
+ * is none of those things: it becomes a scrollable region no keyboard user
201
+ * can reach, which axe fails as `scrollable-region-focusable` (serious) —
202
+ * the exact violation that took `main` red on 2026-08-25. It also puts the
203
+ * scroll container one level BELOW the element this component z-orders,
204
+ * re-opening the Safari async-scrolling hit-test problem the z-10/z-0 rules
205
+ * above exist to close. One element that both stacks and scrolls is the
206
+ * whole fix; two nested ones reintroduce both bugs. `RealisticUse` in
207
+ * Tabs.stories.tsx is the worked example, and its a11y test is the guard.
208
+ *
194
209
  * Behavior:
195
210
  * - Inactive panels: opacity 0, pointer-events: none.
196
211
  * - Active panel: opacity 1, full pointer events.
@@ -224,6 +239,25 @@ function TabsPanels({
224
239
  "[&>[data-slot=tabs-content][data-state=inactive]]:opacity-0",
225
240
  "[&>[data-slot=tabs-content][data-state=inactive]]:pointer-events-none",
226
241
  "[&>[data-slot=tabs-content][data-state=active]]:opacity-100",
242
+ // Explicit stacking: the active panel paints ON TOP of the inactive
243
+ // ones. Without this the panels stack in DOM order, so any tab that
244
+ // isn't last sits UNDER its later siblings.
245
+ //
246
+ // In every other engine that's invisible (the siblings are opacity-0 +
247
+ // pointer-events-none). Safari/WebKit resolves wheel scrolling in its
248
+ // async scrolling tree, which hit-tests overlapping scroll containers
249
+ // WITHOUT honouring `pointer-events: none` — so a transparent sibling
250
+ // stacked above the active panel silently swallows the gesture and the
251
+ // tab "won't scroll" (mouse wheel and trackpad; keyboard and
252
+ // programmatic scrollTop still work, which is what makes it look like a
253
+ // rendering bug rather than a stacking one). Ordering the active panel
254
+ // on top removes the overlay from the scrolling hit-test entirely.
255
+ //
256
+ // z-10/z-0 (not z-index on the container) keeps this local: TabsPanels
257
+ // consumers wrap it in an `isolate` ancestor, so the stacking context
258
+ // never leaks past the panel area.
259
+ "[&>[data-slot=tabs-content][data-state=inactive]]:z-0",
260
+ "[&>[data-slot=tabs-content][data-state=active]]:z-10",
227
261
  className
228
262
  )}
229
263
  {...props}
@@ -0,0 +1,125 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
5
+
6
+ import { cn } from "../../lib/utils"
7
+ import { usePortalThemeClass } from "../../hooks/use-portal-theme-class"
8
+
9
+ interface ToggleTipProps {
10
+ /** The tip body. Informational, non-interactive by default. */
11
+ content: React.ReactNode
12
+ /**
13
+ * The trigger element — rendered via Radix `asChild`, so the consumer
14
+ * supplies the actual interactive element (usually an icon Button).
15
+ */
16
+ children: React.ReactNode
17
+ /** Preferred side for the tip. Matches Tooltip's default register. */
18
+ side?: "top" | "bottom" | "left" | "right"
19
+ /**
20
+ * Prevents the tip from opening. Gated on the wrapper's controlled open
21
+ * state (not just the trigger's native `disabled`) so it holds even when
22
+ * the asChild child is not a native button.
23
+ */
24
+ disabled?: boolean
25
+ /** Merged onto the content surface. */
26
+ className?: string
27
+ }
28
+
29
+ /**
30
+ * ToggleTip — a click-triggered, toggleable information overlay.
31
+ *
32
+ * Unlike Tooltip (hover/focus only — unreachable on touch devices and for
33
+ * users who can't hover), ToggleTip opens on click / tap / Enter / Space and
34
+ * toggles closed the same way. Canonical placement: an "info" icon button
35
+ * next to a form label. Ships an arrow like Tooltip but rides the normal
36
+ * Popover token surface (bg-popover), so normal semantic tokens are safe
37
+ * inside — it is NOT the inverted Tooltip surface.
38
+ *
39
+ * Cross-library primitive: Ark UI ToggleTip + Base UI both ship this shape.
40
+ */
41
+ function ToggleTip({
42
+ content,
43
+ children,
44
+ side = "top",
45
+ disabled = false,
46
+ className,
47
+ }: ToggleTipProps) {
48
+ const [open, setOpen] = React.useState(false)
49
+ // See use-portal-theme-class.ts: lets a PortalThemeProvider scope class
50
+ // (e.g. "atrium-theme") apply to portal content so theme-scoped CSS
51
+ // variables resolve inside the portal.
52
+ const portalThemeClass = usePortalThemeClass()
53
+
54
+ return (
55
+ <PopoverPrimitive.Root
56
+ data-slot="toggle-tip"
57
+ open={disabled ? false : open}
58
+ onOpenChange={(next) => {
59
+ if (!disabled) setOpen(next)
60
+ }}
61
+ >
62
+ <PopoverPrimitive.Trigger
63
+ data-slot="toggle-tip-trigger"
64
+ asChild
65
+ disabled={disabled}
66
+ >
67
+ {children}
68
+ </PopoverPrimitive.Trigger>
69
+ <PopoverPrimitive.Portal>
70
+ <PopoverPrimitive.Content
71
+ data-slot="toggle-tip-content"
72
+ side={side}
73
+ sideOffset={4}
74
+ className={cn(
75
+ "group z-50 w-fit max-w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover px-3 py-1.5 text-sm text-balance text-popover-foreground shadow-md outline-hidden transition-colors data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
76
+ portalThemeClass,
77
+ className
78
+ )}
79
+ style={{
80
+ transitionDuration: "var(--duration-fast)",
81
+ transitionTimingFunction: "var(--ease-out)",
82
+ }}
83
+ >
84
+ {content}
85
+ {/* The arrow is a rotated square, not Radix's filled polygon — the
86
+ * shadcn Tooltip pattern. Tooltip can leave it borderless because
87
+ * its surface is a solid inverted fill with no border; ToggleTip
88
+ * rides the bordered, shadowed popover surface, so an unbordered
89
+ * arrow reads as a detached white triangle hanging off the panel.
90
+ *
91
+ * A 45°-rotated square points at a corner, and only the TWO edges
92
+ * meeting at that corner are outside the panel — the other two are
93
+ * tucked under it, where a border would draw a line across the
94
+ * panel's own edge. So the borders are applied per side, keyed off
95
+ * the data-side Radix sets on the content (hence `group` above):
96
+ *
97
+ * side=top arrow points down → bottom + right edges
98
+ * side=bottom arrow points up → top + left edges
99
+ * side=left arrow points right → top + right edges
100
+ * side=right arrow points left → bottom + left edges
101
+ *
102
+ * shadow-md matches the panel so the elevation continues around the
103
+ * arrow instead of stopping at the panel edge. -translate 2px past
104
+ * half keeps the panel's own border from cutting across the base.
105
+ */}
106
+ <PopoverPrimitive.Arrow asChild>
107
+ <div
108
+ data-slot="toggle-tip-arrow"
109
+ className={cn(
110
+ "z-50 size-2.5 rotate-45 rounded-[2px] border border-border bg-popover shadow-md",
111
+ "group-data-[side=top]:translate-y-[calc(-50%_-_2px)] group-data-[side=top]:border-t-0 group-data-[side=top]:border-l-0",
112
+ "group-data-[side=bottom]:translate-y-[calc(50%_+_2px)] group-data-[side=bottom]:border-b-0 group-data-[side=bottom]:border-r-0",
113
+ "group-data-[side=left]:translate-x-[calc(-50%_-_2px)] group-data-[side=left]:border-b-0 group-data-[side=left]:border-l-0",
114
+ "group-data-[side=right]:translate-x-[calc(50%_+_2px)] group-data-[side=right]:border-t-0 group-data-[side=right]:border-r-0"
115
+ )}
116
+ />
117
+ </PopoverPrimitive.Arrow>
118
+ </PopoverPrimitive.Content>
119
+ </PopoverPrimitive.Portal>
120
+ </PopoverPrimitive.Root>
121
+ )
122
+ }
123
+
124
+ export { ToggleTip }
125
+ export default ToggleTip
@@ -16,6 +16,19 @@ export type DocGroup = {
16
16
  label: string;
17
17
  description: string;
18
18
  entries: DocEntry[];
19
+ /**
20
+ * Set on groups that only make sense while a repo is still the unbranded
21
+ * upstream template. `visibleDocGroups()` drops them once the repo is a
22
+ * renamed client fork, so a fork's Docs tab stops telling its own staff to
23
+ * onboard a design system that was onboarded months ago.
24
+ *
25
+ * The files stay on disk either way — this only controls what the tab
26
+ * SURFACES, so links to them from other docs keep resolving. If an entry in
27
+ * a retiring group is genuinely load-bearing for every fork (Chromatic's two
28
+ * docs are the example: Chromatic gates every fork's PRs), it belongs in a
29
+ * permanent group instead, not here.
30
+ */
31
+ retireAfterRename?: boolean;
19
32
  };
20
33
 
21
34
  export const DOCS_INDEX: DocGroup[] = [
@@ -112,6 +125,8 @@ export const DOCS_INDEX: DocGroup[] = [
112
125
  entries: [
113
126
  { title: "Design rules", path: "DESIGN.md", summary: "Visual system + accessibility baseline." },
114
127
  { title: "Release-please evaluation", path: "docs/release-please-evaluation.md", summary: "Decision record: release-please vs changesets. Recommendation — stay on changesets (BADS ships one package; human-authored changelogs fit the intentional-output ethos), revisit release-please when BADS goes multi-package or Night Shift's auto-merge cadence outpaces manual changeset authoring. Item 12 from the web-common spec." },
128
+ { title: "Oxlint + anti-slop evaluation", path: "docs/oxlint-anti-slop-evaluation.md", summary: "Spike (paused): dmmulroy/anti-slop TS rules + oxlint adoption (web-common Item 3). Finding — BADS's TypeScript is already clean of the low-signal patterns; the cheap win is oxlint's baseline (72 mostly-autofixable warnings), not the anti-slop pack. Recommended split: baseline + web-common React/cn rules + a few zero-cost ratchet rules; skip the high-backlog ones." },
129
+ { title: "StyleX evaluation", path: "docs/stylex-evaluation.md", summary: "Scouting note (not adopted): Meta's compile-time atomic CSS-in-JS. Verdict — a replacement for BADS's Tailwind-v4 foundation, not an addition; rewriting it would invalidate the className-scanning lint suite that is BADS's value. Worth remembering only for a green-field v2 'creative OS' layer, for its deterministic cross-boundary token merge." },
115
130
  { title: "Token migration", path: "docs/token-migration.md", summary: "The pattern for renaming/restructuring tokens in a fork without a heroic all-at-once PR: a token-migration.json old→new mapping enforced diff-aware (changed files held to new names, legacy tolerated in untouched files) via pnpm check:token-migration, plus a copy-pasteable mapping table. Adapted from web-common." },
116
131
  { title: "Chart color palette", path: "docs/chart-color-palette.md", summary: "Accessible 5-color categorical palette for data viz — Okabe-Ito-derived, reviewed against WCAG 1.4.11 non-text contrast." },
117
132
  { title: "Chart design", path: "docs/chart-design.md", summary: "Chart composition rules — grid, axes, labels, legend, tooltip, number formatting, states, motion. The 'data is the only saturated thing' register; companion to the color palette." },
@@ -122,10 +137,17 @@ export const DOCS_INDEX: DocGroup[] = [
122
137
  { title: "Anti-defaults refresh", path: "prompts/anti-defaults-refresh.md", summary: "Quarterly pressure-test of the current anti-defaults." },
123
138
  { title: "Promote corrections", path: "prompts/promote-corrections.md", summary: "Monthly: corrections → lint promotion candidates." },
124
139
  { title: "Recipe miner", path: "prompts/recipe-miner.md", summary: "Monthly: ship-first vs bounce-recipe ranking." },
140
+ { title: "Chromatic setup", path: "docs/chromatic-setup.md", summary: "Wiring the visual-regression gate that runs on every story-relevant PR. Lives here rather than under onboarding because Chromatic gates every fork's PRs for the life of the fork, not just its first week." },
141
+ { title: "Chromatic prompt", path: "prompts/chromatic.md", summary: "AI-guided version of the Chromatic setup walkthrough." },
125
142
  ],
126
143
  },
127
144
  {
128
145
  id: "onboarding",
146
+ // Retires itself once the repo is a renamed fork — see `retireAfterRename`
147
+ // on DocGroup. Every entry below is a one-time, pre-branding step; a fork
148
+ // that has already been branded has no use for any of them, and surfacing
149
+ // them tells its staff to re-run onboarding on their own live system.
150
+ retireAfterRename: true,
129
151
  label: "Client onboarding",
130
152
  description: "The flow that takes BADS from upstream template to a named client engagement.",
131
153
  entries: [
@@ -139,7 +161,6 @@ export const DOCS_INDEX: DocGroup[] = [
139
161
  { title: "4 · Tokens", path: "prompts/4-tokens.md" },
140
162
  { title: "5 · Component needs", path: "prompts/5-component-needs.md" },
141
163
  { title: "6 · Patterns", path: "prompts/6-patterns.md" },
142
- { title: "Chromatic setup", path: "docs/chromatic-setup.md" },
143
164
  {
144
165
  title: "Handoff runbook",
145
166
  path: "docs/handoff-runbook.md",
@@ -152,7 +173,6 @@ export const DOCS_INDEX: DocGroup[] = [
152
173
  summary:
153
174
  "workspace:* to npm-consume — the migration every client fork runs so daily component releases actually arrive.",
154
175
  },
155
- { title: "Chromatic prompt", path: "prompts/chromatic.md" },
156
176
  ],
157
177
  },
158
178
  {
@@ -193,7 +213,33 @@ export const DOCS_INDEX: DocGroup[] = [
193
213
  },
194
214
  ];
195
215
 
216
+ /**
217
+ * Every entry in every group, retiring groups included. Kept as-is so any fork
218
+ * or consumer already importing it still compiles. For "how many docs does this
219
+ * repo actually show", use `docsTotal(visibleDocGroups(IS_CLIENT_FORK))`.
220
+ */
196
221
  export const DOCS_TOTAL = DOCS_INDEX.reduce((sum, g) => sum + g.entries.length, 0);
197
222
 
223
+ /**
224
+ * The groups a given repo should surface.
225
+ *
226
+ * Upstream BADS shows everything — it IS the template, and the onboarding flow
227
+ * is one of the things it ships. A renamed client fork drops the groups marked
228
+ * `retireAfterRename`, because those describe work that already happened.
229
+ *
230
+ * Pass `IS_CLIENT_FORK` from `@…/core/lib/fork`, which is resolved at BUILD
231
+ * time (not from `window`), so the server render and the client hydration agree
232
+ * and the sidebar doesn't flash a group it is about to remove.
233
+ */
234
+ export function visibleDocGroups(isClientFork: boolean): DocGroup[] {
235
+ if (!isClientFork) return DOCS_INDEX;
236
+ return DOCS_INDEX.filter((g) => !g.retireAfterRename);
237
+ }
238
+
239
+ /** Entry count for whichever set of groups you're rendering. */
240
+ export function docsTotal(groups: DocGroup[]): number {
241
+ return groups.reduce((sum, g) => sum + g.entries.length, 0);
242
+ }
243
+
198
244
  // linters, checks, audits, reports, and CI workflows — automation scripts in pnpm + .github
199
- export const AUTOMATION_COUNT = 48;
245
+ export const AUTOMATION_COUNT = 49;
@@ -0,0 +1,25 @@
1
+ /* GENERATED FROM tokens.json — DO NOT EDIT BY HAND.
2
+ * Run `pnpm build:tokens` after changing tokens.json. */
3
+
4
+ /* @behavioral-agentic-design-system/core — Google Fonts CDN faces (opt-in).
5
+ *
6
+ * Import this FIRST in your global stylesheet, ahead of Tailwind:
7
+ * @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
8
+ * @import "tailwindcss";
9
+ * @import "tw-animate-css";
10
+ * @import "@behavioral-agentic-design-system/core/styles.css";
11
+ *
12
+ * Remote @import statements are legal only before any rule, and Tailwind
13
+ * expands into rules — so these cannot live in styles.css, which is imported
14
+ * after it. Skip this file entirely if the app already loads Inter and
15
+ * Atkinson Hyperlegible itself (next/font, or self-hosted woff2 copied out of
16
+ * this package's fonts/ directory); the CDN is the zero-setup fallback, and
17
+ * the local @font-face rules in fonts.css win over it either way.
18
+ *
19
+ * Inter Variable leads as the default sans; Atkinson Hyperlegible stays as
20
+ * the accessibility-preserving secondary.
21
+ *
22
+ * This file must contain NO rules of its own — a single rule here would make
23
+ * the @import statements below invalid for anyone importing it. */
24
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
25
+ @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Is this repo a renamed client fork, or is it still the upstream template?
3
+ *
4
+ * `scripts/rename.mjs` writes `.client-identity.json` at the repo root when it
5
+ * brands a fork, and that file's existence is the canonical answer. But the
6
+ * question gets asked from client components (the Docs and Home tabs), which
7
+ * cannot read the filesystem — and reading it from `window` would answer
8
+ * `false` during the server render and `true` after hydration, so React would
9
+ * render the template shape first and then rip a group out of the sidebar.
10
+ *
11
+ * So it is resolved at BUILD time instead: `next.config.js` checks for the file
12
+ * and inlines the result as `NEXT_PUBLIC_BADS_IS_FORK`. Next substitutes
13
+ * `NEXT_PUBLIC_*` into the server and client bundles identically, so both
14
+ * renders agree and there is no flash.
15
+ *
16
+ * Deliberately NOT derived from `brand.config.ts` (`isUpstreamTemplate`, or
17
+ * `name !== "BADS"`): those are hand-editable content, and a fork that forgets
18
+ * to flip one would silently keep showing template-only docs. The identity file
19
+ * is written by the script, so it cannot drift from the rename itself.
20
+ */
21
+ export const IS_CLIENT_FORK = process.env.NEXT_PUBLIC_BADS_IS_FORK === "1";
@@ -10,12 +10,19 @@ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badg
10
10
  * semantic color, while the label stays text-foreground so it holds the
11
11
  * AAA 7:1 floor. Pair status badges with an icon or distinct label — never
12
12
  * color alone.
13
+ *
14
+ * Size ladder (peer parity: Mantine size, MUI Chip size, Chakra size):
15
+ * sm = dense inline labels, default = unchanged, lg = prominent surfaces.
16
+ * BADS text-xs = 14px and text-sm = 16px — both meet the AAA 14px floor.
13
17
  */
14
18
  const meta: Meta<typeof Badge> = {
15
19
  title: "Components/Badge",
16
20
  component: Badge,
17
21
  parameters: { layout: "centered" },
18
22
  tags: ["autodocs"],
23
+ argTypes: {
24
+ size: { control: "select", options: ["sm", "default", "lg"] },
25
+ },
19
26
  };
20
27
 
21
28
  export default meta;
@@ -81,6 +88,65 @@ export const Variant_Info: Story = {
81
88
  ),
82
89
  };
83
90
 
91
+ /**
92
+ * Size ladder — sm for dense inline labels, lg for prominent status callouts.
93
+ * All sizes use text-xs (14px) or text-sm (16px) — never below the 14px floor.
94
+ */
95
+ export const Size_Sm: Story = {
96
+ render: () => (
97
+ <div className="flex items-center gap-2">
98
+ <Badge size="sm">v2.4.1</Badge>
99
+ <Badge size="sm" variant="success">
100
+ <CircleCheck strokeWidth={1.5} aria-hidden />
101
+ Passing
102
+ </Badge>
103
+ </div>
104
+ ),
105
+ };
106
+
107
+ export const Size_Lg: Story = {
108
+ render: () => (
109
+ <div className="flex items-center gap-2">
110
+ <Badge size="lg">Beta</Badge>
111
+ <Badge size="lg" variant="warning">
112
+ <TriangleAlert strokeWidth={1.5} aria-hidden />
113
+ Degraded
114
+ </Badge>
115
+ </div>
116
+ ),
117
+ };
118
+
119
+ export const Sizes: Story = {
120
+ render: () => (
121
+ <div className="space-y-3">
122
+ <div className="flex items-center gap-2">
123
+ <Badge size="sm">sm</Badge>
124
+ <Badge size="sm" variant="secondary">Secondary</Badge>
125
+ <Badge size="sm" variant="success">
126
+ <CircleCheck strokeWidth={1.5} aria-hidden />
127
+ Passing
128
+ </Badge>
129
+ </div>
130
+ <div className="flex items-center gap-2">
131
+ <Badge>default</Badge>
132
+ <Badge variant="secondary">Secondary</Badge>
133
+ <Badge variant="success">
134
+ <CircleCheck strokeWidth={1.5} aria-hidden />
135
+ Passing
136
+ </Badge>
137
+ </div>
138
+ <div className="flex items-center gap-2">
139
+ <Badge size="lg">lg</Badge>
140
+ <Badge size="lg" variant="secondary">Secondary</Badge>
141
+ <Badge size="lg" variant="success">
142
+ <CircleCheck strokeWidth={1.5} aria-hidden />
143
+ Passing
144
+ </Badge>
145
+ </div>
146
+ </div>
147
+ ),
148
+ };
149
+
84
150
  export const RealisticUse: Story = {
85
151
  render: () => (
86
152
  <div className="flex max-w-md flex-col gap-3">