@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,191 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Search, Bell, Palette } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { Tour, type TourStep } from "@behavioral-agentic-design-system/core/components/ui/tour";
|
|
6
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Tour is a guided product walkthrough built on Radix Dialog: focus trap,
|
|
16
|
+
* Escape-to-close, and focus-return come from the dialog base; the tour adds
|
|
17
|
+
* selector-anchored positioning, a primary-ring target highlight, text
|
|
18
|
+
* progress ("Step N of M"), and ArrowLeft/ArrowRight step navigation.
|
|
19
|
+
* Steps whose `target` is null (or matches nothing) render centered.
|
|
20
|
+
*/
|
|
21
|
+
const meta: Meta<typeof Tour> = {
|
|
22
|
+
title: "Components/Tour",
|
|
23
|
+
component: Tour,
|
|
24
|
+
parameters: { layout: "centered" },
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
function DemoChrome({ idPrefix }: { idPrefix: string }) {
|
|
32
|
+
return (
|
|
33
|
+
<Card className="w-96">
|
|
34
|
+
<CardHeader>
|
|
35
|
+
<CardTitle className="text-sm">Your design system at a glance</CardTitle>
|
|
36
|
+
</CardHeader>
|
|
37
|
+
<CardContent className="flex items-center gap-3">
|
|
38
|
+
<Button id={`${idPrefix}-search`} variant="outline" size="xl" className="px-4">
|
|
39
|
+
<Search strokeWidth={1.5} className="size-4" aria-hidden="true" />
|
|
40
|
+
Search
|
|
41
|
+
</Button>
|
|
42
|
+
<Button id={`${idPrefix}-alerts`} variant="outline" size="xl" className="px-4">
|
|
43
|
+
<Bell strokeWidth={1.5} className="size-4" aria-hidden="true" />
|
|
44
|
+
Alerts
|
|
45
|
+
</Button>
|
|
46
|
+
<Button id={`${idPrefix}-customize`} size="xl" className="px-4">
|
|
47
|
+
<Palette strokeWidth={1.5} className="size-4" aria-hidden="true" />
|
|
48
|
+
Customize
|
|
49
|
+
</Button>
|
|
50
|
+
</CardContent>
|
|
51
|
+
</Card>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function TourDemo({
|
|
56
|
+
steps,
|
|
57
|
+
idPrefix,
|
|
58
|
+
startLabel = "Start tour",
|
|
59
|
+
}: {
|
|
60
|
+
steps: TourStep[];
|
|
61
|
+
idPrefix: string;
|
|
62
|
+
startLabel?: string;
|
|
63
|
+
}) {
|
|
64
|
+
const [open, setOpen] = React.useState(false);
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex flex-col items-start gap-4">
|
|
67
|
+
<Button size="xl" onClick={() => setOpen(true)}>
|
|
68
|
+
{startLabel}
|
|
69
|
+
</Button>
|
|
70
|
+
<DemoChrome idPrefix={idPrefix} />
|
|
71
|
+
<Tour steps={steps} open={open} onOpenChange={setOpen} />
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Default: Story = {
|
|
77
|
+
render: () => (
|
|
78
|
+
<TourDemo
|
|
79
|
+
idPrefix="tour-default"
|
|
80
|
+
steps={[
|
|
81
|
+
{
|
|
82
|
+
title: "Search the registry",
|
|
83
|
+
description: "Find any primitive, token, or pattern by name.",
|
|
84
|
+
target: "#tour-default-search",
|
|
85
|
+
placement: "bottom",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: "Watch for token changes",
|
|
89
|
+
description: "Alerts fire when a token change affects components you own.",
|
|
90
|
+
target: "#tour-default-alerts",
|
|
91
|
+
placement: "bottom",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: "Customize your tokens",
|
|
95
|
+
description: "Brand color overrides live here, with AAA contrast warnings built in.",
|
|
96
|
+
target: "#tour-default-customize",
|
|
97
|
+
placement: "bottom",
|
|
98
|
+
},
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const Placement_TopAndLeft: Story = {
|
|
105
|
+
render: () => (
|
|
106
|
+
<TourDemo
|
|
107
|
+
idPrefix="tour-placement"
|
|
108
|
+
startLabel="Start tour (top / left)"
|
|
109
|
+
steps={[
|
|
110
|
+
{
|
|
111
|
+
title: "Panel above the target",
|
|
112
|
+
description: "This step uses placement 'top'.",
|
|
113
|
+
target: "#tour-placement-search",
|
|
114
|
+
placement: "top",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
title: "Panel beside the target",
|
|
118
|
+
description: "This step uses placement 'left'. Positions clamp to the viewport.",
|
|
119
|
+
target: "#tour-placement-customize",
|
|
120
|
+
placement: "left",
|
|
121
|
+
},
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const Centered_WelcomeStep: Story = {
|
|
128
|
+
render: () => (
|
|
129
|
+
<TourDemo
|
|
130
|
+
idPrefix="tour-centered"
|
|
131
|
+
startLabel="Start tour (welcome step)"
|
|
132
|
+
steps={[
|
|
133
|
+
{
|
|
134
|
+
title: "Set up your design system in five minutes",
|
|
135
|
+
description:
|
|
136
|
+
"BADS ships with tokens, components, and accessibility baked in. This short tour shows the three surfaces you'll use most.",
|
|
137
|
+
target: null,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: "Search the registry",
|
|
141
|
+
description: "Find any primitive, token, or pattern by name.",
|
|
142
|
+
target: "#tour-centered-search",
|
|
143
|
+
},
|
|
144
|
+
]}
|
|
145
|
+
/>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const RealisticUse: Story = {
|
|
150
|
+
render: function RealisticUseStory() {
|
|
151
|
+
const [open, setOpen] = React.useState(false);
|
|
152
|
+
const [completed, setCompleted] = React.useState(false);
|
|
153
|
+
return (
|
|
154
|
+
<div className="flex flex-col items-start gap-4">
|
|
155
|
+
<Button size="xl" onClick={() => setOpen(true)}>
|
|
156
|
+
Show me around
|
|
157
|
+
</Button>
|
|
158
|
+
{completed && (
|
|
159
|
+
<p className="text-sm text-muted-foreground">
|
|
160
|
+
Tour finished. Run it again any time from Settings.
|
|
161
|
+
</p>
|
|
162
|
+
)}
|
|
163
|
+
<DemoChrome idPrefix="tour-realistic" />
|
|
164
|
+
<Tour
|
|
165
|
+
open={open}
|
|
166
|
+
onOpenChange={setOpen}
|
|
167
|
+
onComplete={() => setCompleted(true)}
|
|
168
|
+
steps={[
|
|
169
|
+
{
|
|
170
|
+
title: "Welcome, Jordan",
|
|
171
|
+
description:
|
|
172
|
+
"36 components, all passing AAA contrast. Here's where everything lives.",
|
|
173
|
+
target: null,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: "Search the registry",
|
|
177
|
+
description: "Find any primitive, token, or pattern by name.",
|
|
178
|
+
target: "#tour-realistic-search",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: "Customize your tokens",
|
|
182
|
+
description:
|
|
183
|
+
"Brand color overrides live here. Changes stay in your browser until you commit them to tokens.json.",
|
|
184
|
+
target: "#tour-realistic-customize",
|
|
185
|
+
},
|
|
186
|
+
]}
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
},
|
|
191
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { TransferList } from "@behavioral-agentic-design-system/core/components/ui/transfer-list"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TransferList> = {
|
|
6
|
+
title: "Components/TransferList",
|
|
7
|
+
component: TransferList,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
searchable: { control: "boolean" },
|
|
12
|
+
availableLabel: { control: "text" },
|
|
13
|
+
selectedLabel: { control: "text" },
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof TransferList>
|
|
19
|
+
|
|
20
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
21
|
+
// Controlled wrapper
|
|
22
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
function ControlledTransferList(
|
|
25
|
+
props: Omit<
|
|
26
|
+
React.ComponentProps<typeof TransferList>,
|
|
27
|
+
"available" | "selected" | "onAvailableChange" | "onSelectedChange"
|
|
28
|
+
> & {
|
|
29
|
+
initialAvailable?: string[]
|
|
30
|
+
initialSelected?: string[]
|
|
31
|
+
}
|
|
32
|
+
) {
|
|
33
|
+
const {
|
|
34
|
+
initialAvailable = ["Alpha", "Bravo", "Charlie"],
|
|
35
|
+
initialSelected = [],
|
|
36
|
+
...rest
|
|
37
|
+
} = props
|
|
38
|
+
const [available, setAvailable] = React.useState<string[]>(initialAvailable)
|
|
39
|
+
const [selected, setSelected] = React.useState<string[]>(initialSelected)
|
|
40
|
+
return (
|
|
41
|
+
<TransferList
|
|
42
|
+
available={available}
|
|
43
|
+
selected={selected}
|
|
44
|
+
onAvailableChange={setAvailable}
|
|
45
|
+
onSelectedChange={setSelected}
|
|
46
|
+
{...rest}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
52
|
+
// Stories
|
|
53
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
export const Default: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
// Right panel starts empty — "No items" placeholder renders with role="option"
|
|
58
|
+
// aria-disabled="true" to satisfy listbox's aria-required-children contract.
|
|
59
|
+
<ControlledTransferList
|
|
60
|
+
searchable={false}
|
|
61
|
+
initialAvailable={["Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot"]}
|
|
62
|
+
/>
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const WithSearch: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<ControlledTransferList
|
|
69
|
+
searchable
|
|
70
|
+
initialAvailable={[
|
|
71
|
+
"Accordion",
|
|
72
|
+
"Alert",
|
|
73
|
+
"Badge",
|
|
74
|
+
"Button",
|
|
75
|
+
"Calendar",
|
|
76
|
+
"Checkbox",
|
|
77
|
+
"Combobox",
|
|
78
|
+
"DataList",
|
|
79
|
+
"Dialog",
|
|
80
|
+
"Dropdown",
|
|
81
|
+
"Input",
|
|
82
|
+
"Label",
|
|
83
|
+
"Pagination",
|
|
84
|
+
"Progress",
|
|
85
|
+
"Select",
|
|
86
|
+
"Slider",
|
|
87
|
+
"Switch",
|
|
88
|
+
"Table",
|
|
89
|
+
"Tabs",
|
|
90
|
+
"Textarea",
|
|
91
|
+
"Toast",
|
|
92
|
+
"Tooltip",
|
|
93
|
+
]}
|
|
94
|
+
initialSelected={["Accordion", "Button", "Input"]}
|
|
95
|
+
/>
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Demonstrates wiring up to external controlled state (e.g., a form).
|
|
100
|
+
export const Controlled: Story = {
|
|
101
|
+
render: function ControlledStory() {
|
|
102
|
+
const [available, setAvailable] = React.useState([
|
|
103
|
+
"Read",
|
|
104
|
+
"Write",
|
|
105
|
+
"Delete",
|
|
106
|
+
"Admin",
|
|
107
|
+
])
|
|
108
|
+
const [selected, setSelected] = React.useState(["Read"])
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className="space-y-4">
|
|
112
|
+
<TransferList
|
|
113
|
+
available={available}
|
|
114
|
+
selected={selected}
|
|
115
|
+
onAvailableChange={setAvailable}
|
|
116
|
+
onSelectedChange={setSelected}
|
|
117
|
+
availableLabel="Permissions"
|
|
118
|
+
selectedLabel="Granted"
|
|
119
|
+
/>
|
|
120
|
+
<p className="text-sm text-muted-foreground">
|
|
121
|
+
Granted:{" "}
|
|
122
|
+
<span className="font-medium text-foreground">
|
|
123
|
+
{selected.length === 0 ? "none" : selected.join(", ")}
|
|
124
|
+
</span>
|
|
125
|
+
</p>
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Documents the keyboard navigation contract: Tab → focus listbox, ArrowDown/Up
|
|
132
|
+
// → move active item (aria-activedescendant), Space/Enter → toggle, Tab → move
|
|
133
|
+
// to transfer buttons. Items are NOT individually tabbable (no nested-interactive).
|
|
134
|
+
export const KeyboardNav: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className="space-y-2">
|
|
137
|
+
<p className="text-xs text-muted-foreground max-w-sm">
|
|
138
|
+
Tab to a panel → ArrowDown/Up to move between items → Space or Enter to
|
|
139
|
+
toggle selection → Tab to the transfer buttons.
|
|
140
|
+
</p>
|
|
141
|
+
<ControlledTransferList
|
|
142
|
+
searchable={false}
|
|
143
|
+
initialAvailable={["Read", "Write", "Delete", "Admin"]}
|
|
144
|
+
initialSelected={["Read"]}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
),
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Real-world usage: assigning team members to a project.
|
|
151
|
+
export const RealisticUse: Story = {
|
|
152
|
+
render: function RealisticUseStory() {
|
|
153
|
+
const allMembers = [
|
|
154
|
+
"Seo-yun Park",
|
|
155
|
+
"Jordan Reeves",
|
|
156
|
+
"Amara Osei",
|
|
157
|
+
"Takeshi Nakamura",
|
|
158
|
+
"Priya Mehta",
|
|
159
|
+
"Caleb Torres",
|
|
160
|
+
]
|
|
161
|
+
const [available, setAvailable] = React.useState(allMembers.slice(3))
|
|
162
|
+
const [selected, setSelected] = React.useState(allMembers.slice(0, 3))
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div className="space-y-4 w-full">
|
|
166
|
+
<div>
|
|
167
|
+
<p className="text-sm font-medium text-foreground">
|
|
168
|
+
Assign team members to project
|
|
169
|
+
</p>
|
|
170
|
+
<p className="text-sm text-muted-foreground">
|
|
171
|
+
Select members from the available list, then move them to the
|
|
172
|
+
assigned column.
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
<TransferList
|
|
176
|
+
available={available}
|
|
177
|
+
selected={selected}
|
|
178
|
+
onAvailableChange={setAvailable}
|
|
179
|
+
onSelectedChange={setSelected}
|
|
180
|
+
availableLabel="Team members"
|
|
181
|
+
selectedLabel="Assigned"
|
|
182
|
+
searchable
|
|
183
|
+
/>
|
|
184
|
+
<p className="text-sm text-muted-foreground">
|
|
185
|
+
{selected.length} member{selected.length !== 1 ? "s" : ""} assigned
|
|
186
|
+
</p>
|
|
187
|
+
</div>
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { TypingIndicator } from "@behavioral-agentic-design-system/core/components/ui/typing-indicator";
|
|
4
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
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 TypingIndicator> = {
|
|
14
|
+
title: "Components/TypingIndicator",
|
|
15
|
+
component: TypingIndicator,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Three-dot animated is-typing signal for chat and AI response surfaces. role=status announces the typing state; dots are aria-hidden. Reduced-motion halts the bob animation (dots render as a static ellipsis). Ethics contract: only show for REAL async work — never fake a typing animation on an already-computed response.",
|
|
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-start gap-2">
|
|
34
|
+
<TypingIndicator />
|
|
35
|
+
<p className="text-sm text-muted-foreground">
|
|
36
|
+
Default size — 3 dots bob with 200 ms stagger on a 1.2 s cycle.
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Size_sm: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div className="flex flex-col items-start gap-2">
|
|
45
|
+
<TypingIndicator size="sm" />
|
|
46
|
+
<p className="text-sm text-muted-foreground">
|
|
47
|
+
sm — compact, for dense conversation threads.
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Size_lg: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<div className="flex flex-col items-start gap-2">
|
|
56
|
+
<TypingIndicator size="lg" />
|
|
57
|
+
<p className="text-sm text-muted-foreground">
|
|
58
|
+
lg — prominent, for full-page AI response surfaces.
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const CustomLabel: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<div className="flex flex-col items-start gap-2">
|
|
67
|
+
<TypingIndicator label="BADS assistant is thinking…" />
|
|
68
|
+
<p className="text-sm text-muted-foreground">
|
|
69
|
+
Custom label — announced once by screen readers on mount.
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const RealisticUse: Story = {
|
|
76
|
+
render: function RealisticUseStory() {
|
|
77
|
+
const [phase, setPhase] = React.useState<"idle" | "typing" | "done">("idle");
|
|
78
|
+
const [response, setResponse] = React.useState("");
|
|
79
|
+
|
|
80
|
+
const handleSend = () => {
|
|
81
|
+
setPhase("typing");
|
|
82
|
+
setResponse("");
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
setPhase("done");
|
|
85
|
+
setResponse(
|
|
86
|
+
"I found 3 components related to your query: RollingNumber, Timer, and FormatNumber. RollingNumber animates value changes; Timer ticks toward a deadline; FormatNumber formats statically."
|
|
87
|
+
);
|
|
88
|
+
}, 2600);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Card className="w-[380px]">
|
|
93
|
+
<CardHeader>
|
|
94
|
+
<CardTitle className="text-sm font-medium">BADS Assistant</CardTitle>
|
|
95
|
+
</CardHeader>
|
|
96
|
+
<CardContent className="flex flex-col gap-3">
|
|
97
|
+
{/* User message */}
|
|
98
|
+
<div className="flex justify-end">
|
|
99
|
+
<div className="max-w-[70%] rounded-2xl rounded-tr-sm bg-primary px-3 py-2 text-sm text-primary-foreground">
|
|
100
|
+
Which component should I use for animated numbers?
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{/* Assistant response area */}
|
|
105
|
+
<div className="flex items-end gap-2">
|
|
106
|
+
<Avatar size="sm" className="shrink-0">
|
|
107
|
+
<AvatarImage src="" alt="" />
|
|
108
|
+
<AvatarFallback>B</AvatarFallback>
|
|
109
|
+
</Avatar>
|
|
110
|
+
<div className="min-h-[36px]">
|
|
111
|
+
{phase === "idle" && (
|
|
112
|
+
<p className="text-sm text-muted-foreground">
|
|
113
|
+
Send a message to see the typing indicator.
|
|
114
|
+
</p>
|
|
115
|
+
)}
|
|
116
|
+
{phase === "typing" && (
|
|
117
|
+
<TypingIndicator label="BADS assistant is typing" />
|
|
118
|
+
)}
|
|
119
|
+
{phase === "done" && (
|
|
120
|
+
<div className="max-w-[70%] rounded-2xl rounded-tl-sm bg-muted px-3 py-2 text-sm">
|
|
121
|
+
{response}
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<Button
|
|
128
|
+
size="xl"
|
|
129
|
+
onClick={handleSend}
|
|
130
|
+
disabled={phase === "typing"}
|
|
131
|
+
className="w-full"
|
|
132
|
+
>
|
|
133
|
+
{phase === "typing" ? "Waiting…" : "Ask BADS"}
|
|
134
|
+
</Button>
|
|
135
|
+
</CardContent>
|
|
136
|
+
</Card>
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { BellIcon, DownloadIcon, XIcon } from "lucide-react";
|
|
4
|
+
import { VisuallyHidden } from "@behavioral-agentic-design-system/core/components/ui/visually-hidden";
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
6
|
+
import {
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
10
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof VisuallyHidden> = {
|
|
13
|
+
title: "Components/VisuallyHidden",
|
|
14
|
+
component: VisuallyHidden,
|
|
15
|
+
parameters: { layout: "centered" },
|
|
16
|
+
tags: ["autodocs"],
|
|
17
|
+
argTypes: {
|
|
18
|
+
asChild: { control: "boolean" },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof VisuallyHidden>;
|
|
24
|
+
|
|
25
|
+
// The primitive is invisible by design — every story pairs it with visible
|
|
26
|
+
// context so the canvas shows WHERE the hidden text sits. Inspect the DOM
|
|
27
|
+
// (or run a screen reader) to confirm the hidden content is present.
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<div className="max-w-sm space-y-2">
|
|
32
|
+
<p className="text-sm text-foreground">
|
|
33
|
+
Token changes saved.
|
|
34
|
+
<VisuallyHidden>
|
|
35
|
+
Run pnpm build:tokens to regenerate CSS.
|
|
36
|
+
</VisuallyHidden>
|
|
37
|
+
</p>
|
|
38
|
+
<p className="text-xs text-muted-foreground">
|
|
39
|
+
The follow-up instruction is wrapped in VisuallyHidden — screen
|
|
40
|
+
readers announce it after the visible sentence; sighted users see
|
|
41
|
+
only the confirmation. Inspect the DOM to find the hidden span
|
|
42
|
+
(data-slot="visually-hidden").
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const WithAsChild: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div className="max-w-sm space-y-2">
|
|
51
|
+
<p className="text-sm text-foreground">
|
|
52
|
+
Reviewed by Jordan Reeves
|
|
53
|
+
<VisuallyHidden asChild>
|
|
54
|
+
<span> (jordan@reeves.design)</span>
|
|
55
|
+
</VisuallyHidden>
|
|
56
|
+
</p>
|
|
57
|
+
<p className="text-xs text-muted-foreground">
|
|
58
|
+
asChild merges the sr-only behavior onto the consumer’s own
|
|
59
|
+
span instead of rendering a wrapper — the child keeps its element
|
|
60
|
+
type and props.
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const RealisticUse: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<Card className="w-80">
|
|
69
|
+
<CardContent className="space-y-4 p-4">
|
|
70
|
+
<div className="flex items-start justify-between gap-3">
|
|
71
|
+
<div className="min-w-0 space-y-1">
|
|
72
|
+
<p className="truncate text-sm font-semibold">
|
|
73
|
+
tokens-v2-proposal
|
|
74
|
+
</p>
|
|
75
|
+
<p className="text-xs text-muted-foreground">
|
|
76
|
+
Shared by Jordan Reeves
|
|
77
|
+
</p>
|
|
78
|
+
</div>
|
|
79
|
+
<Badge variant="secondary">Draft</Badge>
|
|
80
|
+
</div>
|
|
81
|
+
<div className="flex items-center gap-2">
|
|
82
|
+
<Button variant="outline" size="icon-xl">
|
|
83
|
+
<DownloadIcon strokeWidth={1.5} />
|
|
84
|
+
<VisuallyHidden>Download tokens-v2-proposal</VisuallyHidden>
|
|
85
|
+
</Button>
|
|
86
|
+
<Button variant="outline" size="icon-xl">
|
|
87
|
+
<BellIcon strokeWidth={1.5} />
|
|
88
|
+
<VisuallyHidden>
|
|
89
|
+
Notify me when tokens-v2-proposal changes
|
|
90
|
+
</VisuallyHidden>
|
|
91
|
+
</Button>
|
|
92
|
+
<Button variant="ghost" size="icon-xl">
|
|
93
|
+
<XIcon strokeWidth={1.5} />
|
|
94
|
+
<VisuallyHidden>Dismiss</VisuallyHidden>
|
|
95
|
+
</Button>
|
|
96
|
+
</div>
|
|
97
|
+
<p className="text-xs text-muted-foreground">
|
|
98
|
+
Each icon-only button gets its accessible name from a
|
|
99
|
+
VisuallyHidden label — announced by screen readers, invisible on
|
|
100
|
+
screen.
|
|
101
|
+
</p>
|
|
102
|
+
</CardContent>
|
|
103
|
+
</Card>
|
|
104
|
+
),
|
|
105
|
+
};
|