@behavioral-agentic-design-system/core 0.24.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 +5 -2
- package/scripts/build-tokens.cjs +79 -5
- package/src/app/preview/components/page.tsx +4474 -208
- 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-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 +50 -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 +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 +9 -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/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 +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/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,240 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import {
|
|
4
|
+
Listbox,
|
|
5
|
+
ListboxRoot,
|
|
6
|
+
ListboxOption,
|
|
7
|
+
} from "@behavioral-agentic-design-system/core/components/ui/listbox";
|
|
8
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Listbox is a controlled, always-visible listbox widget for single or
|
|
12
|
+
* multi-select. It renders with `role="listbox"` and `role="option"` children,
|
|
13
|
+
* following the ARIA Listbox pattern with `aria-activedescendant` keyboard
|
|
14
|
+
* navigation (focus stays on the container).
|
|
15
|
+
*
|
|
16
|
+
* Keyboard: ArrowDown/Up navigate, Home/End jump, Space/Enter select,
|
|
17
|
+
* Shift+ArrowDown/Up extends selection in multi mode.
|
|
18
|
+
*
|
|
19
|
+
* Use for: filter sidebars, settings panels, locale/language pickers — any
|
|
20
|
+
* surface where the list stays open and selection is immediately visible.
|
|
21
|
+
*
|
|
22
|
+
* **Not** for navigation (use NavigationMenu) or popup selection
|
|
23
|
+
* (use Select, Combobox, DropdownMenu).
|
|
24
|
+
*/
|
|
25
|
+
const meta: Meta<typeof ListboxRoot> = {
|
|
26
|
+
title: "Components/Listbox",
|
|
27
|
+
component: ListboxRoot,
|
|
28
|
+
parameters: {
|
|
29
|
+
layout: "centered",
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component:
|
|
33
|
+
"Controlled always-visible listbox (role=listbox + role=option). Follows the ARIA Listbox authoring-practices pattern: aria-activedescendant cursor, keyboard nav (Up/Down/Home/End/Space/Enter/Shift+Arrow in multi), single or multi-select. Distinct from Select/Combobox/DropdownMenu, which are popup-based.",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
tags: ["autodocs"],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Default — single-select, 5 options, one pre-selected
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
export const Default: Story = {
|
|
48
|
+
render: function DefaultStory() {
|
|
49
|
+
const [value, setValue] = React.useState("active");
|
|
50
|
+
return (
|
|
51
|
+
<div className="w-64">
|
|
52
|
+
<Listbox
|
|
53
|
+
value={value}
|
|
54
|
+
onValueChange={(v) => setValue(v as string)}
|
|
55
|
+
aria-label="Filter by project status"
|
|
56
|
+
>
|
|
57
|
+
<ListboxOption value="active">Active</ListboxOption>
|
|
58
|
+
<ListboxOption value="in-review">In Review</ListboxOption>
|
|
59
|
+
<ListboxOption value="on-hold">On Hold</ListboxOption>
|
|
60
|
+
<ListboxOption value="draft">Draft</ListboxOption>
|
|
61
|
+
<ListboxOption value="archived">Archived</ListboxOption>
|
|
62
|
+
</Listbox>
|
|
63
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
64
|
+
Selected:{" "}
|
|
65
|
+
<span className="font-medium text-foreground">{value}</span>
|
|
66
|
+
</p>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// MultiSelect — multiple=true, multiple pre-selected
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
export const MultiSelect: Story = {
|
|
77
|
+
render: function MultiSelectStory() {
|
|
78
|
+
const [value, setValue] = React.useState<string[]>(["design", "tokens"]);
|
|
79
|
+
return (
|
|
80
|
+
<div className="w-64">
|
|
81
|
+
<ListboxRoot
|
|
82
|
+
multiple
|
|
83
|
+
value={value}
|
|
84
|
+
onValueChange={(v) => setValue(v as string[])}
|
|
85
|
+
aria-label="Filter by discipline"
|
|
86
|
+
>
|
|
87
|
+
<ListboxOption value="design">Design</ListboxOption>
|
|
88
|
+
<ListboxOption value="tokens">Tokens</ListboxOption>
|
|
89
|
+
<ListboxOption value="accessibility">Accessibility</ListboxOption>
|
|
90
|
+
<ListboxOption value="motion">Motion</ListboxOption>
|
|
91
|
+
<ListboxOption value="engineering">Engineering</ListboxOption>
|
|
92
|
+
</ListboxRoot>
|
|
93
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
94
|
+
{value.length > 0
|
|
95
|
+
? `${value.length} selected: ${value.join(", ")}`
|
|
96
|
+
: "None selected"}
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Disabled — whole listbox disabled
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
export const Disabled: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<div className="w-64">
|
|
110
|
+
<Listbox
|
|
111
|
+
value="active"
|
|
112
|
+
disabled
|
|
113
|
+
aria-label="Project status (read-only)"
|
|
114
|
+
>
|
|
115
|
+
<ListboxOption value="active">Active</ListboxOption>
|
|
116
|
+
<ListboxOption value="in-review">In Review</ListboxOption>
|
|
117
|
+
<ListboxOption value="on-hold">On Hold</ListboxOption>
|
|
118
|
+
<ListboxOption value="archived">Archived</ListboxOption>
|
|
119
|
+
</Listbox>
|
|
120
|
+
</div>
|
|
121
|
+
),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// DisabledOption — one option disabled within a live listbox
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
export const DisabledOption: Story = {
|
|
129
|
+
render: function DisabledOptionStory() {
|
|
130
|
+
const [value, setValue] = React.useState("active");
|
|
131
|
+
return (
|
|
132
|
+
<div className="w-64">
|
|
133
|
+
<Listbox
|
|
134
|
+
value={value}
|
|
135
|
+
onValueChange={(v) => setValue(v as string)}
|
|
136
|
+
aria-label="Filter by project status"
|
|
137
|
+
>
|
|
138
|
+
<ListboxOption value="active">Active</ListboxOption>
|
|
139
|
+
<ListboxOption value="in-review">In Review</ListboxOption>
|
|
140
|
+
{/* On Hold is locked — pending policy review */}
|
|
141
|
+
<ListboxOption value="on-hold" disabled>
|
|
142
|
+
On Hold
|
|
143
|
+
</ListboxOption>
|
|
144
|
+
<ListboxOption value="draft">Draft</ListboxOption>
|
|
145
|
+
<ListboxOption value="archived">Archived</ListboxOption>
|
|
146
|
+
</Listbox>
|
|
147
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
148
|
+
Selected:{" "}
|
|
149
|
+
<span className="font-medium text-foreground">{value}</span>
|
|
150
|
+
</p>
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
// LongList — 10+ options with max-h + overflow-y to show scroll
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
export const LongList: Story = {
|
|
161
|
+
render: function LongListStory() {
|
|
162
|
+
const [value, setValue] = React.useState("jordan-reeves");
|
|
163
|
+
const reviewers = [
|
|
164
|
+
{ value: "jordan-reeves", label: "Jordan Reeves" },
|
|
165
|
+
{ value: "seoyun-park", label: "Seo-yun Park" },
|
|
166
|
+
{ value: "marcus-lindqvist", label: "Marcus Lindqvist" },
|
|
167
|
+
{ value: "anika-patel", label: "Anika Patel" },
|
|
168
|
+
{ value: "yemi-adeyemi", label: "Yemi Adeyemi" },
|
|
169
|
+
{ value: "priya-menon", label: "Priya Menon" },
|
|
170
|
+
{ value: "dario-esposito", label: "Dario Esposito" },
|
|
171
|
+
{ value: "fatima-al-rashid", label: "Fatima Al-Rashid" },
|
|
172
|
+
{ value: "noah-bergstrom", label: "Noah Bergström" },
|
|
173
|
+
{ value: "lena-fischer", label: "Lena Fischer" },
|
|
174
|
+
{ value: "kwame-asante", label: "Kwame Asante" },
|
|
175
|
+
{ value: "celia-andrade", label: "Celia Andrade" },
|
|
176
|
+
];
|
|
177
|
+
return (
|
|
178
|
+
<div className="w-64">
|
|
179
|
+
<Listbox
|
|
180
|
+
value={value}
|
|
181
|
+
onValueChange={(v) => setValue(v as string)}
|
|
182
|
+
aria-label="Assign reviewer"
|
|
183
|
+
className="max-h-48 overflow-y-auto"
|
|
184
|
+
>
|
|
185
|
+
{reviewers.map((r) => (
|
|
186
|
+
<ListboxOption key={r.value} value={r.value}>
|
|
187
|
+
{r.label}
|
|
188
|
+
</ListboxOption>
|
|
189
|
+
))}
|
|
190
|
+
</Listbox>
|
|
191
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
192
|
+
Reviewer:{" "}
|
|
193
|
+
<span className="font-medium text-foreground">
|
|
194
|
+
{reviewers.find((r) => r.value === value)?.label ?? "—"}
|
|
195
|
+
</span>
|
|
196
|
+
</p>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
// RealisticUse — filter sidebar panel with label and 4 status options
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
export const RealisticUse: Story = {
|
|
207
|
+
render: function RealisticUseStory() {
|
|
208
|
+
const [value, setValue] = React.useState<string[]>(["active", "in-review"]);
|
|
209
|
+
|
|
210
|
+
const statuses = [
|
|
211
|
+
{ value: "active", label: "Active" },
|
|
212
|
+
{ value: "in-review", label: "In Review" },
|
|
213
|
+
{ value: "on-hold", label: "On Hold" },
|
|
214
|
+
{ value: "archived", label: "Archived" },
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div className="w-64 space-y-1.5">
|
|
219
|
+
<Label className="text-sm font-medium">Filter by status</Label>
|
|
220
|
+
<ListboxRoot
|
|
221
|
+
multiple
|
|
222
|
+
value={value}
|
|
223
|
+
onValueChange={(v) => setValue(v as string[])}
|
|
224
|
+
aria-label="Filter by status"
|
|
225
|
+
>
|
|
226
|
+
{statuses.map((s) => (
|
|
227
|
+
<ListboxOption key={s.value} value={s.value}>
|
|
228
|
+
{s.label}
|
|
229
|
+
</ListboxOption>
|
|
230
|
+
))}
|
|
231
|
+
</ListboxRoot>
|
|
232
|
+
<p className="text-xs text-muted-foreground">
|
|
233
|
+
{value.length > 0
|
|
234
|
+
? `Showing: ${value.map((v) => statuses.find((s) => s.value === v)?.label).join(", ")}`
|
|
235
|
+
: "All statuses shown"}
|
|
236
|
+
</p>
|
|
237
|
+
</div>
|
|
238
|
+
);
|
|
239
|
+
},
|
|
240
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { LoadingOverlay } from "@behavioral-agentic-design-system/core/components/ui/loading-overlay";
|
|
4
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
12
|
+
import {
|
|
13
|
+
DataList,
|
|
14
|
+
DataListItem,
|
|
15
|
+
DataListLabel,
|
|
16
|
+
DataListValue,
|
|
17
|
+
} from "@behavioral-agentic-design-system/core/components/ui/data-list";
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof LoadingOverlay> = {
|
|
20
|
+
title: "Components/LoadingOverlay",
|
|
21
|
+
component: LoadingOverlay,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: "centered",
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component:
|
|
27
|
+
"Full-coverage loading state for a container or the viewport. Wraps children in a positioned container and fades a semi-transparent backdrop with a centered Spinner over them while loading. The overlay owns the role=status polite live-region announcement; the fade uses the motion tokens and collapses under reduced motion via the base layer.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
tags: ["autodocs"],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
// Real content from content/personas/bads.json (primary persona pool).
|
|
38
|
+
function TokenProposalBody() {
|
|
39
|
+
return (
|
|
40
|
+
<div className="w-80 space-y-2 rounded-lg border border-border p-4">
|
|
41
|
+
<p className="text-sm font-medium text-foreground">
|
|
42
|
+
tokens-v2-proposal
|
|
43
|
+
</p>
|
|
44
|
+
<p className="text-sm text-muted-foreground">
|
|
45
|
+
Jordan Reeves shared 36 components for review at
|
|
46
|
+
design.bads.com/share/tokens-v2-proposal.
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<LoadingOverlay loading>
|
|
55
|
+
<TokenProposalBody />
|
|
56
|
+
</LoadingOverlay>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const FullScreen: Story = {
|
|
61
|
+
parameters: { layout: "fullscreen" },
|
|
62
|
+
render: () => (
|
|
63
|
+
<div className="p-8">
|
|
64
|
+
<p className="text-sm text-muted-foreground">
|
|
65
|
+
Fullscreen mode positions the overlay with{" "}
|
|
66
|
+
<code>position: fixed</code>, covering the whole viewport — reserve
|
|
67
|
+
it for page-level transitions.
|
|
68
|
+
</p>
|
|
69
|
+
<LoadingOverlay loading fullscreen>
|
|
70
|
+
<TokenProposalBody />
|
|
71
|
+
</LoadingOverlay>
|
|
72
|
+
</div>
|
|
73
|
+
),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const WithBlur: Story = {
|
|
77
|
+
render: () => (
|
|
78
|
+
<LoadingOverlay loading blur>
|
|
79
|
+
<TokenProposalBody />
|
|
80
|
+
</LoadingOverlay>
|
|
81
|
+
),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function ControlledDemo() {
|
|
85
|
+
const [loading, setLoading] = React.useState(false);
|
|
86
|
+
return (
|
|
87
|
+
<div className="flex flex-col items-start gap-4">
|
|
88
|
+
<Button
|
|
89
|
+
size="xl"
|
|
90
|
+
variant="outline"
|
|
91
|
+
onClick={() => setLoading((l) => !l)}
|
|
92
|
+
>
|
|
93
|
+
{loading ? "Finish loading" : "Start loading"}
|
|
94
|
+
</Button>
|
|
95
|
+
<LoadingOverlay loading={loading}>
|
|
96
|
+
<TokenProposalBody />
|
|
97
|
+
</LoadingOverlay>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const Controlled: Story = {
|
|
103
|
+
render: () => <ControlledDemo />,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
function RealisticUseDemo() {
|
|
107
|
+
const [loading, setLoading] = React.useState(true);
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
const t = setTimeout(() => setLoading(false), 2400);
|
|
110
|
+
return () => clearTimeout(t);
|
|
111
|
+
}, []);
|
|
112
|
+
return (
|
|
113
|
+
<LoadingOverlay loading={loading}>
|
|
114
|
+
<Card className="w-96">
|
|
115
|
+
<CardHeader>
|
|
116
|
+
<CardTitle className="text-2xl">Workspace usage</CardTitle>
|
|
117
|
+
<CardDescription>
|
|
118
|
+
design.bads.com · Jordan Reeves’ workspace
|
|
119
|
+
</CardDescription>
|
|
120
|
+
</CardHeader>
|
|
121
|
+
<CardContent>
|
|
122
|
+
<DataList>
|
|
123
|
+
<DataListItem>
|
|
124
|
+
<DataListLabel>Plan</DataListLabel>
|
|
125
|
+
<DataListValue>$249.00 / yr</DataListValue>
|
|
126
|
+
</DataListItem>
|
|
127
|
+
<DataListItem>
|
|
128
|
+
<DataListLabel>Components</DataListLabel>
|
|
129
|
+
<DataListValue>36 components</DataListValue>
|
|
130
|
+
</DataListItem>
|
|
131
|
+
<DataListItem>
|
|
132
|
+
<DataListLabel>Contrast floor</DataListLabel>
|
|
133
|
+
<DataListValue>7:1 contrast</DataListValue>
|
|
134
|
+
</DataListItem>
|
|
135
|
+
<DataListItem>
|
|
136
|
+
<DataListLabel>Billing contact</DataListLabel>
|
|
137
|
+
<DataListValue>jordan@reeves.design</DataListValue>
|
|
138
|
+
</DataListItem>
|
|
139
|
+
</DataList>
|
|
140
|
+
</CardContent>
|
|
141
|
+
</Card>
|
|
142
|
+
</LoadingOverlay>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const RealisticUse: Story = {
|
|
147
|
+
render: () => <RealisticUseDemo />,
|
|
148
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Marquee,
|
|
5
|
+
MarqueeItem,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/marquee";
|
|
7
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardContent,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof Marquee> = {
|
|
14
|
+
title: "Components/Marquee",
|
|
15
|
+
component: Marquee,
|
|
16
|
+
parameters: { layout: "padded" },
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
argTypes: {
|
|
19
|
+
speed: { control: { type: "number", min: 10, max: 200 } },
|
|
20
|
+
direction: { control: "radio", options: ["left", "right"] },
|
|
21
|
+
fade: { control: "boolean" },
|
|
22
|
+
showControl: { control: "boolean" },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof Marquee>;
|
|
28
|
+
|
|
29
|
+
// Real content from content/personas/bads.json — the primary persona's
|
|
30
|
+
// jargon pool (docs-topic ticker) and testimonials pool (strip of quotes).
|
|
31
|
+
const TOPICS = [
|
|
32
|
+
"design tokens",
|
|
33
|
+
"semantic layer",
|
|
34
|
+
"a11y contract",
|
|
35
|
+
"CVA variants",
|
|
36
|
+
"Radix primitive",
|
|
37
|
+
"anti-pattern",
|
|
38
|
+
"token drift",
|
|
39
|
+
"visual regression",
|
|
40
|
+
"forced colors",
|
|
41
|
+
"focus trap",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const TESTIMONIALS = [
|
|
45
|
+
{
|
|
46
|
+
name: "Jordan Reeves",
|
|
47
|
+
role: "Design Systems Lead",
|
|
48
|
+
quote:
|
|
49
|
+
"First system I've adopted without reading a single apology in the docs. The a11y contracts are actually enforced.",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Seo-yun Park",
|
|
53
|
+
role: "Senior Design Engineer",
|
|
54
|
+
quote:
|
|
55
|
+
"The token pipeline paid for itself in a week. One tokens.json change, both CSS files regenerate, every fork picks it up.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "Marcus Lindqvist",
|
|
59
|
+
role: "Staff Engineer",
|
|
60
|
+
quote:
|
|
61
|
+
"Storybook coverage wired into pre-commit means nobody ships a variant without a story. That alone ended our drift problem.",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "Anika Patel",
|
|
65
|
+
role: "Design Engineer",
|
|
66
|
+
quote:
|
|
67
|
+
"7:1 contrast out of the box. I stopped auditing every PR for hardcoded hex values because the lint does it for me.",
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
function TopicChips() {
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
{TOPICS.map((topic) => (
|
|
75
|
+
<MarqueeItem key={topic}>
|
|
76
|
+
<Badge variant="secondary">{topic}</Badge>
|
|
77
|
+
</MarqueeItem>
|
|
78
|
+
))}
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const Default: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<div className="w-full max-w-2xl">
|
|
86
|
+
<Marquee aria-label="Documentation topics">
|
|
87
|
+
<TopicChips />
|
|
88
|
+
</Marquee>
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const Variant_ReverseDirection: Story = {
|
|
94
|
+
render: () => (
|
|
95
|
+
<div className="w-full max-w-2xl">
|
|
96
|
+
<Marquee aria-label="Documentation topics" direction="right">
|
|
97
|
+
<TopicChips />
|
|
98
|
+
</Marquee>
|
|
99
|
+
</div>
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const Variant_EdgeFade: Story = {
|
|
104
|
+
render: () => (
|
|
105
|
+
<div className="w-full max-w-2xl">
|
|
106
|
+
<Marquee aria-label="Documentation topics" fade>
|
|
107
|
+
<TopicChips />
|
|
108
|
+
</Marquee>
|
|
109
|
+
</div>
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const WithoutControl: Story = {
|
|
114
|
+
parameters: {
|
|
115
|
+
docs: {
|
|
116
|
+
description: {
|
|
117
|
+
story:
|
|
118
|
+
"SC 2.2.2 consumer contract: with `showControl={false}` the built-in pause button is gone, and hover / focus-within pause alone does not cover touch users — the consumer MUST provide its own pause mechanism (here, the toggle below the strip).",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
render: function WithoutControlStory() {
|
|
123
|
+
const [paused, setPaused] = React.useState(false);
|
|
124
|
+
return (
|
|
125
|
+
<div className="w-full max-w-2xl space-y-3">
|
|
126
|
+
<Marquee
|
|
127
|
+
aria-label="Documentation topics"
|
|
128
|
+
showControl={false}
|
|
129
|
+
data-state={paused ? "paused" : "running"}
|
|
130
|
+
>
|
|
131
|
+
<TopicChips />
|
|
132
|
+
</Marquee>
|
|
133
|
+
<button
|
|
134
|
+
type="button"
|
|
135
|
+
className="min-h-11 rounded-md border px-4 text-sm font-medium"
|
|
136
|
+
aria-pressed={paused}
|
|
137
|
+
onClick={() => setPaused((p) => !p)}
|
|
138
|
+
>
|
|
139
|
+
{paused ? "Resume ticker" : "Pause ticker"}
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const RealisticUse: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<div className="w-full max-w-3xl space-y-3">
|
|
149
|
+
<p className="text-sm font-medium text-muted-foreground">
|
|
150
|
+
What design systems teams say
|
|
151
|
+
</p>
|
|
152
|
+
<Marquee aria-label="Customer testimonials" fade speed={30}>
|
|
153
|
+
{TESTIMONIALS.map((t) => (
|
|
154
|
+
<MarqueeItem key={t.name}>
|
|
155
|
+
<Card className="w-80 shadow-none">
|
|
156
|
+
<CardContent className="space-y-2 p-4">
|
|
157
|
+
<p className="text-sm leading-relaxed">“{t.quote}”</p>
|
|
158
|
+
<p className="text-xs text-muted-foreground">
|
|
159
|
+
<span className="font-medium text-foreground">{t.name}</span>
|
|
160
|
+
{" — "}
|
|
161
|
+
{t.role}
|
|
162
|
+
</p>
|
|
163
|
+
</CardContent>
|
|
164
|
+
</Card>
|
|
165
|
+
</MarqueeItem>
|
|
166
|
+
))}
|
|
167
|
+
</Marquee>
|
|
168
|
+
</div>
|
|
169
|
+
),
|
|
170
|
+
};
|