@behavioral-agentic-design-system/core 0.39.1 → 0.42.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 (115) hide show
  1. package/README.md +2 -0
  2. package/package.json +26 -5
  3. package/scripts/a11y-lint.cjs +88 -8
  4. package/scripts/bads-components.mjs +118 -0
  5. package/scripts/build-tokens.cjs +133 -12
  6. package/scripts/check-stories.mjs +1 -1
  7. package/scripts/health-report.mjs +16 -2
  8. package/scripts/lint-component-source.mjs +100 -0
  9. package/scripts/lint-microanimation.mjs +267 -0
  10. package/scripts/lint-slop.mjs +25 -1
  11. package/scripts/size-audit.cjs +79 -0
  12. package/scripts/source-of-truth.cjs +58 -0
  13. package/scripts/ux-smoke.mjs +438 -0
  14. package/scripts/wcag-audit.cjs +121 -6
  15. package/src/api/layers/file.ts +1 -0
  16. package/src/app/opengraph-image.tsx +5 -0
  17. package/src/app/preview/components/page.tsx +2237 -2
  18. package/src/app/shell.tsx +17 -16
  19. package/src/components/Foundations/Motion.stories.tsx +1 -0
  20. package/src/components/customize/brand-mark-section.tsx +4 -2
  21. package/src/components/customize/design-controls.tsx +17 -2
  22. package/src/components/customize/discipline-section.tsx +3 -6
  23. package/src/components/customize/font-pickers.tsx +1 -1
  24. package/src/components/customize/letter-spacing.tsx +1 -1
  25. package/src/components/customize/save-bar.tsx +2 -2
  26. package/src/components/customize/theme-io.tsx +7 -7
  27. package/src/components/customize/type-scale.tsx +1 -1
  28. package/src/components/customize-tab.tsx +7 -4
  29. package/src/components/home-tab.tsx +3 -0
  30. package/src/components/studio/studio.tsx +153 -0
  31. package/src/components/ui/accordion.tsx +7 -0
  32. package/src/components/ui/alert.tsx +1 -0
  33. package/src/components/ui/anchor.tsx +37 -3
  34. package/src/components/ui/announcement-bar.tsx +256 -0
  35. package/src/components/ui/attachment.tsx +211 -0
  36. package/src/components/ui/badge.tsx +1 -0
  37. package/src/components/ui/callout.tsx +218 -0
  38. package/src/components/ui/chart.tsx +5 -14
  39. package/src/components/ui/code.tsx +1 -1
  40. package/src/components/ui/color-picker.tsx +2 -2
  41. package/src/components/ui/format-relative-time.tsx +139 -0
  42. package/src/components/ui/gauge-chart.tsx +238 -0
  43. package/src/components/ui/grid.tsx +255 -0
  44. package/src/components/ui/heatmap.tsx +256 -0
  45. package/src/components/ui/icon.tsx +108 -0
  46. package/src/components/ui/index.ts +17 -0
  47. package/src/components/ui/infinite-scroll.tsx +103 -0
  48. package/src/components/ui/json-input.tsx +351 -0
  49. package/src/components/ui/navigation-progress.tsx +281 -0
  50. package/src/components/ui/number-input.tsx +1 -4
  51. package/src/components/ui/page-header.tsx +63 -0
  52. package/src/components/ui/password-input.tsx +2 -1
  53. package/src/components/ui/password-strength-input.tsx +288 -0
  54. package/src/components/ui/pill.tsx +140 -0
  55. package/src/components/ui/popover.tsx +27 -4
  56. package/src/components/ui/portal.tsx +111 -0
  57. package/src/components/ui/presence.tsx +172 -0
  58. package/src/components/ui/progress-stack.tsx +258 -0
  59. package/src/components/ui/scroll-progress.tsx +100 -0
  60. package/src/components/ui/select.tsx +89 -4
  61. package/src/components/ui/separator.tsx +1 -0
  62. package/src/components/ui/slider.tsx +83 -3
  63. package/src/components/ui/snackbar.tsx +393 -0
  64. package/src/components/ui/sortable-list.tsx +342 -0
  65. package/src/components/ui/sparkline.tsx +2 -14
  66. package/src/components/ui/squircle.tsx +1 -1
  67. package/src/components/ui/table.tsx +1 -1
  68. package/src/components/ui/textarea.tsx +28 -1
  69. package/src/components/ui/tour.tsx +1 -3
  70. package/src/data/docs-index.ts +25 -0
  71. package/src/hooks/use-reduced-motion.ts +6 -0
  72. package/src/lib/clamp.ts +2 -0
  73. package/src/stories/Accordion.stories.tsx +59 -0
  74. package/src/stories/Alert.stories.tsx +3 -1
  75. package/src/stories/Anchor.stories.tsx +54 -0
  76. package/src/stories/AnnouncementBar.stories.tsx +261 -0
  77. package/src/stories/Attachment.stories.tsx +189 -0
  78. package/src/stories/Badge.stories.tsx +3 -0
  79. package/src/stories/Calendar.stories.tsx +1 -1
  80. package/src/stories/Callout.stories.tsx +219 -0
  81. package/src/stories/Chart.stories.tsx +8 -0
  82. package/src/stories/Code.stories.tsx +1 -0
  83. package/src/stories/ColorPicker.stories.tsx +24 -0
  84. package/src/stories/FormatRelativeTime.stories.tsx +116 -0
  85. package/src/stories/GaugeChart.stories.tsx +163 -0
  86. package/src/stories/Grid.stories.tsx +197 -0
  87. package/src/stories/Heatmap.stories.tsx +172 -0
  88. package/src/stories/Icon.stories.tsx +175 -0
  89. package/src/stories/InfiniteScroll.stories.tsx +225 -0
  90. package/src/stories/JsonInput.stories.tsx +212 -0
  91. package/src/stories/MultiSelect.stories.tsx +1 -1
  92. package/src/stories/NavigationProgress.stories.tsx +159 -0
  93. package/src/stories/NumberInput.stories.tsx +1 -0
  94. package/src/stories/PageHeader.stories.tsx +102 -0
  95. package/src/stories/PasswordInput.stories.tsx +4 -0
  96. package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
  97. package/src/stories/Pill.stories.tsx +201 -0
  98. package/src/stories/Popover.stories.tsx +29 -1
  99. package/src/stories/Portal.stories.tsx +191 -0
  100. package/src/stories/Presence.stories.tsx +228 -0
  101. package/src/stories/ProgressStack.stories.tsx +287 -0
  102. package/src/stories/ScrollProgress.stories.tsx +117 -0
  103. package/src/stories/Select.stories.tsx +25 -0
  104. package/src/stories/Separator.stories.tsx +3 -0
  105. package/src/stories/Slider.stories.tsx +54 -5
  106. package/src/stories/Snackbar.stories.tsx +315 -0
  107. package/src/stories/SortableList.stories.tsx +263 -0
  108. package/src/stories/Sparkline.stories.tsx +3 -0
  109. package/src/stories/Squircle.stories.tsx +1 -0
  110. package/src/stories/Table.stories.tsx +1 -0
  111. package/src/stories/Textarea.stories.tsx +18 -0
  112. package/src/stories/Tour.stories.tsx +1 -0
  113. package/src/stories/story-groups.json +26 -6
  114. package/src/styles.css +133 -12
  115. package/LICENSE +0 -21
