@behavioral-agentic-design-system/core 0.27.0 → 0.28.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 +4 -4
- package/src/app/preview/components/page.tsx +771 -24
- package/src/app/shell.tsx +17 -0
- package/src/components/ui/ai-badge.tsx +74 -0
- package/src/components/ui/chat-bubble.tsx +298 -0
- package/src/components/ui/clipboard.tsx +291 -0
- package/src/components/ui/copy-button.tsx +5 -1
- package/src/components/ui/data-table.tsx +388 -0
- package/src/components/ui/focus-trap.tsx +184 -0
- package/src/components/ui/index.ts +7 -0
- package/src/components/ui/mark.tsx +69 -0
- package/src/components/ui/rolling-number.tsx +200 -0
- package/src/components/ui/typing-indicator.tsx +2 -2
- package/src/components/ui/word-rotate.tsx +6 -1
- package/src/stories/AiBadge.stories.tsx +67 -0
- package/src/stories/ChatBubble.stories.tsx +222 -0
- package/src/stories/Clipboard.stories.tsx +136 -0
- package/src/stories/CopyButton.stories.tsx +2 -0
- package/src/stories/DataTable.stories.tsx +271 -0
- package/src/stories/FocusTrap.stories.tsx +218 -0
- package/src/stories/Mark.stories.tsx +84 -0
- package/src/stories/RollingNumber.stories.tsx +226 -0
- package/src/stories/TypingIndicator.stories.tsx +1 -0
- package/src/stories/WordRotate.stories.tsx +1 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import {
|
|
4
|
+
DataTable,
|
|
5
|
+
type ColumnDef,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/data-table";
|
|
7
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Meta
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof DataTable> = {
|
|
14
|
+
title: "Components/DataTable",
|
|
15
|
+
component: DataTable,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "padded",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Sortable, paginated, optionally selectable data grid. Wraps @tanstack/react-table for state management and exposes a declarative columns + data API. Use for admin tables, report outputs, and any structured dataset with >10 rows. Prefer the bare Table primitive for static reference data.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Shared types & data
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
interface TeamMember {
|
|
36
|
+
name: string;
|
|
37
|
+
role: string;
|
|
38
|
+
email: string;
|
|
39
|
+
joined: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const TEAM_MEMBERS: TeamMember[] = [
|
|
43
|
+
{
|
|
44
|
+
name: "Jordan Reeves",
|
|
45
|
+
role: "Design Lead",
|
|
46
|
+
email: "jordan@reeves.design",
|
|
47
|
+
joined: "2024-03-12",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "Anika Patel",
|
|
51
|
+
role: "Frontend Engineer",
|
|
52
|
+
email: "anika.patel@bads.design",
|
|
53
|
+
joined: "2024-05-01",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "Marcus Lindqvist",
|
|
57
|
+
role: "Product Manager",
|
|
58
|
+
email: "m.lindqvist@bads.design",
|
|
59
|
+
joined: "2023-11-20",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "Priya Nair",
|
|
63
|
+
role: "Accessibility Specialist",
|
|
64
|
+
email: "priya.nair@bads.design",
|
|
65
|
+
joined: "2025-01-08",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Theo Okafor",
|
|
69
|
+
role: "Design Technologist",
|
|
70
|
+
email: "theo.okafor@bads.design",
|
|
71
|
+
joined: "2024-09-15",
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const TEAM_COLUMNS: ColumnDef<TeamMember>[] = [
|
|
76
|
+
{ accessorKey: "name", header: "Name" },
|
|
77
|
+
{ accessorKey: "role", header: "Role" },
|
|
78
|
+
{ accessorKey: "email", header: "Email" },
|
|
79
|
+
{ accessorKey: "joined", header: "Joined" },
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// Default
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
export const Default: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<DataTable columns={TEAM_COLUMNS} data={TEAM_MEMBERS} />
|
|
89
|
+
),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Sortable (explicit prop — same as default since sorting is on by default)
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
export const Sortable: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<DataTable columns={TEAM_COLUMNS} data={TEAM_MEMBERS} sorting={true} />
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// WithPagination (15+ rows)
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
interface ComponentAdoption {
|
|
107
|
+
component: string;
|
|
108
|
+
status: string;
|
|
109
|
+
adopters: number;
|
|
110
|
+
coverage: string;
|
|
111
|
+
lastUpdated: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const ADOPTION_DATA: ComponentAdoption[] = [
|
|
115
|
+
{ component: "Button", status: "Stable", adopters: 14, coverage: "100%", lastUpdated: "2026-07-28" },
|
|
116
|
+
{ component: "Input", status: "Stable", adopters: 13, coverage: "98%", lastUpdated: "2026-07-22" },
|
|
117
|
+
{ component: "Card", status: "Stable", adopters: 12, coverage: "95%", lastUpdated: "2026-07-15" },
|
|
118
|
+
{ component: "Dialog", status: "Stable", adopters: 11, coverage: "91%", lastUpdated: "2026-07-10" },
|
|
119
|
+
{ component: "Table", status: "Stable", adopters: 10, coverage: "88%", lastUpdated: "2026-07-08" },
|
|
120
|
+
{ component: "Badge", status: "Stable", adopters: 9, coverage: "84%", lastUpdated: "2026-07-05" },
|
|
121
|
+
{ component: "Select", status: "Stable", adopters: 9, coverage: "82%", lastUpdated: "2026-07-01" },
|
|
122
|
+
{ component: "Checkbox", status: "Stable", adopters: 8, coverage: "78%", lastUpdated: "2026-06-28" },
|
|
123
|
+
{ component: "Tooltip", status: "Stable", adopters: 8, coverage: "75%", lastUpdated: "2026-06-25" },
|
|
124
|
+
{ component: "Accordion", status: "Stable", adopters: 7, coverage: "70%", lastUpdated: "2026-06-20" },
|
|
125
|
+
{ component: "Sheet", status: "Stable", adopters: 7, coverage: "68%", lastUpdated: "2026-06-18" },
|
|
126
|
+
{ component: "Popover", status: "Stable", adopters: 6, coverage: "64%", lastUpdated: "2026-06-14" },
|
|
127
|
+
{ component: "Tabs", status: "Stable", adopters: 6, coverage: "61%", lastUpdated: "2026-06-10" },
|
|
128
|
+
{ component: "DataTable", status: "New", adopters: 1, coverage: "12%", lastUpdated: "2026-08-03" },
|
|
129
|
+
{ component: "Slider", status: "Beta", adopters: 4, coverage: "42%", lastUpdated: "2026-06-05" },
|
|
130
|
+
{ component: "Calendar", status: "Beta", adopters: 3, coverage: "38%", lastUpdated: "2026-06-02" },
|
|
131
|
+
{ component: "TreeView", status: "Beta", adopters: 2, coverage: "24%", lastUpdated: "2026-05-28" },
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const ADOPTION_COLUMNS: ColumnDef<ComponentAdoption>[] = [
|
|
135
|
+
{ accessorKey: "component", header: "Component" },
|
|
136
|
+
{ accessorKey: "status", header: "Status" },
|
|
137
|
+
{ accessorKey: "adopters", header: "Adopters" },
|
|
138
|
+
{ accessorKey: "coverage", header: "Coverage" },
|
|
139
|
+
{ accessorKey: "lastUpdated", header: "Last Updated" },
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
export const WithPagination: Story = {
|
|
143
|
+
render: () => (
|
|
144
|
+
<DataTable
|
|
145
|
+
columns={ADOPTION_COLUMNS}
|
|
146
|
+
data={ADOPTION_DATA}
|
|
147
|
+
pagination={{ pageSize: 8 }}
|
|
148
|
+
/>
|
|
149
|
+
),
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// WithRowSelection
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
export const WithRowSelection: Story = {
|
|
157
|
+
render: () => (
|
|
158
|
+
<DataTable
|
|
159
|
+
columns={TEAM_COLUMNS}
|
|
160
|
+
data={TEAM_MEMBERS}
|
|
161
|
+
rowSelection={true}
|
|
162
|
+
/>
|
|
163
|
+
),
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// Dense
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
|
|
170
|
+
export const Dense: Story = {
|
|
171
|
+
render: () => (
|
|
172
|
+
<DataTable
|
|
173
|
+
columns={TEAM_COLUMNS}
|
|
174
|
+
data={TEAM_MEMBERS}
|
|
175
|
+
density="dense"
|
|
176
|
+
/>
|
|
177
|
+
),
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// EmptyState
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
export const EmptyState: Story = {
|
|
185
|
+
render: () => (
|
|
186
|
+
<DataTable
|
|
187
|
+
columns={TEAM_COLUMNS}
|
|
188
|
+
data={[]}
|
|
189
|
+
emptyMessage="No team members matched your filters."
|
|
190
|
+
/>
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
// RealisticUse — design system component adoption table
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
|
|
198
|
+
type AdoptionStatus = "Stable" | "Beta" | "New" | "Deprecated";
|
|
199
|
+
|
|
200
|
+
interface ComponentRow {
|
|
201
|
+
component: string;
|
|
202
|
+
status: AdoptionStatus;
|
|
203
|
+
adopters: number;
|
|
204
|
+
coverage: string;
|
|
205
|
+
lastUpdated: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const REALISTIC_DATA: ComponentRow[] = [
|
|
209
|
+
{ component: "Button", status: "Stable", adopters: 14, coverage: "100%", lastUpdated: "2026-07-28" },
|
|
210
|
+
{ component: "Input", status: "Stable", adopters: 13, coverage: "98%", lastUpdated: "2026-07-22" },
|
|
211
|
+
{ component: "Card", status: "Stable", adopters: 12, coverage: "95%", lastUpdated: "2026-07-15" },
|
|
212
|
+
{ component: "Dialog", status: "Stable", adopters: 11, coverage: "91%", lastUpdated: "2026-07-10" },
|
|
213
|
+
{ component: "DataTable", status: "New", adopters: 1, coverage: "12%", lastUpdated: "2026-08-03" },
|
|
214
|
+
{ component: "Slider", status: "Beta", adopters: 4, coverage: "42%", lastUpdated: "2026-06-05" },
|
|
215
|
+
{ component: "Calendar", status: "Beta", adopters: 3, coverage: "38%", lastUpdated: "2026-06-02" },
|
|
216
|
+
];
|
|
217
|
+
|
|
218
|
+
const STATUS_VARIANT_MAP: Record<AdoptionStatus, "default" | "secondary" | "outline" | "destructive"> = {
|
|
219
|
+
Stable: "default",
|
|
220
|
+
Beta: "secondary",
|
|
221
|
+
New: "outline",
|
|
222
|
+
Deprecated: "destructive",
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const REALISTIC_COLUMNS: ColumnDef<ComponentRow>[] = [
|
|
226
|
+
{ accessorKey: "component", header: "Component" },
|
|
227
|
+
{
|
|
228
|
+
accessorKey: "status",
|
|
229
|
+
header: "Status",
|
|
230
|
+
cell: ({ row }) => {
|
|
231
|
+
const status = row.getValue<AdoptionStatus>("status");
|
|
232
|
+
return (
|
|
233
|
+
<Badge variant={STATUS_VARIANT_MAP[status]} className="text-xs">
|
|
234
|
+
{status}
|
|
235
|
+
</Badge>
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
accessorKey: "adopters",
|
|
241
|
+
header: "Adopters",
|
|
242
|
+
cell: ({ row }) => (
|
|
243
|
+
<span className="tabular-nums">{row.getValue<number>("adopters")}</span>
|
|
244
|
+
),
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
accessorKey: "coverage",
|
|
248
|
+
header: "Coverage",
|
|
249
|
+
cell: ({ row }) => (
|
|
250
|
+
<span className="tabular-nums font-medium">{row.getValue<string>("coverage")}</span>
|
|
251
|
+
),
|
|
252
|
+
},
|
|
253
|
+
{ accessorKey: "lastUpdated", header: "Last Updated" },
|
|
254
|
+
];
|
|
255
|
+
|
|
256
|
+
export const RealisticUse: Story = {
|
|
257
|
+
render: () => (
|
|
258
|
+
<div className="space-y-2">
|
|
259
|
+
<p className="text-sm text-muted-foreground">
|
|
260
|
+
Component adoption tracker — Jordan Reeves' team across 14 product surfaces.
|
|
261
|
+
</p>
|
|
262
|
+
<DataTable
|
|
263
|
+
columns={REALISTIC_COLUMNS}
|
|
264
|
+
data={REALISTIC_DATA}
|
|
265
|
+
sorting={true}
|
|
266
|
+
pagination={{ pageSize: 5 }}
|
|
267
|
+
rowSelection={true}
|
|
268
|
+
/>
|
|
269
|
+
</div>
|
|
270
|
+
),
|
|
271
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import {
|
|
4
|
+
FocusTrap,
|
|
5
|
+
FocusTrapInitialFocus,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/focus-trap";
|
|
7
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
8
|
+
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
9
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof FocusTrap> = {
|
|
12
|
+
title: "Components/FocusTrap",
|
|
13
|
+
component: FocusTrap,
|
|
14
|
+
parameters: { layout: "centered" },
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
argTypes: {
|
|
17
|
+
active: { control: "boolean" },
|
|
18
|
+
loop: { control: "boolean" },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
render: () => {
|
|
27
|
+
const [open, setOpen] = React.useState(false);
|
|
28
|
+
return (
|
|
29
|
+
<div className="space-y-4">
|
|
30
|
+
<Button onClick={() => setOpen(true)}>Open trapped form</Button>
|
|
31
|
+
{open && (
|
|
32
|
+
<FocusTrap
|
|
33
|
+
active
|
|
34
|
+
onEscapeKeyDown={() => setOpen(false)}
|
|
35
|
+
className="rounded-lg border bg-card p-6 shadow-sm"
|
|
36
|
+
>
|
|
37
|
+
<div role="dialog" aria-modal="true" aria-labelledby="ft-title">
|
|
38
|
+
<h3 id="ft-title" className="mb-4 text-lg font-semibold">
|
|
39
|
+
Trapped focus area
|
|
40
|
+
</h3>
|
|
41
|
+
<div className="space-y-3">
|
|
42
|
+
<div className="space-y-1.5">
|
|
43
|
+
<Label htmlFor="ft-name">Name</Label>
|
|
44
|
+
<Input id="ft-name" placeholder="Seo-yun Park" />
|
|
45
|
+
</div>
|
|
46
|
+
<div className="space-y-1.5">
|
|
47
|
+
<Label htmlFor="ft-email">Email</Label>
|
|
48
|
+
<Input id="ft-email" type="email" placeholder="seo-yun@bads.com" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="mt-4 flex gap-3">
|
|
52
|
+
<Button size="sm" onClick={() => setOpen(false)}>
|
|
53
|
+
Save
|
|
54
|
+
</Button>
|
|
55
|
+
<Button size="sm" variant="outline" onClick={() => setOpen(false)}>
|
|
56
|
+
Cancel
|
|
57
|
+
</Button>
|
|
58
|
+
</div>
|
|
59
|
+
<p className="mt-3 text-xs text-muted-foreground">
|
|
60
|
+
Tab cycles within. Press Escape to close.
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</FocusTrap>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Deactivated: Story = {
|
|
71
|
+
render: () => (
|
|
72
|
+
<FocusTrap
|
|
73
|
+
active={false}
|
|
74
|
+
className="rounded-lg border bg-card p-6"
|
|
75
|
+
>
|
|
76
|
+
<p className="mb-3 text-sm text-muted-foreground">
|
|
77
|
+
active=false — Tab moves freely outside this container.
|
|
78
|
+
</p>
|
|
79
|
+
<div className="flex gap-3">
|
|
80
|
+
<Button size="sm">First</Button>
|
|
81
|
+
<Button size="sm" variant="outline">Second</Button>
|
|
82
|
+
<Button size="sm" variant="outline">Third</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</FocusTrap>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const WithEscapeKey: Story = {
|
|
89
|
+
render: () => {
|
|
90
|
+
const [open, setOpen] = React.useState(false);
|
|
91
|
+
const [log, setLog] = React.useState<string[]>([]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div className="space-y-4">
|
|
95
|
+
<Button
|
|
96
|
+
onClick={() => {
|
|
97
|
+
setOpen(true);
|
|
98
|
+
setLog((l) => [...l, "opened"]);
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
Open (then press Escape)
|
|
102
|
+
</Button>
|
|
103
|
+
{open && (
|
|
104
|
+
<FocusTrap
|
|
105
|
+
active
|
|
106
|
+
onEscapeKeyDown={() => {
|
|
107
|
+
setOpen(false);
|
|
108
|
+
setLog((l) => [...l, "closed via Escape"]);
|
|
109
|
+
}}
|
|
110
|
+
className="rounded-lg border bg-card p-6 shadow-sm"
|
|
111
|
+
>
|
|
112
|
+
<p className="mb-3 text-sm">Press Escape to close and log it.</p>
|
|
113
|
+
<div className="flex gap-3">
|
|
114
|
+
<Button size="sm">Action A</Button>
|
|
115
|
+
<Button size="sm" variant="outline">Action B</Button>
|
|
116
|
+
</div>
|
|
117
|
+
</FocusTrap>
|
|
118
|
+
)}
|
|
119
|
+
{log.length > 0 && (
|
|
120
|
+
<ul className="space-y-1">
|
|
121
|
+
{log.map((entry, i) => (
|
|
122
|
+
<li key={i} className="text-xs text-muted-foreground">
|
|
123
|
+
{i + 1}. {entry}
|
|
124
|
+
</li>
|
|
125
|
+
))}
|
|
126
|
+
</ul>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const WithInitialFocus: Story = {
|
|
134
|
+
render: () => {
|
|
135
|
+
const [open, setOpen] = React.useState(false);
|
|
136
|
+
return (
|
|
137
|
+
<div className="space-y-4">
|
|
138
|
+
<Button onClick={() => setOpen(true)}>Open (Cancel gets initial focus)</Button>
|
|
139
|
+
{open && (
|
|
140
|
+
<FocusTrap
|
|
141
|
+
active
|
|
142
|
+
onEscapeKeyDown={() => setOpen(false)}
|
|
143
|
+
className="rounded-lg border border-destructive/30 bg-card p-6 shadow-sm"
|
|
144
|
+
>
|
|
145
|
+
<p className="mb-4 text-sm text-muted-foreground">
|
|
146
|
+
FocusTrapInitialFocus sits before the destructive Confirm — the
|
|
147
|
+
safe Cancel button receives focus on open.
|
|
148
|
+
</p>
|
|
149
|
+
<Button variant="destructive" size="sm">
|
|
150
|
+
Confirm delete
|
|
151
|
+
</Button>{" "}
|
|
152
|
+
<FocusTrapInitialFocus />
|
|
153
|
+
<Button
|
|
154
|
+
size="sm"
|
|
155
|
+
variant="outline"
|
|
156
|
+
onClick={() => setOpen(false)}
|
|
157
|
+
>
|
|
158
|
+
Cancel (initial focus)
|
|
159
|
+
</Button>
|
|
160
|
+
</FocusTrap>
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const RealisticUse: Story = {
|
|
168
|
+
render: () => {
|
|
169
|
+
const [open, setOpen] = React.useState(false);
|
|
170
|
+
return (
|
|
171
|
+
<div className="max-w-sm space-y-4">
|
|
172
|
+
<p className="text-sm text-muted-foreground">
|
|
173
|
+
A lightweight confirmation panel that uses FocusTrap instead of
|
|
174
|
+
Dialog — no overlay, no portal. Useful for inline destructive
|
|
175
|
+
actions in table rows or settings lists.
|
|
176
|
+
</p>
|
|
177
|
+
<Button variant="outline" size="sm" onClick={() => setOpen(true)}>
|
|
178
|
+
Remove team member
|
|
179
|
+
</Button>
|
|
180
|
+
{open && (
|
|
181
|
+
<FocusTrap
|
|
182
|
+
active
|
|
183
|
+
onEscapeKeyDown={() => setOpen(false)}
|
|
184
|
+
className="rounded-lg border border-destructive/40 bg-card px-5 py-4 shadow-md"
|
|
185
|
+
>
|
|
186
|
+
<div role="dialog" aria-modal="true" aria-labelledby="rm-title">
|
|
187
|
+
<p
|
|
188
|
+
id="rm-title"
|
|
189
|
+
className="mb-1 text-sm font-medium text-foreground"
|
|
190
|
+
>
|
|
191
|
+
Remove Arjun Mehta from the workspace?
|
|
192
|
+
</p>
|
|
193
|
+
<p className="mb-4 text-xs text-muted-foreground">
|
|
194
|
+
This revokes access immediately. The action cannot be undone.
|
|
195
|
+
</p>
|
|
196
|
+
<div className="flex gap-2">
|
|
197
|
+
<Button
|
|
198
|
+
variant="destructive"
|
|
199
|
+
size="sm"
|
|
200
|
+
onClick={() => setOpen(false)}
|
|
201
|
+
>
|
|
202
|
+
Remove
|
|
203
|
+
</Button>
|
|
204
|
+
<Button
|
|
205
|
+
variant="outline"
|
|
206
|
+
size="sm"
|
|
207
|
+
onClick={() => setOpen(false)}
|
|
208
|
+
>
|
|
209
|
+
Cancel
|
|
210
|
+
</Button>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</FocusTrap>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Mark } from "@behavioral-agentic-design-system/core/components/ui/mark";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Mark> = {
|
|
6
|
+
title: "Components/Mark",
|
|
7
|
+
component: Mark,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: { control: "select", options: ["default", "primary", "secondary"] },
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<p className="max-w-prose text-base">
|
|
21
|
+
The most important constraint in BADS is{" "}
|
|
22
|
+
<Mark>token discipline</Mark> — every color, spacing value, and
|
|
23
|
+
border radius traces back to a single authoritative source.
|
|
24
|
+
</p>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Variant_Primary: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<p className="max-w-prose text-base">
|
|
31
|
+
Use <Mark variant="primary">primary tint</Mark> for branded or
|
|
32
|
+
navigational emphasis — a phrase the reader should associate with
|
|
33
|
+
the product's core action.
|
|
34
|
+
</p>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Variant_Secondary: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<p className="max-w-prose text-base">
|
|
41
|
+
A <Mark variant="secondary">secondary surface mark</Mark> reads as
|
|
42
|
+
neutral annotation — useful for glossary terms or non-semantic
|
|
43
|
+
editorial callouts where color association isn't the goal.
|
|
44
|
+
</p>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const InParagraph: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div className="max-w-prose space-y-3 text-base">
|
|
51
|
+
<p>
|
|
52
|
+
Sir runs the <Mark>Night Shift</Mark> every day at 06:00 CDT.
|
|
53
|
+
It audits the system, web-researches improvements, builds{" "}
|
|
54
|
+
<Mark>three new components</Mark>, and posts a morning brief to
|
|
55
|
+
Slack <Mark variant="primary">#bads</Mark>.
|
|
56
|
+
</p>
|
|
57
|
+
<p>
|
|
58
|
+
Multiple marks in a single paragraph stay legible because the
|
|
59
|
+
background is a pale wash — never a solid fill competing with the
|
|
60
|
+
surrounding text.
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const RealisticUse: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<div className="max-w-prose space-y-4">
|
|
69
|
+
<h3 className="text-lg font-semibold">Release notes — v2.4.0</h3>
|
|
70
|
+
<p className="text-sm text-muted-foreground">
|
|
71
|
+
The <Mark>Mark</Mark> primitive ships in this release alongside{" "}
|
|
72
|
+
<Mark variant="primary">FocusTrap</Mark> and{" "}
|
|
73
|
+
<Mark variant="primary">TreeSelect</Mark>. Together they close the
|
|
74
|
+
last three gaps in the editorial-text and form-interaction surface.
|
|
75
|
+
See the component-builds ledger for build notes.
|
|
76
|
+
</p>
|
|
77
|
+
<p className="text-sm text-muted-foreground">
|
|
78
|
+
Note: <Mark variant="secondary">Highlight</Mark> and{" "}
|
|
79
|
+
<Mark>Mark</Mark> are distinct. Highlight dynamically marks
|
|
80
|
+
search-query matches at runtime; Mark is a static author annotation.
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
};
|