@behavioral-agentic-design-system/core 0.28.0 → 0.30.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 (106) hide show
  1. package/package.json +2 -2
  2. package/scripts/a11y-lint.cjs +78 -9
  3. package/scripts/build-tokens.cjs +273 -15
  4. package/scripts/wcag-audit.cjs +67 -11
  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 +5679 -3073
  9. package/src/app/preview/health/page.tsx +201 -0
  10. package/src/app/preview/layout.tsx +4 -1
  11. package/src/app/preview/showcase-filter.tsx +66 -0
  12. package/src/app/preview/tab-replay.tsx +63 -0
  13. package/src/app/shell.tsx +74 -18
  14. package/src/components/customize/save-bar.tsx +19 -6
  15. package/src/components/docs-tab.tsx +36 -24
  16. package/src/components/layers-tab.tsx +37 -5
  17. package/src/components/ui/alert.tsx +12 -0
  18. package/src/components/ui/badge.tsx +19 -0
  19. package/src/components/ui/button.tsx +10 -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/close-button.tsx +71 -0
  23. package/src/components/ui/combobox.tsx +62 -3
  24. package/src/components/ui/container.tsx +65 -0
  25. package/src/components/ui/date-field.tsx +368 -0
  26. package/src/components/ui/drawer.tsx +334 -0
  27. package/src/components/ui/file-button.tsx +145 -0
  28. package/src/components/ui/floating-indicator.tsx +217 -0
  29. package/src/components/ui/format-byte.tsx +113 -0
  30. package/src/components/ui/index.ts +21 -0
  31. package/src/components/ui/input-clear-button.tsx +52 -0
  32. package/src/components/ui/input.tsx +39 -20
  33. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  34. package/src/components/ui/loading-dots.tsx +99 -0
  35. package/src/components/ui/month-picker.tsx +296 -0
  36. package/src/components/ui/multi-select.tsx +35 -19
  37. package/src/components/ui/nav-link.tsx +200 -0
  38. package/src/components/ui/navigation-rail.tsx +256 -0
  39. package/src/components/ui/notification.tsx +20 -0
  40. package/src/components/ui/password-input.tsx +34 -1
  41. package/src/components/ui/progress.tsx +15 -1
  42. package/src/components/ui/prose.tsx +62 -0
  43. package/src/components/ui/questionnaire.tsx +334 -0
  44. package/src/components/ui/result.tsx +151 -0
  45. package/src/components/ui/rolling-number.tsx +1 -0
  46. package/src/components/ui/sidebar.tsx +5 -0
  47. package/src/components/ui/simple-grid.tsx +110 -0
  48. package/src/components/ui/skeleton.tsx +52 -3
  49. package/src/components/ui/squircle.tsx +274 -0
  50. package/src/components/ui/stack.tsx +105 -0
  51. package/src/components/ui/status-badge.tsx +93 -0
  52. package/src/components/ui/tabs.tsx +34 -7
  53. package/src/components/ui/tag.tsx +46 -5
  54. package/src/components/ui/textarea.tsx +5 -0
  55. package/src/components/ui/theme-icon.tsx +138 -0
  56. package/src/components/ui/timeline.tsx +27 -10
  57. package/src/components/ui/tooltip.tsx +12 -1
  58. package/src/components/ui/tree-select.tsx +386 -0
  59. package/src/components/ui/year-picker.tsx +307 -0
  60. package/src/data/docs-index.ts +12 -0
  61. package/src/hooks/use-global-primary-color.ts +57 -6
  62. package/src/lib/get-icon-color.ts +66 -0
  63. package/src/stories/Alert.stories.tsx +31 -1
  64. package/src/stories/Badge.stories.tsx +63 -6
  65. package/src/stories/Button.stories.tsx +3 -0
  66. package/src/stories/ChatMarker.stories.tsx +59 -0
  67. package/src/stories/Checkbox.stories.tsx +5 -0
  68. package/src/stories/CloseButton.stories.tsx +65 -0
  69. package/src/stories/Combobox.stories.tsx +74 -3
  70. package/src/stories/Container.stories.tsx +134 -0
  71. package/src/stories/DateField.stories.tsx +114 -0
  72. package/src/stories/Drawer.stories.tsx +211 -0
  73. package/src/stories/FileButton.stories.tsx +117 -0
  74. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  75. package/src/stories/FormatByte.stories.tsx +142 -0
  76. package/src/stories/Input.stories.tsx +94 -0
  77. package/src/stories/InputClearButton.stories.tsx +53 -0
  78. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  79. package/src/stories/LoadingDots.stories.tsx +73 -0
  80. package/src/stories/MonthPicker.stories.tsx +99 -0
  81. package/src/stories/MultiSelect.stories.tsx +7 -1
  82. package/src/stories/NavLink.stories.tsx +213 -0
  83. package/src/stories/NavigationRail.stories.tsx +413 -0
  84. package/src/stories/Notification.stories.tsx +53 -0
  85. package/src/stories/PasswordInput.stories.tsx +21 -0
  86. package/src/stories/Progress.stories.tsx +38 -0
  87. package/src/stories/Prose.stories.tsx +232 -0
  88. package/src/stories/Questionnaire.stories.tsx +287 -0
  89. package/src/stories/Result.stories.tsx +145 -0
  90. package/src/stories/RollingNumber.stories.tsx +1 -1
  91. package/src/stories/Sidebar.stories.tsx +2 -0
  92. package/src/stories/SimpleGrid.stories.tsx +130 -0
  93. package/src/stories/Skeleton.stories.tsx +62 -1
  94. package/src/stories/Squircle.stories.tsx +127 -0
  95. package/src/stories/Stack.stories.tsx +140 -0
  96. package/src/stories/StatusBadge.stories.tsx +125 -0
  97. package/src/stories/Tabs.stories.tsx +56 -1
  98. package/src/stories/Tag.stories.tsx +31 -0
  99. package/src/stories/Textarea.stories.tsx +2 -0
  100. package/src/stories/ThemeIcon.stories.tsx +97 -0
  101. package/src/stories/Timeline.stories.tsx +69 -0
  102. package/src/stories/Tooltip.stories.tsx +18 -0
  103. package/src/stories/TreeSelect.stories.tsx +222 -0
  104. package/src/stories/YearPicker.stories.tsx +100 -0
  105. package/src/styles.css +289 -15
  106. package/src/tokens.json +96 -1