@@ -0,0 +1,197 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import * as React from "react";
3
+ import { Grid, GridCol } from "@behavioral-agentic-design-system/core/components/ui/grid";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+
12
+ /**
13
+ * Grid is a non-CVA layout primitive — `Default` + `RealisticUse` per the
14
+ * storybook rule, plus one story per axis (span, offset, responsive) so the
15
+ * literal class maps are exercised end to end. Twelve tracks, fixed; a
16
+ * GridCol spans 1–12 and may be offset by leading empty tracks. The
17
+ * SimpleGrid sibling for unequal columns.
18
+ */
19
+ const meta: Meta<typeof Grid> = {
20
+ title: "Components/Layout/Grid",
21
+ component: Grid,
22
+ parameters: { layout: "padded" },
23
+ tags: ["autodocs"],
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ function Cell({ label }: { label: string }) {
30
+ return (
31
+ <div className="flex h-16 items-center justify-center rounded-lg border border-dashed border-border bg-card">
32
+ <span className="truncate text-sm text-muted-foreground">{label}</span>
33
+ </div>
34
+ );
35
+ }
36
+
37
+ export const Default: Story = {
38
+ parameters: { controls: { disable: true } },
39
+ render: () => (
40
+ <Grid>
41
+ <GridCol span={8}>
42
+ <Cell label="span 8" />
43
+ </GridCol>
44
+ <GridCol span={4}>
45
+ <Cell label="span 4" />
46
+ </GridCol>
47
+ </Grid>
48
+ ),
49
+ };
50
+
51
+ export const Spans: Story = {
52
+ parameters: { controls: { disable: true } },
53
+ render: () => (
54
+ <Grid gap="sm">
55
+ <GridCol span={12}>
56
+ <Cell label="12" />
57
+ </GridCol>
58
+ <GridCol span={6}>
59
+ <Cell label="6" />
60
+ </GridCol>
61
+ <GridCol span={6}>
62
+ <Cell label="6" />
63
+ </GridCol>
64
+ <GridCol span={4}>
65
+ <Cell label="4" />
66
+ </GridCol>
67
+ <GridCol span={4}>
68
+ <Cell label="4" />
69
+ </GridCol>
70
+ <GridCol span={4}>
71
+ <Cell label="4" />
72
+ </GridCol>
73
+ <GridCol span={3}>
74
+ <Cell label="3" />
75
+ </GridCol>
76
+ <GridCol span={9}>
77
+ <Cell label="9" />
78
+ </GridCol>
79
+ </Grid>
80
+ ),
81
+ };
82
+
83
+ export const Offset: Story = {
84
+ parameters: { controls: { disable: true } },
85
+ render: () => (
86
+ <Grid gap="sm">
87
+ <GridCol span={4} offset={4}>
88
+ <Cell label="span 4 · offset 4" />
89
+ </GridCol>
90
+ <GridCol span={3} offset={2}>
91
+ <Cell label="span 3 · offset 2" />
92
+ </GridCol>
93
+ <GridCol span={5}>
94
+ <Cell label="span 5" />
95
+ </GridCol>
96
+ <GridCol span={6} offset={6}>
97
+ <Cell label="span 6 · offset 6" />
98
+ </GridCol>
99
+ </Grid>
100
+ ),
101
+ };
102
+
103
+ export const Responsive: Story = {
104
+ parameters: { controls: { disable: true } },
105
+ render: () => (
106
+ <div>
107
+ <p className="mb-2 text-xs text-muted-foreground">
108
+ {`span={{ base: 12, md: 8 }} / span={{ base: 12, md: 4 }} — resize the viewport`}
109
+ </p>
110
+ <Grid gap="md">
111
+ <GridCol span={{ base: 12, md: 8 }}>
112
+ <Cell label="main" />
113
+ </GridCol>
114
+ <GridCol span={{ base: 12, md: 4 }}>
115
+ <Cell label="aside" />
116
+ </GridCol>
117
+ <GridCol span={{ base: 6, lg: 3 }}>
118
+ <Cell label="quarter" />
119
+ </GridCol>
120
+ <GridCol span={{ base: 6, lg: 3 }}>
121
+ <Cell label="quarter" />
122
+ </GridCol>
123
+ <GridCol span={{ base: 6, lg: 3 }}>
124
+ <Cell label="quarter" />
125
+ </GridCol>
126
+ <GridCol span={{ base: 6, lg: 3 }}>
127
+ <Cell label="quarter" />
128
+ </GridCol>
129
+ </Grid>
130
+ </div>
131
+ ),
132
+ };
133
+
134
+ export const RealisticUse: Story = {
135
+ parameters: { controls: { disable: true } },
136
+ render: () => (
137
+ <Grid gap="lg">
138
+ <GridCol span={{ base: 12, lg: 8 }}>
139
+ <Card>
140
+ <CardHeader>
141
+ <CardTitle>Tokens v2 proposal</CardTitle>
142
+ <CardDescription>
143
+ Jordan Reeves — review May 26, 2026
144
+ </CardDescription>
145
+ </CardHeader>
146
+ <CardContent>
147
+ <p className="text-sm text-muted-foreground">
148
+ Consolidates the spacing scale to eight stops; retires four
149
+ orphaned color tokens. Both CSS files regenerate from a single
150
+ tokens.json change, and every fork picks it up on the next core
151
+ bump.
152
+ </p>
153
+ </CardContent>
154
+ </Card>
155
+ </GridCol>
156
+ <GridCol span={{ base: 12, lg: 4 }}>
157
+ <Card>
158
+ <CardHeader>
159
+ <CardTitle>Reviewers</CardTitle>
160
+ <CardDescription>Sign-off due 2026-05-26</CardDescription>
161
+ </CardHeader>
162
+ <CardContent>
163
+ <ul className="space-y-2 text-sm">
164
+ <li className="flex justify-between gap-3">
165
+ <span className="min-w-0 truncate">Seo-yun Park</span>
166
+ <span className="shrink-0 text-muted-foreground">Approved</span>
167
+ </li>
168
+ <li className="flex justify-between gap-3">
169
+ <span className="min-w-0 truncate">Marcus Lindqvist</span>
170
+ <span className="shrink-0 text-muted-foreground">Pending</span>
171
+ </li>
172
+ <li className="flex justify-between gap-3">
173
+ <span className="min-w-0 truncate">Anika Patel</span>
174
+ <span className="shrink-0 text-muted-foreground">Pending</span>
175
+ </li>
176
+ </ul>
177
+ </CardContent>
178
+ </Card>
179
+ </GridCol>
180
+ {[
181
+ { label: "Components", value: "36" },
182
+ { label: "Contrast floor", value: "7:1" },
183
+ { label: "Story coverage", value: "98.4%" },
184
+ { label: "Build hours avoided", value: "1,432" },
185
+ ].map((stat) => (
186
+ <GridCol key={stat.label} span={{ base: 6, lg: 3 }}>
187
+ <Card>
188
+ <CardHeader>
189
+ <CardDescription>{stat.label}</CardDescription>
190
+ <CardTitle className="text-2xl tabular-nums">{stat.value}</CardTitle>
191
+ </CardHeader>
192
+ </Card>
193
+ </GridCol>
194
+ ))}
195
+ </Grid>
196
+ ),
197
+ };
@@ -0,0 +1,172 @@
1
+ // "use client" added to heatmap.tsx (useCallback + useMemo hooks)
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Heatmap } from "@behavioral-agentic-design-system/core/components/ui/heatmap";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
11
+
12
+ // Content from content/personas/bads.json → primary (Jordan Reeves, Fieldnote
13
+ // Labs, design-system jargon). Data is generated by a seeded LCG so every
14
+ // render — and every Chromatic snapshot — is byte-identical. No Math.random.
15
+ function seeded(seed: number) {
16
+ let s = seed >>> 0;
17
+ return () => {
18
+ s = (s * 1664525 + 1013904223) >>> 0;
19
+ return s / 0x100000000;
20
+ };
21
+ }
22
+
23
+ function matrix(rowCount: number, colCount: number, seed: number, max = 24) {
24
+ const next = seeded(seed);
25
+ return Array.from({ length: rowCount }, (_, r) =>
26
+ Array.from({ length: colCount }, (_, c) => {
27
+ // Weekends and early columns run quieter so the ramp has structure.
28
+ const weight = r >= 5 ? 0.35 : 1;
29
+ const ramp = 0.4 + (c / Math.max(1, colCount - 1)) * 0.6;
30
+ return Math.round(next() * max * weight * ramp);
31
+ }),
32
+ );
33
+ }
34
+
35
+ const WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
36
+ const weeks = (n: number) => Array.from({ length: n }, (_, i) => `W${i + 1}`);
37
+
38
+ const meta: Meta<typeof Heatmap> = {
39
+ title: "Components/Content and data/Heatmap",
40
+ component: Heatmap,
41
+ parameters: { layout: "centered" },
42
+ tags: ["autodocs"],
43
+ argTypes: {
44
+ size: { control: "select", options: ["sm", "md", "lg"] },
45
+ color: { control: "text" },
46
+ showLegend: { control: "boolean" },
47
+ label: { control: "text" },
48
+ },
49
+ args: {
50
+ rows: WEEKDAYS,
51
+ columns: weeks(12),
52
+ data: matrix(7, 12, 7),
53
+ label: "Token commits by weekday, last 12 weeks",
54
+ formatValue: (v: number) => `${v} commits`,
55
+ },
56
+ };
57
+
58
+ export default meta;
59
+ type Story = StoryObj<typeof meta>;
60
+
61
+ export const Default: Story = {};
62
+
63
+ export const Size_SM: Story = {
64
+ args: { size: "sm" },
65
+ };
66
+
67
+ export const Size_MD: Story = {
68
+ args: { size: "md" },
69
+ };
70
+
71
+ export const Size_LG: Story = {
72
+ args: { size: "lg" },
73
+ };
74
+
75
+ // One series color, always from the chart palette. Vermillion (--chart-2) is
76
+ // the second categorical color; here it distinguishes "review comments" from
77
+ // the commits matrix on the same dashboard.
78
+ export const SeriesColor: Story = {
79
+ args: {
80
+ color: "var(--chart-2)",
81
+ label: "Review comments by weekday, last 12 weeks",
82
+ formatValue: (v: number) => `${v} comments`,
83
+ },
84
+ };
85
+
86
+ // Null cells are "no data" (a quiet muted/50 swatch, announced as "No data"),
87
+ // distinct from level 0 which is a real lowest-bucket value.
88
+ export const WithMissingData: Story = {
89
+ args: {
90
+ columns: weeks(8),
91
+ data: matrix(7, 8, 11).map((row, r) =>
92
+ row.map((v, c) => (c > 5 && r > 3 ? null : v)),
93
+ ),
94
+ label: "Token commits by weekday — weeks 7 and 8 not yet synced",
95
+ },
96
+ };
97
+
98
+ // A fixed domain lets several heatmaps share one scale, so 12 commits reads
99
+ // the same shade in every card of a row.
100
+ export const FixedDomain: Story = {
101
+ args: {
102
+ domain: [0, 40],
103
+ columns: weeks(8),
104
+ data: matrix(7, 8, 3, 18),
105
+ label: "Token commits, scaled 0–40 so cards across the row match",
106
+ },
107
+ };
108
+
109
+ export const NoLegend: Story = {
110
+ args: { showLegend: false, columns: weeks(8), data: matrix(7, 8, 5) },
111
+ };
112
+
113
+ // Scroll-region coverage (corrections #019): 52 columns inside a 420px box.
114
+ // The root is tabIndex=0 + role=region so a keyboard user can scroll it;
115
+ // the axe suite only sees that if a story actually overflows.
116
+ export const WideOverflowing: Story = {
117
+ parameters: { controls: { disable: true } },
118
+ render: (args) => (
119
+ <div className="w-[420px] rounded-lg border p-4">
120
+ <Heatmap
121
+ {...args}
122
+ columns={weeks(52)}
123
+ data={matrix(7, 52, 19)}
124
+ label="Token commits by weekday, 52 weeks — scrolls horizontally"
125
+ />
126
+ </div>
127
+ ),
128
+ };
129
+
130
+ // Hour × weekday usage: the "when does the team hit the system" matrix. Row
131
+ // labels are hours, so the matrix is tall and narrow; sm cells keep it inside
132
+ // a card.
133
+ export const HourByWeekday: Story = {
134
+ parameters: { controls: { disable: true } },
135
+ render: (args) => (
136
+ <Heatmap
137
+ {...args}
138
+ size="sm"
139
+ rows={Array.from({ length: 12 }, (_, h) => `${h + 8}:00`)}
140
+ columns={WEEKDAYS.slice(0, 5)}
141
+ data={matrix(12, 5, 23, 60)}
142
+ label="Storybook sessions by hour and weekday, Fieldnote Labs"
143
+ formatValue={(v: number) => `${v} sessions`}
144
+ />
145
+ ),
146
+ };
147
+
148
+ // Contribution calendar on a profile card — the register this primitive is
149
+ // most often reached for. Real names and orgs from the persona pool.
150
+ export const RealisticUse: Story = {
151
+ parameters: { controls: { disable: true } },
152
+ render: () => (
153
+ <Card className="w-[520px]">
154
+ <CardHeader>
155
+ <CardTitle className="text-base">Jordan Reeves · token commits</CardTitle>
156
+ <CardDescription>
157
+ Fieldnote Labs design-tokens repo, last 16 weeks. 412 commits, busiest
158
+ on Wednesdays.
159
+ </CardDescription>
160
+ </CardHeader>
161
+ <CardContent>
162
+ <Heatmap
163
+ rows={WEEKDAYS}
164
+ columns={weeks(16)}
165
+ data={matrix(7, 16, 42)}
166
+ label="Jordan Reeves token commits by weekday, last 16 weeks"
167
+ formatValue={(v: number) => `${v} commits`}
168
+ />
169
+ </CardContent>
170
+ </Card>
171
+ ),
172
+ };
@@ -0,0 +1,175 @@
1
+ import * as React from "react"
2
+ import type { Meta, StoryObj } from "@storybook/react"
3
+ import {
4
+ Bell,
5
+ CircleAlert,
6
+ CircleCheck,
7
+ Info,
8
+ Palette,
9
+ Search,
10
+ Sparkles,
11
+ TriangleAlert,
12
+ } from "lucide-react"
13
+ import { Icon } from "@behavioral-agentic-design-system/core/components/ui/icon"
14
+ import { ICON_ROLES } from "@behavioral-agentic-design-system/core/lib/get-icon-color"
15
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
16
+
17
+ const meta: Meta<typeof Icon> = {
18
+ title: "Components/Content and data/Icon",
19
+ component: Icon,
20
+ parameters: { layout: "centered" },
21
+ tags: ["autodocs"],
22
+ argTypes: {
23
+ size: { control: "select", options: ["sm", "default", "lg", "xl"] },
24
+ color: { control: "select", options: [undefined, ...ICON_ROLES] },
25
+ label: { control: "text" },
26
+ as: { control: false },
27
+ },
28
+ }
29
+
30
+ export default meta
31
+ type Story = StoryObj<typeof meta>
32
+
33
+ export const Default: Story = {
34
+ args: { size: "default" },
35
+ render: (args) => <Icon as={Search} {...args} />,
36
+ }
37
+
38
+ function SizeRow({ size }: { size: "sm" | "default" | "lg" | "xl" }) {
39
+ return (
40
+ <div className="flex items-center gap-4">
41
+ <Icon as={Search} size={size} />
42
+ <Icon as={Bell} size={size} />
43
+ <Icon as={Palette} size={size} />
44
+ <Icon as={Sparkles} size={size} />
45
+ <span className="text-xs text-muted-foreground">{size}</span>
46
+ </div>
47
+ )
48
+ }
49
+
50
+ export const Size_Sm: Story = {
51
+ args: { size: "sm" },
52
+ render: (args) => <SizeRow size={args.size ?? "sm"} />,
53
+ }
54
+ export const Size_Default: Story = {
55
+ args: { size: "default" },
56
+ render: (args) => <SizeRow size={args.size ?? "default"} />,
57
+ }
58
+ export const Size_Lg: Story = {
59
+ args: { size: "lg" },
60
+ render: (args) => <SizeRow size={args.size ?? "lg"} />,
61
+ }
62
+ export const Size_Xl: Story = {
63
+ args: { size: "xl" },
64
+ render: (args) => <SizeRow size={args.size ?? "xl"} />,
65
+ }
66
+
67
+ /**
68
+ * Every semantic role from the `icon-*` token family. `inverse` sits on a
69
+ * filled primary chip because that is the only surface it is meant for.
70
+ */
71
+ export const ColorRoles: Story = {
72
+ parameters: { controls: { disable: true } },
73
+ render: () => (
74
+ <div className="grid grid-cols-3 gap-x-8 gap-y-4 text-sm">
75
+ {ICON_ROLES.map((role) =>
76
+ role === "inverse" ? (
77
+ <div key={role} className="flex items-center gap-2">
78
+ <span className="inline-flex size-7 items-center justify-center rounded-md bg-primary">
79
+ <Icon as={Sparkles} color={role} />
80
+ </span>
81
+ <span className="text-muted-foreground">{role}</span>
82
+ </div>
83
+ ) : (
84
+ <div key={role} className="flex items-center gap-2">
85
+ <Icon as={Sparkles} size="lg" color={role} />
86
+ <span className="text-muted-foreground">{role}</span>
87
+ </div>
88
+ )
89
+ )}
90
+ </div>
91
+ ),
92
+ }
93
+
94
+ /**
95
+ * Decorative (default) vs labeled. A decorative icon is `aria-hidden`; a
96
+ * labeled one announces as an image named by its meaning — "Passing", not
97
+ * "check mark".
98
+ */
99
+ export const Labeled: Story = {
100
+ parameters: { controls: { disable: true } },
101
+ render: () => (
102
+ <div className="flex flex-col gap-3 text-sm">
103
+ <div className="flex items-center gap-2">
104
+ <Icon as={CircleCheck} color="success" />
105
+ <span>Decorative — the text beside it carries the meaning</span>
106
+ </div>
107
+ <div className="flex items-center gap-2">
108
+ <Icon as={CircleCheck} color="success" label="Passing" />
109
+ <span className="text-muted-foreground">
110
+ Labeled — announced as image, &ldquo;Passing&rdquo;
111
+ </span>
112
+ </div>
113
+ </div>
114
+ ),
115
+ }
116
+
117
+ /**
118
+ * A pre-commit status list from content/personas/bads.json (notifications,
119
+ * error_messages, units): icons colored by role beside their text, plus a
120
+ * Button showing the icon inheriting currentColor from its parent.
121
+ */
122
+ export const RealisticUse: Story = {
123
+ parameters: { controls: { disable: true } },
124
+ render: () => (
125
+ <div className="w-96 rounded-lg border border-border bg-card p-6">
126
+ <p className="mb-4 text-lg font-semibold">Pre-commit checks</p>
127
+ <ul className="flex flex-col gap-3 text-sm">
128
+ <li className="flex items-start gap-2">
129
+ <Icon as={CircleCheck} color="success" className="mt-0.5" />
130
+ <span>
131
+ <span className="font-medium">Story coverage check passed.</span>{" "}
132
+ <span className="text-muted-foreground">
133
+ All 36 components have matching stories.
134
+ </span>
135
+ </span>
136
+ </li>
137
+ <li className="flex items-start gap-2">
138
+ <Icon as={CircleAlert} color="error" className="mt-0.5" />
139
+ <span>
140
+ <span className="font-medium">Token build failed.</span>{" "}
141
+ <span className="text-muted-foreground">
142
+ Check tokens.json for syntax errors and run pnpm build:tokens
143
+ again.
144
+ </span>
145
+ </span>
146
+ </li>
147
+ <li className="flex items-start gap-2">
148
+ <Icon as={TriangleAlert} color="warning" className="mt-0.5" />
149
+ <span>
150
+ <span className="font-medium">7:1 contrast</span>{" "}
151
+ <span className="text-muted-foreground">
152
+ — two token pairs are AA only.
153
+ </span>
154
+ </span>
155
+ </li>
156
+ <li className="flex items-start gap-2">
157
+ <Icon as={Info} color="info" className="mt-0.5" />
158
+ <span className="text-muted-foreground">
159
+ 44×44px target enforced on every CTA.
160
+ </span>
161
+ </li>
162
+ </ul>
163
+ <div className="mt-5 flex gap-2">
164
+ <Button size="xl">
165
+ <Icon as={Search} size="lg" />
166
+ Search components
167
+ </Button>
168
+ <Button size="xl" variant="outline">
169
+ <Icon as={Palette} size="lg" />
170
+ Customize
171
+ </Button>
172
+ </div>
173
+ </div>
174
+ ),
175
+ }