@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.
- package/package.json +2 -2
- package/scripts/a11y-lint.cjs +78 -9
- package/scripts/build-tokens.cjs +273 -15
- package/scripts/wcag-audit.cjs +37 -7
- package/src/api/layers/file.ts +1 -0
- package/src/app/font-ready.tsx +6 -5
- package/src/app/layout.tsx +54 -3
- package/src/app/preview/components/page.tsx +5532 -3044
- package/src/app/preview/layout.tsx +4 -1
- package/src/app/preview/showcase-filter.tsx +66 -0
- package/src/app/preview/tab-replay.tsx +63 -0
- package/src/app/shell.tsx +74 -18
- package/src/components/customize/save-bar.tsx +19 -6
- package/src/components/docs-tab.tsx +36 -24
- package/src/components/layers-tab.tsx +37 -5
- package/src/components/ui/alert.tsx +12 -0
- package/src/components/ui/badge.tsx +19 -0
- package/src/components/ui/chat-marker.tsx +120 -0
- package/src/components/ui/checkbox.tsx +9 -1
- package/src/components/ui/close-button.tsx +71 -0
- package/src/components/ui/combobox.tsx +62 -3
- package/src/components/ui/container.tsx +65 -0
- package/src/components/ui/date-field.tsx +368 -0
- package/src/components/ui/drawer.tsx +334 -0
- package/src/components/ui/file-button.tsx +145 -0
- package/src/components/ui/floating-indicator.tsx +217 -0
- package/src/components/ui/format-byte.tsx +113 -0
- package/src/components/ui/index.ts +21 -0
- package/src/components/ui/input.tsx +38 -3
- package/src/components/ui/keyboard-shortcut.tsx +146 -0
- package/src/components/ui/loading-dots.tsx +99 -0
- package/src/components/ui/month-picker.tsx +296 -0
- package/src/components/ui/multi-select.tsx +15 -13
- package/src/components/ui/nav-link.tsx +200 -0
- package/src/components/ui/navigation-rail.tsx +256 -0
- package/src/components/ui/notification.tsx +20 -0
- package/src/components/ui/password-input.tsx +34 -1
- package/src/components/ui/progress.tsx +15 -1
- package/src/components/ui/prose.tsx +62 -0
- package/src/components/ui/result.tsx +151 -0
- package/src/components/ui/rolling-number.tsx +1 -0
- package/src/components/ui/simple-grid.tsx +110 -0
- package/src/components/ui/skeleton.tsx +52 -3
- package/src/components/ui/squircle.tsx +274 -0
- package/src/components/ui/stack.tsx +105 -0
- package/src/components/ui/status-badge.tsx +93 -0
- package/src/components/ui/tabs.tsx +34 -7
- package/src/components/ui/tag.tsx +46 -5
- package/src/components/ui/theme-icon.tsx +138 -0
- package/src/components/ui/timeline.tsx +27 -10
- package/src/components/ui/tooltip.tsx +12 -1
- package/src/components/ui/tree-select.tsx +386 -0
- package/src/components/ui/year-picker.tsx +307 -0
- package/src/data/docs-index.ts +10 -0
- package/src/hooks/use-global-primary-color.ts +57 -6
- package/src/stories/Alert.stories.tsx +31 -1
- package/src/stories/Badge.stories.tsx +63 -6
- package/src/stories/ChatMarker.stories.tsx +59 -0
- package/src/stories/Checkbox.stories.tsx +5 -0
- package/src/stories/CloseButton.stories.tsx +65 -0
- package/src/stories/Combobox.stories.tsx +74 -3
- package/src/stories/Container.stories.tsx +134 -0
- package/src/stories/DateField.stories.tsx +114 -0
- package/src/stories/Drawer.stories.tsx +211 -0
- package/src/stories/FileButton.stories.tsx +117 -0
- package/src/stories/FloatingIndicator.stories.tsx +343 -0
- package/src/stories/FormatByte.stories.tsx +142 -0
- package/src/stories/Input.stories.tsx +91 -0
- package/src/stories/KeyboardShortcut.stories.tsx +87 -0
- package/src/stories/LoadingDots.stories.tsx +73 -0
- package/src/stories/MonthPicker.stories.tsx +99 -0
- package/src/stories/MultiSelect.stories.tsx +3 -1
- package/src/stories/NavLink.stories.tsx +213 -0
- package/src/stories/NavigationRail.stories.tsx +413 -0
- package/src/stories/Notification.stories.tsx +53 -0
- package/src/stories/PasswordInput.stories.tsx +21 -0
- package/src/stories/Progress.stories.tsx +38 -0
- package/src/stories/Prose.stories.tsx +232 -0
- package/src/stories/Result.stories.tsx +145 -0
- package/src/stories/RollingNumber.stories.tsx +1 -1
- package/src/stories/SimpleGrid.stories.tsx +130 -0
- package/src/stories/Skeleton.stories.tsx +62 -1
- package/src/stories/Squircle.stories.tsx +127 -0
- package/src/stories/Stack.stories.tsx +139 -0
- package/src/stories/StatusBadge.stories.tsx +125 -0
- package/src/stories/Tabs.stories.tsx +56 -1
- package/src/stories/Tag.stories.tsx +31 -0
- package/src/stories/ThemeIcon.stories.tsx +97 -0
- package/src/stories/Timeline.stories.tsx +69 -0
- package/src/stories/Tooltip.stories.tsx +18 -0
- package/src/stories/TreeSelect.stories.tsx +222 -0
- package/src/stories/YearPicker.stories.tsx +100 -0
- package/src/styles.css +289 -15
- package/src/tokens.json +96 -1
- package/LICENSE +0 -21
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Squircle } from "@behavioral-agentic-design-system/core/components/ui/squircle";
|
|
3
|
+
import { Card } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Squircle> = {
|
|
6
|
+
title: "Components/Squircle",
|
|
7
|
+
component: Squircle,
|
|
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
|
+
<Squircle className="grid size-40 place-content-center bg-primary text-primary-foreground">
|
|
18
|
+
<span className="text-sm font-medium">Squircle</span>
|
|
19
|
+
</Squircle>
|
|
20
|
+
),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// The smoothing progression, left to right. smoothing={0} is pixel-identical to an ordinary rounded
|
|
24
|
+
// box (radius unchanged) — the proof that Squircle RE-CURVES the radius scale rather than competing
|
|
25
|
+
// with it. All four share the same --radius, only the corner curve differs.
|
|
26
|
+
export const SmoothingScale: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<div className="flex items-end gap-6">
|
|
29
|
+
{[0, 0.3, 0.6, 1].map((s) => (
|
|
30
|
+
<div key={s} className="flex flex-col items-center gap-2">
|
|
31
|
+
<Squircle radius={24} smoothing={s} className="size-28 bg-primary" />
|
|
32
|
+
<span className="text-xs font-medium text-muted-foreground">
|
|
33
|
+
smoothing {s}
|
|
34
|
+
{s === 0 ? " (= rounded)" : ""}
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// When radius ≥ min(width, height) / 2 the shape auto-resolves to a smooth capsule (stadium).
|
|
43
|
+
export const Capsule: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<Squircle
|
|
46
|
+
radius={999}
|
|
47
|
+
className="grid h-16 w-64 place-content-center bg-secondary text-secondary-foreground"
|
|
48
|
+
>
|
|
49
|
+
<span className="text-sm font-medium">Capsule</span>
|
|
50
|
+
</Squircle>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// The optional border follows the squircle edge (drawn via an even-odd clipped overlay), not a
|
|
55
|
+
// rectangle — so a bordered squircle stays a squircle. Border color defaults to the --border token.
|
|
56
|
+
export const WithBorder: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<Squircle
|
|
59
|
+
radius={28}
|
|
60
|
+
borderWidth={3}
|
|
61
|
+
borderColor="var(--primary)"
|
|
62
|
+
className="grid size-40 place-content-center bg-card text-card-foreground"
|
|
63
|
+
>
|
|
64
|
+
<span className="text-sm font-medium">Bordered</span>
|
|
65
|
+
</Squircle>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// A11y: a clip-path clips the element's OWN focus ring, so Squircle must not be the focusable element
|
|
70
|
+
// itself. The correct interactive pattern is Squircle as a DECORATIVE BACKGROUND inside a real control
|
|
71
|
+
// that owns an unclipped, visible focus ring. Tab to the button below — the ring is intact.
|
|
72
|
+
export const InteractiveSurface: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<button
|
|
75
|
+
type="button"
|
|
76
|
+
className="relative isolate grid min-h-11 place-content-center px-6 text-sm font-medium text-primary-foreground bg-primary outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-offset-2"
|
|
77
|
+
>
|
|
78
|
+
{/* `isolate` on the host is required: it creates a stacking context so the -z-10 background
|
|
79
|
+
squircle sits behind the label but IN FRONT of the page, not behind the whole card. */}
|
|
80
|
+
<Squircle aria-hidden radius={16} className="absolute inset-0 -z-10 bg-primary" />
|
|
81
|
+
Book a lane
|
|
82
|
+
</button>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Polymorphic host: `as` swaps the element for non-interactive semantics (article/section/li/etc.).
|
|
87
|
+
export const AsPolymorphic: Story = {
|
|
88
|
+
render: () => (
|
|
89
|
+
<Squircle
|
|
90
|
+
as="article"
|
|
91
|
+
radius={20}
|
|
92
|
+
className="grid size-40 place-content-center bg-accent text-accent-foreground"
|
|
93
|
+
>
|
|
94
|
+
<span className="text-sm font-medium"><article></span>
|
|
95
|
+
</Squircle>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// Squircles beside a normal rounded Card at the SAME --radius — the coexistence read: identical
|
|
100
|
+
// corner radius, softer curve. Avatar + media thumbnail + label, real content.
|
|
101
|
+
export const RealisticUse: Story = {
|
|
102
|
+
render: () => (
|
|
103
|
+
<div className="flex items-center gap-6">
|
|
104
|
+
<div className="flex flex-col items-center gap-3">
|
|
105
|
+
<Squircle className="grid size-16 place-content-center bg-primary text-lg font-semibold text-primary-foreground">
|
|
106
|
+
PR
|
|
107
|
+
</Squircle>
|
|
108
|
+
<span className="text-xs font-medium text-muted-foreground">Priya Raman</span>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<Squircle radius={16} className="w-56 overflow-hidden bg-card">
|
|
112
|
+
<div className="h-28 w-full bg-gradient-to-br from-primary/80 to-primary" />
|
|
113
|
+
<div className="p-4">
|
|
114
|
+
<p className="text-sm font-semibold text-card-foreground">Freestyle · Lane 4</p>
|
|
115
|
+
<p className="text-xs font-medium text-muted-foreground">Morning session, 6:30 AM</p>
|
|
116
|
+
</div>
|
|
117
|
+
</Squircle>
|
|
118
|
+
|
|
119
|
+
<Card className="w-56 p-4">
|
|
120
|
+
<p className="text-sm font-semibold">Ordinary Card</p>
|
|
121
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
122
|
+
Same --radius, rounded corners — set beside the squircles to compare the curve.
|
|
123
|
+
</p>
|
|
124
|
+
</Card>
|
|
125
|
+
</div>
|
|
126
|
+
),
|
|
127
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Stack, Group } from "@behavioral-agentic-design-system/core/components/ui/stack";
|
|
4
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: "Components/Stack",
|
|
9
|
+
parameters: { layout: "centered" },
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
// ─── Stack stories ─────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
export const Default: StoryObj = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<Stack className="w-64 rounded-lg border border-border bg-card p-4">
|
|
20
|
+
<div className="h-8 rounded bg-muted" />
|
|
21
|
+
<div className="h-8 rounded bg-muted" />
|
|
22
|
+
<div className="h-8 rounded bg-muted" />
|
|
23
|
+
</Stack>
|
|
24
|
+
),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Stack_GapVariants: StoryObj = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<div className="flex gap-8">
|
|
30
|
+
{(["xs", "sm", "md", "lg", "xl"] as const).map((gap) => (
|
|
31
|
+
<Stack key={gap} gap={gap} className="w-28 rounded-lg border border-border bg-card p-3">
|
|
32
|
+
<p className="text-xs text-muted-foreground">{`gap="${gap}"`}</p>
|
|
33
|
+
<div className="h-6 rounded bg-muted" />
|
|
34
|
+
<div className="h-6 rounded bg-muted" />
|
|
35
|
+
<div className="h-6 rounded bg-muted" />
|
|
36
|
+
</Stack>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Stack_AlignVariants: StoryObj = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<div className="flex gap-6">
|
|
45
|
+
{(["start", "center", "end", "stretch"] as const).map((align) => (
|
|
46
|
+
<Stack key={align} gap="sm" align={align} className="w-32 rounded-lg border border-border bg-card p-3">
|
|
47
|
+
<p className="text-xs text-muted-foreground">{`align="${align}"`}</p>
|
|
48
|
+
<div className="h-6 w-20 rounded bg-primary/20" />
|
|
49
|
+
<div className="h-6 w-16 rounded bg-primary/20" />
|
|
50
|
+
<div className="h-6 w-24 rounded bg-primary/20" />
|
|
51
|
+
</Stack>
|
|
52
|
+
))}
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// ─── Group stories ─────────────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
export const Group_Default: StoryObj = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<Group className="max-w-sm">
|
|
62
|
+
<Badge variant="secondary">Design systems</Badge>
|
|
63
|
+
<Badge variant="secondary">Accessibility</Badge>
|
|
64
|
+
<Badge variant="secondary">Tokens</Badge>
|
|
65
|
+
<Badge variant="secondary">Components</Badge>
|
|
66
|
+
<Badge variant="secondary">Storybook</Badge>
|
|
67
|
+
</Group>
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Group_JustifyVariants: StoryObj = {
|
|
72
|
+
render: () => (
|
|
73
|
+
<Stack gap="sm" className="w-96">
|
|
74
|
+
{(["start", "center", "end", "between"] as const).map((justify) => (
|
|
75
|
+
<Group
|
|
76
|
+
key={justify}
|
|
77
|
+
justify={justify}
|
|
78
|
+
wrap={false}
|
|
79
|
+
className="rounded border border-border bg-card px-3 py-2"
|
|
80
|
+
>
|
|
81
|
+
<p className="text-xs text-muted-foreground w-14">{justify}</p>
|
|
82
|
+
<Badge variant="outline">Alpha</Badge>
|
|
83
|
+
<Badge variant="outline">Beta</Badge>
|
|
84
|
+
<Badge variant="outline">Gamma</Badge>
|
|
85
|
+
</Group>
|
|
86
|
+
))}
|
|
87
|
+
</Stack>
|
|
88
|
+
),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Group_NoWrap: StoryObj = {
|
|
92
|
+
render: () => (
|
|
93
|
+
<Group wrap={false} gap="sm" className="overflow-x-auto max-w-xs">
|
|
94
|
+
<Badge variant="secondary">Step 1</Badge>
|
|
95
|
+
<Badge variant="secondary">Step 2</Badge>
|
|
96
|
+
<Badge variant="secondary">Step 3</Badge>
|
|
97
|
+
<Badge variant="secondary">Step 4</Badge>
|
|
98
|
+
<Badge variant="secondary">Step 5</Badge>
|
|
99
|
+
</Group>
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ─── RealisticUse: Stack + Group composing a settings section ─────────────────
|
|
104
|
+
|
|
105
|
+
export const RealisticUse: StoryObj = {
|
|
106
|
+
render: () => (
|
|
107
|
+
<Stack gap="lg" className="w-96 rounded-xl border border-border bg-card p-6">
|
|
108
|
+
<Stack gap="xs">
|
|
109
|
+
<p className="text-sm font-semibold">Notification preferences</p>
|
|
110
|
+
<p className="text-xs text-muted-foreground">
|
|
111
|
+
Choose how you receive release updates.
|
|
112
|
+
</p>
|
|
113
|
+
</Stack>
|
|
114
|
+
|
|
115
|
+
<Stack gap="sm">
|
|
116
|
+
{[
|
|
117
|
+
{ label: "PR reviews", detail: "Instant" },
|
|
118
|
+
{ label: "CI failures", detail: "Instant" },
|
|
119
|
+
{ label: "Weekly digest", detail: "Every Monday, 9 AM" },
|
|
120
|
+
{ label: "Changelog updates", detail: "On release" },
|
|
121
|
+
].map(({ label, detail }) => (
|
|
122
|
+
<Group key={label} justify="between" wrap={false} align="center"
|
|
123
|
+
className="rounded-lg border border-border bg-background px-4 py-3">
|
|
124
|
+
<Stack gap="none">
|
|
125
|
+
<p className="text-sm font-medium">{label}</p>
|
|
126
|
+
<p className="text-xs text-muted-foreground">{detail}</p>
|
|
127
|
+
</Stack>
|
|
128
|
+
<Button variant="outline" size="sm">Edit</Button>
|
|
129
|
+
</Group>
|
|
130
|
+
))}
|
|
131
|
+
</Stack>
|
|
132
|
+
|
|
133
|
+
<Group justify="end" gap="sm">
|
|
134
|
+
<Button variant="ghost" size="sm">Cancel</Button>
|
|
135
|
+
<Button size="sm">Save</Button>
|
|
136
|
+
</Group>
|
|
137
|
+
</Stack>
|
|
138
|
+
),
|
|
139
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { StatusBadge } from "@behavioral-agentic-design-system/core/components/ui/status-badge";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Inline dot-and-label status indicator. Structurally distinct from Badge
|
|
6
|
+
* (tinted pill, no dot) and Indicator (positional overlay on a child).
|
|
7
|
+
*
|
|
8
|
+
* The dot is aria-hidden; the visible label is the sole accessible signal.
|
|
9
|
+
* Never rely on color alone — SC 1.4.1 requires a non-color differentiator,
|
|
10
|
+
* and StatusBadge always provides one via the label.
|
|
11
|
+
*
|
|
12
|
+
* The `processing` dot pulses (animate-pulse); the base layer's
|
|
13
|
+
* prefers-reduced-motion rule stills it automatically.
|
|
14
|
+
*/
|
|
15
|
+
const meta: Meta<typeof StatusBadge> = {
|
|
16
|
+
title: "Components/StatusBadge",
|
|
17
|
+
component: StatusBadge,
|
|
18
|
+
parameters: { layout: "centered" },
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
28
|
+
<StatusBadge status="active" />
|
|
29
|
+
<StatusBadge status="pending" />
|
|
30
|
+
<StatusBadge status="processing" />
|
|
31
|
+
<StatusBadge status="error" />
|
|
32
|
+
<StatusBadge status="offline" />
|
|
33
|
+
<StatusBadge status="warning" />
|
|
34
|
+
</div>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Variant_Active: Story = {
|
|
39
|
+
render: () => <StatusBadge status="active" />,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Variant_Pending: Story = {
|
|
43
|
+
render: () => <StatusBadge status="pending" />,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Variant_Processing: Story = {
|
|
47
|
+
render: () => <StatusBadge status="processing" />,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Variant_Error: Story = {
|
|
51
|
+
render: () => <StatusBadge status="error" />,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Variant_Offline: Story = {
|
|
55
|
+
render: () => <StatusBadge status="offline" />,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Variant_Warning: Story = {
|
|
59
|
+
render: () => <StatusBadge status="warning" />,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Size_Sm: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
65
|
+
<StatusBadge status="active" size="sm" />
|
|
66
|
+
<StatusBadge status="processing" size="sm" />
|
|
67
|
+
<StatusBadge status="error" size="sm" />
|
|
68
|
+
</div>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Size_Default: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
75
|
+
<StatusBadge status="active" size="default" />
|
|
76
|
+
<StatusBadge status="processing" size="default" />
|
|
77
|
+
<StatusBadge status="error" size="default" />
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const Size_Lg: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
85
|
+
<StatusBadge status="active" size="lg" />
|
|
86
|
+
<StatusBadge status="processing" size="lg" />
|
|
87
|
+
<StatusBadge status="error" size="lg" />
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const CustomLabel: Story = {
|
|
93
|
+
render: () => (
|
|
94
|
+
<div className="flex flex-col gap-2">
|
|
95
|
+
<StatusBadge status="active" label="Live" />
|
|
96
|
+
<StatusBadge status="pending" label="Awaiting review" />
|
|
97
|
+
<StatusBadge status="processing" label="Indexing…" />
|
|
98
|
+
<StatusBadge status="error" label="Build failed" />
|
|
99
|
+
<StatusBadge status="offline" label="Not reachable" />
|
|
100
|
+
</div>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const RealisticUse: Story = {
|
|
105
|
+
render: () => (
|
|
106
|
+
<div className="flex w-80 flex-col divide-y divide-border rounded-lg border border-border bg-card">
|
|
107
|
+
{(
|
|
108
|
+
[
|
|
109
|
+
{ name: "tokens-v2 pipeline", status: "active" },
|
|
110
|
+
{ name: "BADS staging fork", status: "processing", label: "Deploying…" },
|
|
111
|
+
{ name: "Jordan Reeves review", status: "pending" },
|
|
112
|
+
{ name: "BADS prod fork", status: "error", label: "Build failed" },
|
|
113
|
+
{ name: "Legacy API bridge", status: "offline" },
|
|
114
|
+
] as const
|
|
115
|
+
).map(({ name, status, label }) => (
|
|
116
|
+
<div key={name} className="flex items-center justify-between px-4 py-3">
|
|
117
|
+
<span className="min-w-0 truncate text-sm" title={name}>
|
|
118
|
+
{name}
|
|
119
|
+
</span>
|
|
120
|
+
<StatusBadge status={status} label={label} />
|
|
121
|
+
</div>
|
|
122
|
+
))}
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
@@ -36,6 +36,57 @@ type Story = StoryObj<typeof meta>;
|
|
|
36
36
|
// selected pill always reads as "brand, not neutral." Previous bg-accent broke
|
|
37
37
|
// forks where --accent is a dark color (e.g. plum), rendering the pill illegibly
|
|
38
38
|
// dark. Default and RealisticUse below exercise this state.
|
|
39
|
+
export const Variant_Default: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<Tabs defaultValue="overview" className="w-[480px]">
|
|
42
|
+
<TabsList variant="default">
|
|
43
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
44
|
+
<TabsTrigger value="usage">Usage</TabsTrigger>
|
|
45
|
+
<TabsTrigger value="billing">Billing</TabsTrigger>
|
|
46
|
+
</TabsList>
|
|
47
|
+
<TabsContent value="overview">Project overview goes here.</TabsContent>
|
|
48
|
+
<TabsContent value="usage">Usage statistics for this project.</TabsContent>
|
|
49
|
+
<TabsContent value="billing">Billing and plan settings.</TabsContent>
|
|
50
|
+
</Tabs>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Variant_Line: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<Tabs defaultValue="overview" className="w-[480px]">
|
|
57
|
+
<TabsList variant="line">
|
|
58
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
59
|
+
<TabsTrigger value="usage">Usage</TabsTrigger>
|
|
60
|
+
<TabsTrigger value="billing">Billing</TabsTrigger>
|
|
61
|
+
</TabsList>
|
|
62
|
+
<TabsContent value="overview">Project overview goes here.</TabsContent>
|
|
63
|
+
<TabsContent value="usage">Usage statistics for this project.</TabsContent>
|
|
64
|
+
<TabsContent value="billing">Billing and plan settings.</TabsContent>
|
|
65
|
+
</Tabs>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Pill variant: each trigger is an independently-shaped rounded-full pill.
|
|
70
|
+
// Active pill uses a soft brand tint (bg-primary/10 text-primary) — legible
|
|
71
|
+
// on all fork brand colors without inverting to white-on-dark. Use for filter
|
|
72
|
+
// chrome, category pickers, and tag-style navigation.
|
|
73
|
+
export const Variant_Pill: Story = {
|
|
74
|
+
render: () => (
|
|
75
|
+
<Tabs defaultValue="all" className="w-[480px]">
|
|
76
|
+
<TabsList variant="pill">
|
|
77
|
+
<TabsTrigger value="all">All</TabsTrigger>
|
|
78
|
+
<TabsTrigger value="active">Active</TabsTrigger>
|
|
79
|
+
<TabsTrigger value="draft">Draft</TabsTrigger>
|
|
80
|
+
<TabsTrigger value="archived">Archived</TabsTrigger>
|
|
81
|
+
</TabsList>
|
|
82
|
+
<TabsContent value="all">Showing all items.</TabsContent>
|
|
83
|
+
<TabsContent value="active">Showing active items only.</TabsContent>
|
|
84
|
+
<TabsContent value="draft">Showing draft items only.</TabsContent>
|
|
85
|
+
<TabsContent value="archived">Showing archived items only.</TabsContent>
|
|
86
|
+
</Tabs>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
39
90
|
export const Default: Story = {
|
|
40
91
|
render: () => (
|
|
41
92
|
<Tabs defaultValue="overview" className="w-[480px]">
|
|
@@ -78,6 +129,10 @@ export const RealisticUse: Story = {
|
|
|
78
129
|
// Scrollable TabsList — opt-in graceful overflow. Hides the scrollbar, keeps
|
|
79
130
|
// the active trigger in view, and fades the right edge while more is hidden,
|
|
80
131
|
// so a row too wide for its container stops clipping the active label.
|
|
132
|
+
// Scrollable tab row: the active trigger is kept visible by scrolling ONLY the
|
|
133
|
+
// list's own horizontal overflow — never the page. (A prior implementation used
|
|
134
|
+
// Element.scrollIntoView, which also scrolled vertical ancestors and yanked the
|
|
135
|
+
// whole page to a below-the-fold tab row on mount — corrections.md #012.)
|
|
81
136
|
export const Scrollable: Story = {
|
|
82
137
|
render: () => (
|
|
83
138
|
<Tabs defaultValue="account" className="w-[320px]">
|
|
@@ -150,4 +205,4 @@ export const Interaction_Switches: Story = {
|
|
|
150
205
|
expect(usageTab).toHaveAttribute("data-state", "active");
|
|
151
206
|
expect(canvas.getByText("Usage statistics panel.")).toBeVisible();
|
|
152
207
|
},
|
|
153
|
-
};
|
|
208
|
+
};
|
|
@@ -42,6 +42,37 @@ export const Variant_Info: Story = {
|
|
|
42
42
|
render: () => <Tag variant="info" label="Info" />,
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
// Size stories use real strings from content/personas/bads.json → primary.jargon
|
|
46
|
+
// (the real-content rule — no placeholder labels). Each size shows a plain tag
|
|
47
|
+
// and a dismissible one so the scaled close button is covered by Chromatic.
|
|
48
|
+
export const Size_XS: Story = {
|
|
49
|
+
render: () => (<div className="flex items-center gap-2 flex-wrap">
|
|
50
|
+
<Tag size="xs" label="token drift" />
|
|
51
|
+
<Tag size="xs" variant="info" label="visual regression" onClose={() => {}} />
|
|
52
|
+
</div>),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Size_SM: Story = {
|
|
56
|
+
render: () => (<div className="flex items-center gap-2 flex-wrap">
|
|
57
|
+
<Tag size="sm" label="design tokens" />
|
|
58
|
+
<Tag size="sm" variant="success" label="a11y contract" onClose={() => {}} />
|
|
59
|
+
</div>),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Size_MD: Story = {
|
|
63
|
+
render: () => (<div className="flex items-center gap-2 flex-wrap">
|
|
64
|
+
<Tag size="md" label="semantic layer" />
|
|
65
|
+
<Tag size="md" variant="warning" label="anti-pattern" onClose={() => {}} />
|
|
66
|
+
</div>),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Size_LG: Story = {
|
|
70
|
+
render: () => (<div className="flex items-center gap-2 flex-wrap">
|
|
71
|
+
<Tag size="lg" label="Radix primitive" />
|
|
72
|
+
<Tag size="lg" variant="error" label="focus trap" onClose={() => {}} />
|
|
73
|
+
</div>),
|
|
74
|
+
};
|
|
75
|
+
|
|
45
76
|
export const RealisticUse: Story = {
|
|
46
77
|
render: () => (<div className="flex items-center gap-2 flex-wrap">
|
|
47
78
|
<Tag label="Design" onClose={() => {}} />
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { PaletteIcon, StarIcon } from "lucide-react";
|
|
4
|
+
import { ThemeIcon } from "@behavioral-agentic-design-system/core/components/ui/theme-icon";
|
|
5
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof ThemeIcon> = {
|
|
8
|
+
title: "Components/ThemeIcon",
|
|
9
|
+
component: ThemeIcon,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
"Renders the icon for the active theme — Sun in light mode, Moon in dark mode — with a token-driven spring crossfade on theme change. Reads `data-theme` on <html>, then the `dark` class, then `prefers-color-scheme`; renders a neutral placeholder on the server so hydration never flashes the wrong icon. Decorative (`aria-hidden`) — the wrapping toggle carries the accessible label. Toggle Storybook's theme (or the story below) to see it flip.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
render: () => <ThemeIcon />,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Size_Small: Story = {
|
|
30
|
+
render: () => <ThemeIcon size={12} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Size_Large: Story = {
|
|
34
|
+
render: () => <ThemeIcon size={24} />,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const WithCustomIcons: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<ThemeIcon
|
|
40
|
+
size={24}
|
|
41
|
+
lightIcon={<PaletteIcon size={24} strokeWidth={1.5} />}
|
|
42
|
+
darkIcon={<StarIcon size={24} strokeWidth={1.5} />}
|
|
43
|
+
/>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* ThemeIcon has no disabled state — it is display-only and never interactive.
|
|
49
|
+
* The frozen equivalent: pass the same node to both slots so the icon never
|
|
50
|
+
* swaps, e.g. for a "follows system" row where the mode is not a choice.
|
|
51
|
+
*/
|
|
52
|
+
export const Static: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<ThemeIcon
|
|
55
|
+
size={24}
|
|
56
|
+
lightIcon={<StarIcon size={24} strokeWidth={1.5} />}
|
|
57
|
+
darkIcon={<StarIcon size={24} strokeWidth={1.5} />}
|
|
58
|
+
/>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function ThemeToggleDemo() {
|
|
63
|
+
const [dark, setDark] = React.useState(
|
|
64
|
+
() =>
|
|
65
|
+
typeof document !== "undefined" &&
|
|
66
|
+
document.documentElement.classList.contains("dark"),
|
|
67
|
+
);
|
|
68
|
+
const toggle = () => {
|
|
69
|
+
const next = !dark;
|
|
70
|
+
document.documentElement.classList.toggle("dark", next);
|
|
71
|
+
setDark(next);
|
|
72
|
+
};
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex w-72 items-center justify-between rounded-lg border border-border bg-card p-4">
|
|
75
|
+
<div className="space-y-0.5">
|
|
76
|
+
<p className="text-sm font-medium text-foreground">Appearance</p>
|
|
77
|
+
<p className="text-xs text-muted-foreground">
|
|
78
|
+
Currently {dark ? "dark" : "light"} for seoyun.park@figma.com
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
<Button
|
|
82
|
+
variant="outline"
|
|
83
|
+
size="icon-xl"
|
|
84
|
+
aria-label={dark ? "Switch to light mode" : "Switch to dark mode"}
|
|
85
|
+
aria-pressed={dark}
|
|
86
|
+
onClick={toggle}
|
|
87
|
+
>
|
|
88
|
+
{/* size 20 matches the icon-xl Button's forced svg size (size-5) */}
|
|
89
|
+
<ThemeIcon size={20} />
|
|
90
|
+
</Button>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const RealisticUse: Story = {
|
|
96
|
+
render: () => <ThemeToggleDemo />,
|
|
97
|
+
};
|
|
@@ -296,6 +296,75 @@ export const Variant_AlternateWithIcons: Story = {
|
|
|
296
296
|
),
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
+
// Horizontal orientation: step-progress row, dots above content.
|
|
300
|
+
// Connector line runs through all dot centers; last item's connector hidden.
|
|
301
|
+
export const Variant_Horizontal: Story = {
|
|
302
|
+
render: () => (
|
|
303
|
+
<div className="w-full max-w-2xl">
|
|
304
|
+
<Timeline orientation="horizontal">
|
|
305
|
+
<TimelineItem
|
|
306
|
+
status="complete"
|
|
307
|
+
title="Branch cut"
|
|
308
|
+
description="release/2.5.0 branched"
|
|
309
|
+
time="Jun 20"
|
|
310
|
+
/>
|
|
311
|
+
<TimelineItem
|
|
312
|
+
status="complete"
|
|
313
|
+
title="Token sync"
|
|
314
|
+
description="142 variables pulled"
|
|
315
|
+
time="Jun 21"
|
|
316
|
+
/>
|
|
317
|
+
<TimelineItem
|
|
318
|
+
status="active"
|
|
319
|
+
title="Audit"
|
|
320
|
+
description="12 of 18 done"
|
|
321
|
+
time="Jun 25"
|
|
322
|
+
/>
|
|
323
|
+
<TimelineItem
|
|
324
|
+
status="pending"
|
|
325
|
+
title="Release"
|
|
326
|
+
description="npm + Storybook"
|
|
327
|
+
time="Jun 28"
|
|
328
|
+
/>
|
|
329
|
+
</Timeline>
|
|
330
|
+
</div>
|
|
331
|
+
),
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
// Horizontal with icons — same step-indicator pattern, custom dot icons.
|
|
335
|
+
export const Variant_HorizontalWithIcons: Story = {
|
|
336
|
+
render: () => (
|
|
337
|
+
<div className="w-full max-w-2xl">
|
|
338
|
+
<Timeline orientation="horizontal">
|
|
339
|
+
<TimelineItem
|
|
340
|
+
status="complete"
|
|
341
|
+
icon={<UserCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
342
|
+
title="Account created"
|
|
343
|
+
time="Step 1"
|
|
344
|
+
/>
|
|
345
|
+
<TimelineItem
|
|
346
|
+
status="complete"
|
|
347
|
+
icon={<CreditCardIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
348
|
+
title="Plan selected"
|
|
349
|
+
time="Step 2"
|
|
350
|
+
/>
|
|
351
|
+
<TimelineItem
|
|
352
|
+
status="active"
|
|
353
|
+
icon={<ClipboardCheckIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
354
|
+
title="Configuring"
|
|
355
|
+
time="Step 3"
|
|
356
|
+
/>
|
|
357
|
+
<TimelineItem
|
|
358
|
+
status="pending"
|
|
359
|
+
icon={<TrophyIcon className="size-3" strokeWidth={1.5} aria-hidden />}
|
|
360
|
+
title="You're live"
|
|
361
|
+
time="Step 4"
|
|
362
|
+
/>
|
|
363
|
+
</Timeline>
|
|
364
|
+
</div>
|
|
365
|
+
),
|
|
366
|
+
};
|
|
367
|
+
|
|
299
368
|
// Realistic use: BADS Design System, v2.4.0 release journey
|
|
300
369
|
export const RealisticUse: Story = {
|
|
301
370
|
render: () => (
|