@behavioral-agentic-design-system/core 0.24.0 → 0.27.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 +5 -2
- package/scripts/build-tokens.cjs +87 -5
- package/src/app/preview/components/page.tsx +4745 -244
- package/src/app/shell.tsx +18 -6
- package/src/components/customize/brand-mark-section.tsx +1 -1
- package/src/components/customize-tab.tsx +2 -2
- package/src/components/home-tab.tsx +2 -2
- package/src/components/ui/action-bar.tsx +142 -0
- package/src/components/ui/affix.tsx +109 -0
- package/src/components/ui/alert.tsx +37 -3
- package/src/components/ui/anchor.tsx +136 -0
- package/src/components/ui/angle-slider.tsx +265 -0
- package/src/components/ui/autocomplete.tsx +223 -0
- package/src/components/ui/avatar.tsx +8 -2
- package/src/components/ui/blockquote.tsx +112 -0
- package/src/components/ui/bottom-navigation.tsx +144 -0
- package/src/components/ui/burger.tsx +117 -0
- package/src/components/ui/button.tsx +101 -3
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/card.tsx +43 -5
- package/src/components/ui/carousel.tsx +10 -5
- package/src/components/ui/cascader.tsx +253 -0
- package/src/components/ui/checkbox-card.tsx +176 -0
- package/src/components/ui/checkbox-group.tsx +231 -0
- package/src/components/ui/checkbox.tsx +14 -3
- package/src/components/ui/chip.tsx +143 -0
- package/src/components/ui/circular-progress.tsx +2 -2
- package/src/components/ui/color-swatch.tsx +73 -0
- package/src/components/ui/copy-button.tsx +21 -4
- package/src/components/ui/date-picker.tsx +6 -3
- package/src/components/ui/date-range-picker.tsx +6 -3
- package/src/components/ui/float-label.tsx +114 -0
- package/src/components/ui/floating-action-button.tsx +179 -0
- package/src/components/ui/floating-panel.tsx +129 -0
- package/src/components/ui/format-number.tsx +122 -0
- package/src/components/ui/highlight.tsx +85 -0
- package/src/components/ui/image.tsx +195 -0
- package/src/components/ui/index.ts +51 -0
- package/src/components/ui/indicator.tsx +2 -2
- package/src/components/ui/input.tsx +48 -4
- package/src/components/ui/kbd.tsx +1 -1
- package/src/components/ui/link.tsx +158 -0
- package/src/components/ui/listbox.tsx +426 -0
- package/src/components/ui/loading-overlay.tsx +80 -0
- package/src/components/ui/marquee.tsx +193 -0
- package/src/components/ui/masonry.tsx +164 -0
- package/src/components/ui/meter.tsx +186 -0
- package/src/components/ui/motion-toggle.tsx +170 -0
- package/src/components/ui/notification.tsx +175 -0
- package/src/components/ui/overlay.tsx +63 -0
- package/src/components/ui/progress.tsx +95 -4
- package/src/components/ui/rating-group.tsx +1 -0
- package/src/components/ui/separator.tsx +57 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/signature-pad.tsx +381 -0
- package/src/components/ui/skeleton.tsx +59 -2
- package/src/components/ui/skip-link.tsx +117 -0
- package/src/components/ui/slider.tsx +86 -1
- package/src/components/ui/spoiler.tsx +131 -0
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/text.tsx +135 -0
- package/src/components/ui/textarea.tsx +66 -2
- package/src/components/ui/timeline.tsx +71 -14
- package/src/components/ui/timer.tsx +183 -0
- package/src/components/ui/tour.tsx +332 -0
- package/src/components/ui/transfer-list.tsx +343 -0
- package/src/components/ui/typing-indicator.tsx +96 -0
- package/src/components/ui/visually-hidden.tsx +42 -0
- package/src/components/ui/watermark.tsx +0 -0
- package/src/components/ui/word-rotate.tsx +82 -0
- package/src/data/docs-index.ts +10 -2
- package/src/stories/ActionBar.stories.tsx +201 -0
- package/src/stories/Affix.stories.tsx +165 -0
- package/src/stories/Alert.stories.tsx +58 -0
- package/src/stories/Anchor.stories.tsx +236 -0
- package/src/stories/AngleSlider.stories.tsx +128 -0
- package/src/stories/Autocomplete.stories.tsx +216 -0
- package/src/stories/Avatar.stories.tsx +73 -1
- package/src/stories/Blockquote.stories.tsx +148 -0
- package/src/stories/BottomNavigation.stories.tsx +195 -0
- package/src/stories/Burger.stories.tsx +79 -0
- package/src/stories/Button.stories.tsx +103 -2
- package/src/stories/Calendar.stories.tsx +4 -0
- package/src/stories/Card.stories.tsx +30 -0
- package/src/stories/Carousel.stories.tsx +2 -1
- package/src/stories/Cascader.stories.tsx +285 -0
- package/src/stories/Checkbox.stories.tsx +13 -0
- package/src/stories/CheckboxCard.stories.tsx +210 -0
- package/src/stories/CheckboxGroup.stories.tsx +186 -0
- package/src/stories/Chip.stories.tsx +173 -0
- package/src/stories/CircularProgress.stories.tsx +3 -0
- package/src/stories/ColorSwatch.stories.tsx +81 -0
- package/src/stories/CopyButton.stories.tsx +3 -3
- package/src/stories/DatePicker.stories.tsx +3 -0
- package/src/stories/DateRangePicker.stories.tsx +3 -0
- package/src/stories/Editable.stories.tsx +14 -0
- package/src/stories/FloatLabel.stories.tsx +148 -0
- package/src/stories/FloatingActionButton.stories.tsx +215 -0
- package/src/stories/FloatingPanel.stories.tsx +176 -0
- package/src/stories/FormatNumber.stories.tsx +308 -0
- package/src/stories/Highlight.stories.tsx +140 -0
- package/src/stories/Image.stories.tsx +141 -0
- package/src/stories/Indicator.stories.tsx +3 -0
- package/src/stories/Input.stories.tsx +33 -0
- package/src/stories/Kbd.stories.tsx +3 -0
- package/src/stories/Link.stories.tsx +198 -0
- package/src/stories/Listbox.stories.tsx +240 -0
- package/src/stories/LoadingOverlay.stories.tsx +148 -0
- package/src/stories/Marquee.stories.tsx +170 -0
- package/src/stories/Masonry.stories.tsx +227 -0
- package/src/stories/Meter.stories.tsx +150 -0
- package/src/stories/MotionToggle.stories.tsx +85 -0
- package/src/stories/Notification.stories.tsx +264 -0
- package/src/stories/Overlay.stories.tsx +169 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/Progress.stories.tsx +70 -27
- package/src/stories/RatingGroup.stories.tsx +5 -0
- package/src/stories/Separator.stories.tsx +41 -5
- package/src/stories/Sidebar.stories.tsx +2 -1
- package/src/stories/SignaturePad.stories.tsx +112 -0
- package/src/stories/Skeleton.stories.tsx +23 -4
- package/src/stories/SkipLink.stories.tsx +137 -0
- package/src/stories/Slider.stories.tsx +28 -0
- package/src/stories/Spoiler.stories.tsx +122 -0
- package/src/stories/Tabs.stories.tsx +2 -1
- package/src/stories/Text.stories.tsx +191 -0
- package/src/stories/Textarea.stories.tsx +58 -6
- package/src/stories/Timeline.stories.tsx +82 -0
- package/src/stories/Timer.stories.tsx +160 -0
- package/src/stories/Tour.stories.tsx +191 -0
- package/src/stories/TransferList.stories.tsx +190 -0
- package/src/stories/TypingIndicator.stories.tsx +139 -0
- package/src/stories/VisuallyHidden.stories.tsx +105 -0
- package/src/stories/Watermark.stories.tsx +212 -0
- package/src/stories/WordRotate.stories.tsx +101 -0
- package/src/styles.css +88 -6
- package/src/tokens.json +3 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { userEvent, within, expect, waitFor } from "storybook/test";
|
|
4
|
+
import { MotionToggle } from "@behavioral-agentic-design-system/core/components/ui/motion-toggle";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof MotionToggle> = {
|
|
7
|
+
title: "Components/MotionToggle",
|
|
8
|
+
component: MotionToggle,
|
|
9
|
+
parameters: { layout: "centered" },
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: "select", options: ["sm", "default", "lg"] },
|
|
13
|
+
showHint: { control: "boolean" },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof MotionToggle>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: { storageSuffix: "motion-sb-default" },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const WithHint: Story = {
|
|
25
|
+
args: { showHint: true, storageSuffix: "motion-sb-hint" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Size_Sm: Story = {
|
|
29
|
+
args: { size: "sm", storageSuffix: "motion-sb-sm" },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Size_Default: Story = {
|
|
33
|
+
args: { size: "default", storageSuffix: "motion-sb-default2" },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Size_Lg: Story = {
|
|
37
|
+
args: { size: "lg", storageSuffix: "motion-sb-lg" },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Realistic use: an Appearance settings row pairing the label + control + hint,
|
|
41
|
+
// the shape a fork drops into its own settings surface.
|
|
42
|
+
export const RealisticUse: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div className="flex w-96 flex-col gap-4 rounded-lg border bg-card p-6">
|
|
45
|
+
<div className="flex flex-col gap-1">
|
|
46
|
+
<h3 className="text-sm font-medium text-foreground">Motion</h3>
|
|
47
|
+
<p className="text-xs text-muted-foreground">
|
|
48
|
+
Control animations across the app. Reduced turns them off here even if
|
|
49
|
+
your device allows motion.
|
|
50
|
+
</p>
|
|
51
|
+
</div>
|
|
52
|
+
<MotionToggle showHint storageSuffix="motion-sb-settings" />
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Verifies the data-motion contract end to end: selecting Reduced sets
|
|
58
|
+
// html[data-motion="reduce"], selecting Full sets "full", and returning to
|
|
59
|
+
// System REMOVES the attribute so the OS media query is the sole authority.
|
|
60
|
+
export const Interaction_SetsDataMotion: Story = {
|
|
61
|
+
tags: ["test"],
|
|
62
|
+
args: { storageSuffix: "motion-sb-interaction" },
|
|
63
|
+
play: async ({ canvasElement }) => {
|
|
64
|
+
const canvas = within(canvasElement);
|
|
65
|
+
const root = document.documentElement;
|
|
66
|
+
// Clean slate — other stories may have left an attribute behind.
|
|
67
|
+
root.removeAttribute("data-motion");
|
|
68
|
+
|
|
69
|
+
const reduced = canvas.getByRole("radio", { name: /reduced/i });
|
|
70
|
+
const full = canvas.getByRole("radio", { name: /full/i });
|
|
71
|
+
const system = canvas.getByRole("radio", { name: /system/i });
|
|
72
|
+
|
|
73
|
+
await userEvent.click(reduced);
|
|
74
|
+
await waitFor(() => expect(root).toHaveAttribute("data-motion", "reduce"));
|
|
75
|
+
expect(reduced).toHaveAttribute("aria-checked", "true");
|
|
76
|
+
|
|
77
|
+
await userEvent.click(full);
|
|
78
|
+
await waitFor(() => expect(root).toHaveAttribute("data-motion", "full"));
|
|
79
|
+
|
|
80
|
+
await userEvent.click(system);
|
|
81
|
+
// System clears the attribute entirely (not data-motion="system").
|
|
82
|
+
await waitFor(() => expect(root).not.toHaveAttribute("data-motion"));
|
|
83
|
+
expect(system).toHaveAttribute("aria-checked", "true");
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// Stories cover all Notification variants, states, and compositions.
|
|
2
|
+
// 2026-07-23: added axe target-size rule to Dismissible story (SC 2.5.8 audit
|
|
3
|
+
// per Thursday accessibility research — dismiss button is size-6 offset-exception).
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
|
+
import {
|
|
7
|
+
Bell,
|
|
8
|
+
CheckCircle2,
|
|
9
|
+
GitPullRequest,
|
|
10
|
+
MessageSquare,
|
|
11
|
+
TriangleAlert,
|
|
12
|
+
} from "lucide-react";
|
|
13
|
+
import { Notification } from "@behavioral-agentic-design-system/core/components/ui/notification";
|
|
14
|
+
import {
|
|
15
|
+
Avatar,
|
|
16
|
+
AvatarFallback,
|
|
17
|
+
} from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof Notification> = {
|
|
20
|
+
title: "Components/Notification",
|
|
21
|
+
component: Notification,
|
|
22
|
+
parameters: { layout: "centered" },
|
|
23
|
+
tags: ["autodocs"],
|
|
24
|
+
decorators: [
|
|
25
|
+
(Story) => (
|
|
26
|
+
<div className="w-96">
|
|
27
|
+
<Story />
|
|
28
|
+
</div>
|
|
29
|
+
),
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<Notification
|
|
39
|
+
title="Chromatic baseline updated"
|
|
40
|
+
description="4 visual changes are ready to review on the tokens-v2-proposal branch."
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Unread: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<Notification
|
|
48
|
+
unread
|
|
49
|
+
title="Jordan Reeves mentioned you"
|
|
50
|
+
description="“Can you confirm the 7:1 pair on the new success accent before I merge?”"
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithTimestamp: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<Notification
|
|
58
|
+
title="Story coverage report ready"
|
|
59
|
+
description="Coverage is at 98.4% after last night's build pass."
|
|
60
|
+
timestamp="2 min ago"
|
|
61
|
+
/>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const WithIcon: Story = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<Notification
|
|
68
|
+
icon={<GitPullRequest strokeWidth={1.5} />}
|
|
69
|
+
title="PR #482 opened"
|
|
70
|
+
description="feat(notification): add Notification primitive [Night Shift]"
|
|
71
|
+
timestamp="Just now"
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Loading: Story = {
|
|
77
|
+
render: () => (
|
|
78
|
+
<Notification
|
|
79
|
+
loading
|
|
80
|
+
title="Publishing tokens v2"
|
|
81
|
+
description="Running pnpm build:tokens and pushing to the registry."
|
|
82
|
+
/>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Variant_Destructive: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<Notification
|
|
89
|
+
variant="destructive"
|
|
90
|
+
icon={<TriangleAlert strokeWidth={1.5} />}
|
|
91
|
+
title="CI gate failed"
|
|
92
|
+
description="lint:microanimation found a duration-200 literal in sheet.tsx."
|
|
93
|
+
timestamp="8 min ago"
|
|
94
|
+
/>
|
|
95
|
+
),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Variant_Success: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<Notification
|
|
101
|
+
variant="success"
|
|
102
|
+
icon={<CheckCircle2 strokeWidth={1.5} />}
|
|
103
|
+
title="WCAG audit passed"
|
|
104
|
+
description="All 41 token pairs meet the AAA 7:1 floor."
|
|
105
|
+
timestamp="1 hr ago"
|
|
106
|
+
/>
|
|
107
|
+
),
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const Variant_Warning: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<Notification
|
|
113
|
+
variant="warning"
|
|
114
|
+
icon={<TriangleAlert strokeWidth={1.5} />}
|
|
115
|
+
title="Token drift detected"
|
|
116
|
+
description="3 hardcoded hex values found in components/examples/cards."
|
|
117
|
+
timestamp="Yesterday"
|
|
118
|
+
/>
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function DismissibleDemo() {
|
|
123
|
+
const [visible, setVisible] = React.useState(true);
|
|
124
|
+
if (!visible) {
|
|
125
|
+
return (
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
className="text-sm font-medium text-primary underline underline-offset-4 min-h-11"
|
|
129
|
+
onClick={() => setVisible(true)}
|
|
130
|
+
>
|
|
131
|
+
Restore notification
|
|
132
|
+
</button>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return (
|
|
136
|
+
<Notification
|
|
137
|
+
unread
|
|
138
|
+
icon={<Bell strokeWidth={1.5} />}
|
|
139
|
+
title="Weekly digest ready"
|
|
140
|
+
description="12 registry changes and 2 new corrections this week."
|
|
141
|
+
timestamp="Mon 09:00"
|
|
142
|
+
onDismiss={() => setVisible(false)}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const Dismissible: Story = {
|
|
148
|
+
render: () => <DismissibleDemo />,
|
|
149
|
+
parameters: {
|
|
150
|
+
a11y: {
|
|
151
|
+
config: {
|
|
152
|
+
rules: [
|
|
153
|
+
{
|
|
154
|
+
// SC 2.5.8 AA: dismiss button is size-6 (24×24px) — satisfies via
|
|
155
|
+
// the offset exception (ml-auto + self-start provides ≥24px clearance
|
|
156
|
+
// from every adjacent interactive element). Enable target-size rule
|
|
157
|
+
// to surface any regressions if layout changes narrow that offset.
|
|
158
|
+
id: "target-size",
|
|
159
|
+
enabled: true,
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const NoTitle: Story = {
|
|
168
|
+
render: () => (
|
|
169
|
+
<Notification
|
|
170
|
+
description="Seo-yun Park accepted your invite to the design-tokens workspace."
|
|
171
|
+
timestamp="3 hrs ago"
|
|
172
|
+
/>
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
type FeedItem = {
|
|
177
|
+
id: string;
|
|
178
|
+
variant?: "default" | "destructive" | "success" | "warning";
|
|
179
|
+
unread?: boolean;
|
|
180
|
+
icon: React.ReactNode;
|
|
181
|
+
title: string;
|
|
182
|
+
description: string;
|
|
183
|
+
timestamp: string;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const FEED_ITEMS: FeedItem[] = [
|
|
187
|
+
{
|
|
188
|
+
id: "comment",
|
|
189
|
+
unread: true,
|
|
190
|
+
icon: (
|
|
191
|
+
<Avatar className="size-6">
|
|
192
|
+
<AvatarFallback className="text-xs">JR</AvatarFallback>
|
|
193
|
+
</Avatar>
|
|
194
|
+
),
|
|
195
|
+
title: "Jordan Reeves commented on Chip",
|
|
196
|
+
description:
|
|
197
|
+
"“The selected fill should use the AAA-verified primary pair, not secondary.”",
|
|
198
|
+
timestamp: "2 min ago",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: "ci",
|
|
202
|
+
variant: "destructive",
|
|
203
|
+
unread: true,
|
|
204
|
+
icon: <TriangleAlert strokeWidth={1.5} />,
|
|
205
|
+
title: "CI gate failed: lint:microanimation",
|
|
206
|
+
description:
|
|
207
|
+
"notification.tsx must not use duration-fast — use var(--duration-fast).",
|
|
208
|
+
timestamp: "14 min ago",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: "chromatic",
|
|
212
|
+
variant: "success",
|
|
213
|
+
icon: <CheckCircle2 strokeWidth={1.5} />,
|
|
214
|
+
title: "Chromatic baseline updated",
|
|
215
|
+
description:
|
|
216
|
+
"4 changes to review across Button, Tabs, and the Foundations stories.",
|
|
217
|
+
timestamp: "1 hr ago",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "mention",
|
|
221
|
+
icon: <MessageSquare strokeWidth={1.5} />,
|
|
222
|
+
title: "Anika Patel replied in #bads",
|
|
223
|
+
description:
|
|
224
|
+
"“Morning brief looks good — shipping the orphan-lint sweep today.”",
|
|
225
|
+
timestamp: "Yesterday",
|
|
226
|
+
},
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
function RealisticUseDemo() {
|
|
230
|
+
const [items, setItems] = React.useState(FEED_ITEMS);
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<div
|
|
234
|
+
role="feed"
|
|
235
|
+
aria-label="Notifications"
|
|
236
|
+
className="flex w-full flex-col gap-2"
|
|
237
|
+
>
|
|
238
|
+
{items.map((item) => (
|
|
239
|
+
<Notification
|
|
240
|
+
key={item.id}
|
|
241
|
+
role="article"
|
|
242
|
+
variant={item.variant}
|
|
243
|
+
unread={item.unread}
|
|
244
|
+
icon={item.icon}
|
|
245
|
+
title={item.title}
|
|
246
|
+
description={item.description}
|
|
247
|
+
timestamp={item.timestamp}
|
|
248
|
+
onDismiss={() =>
|
|
249
|
+
setItems((prev) => prev.filter((i) => i.id !== item.id))
|
|
250
|
+
}
|
|
251
|
+
/>
|
|
252
|
+
))}
|
|
253
|
+
{items.length === 0 && (
|
|
254
|
+
<p className="py-6 text-center text-sm text-muted-foreground">
|
|
255
|
+
You’re all caught up.
|
|
256
|
+
</p>
|
|
257
|
+
)}
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export const RealisticUse: Story = {
|
|
263
|
+
render: () => <RealisticUseDemo />,
|
|
264
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Overlay } from "@behavioral-agentic-design-system/core/components/ui/overlay";
|
|
4
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
5
|
+
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
6
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardDescription,
|
|
11
|
+
CardHeader,
|
|
12
|
+
CardTitle,
|
|
13
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Overlay> = {
|
|
16
|
+
title: "Components/Overlay",
|
|
17
|
+
component: Overlay,
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "centered",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component:
|
|
23
|
+
"Thin translucent layer covering its nearest position:relative ancestor (or the viewport with fixed) — the raw backdrop primitive LoadingOverlay builds on. Purely decorative (aria-hidden, never focusable); it blocks pointer input by sitting on top, so the reason a region is frozen must ship in a visible, announced element beside it. Fade rides transition-opacity on the motion tokens.",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
// Real content from content/personas/bads.json (primary persona pool).
|
|
34
|
+
function ShareCardBody() {
|
|
35
|
+
return (
|
|
36
|
+
<div className="w-80 space-y-2 rounded-lg border border-border p-4">
|
|
37
|
+
<p className="text-sm font-medium text-foreground">tokens-v2-proposal</p>
|
|
38
|
+
<p className="text-sm text-muted-foreground">
|
|
39
|
+
Jordan Reeves shared 36 components for review at
|
|
40
|
+
design.bads.com/share/tokens-v2-proposal.
|
|
41
|
+
</p>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
// The consumer wraps the frozen container in `relative`;
|
|
49
|
+
// the overlay covers that nearest positioned ancestor.
|
|
50
|
+
<div className="relative">
|
|
51
|
+
<ShareCardBody />
|
|
52
|
+
<Overlay radius="rounded-lg" />
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithBlur: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<div className="relative">
|
|
60
|
+
<ShareCardBody />
|
|
61
|
+
<Overlay blur radius="rounded-lg" />
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function FixedDemo() {
|
|
67
|
+
const [shown, setShown] = React.useState(false);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
if (!shown) return;
|
|
70
|
+
const t = setTimeout(() => setShown(false), 3000);
|
|
71
|
+
return () => clearTimeout(t);
|
|
72
|
+
}, [shown]);
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex flex-col items-start gap-4">
|
|
75
|
+
<Button size="xl" variant="outline" onClick={() => setShown(true)}>
|
|
76
|
+
{shown ? "Covering the viewport…" : "Show fixed overlay (3s)"}
|
|
77
|
+
</Button>
|
|
78
|
+
<ShareCardBody />
|
|
79
|
+
{shown && <Overlay fixed blur zIndex={40} />}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Fixed: Story = {
|
|
85
|
+
parameters: { layout: "fullscreen" },
|
|
86
|
+
render: () => (
|
|
87
|
+
<div className="p-8">
|
|
88
|
+
<p className="mb-4 text-sm text-muted-foreground">
|
|
89
|
+
<code>fixed</code> switches to viewport coverage (position: fixed) for
|
|
90
|
+
full-screen use. It does not lock body scroll — that is dialog-layer
|
|
91
|
+
behavior, not the paint layer’s job.
|
|
92
|
+
</p>
|
|
93
|
+
<FixedDemo />
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Custom: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<div className="relative">
|
|
101
|
+
<ShareCardBody />
|
|
102
|
+
<Overlay color="bg-primary/10" radius="rounded-lg" />
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function RealisticUseDemo() {
|
|
108
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
if (!submitting) return;
|
|
111
|
+
const t = setTimeout(() => setSubmitting(false), 2400);
|
|
112
|
+
return () => clearTimeout(t);
|
|
113
|
+
}, [submitting]);
|
|
114
|
+
return (
|
|
115
|
+
<Card className="w-96">
|
|
116
|
+
<CardHeader>
|
|
117
|
+
<CardTitle className="text-2xl">Billing contact</CardTitle>
|
|
118
|
+
<CardDescription>
|
|
119
|
+
design.bads.com · Jordan Reeves’ workspace
|
|
120
|
+
</CardDescription>
|
|
121
|
+
</CardHeader>
|
|
122
|
+
<CardContent>
|
|
123
|
+
{/* The overlay freezes the fieldset visually; the disabled inputs and
|
|
124
|
+
the role="status" line carry the state to assistive tech — the
|
|
125
|
+
overlay itself is aria-hidden and announces nothing. */}
|
|
126
|
+
<div className="relative">
|
|
127
|
+
<form
|
|
128
|
+
className="flex flex-col gap-5"
|
|
129
|
+
onSubmit={(e) => {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
setSubmitting(true);
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<div className="flex flex-col gap-3">
|
|
135
|
+
<Label htmlFor="overlay-billing-name">Full name</Label>
|
|
136
|
+
<Input
|
|
137
|
+
id="overlay-billing-name"
|
|
138
|
+
autoComplete="name"
|
|
139
|
+
defaultValue="Jordan Reeves"
|
|
140
|
+
disabled={submitting}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
<div className="flex flex-col gap-3">
|
|
144
|
+
<Label htmlFor="overlay-billing-email">Billing email</Label>
|
|
145
|
+
<Input
|
|
146
|
+
id="overlay-billing-email"
|
|
147
|
+
type="email"
|
|
148
|
+
autoComplete="email"
|
|
149
|
+
defaultValue="jordan@reeves.design"
|
|
150
|
+
disabled={submitting}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
<Button size="xl" type="submit" disabled={submitting}>
|
|
154
|
+
{submitting ? "Saving…" : "Save billing contact"}
|
|
155
|
+
</Button>
|
|
156
|
+
</form>
|
|
157
|
+
{submitting && <Overlay radius="rounded-lg" />}
|
|
158
|
+
</div>
|
|
159
|
+
<p role="status" aria-live="polite" className="mt-3 text-sm text-muted-foreground">
|
|
160
|
+
{submitting ? "Saving your billing contact…" : " "}
|
|
161
|
+
</p>
|
|
162
|
+
</CardContent>
|
|
163
|
+
</Card>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const RealisticUse: Story = {
|
|
168
|
+
render: () => <RealisticUseDemo />,
|
|
169
|
+
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
// Motion: fill narrowed transition-all → transition-transform (the fill only translates; explicit-properties rule).
|
|
1
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Progress } from "@behavioral-agentic-design-system/core/components/ui/progress";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
* Progress is a non-CVA primitive —
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* → Known AAA
|
|
6
|
+
* Progress is a non-CVA primitive — `Default` + `RealisticUse` per the
|
|
7
|
+
* storybook rule, plus one story per new prop surface (label / showValue).
|
|
8
|
+
* Track surface uses `bg-primary/30 dark:bg-primary/60`, an asymmetric alpha
|
|
9
|
+
* that lands at typical-progress-track contrast in light mode and AAA-passing
|
|
10
|
+
* 6.79:1 in dark mode (documented exception in CLAUDE.md → Known AAA
|
|
11
|
+
* exceptions).
|
|
12
|
+
*
|
|
13
|
+
* The `label` prop becomes the accessible name (generated-id aria-labelledby)
|
|
14
|
+
* and `showValue` renders the exact string Radix announces via aria-valuetext
|
|
15
|
+
* (`getValueLabel`), so the visible and announced values cannot diverge.
|
|
10
16
|
*/
|
|
11
17
|
const meta: Meta<typeof Progress> = {
|
|
12
18
|
title: "Components/Progress",
|
|
@@ -17,6 +23,7 @@ const meta: Meta<typeof Progress> = {
|
|
|
17
23
|
tags: ["autodocs"],
|
|
18
24
|
argTypes: {
|
|
19
25
|
value: { control: { type: "range", min: 0, max: 100, step: 1 } },
|
|
26
|
+
showValue: { control: "boolean" },
|
|
20
27
|
},
|
|
21
28
|
};
|
|
22
29
|
|
|
@@ -35,30 +42,66 @@ export const Default: Story = {
|
|
|
35
42
|
),
|
|
36
43
|
};
|
|
37
44
|
|
|
45
|
+
export const WithLabel: Story = {
|
|
46
|
+
args: { value: 62, label: "Token migration" },
|
|
47
|
+
render: (args) => (
|
|
48
|
+
<div className="w-72">
|
|
49
|
+
<Progress {...args} />
|
|
50
|
+
</div>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const WithValue: Story = {
|
|
55
|
+
args: { value: 72, showValue: true, "aria-label": "Storybook coverage" },
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<div className="w-72">
|
|
58
|
+
<Progress {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const WithLabelAndValue: Story = {
|
|
64
|
+
args: { value: 100, label: "AAA contrast audit", showValue: true },
|
|
65
|
+
render: (args) => (
|
|
66
|
+
<div className="w-72">
|
|
67
|
+
<Progress {...args} />
|
|
68
|
+
</div>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Custom value formatting rides the (passthrough) Radix `getValueLabel` prop:
|
|
74
|
+
* the same function drives the visible text AND aria-valuetext, so "14 of 36
|
|
75
|
+
* components" is what sighted users see and what screen readers announce.
|
|
76
|
+
* The fill is max-aware on the labeled path (14 of 36 ≈ 39% filled).
|
|
77
|
+
*/
|
|
78
|
+
export const CustomValueFormat: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<div className="w-72">
|
|
81
|
+
<Progress
|
|
82
|
+
value={14}
|
|
83
|
+
max={36}
|
|
84
|
+
label="Components migrated"
|
|
85
|
+
showValue
|
|
86
|
+
getValueLabel={(value, max) => `${value} of ${max} components`}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
91
|
+
|
|
38
92
|
export const RealisticUse: Story = {
|
|
39
93
|
render: () => (
|
|
40
94
|
<div className="w-72 space-y-6">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<span className="text-muted-foreground tabular-nums">72%</span>
|
|
52
|
-
</div>
|
|
53
|
-
<Progress value={72} aria-labelledby="progress-processing" />
|
|
54
|
-
</div>
|
|
55
|
-
<div className="space-y-2">
|
|
56
|
-
<div className="flex justify-between text-sm">
|
|
57
|
-
<span id="progress-done" className="text-foreground">Done</span>
|
|
58
|
-
<span className="text-muted-foreground tabular-nums">100%</span>
|
|
59
|
-
</div>
|
|
60
|
-
<Progress value={100} aria-labelledby="progress-done" />
|
|
61
|
-
</div>
|
|
95
|
+
<Progress value={28} label="Uploading brand-fonts.woff2" showValue />
|
|
96
|
+
<Progress value={72} label="Processing tokens" showValue />
|
|
97
|
+
<Progress value={100} label="Storybook coverage" showValue />
|
|
98
|
+
<Progress
|
|
99
|
+
value={14}
|
|
100
|
+
max={36}
|
|
101
|
+
label="a11y contracts reviewed"
|
|
102
|
+
showValue
|
|
103
|
+
getValueLabel={(value, max) => `${value} of ${max}`}
|
|
104
|
+
/>
|
|
62
105
|
</div>
|
|
63
106
|
),
|
|
64
|
-
};
|
|
107
|
+
};
|
|
@@ -2,6 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import { RatingGroup } from "@behavioral-agentic-design-system/core/components/ui/rating-group";
|
|
4
4
|
|
|
5
|
+
// Note: the star's hover:scale-110 is a deliberate selection-preview affordance
|
|
6
|
+
// (documented via an allow-slop:BADS-SLOP-3 escape hatch in the component) —
|
|
7
|
+
// the star you're about to pick grows. This is the one place a scale hover is
|
|
8
|
+
// the affordance rather than a decorative pop.
|
|
9
|
+
|
|
5
10
|
const meta: Meta<typeof RatingGroup> = {
|
|
6
11
|
title: "Components/RatingGroup",
|
|
7
12
|
component: RatingGroup,
|