@behavioral-agentic-design-system/core 0.17.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/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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Reveal } from "@behavioral-agentic-design-system/core/components/motion/reveal";
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reveal is a scroll-driven motion wrapper, not a visual primitive: content
|
|
7
|
+
* already on screen just appears; only below-the-fold children fade + nudge in
|
|
8
|
+
* as they scroll into view, cascading with their neighbours, once. Because the
|
|
9
|
+
* motion is scroll/viewport-driven and time-based, Chromatic snapshots are
|
|
10
|
+
* disabled here (a static frame would capture an arbitrary mid-animation state).
|
|
11
|
+
* The stories document usage; the behavior is best seen live by scrolling.
|
|
12
|
+
*/
|
|
13
|
+
const meta: Meta<typeof Reveal> = {
|
|
14
|
+
title: "Motion/Reveal",
|
|
15
|
+
component: Reveal,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "fullscreen",
|
|
18
|
+
chromatic: { disableSnapshot: true },
|
|
19
|
+
},
|
|
20
|
+
tags: ["autodocs"],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
function DemoCard({ n }: { n: number }) {
|
|
27
|
+
return (
|
|
28
|
+
<Card>
|
|
29
|
+
<CardHeader>
|
|
30
|
+
<CardTitle>Card {n}</CardTitle>
|
|
31
|
+
</CardHeader>
|
|
32
|
+
<CardContent className="text-sm text-muted-foreground">
|
|
33
|
+
Scroll this card into view and it fades + settles up into place, staggered
|
|
34
|
+
with its neighbours. Cards already visible on load do not animate.
|
|
35
|
+
</CardContent>
|
|
36
|
+
</Card>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<div className="mx-auto max-w-md space-y-6 p-6">
|
|
43
|
+
{Array.from({ length: 10 }, (_, i) => (
|
|
44
|
+
<Reveal key={i}>
|
|
45
|
+
<DemoCard n={i + 1} />
|
|
46
|
+
</Reveal>
|
|
47
|
+
))}
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const RealisticUse: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<div className="mx-auto max-w-2xl space-y-6 p-6">
|
|
55
|
+
<h2 className="text-2xl font-semibold">Activity</h2>
|
|
56
|
+
{Array.from({ length: 8 }, (_, i) => (
|
|
57
|
+
<Reveal key={i}>
|
|
58
|
+
<DemoCard n={i + 1} />
|
|
59
|
+
</Reveal>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ScrollArea } from "@behavioral-agentic-design-system/core/components/ui/scroll-area";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof ScrollArea> = {
|
|
5
|
+
title: "Components/ScrollArea",
|
|
6
|
+
component: ScrollArea,
|
|
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: () => (<ScrollArea aria-label="Tags" className="h-48 w-64 rounded-md border p-3">
|
|
16
|
+
<div className="flex flex-col gap-2 text-sm">
|
|
17
|
+
{Array.from({ length: 30 }).map((_, i) => (
|
|
18
|
+
<div key={i}>Tag {i + 1}</div>
|
|
19
|
+
))}
|
|
20
|
+
</div>
|
|
21
|
+
</ScrollArea>),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const RealisticUse: Story = {
|
|
25
|
+
render: () => (<ScrollArea aria-label="Tags" className="h-48 w-64 rounded-md border p-3">
|
|
26
|
+
<div className="flex flex-col gap-2 text-sm">
|
|
27
|
+
{Array.from({ length: 30 }).map((_, i) => (
|
|
28
|
+
<div key={i}>Tag {i + 1}</div>
|
|
29
|
+
))}
|
|
30
|
+
</div>
|
|
31
|
+
</ScrollArea>),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Regression guard for the mobile horizontal-overflow fix: a long unbreakable
|
|
35
|
+
// line (a <pre> import, a wide nowrap string) must NOT make the ScrollArea
|
|
36
|
+
// balloon past its width. The viewport's content wrapper is forced to a normal
|
|
37
|
+
// full-width block so the inner overflow-x-auto element scrolls on its own
|
|
38
|
+
// instead of the whole area scrolling sideways and clipping content. The outer
|
|
39
|
+
// 16rem box should stay 16rem and the <pre> below should get its own scrollbar.
|
|
40
|
+
export const ConstrainsWideContent: Story = {
|
|
41
|
+
// Layout-stress regression guard — the test surface is the 16rem outer
|
|
42
|
+
// box and the inner <pre> scrollbar, not the rendered text's accessibility
|
|
43
|
+
// signature. The `<code>` inside `<pre>` gets `text-xs` (12px raw) so that
|
|
44
|
+
// a long code line actually overflows at typical viewport widths, which
|
|
45
|
+
// is the bug this story exists to catch. axe flags the sub-floor size on
|
|
46
|
+
// the rendered code sample — an accurate finding, but unrelated to the
|
|
47
|
+
// layout invariant we want to preserve. Disable axe per the test-runner
|
|
48
|
+
// opt-out pattern in .storybook/test-runner.ts.
|
|
49
|
+
parameters: {
|
|
50
|
+
a11y: { disable: true },
|
|
51
|
+
},
|
|
52
|
+
render: () => (
|
|
53
|
+
<ScrollArea aria-label="Code" className="h-48 w-64 rounded-md border p-3">
|
|
54
|
+
<div className="flex flex-col gap-3 text-sm">
|
|
55
|
+
<p className="text-muted-foreground">
|
|
56
|
+
The card below holds a line far wider than this 16rem area:
|
|
57
|
+
</p>
|
|
58
|
+
{/* tabIndex + role/label so this horizontally-scrollable block is
|
|
59
|
+
keyboard-reachable (axe scrollable-region-focusable, WCAG 2.1.1) —
|
|
60
|
+
an overflow-x region that isn't focusable is the violation that
|
|
61
|
+
was reding the a11y CI. */}
|
|
62
|
+
<pre
|
|
63
|
+
tabIndex={0}
|
|
64
|
+
role="region"
|
|
65
|
+
aria-label="Code snippet"
|
|
66
|
+
className="overflow-x-auto rounded-md border bg-muted p-3 font-mono text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
67
|
+
>
|
|
68
|
+
<code>{`import { Button, Card, Input, ScrollArea } from "@behavioral-agentic-design-system/core/components/ui";`}</code>
|
|
69
|
+
</pre>
|
|
70
|
+
{Array.from({ length: 12 }).map((_, i) => (
|
|
71
|
+
<div key={i}>Row {i + 1}</div>
|
|
72
|
+
))}
|
|
73
|
+
</div>
|
|
74
|
+
</ScrollArea>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
LayoutGridIcon,
|
|
5
|
+
ListIcon,
|
|
6
|
+
MapIcon,
|
|
7
|
+
CalendarIcon,
|
|
8
|
+
BarChart2Icon,
|
|
9
|
+
} from "lucide-react";
|
|
10
|
+
import {
|
|
11
|
+
SegmentedControl,
|
|
12
|
+
SegmentedControlItem,
|
|
13
|
+
} from "@behavioral-agentic-design-system/core/components/ui/segmented-control";
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof SegmentedControl> = {
|
|
16
|
+
title: "Components/SegmentedControl",
|
|
17
|
+
component: SegmentedControl,
|
|
18
|
+
parameters: { layout: "centered" },
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
size: { control: "select", options: ["sm", "default", "lg"] },
|
|
22
|
+
disabled: { control: "boolean" },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof SegmentedControl>;
|
|
28
|
+
|
|
29
|
+
// Controlled wrapper for interactive stories
|
|
30
|
+
function Controlled({
|
|
31
|
+
defaultValue,
|
|
32
|
+
size,
|
|
33
|
+
disabled,
|
|
34
|
+
children,
|
|
35
|
+
}: {
|
|
36
|
+
defaultValue: string;
|
|
37
|
+
size?: "sm" | "default" | "lg";
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
}) {
|
|
41
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
42
|
+
return (
|
|
43
|
+
<SegmentedControl value={value} onValueChange={setValue} size={size} disabled={disabled} label="Demo">
|
|
44
|
+
{children}
|
|
45
|
+
</SegmentedControl>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
render: () => (
|
|
51
|
+
<Controlled defaultValue="list">
|
|
52
|
+
<SegmentedControlItem value="list">List</SegmentedControlItem>
|
|
53
|
+
<SegmentedControlItem value="grid">Grid</SegmentedControlItem>
|
|
54
|
+
<SegmentedControlItem value="map">Map</SegmentedControlItem>
|
|
55
|
+
</Controlled>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Size_Sm: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<Controlled defaultValue="month" size="sm">
|
|
62
|
+
<SegmentedControlItem value="day">Day</SegmentedControlItem>
|
|
63
|
+
<SegmentedControlItem value="week">Week</SegmentedControlItem>
|
|
64
|
+
<SegmentedControlItem value="month">Month</SegmentedControlItem>
|
|
65
|
+
</Controlled>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Size_Default: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<Controlled defaultValue="active">
|
|
72
|
+
<SegmentedControlItem value="all">All</SegmentedControlItem>
|
|
73
|
+
<SegmentedControlItem value="active">Active</SegmentedControlItem>
|
|
74
|
+
<SegmentedControlItem value="archived">Archived</SegmentedControlItem>
|
|
75
|
+
</Controlled>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Size_Lg: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<Controlled defaultValue="quarter" size="lg">
|
|
82
|
+
<SegmentedControlItem value="month">Month</SegmentedControlItem>
|
|
83
|
+
<SegmentedControlItem value="quarter">Quarter</SegmentedControlItem>
|
|
84
|
+
<SegmentedControlItem value="year">Year</SegmentedControlItem>
|
|
85
|
+
</Controlled>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const WithIcons: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<Controlled defaultValue="grid">
|
|
92
|
+
<SegmentedControlItem value="list" icon={<ListIcon strokeWidth={1.5} />}>List</SegmentedControlItem>
|
|
93
|
+
<SegmentedControlItem value="grid" icon={<LayoutGridIcon strokeWidth={1.5} />}>Grid</SegmentedControlItem>
|
|
94
|
+
<SegmentedControlItem value="map" icon={<MapIcon strokeWidth={1.5} />}>Map</SegmentedControlItem>
|
|
95
|
+
</Controlled>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const IconOnly: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<Controlled defaultValue="chart">
|
|
102
|
+
<SegmentedControlItem value="chart" aria-label="Chart view">
|
|
103
|
+
<BarChart2Icon className="size-4" strokeWidth={1.5} />
|
|
104
|
+
</SegmentedControlItem>
|
|
105
|
+
<SegmentedControlItem value="calendar" aria-label="Calendar view">
|
|
106
|
+
<CalendarIcon className="size-4" strokeWidth={1.5} />
|
|
107
|
+
</SegmentedControlItem>
|
|
108
|
+
<SegmentedControlItem value="list" aria-label="List view">
|
|
109
|
+
<ListIcon className="size-4" strokeWidth={1.5} />
|
|
110
|
+
</SegmentedControlItem>
|
|
111
|
+
</Controlled>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Disabled: Story = {
|
|
116
|
+
render: () => (
|
|
117
|
+
<Controlled defaultValue="month" disabled>
|
|
118
|
+
<SegmentedControlItem value="day">Day</SegmentedControlItem>
|
|
119
|
+
<SegmentedControlItem value="week">Week</SegmentedControlItem>
|
|
120
|
+
<SegmentedControlItem value="month">Month</SegmentedControlItem>
|
|
121
|
+
</Controlled>
|
|
122
|
+
),
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const DisabledItem: Story = {
|
|
126
|
+
render: () => (
|
|
127
|
+
<Controlled defaultValue="list">
|
|
128
|
+
<SegmentedControlItem value="list">List</SegmentedControlItem>
|
|
129
|
+
<SegmentedControlItem value="grid">Grid</SegmentedControlItem>
|
|
130
|
+
<SegmentedControlItem value="map" disabled>Map (unavailable)</SegmentedControlItem>
|
|
131
|
+
</Controlled>
|
|
132
|
+
),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const TwoItems: Story = {
|
|
136
|
+
render: () => (
|
|
137
|
+
<Controlled defaultValue="on">
|
|
138
|
+
<SegmentedControlItem value="on">On</SegmentedControlItem>
|
|
139
|
+
<SegmentedControlItem value="off">Off</SegmentedControlItem>
|
|
140
|
+
</Controlled>
|
|
141
|
+
),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const FiveItems: Story = {
|
|
145
|
+
render: () => (
|
|
146
|
+
<Controlled defaultValue="wed">
|
|
147
|
+
<SegmentedControlItem value="mon">Mon</SegmentedControlItem>
|
|
148
|
+
<SegmentedControlItem value="tue">Tue</SegmentedControlItem>
|
|
149
|
+
<SegmentedControlItem value="wed">Wed</SegmentedControlItem>
|
|
150
|
+
<SegmentedControlItem value="thu">Thu</SegmentedControlItem>
|
|
151
|
+
<SegmentedControlItem value="fri">Fri</SegmentedControlItem>
|
|
152
|
+
</Controlled>
|
|
153
|
+
),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Realistic use: Breezy Hills Aquatic Club session view toggle
|
|
157
|
+
export const RealisticUse: Story = {
|
|
158
|
+
render: () => {
|
|
159
|
+
const [view, setView] = React.useState("upcoming");
|
|
160
|
+
return (
|
|
161
|
+
<div className="flex flex-col gap-4 w-72">
|
|
162
|
+
<div>
|
|
163
|
+
<p className="text-xs text-muted-foreground mb-2">
|
|
164
|
+
Breezy Hills Aquatic Club · Practice Sessions
|
|
165
|
+
</p>
|
|
166
|
+
<SegmentedControl
|
|
167
|
+
value={view}
|
|
168
|
+
onValueChange={setView}
|
|
169
|
+
label="Session view"
|
|
170
|
+
>
|
|
171
|
+
<SegmentedControlItem value="upcoming">Upcoming</SegmentedControlItem>
|
|
172
|
+
<SegmentedControlItem value="past">Past</SegmentedControlItem>
|
|
173
|
+
<SegmentedControlItem value="cancelled">Cancelled</SegmentedControlItem>
|
|
174
|
+
</SegmentedControl>
|
|
175
|
+
</div>
|
|
176
|
+
<p className="text-sm text-muted-foreground">
|
|
177
|
+
Showing: <span className="font-medium text-foreground capitalize">{view}</span> sessions
|
|
178
|
+
</p>
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// NOTE: this primitive now respects PortalThemeProvider — when a parent\
|
|
2
|
+
// mounts <PortalThemeProvider scope="...">, the portal'd content auto-\
|
|
3
|
+
// applies the scope class so theme-scoped CSS variables resolve inside\
|
|
4
|
+
// the portal. See components/Sheet.stories.tsx → WithPortalTheme for the\
|
|
5
|
+
// canonical demonstration. Mechanism is identical here; no separate\
|
|
6
|
+
// story added because the demo would duplicate Sheet's.
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@behavioral-agentic-design-system/core/components/ui/select";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof Select> = {
|
|
11
|
+
title: "Components/Select",
|
|
12
|
+
component: Select,
|
|
13
|
+
parameters: { layout: "centered" },
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: () => (<Select>
|
|
22
|
+
<SelectTrigger className="w-[220px]" aria-label="Pick a fruit"><SelectValue placeholder="Pick a fruit" /></SelectTrigger>
|
|
23
|
+
<SelectContent>
|
|
24
|
+
<SelectGroup>
|
|
25
|
+
<SelectLabel>Fruits</SelectLabel>
|
|
26
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
27
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
28
|
+
<SelectItem value="cherry">Cherry</SelectItem>
|
|
29
|
+
</SelectGroup>
|
|
30
|
+
</SelectContent>
|
|
31
|
+
</Select>),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Disabled: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<Select disabled>
|
|
37
|
+
<SelectTrigger className="w-[220px]" aria-label="Pick a fruit"><SelectValue placeholder="Pick a fruit" /></SelectTrigger>
|
|
38
|
+
<SelectContent>
|
|
39
|
+
<SelectGroup>
|
|
40
|
+
<SelectLabel>Fruits</SelectLabel>
|
|
41
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
42
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
43
|
+
<SelectItem value="cherry">Cherry</SelectItem>
|
|
44
|
+
</SelectGroup>
|
|
45
|
+
</SelectContent>
|
|
46
|
+
</Select>
|
|
47
|
+
),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const RealisticUse: Story = {
|
|
51
|
+
render: () => (<Select>
|
|
52
|
+
<SelectTrigger className="w-[220px]" aria-label="Pick a fruit"><SelectValue placeholder="Pick a fruit" /></SelectTrigger>
|
|
53
|
+
<SelectContent>
|
|
54
|
+
<SelectGroup>
|
|
55
|
+
<SelectLabel>Fruits</SelectLabel>
|
|
56
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
57
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
58
|
+
<SelectItem value="cherry">Cherry</SelectItem>
|
|
59
|
+
</SelectGroup>
|
|
60
|
+
</SelectContent>
|
|
61
|
+
</Select>),
|
|
62
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Separator> = {
|
|
5
|
+
title: "Components/Separator",
|
|
6
|
+
component: Separator,
|
|
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="w-[280px] space-y-3">
|
|
16
|
+
<p className="text-sm">Section one.</p>
|
|
17
|
+
<Separator />
|
|
18
|
+
<p className="text-sm">Section two.</p>
|
|
19
|
+
</div>),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const RealisticUse: Story = {
|
|
23
|
+
render: () => (<div className="w-[280px] space-y-3">
|
|
24
|
+
<p className="text-sm">Section one.</p>
|
|
25
|
+
<Separator />
|
|
26
|
+
<p className="text-sm">Section two.</p>
|
|
27
|
+
</div>),
|
|
28
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
Sheet,
|
|
4
|
+
SheetClose,
|
|
5
|
+
SheetContent,
|
|
6
|
+
SheetDescription,
|
|
7
|
+
SheetFooter,
|
|
8
|
+
SheetHeader,
|
|
9
|
+
SheetTitle,
|
|
10
|
+
SheetTrigger,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/sheet";
|
|
12
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
13
|
+
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
14
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
15
|
+
import { Textarea } from "@behavioral-agentic-design-system/core/components/ui/textarea";
|
|
16
|
+
import { Avatar, AvatarFallback } from "@behavioral-agentic-design-system/core/components/ui/avatar";
|
|
17
|
+
|
|
18
|
+
const meta: Meta<typeof Sheet> = {
|
|
19
|
+
title: "Components/Sheet",
|
|
20
|
+
component: Sheet,
|
|
21
|
+
parameters: { layout: "centered" },
|
|
22
|
+
tags: ["autodocs"],
|
|
23
|
+
// Close button matches the Dialog close: top-4 right-4, rounded-xs, 32px X
|
|
24
|
+
// glyph, opacity-70→100 hover — in a 44px hit target, on every side.
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
// Real edit-profile form so the sheet shows a finished surface rather than an
|
|
31
|
+
// empty panel. Content comes from the BADS persona pool (content/personas/
|
|
32
|
+
// bads.json) — never placeholder. The body scrolls independently; the footer
|
|
33
|
+
// sticks to the bottom via SheetFooter's mt-auto.
|
|
34
|
+
function EditProfileSheet({ withBio = false }: { withBio?: boolean }) {
|
|
35
|
+
return (
|
|
36
|
+
<Sheet>
|
|
37
|
+
<SheetTrigger asChild>
|
|
38
|
+
<Button variant="outline">Edit profile</Button>
|
|
39
|
+
</SheetTrigger>
|
|
40
|
+
<SheetContent>
|
|
41
|
+
<SheetHeader>
|
|
42
|
+
<SheetTitle>Edit profile</SheetTitle>
|
|
43
|
+
<SheetDescription>
|
|
44
|
+
Update your account details. Changes save when you select Save.
|
|
45
|
+
</SheetDescription>
|
|
46
|
+
</SheetHeader>
|
|
47
|
+
|
|
48
|
+
<div className="flex flex-1 flex-col gap-6 overflow-y-auto px-4">
|
|
49
|
+
{withBio && (
|
|
50
|
+
<div className="flex items-center gap-3">
|
|
51
|
+
<Avatar className="size-12">
|
|
52
|
+
<AvatarFallback>JR</AvatarFallback>
|
|
53
|
+
</Avatar>
|
|
54
|
+
<div className="flex min-w-0 flex-col">
|
|
55
|
+
<span className="truncate text-sm font-medium">Jordan Reeves</span>
|
|
56
|
+
<span className="truncate text-sm text-muted-foreground">
|
|
57
|
+
Design Systems Lead
|
|
58
|
+
</span>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
|
|
63
|
+
<div className="flex flex-col gap-3">
|
|
64
|
+
<Label htmlFor="profile-name">Full name</Label>
|
|
65
|
+
<Input id="profile-name" defaultValue="Jordan Reeves" />
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className="flex flex-col gap-3">
|
|
69
|
+
<Label htmlFor="profile-username">Username</Label>
|
|
70
|
+
<Input id="profile-username" defaultValue="jordan.reeves" />
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div className="flex flex-col gap-3">
|
|
74
|
+
<Label htmlFor="profile-email">Email</Label>
|
|
75
|
+
<Input id="profile-email" type="email" defaultValue="jordan@reeves.design" />
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{withBio && (
|
|
79
|
+
<div className="flex flex-col gap-3">
|
|
80
|
+
<Label htmlFor="profile-bio">Bio</Label>
|
|
81
|
+
<Textarea
|
|
82
|
+
id="profile-bio"
|
|
83
|
+
rows={3}
|
|
84
|
+
defaultValue="Design systems lead. I build accessible component libraries and keep an eye on token drift across forks."
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<SheetFooter>
|
|
91
|
+
<Button type="submit">Save changes</Button>
|
|
92
|
+
<SheetClose asChild>
|
|
93
|
+
<Button variant="outline">Cancel</Button>
|
|
94
|
+
</SheetClose>
|
|
95
|
+
</SheetFooter>
|
|
96
|
+
</SheetContent>
|
|
97
|
+
</Sheet>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const Default: Story = {
|
|
102
|
+
render: () => <EditProfileSheet />,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const RealisticUse: Story = {
|
|
106
|
+
render: () => <EditProfileSheet withBio />,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// side="bottom" is the canonical bottom sheet (this absorbed the former
|
|
110
|
+
// standalone BottomSheet primitive). It picks up the rounded top, grab handle,
|
|
111
|
+
// 85svh cap + internal scroll, and safe-area padding automatically.
|
|
112
|
+
export const Side_Bottom: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<Sheet>
|
|
115
|
+
<SheetTrigger asChild>
|
|
116
|
+
<Button variant="outline">Open bottom sheet</Button>
|
|
117
|
+
</SheetTrigger>
|
|
118
|
+
<SheetContent side="bottom">
|
|
119
|
+
<SheetHeader>
|
|
120
|
+
<SheetTitle>Display density</SheetTitle>
|
|
121
|
+
<SheetDescription>
|
|
122
|
+
Choose how much information shows on each row.
|
|
123
|
+
</SheetDescription>
|
|
124
|
+
</SheetHeader>
|
|
125
|
+
<SheetFooter className="flex-row justify-end gap-2">
|
|
126
|
+
<SheetClose asChild>
|
|
127
|
+
<Button variant="ghost">Cancel</Button>
|
|
128
|
+
</SheetClose>
|
|
129
|
+
<SheetClose asChild>
|
|
130
|
+
<Button>Apply</Button>
|
|
131
|
+
</SheetClose>
|
|
132
|
+
</SheetFooter>
|
|
133
|
+
</SheetContent>
|
|
134
|
+
</Sheet>
|
|
135
|
+
),
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Same bottom sheet with the grab handle hidden via showHandle={false}.
|
|
139
|
+
export const Side_Bottom_NoHandle: Story = {
|
|
140
|
+
render: () => (
|
|
141
|
+
<Sheet>
|
|
142
|
+
<SheetTrigger asChild>
|
|
143
|
+
<Button variant="outline">Bottom sheet, no handle</Button>
|
|
144
|
+
</SheetTrigger>
|
|
145
|
+
<SheetContent side="bottom" showHandle={false}>
|
|
146
|
+
<SheetHeader>
|
|
147
|
+
<SheetTitle>No grab handle</SheetTitle>
|
|
148
|
+
<SheetDescription>
|
|
149
|
+
The decorative grab handle is hidden via showHandle={"{false}"}.
|
|
150
|
+
</SheetDescription>
|
|
151
|
+
</SheetHeader>
|
|
152
|
+
</SheetContent>
|
|
153
|
+
</Sheet>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Demonstrates the use-portal-theme-class mechanism: SheetContent
|
|
158
|
+
// auto-mirrors the active PortalThemeProvider scope class onto its
|
|
159
|
+
// rendered portal node, so theme-scoped CSS variables resolve inside
|
|
160
|
+
// the portal. Same mechanism applies to Dialog / Popover / Tooltip /
|
|
161
|
+
// DropdownMenu / Select.
|
|
162
|
+
//
|
|
163
|
+
// In a real app, PortalThemeProvider wraps the whole tree once near
|
|
164
|
+
// the root (typically next to your ThemeProvider). Mounting it inline
|
|
165
|
+
// here demonstrates the cause and effect without depending on
|
|
166
|
+
// repository-level theme classes.
|
|
167
|
+
export const WithPortalTheme: Story = {
|
|
168
|
+
render: () => {
|
|
169
|
+
const { PortalThemeProvider } =
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
171
|
+
require("@behavioral-agentic-design-system/core/hooks/use-portal-theme-class");
|
|
172
|
+
return (
|
|
173
|
+
<PortalThemeProvider scope="dark">
|
|
174
|
+
<Sheet>
|
|
175
|
+
<SheetTrigger asChild>
|
|
176
|
+
<Button variant="outline">Open sheet (dark portal)</Button>
|
|
177
|
+
</SheetTrigger>
|
|
178
|
+
<SheetContent>
|
|
179
|
+
<SheetHeader>
|
|
180
|
+
<SheetTitle>Themed via context</SheetTitle>
|
|
181
|
+
<SheetDescription>
|
|
182
|
+
This SheetContent picks up the "dark" scope class via
|
|
183
|
+
PortalThemeProvider — even though Radix portals it to
|
|
184
|
+
<body>, outside the React DOM tree where the provider
|
|
185
|
+
was mounted. React context crosses portals.
|
|
186
|
+
</SheetDescription>
|
|
187
|
+
</SheetHeader>
|
|
188
|
+
</SheetContent>
|
|
189
|
+
</Sheet>
|
|
190
|
+
</PortalThemeProvider>
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Sidebar sticky container gained `h-svh` so the bg always spans the
|
|
2
|
+
// viewport even when the menu is shorter than the screen. No new variants
|
|
3
|
+
// or sizes — existing story matrix still covers the change.
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "@behavioral-agentic-design-system/core/components/ui/sidebar";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Sidebar> = {
|
|
8
|
+
title: "Components/Sidebar",
|
|
9
|
+
component: Sidebar,
|
|
10
|
+
parameters: { layout: "centered" },
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
render: () => (<SidebarProvider>
|
|
19
|
+
<Sidebar className="h-[320px] w-[240px]">
|
|
20
|
+
<SidebarContent>
|
|
21
|
+
<SidebarGroup>
|
|
22
|
+
<SidebarGroupLabel>Workspace</SidebarGroupLabel>
|
|
23
|
+
<SidebarGroupContent>
|
|
24
|
+
<SidebarMenu>
|
|
25
|
+
<SidebarMenuItem><SidebarMenuButton>Inbox</SidebarMenuButton></SidebarMenuItem>
|
|
26
|
+
<SidebarMenuItem><SidebarMenuButton>Drafts</SidebarMenuButton></SidebarMenuItem>
|
|
27
|
+
<SidebarMenuItem><SidebarMenuButton>Sent</SidebarMenuButton></SidebarMenuItem>
|
|
28
|
+
</SidebarMenu>
|
|
29
|
+
</SidebarGroupContent>
|
|
30
|
+
</SidebarGroup>
|
|
31
|
+
</SidebarContent>
|
|
32
|
+
</Sidebar>
|
|
33
|
+
</SidebarProvider>),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const RealisticUse: Story = {
|
|
37
|
+
render: () => (<SidebarProvider>
|
|
38
|
+
<Sidebar className="h-[320px] w-[240px]">
|
|
39
|
+
<SidebarContent>
|
|
40
|
+
<SidebarGroup>
|
|
41
|
+
<SidebarGroupLabel>Workspace</SidebarGroupLabel>
|
|
42
|
+
<SidebarGroupContent>
|
|
43
|
+
<SidebarMenu>
|
|
44
|
+
<SidebarMenuItem><SidebarMenuButton>Inbox</SidebarMenuButton></SidebarMenuItem>
|
|
45
|
+
<SidebarMenuItem><SidebarMenuButton>Drafts</SidebarMenuButton></SidebarMenuItem>
|
|
46
|
+
<SidebarMenuItem><SidebarMenuButton>Sent</SidebarMenuButton></SidebarMenuItem>
|
|
47
|
+
</SidebarMenu>
|
|
48
|
+
</SidebarGroupContent>
|
|
49
|
+
</SidebarGroup>
|
|
50
|
+
</SidebarContent>
|
|
51
|
+
</Sidebar>
|
|
52
|
+
</SidebarProvider>),
|
|
53
|
+
};
|