@behavioral-agentic-design-system/core 0.28.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 (95) hide show
  1. package/package.json +2 -2
  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 +5532 -3044
  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 +74 -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/alert.tsx +12 -0
  17. package/src/components/ui/badge.tsx +19 -0
  18. package/src/components/ui/chat-marker.tsx +120 -0
  19. package/src/components/ui/checkbox.tsx +9 -1
  20. package/src/components/ui/close-button.tsx +71 -0
  21. package/src/components/ui/combobox.tsx +62 -3
  22. package/src/components/ui/container.tsx +65 -0
  23. package/src/components/ui/date-field.tsx +368 -0
  24. package/src/components/ui/drawer.tsx +334 -0
  25. package/src/components/ui/file-button.tsx +145 -0
  26. package/src/components/ui/floating-indicator.tsx +217 -0
  27. package/src/components/ui/format-byte.tsx +113 -0
  28. package/src/components/ui/index.ts +21 -0
  29. package/src/components/ui/input.tsx +38 -3
  30. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  31. package/src/components/ui/loading-dots.tsx +99 -0
  32. package/src/components/ui/month-picker.tsx +296 -0
  33. package/src/components/ui/multi-select.tsx +15 -13
  34. package/src/components/ui/nav-link.tsx +200 -0
  35. package/src/components/ui/navigation-rail.tsx +256 -0
  36. package/src/components/ui/notification.tsx +20 -0
  37. package/src/components/ui/password-input.tsx +34 -1
  38. package/src/components/ui/progress.tsx +15 -1
  39. package/src/components/ui/prose.tsx +62 -0
  40. package/src/components/ui/result.tsx +151 -0
  41. package/src/components/ui/rolling-number.tsx +1 -0
  42. package/src/components/ui/simple-grid.tsx +110 -0
  43. package/src/components/ui/skeleton.tsx +52 -3
  44. package/src/components/ui/squircle.tsx +274 -0
  45. package/src/components/ui/stack.tsx +105 -0
  46. package/src/components/ui/status-badge.tsx +93 -0
  47. package/src/components/ui/tabs.tsx +34 -7
  48. package/src/components/ui/tag.tsx +46 -5
  49. package/src/components/ui/theme-icon.tsx +138 -0
  50. package/src/components/ui/timeline.tsx +27 -10
  51. package/src/components/ui/tooltip.tsx +12 -1
  52. package/src/components/ui/tree-select.tsx +386 -0
  53. package/src/components/ui/year-picker.tsx +307 -0
  54. package/src/data/docs-index.ts +10 -0
  55. package/src/hooks/use-global-primary-color.ts +57 -6
  56. package/src/stories/Alert.stories.tsx +31 -1
  57. package/src/stories/Badge.stories.tsx +63 -6
  58. package/src/stories/ChatMarker.stories.tsx +59 -0
  59. package/src/stories/Checkbox.stories.tsx +5 -0
  60. package/src/stories/CloseButton.stories.tsx +65 -0
  61. package/src/stories/Combobox.stories.tsx +74 -3
  62. package/src/stories/Container.stories.tsx +134 -0
  63. package/src/stories/DateField.stories.tsx +114 -0
  64. package/src/stories/Drawer.stories.tsx +211 -0
  65. package/src/stories/FileButton.stories.tsx +117 -0
  66. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  67. package/src/stories/FormatByte.stories.tsx +142 -0
  68. package/src/stories/Input.stories.tsx +91 -0
  69. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  70. package/src/stories/LoadingDots.stories.tsx +73 -0
  71. package/src/stories/MonthPicker.stories.tsx +99 -0
  72. package/src/stories/MultiSelect.stories.tsx +3 -1
  73. package/src/stories/NavLink.stories.tsx +213 -0
  74. package/src/stories/NavigationRail.stories.tsx +413 -0
  75. package/src/stories/Notification.stories.tsx +53 -0
  76. package/src/stories/PasswordInput.stories.tsx +21 -0
  77. package/src/stories/Progress.stories.tsx +38 -0
  78. package/src/stories/Prose.stories.tsx +232 -0
  79. package/src/stories/Result.stories.tsx +145 -0
  80. package/src/stories/RollingNumber.stories.tsx +1 -1
  81. package/src/stories/SimpleGrid.stories.tsx +130 -0
  82. package/src/stories/Skeleton.stories.tsx +62 -1
  83. package/src/stories/Squircle.stories.tsx +127 -0
  84. package/src/stories/Stack.stories.tsx +139 -0
  85. package/src/stories/StatusBadge.stories.tsx +125 -0
  86. package/src/stories/Tabs.stories.tsx +56 -1
  87. package/src/stories/Tag.stories.tsx +31 -0
  88. package/src/stories/ThemeIcon.stories.tsx +97 -0
  89. package/src/stories/Timeline.stories.tsx +69 -0
  90. package/src/stories/Tooltip.stories.tsx +18 -0
  91. package/src/stories/TreeSelect.stories.tsx +222 -0
  92. package/src/stories/YearPicker.stories.tsx +100 -0
  93. package/src/styles.css +289 -15
  94. package/src/tokens.json +96 -1
  95. package/LICENSE +0 -21
