@behavioral-agentic-design-system/core 0.16.0 → 0.18.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 +1 -1
- package/scripts/check-stories.mjs +12 -5
- package/scripts/fix-stories.mjs +6 -6
- package/scripts/generate-stories.cjs +7 -7
- package/src/app/preview/components/page.tsx +165 -50
- package/src/components/ui/code.tsx +55 -0
- package/src/components/ui/index.ts +0 -1
- package/src/components/ui/indicator.tsx +9 -7
- package/src/components/ui/native-select.tsx +68 -0
- package/src/components/ui/navigation-menu.tsx +23 -0
- package/src/components/ui/sheet.tsx +23 -6
- package/src/components/ui/spinner.tsx +14 -3
- package/src/components/ui/tags-input.tsx +210 -69
- package/src/stories/Accordion.stories.tsx +152 -0
- package/src/stories/Alert.stories.tsx +102 -0
- package/src/stories/AlertDialog.stories.tsx +125 -0
- package/src/stories/AspectRatio.stories.tsx +82 -0
- package/src/stories/Avatar.stories.tsx +36 -0
- package/src/stories/Badge.stories.tsx +54 -0
- package/src/stories/Breadcrumb.stories.tsx +36 -0
- package/src/stories/Button.stories.tsx +144 -0
- package/src/stories/ButtonGroup.stories.tsx +176 -0
- package/src/stories/Calendar.stories.tsx +67 -0
- package/src/stories/Card.stories.tsx +43 -0
- package/src/stories/Carousel.stories.tsx +233 -0
- package/src/stories/Chart.stories.tsx +174 -0
- package/src/stories/Checkbox.stories.tsx +32 -0
- package/src/stories/CircularProgress.stories.tsx +136 -0
- package/src/stories/Code.stories.tsx +131 -0
- package/src/stories/Collapsible.stories.tsx +27 -0
- package/src/stories/ColorPicker.stories.tsx +155 -0
- package/src/stories/Combobox.stories.tsx +168 -0
- package/src/stories/Command.stories.tsx +40 -0
- package/src/stories/ContextMenu.stories.tsx +293 -0
- package/src/stories/CopyButton.stories.tsx +111 -0
- package/src/stories/DatePicker.stories.tsx +176 -0
- package/src/stories/DateRangePicker.stories.tsx +95 -0
- package/src/stories/Dialog.stories.tsx +186 -0
- package/src/stories/DropdownMenu.stories.tsx +47 -0
- package/src/stories/EmptyState.stories.tsx +199 -0
- package/src/stories/Field.stories.tsx +155 -0
- package/src/stories/FileUpload.stories.tsx +134 -0
- package/src/stories/HoverCard.stories.tsx +149 -0
- package/src/stories/Indicator.stories.tsx +255 -0
- package/src/stories/Input.stories.tsx +69 -0
- package/src/stories/Kbd.stories.tsx +123 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/List.stories.tsx +159 -0
- package/src/stories/Menubar.stories.tsx +190 -0
- package/src/stories/MultiSelect.stories.tsx +107 -0
- package/src/stories/NativeSelect.stories.tsx +107 -0
- package/src/stories/NavigationMenu.stories.tsx +322 -0
- package/src/stories/NumberInput.stories.tsx +100 -0
- package/src/stories/Pagination.stories.tsx +201 -0
- package/src/stories/PasswordInput.stories.tsx +62 -0
- package/src/stories/PinInput.stories.tsx +136 -0
- package/src/stories/Popover.stories.tsx +37 -0
- package/src/stories/Progress.stories.tsx +64 -0
- package/src/stories/RadioGroup.stories.tsx +39 -0
- package/src/stories/RatingGroup.stories.tsx +102 -0
- package/src/stories/Resizable.stories.tsx +28 -0
- package/src/stories/Reveal.stories.tsx +63 -0
- package/src/stories/ScrollArea.stories.tsx +76 -0
- package/src/stories/SegmentedControl.stories.tsx +182 -0
- package/src/stories/Select.stories.tsx +62 -0
- package/src/stories/Separator.stories.tsx +28 -0
- package/src/stories/Sheet.stories.tsx +193 -0
- package/src/stories/Sidebar.stories.tsx +53 -0
- package/src/stories/Skeleton.stories.tsx +32 -0
- package/src/stories/Slider.stories.tsx +67 -0
- package/src/stories/Sonner.stories.tsx +146 -0
- package/src/stories/Spinner.stories.tsx +94 -0
- package/src/stories/Stepper.stories.tsx +228 -0
- package/src/stories/Switch.stories.tsx +58 -0
- package/src/stories/Table.stories.tsx +38 -0
- package/src/stories/Tabs.stories.tsx +128 -0
- package/src/stories/Tag.stories.tsx +51 -0
- package/src/stories/TagsInput.stories.tsx +154 -0
- package/src/stories/Textarea.stories.tsx +31 -0
- package/src/stories/TimePicker.stories.tsx +54 -0
- package/src/stories/Timeline.stories.tsx +263 -0
- package/src/stories/Toggle.stories.tsx +45 -0
- package/src/stories/ToggleGroup.stories.tsx +39 -0
- package/src/stories/Toolbar.stories.tsx +295 -0
- package/src/stories/Tooltip.stories.tsx +37 -0
- package/src/stories/TreeView.stories.tsx +293 -0
- package/src/components/ui/bottom-sheet.tsx +0 -133
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Skeleton } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Skeleton> = {
|
|
5
|
+
title: "Components/Skeleton",
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (<div className="flex items-center gap-3 w-[320px]">
|
|
16
|
+
<Skeleton className="h-12 w-12 rounded-full" />
|
|
17
|
+
<div className="flex-1 space-y-2">
|
|
18
|
+
<Skeleton className="h-4 w-[80%]" />
|
|
19
|
+
<Skeleton className="h-4 w-[60%]" />
|
|
20
|
+
</div>
|
|
21
|
+
</div>),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const RealisticUse: Story = {
|
|
25
|
+
render: () => (<div className="flex items-center gap-3 w-[320px]">
|
|
26
|
+
<Skeleton className="h-12 w-12 rounded-full" />
|
|
27
|
+
<div className="flex-1 space-y-2">
|
|
28
|
+
<Skeleton className="h-4 w-[80%]" />
|
|
29
|
+
<Skeleton className="h-4 w-[60%]" />
|
|
30
|
+
</div>
|
|
31
|
+
</div>),
|
|
32
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Slider } from "@behavioral-agentic-design-system/core/components/ui/slider";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Slider is a non-CVA primitive — only `Default` + `Disabled` + `RealisticUse`
|
|
6
|
+
* per the storybook rule. Track surface uses `bg-primary/30 dark:bg-primary/60`
|
|
7
|
+
* (matches Progress); thumb uses `bg-white border-2 border-primary` so it
|
|
8
|
+
* contrasts against any track tint while inheriting the brand color on its
|
|
9
|
+
* border. Documented AAA exception lives in CLAUDE.md → Known AAA exceptions.
|
|
10
|
+
*/
|
|
11
|
+
const meta: Meta<typeof Slider> = {
|
|
12
|
+
title: "Components/Slider",
|
|
13
|
+
component: Slider,
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "centered",
|
|
16
|
+
},
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: { defaultValue: [50], min: 0, max: 100, step: 1, "aria-label": "Value" },
|
|
25
|
+
render: (args) => (
|
|
26
|
+
<div className="w-72">
|
|
27
|
+
<Slider {...args} />
|
|
28
|
+
</div>
|
|
29
|
+
),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Disabled: Story = {
|
|
33
|
+
args: { defaultValue: [40], min: 0, max: 100, step: 1, disabled: true, "aria-label": "Value" },
|
|
34
|
+
render: (args) => (
|
|
35
|
+
<div className="w-72">
|
|
36
|
+
<Slider {...args} />
|
|
37
|
+
</div>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const RealisticUse: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<div className="w-80 space-y-6">
|
|
44
|
+
<div className="space-y-3">
|
|
45
|
+
<div className="flex items-baseline justify-between">
|
|
46
|
+
<label id="slider-volume" className="text-sm font-medium">Volume</label>
|
|
47
|
+
<span className="text-xs text-muted-foreground tabular-nums">62%</span>
|
|
48
|
+
</div>
|
|
49
|
+
<Slider defaultValue={[62]} min={0} max={100} step={1} aria-labelledby="slider-volume" />
|
|
50
|
+
</div>
|
|
51
|
+
<div className="space-y-3">
|
|
52
|
+
<div className="flex items-baseline justify-between">
|
|
53
|
+
<label id="slider-brightness" className="text-sm font-medium">Brightness</label>
|
|
54
|
+
<span className="text-xs text-muted-foreground tabular-nums">28%</span>
|
|
55
|
+
</div>
|
|
56
|
+
<Slider defaultValue={[28]} min={0} max={100} step={1} aria-labelledby="slider-brightness" />
|
|
57
|
+
</div>
|
|
58
|
+
<div className="space-y-3">
|
|
59
|
+
<div className="flex items-baseline justify-between">
|
|
60
|
+
<label className="text-sm font-medium">Range</label>
|
|
61
|
+
<span className="text-xs text-muted-foreground tabular-nums">20 — 75</span>
|
|
62
|
+
</div>
|
|
63
|
+
<Slider defaultValue={[20, 75]} min={0} max={100} step={1} aria-label="Range" />
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Toaster } from "@behavioral-agentic-design-system/core/components/ui/sonner";
|
|
3
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Toaster> = {
|
|
7
|
+
title: "Components/Sonner",
|
|
8
|
+
component: Toaster,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
"Status variants (success / warning / info / error) color the icon and a 4px left accent bar in the matching status token; the surface stays neutral popover and body text keeps the AAA `muted-foreground` token, so only the non-text accent is colored. The status tokens (`--success` / `--warning` / `--info`, plus `--destructive` for error) are tuned ≥3:1 against popover in both themes and enforced by `pnpm wcag:audit` (`<status> accent on popover`). Descriptions use an important modifier so they win over Sonner's hard-coded grey description color (which otherwise out-specifies the utility class). The status icon renders at 50px, top-aligned to the title (the toast row is `items-start`).",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<>
|
|
27
|
+
<Button
|
|
28
|
+
onClick={() =>
|
|
29
|
+
toast("Saved", { description: "Your changes are live." })
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
Show toast
|
|
33
|
+
</Button>
|
|
34
|
+
<Toaster />
|
|
35
|
+
</>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Variant_Success: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<>
|
|
42
|
+
<Button
|
|
43
|
+
onClick={() =>
|
|
44
|
+
toast.success("Brand color saved", {
|
|
45
|
+
description: "tokens.json updated. Run pnpm build:tokens to regenerate CSS.",
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
Show success toast
|
|
50
|
+
</Button>
|
|
51
|
+
<Toaster />
|
|
52
|
+
</>
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Variant_Error: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<>
|
|
59
|
+
<Button
|
|
60
|
+
variant="destructive"
|
|
61
|
+
onClick={() =>
|
|
62
|
+
toast.error("Save failed", {
|
|
63
|
+
description: "The brand-colors.json file is read-only or missing.",
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
Show error toast
|
|
68
|
+
</Button>
|
|
69
|
+
<Toaster />
|
|
70
|
+
</>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Variant_Warning: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<>
|
|
77
|
+
<Button
|
|
78
|
+
onClick={() =>
|
|
79
|
+
toast.warning("Contrast below AAA", {
|
|
80
|
+
description: "Current 4.2:1, required 7:1. You can keep the color anyway.",
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
Show warning toast
|
|
85
|
+
</Button>
|
|
86
|
+
<Toaster />
|
|
87
|
+
</>
|
|
88
|
+
),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Variant_Info: Story = {
|
|
92
|
+
render: () => (
|
|
93
|
+
<>
|
|
94
|
+
<Button
|
|
95
|
+
variant="outline"
|
|
96
|
+
onClick={() =>
|
|
97
|
+
toast.info("Heads up", {
|
|
98
|
+
description: "BADS @core has new commits available since your last sync.",
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
Show info toast
|
|
103
|
+
</Button>
|
|
104
|
+
<Toaster />
|
|
105
|
+
</>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const WithAction: Story = {
|
|
110
|
+
render: () => (
|
|
111
|
+
<>
|
|
112
|
+
<Button
|
|
113
|
+
onClick={() =>
|
|
114
|
+
toast("Color reset to brand default", {
|
|
115
|
+
description: "Primary returned to the canonical brand palette.",
|
|
116
|
+
action: { label: "Undo", onClick: () => toast("Reverted") },
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
Show toast with action
|
|
121
|
+
</Button>
|
|
122
|
+
<Toaster />
|
|
123
|
+
</>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const RealisticUse: Story = {
|
|
128
|
+
render: () => (
|
|
129
|
+
<>
|
|
130
|
+
<div className="flex flex-col gap-2">
|
|
131
|
+
<Button
|
|
132
|
+
onClick={() =>
|
|
133
|
+
toast.success("Pushed to brand-colors.json", {
|
|
134
|
+
description:
|
|
135
|
+
"Custom primary saved as a built-in. Everyone on the repo will see it on next pull.",
|
|
136
|
+
action: { label: "View diff", onClick: () => {} },
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
>
|
|
140
|
+
Save brand color
|
|
141
|
+
</Button>
|
|
142
|
+
</div>
|
|
143
|
+
<Toaster />
|
|
144
|
+
</>
|
|
145
|
+
),
|
|
146
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/spinner";
|
|
3
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Spinner> = {
|
|
6
|
+
title: "Components/Spinner",
|
|
7
|
+
component: Spinner,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"Loading spinner. The track and the moving arc are concentric circles drawn at the same 1.5 stroke width, so it reads as one ring with a moving highlight rather than a thin track behind a heavier arc. Animation is killed for users with reduced-motion via the base layer.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: () => <Spinner />,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Variant_Default: Story = {
|
|
28
|
+
render: () => <Spinner variant="default" />,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Variant_Muted: Story = {
|
|
32
|
+
render: () => <Spinner variant="muted" />,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Variant_Primary: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<div className="rounded-md bg-primary p-4">
|
|
38
|
+
<Spinner variant="primary" className="text-primary-foreground" />
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Size_Xs: Story = {
|
|
44
|
+
render: () => <Spinner size="xs" />,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Size_Sm: Story = {
|
|
48
|
+
render: () => <Spinner size="sm" />,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Size_Default: Story = {
|
|
52
|
+
render: () => <Spinner size="default" />,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Size_Lg: Story = {
|
|
56
|
+
render: () => <Spinner size="lg" />,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const AllSizes: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<div className="flex items-center gap-4">
|
|
62
|
+
<Spinner size="xs" />
|
|
63
|
+
<Spinner size="sm" />
|
|
64
|
+
<Spinner size="default" />
|
|
65
|
+
<Spinner size="lg" />
|
|
66
|
+
</div>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const RealisticUse: Story = {
|
|
71
|
+
render: () => (
|
|
72
|
+
<div className="flex flex-col gap-6">
|
|
73
|
+
{/* Button loading state */}
|
|
74
|
+
<div className="flex items-center gap-3">
|
|
75
|
+
<Button disabled className="gap-2">
|
|
76
|
+
<Spinner size="xs" className="text-primary-foreground" />
|
|
77
|
+
Saving changes…
|
|
78
|
+
</Button>
|
|
79
|
+
<Button variant="outline" disabled className="gap-2">
|
|
80
|
+
<Spinner size="xs" />
|
|
81
|
+
Uploading
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{/* Page-level loading */}
|
|
86
|
+
<div className="flex h-32 items-center justify-center rounded-md border border-dashed border-border">
|
|
87
|
+
<div className="flex flex-col items-center gap-2">
|
|
88
|
+
<Spinner size="lg" variant="muted" label="Loading workspace" />
|
|
89
|
+
<p className="text-sm text-muted-foreground">Loading workspace…</p>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Stepper,
|
|
4
|
+
StepperItem,
|
|
5
|
+
StepperIndicator,
|
|
6
|
+
StepperTitle,
|
|
7
|
+
StepperDescription,
|
|
8
|
+
StepperSeparator,
|
|
9
|
+
} from "@behavioral-agentic-design-system/core/components/ui/stepper";
|
|
10
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof Stepper> = {
|
|
14
|
+
title: "Components/Stepper",
|
|
15
|
+
component: Stepper,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Sequential step tracker for multi-step flows. Zero deps, WCAG AAA. Horizontal (separator between items) and vertical (separator inside indicator column) orientations. Completed steps render as a filled primary circle with a brand-colored box-shadow ring (background-gap + 2px brand ring). Active steps show the brand color as a 2px border. Error steps read fully in the destructive color — 2px destructive border, × icon, and step title. All three (active, completed, error) set their border color inline (var(--primary) / var(--destructive)) so it resolves regardless of Tailwind @theme cascade order. Pending indicators use the border-input token.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
// ─── Stories ──────────────────────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<div className="w-[480px]">
|
|
36
|
+
<Stepper value={2} aria-label="Checkout steps">
|
|
37
|
+
<StepperItem step={1}>
|
|
38
|
+
<StepperIndicator />
|
|
39
|
+
<StepperTitle className="mt-2 text-center">Shipping</StepperTitle>
|
|
40
|
+
</StepperItem>
|
|
41
|
+
<StepperSeparator step={1} />
|
|
42
|
+
<StepperItem step={2}>
|
|
43
|
+
<StepperIndicator />
|
|
44
|
+
<StepperTitle className="mt-2 text-center">Payment</StepperTitle>
|
|
45
|
+
</StepperItem>
|
|
46
|
+
<StepperSeparator step={2} />
|
|
47
|
+
<StepperItem step={3}>
|
|
48
|
+
<StepperIndicator />
|
|
49
|
+
<StepperTitle className="mt-2 text-center">Review</StepperTitle>
|
|
50
|
+
</StepperItem>
|
|
51
|
+
<StepperSeparator step={3} />
|
|
52
|
+
<StepperItem step={4}>
|
|
53
|
+
<StepperIndicator />
|
|
54
|
+
<StepperTitle className="mt-2 text-center">Confirm</StepperTitle>
|
|
55
|
+
</StepperItem>
|
|
56
|
+
</Stepper>
|
|
57
|
+
</div>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Variant_WithDescriptions: Story = {
|
|
62
|
+
name: "Variant_WithDescriptions",
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="w-[560px]">
|
|
65
|
+
<Stepper value={2} aria-label="Account setup">
|
|
66
|
+
<StepperItem step={1}>
|
|
67
|
+
<StepperIndicator />
|
|
68
|
+
<div className="mt-2 text-center">
|
|
69
|
+
<StepperTitle>Profile</StepperTitle>
|
|
70
|
+
<StepperDescription>Your details</StepperDescription>
|
|
71
|
+
</div>
|
|
72
|
+
</StepperItem>
|
|
73
|
+
<StepperSeparator step={1} />
|
|
74
|
+
<StepperItem step={2}>
|
|
75
|
+
<StepperIndicator />
|
|
76
|
+
<div className="mt-2 text-center">
|
|
77
|
+
<StepperTitle>Security</StepperTitle>
|
|
78
|
+
<StepperDescription>Password + 2FA</StepperDescription>
|
|
79
|
+
</div>
|
|
80
|
+
</StepperItem>
|
|
81
|
+
<StepperSeparator step={2} />
|
|
82
|
+
<StepperItem step={3}>
|
|
83
|
+
<StepperIndicator />
|
|
84
|
+
<div className="mt-2 text-center">
|
|
85
|
+
<StepperTitle>Preferences</StepperTitle>
|
|
86
|
+
<StepperDescription>Notifications</StepperDescription>
|
|
87
|
+
</div>
|
|
88
|
+
</StepperItem>
|
|
89
|
+
</Stepper>
|
|
90
|
+
</div>
|
|
91
|
+
),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Variant_Vertical: Story = {
|
|
95
|
+
name: "Variant_Vertical",
|
|
96
|
+
render: () => (
|
|
97
|
+
<div className="w-72">
|
|
98
|
+
<Stepper value={2} orientation="vertical" aria-label="Onboarding steps">
|
|
99
|
+
<StepperItem step={1}>
|
|
100
|
+
<div className="flex flex-col items-center shrink-0">
|
|
101
|
+
<StepperIndicator />
|
|
102
|
+
<StepperSeparator />
|
|
103
|
+
</div>
|
|
104
|
+
<div className="pb-6">
|
|
105
|
+
<StepperTitle>Connect your data</StepperTitle>
|
|
106
|
+
<StepperDescription>Integrate your existing tools via OAuth or API key.</StepperDescription>
|
|
107
|
+
</div>
|
|
108
|
+
</StepperItem>
|
|
109
|
+
<StepperItem step={2}>
|
|
110
|
+
<div className="flex flex-col items-center shrink-0">
|
|
111
|
+
<StepperIndicator />
|
|
112
|
+
<StepperSeparator />
|
|
113
|
+
</div>
|
|
114
|
+
<div className="pb-6">
|
|
115
|
+
<StepperTitle>Set up your workspace</StepperTitle>
|
|
116
|
+
<StepperDescription>Invite teammates, configure roles, and set a team name.</StepperDescription>
|
|
117
|
+
</div>
|
|
118
|
+
</StepperItem>
|
|
119
|
+
<StepperItem step={3}>
|
|
120
|
+
<div className="flex flex-col items-center shrink-0">
|
|
121
|
+
<StepperIndicator />
|
|
122
|
+
{/* no separator on last item */}
|
|
123
|
+
</div>
|
|
124
|
+
<div className="pb-6">
|
|
125
|
+
<StepperTitle>Publish your first flow</StepperTitle>
|
|
126
|
+
<StepperDescription>Run the BADS onboarding workflow and invite your first client.</StepperDescription>
|
|
127
|
+
</div>
|
|
128
|
+
</StepperItem>
|
|
129
|
+
</Stepper>
|
|
130
|
+
</div>
|
|
131
|
+
),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const Variant_Error: Story = {
|
|
135
|
+
name: "Variant_Error",
|
|
136
|
+
render: () => (
|
|
137
|
+
<div className="w-[480px]">
|
|
138
|
+
<Stepper value={2} aria-label="Import steps — step 2 has an error">
|
|
139
|
+
<StepperItem step={1}>
|
|
140
|
+
<StepperIndicator />
|
|
141
|
+
<StepperTitle className="mt-2 text-center">Upload file</StepperTitle>
|
|
142
|
+
</StepperItem>
|
|
143
|
+
<StepperSeparator step={1} />
|
|
144
|
+
<StepperItem step={2} error>
|
|
145
|
+
<StepperIndicator />
|
|
146
|
+
<StepperTitle className="mt-2 text-center">Validate</StepperTitle>
|
|
147
|
+
</StepperItem>
|
|
148
|
+
<StepperSeparator step={2} />
|
|
149
|
+
<StepperItem step={3}>
|
|
150
|
+
<StepperIndicator />
|
|
151
|
+
<StepperTitle className="mt-2 text-center">Import</StepperTitle>
|
|
152
|
+
</StepperItem>
|
|
153
|
+
</Stepper>
|
|
154
|
+
</div>
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const Size_Compact: Story = {
|
|
159
|
+
name: "Size_Compact",
|
|
160
|
+
render: () => (
|
|
161
|
+
<div className="w-[400px]">
|
|
162
|
+
<Stepper value={3} aria-label="Quiz progress">
|
|
163
|
+
{[1, 2, 3, 4, 5].map((n) => (
|
|
164
|
+
<React.Fragment key={n}>
|
|
165
|
+
<StepperItem step={n}>
|
|
166
|
+
<StepperIndicator className="size-8 text-xs" />
|
|
167
|
+
</StepperItem>
|
|
168
|
+
{n < 5 && <StepperSeparator step={n} />}
|
|
169
|
+
</React.Fragment>
|
|
170
|
+
))}
|
|
171
|
+
</Stepper>
|
|
172
|
+
</div>
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const RealisticUse: Story = {
|
|
177
|
+
name: "RealisticUse — client onboarding wizard",
|
|
178
|
+
render: function RealisticUseStory() {
|
|
179
|
+
const [step, setStep] = React.useState(1);
|
|
180
|
+
const steps = [
|
|
181
|
+
{ label: "Brand intake", desc: "Name, logo, and color palette" },
|
|
182
|
+
{ label: "Token build", desc: "Run pnpm build:tokens" },
|
|
183
|
+
{ label: "Voice calibration", desc: "Tone + persona pressure-test" },
|
|
184
|
+
{ label: "Component scope", desc: "Decide which primitives to fork" },
|
|
185
|
+
];
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<div className="w-[560px] space-y-8 rounded-xl border bg-card p-6 shadow-sm">
|
|
189
|
+
<Stepper value={step} aria-label="Client onboarding steps">
|
|
190
|
+
{steps.map((s, i) => (
|
|
191
|
+
<React.Fragment key={i}>
|
|
192
|
+
<StepperItem step={i + 1}>
|
|
193
|
+
<StepperIndicator />
|
|
194
|
+
<div className="mt-2 text-center">
|
|
195
|
+
<StepperTitle className="text-xs">{s.label}</StepperTitle>
|
|
196
|
+
</div>
|
|
197
|
+
</StepperItem>
|
|
198
|
+
{i < steps.length - 1 && <StepperSeparator step={i + 1} />}
|
|
199
|
+
</React.Fragment>
|
|
200
|
+
))}
|
|
201
|
+
</Stepper>
|
|
202
|
+
|
|
203
|
+
<div className="min-h-[80px]">
|
|
204
|
+
<p className="text-sm font-semibold text-foreground">{steps[step - 1].label}</p>
|
|
205
|
+
<p className="mt-1 text-sm text-muted-foreground">{steps[step - 1].desc}</p>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<div className="flex justify-between">
|
|
209
|
+
<Button
|
|
210
|
+
variant="outline"
|
|
211
|
+
size="sm"
|
|
212
|
+
disabled={step === 1}
|
|
213
|
+
onClick={() => setStep((s) => Math.max(1, s - 1))}
|
|
214
|
+
>
|
|
215
|
+
Back
|
|
216
|
+
</Button>
|
|
217
|
+
<Button
|
|
218
|
+
size="sm"
|
|
219
|
+
disabled={step === steps.length}
|
|
220
|
+
onClick={() => setStep((s) => Math.min(steps.length, s + 1))}
|
|
221
|
+
>
|
|
222
|
+
{step === steps.length ? "Done" : "Next"}
|
|
223
|
+
</Button>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Switch } from "@behavioral-agentic-design-system/core/components/ui/switch";
|
|
3
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Switch> = {
|
|
6
|
+
title: "Components/Switch",
|
|
7
|
+
component: Switch,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: () => (<div className="flex items-center gap-2">
|
|
17
|
+
<Switch id="airplane" />
|
|
18
|
+
<Label htmlFor="airplane">Airplane mode</Label>
|
|
19
|
+
</div>),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Checked: Story = {
|
|
23
|
+
render: () => (<div className="flex items-center gap-2">
|
|
24
|
+
<Switch id="checked" defaultChecked />
|
|
25
|
+
<Label htmlFor="checked">Enabled</Label>
|
|
26
|
+
</div>),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Disabled: Story = {
|
|
30
|
+
args: { disabled: true, "aria-label": "Airplane mode" } as any,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Both sizes, both states — guards the sm checked state, where the check
|
|
34
|
+
// indicator must clear the thumb rather than tuck under it.
|
|
35
|
+
export const Sizes: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<div className="flex items-center gap-8">
|
|
38
|
+
<div className="flex flex-col items-center gap-3">
|
|
39
|
+
<span className="text-xs text-muted-foreground">Default</span>
|
|
40
|
+
<Switch aria-label="Default off" />
|
|
41
|
+
<Switch aria-label="Default on" defaultChecked />
|
|
42
|
+
</div>
|
|
43
|
+
<div className="flex flex-col items-center gap-3">
|
|
44
|
+
<span className="text-xs text-muted-foreground">Small</span>
|
|
45
|
+
<Switch size="sm" aria-label="Small off" />
|
|
46
|
+
<Switch size="sm" aria-label="Small on" defaultChecked />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const RealisticUse: Story = {
|
|
53
|
+
render: () => (<div className="flex items-center gap-2">
|
|
54
|
+
<Switch id="airplane" />
|
|
55
|
+
<Label htmlFor="airplane">Airplane mode</Label>
|
|
56
|
+
</div>),
|
|
57
|
+
};
|
|
58
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@behavioral-agentic-design-system/core/components/ui/table";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Table> = {
|
|
5
|
+
title: "Components/Table",
|
|
6
|
+
component: Table,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (<Table className="w-[480px]">
|
|
16
|
+
<TableCaption>Recent invoices.</TableCaption>
|
|
17
|
+
<TableHeader>
|
|
18
|
+
<TableRow><TableHead>Invoice</TableHead><TableHead>Status</TableHead><TableHead className="text-right">Amount</TableHead></TableRow>
|
|
19
|
+
</TableHeader>
|
|
20
|
+
<TableBody>
|
|
21
|
+
<TableRow><TableCell>INV001</TableCell><TableCell>Paid</TableCell><TableCell className="text-right">$250.00</TableCell></TableRow>
|
|
22
|
+
<TableRow><TableCell>INV002</TableCell><TableCell>Pending</TableCell><TableCell className="text-right">$150.00</TableCell></TableRow>
|
|
23
|
+
</TableBody>
|
|
24
|
+
</Table>),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const RealisticUse: Story = {
|
|
28
|
+
render: () => (<Table className="w-[480px]">
|
|
29
|
+
<TableCaption>Recent invoices.</TableCaption>
|
|
30
|
+
<TableHeader>
|
|
31
|
+
<TableRow><TableHead>Invoice</TableHead><TableHead>Status</TableHead><TableHead className="text-right">Amount</TableHead></TableRow>
|
|
32
|
+
</TableHeader>
|
|
33
|
+
<TableBody>
|
|
34
|
+
<TableRow><TableCell>INV001</TableCell><TableCell>Paid</TableCell><TableCell className="text-right">$250.00</TableCell></TableRow>
|
|
35
|
+
<TableRow><TableCell>INV002</TableCell><TableCell>Pending</TableCell><TableCell className="text-right">$150.00</TableCell></TableRow>
|
|
36
|
+
</TableBody>
|
|
37
|
+
</Table>),
|
|
38
|
+
};
|