@behavioral-agentic-design-system/core 0.27.0 → 0.29.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 (113) hide show
  1. package/package.json +5 -5
  2. package/scripts/a11y-lint.cjs +78 -9
  3. package/scripts/build-tokens.cjs +273 -15
  4. package/scripts/wcag-audit.cjs +37 -7
  5. package/src/api/layers/file.ts +1 -0
  6. package/src/app/font-ready.tsx +6 -5
  7. package/src/app/layout.tsx +54 -3
  8. package/src/app/preview/components/page.tsx +5735 -2500
  9. package/src/app/preview/layout.tsx +4 -1
  10. package/src/app/preview/showcase-filter.tsx +66 -0
  11. package/src/app/preview/tab-replay.tsx +63 -0
  12. package/src/app/shell.tsx +91 -18
  13. package/src/components/customize/save-bar.tsx +19 -6
  14. package/src/components/docs-tab.tsx +36 -24
  15. package/src/components/layers-tab.tsx +37 -5
  16. package/src/components/ui/ai-badge.tsx +74 -0
  17. package/src/components/ui/alert.tsx +12 -0
  18. package/src/components/ui/badge.tsx +19 -0
  19. package/src/components/ui/chat-bubble.tsx +298 -0
  20. package/src/components/ui/chat-marker.tsx +120 -0
  21. package/src/components/ui/checkbox.tsx +9 -1
  22. package/src/components/ui/clipboard.tsx +291 -0
  23. package/src/components/ui/close-button.tsx +71 -0
  24. package/src/components/ui/combobox.tsx +62 -3
  25. package/src/components/ui/container.tsx +65 -0
  26. package/src/components/ui/copy-button.tsx +5 -1
  27. package/src/components/ui/data-table.tsx +388 -0
  28. package/src/components/ui/date-field.tsx +368 -0
  29. package/src/components/ui/drawer.tsx +334 -0
  30. package/src/components/ui/file-button.tsx +145 -0
  31. package/src/components/ui/floating-indicator.tsx +217 -0
  32. package/src/components/ui/focus-trap.tsx +184 -0
  33. package/src/components/ui/format-byte.tsx +113 -0
  34. package/src/components/ui/index.ts +28 -0
  35. package/src/components/ui/input.tsx +38 -3
  36. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  37. package/src/components/ui/loading-dots.tsx +99 -0
  38. package/src/components/ui/mark.tsx +69 -0
  39. package/src/components/ui/month-picker.tsx +296 -0
  40. package/src/components/ui/multi-select.tsx +15 -13
  41. package/src/components/ui/nav-link.tsx +200 -0
  42. package/src/components/ui/navigation-rail.tsx +256 -0
  43. package/src/components/ui/notification.tsx +20 -0
  44. package/src/components/ui/password-input.tsx +34 -1
  45. package/src/components/ui/progress.tsx +15 -1
  46. package/src/components/ui/prose.tsx +62 -0
  47. package/src/components/ui/result.tsx +151 -0
  48. package/src/components/ui/rolling-number.tsx +201 -0
  49. package/src/components/ui/simple-grid.tsx +110 -0
  50. package/src/components/ui/skeleton.tsx +52 -3
  51. package/src/components/ui/squircle.tsx +274 -0
  52. package/src/components/ui/stack.tsx +105 -0
  53. package/src/components/ui/status-badge.tsx +93 -0
  54. package/src/components/ui/tabs.tsx +34 -7
  55. package/src/components/ui/tag.tsx +46 -5
  56. package/src/components/ui/theme-icon.tsx +138 -0
  57. package/src/components/ui/timeline.tsx +27 -10
  58. package/src/components/ui/tooltip.tsx +12 -1
  59. package/src/components/ui/tree-select.tsx +386 -0
  60. package/src/components/ui/typing-indicator.tsx +2 -2
  61. package/src/components/ui/word-rotate.tsx +6 -1
  62. package/src/components/ui/year-picker.tsx +307 -0
  63. package/src/data/docs-index.ts +10 -0
  64. package/src/hooks/use-global-primary-color.ts +57 -6
  65. package/src/stories/AiBadge.stories.tsx +67 -0
  66. package/src/stories/Alert.stories.tsx +31 -1
  67. package/src/stories/Badge.stories.tsx +63 -6
  68. package/src/stories/ChatBubble.stories.tsx +222 -0
  69. package/src/stories/ChatMarker.stories.tsx +59 -0
  70. package/src/stories/Checkbox.stories.tsx +5 -0
  71. package/src/stories/Clipboard.stories.tsx +136 -0
  72. package/src/stories/CloseButton.stories.tsx +65 -0
  73. package/src/stories/Combobox.stories.tsx +74 -3
  74. package/src/stories/Container.stories.tsx +134 -0
  75. package/src/stories/CopyButton.stories.tsx +2 -0
  76. package/src/stories/DataTable.stories.tsx +271 -0
  77. package/src/stories/DateField.stories.tsx +114 -0
  78. package/src/stories/Drawer.stories.tsx +211 -0
  79. package/src/stories/FileButton.stories.tsx +117 -0
  80. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  81. package/src/stories/FocusTrap.stories.tsx +218 -0
  82. package/src/stories/FormatByte.stories.tsx +142 -0
  83. package/src/stories/Input.stories.tsx +91 -0
  84. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  85. package/src/stories/LoadingDots.stories.tsx +73 -0
  86. package/src/stories/Mark.stories.tsx +84 -0
  87. package/src/stories/MonthPicker.stories.tsx +99 -0
  88. package/src/stories/MultiSelect.stories.tsx +3 -1
  89. package/src/stories/NavLink.stories.tsx +213 -0
  90. package/src/stories/NavigationRail.stories.tsx +413 -0
  91. package/src/stories/Notification.stories.tsx +53 -0
  92. package/src/stories/PasswordInput.stories.tsx +21 -0
  93. package/src/stories/Progress.stories.tsx +38 -0
  94. package/src/stories/Prose.stories.tsx +232 -0
  95. package/src/stories/Result.stories.tsx +145 -0
  96. package/src/stories/RollingNumber.stories.tsx +226 -0
  97. package/src/stories/SimpleGrid.stories.tsx +130 -0
  98. package/src/stories/Skeleton.stories.tsx +62 -1
  99. package/src/stories/Squircle.stories.tsx +127 -0
  100. package/src/stories/Stack.stories.tsx +139 -0
  101. package/src/stories/StatusBadge.stories.tsx +125 -0
  102. package/src/stories/Tabs.stories.tsx +56 -1
  103. package/src/stories/Tag.stories.tsx +31 -0
  104. package/src/stories/ThemeIcon.stories.tsx +97 -0
  105. package/src/stories/Timeline.stories.tsx +69 -0
  106. package/src/stories/Tooltip.stories.tsx +18 -0
  107. package/src/stories/TreeSelect.stories.tsx +222 -0
  108. package/src/stories/TypingIndicator.stories.tsx +1 -0
  109. package/src/stories/WordRotate.stories.tsx +1 -0
  110. package/src/stories/YearPicker.stories.tsx +100 -0
  111. package/src/styles.css +289 -15
  112. package/src/tokens.json +96 -1
  113. package/LICENSE +0 -21