@@ -0,0 +1,343 @@
1
+ /**
2
+ * FloatingIndicator — animated selection highlight that slides between nav/tab items.
3
+ *
4
+ * Implementation note: the indicator is a purely decorative, aria-hidden layer.
5
+ * All active-state ARIA (aria-selected, aria-current, data-state="active") belongs
6
+ * on the nav items themselves — FloatingIndicator provides only visual motion.
7
+ *
8
+ * Motion: token-driven var(--duration-base) + var(--ease-out) via inline style
9
+ * (explicit property list: left, top, width, height — never transition-all).
10
+ * Reduced-motion is handled automatically by the base-layer media query in styles.css.
11
+ */
12
+ import * as React from "react";
13
+ import type { Meta, StoryObj } from "@storybook/react";
14
+ import { cn } from "@behavioral-agentic-design-system/core/lib/utils";
15
+ import {
16
+ FloatingIndicator,
17
+ useFloatingIndicator,
18
+ } from "@behavioral-agentic-design-system/core/components/ui/floating-indicator";
19
+
20
+ // ─── Meta ─────────────────────────────────────────────────────────────────────
21
+
22
+ const meta: Meta<typeof FloatingIndicator> = {
23
+ title: "Components/FloatingIndicator",
24
+ component: FloatingIndicator,
25
+ parameters: {
26
+ layout: "centered",
27
+ docs: {
28
+ description: {
29
+ component:
30
+ "Animated selection highlight that slides between nav/tab items. Decorative aria-hidden layer — all active-state ARIA belongs on the nav items. Source: Mantine segmented-control pattern.",
31
+ },
32
+ },
33
+ },
34
+ tags: ["autodocs"],
35
+ };
36
+
37
+ export default meta;
38
+ type Story = StoryObj<typeof meta>;
39
+
40
+ // ─── Default — three-tab bar (Jordan Reeves's workspace) ──────────────────────
41
+
42
+ const WORKSPACE_TABS = [
43
+ { value: "dashboard", label: "Dashboard" },
44
+ { value: "analytics", label: "Analytics" },
45
+ { value: "settings", label: "Settings" },
46
+ ];
47
+
48
+ function TabBarDemo() {
49
+ const [active, setActive] = React.useState(0);
50
+ const containerRef = React.useRef<HTMLDivElement>(null);
51
+ const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]);
52
+ const [target, setTarget] = React.useState<HTMLElement | null>(null);
53
+
54
+ // Sync target with active index on mount and when index changes
55
+ React.useEffect(() => {
56
+ setTarget(itemRefs.current[active] ?? null);
57
+ }, [active]);
58
+
59
+ return (
60
+ <div className="space-y-4 w-[380px]">
61
+ <p className="text-xs text-muted-foreground">
62
+ Jordan Reeves · Watershed Analytics workspace
63
+ </p>
64
+ <div
65
+ ref={containerRef}
66
+ role="tablist"
67
+ aria-label="Workspace sections"
68
+ className="relative inline-flex rounded-lg bg-muted p-1 gap-0.5"
69
+ >
70
+ <FloatingIndicator
71
+ target={target}
72
+ parent={containerRef.current}
73
+ className="bg-background shadow-sm rounded-md"
74
+ />
75
+ {WORKSPACE_TABS.map((tab, i) => (
76
+ <button
77
+ key={tab.value}
78
+ ref={(el) => {
79
+ itemRefs.current[i] = el;
80
+ }}
81
+ role="tab"
82
+ aria-selected={active === i}
83
+ onClick={() => setActive(i)}
84
+ className={cn(
85
+ "relative z-10 px-3 py-1.5 text-sm font-medium rounded-md transition-colors",
86
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
87
+ active === i
88
+ ? "text-foreground"
89
+ : "text-muted-foreground hover:text-foreground"
90
+ )}
91
+ >
92
+ {tab.label}
93
+ </button>
94
+ ))}
95
+ </div>
96
+ <p className="text-xs text-muted-foreground">
97
+ Active: <span className="font-medium text-foreground">{WORKSPACE_TABS[active].label}</span>
98
+ </p>
99
+ </div>
100
+ );
101
+ }
102
+
103
+ export const Default: Story = {
104
+ render: () => <TabBarDemo />,
105
+ };
106
+
107
+ // ─── PillNav — horizontal pill navigation ─────────────────────────────────────
108
+
109
+ const PILL_NAV_ITEMS = [
110
+ { value: "overview", label: "Overview" },
111
+ { value: "components", label: "Components" },
112
+ { value: "tokens", label: "Tokens" },
113
+ { value: "docs", label: "Docs" },
114
+ ];
115
+
116
+ function PillNavDemo() {
117
+ const [active, setActive] = React.useState(0);
118
+ const containerRef = React.useRef<HTMLDivElement>(null);
119
+ const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]);
120
+ const [target, setTarget] = React.useState<HTMLElement | null>(null);
121
+
122
+ React.useEffect(() => {
123
+ setTarget(itemRefs.current[active] ?? null);
124
+ }, [active]);
125
+
126
+ return (
127
+ <div className="space-y-4 w-[420px]">
128
+ <p className="text-xs text-muted-foreground">Pill-style navigation — rounded-full items</p>
129
+ <div
130
+ ref={containerRef}
131
+ role="navigation"
132
+ aria-label="Section navigation"
133
+ className="relative inline-flex gap-1 bg-transparent"
134
+ >
135
+ {/* Pill indicator: rounded-full matches the item shape */}
136
+ <FloatingIndicator
137
+ target={target}
138
+ parent={containerRef.current}
139
+ className="bg-primary/10 rounded-full shadow-none"
140
+ />
141
+ {PILL_NAV_ITEMS.map((item, i) => (
142
+ <button
143
+ key={item.value}
144
+ ref={(el) => {
145
+ itemRefs.current[i] = el;
146
+ }}
147
+ onClick={() => setActive(i)}
148
+ aria-current={active === i ? "page" : undefined}
149
+ className={cn(
150
+ "relative z-10 px-4 py-2 text-sm font-medium rounded-full transition-colors",
151
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
152
+ active === i
153
+ ? "text-primary"
154
+ : "text-muted-foreground hover:text-foreground"
155
+ )}
156
+ >
157
+ {item.label}
158
+ </button>
159
+ ))}
160
+ </div>
161
+ </div>
162
+ );
163
+ }
164
+
165
+ export const PillNav: Story = {
166
+ render: () => <PillNavDemo />,
167
+ };
168
+
169
+ // ─── VerticalNav — sidebar navigation sliding indicator ───────────────────────
170
+
171
+ const SIDEBAR_NAV = [
172
+ { value: "portfolio", label: "Portfolio" },
173
+ { value: "clients", label: "Clients" },
174
+ { value: "projects", label: "Projects" },
175
+ { value: "reports", label: "Reports" },
176
+ { value: "settings", label: "Settings" },
177
+ ];
178
+
179
+ function VerticalNavDemo() {
180
+ const [active, setActive] = React.useState(0);
181
+ const containerRef = React.useRef<HTMLDivElement>(null);
182
+ const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]);
183
+ const [target, setTarget] = React.useState<HTMLElement | null>(null);
184
+
185
+ React.useEffect(() => {
186
+ setTarget(itemRefs.current[active] ?? null);
187
+ }, [active]);
188
+
189
+ return (
190
+ <div className="flex gap-6 w-[360px]">
191
+ <nav aria-label="Design system sections" className="w-40">
192
+ <div
193
+ ref={containerRef}
194
+ className="relative flex flex-col gap-0.5"
195
+ >
196
+ <FloatingIndicator
197
+ target={target}
198
+ parent={containerRef.current}
199
+ className="bg-muted rounded-md shadow-none"
200
+ />
201
+ {SIDEBAR_NAV.map((item, i) => (
202
+ <button
203
+ key={item.value}
204
+ ref={(el) => {
205
+ itemRefs.current[i] = el;
206
+ }}
207
+ onClick={() => setActive(i)}
208
+ aria-current={active === i ? "page" : undefined}
209
+ className={cn(
210
+ "relative z-10 w-full text-left px-3 py-2 text-sm font-medium rounded-md transition-colors",
211
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
212
+ active === i
213
+ ? "text-foreground"
214
+ : "text-muted-foreground hover:text-foreground"
215
+ )}
216
+ >
217
+ {item.label}
218
+ </button>
219
+ ))}
220
+ </div>
221
+ </nav>
222
+ <div className="flex-1 pt-1">
223
+ <p className="text-xs text-muted-foreground mb-1">Active section</p>
224
+ <p className="text-sm font-medium">{SIDEBAR_NAV[active].label}</p>
225
+ </div>
226
+ </div>
227
+ );
228
+ }
229
+
230
+ export const VerticalNav: Story = {
231
+ render: () => <VerticalNavDemo />,
232
+ };
233
+
234
+ // ─── RealisticUse — segmented control with content ────────────────────────────
235
+
236
+ /**
237
+ * Complete segmented control pattern: FloatingIndicator powers the sliding
238
+ * highlight inside a custom nav bar, with real content below each tab.
239
+ * Demonstrates the useFloatingIndicator hook for integrated state management.
240
+ */
241
+
242
+ const DASHBOARD_TABS = [
243
+ { value: "dashboard", label: "Dashboard" },
244
+ { value: "analytics", label: "Analytics" },
245
+ { value: "settings", label: "Settings" },
246
+ ];
247
+
248
+ const DASHBOARD_CONTENT: Record<string, React.ReactNode> = {
249
+ dashboard: (
250
+ <div className="space-y-2">
251
+ <p className="text-sm font-medium text-foreground">Active projects — Seo-yun Park</p>
252
+ <p className="text-sm text-muted-foreground">
253
+ Watershed Analytics Q3 · On track · 12 components shipped
254
+ </p>
255
+ <p className="text-sm text-muted-foreground">
256
+ Civic Design System · In review · 4 tokens pending approval
257
+ </p>
258
+ </div>
259
+ ),
260
+ analytics: (
261
+ <div className="space-y-2">
262
+ <p className="text-sm font-medium text-foreground">Usage metrics · Last 30 days</p>
263
+ <p className="text-sm text-muted-foreground">
264
+ Component renders: <span className="font-medium text-foreground">142,800</span>
265
+ </p>
266
+ <p className="text-sm text-muted-foreground">
267
+ Token overrides applied: <span className="font-medium text-foreground">2,340</span>
268
+ </p>
269
+ </div>
270
+ ),
271
+ settings: (
272
+ <div className="space-y-2">
273
+ <p className="text-sm font-medium text-foreground">Workspace settings — Jordan Reeves</p>
274
+ <p className="text-sm text-muted-foreground">
275
+ Brand: Watershed Analytics · Slug: watershed
276
+ </p>
277
+ <p className="text-sm text-muted-foreground">
278
+ Theme: System default · AAA audit: passing (78/78 pairs)
279
+ </p>
280
+ </div>
281
+ ),
282
+ };
283
+
284
+ function RealisticUseDemo() {
285
+ const [active, setActive] = React.useState(0);
286
+ const containerRef = React.useRef<HTMLDivElement>(null);
287
+ const { target, setTarget } = useFloatingIndicator(containerRef);
288
+ const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]);
289
+
290
+ React.useEffect(() => {
291
+ setTarget(itemRefs.current[active] ?? null);
292
+ }, [active]);
293
+
294
+ return (
295
+ <div className="w-[440px] space-y-4">
296
+ <div className="rounded-xl border border-border bg-card shadow-sm">
297
+ {/* Custom segmented nav bar */}
298
+ <div className="border-b border-border px-4 pt-4 pb-0">
299
+ <div
300
+ ref={containerRef}
301
+ role="tablist"
302
+ aria-label="Dashboard sections"
303
+ className="relative inline-flex gap-0 border-b-0"
304
+ >
305
+ <FloatingIndicator
306
+ target={target}
307
+ parent={containerRef.current}
308
+ className="rounded-t-md rounded-b-none bg-background shadow-none border border-b-0 border-border"
309
+ />
310
+ {DASHBOARD_TABS.map((tab, i) => (
311
+ <button
312
+ key={tab.value}
313
+ ref={(el) => {
314
+ itemRefs.current[i] = el;
315
+ }}
316
+ role="tab"
317
+ aria-selected={active === i}
318
+ onClick={() => setActive(i)}
319
+ className={cn(
320
+ "relative z-10 px-4 py-2.5 text-sm font-medium transition-colors",
321
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm",
322
+ active === i
323
+ ? "text-foreground"
324
+ : "text-muted-foreground hover:text-foreground"
325
+ )}
326
+ >
327
+ {tab.label}
328
+ </button>
329
+ ))}
330
+ </div>
331
+ </div>
332
+ {/* Tab content */}
333
+ <div className="p-4">
334
+ {DASHBOARD_CONTENT[DASHBOARD_TABS[active].value]}
335
+ </div>
336
+ </div>
337
+ </div>
338
+ );
339
+ }
340
+
341
+ export const RealisticUse: Story = {
342
+ render: () => <RealisticUseDemo />,
343
+ };
@@ -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
+ }