@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.
Files changed (87) hide show
  1. package/package.json +1 -1
  2. package/scripts/check-stories.mjs +12 -5
  3. package/scripts/fix-stories.mjs +6 -6
  4. package/scripts/generate-stories.cjs +7 -7
  5. package/src/app/preview/components/page.tsx +165 -50
  6. package/src/components/ui/code.tsx +55 -0
  7. package/src/components/ui/index.ts +0 -1
  8. package/src/components/ui/indicator.tsx +9 -7
  9. package/src/components/ui/native-select.tsx +68 -0
  10. package/src/components/ui/navigation-menu.tsx +23 -0
  11. package/src/components/ui/sheet.tsx +23 -6
  12. package/src/components/ui/spinner.tsx +14 -3
  13. package/src/components/ui/tags-input.tsx +210 -69
  14. package/src/stories/Accordion.stories.tsx +152 -0
  15. package/src/stories/Alert.stories.tsx +102 -0
  16. package/src/stories/AlertDialog.stories.tsx +125 -0
  17. package/src/stories/AspectRatio.stories.tsx +82 -0
  18. package/src/stories/Avatar.stories.tsx +36 -0
  19. package/src/stories/Badge.stories.tsx +54 -0
  20. package/src/stories/Breadcrumb.stories.tsx +36 -0
  21. package/src/stories/Button.stories.tsx +144 -0
  22. package/src/stories/ButtonGroup.stories.tsx +176 -0
  23. package/src/stories/Calendar.stories.tsx +67 -0
  24. package/src/stories/Card.stories.tsx +43 -0
  25. package/src/stories/Carousel.stories.tsx +233 -0
  26. package/src/stories/Chart.stories.tsx +174 -0
  27. package/src/stories/Checkbox.stories.tsx +32 -0
  28. package/src/stories/CircularProgress.stories.tsx +136 -0
  29. package/src/stories/Code.stories.tsx +131 -0
  30. package/src/stories/Collapsible.stories.tsx +27 -0
  31. package/src/stories/ColorPicker.stories.tsx +155 -0
  32. package/src/stories/Combobox.stories.tsx +168 -0
  33. package/src/stories/Command.stories.tsx +40 -0
  34. package/src/stories/ContextMenu.stories.tsx +293 -0
  35. package/src/stories/CopyButton.stories.tsx +111 -0
  36. package/src/stories/DatePicker.stories.tsx +176 -0
  37. package/src/stories/DateRangePicker.stories.tsx +95 -0
  38. package/src/stories/Dialog.stories.tsx +186 -0
  39. package/src/stories/DropdownMenu.stories.tsx +47 -0
  40. package/src/stories/EmptyState.stories.tsx +199 -0
  41. package/src/stories/Field.stories.tsx +155 -0
  42. package/src/stories/FileUpload.stories.tsx +134 -0
  43. package/src/stories/HoverCard.stories.tsx +149 -0
  44. package/src/stories/Indicator.stories.tsx +255 -0
  45. package/src/stories/Input.stories.tsx +69 -0
  46. package/src/stories/Kbd.stories.tsx +123 -0
  47. package/src/stories/Label.stories.tsx +27 -0
  48. package/src/stories/List.stories.tsx +159 -0
  49. package/src/stories/Menubar.stories.tsx +190 -0
  50. package/src/stories/MultiSelect.stories.tsx +107 -0
  51. package/src/stories/NativeSelect.stories.tsx +107 -0
  52. package/src/stories/NavigationMenu.stories.tsx +322 -0
  53. package/src/stories/NumberInput.stories.tsx +100 -0
  54. package/src/stories/Pagination.stories.tsx +201 -0
  55. package/src/stories/PasswordInput.stories.tsx +62 -0
  56. package/src/stories/PinInput.stories.tsx +136 -0
  57. package/src/stories/Popover.stories.tsx +37 -0
  58. package/src/stories/Progress.stories.tsx +64 -0
  59. package/src/stories/RadioGroup.stories.tsx +39 -0
  60. package/src/stories/RatingGroup.stories.tsx +102 -0
  61. package/src/stories/Resizable.stories.tsx +28 -0
  62. package/src/stories/Reveal.stories.tsx +63 -0
  63. package/src/stories/ScrollArea.stories.tsx +76 -0
  64. package/src/stories/SegmentedControl.stories.tsx +182 -0
  65. package/src/stories/Select.stories.tsx +62 -0
  66. package/src/stories/Separator.stories.tsx +28 -0
  67. package/src/stories/Sheet.stories.tsx +193 -0
  68. package/src/stories/Sidebar.stories.tsx +53 -0
  69. package/src/stories/Skeleton.stories.tsx +32 -0
  70. package/src/stories/Slider.stories.tsx +67 -0
  71. package/src/stories/Sonner.stories.tsx +146 -0
  72. package/src/stories/Spinner.stories.tsx +94 -0
  73. package/src/stories/Stepper.stories.tsx +228 -0
  74. package/src/stories/Switch.stories.tsx +58 -0
  75. package/src/stories/Table.stories.tsx +38 -0
  76. package/src/stories/Tabs.stories.tsx +128 -0
  77. package/src/stories/Tag.stories.tsx +51 -0
  78. package/src/stories/TagsInput.stories.tsx +154 -0
  79. package/src/stories/Textarea.stories.tsx +31 -0
  80. package/src/stories/TimePicker.stories.tsx +54 -0
  81. package/src/stories/Timeline.stories.tsx +263 -0
  82. package/src/stories/Toggle.stories.tsx +45 -0
  83. package/src/stories/ToggleGroup.stories.tsx +39 -0
  84. package/src/stories/Toolbar.stories.tsx +295 -0
  85. package/src/stories/Tooltip.stories.tsx +37 -0
  86. package/src/stories/TreeView.stories.tsx +293 -0
  87. package/src/components/ui/bottom-sheet.tsx +0 -133