@@ -0,0 +1,218 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import {
4
+ FocusTrap,
5
+ FocusTrapInitialFocus,
6
+ } from "@behavioral-agentic-design-system/core/components/ui/focus-trap";
7
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
8
+ import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
9
+ import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
10
+
11
+ const meta: Meta<typeof FocusTrap> = {
12
+ title: "Components/FocusTrap",
13
+ component: FocusTrap,
14
+ parameters: { layout: "centered" },
15
+ tags: ["autodocs"],
16
+ argTypes: {
17
+ active: { control: "boolean" },
18
+ loop: { control: "boolean" },
19
+ },
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const Default: Story = {
26
+ render: () => {
27
+ const [open, setOpen] = React.useState(false);
28
+ return (
29
+ <div className="space-y-4">
30
+ <Button onClick={() => setOpen(true)}>Open trapped form</Button>
31
+ {open && (
32
+ <FocusTrap
33
+ active
34
+ onEscapeKeyDown={() => setOpen(false)}
35
+ className="rounded-lg border bg-card p-6 shadow-sm"
36
+ >
37
+ <div role="dialog" aria-modal="true" aria-labelledby="ft-title">
38
+ <h3 id="ft-title" className="mb-4 text-lg font-semibold">
39
+ Trapped focus area
40
+ </h3>
41
+ <div className="space-y-3">
42
+ <div className="space-y-1.5">
43
+ <Label htmlFor="ft-name">Name</Label>
44
+ <Input id="ft-name" placeholder="Seo-yun Park" />
45
+ </div>
46
+ <div className="space-y-1.5">
47
+ <Label htmlFor="ft-email">Email</Label>
48
+ <Input id="ft-email" type="email" placeholder="seo-yun@bads.com" />
49
+ </div>
50
+ </div>
51
+ <div className="mt-4 flex gap-3">
52
+ <Button size="sm" onClick={() => setOpen(false)}>
53
+ Save
54
+ </Button>
55
+ <Button size="sm" variant="outline" onClick={() => setOpen(false)}>
56
+ Cancel
57
+ </Button>
58
+ </div>
59
+ <p className="mt-3 text-xs text-muted-foreground">
60
+ Tab cycles within. Press Escape to close.
61
+ </p>
62
+ </div>
63
+ </FocusTrap>
64
+ )}
65
+ </div>
66
+ );
67
+ },
68
+ };
69
+
70
+ export const Deactivated: Story = {
71
+ render: () => (
72
+ <FocusTrap
73
+ active={false}
74
+ className="rounded-lg border bg-card p-6"
75
+ >
76
+ <p className="mb-3 text-sm text-muted-foreground">
77
+ active=false — Tab moves freely outside this container.
78
+ </p>
79
+ <div className="flex gap-3">
80
+ <Button size="sm">First</Button>
81
+ <Button size="sm" variant="outline">Second</Button>
82
+ <Button size="sm" variant="outline">Third</Button>
83
+ </div>
84
+ </FocusTrap>
85
+ ),
86
+ };
87
+
88
+ export const WithEscapeKey: Story = {
89
+ render: () => {
90
+ const [open, setOpen] = React.useState(false);
91
+ const [log, setLog] = React.useState<string[]>([]);
92
+
93
+ return (
94
+ <div className="space-y-4">
95
+ <Button
96
+ onClick={() => {
97
+ setOpen(true);
98
+ setLog((l) => [...l, "opened"]);
99
+ }}
100
+ >
101
+ Open (then press Escape)
102
+ </Button>
103
+ {open && (
104
+ <FocusTrap
105
+ active
106
+ onEscapeKeyDown={() => {
107
+ setOpen(false);
108
+ setLog((l) => [...l, "closed via Escape"]);
109
+ }}
110
+ className="rounded-lg border bg-card p-6 shadow-sm"
111
+ >
112
+ <p className="mb-3 text-sm">Press Escape to close and log it.</p>
113
+ <div className="flex gap-3">
114
+ <Button size="sm">Action A</Button>
115
+ <Button size="sm" variant="outline">Action B</Button>
116
+ </div>
117
+ </FocusTrap>
118
+ )}
119
+ {log.length > 0 && (
120
+ <ul className="space-y-1">
121
+ {log.map((entry, i) => (
122
+ <li key={i} className="text-xs text-muted-foreground">
123
+ {i + 1}. {entry}
124
+ </li>
125
+ ))}
126
+ </ul>
127
+ )}
128
+ </div>
129
+ );
130
+ },
131
+ };
132
+
133
+ export const WithInitialFocus: Story = {
134
+ render: () => {
135
+ const [open, setOpen] = React.useState(false);
136
+ return (
137
+ <div className="space-y-4">
138
+ <Button onClick={() => setOpen(true)}>Open (Cancel gets initial focus)</Button>
139
+ {open && (
140
+ <FocusTrap
141
+ active
142
+ onEscapeKeyDown={() => setOpen(false)}
143
+ className="rounded-lg border border-destructive/30 bg-card p-6 shadow-sm"
144
+ >
145
+ <p className="mb-4 text-sm text-muted-foreground">
146
+ FocusTrapInitialFocus sits before the destructive Confirm — the
147
+ safe Cancel button receives focus on open.
148
+ </p>
149
+ <Button variant="destructive" size="sm">
150
+ Confirm delete
151
+ </Button>{" "}
152
+ <FocusTrapInitialFocus />
153
+ <Button
154
+ size="sm"
155
+ variant="outline"
156
+ onClick={() => setOpen(false)}
157
+ >
158
+ Cancel (initial focus)
159
+ </Button>
160
+ </FocusTrap>
161
+ )}
162
+ </div>
163
+ );
164
+ },
165
+ };
166
+
167
+ export const RealisticUse: Story = {
168
+ render: () => {
169
+ const [open, setOpen] = React.useState(false);
170
+ return (
171
+ <div className="max-w-sm space-y-4">
172
+ <p className="text-sm text-muted-foreground">
173
+ A lightweight confirmation panel that uses FocusTrap instead of
174
+ Dialog — no overlay, no portal. Useful for inline destructive
175
+ actions in table rows or settings lists.
176
+ </p>
177
+ <Button variant="outline" size="sm" onClick={() => setOpen(true)}>
178
+ Remove team member
179
+ </Button>
180
+ {open && (
181
+ <FocusTrap
182
+ active
183
+ onEscapeKeyDown={() => setOpen(false)}
184
+ className="rounded-lg border border-destructive/40 bg-card px-5 py-4 shadow-md"
185
+ >
186
+ <div role="dialog" aria-modal="true" aria-labelledby="rm-title">
187
+ <p
188
+ id="rm-title"
189
+ className="mb-1 text-sm font-medium text-foreground"
190
+ >
191
+ Remove Arjun Mehta from the workspace?
192
+ </p>
193
+ <p className="mb-4 text-xs text-muted-foreground">
194
+ This revokes access immediately. The action cannot be undone.
195
+ </p>
196
+ <div className="flex gap-2">
197
+ <Button
198
+ variant="destructive"
199
+ size="sm"
200
+ onClick={() => setOpen(false)}
201
+ >
202
+ Remove
203
+ </Button>
204
+ <Button
205
+ variant="outline"
206
+ size="sm"
207
+ onClick={() => setOpen(false)}
208
+ >
209
+ Cancel
210
+ </Button>
211
+ </div>
212
+ </div>
213
+ </FocusTrap>
214
+ )}
215
+ </div>
216
+ );
217
+ },
218
+ };
@@ -0,0 +1,142 @@
1
+ import * as React from "react"
2
+ import type { Meta, StoryObj } from "@storybook/react"
3
+ import { FileArchiveIcon, FileCodeIcon, FileTextIcon } from "lucide-react"
4
+ import { FormatByte } from "@behavioral-agentic-design-system/core/components/ui/format-byte"
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from "@behavioral-agentic-design-system/core/components/ui/card"
12
+
13
+ const meta: Meta<typeof FormatByte> = {
14
+ title: "Components/FormatByte",
15
+ component: FormatByte,
16
+ parameters: { layout: "centered" },
17
+ tags: ["autodocs"],
18
+ argTypes: {
19
+ value: { control: "number" },
20
+ precision: { control: "number" },
21
+ locale: { control: "text" },
22
+ tabular: { control: "boolean" },
23
+ },
24
+ }
25
+
26
+ export default meta
27
+ type Story = StoryObj<typeof meta>
28
+
29
+ // All file names and byte counts come from content/personas/bads.json →
30
+ // primary.files (real-content rule — the pool grew these entries before this
31
+ // story used them). Scale is SI (base-1000, KB/MB/GB), matching Mantine and
32
+ // Chakra defaults and what OS file managers report — not IEC base-1024.
33
+
34
+ export const Default: Story = {
35
+ render: () => (
36
+ <p className="text-sm text-foreground">
37
+ roi-report-2026-06.pdf —{" "}
38
+ <FormatByte value={1536000} className="font-medium" />
39
+ </p>
40
+ ),
41
+ }
42
+
43
+ export const Size_Bytes: Story = {
44
+ render: () => (
45
+ <p className="text-sm text-foreground">
46
+ favicon.svg — <FormatByte value={500} className="font-medium" />
47
+ </p>
48
+ ),
49
+ }
50
+
51
+ export const Size_KB: Story = {
52
+ render: () => (
53
+ <p className="text-sm text-foreground">
54
+ Icon sprite chunk — <FormatByte value={2048} className="font-medium" />
55
+ </p>
56
+ ),
57
+ }
58
+
59
+ export const Size_GB: Story = {
60
+ render: () => (
61
+ <p className="text-sm text-foreground">
62
+ chromatic-snapshots-2026-06.zip —{" "}
63
+ <FormatByte value={1_073_741_824} className="font-medium" />
64
+ </p>
65
+ ),
66
+ }
67
+
68
+ export const Precision_Zero: Story = {
69
+ render: () => (
70
+ <div className="space-y-2 text-sm text-foreground">
71
+ <p>
72
+ Default precision (1):{" "}
73
+ <FormatByte value={1536000} className="font-medium" />
74
+ </p>
75
+ <p>
76
+ precision={"{0}"}:{" "}
77
+ <FormatByte value={1536000} precision={0} className="font-medium" />
78
+ </p>
79
+ <p className="text-xs text-muted-foreground">
80
+ Scaled output rounds, so the exact byte count rides the native title
81
+ attribute — hover either size to recover “1,536,000 bytes”.
82
+ </p>
83
+ </div>
84
+ ),
85
+ }
86
+
87
+ export const RealisticUse: Story = {
88
+ render: () => (
89
+ <Card className="w-96">
90
+ <CardHeader>
91
+ <CardTitle>Engagement deliverables</CardTitle>
92
+ <CardDescription>
93
+ Files shared with the Austin design systems team this quarter.
94
+ </CardDescription>
95
+ </CardHeader>
96
+ <CardContent>
97
+ <ul className="divide-y divide-border">
98
+ {[
99
+ {
100
+ icon: FileTextIcon,
101
+ name: "roi-report-2026-06.pdf",
102
+ bytes: 1536000,
103
+ },
104
+ {
105
+ icon: FileCodeIcon,
106
+ name: "styles.css",
107
+ bytes: 42700,
108
+ },
109
+ {
110
+ icon: FileCodeIcon,
111
+ name: "brand-fonts.woff2",
112
+ bytes: 84512,
113
+ },
114
+ {
115
+ icon: FileArchiveIcon,
116
+ name: "chromatic-snapshots-2026-06.zip",
117
+ bytes: 1073741824,
118
+ },
119
+ ].map((file) => (
120
+ <li key={file.name} className="flex items-center gap-3 py-2">
121
+ <file.icon
122
+ strokeWidth={1.5}
123
+ className="size-4 shrink-0 text-muted-foreground"
124
+ aria-hidden="true"
125
+ />
126
+ <span
127
+ className="min-w-0 flex-1 truncate text-sm text-foreground"
128
+ title={file.name}
129
+ >
130
+ {file.name}
131
+ </span>
132
+ <FormatByte
133
+ value={file.bytes}
134
+ className="shrink-0 text-sm text-muted-foreground"
135
+ />
136
+ </li>
137
+ ))}
138
+ </ul>
139
+ </CardContent>
140
+ </Card>
141
+ ),
142
+ }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Meta, StoryObj } from "@storybook/react";
3
+ import { CalendarIcon, MailIcon, SearchIcon } from "lucide-react";
3
4
  import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
