@behavioral-agentic-design-system/core 0.17.0 → 0.19.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 +119 -98
- package/src/components/ui/color-picker.tsx +318 -9
- 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 +186 -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,293 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
ContextMenu,
|
|
4
|
+
ContextMenuTrigger,
|
|
5
|
+
ContextMenuContent,
|
|
6
|
+
ContextMenuItem,
|
|
7
|
+
ContextMenuCheckboxItem,
|
|
8
|
+
ContextMenuRadioGroup,
|
|
9
|
+
ContextMenuRadioItem,
|
|
10
|
+
ContextMenuLabel,
|
|
11
|
+
ContextMenuSeparator,
|
|
12
|
+
ContextMenuShortcut,
|
|
13
|
+
ContextMenuSub,
|
|
14
|
+
ContextMenuSubTrigger,
|
|
15
|
+
ContextMenuSubContent,
|
|
16
|
+
ContextMenuGroup,
|
|
17
|
+
} from "@behavioral-agentic-design-system/core/components/ui/context-menu";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
|
|
20
|
+
const meta: Meta<typeof ContextMenu> = {
|
|
21
|
+
title: "Components/ContextMenu",
|
|
22
|
+
component: ContextMenu,
|
|
23
|
+
parameters: { layout: "centered" },
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
const TriggerZone = ({ label = "Right-click here" }: { label?: string }) => (
|
|
31
|
+
<div className="flex h-36 w-72 items-center justify-center rounded-md border border-dashed border-border bg-muted/40 text-sm text-muted-foreground select-none">
|
|
32
|
+
{label}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<ContextMenu>
|
|
39
|
+
<ContextMenuTrigger>
|
|
40
|
+
<TriggerZone />
|
|
41
|
+
</ContextMenuTrigger>
|
|
42
|
+
<ContextMenuContent>
|
|
43
|
+
<ContextMenuItem>Back</ContextMenuItem>
|
|
44
|
+
<ContextMenuItem>Forward</ContextMenuItem>
|
|
45
|
+
<ContextMenuItem>Reload</ContextMenuItem>
|
|
46
|
+
<ContextMenuSeparator />
|
|
47
|
+
<ContextMenuItem>Save page as…</ContextMenuItem>
|
|
48
|
+
<ContextMenuItem>Print…</ContextMenuItem>
|
|
49
|
+
</ContextMenuContent>
|
|
50
|
+
</ContextMenu>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const WithShortcuts: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<ContextMenu>
|
|
57
|
+
<ContextMenuTrigger>
|
|
58
|
+
<TriggerZone label="Right-click for edit actions" />
|
|
59
|
+
</ContextMenuTrigger>
|
|
60
|
+
<ContextMenuContent className="w-52">
|
|
61
|
+
<ContextMenuItem>
|
|
62
|
+
Cut <ContextMenuShortcut>⌘X</ContextMenuShortcut>
|
|
63
|
+
</ContextMenuItem>
|
|
64
|
+
<ContextMenuItem>
|
|
65
|
+
Copy <ContextMenuShortcut>⌘C</ContextMenuShortcut>
|
|
66
|
+
</ContextMenuItem>
|
|
67
|
+
<ContextMenuItem>
|
|
68
|
+
Paste <ContextMenuShortcut>⌘V</ContextMenuShortcut>
|
|
69
|
+
</ContextMenuItem>
|
|
70
|
+
<ContextMenuSeparator />
|
|
71
|
+
<ContextMenuItem>
|
|
72
|
+
Select all <ContextMenuShortcut>⌘A</ContextMenuShortcut>
|
|
73
|
+
</ContextMenuItem>
|
|
74
|
+
</ContextMenuContent>
|
|
75
|
+
</ContextMenu>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const WithLabel: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<ContextMenu>
|
|
82
|
+
<ContextMenuTrigger>
|
|
83
|
+
<TriggerZone label="Right-click — labeled groups" />
|
|
84
|
+
</ContextMenuTrigger>
|
|
85
|
+
<ContextMenuContent className="w-56">
|
|
86
|
+
<ContextMenuLabel>View</ContextMenuLabel>
|
|
87
|
+
<ContextMenuItem>Zoom in</ContextMenuItem>
|
|
88
|
+
<ContextMenuItem>Zoom out</ContextMenuItem>
|
|
89
|
+
<ContextMenuSeparator />
|
|
90
|
+
<ContextMenuLabel>Actions</ContextMenuLabel>
|
|
91
|
+
<ContextMenuItem>Duplicate</ContextMenuItem>
|
|
92
|
+
<ContextMenuItem>Export</ContextMenuItem>
|
|
93
|
+
<ContextMenuSeparator />
|
|
94
|
+
<ContextMenuItem variant="destructive">Delete</ContextMenuItem>
|
|
95
|
+
</ContextMenuContent>
|
|
96
|
+
</ContextMenu>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const WithDestructive: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<ContextMenu>
|
|
103
|
+
<ContextMenuTrigger>
|
|
104
|
+
<TriggerZone label="Right-click — destructive item" />
|
|
105
|
+
</ContextMenuTrigger>
|
|
106
|
+
<ContextMenuContent className="w-48">
|
|
107
|
+
<ContextMenuItem>Rename</ContextMenuItem>
|
|
108
|
+
<ContextMenuItem>Duplicate</ContextMenuItem>
|
|
109
|
+
<ContextMenuSeparator />
|
|
110
|
+
<ContextMenuItem variant="destructive">Delete</ContextMenuItem>
|
|
111
|
+
</ContextMenuContent>
|
|
112
|
+
</ContextMenu>
|
|
113
|
+
),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const WithCheckboxItems: Story = {
|
|
117
|
+
render: () => {
|
|
118
|
+
const [showGrid, setShowGrid] = useState(true);
|
|
119
|
+
const [showRulers, setShowRulers] = useState(false);
|
|
120
|
+
const [showGuides, setShowGuides] = useState(true);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<ContextMenu>
|
|
124
|
+
<ContextMenuTrigger>
|
|
125
|
+
<TriggerZone label="Right-click — checkbox items" />
|
|
126
|
+
</ContextMenuTrigger>
|
|
127
|
+
<ContextMenuContent className="w-48">
|
|
128
|
+
<ContextMenuLabel>Show</ContextMenuLabel>
|
|
129
|
+
<ContextMenuSeparator />
|
|
130
|
+
<ContextMenuCheckboxItem
|
|
131
|
+
checked={showGrid}
|
|
132
|
+
onCheckedChange={setShowGrid}
|
|
133
|
+
>
|
|
134
|
+
Grid
|
|
135
|
+
</ContextMenuCheckboxItem>
|
|
136
|
+
<ContextMenuCheckboxItem
|
|
137
|
+
checked={showRulers}
|
|
138
|
+
onCheckedChange={setShowRulers}
|
|
139
|
+
>
|
|
140
|
+
Rulers
|
|
141
|
+
</ContextMenuCheckboxItem>
|
|
142
|
+
<ContextMenuCheckboxItem
|
|
143
|
+
checked={showGuides}
|
|
144
|
+
onCheckedChange={setShowGuides}
|
|
145
|
+
>
|
|
146
|
+
Guides
|
|
147
|
+
</ContextMenuCheckboxItem>
|
|
148
|
+
</ContextMenuContent>
|
|
149
|
+
</ContextMenu>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const WithRadioItems: Story = {
|
|
155
|
+
render: () => {
|
|
156
|
+
const [theme, setTheme] = useState("system");
|
|
157
|
+
return (
|
|
158
|
+
<ContextMenu>
|
|
159
|
+
<ContextMenuTrigger>
|
|
160
|
+
<TriggerZone label="Right-click — radio items" />
|
|
161
|
+
</ContextMenuTrigger>
|
|
162
|
+
<ContextMenuContent className="w-48">
|
|
163
|
+
<ContextMenuLabel>Theme</ContextMenuLabel>
|
|
164
|
+
<ContextMenuSeparator />
|
|
165
|
+
<ContextMenuRadioGroup value={theme} onValueChange={setTheme}>
|
|
166
|
+
<ContextMenuRadioItem value="light">Light</ContextMenuRadioItem>
|
|
167
|
+
<ContextMenuRadioItem value="dark">Dark</ContextMenuRadioItem>
|
|
168
|
+
<ContextMenuRadioItem value="system">System</ContextMenuRadioItem>
|
|
169
|
+
</ContextMenuRadioGroup>
|
|
170
|
+
</ContextMenuContent>
|
|
171
|
+
</ContextMenu>
|
|
172
|
+
);
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const WithSubMenu: Story = {
|
|
177
|
+
render: () => (
|
|
178
|
+
<ContextMenu>
|
|
179
|
+
<ContextMenuTrigger>
|
|
180
|
+
<TriggerZone label="Right-click — sub-menu" />
|
|
181
|
+
</ContextMenuTrigger>
|
|
182
|
+
<ContextMenuContent className="w-52">
|
|
183
|
+
<ContextMenuItem>
|
|
184
|
+
Open <ContextMenuShortcut>⌘O</ContextMenuShortcut>
|
|
185
|
+
</ContextMenuItem>
|
|
186
|
+
<ContextMenuItem>
|
|
187
|
+
Open in new tab <ContextMenuShortcut>⌘⇧O</ContextMenuShortcut>
|
|
188
|
+
</ContextMenuItem>
|
|
189
|
+
<ContextMenuSeparator />
|
|
190
|
+
<ContextMenuSub>
|
|
191
|
+
<ContextMenuSubTrigger>Share</ContextMenuSubTrigger>
|
|
192
|
+
<ContextMenuSubContent className="w-44">
|
|
193
|
+
<ContextMenuItem>Email link</ContextMenuItem>
|
|
194
|
+
<ContextMenuItem>Copy link</ContextMenuItem>
|
|
195
|
+
<ContextMenuSeparator />
|
|
196
|
+
<ContextMenuItem>Messages</ContextMenuItem>
|
|
197
|
+
<ContextMenuItem>Notes</ContextMenuItem>
|
|
198
|
+
</ContextMenuSubContent>
|
|
199
|
+
</ContextMenuSub>
|
|
200
|
+
<ContextMenuSeparator />
|
|
201
|
+
<ContextMenuItem variant="destructive">Move to trash</ContextMenuItem>
|
|
202
|
+
</ContextMenuContent>
|
|
203
|
+
</ContextMenu>
|
|
204
|
+
),
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const WithDisabledItems: Story = {
|
|
208
|
+
render: () => (
|
|
209
|
+
<ContextMenu>
|
|
210
|
+
<ContextMenuTrigger>
|
|
211
|
+
<TriggerZone label="Right-click — disabled items" />
|
|
212
|
+
</ContextMenuTrigger>
|
|
213
|
+
<ContextMenuContent className="w-48">
|
|
214
|
+
<ContextMenuItem>Undo</ContextMenuItem>
|
|
215
|
+
<ContextMenuItem disabled>
|
|
216
|
+
Redo <ContextMenuShortcut>⌘⇧Z</ContextMenuShortcut>
|
|
217
|
+
</ContextMenuItem>
|
|
218
|
+
<ContextMenuSeparator />
|
|
219
|
+
<ContextMenuItem>Copy</ContextMenuItem>
|
|
220
|
+
<ContextMenuItem disabled>Paste</ContextMenuItem>
|
|
221
|
+
</ContextMenuContent>
|
|
222
|
+
</ContextMenu>
|
|
223
|
+
),
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const RealisticUse: Story = {
|
|
227
|
+
render: () => {
|
|
228
|
+
const [starred, setStarred] = useState(false);
|
|
229
|
+
const [view, setView] = useState("grid");
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div className="flex flex-col gap-4">
|
|
233
|
+
<p className="text-xs text-muted-foreground">
|
|
234
|
+
File manager — right-click a file
|
|
235
|
+
</p>
|
|
236
|
+
<ContextMenu>
|
|
237
|
+
<ContextMenuTrigger>
|
|
238
|
+
<div className="flex items-center gap-3 rounded-md border bg-card p-3 shadow-sm transition-colors hover:bg-accent/40 select-none w-72">
|
|
239
|
+
<div className="flex size-10 items-center justify-center rounded-md bg-primary/10 text-primary text-lg font-semibold">
|
|
240
|
+
🎨
|
|
241
|
+
</div>
|
|
242
|
+
<div className="min-w-0 flex-1">
|
|
243
|
+
<p className="truncate text-sm font-medium">brand-tokens.json</p>
|
|
244
|
+
<p className="text-xs text-muted-foreground">14 KB · Modified today</p>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</ContextMenuTrigger>
|
|
248
|
+
<ContextMenuContent className="w-52">
|
|
249
|
+
<ContextMenuLabel>brand-tokens.json</ContextMenuLabel>
|
|
250
|
+
<ContextMenuSeparator />
|
|
251
|
+
<ContextMenuItem>
|
|
252
|
+
Open <ContextMenuShortcut>↵</ContextMenuShortcut>
|
|
253
|
+
</ContextMenuItem>
|
|
254
|
+
<ContextMenuItem>Open with…</ContextMenuItem>
|
|
255
|
+
<ContextMenuSeparator />
|
|
256
|
+
<ContextMenuGroup>
|
|
257
|
+
<ContextMenuCheckboxItem
|
|
258
|
+
checked={starred}
|
|
259
|
+
onCheckedChange={setStarred}
|
|
260
|
+
>
|
|
261
|
+
Star
|
|
262
|
+
</ContextMenuCheckboxItem>
|
|
263
|
+
</ContextMenuGroup>
|
|
264
|
+
<ContextMenuSeparator />
|
|
265
|
+
<ContextMenuSub>
|
|
266
|
+
<ContextMenuSubTrigger>Share</ContextMenuSubTrigger>
|
|
267
|
+
<ContextMenuSubContent className="w-40">
|
|
268
|
+
<ContextMenuItem>Copy link</ContextMenuItem>
|
|
269
|
+
<ContextMenuItem>Email</ContextMenuItem>
|
|
270
|
+
<ContextMenuSeparator />
|
|
271
|
+
<ContextMenuRadioGroup value={view} onValueChange={setView}>
|
|
272
|
+
<ContextMenuLabel inset>Access</ContextMenuLabel>
|
|
273
|
+
<ContextMenuRadioItem value="view">View only</ContextMenuRadioItem>
|
|
274
|
+
<ContextMenuRadioItem value="grid">Can edit</ContextMenuRadioItem>
|
|
275
|
+
</ContextMenuRadioGroup>
|
|
276
|
+
</ContextMenuSubContent>
|
|
277
|
+
</ContextMenuSub>
|
|
278
|
+
<ContextMenuItem>
|
|
279
|
+
Duplicate <ContextMenuShortcut>⌘D</ContextMenuShortcut>
|
|
280
|
+
</ContextMenuItem>
|
|
281
|
+
<ContextMenuSeparator />
|
|
282
|
+
<ContextMenuItem>
|
|
283
|
+
Rename <ContextMenuShortcut>↵</ContextMenuShortcut>
|
|
284
|
+
</ContextMenuItem>
|
|
285
|
+
<ContextMenuItem variant="destructive">
|
|
286
|
+
Delete <ContextMenuShortcut>⌫</ContextMenuShortcut>
|
|
287
|
+
</ContextMenuItem>
|
|
288
|
+
</ContextMenuContent>
|
|
289
|
+
</ContextMenu>
|
|
290
|
+
</div>
|
|
291
|
+
);
|
|
292
|
+
},
|
|
293
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof CopyButton> = {
|
|
6
|
+
title: "Components/CopyButton",
|
|
7
|
+
component: CopyButton,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"Button that copies a string to the clipboard. Idle → Copied state swap via opacity + scale transition (var(--duration-fast) + var(--ease-out)). Announces 'Copied to clipboard' via aria-live=polite. Icon-only mode requires aria-label. Gracefully falls back to document.execCommand in non-secure contexts. Not a form submit — always type=button via Button primitive.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof CopyButton>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<CopyButton value="hello@example.com">Copy email</CopyButton>
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Variant_Outline: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<CopyButton value="npm install @behavioral-agentic-design-system/core" variant="outline">
|
|
30
|
+
Copy install command
|
|
31
|
+
</CopyButton>
|
|
32
|
+
),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Variant_Ghost: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<CopyButton value="sk-proj-abc123xyz" variant="ghost">
|
|
38
|
+
Copy API key
|
|
39
|
+
</CopyButton>
|
|
40
|
+
),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Variant_Secondary: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<CopyButton value="https://example.com/share/abc123" variant="secondary">
|
|
46
|
+
Copy link
|
|
47
|
+
</CopyButton>
|
|
48
|
+
),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Size_Sm: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<CopyButton value="small value" size="sm">Copy</CopyButton>
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Size_Default: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<CopyButton value="default value" size="default">Copy</CopyButton>
|
|
60
|
+
),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Size_Lg: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<CopyButton value="large value" size="lg">Copy</CopyButton>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const IconOnly: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<CopyButton value="sk-proj-abc123xyz" size="icon" aria-label="Copy API key" />
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const IconOnly_Sm: Story = {
|
|
76
|
+
render: () => (
|
|
77
|
+
<CopyButton value="abc123" size="icon-sm" aria-label="Copy token" />
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const Disabled: Story = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<CopyButton value="disabled" disabled>Copy</CopyButton>
|
|
84
|
+
),
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const RealisticUse: Story = {
|
|
88
|
+
render: () => {
|
|
89
|
+
const apiKey = "sk-proj-Xk9mNpQ2vR7tLwYjAb4cDeFgHiJkLmNo" // gitleaks:allow
|
|
90
|
+
return (
|
|
91
|
+
<div className="flex w-full max-w-sm items-center gap-2 rounded-md border bg-muted px-3 py-2">
|
|
92
|
+
<code className="flex-1 truncate text-xs font-mono text-muted-foreground">
|
|
93
|
+
{apiKey}
|
|
94
|
+
</code>
|
|
95
|
+
<CopyButton value={apiKey} size="icon-sm" variant="ghost" aria-label="Copy API key" />
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const AllVariants: Story = {
|
|
102
|
+
render: () => (
|
|
103
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
104
|
+
<CopyButton value="default" variant="default">Default</CopyButton>
|
|
105
|
+
<CopyButton value="outline" variant="outline">Outline</CopyButton>
|
|
106
|
+
<CopyButton value="secondary" variant="secondary">Secondary</CopyButton>
|
|
107
|
+
<CopyButton value="ghost" variant="ghost">Ghost</CopyButton>
|
|
108
|
+
</div>
|
|
109
|
+
),
|
|
110
|
+
}
|
|
111
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { DatePicker } from "@behavioral-agentic-design-system/core/components/ui/date-picker";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DatePicker> = {
|
|
6
|
+
title: "Components/DatePicker",
|
|
7
|
+
component: DatePicker,
|
|
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: () => {
|
|
17
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
18
|
+
return (
|
|
19
|
+
<div className="w-[280px]">
|
|
20
|
+
<DatePicker
|
|
21
|
+
value={date}
|
|
22
|
+
onValueChange={setDate}
|
|
23
|
+
placeholder="Pick a date"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Size_Small: Story = {
|
|
31
|
+
render: () => {
|
|
32
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
33
|
+
return (
|
|
34
|
+
<div className="w-[240px]">
|
|
35
|
+
<DatePicker size="sm" value={date} onValueChange={setDate} />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Size_Default: Story = {
|
|
42
|
+
render: () => {
|
|
43
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
44
|
+
return (
|
|
45
|
+
<div className="w-[280px]">
|
|
46
|
+
<DatePicker size="default" value={date} onValueChange={setDate} />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Size_Large: Story = {
|
|
53
|
+
render: () => {
|
|
54
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
55
|
+
return (
|
|
56
|
+
<div className="w-[300px]">
|
|
57
|
+
<DatePicker size="lg" value={date} onValueChange={setDate} />
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Variant_Clearable: Story = {
|
|
64
|
+
render: () => {
|
|
65
|
+
const [date, setDate] = React.useState<Date | undefined>(
|
|
66
|
+
new Date("2026-08-15")
|
|
67
|
+
);
|
|
68
|
+
return (
|
|
69
|
+
<div className="w-[280px]">
|
|
70
|
+
<DatePicker
|
|
71
|
+
value={date}
|
|
72
|
+
onValueChange={setDate}
|
|
73
|
+
clearable
|
|
74
|
+
placeholder="Choose date"
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Variant_Clearable_Empty: Story = {
|
|
82
|
+
render: () => {
|
|
83
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
84
|
+
return (
|
|
85
|
+
<div className="w-[280px] space-y-1.5">
|
|
86
|
+
<p className="text-xs text-muted-foreground">No date selected — clear button not shown</p>
|
|
87
|
+
<DatePicker
|
|
88
|
+
value={date}
|
|
89
|
+
onValueChange={setDate}
|
|
90
|
+
clearable
|
|
91
|
+
placeholder="Choose date"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Variant_WithBounds: Story = {
|
|
99
|
+
render: () => {
|
|
100
|
+
const [date, setDate] = React.useState<Date | undefined>(undefined);
|
|
101
|
+
const today = new Date();
|
|
102
|
+
const nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
|
|
103
|
+
return (
|
|
104
|
+
<div className="w-[280px] space-y-2">
|
|
105
|
+
<p className="text-sm text-muted-foreground">From today, next 30 days only</p>
|
|
106
|
+
<DatePicker
|
|
107
|
+
value={date}
|
|
108
|
+
onValueChange={setDate}
|
|
109
|
+
fromDate={today}
|
|
110
|
+
toDate={nextMonth}
|
|
111
|
+
placeholder="Select a date"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const Disabled: Story = {
|
|
119
|
+
render: () => (
|
|
120
|
+
<div className="w-[280px]">
|
|
121
|
+
<DatePicker
|
|
122
|
+
disabled
|
|
123
|
+
value={new Date("2026-06-15")}
|
|
124
|
+
placeholder="Pick a date"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const RealisticUse: Story = {
|
|
131
|
+
render: () => {
|
|
132
|
+
const [startDate, setStartDate] = React.useState<Date | undefined>(undefined);
|
|
133
|
+
const [endDate, setEndDate] = React.useState<Date | undefined>(undefined);
|
|
134
|
+
return (
|
|
135
|
+
<div className="w-[320px] space-y-4 rounded-lg border border-border bg-card p-4">
|
|
136
|
+
<div className="space-y-1">
|
|
137
|
+
<p className="text-sm font-semibold">Schedule practice</p>
|
|
138
|
+
<p className="text-xs text-muted-foreground">
|
|
139
|
+
Choose start and end dates for the practice block
|
|
140
|
+
</p>
|
|
141
|
+
</div>
|
|
142
|
+
<div className="space-y-3">
|
|
143
|
+
<div className="space-y-1.5">
|
|
144
|
+
<label className="text-sm font-medium">Start date</label>
|
|
145
|
+
<DatePicker
|
|
146
|
+
value={startDate}
|
|
147
|
+
onValueChange={setStartDate}
|
|
148
|
+
placeholder="Pick start date"
|
|
149
|
+
clearable
|
|
150
|
+
toDate={endDate}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
<div className="space-y-1.5">
|
|
154
|
+
<label className="text-sm font-medium">End date</label>
|
|
155
|
+
<DatePicker
|
|
156
|
+
value={endDate}
|
|
157
|
+
onValueChange={setEndDate}
|
|
158
|
+
placeholder="Pick end date"
|
|
159
|
+
clearable
|
|
160
|
+
fromDate={startDate}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
<div className="flex justify-end">
|
|
165
|
+
<button
|
|
166
|
+
type="button"
|
|
167
|
+
className="rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground min-h-11 px-4"
|
|
168
|
+
onClick={() => {}}
|
|
169
|
+
>
|
|
170
|
+
Schedule
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import {
|
|
4
|
+
DateRangePicker,
|
|
5
|
+
DateRangeValue,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/date-range-picker"
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof DateRangePicker> = {
|
|
9
|
+
title: "Components/DateRangePicker",
|
|
10
|
+
component: DateRangePicker,
|
|
11
|
+
parameters: { layout: "centered" },
|
|
12
|
+
}
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof DateRangePicker>
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
value: {
|
|
19
|
+
from: new Date(2026, 5, 1),
|
|
20
|
+
to: new Date(2026, 5, 15),
|
|
21
|
+
},
|
|
22
|
+
size: "default",
|
|
23
|
+
},
|
|
24
|
+
render: (args) => (
|
|
25
|
+
<div className="w-96">
|
|
26
|
+
<DateRangePicker {...args} />
|
|
27
|
+
</div>
|
|
28
|
+
),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Clearable: Story = {
|
|
32
|
+
render: () => {
|
|
33
|
+
const [range, setRange] = React.useState<DateRangeValue | undefined>({
|
|
34
|
+
from: new Date(2026, 5, 10),
|
|
35
|
+
to: new Date(2026, 5, 20),
|
|
36
|
+
})
|
|
37
|
+
return (
|
|
38
|
+
<div className="w-96">
|
|
39
|
+
<DateRangePicker value={range} onValueChange={setRange} clearable />
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Sizes: Story = {
|
|
46
|
+
render: () => {
|
|
47
|
+
const range = { from: new Date(2026, 5, 1), to: new Date(2026, 5, 15) }
|
|
48
|
+
return (
|
|
49
|
+
<div className="flex flex-col gap-3 w-96">
|
|
50
|
+
<DateRangePicker value={range} size="sm" />
|
|
51
|
+
<DateRangePicker value={range} size="default" />
|
|
52
|
+
<DateRangePicker value={range} size="lg" />
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Empty: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<div className="w-96">
|
|
61
|
+
<DateRangePicker size="default" />
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Disabled: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<div className="w-96">
|
|
69
|
+
<DateRangePicker
|
|
70
|
+
value={{ from: new Date(2026, 5, 1), to: new Date(2026, 5, 15) }}
|
|
71
|
+
disabled
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const RealisticUse: Story = {
|
|
78
|
+
render: () => {
|
|
79
|
+
const [range, setRange] = React.useState<DateRangeValue | undefined>()
|
|
80
|
+
return (
|
|
81
|
+
<div className="flex flex-col gap-2 w-96">
|
|
82
|
+
<label className="text-sm font-medium">Trip dates</label>
|
|
83
|
+
<DateRangePicker value={range} onValueChange={setRange} clearable />
|
|
84
|
+
{range?.from && range?.to && (
|
|
85
|
+
<p className="text-xs text-muted-foreground">
|
|
86
|
+
{Math.round(
|
|
87
|
+
(range.to.getTime() - range.from.getTime()) / 86400000
|
|
88
|
+
)}{" "}
|
|
89
|
+
nights selected
|
|
90
|
+
</p>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
)
|
|
94
|
+
},
|
|
95
|
+
}
|