@behavioral-agentic-design-system/core 0.23.0 → 0.26.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 -4
- package/scripts/build-tokens.cjs +79 -5
- package/src/app/preview/components/page.tsx +4760 -213
- 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/data-list.tsx +169 -0
- package/src/components/ui/date-picker.tsx +6 -3
- package/src/components/ui/date-range-picker.tsx +6 -3
- package/src/components/ui/fieldset.tsx +8 -2
- package/src/components/ui/float-label.tsx +114 -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 +52 -0
- package/src/components/ui/indicator.tsx +2 -2
- package/src/components/ui/input-group.tsx +11 -1
- 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/qr-code.tsx +107 -0
- 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 +308 -0
- package/src/components/ui/visually-hidden.tsx +42 -0
- package/src/components/ui/watermark.tsx +0 -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/DataList.stories.tsx +160 -0
- 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/Fieldset.stories.tsx +4 -0
- package/src/stories/FloatLabel.stories.tsx +148 -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/InputGroup.stories.tsx +39 -41
- 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 +143 -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/QrCode.stories.tsx +146 -0
- 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 +169 -0
- package/src/stories/VisuallyHidden.stories.tsx +105 -0
- package/src/stories/Watermark.stories.tsx +212 -0
- package/src/styles.css +80 -6
- package/src/tokens.json +2 -2
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import {
|
|
4
|
+
Text,
|
|
5
|
+
Heading,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/text"
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card"
|
|
13
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator"
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Text> = {
|
|
16
|
+
title: "Components/Text",
|
|
17
|
+
component: Text,
|
|
18
|
+
parameters: { layout: "centered" },
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
as: { control: "select", options: ["p", "span", "div"] },
|
|
22
|
+
variant: { control: "select", options: ["body", "body-sm", "caption"] },
|
|
23
|
+
tone: { control: "select", options: ["default", "muted"] },
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
29
|
+
|
|
30
|
+
// Content pulled from content/personas/bads.json (real-content rule) —
|
|
31
|
+
// onboarding/dashboard copy, persona names, and unit strings are verbatim
|
|
32
|
+
// pool entries.
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div className="max-w-md">
|
|
37
|
+
<Text>
|
|
38
|
+
BADS ships with tokens, components, and accessibility baked in. Fork
|
|
39
|
+
it, rename it, customize the brand colors, and start building.
|
|
40
|
+
</Text>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Variant_Body: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<div className="max-w-md">
|
|
48
|
+
<Text variant="body">
|
|
49
|
+
Add your first component to see it here. Start with the primitives —
|
|
50
|
+
Button, Card, Input — and compose from there.
|
|
51
|
+
</Text>
|
|
52
|
+
</div>
|
|
53
|
+
),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Variant_BodySm: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<div className="max-w-md">
|
|
59
|
+
<Text variant="body-sm">
|
|
60
|
+
36 components, all passing AAA contrast. Last token change was 3 days
|
|
61
|
+
ago. Your Storybook coverage is at 100%.
|
|
62
|
+
</Text>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const Variant_Caption: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="max-w-md">
|
|
70
|
+
<Text variant="caption" tone="muted">
|
|
71
|
+
Updated 2026-05-26 by Jordan Reeves · 7:1 contrast · 44×44px target
|
|
72
|
+
</Text>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Tone_Muted: Story = {
|
|
78
|
+
render: () => (
|
|
79
|
+
<div className="max-w-md space-y-2">
|
|
80
|
+
<Text variant="body-sm">
|
|
81
|
+
Tokens propagate to both CSS files when you run pnpm build:tokens.
|
|
82
|
+
</Text>
|
|
83
|
+
<Text variant="body-sm" tone="muted">
|
|
84
|
+
Changes via the Customize tab are per-user overrides only.
|
|
85
|
+
</Text>
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// One story per Heading size — each maps 1:1 to a tokens.json textStyle
|
|
91
|
+
// (heading-sm/md/lg/xl). The size prop never changes the outline level.
|
|
92
|
+
|
|
93
|
+
export const Size_Sm: Story = {
|
|
94
|
+
render: () => <Heading size="sm">Customize your tokens</Heading>,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const Size_Md: Story = {
|
|
98
|
+
render: () => <Heading size="md">Your design system at a glance</Heading>,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Size_Lg: Story = {
|
|
102
|
+
render: () => <Heading size="lg">Set up your design system in five minutes</Heading>,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const Size_Xl: Story = {
|
|
106
|
+
render: () => <Heading size="xl">Your design system at a glance</Heading>,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The SC 1.3.1 story: three different outline levels, one visual size.
|
|
110
|
+
// `as` is the document structure; `size` is the look. A screen reader walks
|
|
111
|
+
// h2 → h3 → h4 here even though all three render identically.
|
|
112
|
+
export const HeadingLevelsDecoupled: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<div className="max-w-md space-y-3">
|
|
115
|
+
<Heading as="h2" size="sm">
|
|
116
|
+
Design tokens
|
|
117
|
+
</Heading>
|
|
118
|
+
<Heading as="h3" size="sm">
|
|
119
|
+
Semantic layer
|
|
120
|
+
</Heading>
|
|
121
|
+
<Heading as="h4" size="sm">
|
|
122
|
+
CVA variants
|
|
123
|
+
</Heading>
|
|
124
|
+
<Text variant="body-sm" tone="muted">
|
|
125
|
+
Three outline levels, one visual size — the level comes from the page
|
|
126
|
+
structure, never from the look.
|
|
127
|
+
</Text>
|
|
128
|
+
</div>
|
|
129
|
+
),
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Unbroken long strings in a 320px box — exercises the overflow contract
|
|
133
|
+
// (min-w-0 + overflow-wrap:anywhere): the email wraps instead of bleeding.
|
|
134
|
+
export const LongContent: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className="w-[320px] space-y-2">
|
|
137
|
+
<Heading size="sm">Account owner</Heading>
|
|
138
|
+
<Text variant="body-sm">
|
|
139
|
+
Wilhelmina-Constance Featherstonehaugh-Vance,
|
|
140
|
+
wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org
|
|
141
|
+
</Text>
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const RealisticUse: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<div className="w-[560px] space-y-6">
|
|
149
|
+
<div className="space-y-2">
|
|
150
|
+
<Heading as="h1" size="xl">
|
|
151
|
+
Customize your tokens
|
|
152
|
+
</Heading>
|
|
153
|
+
<Text tone="muted">
|
|
154
|
+
Colors, spacing, and typography for every fork of this system.
|
|
155
|
+
</Text>
|
|
156
|
+
</div>
|
|
157
|
+
<Card>
|
|
158
|
+
<CardHeader>
|
|
159
|
+
<CardTitle className="text-lg">Token health</CardTitle>
|
|
160
|
+
</CardHeader>
|
|
161
|
+
<CardContent className="space-y-4">
|
|
162
|
+
<div className="space-y-1">
|
|
163
|
+
<Heading as="h3" size="sm">
|
|
164
|
+
Contrast audit
|
|
165
|
+
</Heading>
|
|
166
|
+
<Text variant="body-sm">
|
|
167
|
+
36 components, all passing AAA contrast. Last token change was 3
|
|
168
|
+
days ago.
|
|
169
|
+
</Text>
|
|
170
|
+
<Text variant="caption" tone="muted">
|
|
171
|
+
Ran 2026-05-26 · floor 7:1 normal text, 3:1 non-text
|
|
172
|
+
</Text>
|
|
173
|
+
</div>
|
|
174
|
+
<Separator />
|
|
175
|
+
<div className="space-y-1">
|
|
176
|
+
<Heading as="h3" size="sm">
|
|
177
|
+
Type floor
|
|
178
|
+
</Heading>
|
|
179
|
+
<Text variant="body-sm">
|
|
180
|
+
Smallest rendered size is 14px minimum — the caption style sits
|
|
181
|
+
exactly on the floor.
|
|
182
|
+
</Text>
|
|
183
|
+
<Text variant="caption" tone="muted">
|
|
184
|
+
Verified by Seo-yun Park · seoyun.park@figma.com
|
|
185
|
+
</Text>
|
|
186
|
+
</div>
|
|
187
|
+
</CardContent>
|
|
188
|
+
</Card>
|
|
189
|
+
</div>
|
|
190
|
+
),
|
|
191
|
+
}
|
|
@@ -13,19 +13,71 @@ export default meta;
|
|
|
13
13
|
type Story = StoryObj<typeof meta>;
|
|
14
14
|
|
|
15
15
|
export const Default: Story = {
|
|
16
|
-
render: () => (
|
|
16
|
+
render: () => (
|
|
17
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
17
18
|
<Label htmlFor="msg">Message</Label>
|
|
18
19
|
<Textarea id="msg" placeholder="Tell us what's on your mind." rows={4} />
|
|
19
|
-
</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export const Disabled: Story = {
|
|
23
25
|
args: { disabled: true, "aria-label": "Message", placeholder: "Tell us what's on your mind." } as any,
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
export const ShowCount: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
31
|
+
<Label htmlFor="msg-count">Bio</Label>
|
|
32
|
+
<Textarea id="msg-count" placeholder="Tell us about yourself." rows={3} showCount />
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ShowCountWithMax: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
40
|
+
<Label htmlFor="msg-max">Bio</Label>
|
|
41
|
+
<Textarea
|
|
42
|
+
id="msg-max"
|
|
43
|
+
placeholder="Tell us about yourself (max 160 chars)."
|
|
44
|
+
rows={3}
|
|
45
|
+
showCount
|
|
46
|
+
maxLength={160}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const ShowCountAtLimit: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
55
|
+
<Label htmlFor="msg-limit">Bio</Label>
|
|
56
|
+
<Textarea
|
|
57
|
+
id="msg-limit"
|
|
58
|
+
defaultValue={"A".repeat(160)}
|
|
59
|
+
rows={3}
|
|
60
|
+
showCount
|
|
61
|
+
maxLength={160}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
26
67
|
export const RealisticUse: Story = {
|
|
27
|
-
render: () => (
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="flex flex-col gap-2 w-[320px]">
|
|
70
|
+
<Label htmlFor="bio">Short bio</Label>
|
|
71
|
+
<Textarea
|
|
72
|
+
id="bio"
|
|
73
|
+
placeholder="Tell the team a little about yourself — what you work on, what you care about."
|
|
74
|
+
rows={4}
|
|
75
|
+
showCount
|
|
76
|
+
maxLength={200}
|
|
77
|
+
/>
|
|
78
|
+
<p className="text-xs text-muted-foreground">
|
|
79
|
+
Shown on your public profile.
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
),
|
|
31
83
|
};
|
|
@@ -214,6 +214,88 @@ export const ActivityFeed: Story = {
|
|
|
214
214
|
),
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
+
// Alternate orientation: centered spine, items alternate sides at md+.
|
|
218
|
+
// Below md this falls back to the standard left-aligned vertical layout.
|
|
219
|
+
export const Variant_Alternate: Story = {
|
|
220
|
+
render: () => (
|
|
221
|
+
<div className="w-[640px] max-w-full">
|
|
222
|
+
<Timeline orientation="alternate">
|
|
223
|
+
<TimelineItem
|
|
224
|
+
status="complete"
|
|
225
|
+
title="Token proposal shared"
|
|
226
|
+
description="tokens-v2 draft sent to Jordan Reeves for review."
|
|
227
|
+
time="May 26, 2026"
|
|
228
|
+
dateTime="2026-05-26"
|
|
229
|
+
/>
|
|
230
|
+
<TimelineItem
|
|
231
|
+
status="complete"
|
|
232
|
+
title="Semantic layer approved"
|
|
233
|
+
description="Seo-yun Park signed off on the 7:1 contrast pairs."
|
|
234
|
+
time="Jun 20, 2026"
|
|
235
|
+
dateTime="2026-06-20"
|
|
236
|
+
/>
|
|
237
|
+
<TimelineItem
|
|
238
|
+
status="active"
|
|
239
|
+
title="Component migration"
|
|
240
|
+
description="14 of 36 components on the new tokens."
|
|
241
|
+
time="Jul 9 (today)"
|
|
242
|
+
dateTime="2026-07-09"
|
|
243
|
+
/>
|
|
244
|
+
<TimelineItem
|
|
245
|
+
status="default"
|
|
246
|
+
title="Visual regression sweep"
|
|
247
|
+
description="Chromatic baseline refresh across every story."
|
|
248
|
+
time="Jul 14 (planned)"
|
|
249
|
+
/>
|
|
250
|
+
<TimelineItem
|
|
251
|
+
status="pending"
|
|
252
|
+
title="tokens-v2 released"
|
|
253
|
+
description="Published to npm with the migration guide."
|
|
254
|
+
time="Jul 21 (estimated)"
|
|
255
|
+
/>
|
|
256
|
+
</Timeline>
|
|
257
|
+
</div>
|
|
258
|
+
),
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// Alternate orientation with custom icons — same icon slot, both sides.
|
|
262
|
+
export const Variant_AlternateWithIcons: Story = {
|
|
263
|
+
render: () => (
|
|
264
|
+
<div className="w-[640px] max-w-full">
|
|
265
|
+
<Timeline orientation="alternate">
|
|
266
|
+
<TimelineItem
|
|
267
|
+
status="complete"
|
|
268
|
+
icon={<UserCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
269
|
+
title="Anika Patel joined as reviewer"
|
|
270
|
+
description="Second maintainer on the a11y contract lane."
|
|
271
|
+
time="Jun 24"
|
|
272
|
+
/>
|
|
273
|
+
<TimelineItem
|
|
274
|
+
status="complete"
|
|
275
|
+
icon={<ClipboardCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
276
|
+
title="Accessibility audit passed"
|
|
277
|
+
description="36 components reviewed, all AAA."
|
|
278
|
+
time="Jul 1"
|
|
279
|
+
/>
|
|
280
|
+
<TimelineItem
|
|
281
|
+
status="active"
|
|
282
|
+
icon={<CalendarIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
283
|
+
title="Design review week"
|
|
284
|
+
description="Tue/Thu 10:00–11:00 AM with Tomás Herrera."
|
|
285
|
+
time="Jul 9 (today)"
|
|
286
|
+
/>
|
|
287
|
+
<TimelineItem
|
|
288
|
+
status="pending"
|
|
289
|
+
icon={<TrophyIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
290
|
+
title="v2.5.0 released"
|
|
291
|
+
description="Published to npm and Storybook."
|
|
292
|
+
time="Jul 21"
|
|
293
|
+
/>
|
|
294
|
+
</Timeline>
|
|
295
|
+
</div>
|
|
296
|
+
),
|
|
297
|
+
};
|
|
298
|
+
|
|
217
299
|
// Realistic use: BADS Design System, v2.4.0 release journey
|
|
218
300
|
export const RealisticUse: Story = {
|
|
219
301
|
render: () => (
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Timer } from "@behavioral-agentic-design-system/core/components/ui/timer";
|
|
4
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
5
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
6
|
+
import {
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof Timer> = {
|
|
14
|
+
title: "Components/Timer",
|
|
15
|
+
component: Timer,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Live countdown or count-up display ticking on a configurable interval. Drift-free (wall-clock anchored), tabular-nums digits, aria-live=off on the ticking value with a single polite role=status announcement at completion. data-state exposes running/paused/completed; paused dims via a token-driven color transition. Ethics contract: only bind to REAL deadlines — invented urgency is a dark pattern.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<div className="flex flex-col items-center gap-2">
|
|
34
|
+
<Timer mode="countdown" startMs={5 * 60 * 1000} className="text-2xl" />
|
|
35
|
+
<p className="text-sm text-muted-foreground">
|
|
36
|
+
Five-minute countdown, default MM:SS format.
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const CountUp: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div className="flex flex-col items-center gap-2">
|
|
45
|
+
<Timer mode="countup" format="HH:MM:SS" className="text-2xl" />
|
|
46
|
+
<p className="text-sm text-muted-foreground">
|
|
47
|
+
Count-up from zero — elapsed-time displays (recording length, session
|
|
48
|
+
duration). Never completes.
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const PausedInitially: Story = {
|
|
55
|
+
render: function PausedInitiallyStory() {
|
|
56
|
+
const [paused, setPaused] = React.useState(true);
|
|
57
|
+
return (
|
|
58
|
+
<div className="flex flex-col items-center gap-3">
|
|
59
|
+
<Timer
|
|
60
|
+
mode="countdown"
|
|
61
|
+
startMs={90 * 1000}
|
|
62
|
+
paused={paused}
|
|
63
|
+
className="text-2xl"
|
|
64
|
+
/>
|
|
65
|
+
<Button
|
|
66
|
+
size="xl"
|
|
67
|
+
variant="outline"
|
|
68
|
+
aria-pressed={!paused}
|
|
69
|
+
onClick={() => setPaused((p) => !p)}
|
|
70
|
+
>
|
|
71
|
+
{paused ? "Start" : "Pause"}
|
|
72
|
+
</Button>
|
|
73
|
+
<p className="text-sm text-muted-foreground">
|
|
74
|
+
The paused prop wins over autoStart; paused dims the digits via a
|
|
75
|
+
token-driven color transition.
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const CustomFormat: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<div className="flex flex-col items-center gap-2">
|
|
85
|
+
<Timer
|
|
86
|
+
mode="countdown"
|
|
87
|
+
startMs={3 * 60 * 1000}
|
|
88
|
+
format={(ms) => {
|
|
89
|
+
const total = Math.max(0, Math.floor(ms / 1000));
|
|
90
|
+
return `${Math.floor(total / 60)} min ${String(total % 60).padStart(2, "0")} s`;
|
|
91
|
+
}}
|
|
92
|
+
className="text-2xl"
|
|
93
|
+
/>
|
|
94
|
+
<p className="text-sm text-muted-foreground">
|
|
95
|
+
format accepts a custom (ms) => string when the presets don't
|
|
96
|
+
fit.
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const FormatMM_SS: Story = {
|
|
103
|
+
render: () => (
|
|
104
|
+
<div className="flex flex-col items-center gap-2">
|
|
105
|
+
<Timer
|
|
106
|
+
mode="countdown"
|
|
107
|
+
startMs={95 * 60 * 1000}
|
|
108
|
+
format="MM:SS"
|
|
109
|
+
className="text-2xl"
|
|
110
|
+
/>
|
|
111
|
+
<p className="text-sm text-muted-foreground">
|
|
112
|
+
MM:SS shows TOTAL minutes (95:00 for a 95-minute window) — switch to
|
|
113
|
+
HH:MM:SS when hours matter.
|
|
114
|
+
</p>
|
|
115
|
+
</div>
|
|
116
|
+
),
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Real content from content/personas/bads.json (primary persona pool).
|
|
120
|
+
export const RealisticUse: Story = {
|
|
121
|
+
render: function RealisticUseStory() {
|
|
122
|
+
const [done, setDone] = React.useState(false);
|
|
123
|
+
return (
|
|
124
|
+
<Card className="w-96">
|
|
125
|
+
<CardHeader>
|
|
126
|
+
<div className="flex items-center justify-between gap-3">
|
|
127
|
+
<CardTitle className="min-w-0 truncate">
|
|
128
|
+
Tokens v2 proposal — live review
|
|
129
|
+
</CardTitle>
|
|
130
|
+
<Badge variant={done ? "destructive" : "secondary"}>
|
|
131
|
+
{done ? "Session ended" : "In session"}
|
|
132
|
+
</Badge>
|
|
133
|
+
</div>
|
|
134
|
+
</CardHeader>
|
|
135
|
+
<CardContent className="space-y-3">
|
|
136
|
+
<p className="text-sm text-muted-foreground">
|
|
137
|
+
Jordan Reeves is walking 36 components through the 7:1 contrast
|
|
138
|
+
floor at design.bads.com/share/tokens-v2-proposal.
|
|
139
|
+
</p>
|
|
140
|
+
<div className="flex items-baseline gap-2">
|
|
141
|
+
<span className="text-sm font-medium text-foreground">
|
|
142
|
+
Time remaining
|
|
143
|
+
</span>
|
|
144
|
+
<Timer
|
|
145
|
+
mode="countdown"
|
|
146
|
+
startMs={25 * 60 * 1000}
|
|
147
|
+
format="MM:SS"
|
|
148
|
+
className="text-2xl"
|
|
149
|
+
completeAnnouncement="Review session ended"
|
|
150
|
+
onComplete={() => setDone(true)}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
<Button size="xl" className="w-full">
|
|
154
|
+
Join the review
|
|
155
|
+
</Button>
|
|
156
|
+
</CardContent>
|
|
157
|
+
</Card>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
};
|