@@ -0,0 +1,168 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Combobox } from "@behavioral-agentic-design-system/core/components/ui/combobox";
4
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
5
+
6
+ // Trigger uses aria-haspopup=listbox + aria-expanded on a native <button>.
7
+ // role=combobox is intentionally omitted — ARIA 1.2 requires aria-controls when
8
+ // it's present, which cannot be wired across a portal without a ref handshake.
9
+ const meta: Meta<typeof Combobox> = {
10
+ title: "Components/Combobox",
11
+ component: Combobox,
12
+ parameters: { layout: "centered" },
13
+ tags: ["autodocs"],
14
+ decorators: [
15
+ (Story) => (
16
+ <div className="flex min-h-[320px] w-[300px] items-start justify-center pt-8">
17
+ <div className="w-full">
18
+ <Story />
19
+ </div>
20
+ </div>
21
+ ),
22
+ ],
23
+ };
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ const frameworks = [
29
+ { value: "next", label: "Next.js" },
30
+ { value: "sveltekit", label: "SvelteKit" },
31
+ { value: "nuxt", label: "Nuxt.js" },
32
+ { value: "remix", label: "Remix" },
33
+ { value: "astro", label: "Astro" },
34
+ ];
35
+
36
+ export const Default: Story = {
37
+ render: () => {
38
+ const [value, setValue] = React.useState("");
39
+ return (
40
+ <Combobox
41
+ options={frameworks}
42
+ value={value}
43
+ onValueChange={setValue}
44
+ placeholder="Select framework..."
45
+ searchPlaceholder="Search frameworks..."
46
+ />
47
+ );
48
+ },
49
+ };
50
+
51
+ export const WithValue: Story = {
52
+ render: () => {
53
+ const [value, setValue] = React.useState("next");
54
+ return (
55
+ <Combobox
56
+ options={frameworks}
57
+ value={value}
58
+ onValueChange={setValue}
59
+ placeholder="Select framework..."
60
+ searchPlaceholder="Search frameworks..."
61
+ />
62
+ );
63
+ },
64
+ };
65
+
66
+ export const Disabled: Story = {
67
+ render: () => (
68
+ <Combobox
69
+ options={frameworks}
70
+ value="next"
71
+ disabled
72
+ placeholder="Select framework..."
73
+ />
74
+ ),
75
+ };
76
+
77
+ export const WithDisabledOptions: Story = {
78
+ render: () => {
79
+ const [value, setValue] = React.useState("");
80
+ const options = [
81
+ { value: "next", label: "Next.js" },
82
+ { value: "sveltekit", label: "SvelteKit", disabled: true },
83
+ { value: "nuxt", label: "Nuxt.js" },
84
+ { value: "remix", label: "Remix", disabled: true },
85
+ { value: "astro", label: "Astro" },
86
+ ];
87
+ return (
88
+ <Combobox
89
+ options={options}
90
+ value={value}
91
+ onValueChange={setValue}
92
+ placeholder="Select framework..."
93
+ searchPlaceholder="Search frameworks..."
94
+ />
95
+ );
96
+ },
97
+ };
98
+
99
+ export const RealisticUse: Story = {
100
+ decorators: [
101
+ (Story) => (
102
+ <div className="flex min-h-[400px] w-[380px] items-start justify-center pt-8">
103
+ <div className="w-full rounded-lg border bg-card p-6 shadow-sm">
104
+ <Story />
105
+ </div>
106
+ </div>
107
+ ),
108
+ ],
109
+ render: () => {
110
+ const [country, setCountry] = React.useState("");
111
+ const [timezone, setTimezone] = React.useState("");
112
+
113
+ const countries = [
114
+ { value: "us", label: "United States" },
115
+ { value: "ca", label: "Canada" },
116
+ { value: "gb", label: "United Kingdom" },
117
+ { value: "de", label: "Germany" },
118
+ { value: "fr", label: "France" },
119
+ { value: "au", label: "Australia" },
120
+ { value: "jp", label: "Japan" },
121
+ { value: "sg", label: "Singapore" },
122
+ ];
123
+
124
+ const timezones = [
125
+ { value: "utc-8", label: "Pacific Time (UTC-8)" },
126
+ { value: "utc-7", label: "Mountain Time (UTC-7)" },
127
+ { value: "utc-6", label: "Central Time (UTC-6)" },
128
+ { value: "utc-5", label: "Eastern Time (UTC-5)" },
129
+ { value: "utc+0", label: "UTC" },
130
+ { value: "utc+1", label: "Central European Time (UTC+1)" },
131
+ { value: "utc+8", label: "Singapore Time (UTC+8)" },
132
+ { value: "utc+9", label: "Japan Standard Time (UTC+9)" },
133
+ ];
134
+
135
+ return (
136
+ <div className="space-y-5">
137
+ <div>
138
+ <h3 className="text-sm font-semibold text-foreground">Account location</h3>
139
+ <p className="mt-0.5 text-sm text-muted-foreground">Set your country and timezone for accurate scheduling.</p>
140
+ </div>
141
+ <div className="space-y-3">
142
+ <div className="space-y-1.5">
143
+ <Label htmlFor="country">Country</Label>
144
+ <Combobox
145
+ options={countries}
146
+ value={country}
147
+ onValueChange={setCountry}
148
+ placeholder="Select country..."
149
+ searchPlaceholder="Search countries..."
150
+ emptyText="Country not found."
151
+ />
152
+ </div>
153
+ <div className="space-y-1.5">
154
+ <Label htmlFor="timezone">Timezone</Label>
155
+ <Combobox
156
+ options={timezones}
157
+ value={timezone}
158
+ onValueChange={setTimezone}
159
+ placeholder="Select timezone..."
160
+ searchPlaceholder="Search timezones..."
161
+ emptyText="Timezone not found."
162
+ />
163
+ </div>
164
+ </div>
165
+ </div>
166
+ );
167
+ },
168
+ };
@@ -0,0 +1,40 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@behavioral-agentic-design-system/core/components/ui/command";
3
+
4
+ const meta: Meta<typeof Command> = {
5
+ title: "Components/Command",
6
+ component: Command,
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: () => (<Command className="rounded-lg border w-[320px]">
16
+ <CommandInput placeholder="Search..." />
17
+ <CommandList>
18
+ <CommandEmpty>No results.</CommandEmpty>
19
+ <CommandGroup heading="Suggestions">
20
+ <CommandItem>Calendar</CommandItem>
21
+ <CommandItem>Settings</CommandItem>
22
+ <CommandItem>Profile</CommandItem>
23
+ </CommandGroup>
24
+ </CommandList>
25
+ </Command>),
26
+ };
27
+
28
+ export const RealisticUse: Story = {
29
+ render: () => (<Command className="rounded-lg border w-[320px]">
30
+ <CommandInput placeholder="Search..." />
31
+ <CommandList>
32
+ <CommandEmpty>No results.</CommandEmpty>
33
+ <CommandGroup heading="Suggestions">
34
+ <CommandItem>Calendar</CommandItem>
35
+ <CommandItem>Settings</CommandItem>
36
+ <CommandItem>Profile</CommandItem>
37
+ </CommandGroup>
38
+ </CommandList>
39
+ </Command>),
40
+ };
@@ -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
+