@behavioral-agentic-design-system/core 0.39.0 → 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 +93 -39
- package/scripts/a11y-ratchet.mjs +10 -23
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +175 -17
- package/scripts/check-stories.mjs +1 -1
- package/scripts/health-report.mjs +52 -10
- package/scripts/lib/scan-roots.cjs +143 -0
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/lint-slop.mjs +21 -28
- package/scripts/lint-token-intent.mjs +10 -16
- package/scripts/size-audit.cjs +94 -27
- 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 +2 -0
- package/src/app/preview/components/page.tsx +972 -0
- package/src/app/preview/health/page.tsx +8 -5
- package/src/app/preview/history/page.tsx +11 -0
- package/src/app/shell.tsx +261 -87
- 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 +91 -0
- 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 +9 -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 +15 -15
- package/src/components/ui/textarea.tsx +28 -1
- package/src/data/docs-index.ts +5 -0
- package/src/data/history.json +269 -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/Sheet.stories.tsx +9 -3
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Sparkline.stories.tsx +39 -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,228 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { CircleCheck } from "lucide-react"
|
|
4
|
+
import {
|
|
5
|
+
Presence,
|
|
6
|
+
type PresenceTransition,
|
|
7
|
+
} from "@behavioral-agentic-design-system/core/components/ui/presence"
|
|
8
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
9
|
+
import {
|
|
10
|
+
Alert,
|
|
11
|
+
AlertDescription,
|
|
12
|
+
AlertTitle,
|
|
13
|
+
} from "@behavioral-agentic-design-system/core/components/ui/alert"
|
|
14
|
+
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input"
|
|
15
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label"
|
|
16
|
+
|
|
17
|
+
const meta: Meta<typeof Presence> = {
|
|
18
|
+
title: "Components/Feedback/Presence",
|
|
19
|
+
component: Presence,
|
|
20
|
+
parameters: { layout: "centered" },
|
|
21
|
+
tags: ["autodocs"],
|
|
22
|
+
argTypes: {
|
|
23
|
+
transition: {
|
|
24
|
+
control: "select",
|
|
25
|
+
options: ["fade", "scale", "slide-up", "slide-down", "slide-left", "slide-right"],
|
|
26
|
+
},
|
|
27
|
+
unmountOnExit: { control: "boolean" },
|
|
28
|
+
asChild: { control: false },
|
|
29
|
+
present: { control: false },
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
type Story = StoryObj<typeof meta>
|
|
35
|
+
|
|
36
|
+
// Content from content/personas/bads.json → primary.names / companies.
|
|
37
|
+
const PANEL_TITLE = "Jordan Reeves"
|
|
38
|
+
const PANEL_BODY = "Northwind Systems · design system lead"
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Shared harness: a toggle Button drives `present`, the panel underneath
|
|
42
|
+
* animates in and out. Every story below reuses it with a different
|
|
43
|
+
* `transition` so the sidebar reads as the full keyframe matrix.
|
|
44
|
+
*/
|
|
45
|
+
function Harness({
|
|
46
|
+
transition,
|
|
47
|
+
unmountOnExit = true,
|
|
48
|
+
}: {
|
|
49
|
+
transition: PresenceTransition
|
|
50
|
+
unmountOnExit?: boolean
|
|
51
|
+
}) {
|
|
52
|
+
const [present, setPresent] = React.useState(true)
|
|
53
|
+
return (
|
|
54
|
+
<div className="flex w-80 flex-col gap-4">
|
|
55
|
+
<Button
|
|
56
|
+
variant="outline"
|
|
57
|
+
onClick={() => setPresent((p) => !p)}
|
|
58
|
+
aria-expanded={present}
|
|
59
|
+
aria-controls="presence-harness-panel"
|
|
60
|
+
>
|
|
61
|
+
{present ? "Hide panel" : "Show panel"}
|
|
62
|
+
</Button>
|
|
63
|
+
{/* Fixed-height slot so the layout doesn't jump while the exit plays. */}
|
|
64
|
+
<div className="h-24">
|
|
65
|
+
<Presence
|
|
66
|
+
id="presence-harness-panel"
|
|
67
|
+
present={present}
|
|
68
|
+
transition={transition}
|
|
69
|
+
unmountOnExit={unmountOnExit}
|
|
70
|
+
className="rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm"
|
|
71
|
+
>
|
|
72
|
+
<p className="text-sm font-medium">{PANEL_TITLE}</p>
|
|
73
|
+
<p className="text-sm text-muted-foreground">{PANEL_BODY}</p>
|
|
74
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
75
|
+
transition: <code className="font-mono">{transition}</code>
|
|
76
|
+
</p>
|
|
77
|
+
</Presence>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// `present` is owned by the harness's toggle button; `transition` and
|
|
84
|
+
// `unmountOnExit` come from args so the Controls panel drives them.
|
|
85
|
+
const renderHarness = (args: Story["args"]) => (
|
|
86
|
+
<Harness
|
|
87
|
+
transition={args?.transition ?? "fade"}
|
|
88
|
+
unmountOnExit={args?.unmountOnExit ?? true}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
export const Default: Story = {
|
|
93
|
+
args: { transition: "fade", unmountOnExit: true },
|
|
94
|
+
render: (args) => renderHarness(args),
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const Variant_Fade: Story = {
|
|
98
|
+
args: { transition: "fade" },
|
|
99
|
+
render: (args) => renderHarness(args),
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const Variant_Scale: Story = {
|
|
103
|
+
args: { transition: "scale" },
|
|
104
|
+
render: (args) => renderHarness(args),
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const Variant_SlideUp: Story = {
|
|
108
|
+
args: { transition: "slide-up" },
|
|
109
|
+
render: (args) => renderHarness(args),
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const Variant_SlideDown: Story = {
|
|
113
|
+
args: { transition: "slide-down" },
|
|
114
|
+
render: (args) => renderHarness(args),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const Variant_SlideLeft: Story = {
|
|
118
|
+
args: { transition: "slide-left" },
|
|
119
|
+
render: (args) => renderHarness(args),
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const Variant_SlideRight: Story = {
|
|
123
|
+
args: { transition: "slide-right" },
|
|
124
|
+
render: (args) => renderHarness(args),
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* `unmountOnExit={false}` keeps the element in the DOM with the `hidden`
|
|
129
|
+
* attribute after the exit animation — inspect the DOM to see it. Use this
|
|
130
|
+
* for expensive subtrees (charts, iframes) that should keep their state.
|
|
131
|
+
*/
|
|
132
|
+
export const KeepMounted: Story = {
|
|
133
|
+
args: { transition: "scale", unmountOnExit: false },
|
|
134
|
+
render: (args) => renderHarness(args),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* `asChild` merges the presence attributes onto the single child instead of
|
|
139
|
+
* adding a wrapper div — here the Alert itself animates.
|
|
140
|
+
*/
|
|
141
|
+
export const AsChild: Story = {
|
|
142
|
+
render: function AsChildStory() {
|
|
143
|
+
const [present, setPresent] = React.useState(true)
|
|
144
|
+
return (
|
|
145
|
+
<div className="flex w-96 flex-col gap-4">
|
|
146
|
+
<Button variant="outline" onClick={() => setPresent((p) => !p)}>
|
|
147
|
+
{present ? "Dismiss alert" : "Show alert"}
|
|
148
|
+
</Button>
|
|
149
|
+
<div className="min-h-20">
|
|
150
|
+
<Presence present={present} transition="slide-down" asChild>
|
|
151
|
+
<Alert>
|
|
152
|
+
<CircleCheck strokeWidth={1.5} />
|
|
153
|
+
<AlertTitle>Story coverage check passed</AlertTitle>
|
|
154
|
+
<AlertDescription>
|
|
155
|
+
All 36 components have matching stories.
|
|
156
|
+
</AlertDescription>
|
|
157
|
+
</Alert>
|
|
158
|
+
</Presence>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* A settings form whose "Save changes" shows an inline confirmation that
|
|
167
|
+
* animates in, holds for a moment, then animates out — the exit frame is
|
|
168
|
+
* what conditional rendering can't do. Copy from
|
|
169
|
+
* content/personas/bads.json → primary.notifications / microcopy.
|
|
170
|
+
*/
|
|
171
|
+
export const RealisticUse: Story = {
|
|
172
|
+
render: function RealisticUseStory() {
|
|
173
|
+
const [saved, setSaved] = React.useState(false)
|
|
174
|
+
React.useEffect(() => {
|
|
175
|
+
if (!saved) return
|
|
176
|
+
const t = window.setTimeout(() => setSaved(false), 2400)
|
|
177
|
+
return () => window.clearTimeout(t)
|
|
178
|
+
}, [saved])
|
|
179
|
+
return (
|
|
180
|
+
<form
|
|
181
|
+
className="flex w-96 flex-col gap-5 rounded-lg border border-border bg-card p-6"
|
|
182
|
+
onSubmit={(e) => {
|
|
183
|
+
e.preventDefault()
|
|
184
|
+
setSaved(true)
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
<div>
|
|
188
|
+
<p className="text-lg font-semibold">Customize your tokens</p>
|
|
189
|
+
<p className="text-sm text-muted-foreground">
|
|
190
|
+
36 components, all passing AAA contrast.
|
|
191
|
+
</p>
|
|
192
|
+
</div>
|
|
193
|
+
<div className="flex flex-col gap-3">
|
|
194
|
+
<Label htmlFor="presence-scope">npm scope</Label>
|
|
195
|
+
<Input
|
|
196
|
+
id="presence-scope"
|
|
197
|
+
defaultValue="@behavioral-agentic-design-system"
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
<div className="flex items-center gap-3">
|
|
201
|
+
<Button type="submit" size="xl">
|
|
202
|
+
Save changes
|
|
203
|
+
</Button>
|
|
204
|
+
<Button type="button" variant="ghost" size="xl">
|
|
205
|
+
Cancel
|
|
206
|
+
</Button>
|
|
207
|
+
</div>
|
|
208
|
+
<div className="min-h-12" aria-live="polite">
|
|
209
|
+
<Presence present={saved} transition="slide-up" asChild>
|
|
210
|
+
<div className="flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-sm">
|
|
211
|
+
<CircleCheck
|
|
212
|
+
strokeWidth={1.5}
|
|
213
|
+
className="mt-0.5 size-4 shrink-0 text-icon-success"
|
|
214
|
+
aria-hidden="true"
|
|
215
|
+
/>
|
|
216
|
+
<span>
|
|
217
|
+
<span className="font-medium">Token changes saved.</span>{" "}
|
|
218
|
+
<span className="text-muted-foreground">
|
|
219
|
+
Run pnpm build:tokens to regenerate CSS.
|
|
220
|
+
</span>
|
|
221
|
+
</span>
|
|
222
|
+
</div>
|
|
223
|
+
</Presence>
|
|
224
|
+
</div>
|
|
225
|
+
</form>
|
|
226
|
+
)
|
|
227
|
+
},
|
|
228
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ProgressStack } from "@behavioral-agentic-design-system/core/components/ui/progress-stack";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ProgressStack renders a multi-segment stacked horizontal bar for categorical
|
|
6
|
+
* breakdowns: storage used by file type, budget allocated by team, skill
|
|
7
|
+
* proficiency spread across domains.
|
|
8
|
+
*
|
|
9
|
+
* Segment colors cycle through the --chart-1..5 family by default so the bar
|
|
10
|
+
* reads as part of the same system as BADS charts. Override per segment via the
|
|
11
|
+
* `color` field.
|
|
12
|
+
*
|
|
13
|
+
* Accessibility: the track is `role="img"` with an `aria-label`. A
|
|
14
|
+
* visually-hidden description list carries the label + percentage for each
|
|
15
|
+
* segment. Always supply `aria-label` and, for sighted users, pair with
|
|
16
|
+
* `showLegend` so the breakdown is visible without assistive technology.
|
|
17
|
+
*
|
|
18
|
+
* Motion: each segment's width animates from 0 on mount using --duration-slow +
|
|
19
|
+
* --ease-out with a 40 ms per-segment stagger. Reduced-motion users see the
|
|
20
|
+
* final state immediately.
|
|
21
|
+
*/
|
|
22
|
+
const meta: Meta<typeof ProgressStack> = {
|
|
23
|
+
title: "Components/Content and data/ProgressStack",
|
|
24
|
+
component: ProgressStack,
|
|
25
|
+
parameters: { layout: "centered" },
|
|
26
|
+
tags: ["autodocs"],
|
|
27
|
+
argTypes: {
|
|
28
|
+
size: { control: "select", options: ["sm", "default", "lg"] },
|
|
29
|
+
showLegend: { control: "boolean" },
|
|
30
|
+
showValues: { control: "boolean" },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
// ─── Segment fixtures ─────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
const storageSegments = [
|
|
40
|
+
{ value: 38, label: "Documents" },
|
|
41
|
+
{ value: 29, label: "Media" },
|
|
42
|
+
{ value: 16, label: "System" },
|
|
43
|
+
{ value: 8, label: "Other" },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const budgetSegments = [
|
|
47
|
+
{ value: 42, label: "Engineering" },
|
|
48
|
+
{ value: 28, label: "Design" },
|
|
49
|
+
{ value: 18, label: "Marketing" },
|
|
50
|
+
{ value: 12, label: "Operations" },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const skillSegments = [
|
|
54
|
+
{ value: 90, label: "TypeScript" },
|
|
55
|
+
{ value: 75, label: "Design systems" },
|
|
56
|
+
{ value: 60, label: "Accessibility" },
|
|
57
|
+
{ value: 45, label: "Motion design" },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const twoSegments = [
|
|
61
|
+
{ value: 65, label: "Used" },
|
|
62
|
+
{ value: 35, label: "Available" },
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
const customColors = [
|
|
66
|
+
{ value: 40, label: "Q1", color: "var(--primary)" },
|
|
67
|
+
{ value: 25, label: "Q2", color: "var(--success)" },
|
|
68
|
+
{ value: 20, label: "Q3", color: "var(--warning)" },
|
|
69
|
+
{ value: 15, label: "Q4", color: "var(--destructive)" },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
// ─── Stories ──────────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
export const Default: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
segments: storageSegments,
|
|
77
|
+
"aria-label": "Storage breakdown",
|
|
78
|
+
size: "default",
|
|
79
|
+
showLegend: false,
|
|
80
|
+
showValues: false,
|
|
81
|
+
},
|
|
82
|
+
render: (args) => (
|
|
83
|
+
<div className="w-80">
|
|
84
|
+
<ProgressStack {...args} />
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const WithLegend: Story = {
|
|
90
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
91
|
+
<div className="w-80">
|
|
92
|
+
<ProgressStack
|
|
93
|
+
segments={storageSegments}
|
|
94
|
+
aria-label="Storage breakdown"
|
|
95
|
+
showLegend
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const WithValues: Story = {
|
|
102
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
103
|
+
<div className="w-80">
|
|
104
|
+
<ProgressStack
|
|
105
|
+
segments={storageSegments}
|
|
106
|
+
aria-label="Storage breakdown"
|
|
107
|
+
showLegend
|
|
108
|
+
showValues
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Size_Sm: Story = {
|
|
115
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
116
|
+
<div className="w-80">
|
|
117
|
+
<ProgressStack
|
|
118
|
+
segments={storageSegments}
|
|
119
|
+
size="sm"
|
|
120
|
+
aria-label="Storage breakdown"
|
|
121
|
+
showLegend
|
|
122
|
+
showValues
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const Size_Default: Story = {
|
|
129
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
130
|
+
<div className="w-80">
|
|
131
|
+
<ProgressStack
|
|
132
|
+
segments={storageSegments}
|
|
133
|
+
size="default"
|
|
134
|
+
aria-label="Storage breakdown"
|
|
135
|
+
showLegend
|
|
136
|
+
showValues
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const Size_Lg: Story = {
|
|
143
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
144
|
+
<div className="w-80">
|
|
145
|
+
<ProgressStack
|
|
146
|
+
segments={storageSegments}
|
|
147
|
+
size="lg"
|
|
148
|
+
aria-label="Storage breakdown"
|
|
149
|
+
showLegend
|
|
150
|
+
showValues
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const Sizes: Story = {
|
|
157
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
158
|
+
<div className="flex w-80 flex-col gap-6">
|
|
159
|
+
{(["sm", "default", "lg"] as const).map((size) => (
|
|
160
|
+
<div key={size} className="flex flex-col gap-2">
|
|
161
|
+
<p className="text-xs text-muted-foreground font-medium">size="{size}"</p>
|
|
162
|
+
<ProgressStack
|
|
163
|
+
segments={storageSegments}
|
|
164
|
+
size={size}
|
|
165
|
+
aria-label={`Storage breakdown — ${size}`}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
))}
|
|
169
|
+
</div>
|
|
170
|
+
),
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const TwoSegments: Story = {
|
|
174
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
175
|
+
<div className="w-72">
|
|
176
|
+
<ProgressStack
|
|
177
|
+
segments={twoSegments}
|
|
178
|
+
aria-label="Disk usage"
|
|
179
|
+
showLegend
|
|
180
|
+
showValues
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
),
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const CustomColors: Story = {
|
|
187
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
188
|
+
<div className="w-80">
|
|
189
|
+
<ProgressStack
|
|
190
|
+
segments={customColors}
|
|
191
|
+
aria-label="Quarterly revenue split"
|
|
192
|
+
showLegend
|
|
193
|
+
showValues
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
),
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const PartialFill: Story = {
|
|
200
|
+
name: "Partial fill (max prop)",
|
|
201
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
202
|
+
<div className="w-80 flex flex-col gap-2">
|
|
203
|
+
<p className="text-xs text-muted-foreground">
|
|
204
|
+
70 GB used of 128 GB — segments fill only the used portion
|
|
205
|
+
</p>
|
|
206
|
+
<ProgressStack
|
|
207
|
+
segments={[
|
|
208
|
+
{ value: 38, label: "Documents" },
|
|
209
|
+
{ value: 22, label: "Media" },
|
|
210
|
+
{ value: 10, label: "System" },
|
|
211
|
+
]}
|
|
212
|
+
max={128}
|
|
213
|
+
aria-label="Storage: 70 of 128 GB used"
|
|
214
|
+
showLegend
|
|
215
|
+
formatValue={(v) => `${v} GB`}
|
|
216
|
+
/>
|
|
217
|
+
</div>
|
|
218
|
+
),
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const CustomFormat: Story = {
|
|
222
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
223
|
+
<div className="w-80">
|
|
224
|
+
<ProgressStack
|
|
225
|
+
segments={[
|
|
226
|
+
{ value: 42_000, label: "Engineering" },
|
|
227
|
+
{ value: 28_000, label: "Design" },
|
|
228
|
+
{ value: 18_000, label: "Marketing" },
|
|
229
|
+
{ value: 12_000, label: "Operations" },
|
|
230
|
+
]}
|
|
231
|
+
aria-label="Annual budget allocation"
|
|
232
|
+
showLegend
|
|
233
|
+
showValues
|
|
234
|
+
formatValue={(v) =>
|
|
235
|
+
`$${(v / 1000).toFixed(0)}k`
|
|
236
|
+
}
|
|
237
|
+
/>
|
|
238
|
+
</div>
|
|
239
|
+
),
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const RealisticUse: Story = {
|
|
243
|
+
parameters: { controls: { disable: true } }, render: () => (
|
|
244
|
+
<div className="w-[480px] rounded-lg border bg-card p-6 flex flex-col gap-6">
|
|
245
|
+
<div>
|
|
246
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
247
|
+
Repository storage
|
|
248
|
+
</p>
|
|
249
|
+
<ProgressStack
|
|
250
|
+
segments={storageSegments}
|
|
251
|
+
aria-label="Repository storage breakdown"
|
|
252
|
+
showLegend
|
|
253
|
+
showValues
|
|
254
|
+
size="default"
|
|
255
|
+
formatValue={(v, t) => `${Math.round((v / t) * 100)}%`}
|
|
256
|
+
/>
|
|
257
|
+
</div>
|
|
258
|
+
<div>
|
|
259
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
260
|
+
Q3 budget utilization
|
|
261
|
+
</p>
|
|
262
|
+
<ProgressStack
|
|
263
|
+
segments={budgetSegments}
|
|
264
|
+
aria-label="Q3 budget by department"
|
|
265
|
+
showLegend
|
|
266
|
+
showValues
|
|
267
|
+
size="default"
|
|
268
|
+
formatValue={(v) => `$${v}k`}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
<div>
|
|
272
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
273
|
+
Token coverage (partially filled)
|
|
274
|
+
</p>
|
|
275
|
+
<ProgressStack
|
|
276
|
+
segments={skillSegments}
|
|
277
|
+
max={100}
|
|
278
|
+
aria-label="Token documentation coverage"
|
|
279
|
+
showLegend
|
|
280
|
+
showValues
|
|
281
|
+
size="sm"
|
|
282
|
+
formatValue={(v) => `${v}%`}
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
),
|
|
287
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// the portal. See components/Sheet.stories.tsx → WithPortalTheme for the\
|
|
5
5
|
// canonical demonstration. Mechanism is identical here; no separate\
|
|
6
6
|
// story added because the demo would duplicate Sheet's.
|
|
7
|
+
import * as React from "react";
|
|
7
8
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
9
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@behavioral-agentic-design-system/core/components/ui/select";
|
|
9
10
|
|
|
@@ -132,3 +133,27 @@ export const RealisticUse: Story = {
|
|
|
132
133
|
</SelectContent>
|
|
133
134
|
</Select>),
|
|
134
135
|
};
|
|
136
|
+
|
|
137
|
+
export const Clearable: Story = {
|
|
138
|
+
// Controlled story uses React.useState — args panel can't drive it.
|
|
139
|
+
parameters: { controls: { disable: true } },
|
|
140
|
+
render: () => {
|
|
141
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
142
|
+
const [value, setValue] = React.useState("apple");
|
|
143
|
+
return (
|
|
144
|
+
<Select value={value} onValueChange={setValue} clearable>
|
|
145
|
+
<SelectTrigger className="w-[220px]" aria-label="Pick a fruit — clearable">
|
|
146
|
+
<SelectValue placeholder="Pick a fruit" />
|
|
147
|
+
</SelectTrigger>
|
|
148
|
+
<SelectContent>
|
|
149
|
+
<SelectGroup>
|
|
150
|
+
<SelectLabel>Fruits</SelectLabel>
|
|
151
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
152
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
153
|
+
<SelectItem value="cherry">Cherry</SelectItem>
|
|
154
|
+
</SelectGroup>
|
|
155
|
+
</SelectContent>
|
|
156
|
+
</Select>
|
|
157
|
+
);
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
3
3
|
|
|
4
|
+
// Separator always renders a <div> (see the recipe-note in separator.tsx) —
|
|
5
|
+
// never nest it inside a <p>; that's invalid HTML and throws React hydration
|
|
6
|
+
// error #418 at runtime even though `next build` reports success.
|
|
4
7
|
const meta: Meta<typeof Separator> = {
|
|
5
8
|
title: "Components/Layout/Separator",
|
|
6
9
|
component: Separator,
|
|
@@ -14,6 +14,15 @@ import { Input } from "@behavioral-agentic-design-system/core/components/ui/inpu
|
|
|
14
14
|
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
15
15
|
import { Textarea } from "@behavioral-agentic-design-system/core/components/ui/textarea";
|
|
16
16
|
import { Avatar, AvatarFallback } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
17
|
+
// A static import, not a require() inside render.
|
|
18
|
+
//
|
|
19
|
+
// This was `const { PortalThemeProvider } = require(...)` with an eslint-disable
|
|
20
|
+
// on it, which works under Node and is simply undefined in a browser bundle:
|
|
21
|
+
// the story threw `require is not defined` on every run. It went unnoticed
|
|
22
|
+
// because the Storybook a11y suite has been failing to start at all, so no
|
|
23
|
+
// story has actually executed in CI for some time — see vitest.config.ts.
|
|
24
|
+
import { PortalThemeProvider } from "@behavioral-agentic-design-system/core/hooks/use-portal-theme-class";
|
|
25
|
+
|
|
17
26
|
|
|
18
27
|
const meta: Meta<typeof Sheet> = {
|
|
19
28
|
title: "Components/Overlays/Sheet",
|
|
@@ -166,9 +175,6 @@ export const Side_Bottom_NoHandle: Story = {
|
|
|
166
175
|
// repository-level theme classes.
|
|
167
176
|
export const WithPortalTheme: Story = {
|
|
168
177
|
render: () => {
|
|
169
|
-
const { PortalThemeProvider } =
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
171
|
-
require("@behavioral-agentic-design-system/core/hooks/use-portal-theme-class");
|
|
172
178
|
return (
|
|
173
179
|
<PortalThemeProvider scope="dark">
|
|
174
180
|
<Sheet>
|
|
@@ -66,6 +66,48 @@ export const WithMarks: Story = {
|
|
|
66
66
|
),
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* `valueLabel="auto"` shows a thumb-anchored value bubble on hover, focus, and
|
|
71
|
+
* drag (Mantine `label`, MUI `valueLabelDisplay="auto"`, Ant `tooltip`). The
|
|
72
|
+
* bubble is `aria-hidden` — the thumb announces the value — and a string from
|
|
73
|
+
* `valueLabelFormat` is mirrored to `aria-valuetext`. Default `never` keeps
|
|
74
|
+
* the slider byte-identical to before.
|
|
75
|
+
*/
|
|
76
|
+
export const WithValueLabel: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
defaultValue: [62],
|
|
79
|
+
min: 0,
|
|
80
|
+
max: 100,
|
|
81
|
+
step: 1,
|
|
82
|
+
"aria-label": "Volume",
|
|
83
|
+
valueLabel: "auto",
|
|
84
|
+
valueLabelFormat: (v: number) => `${v}%`,
|
|
85
|
+
},
|
|
86
|
+
render: (args) => (
|
|
87
|
+
<div className="w-72">
|
|
88
|
+
<Slider {...args} />
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** `valueLabel="always"` keeps the bubble persistent and reserves room above the track for it. */
|
|
94
|
+
export const ValueLabelAlways: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
defaultValue: [120, 375],
|
|
97
|
+
min: 0,
|
|
98
|
+
max: 500,
|
|
99
|
+
step: 5,
|
|
100
|
+
"aria-label": "Retainer range",
|
|
101
|
+
valueLabel: "always",
|
|
102
|
+
valueLabelFormat: (v: number) => `$${v}`,
|
|
103
|
+
},
|
|
104
|
+
render: (args) => (
|
|
105
|
+
<div className="w-72">
|
|
106
|
+
<Slider {...args} />
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
69
111
|
export const RealisticUse: Story = {
|
|
70
112
|
render: () => (
|
|
71
113
|
<div className="w-80 space-y-6">
|
|
@@ -84,11 +126,18 @@ export const RealisticUse: Story = {
|
|
|
84
126
|
<Slider defaultValue={[28]} min={0} max={100} step={1} aria-labelledby="slider-brightness" />
|
|
85
127
|
</div>
|
|
86
128
|
<div className="space-y-3">
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
129
|
+
<label id="slider-retainer" className="text-sm font-medium">
|
|
130
|
+
Monthly retainer range
|
|
131
|
+
</label>
|
|
132
|
+
<Slider
|
|
133
|
+
defaultValue={[120, 375]}
|
|
134
|
+
min={0}
|
|
135
|
+
max={500}
|
|
136
|
+
step={5}
|
|
137
|
+
aria-labelledby="slider-retainer"
|
|
138
|
+
valueLabel="always"
|
|
139
|
+
valueLabelFormat={(v) => `$${v}`}
|
|
140
|
+
/>
|
|
92
141
|
</div>
|
|
93
142
|
</div>
|
|
94
143
|
),
|