@@ -58,6 +58,7 @@ export const DOCS_INDEX: DocGroup[] = [
58
58
  { title: "Component backlog", path: "docs/component-backlog.md", summary: "Figma-library primitives queued for Night Shift." },
59
59
  { title: "Component index", path: "COMPONENT_INDEX.md" },
60
60
  { title: "Component design rules", path: "COMPONENT_DESIGN.md" },
61
+ { title: "Atomic design taxonomy", path: "ATOMIC_DESIGN.md", summary: "Atoms → molecules → organisms → templates → pages, in RFC-2119 language (MUST/MUST NOT/SHOULD/MAY): what each level may do (business logic, data fetching, local state) and where it lives in BADS, plus a bucket A–D ↔ level cheat sheet. For engineers and AI agents; makes promoting a BADS component into a client library 1:1. Adapted from web-common." },
61
62
  { title: "Storybook rule", path: "STORYBOOK_RULE.md" },
62
63
  { title: "CTA size contract", path: "prompts/cta-size-contract.md" },
63
64
  { title: "Motion spec", path: "prompts/motion-spec.md" },
@@ -90,10 +91,15 @@ export const DOCS_INDEX: DocGroup[] = [
90
91
  { title: "Skill — persona-pressure-test", path: ".claude/skills/persona-pressure-test/SKILL.md" },
91
92
  { title: "Skill — promote-prototype", path: ".claude/skills/promote-prototype/SKILL.md" },
92
93
  { title: "Skill — visual-verify", path: ".claude/skills/visual-verify/SKILL.md" },
94
+ { title: "Skill — motion-review", path: ".claude/skills/motion-review/SKILL.md" },
95
+ { title: "Skill — redesign", path: ".claude/skills/redesign/SKILL.md", summary: "Re-skin an existing surface WITHOUT changing what it does — preserve copy / IA / routes / brand, rebuild only the visual + interaction layer with a fresh (diversified) fingerprint. Distinct from design-exploration (new surface) and component-builder (one component). Adapted BADS-native from Hallmark's redesign verb." },
93
96
  { title: "Prompt — conceptual model", path: "prompts/conceptual-model.md", summary: "Before sketching a product surface, name its domain objects, states, relationships, and vocabulary — Jamie Mill's 'most neglected layer,' wired into Path B as design-exploration step 3.5. Feeds the real-content pool, state patterns, and primitive selection." },
94
97
  { title: "Prompt — parallel rollout", path: "prompts/parallel-rollout.md", summary: "For a Path B build that's N similar surfaces: build one reference screen, turn it into an explicit contract, sign off on the contract, then fan the rest out against it (via Workflow) and verify each to the contract. Stops multi-screen drift. Adapted from the design-spec-framework." },
95
98
  { title: "Prompt — design directions", path: "prompts/design-directions.md" },
99
+ { title: "Prompt — plan & spec", path: "prompts/plan-and-spec.md", summary: "Lightweight per-feature convention: a matched plan (how you'll build it) + spec (the durable contract, in RFC-2119 language) under docs/plans/ and docs/specs/, dated and slugged the same. The trail that lets the next agent — or the client's team after the engagement — reconstruct why. Adapted from web-common's superpowers/plans + specs." },
100
+ { title: "Prompt — macrostructures", path: "prompts/macrostructures.md", summary: "Named menu of ~16 structural paradigms (the positive counterpart to the anti-defaults) with when-it-fits / what-it-costs each, plus a diversification rule so a fork's screens don't converge on one shape. Consumed at design-exploration step 3.7. Adapted BADS-native from Nutlope's Hallmark." },
96
101
  { title: "Prompt — design critique", path: "prompts/design-critique.md" },
102
+ { title: "Prompt — design DNA", path: "prompts/design-dna.md", summary: "Extract a single admired reference's DNA along three axes (macrostructure + type-pairing + colour anchor), refuse templates/marketplaces, and seed it into the fork's exemplars as a portable visual target. The single-reference counterpart to art-direction's gallery sweep. Adapted BADS-native from Hallmark's study verb." },
97
103
  { title: "Prompt — independent critique", path: "prompts/independent-critique.md" },
98
104
  { title: "Prompt — futures check", path: "prompts/futures-check.md" },
99
105
  { title: "Prompt — persona pressure test", path: "prompts/persona-pressure-test.md" },
@@ -105,6 +111,8 @@ export const DOCS_INDEX: DocGroup[] = [
105
111
  description: "How the system stays honest — anti-patterns, the corrections log, the ethics floor.",
106
112
  entries: [
107
113
  { title: "Design rules", path: "DESIGN.md", summary: "Visual system + accessibility baseline." },
114
+ { 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." },
115
+ { 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." },
108
116
  { 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." },
109
117
  { 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." },
110
118
  { title: "Privacy-first design (8 principles)", path: "layer-2-ethics-responsibility/privacy-first-design.md", summary: "Matthew Stephens' 8-principle privacy framework: minimize collection, transparency, expiration, no dark patterns, user control, ethical monetization, sustainable practices, accountability — mapped to BADS enforcement." },
@@ -177,6 +185,10 @@ export const DOCS_INDEX: DocGroup[] = [
177
185
  description: "Deferred plans — what we'd build if the activation signal fires.",
178
186
  entries: [
179
187
  { title: "Roadmap", path: "docs/roadmap.md", summary: "Layer 2/6/8/9/10 deferred work with the signal that should activate each one." },
188
+ { title: "Plan — skill package", path: "docs/plans/2026-08-21-skill-package.md", summary: "Approved plan: generate a per-fork, npx-installable agent skill — SKILL.md + drift-proof component recipes + token CSS — so the design system's rules travel into the client product repos where components are consumed. Phase A shipped; see the spec." },
189
+ { title: "Spec — skill package", path: "docs/specs/2026-08-21-skill-package.md", summary: "The durable contract for packages/skill: generated-only output, usage-focused recipes, ≤2k-word SKILL.md, deterministic builds, the check:skill staleness gate, and the eval --context=skill acceptance instrument." },
190
+ { title: "Plan — self-healing layer", path: "docs/plans/2026-08-21-self-healing-layer.md", summary: "Approved plan: the watch-half of the system — drift ledger, token intent validator, component health score, and a Health surface, assembled from signals BADS already owns; runtime telemetry deliberately deferred behind consent + futures-check." },
191
+ { title: "Spec — self-healing layer", path: "docs/specs/2026-08-21-self-healing-layer.md", summary: "Phase A contract: informational-only health score (Goodhart guard), no runtime telemetry, deterministic visible-copy intent rules, drift-ledger status convention, and the calibration record (6→0 false positives; two scoring bugs caught by face-checking)." },
180
192
  ],
181
193
  },
182
194
  ];
@@ -278,12 +278,57 @@ function clearPrimaryColor() {
278
278
  }
279
279
  }
280
280
 
281
+ /**
282
+ * Floor for the brand primary in dark mode. --primary feeds fills, the focus ring, and (via
283
+ * --link) inline link text, so the text floor is the one that has to hold.
284
+ */
285
+ const PRIMARY_DARK_FLOOR = 4.5;
286
+
287
+ /**
288
+ * Should the brand primary be written inline at all?
289
+ *
290
+ * The picker used to write --primary unconditionally, in both themes. That is fine for a brand
291
+ * colour with mid-to-high luminance and wrong for a dark one. A client fork whose brand primary is
292
+ * a deep navy measured 1.79:1 on the dark card and 1.98:1 on the dark page, producing 25 rendered
293
+ * contrast failures the moment dark mode actually rendered. tokens.json already carries a
294
+ * luminance-tuned dark primary for exactly this reason — the inline write was overwriting it.
295
+ *
296
+ * Same discipline as pickAccentForeground below, and the same rationale: an inline override that
297
+ * fails contrast is worse than no override, because the stylesheet value it replaces was tuned.
298
+ * Both are invisible to wcag:audit, which only sees declared tokens — pnpm check:contrast is what
299
+ * catches this class of bug.
300
+ */
301
+ function shouldWritePrimary(opt: PrimaryColorOption): boolean {
302
+ if (typeof document === "undefined") return true;
303
+ const html = document.documentElement;
304
+ if (!html.classList.contains("dark")) return true;
305
+ const bg = parseCssColorToRgb(
306
+ getComputedStyle(html).getPropertyValue("--background").trim(),
307
+ );
308
+ if (!bg) return true; // can't tell — leave existing behaviour alone
309
+ try {
310
+ return contrastRatio(rgbFromHex(opt.primary), bg) >= PRIMARY_DARK_FLOOR;
311
+ } catch {
312
+ return true;
313
+ }
314
+ }
315
+
281
316
  function applyColor(opt: PrimaryColorOption) {
282
317
  if (typeof document === "undefined") return;
283
318
  const root = document.documentElement.style;
284
- root.setProperty("--primary", opt.primary);
285
- root.setProperty("--primary-foreground", opt.primaryForeground);
286
- root.setProperty("--ring", opt.primary);
319
+ const writePrimary = shouldWritePrimary(opt);
320
+ if (writePrimary) {
321
+ root.setProperty("--primary", opt.primary);
322
+ root.setProperty("--primary-foreground", opt.primaryForeground);
323
+ root.setProperty("--ring", opt.primary);
324
+ } else {
325
+ // Remove rather than substitute. --primary-foreground goes too: it is paired with the brand
326
+ // colour, and leaving it behind would put the brand's foreground on the stylesheet's tuned
327
+ // dark primary — a pairing nobody chose and which measures worse than either default.
328
+ root.removeProperty("--primary");
329
+ root.removeProperty("--primary-foreground");
330
+ root.removeProperty("--ring");
331
+ }
287
332
 
288
333
  // --accent-foreground used to be set unconditionally to opt.primary. That
289
334
  // produced silent contrast failures when the brand color was too close in
@@ -300,9 +345,15 @@ function applyColor(opt: PrimaryColorOption) {
300
345
  root.removeProperty("--accent-foreground");
301
346
  }
302
347
 
303
- root.setProperty("--sidebar-primary", opt.primary);
304
- root.setProperty("--sidebar-primary-foreground", opt.primaryForeground);
305
- root.setProperty("--sidebar-ring", opt.primary);
348
+ if (writePrimary) {
349
+ root.setProperty("--sidebar-primary", opt.primary);
350
+ root.setProperty("--sidebar-primary-foreground", opt.primaryForeground);
351
+ root.setProperty("--sidebar-ring", opt.primary);
352
+ } else {
353
+ root.removeProperty("--sidebar-primary");
354
+ root.removeProperty("--sidebar-primary-foreground");
355
+ root.removeProperty("--sidebar-ring");
356
+ }
306
357
  // Inline-write the chart ramp so brand picker changes reach charts. The
307
358
  // stylesheet rule is precomputed by Lightning CSS into a frozen lab().
308
359
  writeChartRamp();
@@ -0,0 +1,66 @@
1
+ /**
2
+ * getIconColor — map a semantic icon *role* to the Tailwind class bound to the
3
+ * matching `--icon-*` token. This is the pattern for giving a custom icon set
4
+ * semantic colors instead of leaving everything to `currentColor`
5
+ * (see CLAUDE.md → Icons, and the `icon-*` token family in tokens.json).
6
+ *
7
+ * Adapted from web-common's `get-icon-color.ts`. Their failure mode: passing a
8
+ * token name (`"icon-brand-primary"`) or a raw Tailwind class (`"text-brand-…"`)
9
+ * instead of a semantic role falls through the map and renders the icon
10
+ * UNSTYLED — three call sites did exactly that and nothing caught it. Two guards
11
+ * here close that gap:
12
+ * 1. The input is the typed `IconRole` union, so a wrong string literal fails
13
+ * to type-check at compile time (better than a runtime fallthrough).
14
+ * 2. `pnpm lint:icon-color` catches the any-typed / prop-forwarded call sites a
15
+ * fork might add where the type can't see the value.
16
+ */
17
+ export const ICON_ROLES = [
18
+ "default",
19
+ "muted",
20
+ "primary",
21
+ "success",
22
+ "warning",
23
+ "error",
24
+ "info",
25
+ "inverse",
26
+ "disabled",
27
+ ] as const;
28
+
29
+ export type IconRole = (typeof ICON_ROLES)[number];
30
+
31
+ const ICON_COLOR_CLASS: Record<IconRole, string> = {
32
+ default: "text-icon-default",
33
+ muted: "text-icon-muted",
34
+ primary: "text-icon-primary",
35
+ success: "text-icon-success",
36
+ warning: "text-icon-warning",
37
+ error: "text-icon-error",
38
+ info: "text-icon-info",
39
+ inverse: "text-icon-inverse",
40
+ disabled: "text-icon-disabled",
41
+ };
42
+
43
+ /** Runtime guard for the any-typed boundary (a prop from JSON, a CMS field, etc.). */
44
+ export function isIconRole(value: unknown): value is IconRole {
45
+ return typeof value === "string" && (ICON_ROLES as readonly string[]).includes(value);
46
+ }
47
+
48
+ /**
49
+ * Returns the `text-icon-*` class for a semantic role. Pass a ROLE (`"error"`),
50
+ * never a token name (`"icon-error"`) or a class (`"text-icon-error"`). An
51
+ * unrecognized value logs a dev warning and falls back to `"default"` so the
52
+ * icon is never rendered invisibly; in production it falls back silently.
53
+ */
54
+ export function getIconColor(role: IconRole): string {
55
+ const cls = ICON_COLOR_CLASS[role];
56
+ if (!cls) {
57
+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
58
+ // eslint-disable-next-line no-console
59
+ console.warn(
60
+ `getIconColor: "${String(role)}" is not an icon role. Pass one of: ${ICON_ROLES.join(", ")}. Falling back to "default".`,
61
+ );
62
+ }
63
+ return ICON_COLOR_CLASS.default;
64
+ }
65
+ return cls;
66
+ }
@@ -9,7 +9,7 @@
9
9
  // Dismissible + WithAction: onDismiss renders a top-right × button; action
10
10
  // renders a row below AlertDescription. Both are optional and compose freely.
11
11
  import type { Meta, StoryObj } from "@storybook/react";
12
- import { AlertCircleIcon } from "lucide-react";
12
+ import { AlertCircleIcon, CheckCircle2Icon, TriangleAlertIcon, InfoIcon } from "lucide-react";
13
13
  import { Alert, AlertTitle, AlertDescription } from "@behavioral-agentic-design-system/core/components/ui/alert";
14
14
  import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
15
15
  import { Card, CardContent, CardHeader, CardTitle } from "@behavioral-agentic-design-system/core/components/ui/card";
@@ -59,6 +59,36 @@ export const Variant_Destructive: Story = {
59
59
  </div>),
60
60
  };
61
61
 
62
+ export const Variant_Success: Story = {
63
+ render: () => (<div className="w-[420px]">
64
+ <Alert variant="success">
65
+ <CheckCircle2Icon className="h-5 w-5" />
66
+ <AlertTitle>Changes saved</AlertTitle>
67
+ <AlertDescription>Your profile has been updated successfully.</AlertDescription>
68
+ </Alert>
69
+ </div>),
70
+ };
71
+
72
+ export const Variant_Warning: Story = {
73
+ render: () => (<div className="w-[420px]">
74
+ <Alert variant="warning">
75
+ <TriangleAlertIcon className="h-5 w-5" />
76
+ <AlertTitle>Plan limit approaching</AlertTitle>
77
+ <AlertDescription>You&apos;ve used 80% of your monthly API calls.</AlertDescription>
78
+ </Alert>
79
+ </div>),
80
+ };
81
+
82
+ export const Variant_Info: Story = {
83
+ render: () => (<div className="w-[420px]">
84
+ <Alert variant="info">
85
+ <InfoIcon className="h-5 w-5" />
86
+ <AlertTitle>Maintenance scheduled</AlertTitle>
87
+ <AlertDescription>We&apos;ll be down for 15 minutes on Sunday at 2am UTC.</AlertDescription>
88
+ </Alert>
89
+ </div>),
90
+ };
91
+
62
92
  // NestedInCard verifies the hierarchy contract — an Alert sitting inside a
63
93
  // Card must remain visually distinct. Pre-fix, both surfaces used bg-card and
64
94
  // the alert disappeared into the card.
@@ -1,6 +1,16 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
+ import { CircleCheck, TriangleAlert, Info } from "lucide-react";
2
3
  import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
3
4
 
5
+ /**
6
+ * Badge ships six neutral variants plus three semantic status variants
7
+ * (success / warning / info — peer parity: Mantine Badge color, Chakra
8
+ * colorPalette, Ant Design status Tags). Status variants share Alert's
9
+ * color language: semantic-token border + tinted background + icon in the
10
+ * semantic color, while the label stays text-foreground so it holds the
11
+ * AAA 7:1 floor. Pair status badges with an icon or distinct label — never
12
+ * color alone.
13
+ */
4
14
  const meta: Meta<typeof Badge> = {
5
15
  title: "Components/Badge",
6
16
  component: Badge,
@@ -44,11 +54,58 @@ export const Variant_Link: Story = {
44
54
  render: () => <Badge variant="link">Link</Badge>,
45
55
  };
46
56
 
57
+ export const Variant_Success: Story = {
58
+ render: () => (
59
+ <Badge variant="success">
60
+ <CircleCheck strokeWidth={1.5} aria-hidden />
61
+ Passing
62
+ </Badge>
63
+ ),
64
+ };
65
+
66
+ export const Variant_Warning: Story = {
67
+ render: () => (
68
+ <Badge variant="warning">
69
+ <TriangleAlert strokeWidth={1.5} aria-hidden />
70
+ Degraded
71
+ </Badge>
72
+ ),
73
+ };
74
+
75
+ export const Variant_Info: Story = {
76
+ render: () => (
77
+ <Badge variant="info">
78
+ <Info strokeWidth={1.5} aria-hidden />
79
+ Preview
80
+ </Badge>
81
+ ),
82
+ };
83
+
47
84
  export const RealisticUse: Story = {
48
- render: () => (<div className="flex items-center gap-2">
49
- <Badge>Default</Badge>
50
- <Badge variant="secondary">Secondary</Badge>
51
- <Badge variant="destructive">Destructive</Badge>
52
- <Badge variant="outline">Outline</Badge>
53
- </div>),
85
+ render: () => (
86
+ <div className="flex max-w-md flex-col gap-3">
87
+ <div className="flex items-center gap-2">
88
+ <Badge>Default</Badge>
89
+ <Badge variant="secondary">Secondary</Badge>
90
+ <Badge variant="destructive">Destructive</Badge>
91
+ <Badge variant="outline">Outline</Badge>
92
+ </div>
93
+ {/* Status row as it appears in a component-registry table: the icon
94
+ carries the non-color signal alongside the label. */}
95
+ <div className="flex items-center gap-2">
96
+ <Badge variant="success">
97
+ <CircleCheck strokeWidth={1.5} aria-hidden />
98
+ AAA audit passing
99
+ </Badge>
100
+ <Badge variant="warning">
101
+ <TriangleAlert strokeWidth={1.5} aria-hidden />
102
+ 2 advisory warnings
103
+ </Badge>
104
+ <Badge variant="info">
105
+ <Info strokeWidth={1.5} aria-hidden />
106
+ Tokens v2 preview
107
+ </Badge>
108
+ </div>
109
+ </div>
110
+ ),
54
111
  };
@@ -1,3 +1,6 @@
1
+ // Button is a client component: it always attaches its own onClick/onKeyDown to
2
+ // guard the aria-disabled pattern, so it cannot be rendered from a React Server
3
+ // Component. See the note at the top of components/ui/button.tsx.
1
4
  // Motion: base transition narrowed transition-all → transition-colors (Vercel/Rauno "list only the properties you animate" + BADS microanimation rule). Focus ring now appears instantly rather than fading — strictly better for a11y.
2
5
  import { Meta, StoryObj } from "@storybook/react"
3
6
  import { userEvent, within, expect, fn } from "storybook/test"
@@ -0,0 +1,59 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { ChatMarker } from "../components/ui/chat-marker"
4
+
5
+ const meta: Meta<typeof ChatMarker> = {
6
+ title: "UI/ChatMarker",
7
+ component: ChatMarker,
8
+ tags: ["autodocs"],
9
+ parameters: {
10
+ layout: "padded",
11
+ },
12
+ }
13
+
14
+ export default meta
15
+ type Story = StoryObj<typeof ChatMarker>
16
+
17
+ export const Default: Story = {
18
+ args: {
19
+ label: "Today",
20
+ },
21
+ }
22
+
23
+ export const Variant_Yesterday: Story = {
24
+ args: {
25
+ label: "Yesterday",
26
+ },
27
+ }
28
+
29
+ export const Variant_Status: Story = {
30
+ args: {
31
+ variant: "status",
32
+ label: "Seen 2:14 PM",
33
+ },
34
+ }
35
+
36
+ export const Variant_Divider: Story = {
37
+ args: {
38
+ variant: "divider",
39
+ },
40
+ }
41
+
42
+ export const RealisticUse: Story = {
43
+ render: () => (
44
+ <div className="flex w-72 flex-col gap-1 rounded-lg border bg-card p-4">
45
+ <div className="rounded-lg bg-muted px-3 py-2 text-sm">
46
+ Hey, you around?
47
+ </div>
48
+ <ChatMarker label="Yesterday" />
49
+ <div className="self-end rounded-lg bg-primary px-3 py-2 text-sm text-primary-foreground">
50
+ Yeah! What&apos;s up?
51
+ </div>
52
+ <ChatMarker label="Today" />
53
+ <div className="rounded-lg bg-muted px-3 py-2 text-sm">
54
+ Can we jump on a call?
55
+ </div>
56
+ <ChatMarker variant="status" label="Seen 9:41 AM" />
57
+ </div>
58
+ ),
59
+ }
@@ -12,6 +12,11 @@ const meta: Meta<typeof Checkbox> = {
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof meta>;
14
14
 
15
+ // The visible box is 32px but the pointer target is 44px (WCAG 2.2 SC 2.5.5
16
+ // Enhanced / AAA), delivered by a centered transparent ::before overlay on the
17
+ // Root — see checkbox.tsx. It's invisible and layout-neutral, so it can't be
18
+ // verified by eye here; this note is the regression guard. Do not remove the
19
+ // `before:*` hit-area utilities without a replacement that keeps the target 44px.
15
20
  export const Default: Story = {
16
21
  render: () => (<div className="flex items-center gap-2">
17
22
  <Checkbox id="terms" defaultChecked />
@@ -0,0 +1,65 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { CloseButton } from "@behavioral-agentic-design-system/core/components/ui/close-button";
4
+ import { Tag } from "@behavioral-agentic-design-system/core/components/ui/tag";
5
+
6
+ const meta: Meta<typeof CloseButton> = {
7
+ title: "Components/CloseButton",
8
+ component: CloseButton,
9
+ parameters: { layout: "centered" },
10
+ tags: ["autodocs"],
11
+ };
12
+
13
+ export default meta;
14
+
15
+ export const Default: StoryObj = {
16
+ render: () => <CloseButton />,
17
+ };
18
+
19
+ export const Sizes: StoryObj = {
20
+ render: () => (
21
+ <div className="flex items-center gap-3">
22
+ {(["icon-xs", "icon-sm", "icon", "icon-lg", "icon-xl"] as const).map(
23
+ (size) => (
24
+ <div key={size} className="flex flex-col items-center gap-1">
25
+ <CloseButton size={size} aria-label={`Close (${size})`} />
26
+ <span className="text-xs text-muted-foreground">{size}</span>
27
+ </div>
28
+ )
29
+ )}
30
+ </div>
31
+ ),
32
+ };
33
+
34
+ export const Variant_Outline: StoryObj = {
35
+ render: () => <CloseButton variant="outline" />,
36
+ };
37
+
38
+ export const Variant_Secondary: StoryObj = {
39
+ render: () => <CloseButton variant="secondary" />,
40
+ };
41
+
42
+ export const Disabled: StoryObj = {
43
+ render: () => <CloseButton disabled />,
44
+ };
45
+
46
+ export const RealisticUse: StoryObj = {
47
+ render: () => (
48
+ <div className="flex w-96 items-start justify-between gap-3 rounded-lg border border-border bg-card p-4">
49
+ <div className="min-w-0">
50
+ <p className="text-sm font-medium text-foreground">
51
+ Tokens v2 proposal shared
52
+ </p>
53
+ <p className="mt-1 text-sm text-muted-foreground">
54
+ Jordan Reeves shared tokens-v2-proposal.pdf with the review group.
55
+ Review is scheduled for May 26, 2026.
56
+ </p>
57
+ <div className="mt-2 flex flex-wrap gap-1.5">
58
+ <Tag label="design-review" />
59
+ <Tag label="tokens" />
60
+ </div>
61
+ </div>
62
+ <CloseButton aria-label="Dismiss notification" />
63
+ </div>
64
+ ),
65
+ };
@@ -96,10 +96,52 @@ export const WithDisabledOptions: Story = {
96
96
  },
97
97
  };
98
98
 
99
+ export const Variant_Creatable: Story = {
100
+ name: "Variant — Creatable",
101
+ render: () => {
102
+ const [value, setValue] = React.useState("");
103
+ const [options, setOptions] = React.useState([
104
+ { value: "design", label: "Design" },
105
+ { value: "engineering", label: "Engineering" },
106
+ { value: "product", label: "Product" },
107
+ { value: "marketing", label: "Marketing" },
108
+ { value: "research", label: "Research" },
109
+ ]);
110
+
111
+ function handleCreate(newLabel: string) {
112
+ const newOption = { value: newLabel.toLowerCase().replace(/\s+/g, "-"), label: newLabel };
113
+ setOptions((prev) => [...prev, newOption]);
114
+ setValue(newOption.value);
115
+ }
116
+
117
+ return (
118
+ <div className="space-y-2">
119
+ <p className="text-sm text-muted-foreground">
120
+ Type a department name not in the list to create it.
121
+ </p>
122
+ <Combobox
123
+ options={options}
124
+ value={value}
125
+ onValueChange={setValue}
126
+ placeholder="Select or create department..."
127
+ searchPlaceholder="Search or type new..."
128
+ creatable
129
+ onCreateOption={handleCreate}
130
+ />
131
+ {value && (
132
+ <p className="text-xs text-muted-foreground">
133
+ Selected: <span className="font-medium text-foreground">{value}</span>
134
+ </p>
135
+ )}
136
+ </div>
137
+ );
138
+ },
139
+ };
140
+
99
141
  export const RealisticUse: Story = {
100
142
  decorators: [
101
143
  (Story) => (
102
- <div className="flex min-h-[400px] w-[380px] items-start justify-center pt-8">
144
+ <div className="flex min-h-[520px] w-[380px] items-start justify-center pt-8">
103
145
  <div className="w-full rounded-lg border bg-card p-6 shadow-sm">
104
146
  <Story />
105
147
  </div>
@@ -109,6 +151,14 @@ export const RealisticUse: Story = {
109
151
  render: () => {
110
152
  const [country, setCountry] = React.useState("");
111
153
  const [timezone, setTimezone] = React.useState("");
154
+ const [skillValue, setSkillValue] = React.useState("");
155
+ const [skillOptions, setSkillOptions] = React.useState([
156
+ { value: "accessibility", label: "Accessibility" },
157
+ { value: "data-viz", label: "Data Visualization" },
158
+ { value: "design-systems", label: "Design Systems" },
159
+ { value: "motion-design", label: "Motion Design" },
160
+ { value: "user-research", label: "User Research" },
161
+ ]);
112
162
 
113
163
  const countries = [
114
164
  { value: "us", label: "United States" },
@@ -132,11 +182,19 @@ export const RealisticUse: Story = {
132
182
  { value: "utc+9", label: "Japan Standard Time (UTC+9)" },
133
183
  ];
134
184
 
185
+ function handleCreateSkill(newLabel: string) {
186
+ const newOption = { value: newLabel.toLowerCase().replace(/\s+/g, "-"), label: newLabel };
187
+ setSkillOptions((prev) => [...prev, newOption]);
188
+ setSkillValue(newOption.value);
189
+ }
190
+
135
191
  return (
136
192
  <div className="space-y-5">
137
193
  <div>
138
- <h3 className="text-sm font-semibold text-foreground">Account location</h3>
139
- <p className="mt-0.5 text-sm text-muted-foreground">Set your country and timezone for accurate scheduling.</p>
194
+ <h3 className="text-sm font-semibold text-foreground">Profile settings</h3>
195
+ <p className="mt-0.5 text-sm text-muted-foreground">
196
+ Set your location and add a primary skill. Type a skill name to create one if it's not listed.
197
+ </p>
140
198
  </div>
141
199
  <div className="space-y-3">
142
200
  <div className="space-y-1.5">
@@ -161,6 +219,19 @@ export const RealisticUse: Story = {
161
219
  emptyText="Timezone not found."
162
220
  />
163
221
  </div>
222
+ <div className="space-y-1.5">
223
+ <Label htmlFor="skill">Primary skill</Label>
224
+ <Combobox
225
+ options={skillOptions}
226
+ value={skillValue}
227
+ onValueChange={setSkillValue}
228
+ placeholder="Select or create skill..."
229
+ searchPlaceholder="Search or type new..."
230
+ emptyText="No skill found."
231
+ creatable
232
+ onCreateOption={handleCreateSkill}
233
+ />
234
+ </div>
164
235
  </div>
165
236
  </div>
166
237
  );