@behavioral-agentic-design-system/core 0.39.1 → 0.40.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.
- package/package.json +8 -3
- package/scripts/a11y-lint.cjs +47 -6
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +133 -12
- package/scripts/check-stories.mjs +1 -1
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/size-audit.cjs +79 -0
- package/scripts/source-of-truth.cjs +58 -0
- package/scripts/ux-smoke.mjs +438 -0
- package/scripts/wcag-audit.cjs +49 -1
- package/src/api/layers/file.ts +1 -0
- package/src/app/preview/components/page.tsx +968 -0
- package/src/app/shell.tsx +11 -13
- package/src/components/customize/brand-mark-section.tsx +4 -2
- package/src/components/customize/design-controls.tsx +1 -1
- package/src/components/customize/discipline-section.tsx +3 -6
- package/src/components/customize/font-pickers.tsx +1 -1
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/save-bar.tsx +2 -2
- package/src/components/customize/theme-io.tsx +7 -7
- package/src/components/customize/type-scale.tsx +1 -1
- package/src/components/customize-tab.tsx +7 -4
- package/src/components/home-tab.tsx +3 -0
- package/src/components/ui/accordion.tsx +7 -0
- package/src/components/ui/alert.tsx +1 -0
- package/src/components/ui/announcement-bar.tsx +256 -0
- package/src/components/ui/badge.tsx +1 -0
- package/src/components/ui/callout.tsx +218 -0
- package/src/components/ui/chart.tsx +2 -14
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/format-relative-time.tsx +139 -0
- package/src/components/ui/grid.tsx +255 -0
- package/src/components/ui/icon.tsx +108 -0
- package/src/components/ui/index.ts +8 -0
- package/src/components/ui/page-header.tsx +63 -0
- package/src/components/ui/portal.tsx +111 -0
- package/src/components/ui/presence.tsx +172 -0
- package/src/components/ui/progress-stack.tsx +258 -0
- package/src/components/ui/select.tsx +89 -4
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/slider.tsx +83 -3
- package/src/components/ui/sparkline.tsx +2 -14
- package/src/components/ui/textarea.tsx +28 -1
- package/src/data/docs-index.ts +1 -0
- package/src/hooks/use-reduced-motion.ts +6 -0
- package/src/stories/Accordion.stories.tsx +59 -0
- package/src/stories/Alert.stories.tsx +3 -1
- package/src/stories/AnnouncementBar.stories.tsx +261 -0
- package/src/stories/Badge.stories.tsx +3 -0
- package/src/stories/Calendar.stories.tsx +1 -1
- package/src/stories/Callout.stories.tsx +219 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/ColorPicker.stories.tsx +23 -0
- package/src/stories/FormatRelativeTime.stories.tsx +116 -0
- package/src/stories/Grid.stories.tsx +197 -0
- package/src/stories/Icon.stories.tsx +175 -0
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/PageHeader.stories.tsx +102 -0
- package/src/stories/Portal.stories.tsx +189 -0
- package/src/stories/Presence.stories.tsx +228 -0
- package/src/stories/ProgressStack.stories.tsx +287 -0
- package/src/stories/Select.stories.tsx +25 -0
- package/src/stories/Separator.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Sparkline.stories.tsx +3 -0
- package/src/stories/Textarea.stories.tsx +18 -0
- package/src/stories/story-groups.json +14 -5
- package/src/styles.css +133 -12
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { FormatRelativeTime } from "@behavioral-agentic-design-system/core/components/ui/format-relative-time"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FormatRelativeTime> = {
|
|
5
|
+
title: "Components/Content and data/FormatRelativeTime",
|
|
6
|
+
component: FormatRelativeTime,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component:
|
|
11
|
+
"Locale-aware relative-time display primitive. Renders a `<time>` element with a machine-readable dateTime attribute. Optionally live-updates every 30 s.",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof FormatRelativeTime>
|
|
20
|
+
|
|
21
|
+
// Two minutes ago
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
date: new Date(Date.now() - 2 * 60_000),
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Future date
|
|
29
|
+
export const Future: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
date: new Date(Date.now() + 4 * 60 * 60_000),
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Yesterday
|
|
36
|
+
export const Yesterday: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
date: new Date(Date.now() - 25 * 60 * 60_000),
|
|
39
|
+
numeric: "auto",
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Two weeks ago — days unit
|
|
44
|
+
export const TwoWeeksAgo: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
date: new Date(Date.now() - 14 * 24 * 60 * 60_000),
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Long time ago — years unit
|
|
51
|
+
export const ThreeYearsAgo: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
date: new Date(Date.now() - 3 * 365 * 24 * 60 * 60_000),
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Static (no live update) — for use in SSR/static contexts
|
|
58
|
+
export const Static: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
date: new Date(Date.now() - 45_000),
|
|
61
|
+
live: false,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Narrow style — compact label ("2 min. ago")
|
|
66
|
+
export const Narrow: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
date: new Date(Date.now() - 7 * 60_000),
|
|
69
|
+
formatStyle: "narrow",
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Numeric forced — always uses numbers even for "yesterday"
|
|
74
|
+
export const AlwaysNumeric: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
date: new Date(Date.now() - 25 * 60 * 60_000),
|
|
77
|
+
numeric: "always",
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Realistic use: activity feed row
|
|
82
|
+
export const RealisticUse: Story = {
|
|
83
|
+
parameters: { controls: { disable: true } },
|
|
84
|
+
render: () => (
|
|
85
|
+
<ul className="flex flex-col gap-2 text-sm">
|
|
86
|
+
{[
|
|
87
|
+
{ user: "Jordan Reeves", action: "approved the PR", ago: 3 * 60_000 },
|
|
88
|
+
{
|
|
89
|
+
user: "Seo-yun Park",
|
|
90
|
+
action: "left a comment",
|
|
91
|
+
ago: 42 * 60_000,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
user: "Marcus Lindqvist",
|
|
95
|
+
action: "opened a pull request",
|
|
96
|
+
ago: 4 * 60 * 60_000,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
user: "Anika Patel",
|
|
100
|
+
action: "pushed 3 commits",
|
|
101
|
+
ago: 2 * 24 * 60 * 60_000,
|
|
102
|
+
},
|
|
103
|
+
].map(({ user, action, ago }) => (
|
|
104
|
+
<li key={user} className="flex items-center justify-between gap-4">
|
|
105
|
+
<span>
|
|
106
|
+
<span className="font-medium">{user}</span> {action}
|
|
107
|
+
</span>
|
|
108
|
+
<FormatRelativeTime
|
|
109
|
+
date={new Date(Date.now() - ago)}
|
|
110
|
+
className="text-muted-foreground tabular-nums shrink-0"
|
|
111
|
+
/>
|
|
112
|
+
</li>
|
|
113
|
+
))}
|
|
114
|
+
</ul>
|
|
115
|
+
),
|
|
116
|
+
}
|
|
@@ -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,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, “Passing”
|
|
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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Trigger text is font-medium (text-sm/16px) to satisfy the
|
|
1
|
+
// Trigger text is font-medium (text-sm/16px) to satisfy the BADS-WEIGHT AAA
|
|
2
2
|
// weight floor — text below 18px must be font-medium or heavier.
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/react"
|
|
4
4
|
import * as React from "react"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { PageHeader } from "@behavioral-agentic-design-system/core/components/ui/page-header"
|
|
3
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof PageHeader> = {
|
|
6
|
+
title: "Components/Layout/PageHeader",
|
|
7
|
+
component: PageHeader,
|
|
8
|
+
parameters: { layout: "padded" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
}
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
title: "Workspace settings",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const WithDescription: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
title: "Workspace settings",
|
|
23
|
+
description: "Manage your workspace preferences, integrations, and team access.",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const WithEyebrow: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
eyebrow: "Account",
|
|
30
|
+
title: "Billing & plans",
|
|
31
|
+
description: "Manage your subscription and payment methods.",
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const WithAction: Story = {
|
|
36
|
+
parameters: { controls: { disable: true } },
|
|
37
|
+
render: () => (
|
|
38
|
+
<PageHeader
|
|
39
|
+
title="Team members"
|
|
40
|
+
description="Invite people and manage their roles."
|
|
41
|
+
action={<Button size="xl">Invite member</Button>}
|
|
42
|
+
/>
|
|
43
|
+
),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const WithEyebrowAndAction: Story = {
|
|
47
|
+
parameters: { controls: { disable: true } },
|
|
48
|
+
render: () => (
|
|
49
|
+
<PageHeader
|
|
50
|
+
eyebrow="Projects"
|
|
51
|
+
title="Meridian rebrand"
|
|
52
|
+
description="Brand identity, design tokens, and component library for Meridian Financial."
|
|
53
|
+
action={
|
|
54
|
+
<>
|
|
55
|
+
<Button variant="outline" size="lg">Export</Button>
|
|
56
|
+
<Button size="xl">New component</Button>
|
|
57
|
+
</>
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Bordered: Story = {
|
|
64
|
+
parameters: { controls: { disable: true } },
|
|
65
|
+
render: () => (
|
|
66
|
+
<div>
|
|
67
|
+
<PageHeader
|
|
68
|
+
title="Notifications"
|
|
69
|
+
description="Choose what you want to be notified about."
|
|
70
|
+
bordered
|
|
71
|
+
/>
|
|
72
|
+
<p className="mt-6 text-sm text-muted-foreground">Content below the border…</p>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const RealisticUse: Story = {
|
|
78
|
+
parameters: { controls: { disable: true } },
|
|
79
|
+
render: () => (
|
|
80
|
+
<div className="w-full max-w-3xl space-y-6">
|
|
81
|
+
<PageHeader
|
|
82
|
+
eyebrow="Design system"
|
|
83
|
+
title="Component library"
|
|
84
|
+
description="149 primitives and compositions ready for your next client engagement. All WCAG AAA."
|
|
85
|
+
bordered
|
|
86
|
+
action={
|
|
87
|
+
<>
|
|
88
|
+
<Button variant="outline" size="lg">Import tokens</Button>
|
|
89
|
+
<Button size="xl">Add component</Button>
|
|
90
|
+
</>
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
<div className="space-y-3">
|
|
94
|
+
{["Button", "Combobox", "MultiSelect"].map((name) => (
|
|
95
|
+
<div key={name} className="rounded-md border border-border p-4 text-sm text-foreground">
|
|
96
|
+
{name}
|
|
97
|
+
</div>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
),
|
|
102
|
+
}
|