4
5
 
5
6
  const meta: Meta<typeof Input> = {
@@ -62,7 +63,97 @@ export const WithError: Story = {
62
63
  },
63
64
  };
64
65
 
66
+ export const Variant_WithLeftIcon: Story = {
67
+ name: "Variant: With left icon",
68
+ args: {
69
+ type: "search",
70
+ placeholder: "Search users…",
71
+ "aria-label": "Search users",
72
+ leftSection: <SearchIcon size={16} strokeWidth={1.5} aria-hidden="true" />,
73
+ },
74
+ };
75
+
76
+ export const Variant_WithRightIcon: Story = {
77
+ name: "Variant: With right icon",
78
+ args: {
79
+ placeholder: "Due date",
80
+ "aria-label": "Due date",
81
+ rightSection: <CalendarIcon size={16} strokeWidth={1.5} aria-hidden="true" />,
82
+ },
83
+ };
84
+
85
+ export const Variant_WithBothSections: Story = {
86
+ name: "Variant: With both sections",
87
+ args: {
88
+ type: "email",
89
+ placeholder: "amara.okafor@lumenworks.studio",
90
+ "aria-label": "Work email",
91
+ leftSection: <MailIcon size={16} strokeWidth={1.5} aria-hidden="true" />,
92
+ rightSection: (
93
+ <span className="text-sm" aria-hidden="true">
94
+ .com
95
+ </span>
96
+ ),
97
+ },
98
+ };
99
+
100
+ export const Variant_WithRightText: Story = {
101
+ name: "Variant: With text sections (currency, percent)",
102
+ render: () => (
103
+ <div className="flex w-72 flex-col gap-4">
104
+ <Input
105
+ type="number"
106
+ inputMode="decimal"
107
+ placeholder="1,250.00"
108
+ aria-label="Amount"
109
+ leftSection={
110
+ <span className="text-sm" aria-hidden="true">
111
+ $
112
+ </span>
113
+ }
114
+ rightSection={
115
+ <span className="text-sm" aria-hidden="true">
116
+ USD
117
+ </span>
118
+ }
119
+ />
120
+ <Input
121
+ type="number"
122
+ inputMode="decimal"
123
+ placeholder="7.5"
124
+ aria-label="Interest rate"
125
+ rightSection={
126
+ <span className="text-sm" aria-hidden="true">
127
+ %
128
+ </span>
129
+ }
130
+ />
131
+ </div>
132
+ ),
133
+ };
134
+
65
135
  export const RealisticUse: Story = {
136
+ name: "Realistic use: search with clear",
137
+ render: () => {
138
+ const [value, setValue] = React.useState("design tokens");
139
+ return (
140
+ <div className="w-72">
141
+ <Input
142
+ type="search"
143
+ aria-label="Search users"
144
+ placeholder="Search users…"
145
+ value={value}
146
+ onChange={(e) => setValue(e.target.value)}
147
+ clearable
148
+ leftSection={<SearchIcon size={16} strokeWidth={1.5} aria-hidden="true" />}
149
+ />
150
+ </div>
151
+ );
152
+ },
153
+ };
154
+
155
+ export const RealisticUse_Email: Story = {
156
+ name: "Realistic use: email field",
66
157
  args: {
67
158
  type: "email",
68
159
  placeholder: "your@email.com",
@@ -0,0 +1,87 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { KeyboardShortcut } from "../components/ui/keyboard-shortcut"
4
+
5
+ const meta: Meta<typeof KeyboardShortcut> = {
6
+ title: "UI/KeyboardShortcut",
7
+ component: KeyboardShortcut,
8
+ tags: ["autodocs"],
9
+ parameters: {
10
+ layout: "padded",
11
+ },
12
+ }
13
+
14
+ export default meta
15
+ type Story = StoryObj<typeof KeyboardShortcut>
16
+
17
+ export const Default: Story = {
18
+ args: {
19
+ keys: ["meta", "K"],
20
+ },
21
+ }
22
+
23
+ export const Variant_ThreeKey: Story = {
24
+ args: {
25
+ keys: ["meta", "shift", "P"],
26
+ },
27
+ }
28
+
29
+ export const Variant_Windows: Story = {
30
+ args: {
31
+ keys: ["ctrl", "shift", "P"],
32
+ platform: "windows",
33
+ },
34
+ }
35
+
36
+ export const Variant_ThenSeparator: Story = {
37
+ args: {
38
+ keys: ["G", "I"],
39
+ separator: "then",
40
+ },
41
+ }
42
+
43
+ export const Size_Sm: Story = {
44
+ args: {
45
+ keys: ["meta", "K"],
46
+ size: "sm",
47
+ },
48
+ }
49
+
50
+ export const Variant_Outline: Story = {
51
+ args: {
52
+ keys: ["meta", "K"],
53
+ variant: "outline",
54
+ },
55
+ }
56
+
57
+ export const Disabled: Story = {
58
+ render: () => (
59
+ <span className="flex items-center gap-2 text-sm text-muted-foreground">
60
+ <KeyboardShortcut keys={["meta", "K"]} size="sm" />
61
+ <span>disabled</span>
62
+ </span>
63
+ ),
64
+ }
65
+
66
+ export const RealisticUse: Story = {
67
+ render: () => (
68
+ <div className="flex flex-col gap-4">
69
+ <div className="flex items-center justify-between rounded-md border px-4 py-2 text-sm">
70
+ <span>Open command palette</span>
71
+ <KeyboardShortcut keys={["meta", "K"]} size="sm" />
72
+ </div>
73
+ <div className="flex items-center justify-between rounded-md border px-4 py-2 text-sm">
74
+ <span>Search files</span>
75
+ <KeyboardShortcut keys={["meta", "P"]} size="sm" />
76
+ </div>
77
+ <div className="flex items-center justify-between rounded-md border px-4 py-2 text-sm">
78
+ <span>Go to issues</span>
79
+ <KeyboardShortcut keys={["G", "I"]} separator="then" size="sm" />
80
+ </div>
81
+ <div className="flex items-center justify-between rounded-md border px-4 py-2 text-sm">
82
+ <span>Format document</span>
83
+ <KeyboardShortcut keys={["meta", "shift", "F"]} size="sm" />
84
+ </div>
85
+ </div>
86
+ ),
87
+ }
@@ -0,0 +1,73 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { LoadingDots } from "../components/ui/loading-dots"
4
+ import { Button } from "../components/ui/button"
5
+
6
+ const meta: Meta<typeof LoadingDots> = {
7
+ title: "UI/LoadingDots",
8
+ component: LoadingDots,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "padded",
12
+ },
13
+ }
14
+
15
+ export default meta
16
+ type Story = StoryObj<typeof LoadingDots>
17
+
18
+ export const Default: Story = {}
19
+
20
+ export const Size_Xs: Story = {
21
+ args: { size: "xs" },
22
+ }
23
+
24
+ export const Size_Sm: Story = {
25
+ args: { size: "sm" },
26
+ }
27
+
28
+ export const Size_Lg: Story = {
29
+ args: { size: "lg" },
30
+ }
31
+
32
+ export const Color_Muted: Story = {
33
+ args: { tone: "muted" },
34
+ }
35
+
36
+ export const Color_Primary: Story = {
37
+ args: { tone: "primary" },
38
+ }
39
+
40
+ export const Disabled: Story = {
41
+ render: () => (
42
+ <span className="inline-flex items-center gap-2 text-muted-foreground">
43
+ <LoadingDots color="muted" size="sm" aria-label="Paused" />
44
+ <span className="text-sm">Paused</span>
45
+ </span>
46
+ ),
47
+ }
48
+
49
+ export const RealisticUse: Story = {
50
+ render: () => (
51
+ <div className="flex flex-col gap-6">
52
+ <div className="space-y-2">
53
+ <p className="text-xs font-medium text-muted-foreground">Button loading state</p>
54
+ <Button disabled className="min-w-28">
55
+ <LoadingDots size="xs" aria-label="Saving" />
56
+ </Button>
57
+ </div>
58
+ <div className="space-y-2">
59
+ <p className="text-xs font-medium text-muted-foreground">Inline in text</p>
60
+ <p className="flex items-center gap-2 text-sm text-muted-foreground">
61
+ Fetching results
62
+ <LoadingDots size="sm" color="muted" />
63
+ </p>
64
+ </div>
65
+ <div className="space-y-2">
66
+ <p className="text-xs font-medium text-muted-foreground">Standalone placeholder</p>
67
+ <div className="flex h-10 w-full items-center justify-center rounded-md border border-dashed">
68
+ <LoadingDots color="muted" aria-label="Loading content" />
69
+ </div>
70
+ </div>
71
+ </div>
72
+ ),
73
+ }