@behavioral-agentic-design-system/core 0.28.0 → 0.29.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 +2 -2
- package/scripts/a11y-lint.cjs +78 -9
- package/scripts/build-tokens.cjs +273 -15
- package/scripts/wcag-audit.cjs +37 -7
- package/src/api/layers/file.ts +1 -0
- package/src/app/font-ready.tsx +6 -5
- package/src/app/layout.tsx +54 -3
- package/src/app/preview/components/page.tsx +5532 -3044
- package/src/app/preview/layout.tsx +4 -1
- package/src/app/preview/showcase-filter.tsx +66 -0
- package/src/app/preview/tab-replay.tsx +63 -0
- package/src/app/shell.tsx +74 -18
- package/src/components/customize/save-bar.tsx +19 -6
- package/src/components/docs-tab.tsx +36 -24
- package/src/components/layers-tab.tsx +37 -5
- package/src/components/ui/alert.tsx +12 -0
- package/src/components/ui/badge.tsx +19 -0
- package/src/components/ui/chat-marker.tsx +120 -0
- package/src/components/ui/checkbox.tsx +9 -1
- package/src/components/ui/close-button.tsx +71 -0
- package/src/components/ui/combobox.tsx +62 -3
- package/src/components/ui/container.tsx +65 -0
- package/src/components/ui/date-field.tsx +368 -0
- package/src/components/ui/drawer.tsx +334 -0
- package/src/components/ui/file-button.tsx +145 -0
- package/src/components/ui/floating-indicator.tsx +217 -0
- package/src/components/ui/format-byte.tsx +113 -0
- package/src/components/ui/index.ts +21 -0
- package/src/components/ui/input.tsx +38 -3
- package/src/components/ui/keyboard-shortcut.tsx +146 -0
- package/src/components/ui/loading-dots.tsx +99 -0
- package/src/components/ui/month-picker.tsx +296 -0
- package/src/components/ui/multi-select.tsx +15 -13
- package/src/components/ui/nav-link.tsx +200 -0
- package/src/components/ui/navigation-rail.tsx +256 -0
- package/src/components/ui/notification.tsx +20 -0
- package/src/components/ui/password-input.tsx +34 -1
- package/src/components/ui/progress.tsx +15 -1
- package/src/components/ui/prose.tsx +62 -0
- package/src/components/ui/result.tsx +151 -0
- package/src/components/ui/rolling-number.tsx +1 -0
- package/src/components/ui/simple-grid.tsx +110 -0
- package/src/components/ui/skeleton.tsx +52 -3
- package/src/components/ui/squircle.tsx +274 -0
- package/src/components/ui/stack.tsx +105 -0
- package/src/components/ui/status-badge.tsx +93 -0
- package/src/components/ui/tabs.tsx +34 -7
- package/src/components/ui/tag.tsx +46 -5
- package/src/components/ui/theme-icon.tsx +138 -0
- package/src/components/ui/timeline.tsx +27 -10
- package/src/components/ui/tooltip.tsx +12 -1
- package/src/components/ui/tree-select.tsx +386 -0
- package/src/components/ui/year-picker.tsx +307 -0
- package/src/data/docs-index.ts +10 -0
- package/src/hooks/use-global-primary-color.ts +57 -6
- package/src/stories/Alert.stories.tsx +31 -1
- package/src/stories/Badge.stories.tsx +63 -6
- package/src/stories/ChatMarker.stories.tsx +59 -0
- package/src/stories/Checkbox.stories.tsx +5 -0
- package/src/stories/CloseButton.stories.tsx +65 -0
- package/src/stories/Combobox.stories.tsx +74 -3
- package/src/stories/Container.stories.tsx +134 -0
- package/src/stories/DateField.stories.tsx +114 -0
- package/src/stories/Drawer.stories.tsx +211 -0
- package/src/stories/FileButton.stories.tsx +117 -0
- package/src/stories/FloatingIndicator.stories.tsx +343 -0
- package/src/stories/FormatByte.stories.tsx +142 -0
- package/src/stories/Input.stories.tsx +91 -0
- package/src/stories/KeyboardShortcut.stories.tsx +87 -0
- package/src/stories/LoadingDots.stories.tsx +73 -0
- package/src/stories/MonthPicker.stories.tsx +99 -0
- package/src/stories/MultiSelect.stories.tsx +3 -1
- package/src/stories/NavLink.stories.tsx +213 -0
- package/src/stories/NavigationRail.stories.tsx +413 -0
- package/src/stories/Notification.stories.tsx +53 -0
- package/src/stories/PasswordInput.stories.tsx +21 -0
- package/src/stories/Progress.stories.tsx +38 -0
- package/src/stories/Prose.stories.tsx +232 -0
- package/src/stories/Result.stories.tsx +145 -0
- package/src/stories/RollingNumber.stories.tsx +1 -1
- package/src/stories/SimpleGrid.stories.tsx +130 -0
- package/src/stories/Skeleton.stories.tsx +62 -1
- package/src/stories/Squircle.stories.tsx +127 -0
- package/src/stories/Stack.stories.tsx +139 -0
- package/src/stories/StatusBadge.stories.tsx +125 -0
- package/src/stories/Tabs.stories.tsx +56 -1
- package/src/stories/Tag.stories.tsx +31 -0
- package/src/stories/ThemeIcon.stories.tsx +97 -0
- package/src/stories/Timeline.stories.tsx +69 -0
- package/src/stories/Tooltip.stories.tsx +18 -0
- package/src/stories/TreeSelect.stories.tsx +222 -0
- package/src/stories/YearPicker.stories.tsx +100 -0
- package/src/styles.css +289 -15
- package/src/tokens.json +96 -1
- package/LICENSE +0 -21
|
@@ -35,3 +35,21 @@ export const RealisticUse: Story = {
|
|
|
35
35
|
</Tooltip>
|
|
36
36
|
</TooltipProvider>),
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
// TooltipContent is an INVERTED surface (bg-foreground text-background). A
|
|
40
|
+
// de-emphasized second line must use `text-background/70`, NOT
|
|
41
|
+
// `text-muted-foreground` — the latter is calibrated to pair against the normal
|
|
42
|
+
// background and collapses to ~2:1 (fails WCAG) on the inverted box. This story
|
|
43
|
+
// is the canonical demonstration of the correct pattern; see tooltip.tsx's
|
|
44
|
+
// inverted-surface note and the Tooltip registry antiPattern.
|
|
45
|
+
export const DeEmphasizedText: Story = {
|
|
46
|
+
render: () => (<TooltipProvider>
|
|
47
|
+
<Tooltip>
|
|
48
|
+
<TooltipTrigger asChild><Button variant="outline">Contrast ratio</Button></TooltipTrigger>
|
|
49
|
+
<TooltipContent className="flex flex-col gap-0.5">
|
|
50
|
+
<span className="font-medium">7.36:1 — passes AAA</span>
|
|
51
|
+
<span className="text-background/70">WCAG 1.4.6 requires 7:1 for normal text</span>
|
|
52
|
+
</TooltipContent>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</TooltipProvider>),
|
|
55
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
TreeSelect,
|
|
5
|
+
type TreeSelectNode,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/tree-select";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof TreeSelect> = {
|
|
9
|
+
title: "Components/TreeSelect",
|
|
10
|
+
component: TreeSelect,
|
|
11
|
+
parameters: { layout: "centered" },
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof TreeSelect>;
|
|
17
|
+
|
|
18
|
+
// Real content: the BADS 10-layer stack as a browsable taxonomy
|
|
19
|
+
// (content/personas/bads.json — jargon + system vocabulary).
|
|
20
|
+
const systemLayers: TreeSelectNode[] = [
|
|
21
|
+
{
|
|
22
|
+
value: "foundation",
|
|
23
|
+
label: "Foundation",
|
|
24
|
+
children: [
|
|
25
|
+
{ value: "voice-and-tone", label: "Voice & tone" },
|
|
26
|
+
{ value: "language", label: "Language" },
|
|
27
|
+
{ value: "microcopy", label: "Microcopy" },
|
|
28
|
+
{ value: "personas", label: "Personas" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "tokens",
|
|
33
|
+
label: "Design tokens",
|
|
34
|
+
children: [
|
|
35
|
+
{ value: "primitive-tokens", label: "Primitive tokens" },
|
|
36
|
+
{ value: "semantic-tokens", label: "Semantic tokens" },
|
|
37
|
+
{
|
|
38
|
+
value: "motion-tokens",
|
|
39
|
+
label: "Motion",
|
|
40
|
+
children: [
|
|
41
|
+
{ value: "durations", label: "Durations (180ms transition)" },
|
|
42
|
+
{ value: "easings", label: "Easings" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "components",
|
|
49
|
+
label: "Component registry",
|
|
50
|
+
children: [
|
|
51
|
+
{ value: "a11y-contracts", label: "A11y contracts" },
|
|
52
|
+
{ value: "cva-variants", label: "CVA variants" },
|
|
53
|
+
{ value: "anti-patterns", label: "Anti-patterns" },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
// Team structure for the multi-select review-request scenario
|
|
59
|
+
// (names from the primary persona pool).
|
|
60
|
+
const reviewers: TreeSelectNode[] = [
|
|
61
|
+
{
|
|
62
|
+
value: "design-systems",
|
|
63
|
+
label: "Design systems",
|
|
64
|
+
children: [
|
|
65
|
+
{ value: "jordan-reeves", label: "Jordan Reeves" },
|
|
66
|
+
{ value: "seoyun-park", label: "Seo-yun Park" },
|
|
67
|
+
{ value: "anika-patel", label: "Anika Patel" },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
value: "platform",
|
|
72
|
+
label: "Platform engineering",
|
|
73
|
+
children: [
|
|
74
|
+
{ value: "marcus-lindqvist", label: "Marcus Lindqvist" },
|
|
75
|
+
{ value: "tomas-herrera", label: "Tomás Herrera" },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: "product",
|
|
80
|
+
label: "Product",
|
|
81
|
+
children: [
|
|
82
|
+
{ value: "yuki-tanaka", label: "Yuki Tanaka" },
|
|
83
|
+
{ value: "kofi-asante", label: "Kofi Asante", disabled: true },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
// Docs destination tree for RealisticUse (urls from the persona pool).
|
|
89
|
+
const docsTree: TreeSelectNode[] = [
|
|
90
|
+
{
|
|
91
|
+
value: "docs",
|
|
92
|
+
label: "Docs",
|
|
93
|
+
children: [
|
|
94
|
+
{ value: "getting-started", label: "Getting started" },
|
|
95
|
+
{
|
|
96
|
+
value: "guides",
|
|
97
|
+
label: "Guides",
|
|
98
|
+
children: [
|
|
99
|
+
{ value: "token-pipeline", label: "Token pipeline" },
|
|
100
|
+
{ value: "storybook-coverage", label: "Storybook coverage" },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{ value: "proposals", label: "Proposals" },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: "shared",
|
|
108
|
+
label: "Shared with team",
|
|
109
|
+
children: [
|
|
110
|
+
{ value: "reviews", label: "Reviews" },
|
|
111
|
+
{ value: "archive", label: "Archive" },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
export const Default: Story = {
|
|
117
|
+
render: () => {
|
|
118
|
+
const [value, setValue] = React.useState<string | string[]>("");
|
|
119
|
+
return (
|
|
120
|
+
<div className="w-80">
|
|
121
|
+
<TreeSelect
|
|
122
|
+
data={systemLayers}
|
|
123
|
+
value={value}
|
|
124
|
+
onChange={setValue}
|
|
125
|
+
placeholder="Select a layer…"
|
|
126
|
+
aria-label="System layer"
|
|
127
|
+
defaultExpanded={["foundation"]}
|
|
128
|
+
/>
|
|
129
|
+
{typeof value === "string" && value && (
|
|
130
|
+
<p className="mt-2 text-sm text-muted-foreground">Selected: {value}</p>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const Multiple: Story = {
|
|
138
|
+
render: () => {
|
|
139
|
+
const [value, setValue] = React.useState<string | string[]>([
|
|
140
|
+
"jordan-reeves",
|
|
141
|
+
"seoyun-park",
|
|
142
|
+
]);
|
|
143
|
+
return (
|
|
144
|
+
<div className="w-80">
|
|
145
|
+
<TreeSelect
|
|
146
|
+
multiple
|
|
147
|
+
data={reviewers}
|
|
148
|
+
value={value}
|
|
149
|
+
onChange={setValue}
|
|
150
|
+
placeholder="Add reviewers…"
|
|
151
|
+
aria-label="Reviewers"
|
|
152
|
+
defaultExpanded={["design-systems", "platform"]}
|
|
153
|
+
/>
|
|
154
|
+
{Array.isArray(value) && (
|
|
155
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
156
|
+
{value.length} reviewer{value.length === 1 ? "" : "s"} selected
|
|
157
|
+
</p>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const Disabled: Story = {
|
|
165
|
+
render: () => (
|
|
166
|
+
<div className="w-80">
|
|
167
|
+
<TreeSelect
|
|
168
|
+
disabled
|
|
169
|
+
data={systemLayers}
|
|
170
|
+
value="semantic-tokens"
|
|
171
|
+
onChange={() => {}}
|
|
172
|
+
aria-label="System layer"
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
),
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const RealisticUse: Story = {
|
|
179
|
+
render: () => {
|
|
180
|
+
const [destination, setDestination] = React.useState<string | string[]>("");
|
|
181
|
+
const [reviewerValues, setReviewerValues] = React.useState<string | string[]>(
|
|
182
|
+
[]
|
|
183
|
+
);
|
|
184
|
+
return (
|
|
185
|
+
<div className="w-[420px] rounded-lg border bg-card p-6 shadow-sm">
|
|
186
|
+
<h3 className="text-base font-semibold">Move proposal</h3>
|
|
187
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
188
|
+
tokens-v2-proposal — shared by Jordan Reeves via
|
|
189
|
+
design.bads.com/share/tokens-v2-proposal
|
|
190
|
+
</p>
|
|
191
|
+
<div className="mt-4 space-y-4">
|
|
192
|
+
<div className="space-y-1.5">
|
|
193
|
+
<label id="destination-label" className="text-sm font-medium">
|
|
194
|
+
Destination folder
|
|
195
|
+
</label>
|
|
196
|
+
<TreeSelect
|
|
197
|
+
data={docsTree}
|
|
198
|
+
value={destination}
|
|
199
|
+
onChange={setDestination}
|
|
200
|
+
placeholder="Choose a folder…"
|
|
201
|
+
aria-labelledby="destination-label"
|
|
202
|
+
defaultExpanded={["docs"]}
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
<div className="space-y-1.5">
|
|
206
|
+
<label id="notify-label" className="text-sm font-medium">
|
|
207
|
+
Notify reviewers
|
|
208
|
+
</label>
|
|
209
|
+
<TreeSelect
|
|
210
|
+
multiple
|
|
211
|
+
data={reviewers}
|
|
212
|
+
value={reviewerValues}
|
|
213
|
+
onChange={setReviewerValues}
|
|
214
|
+
placeholder="Add reviewers…"
|
|
215
|
+
aria-labelledby="notify-label"
|
|
216
|
+
/>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { YearPicker } from "@behavioral-agentic-design-system/core/components/ui/year-picker";
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardDescription,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
11
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof YearPicker> = {
|
|
14
|
+
title: "Components/YearPicker",
|
|
15
|
+
component: YearPicker,
|
|
16
|
+
parameters: { layout: "centered" },
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: () => <YearPicker className="rounded-md border" />,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Prefilled: Story = {
|
|
28
|
+
render: () => {
|
|
29
|
+
// Persona pool date (content/personas/bads.json → primary.dates): 2026-05-26.
|
|
30
|
+
const [year, setYear] = useState<number | undefined>(2026);
|
|
31
|
+
return (
|
|
32
|
+
<YearPicker
|
|
33
|
+
value={year}
|
|
34
|
+
onValueChange={setYear}
|
|
35
|
+
defaultValue={2026}
|
|
36
|
+
className="rounded-md border"
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Disabled: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
// When disabled: grid div gets tabIndex=0 (keyboard-reachable without
|
|
45
|
+
// placing tabIndex=0 on a non-focusable button); year label uses
|
|
46
|
+
// text-muted-foreground instead of opacity-50 to maintain contrast.
|
|
47
|
+
<YearPicker
|
|
48
|
+
disabled
|
|
49
|
+
defaultValue={2026}
|
|
50
|
+
className="rounded-md border"
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithMinMax: Story = {
|
|
56
|
+
render: () => {
|
|
57
|
+
// Engagement range: minYear=2020, maxYear=2030. Out-of-range cells
|
|
58
|
+
// render at opacity-40 and are pointer-events-none.
|
|
59
|
+
const [year, setYear] = useState<number | undefined>(2026);
|
|
60
|
+
return (
|
|
61
|
+
<YearPicker
|
|
62
|
+
value={year}
|
|
63
|
+
onValueChange={setYear}
|
|
64
|
+
minYear={2020}
|
|
65
|
+
maxYear={2030}
|
|
66
|
+
className="rounded-md border"
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const RealisticUse: Story = {
|
|
73
|
+
render: () => {
|
|
74
|
+
// Persona: Jordan Reeves (content/personas/bads.json → primary.names[0]).
|
|
75
|
+
// Use case: graduation year for a professional profile.
|
|
76
|
+
const [year, setYear] = useState<number | undefined>(2026);
|
|
77
|
+
return (
|
|
78
|
+
<Card className="w-fit">
|
|
79
|
+
<CardHeader>
|
|
80
|
+
<CardTitle>Select graduation year</CardTitle>
|
|
81
|
+
<CardDescription>
|
|
82
|
+
Jordan Reeves — design systems lead, Cohort{" "}
|
|
83
|
+
{year ?? "—"}.
|
|
84
|
+
</CardDescription>
|
|
85
|
+
</CardHeader>
|
|
86
|
+
<CardContent className="space-y-3">
|
|
87
|
+
<Label htmlFor="graduation-year">Graduation year</Label>
|
|
88
|
+
<YearPicker
|
|
89
|
+
id="graduation-year"
|
|
90
|
+
value={year}
|
|
91
|
+
onValueChange={setYear}
|
|
92
|
+
minYear={2000}
|
|
93
|
+
maxYear={2030}
|
|
94
|
+
className="rounded-md border"
|
|
95
|
+
/>
|
|
96
|
+
</CardContent>
|
|
97
|
+
</Card>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
};
|