@behavioral-agentic-design-system/core 0.28.0 → 0.30.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 +67 -11
- 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 +5679 -3073
- package/src/app/preview/health/page.tsx +201 -0
- 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/button.tsx +10 -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-clear-button.tsx +52 -0
- package/src/components/ui/input.tsx +39 -20
- 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 +35 -19
- 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/questionnaire.tsx +334 -0
- package/src/components/ui/result.tsx +151 -0
- package/src/components/ui/rolling-number.tsx +1 -0
- package/src/components/ui/sidebar.tsx +5 -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/textarea.tsx +5 -0
- 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 +12 -0
- package/src/hooks/use-global-primary-color.ts +57 -6
- package/src/lib/get-icon-color.ts +66 -0
- package/src/stories/Alert.stories.tsx +31 -1
- package/src/stories/Badge.stories.tsx +63 -6
- package/src/stories/Button.stories.tsx +3 -0
- 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 +94 -0
- package/src/stories/InputClearButton.stories.tsx +53 -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 +7 -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/Questionnaire.stories.tsx +287 -0
- package/src/stories/Result.stories.tsx +145 -0
- package/src/stories/RollingNumber.stories.tsx +1 -1
- package/src/stories/Sidebar.stories.tsx +2 -0
- 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 +140 -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/Textarea.stories.tsx +2 -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
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { SimpleGrid } from "@behavioral-agentic-design-system/core/components/ui/simple-grid";
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardDescription,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof SimpleGrid> = {
|
|
13
|
+
title: "Components/SimpleGrid",
|
|
14
|
+
component: SimpleGrid,
|
|
15
|
+
parameters: { layout: "padded" },
|
|
16
|
+
tags: ["autodocs"],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
function Cell({ label }: { label: string }) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="flex h-16 items-center justify-center rounded-lg border border-border bg-card">
|
|
24
|
+
<span className="text-sm text-muted-foreground">{label}</span>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Default: StoryObj = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<SimpleGrid>
|
|
32
|
+
{Array.from({ length: 6 }, (_, i) => (
|
|
33
|
+
<Cell key={i} label={`Cell ${i + 1}`} />
|
|
34
|
+
))}
|
|
35
|
+
</SimpleGrid>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const FixedCols: StoryObj = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div className="space-y-6">
|
|
42
|
+
{([2, 3, 4] as const).map((n) => (
|
|
43
|
+
<div key={n}>
|
|
44
|
+
<p className="mb-2 text-xs text-muted-foreground">{`cols={${n}}`}</p>
|
|
45
|
+
<SimpleGrid cols={n} gap="sm">
|
|
46
|
+
{Array.from({ length: n }, (_, i) => (
|
|
47
|
+
<Cell key={i} label={`${i + 1}`} />
|
|
48
|
+
))}
|
|
49
|
+
</SimpleGrid>
|
|
50
|
+
</div>
|
|
51
|
+
))}
|
|
52
|
+
</div>
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const ResponsiveCols: StoryObj = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<div>
|
|
59
|
+
<p className="mb-2 text-xs text-muted-foreground">
|
|
60
|
+
{`cols={{ base: 1, sm: 2, md: 3, lg: 4 }} — resize the viewport`}
|
|
61
|
+
</p>
|
|
62
|
+
<SimpleGrid cols={{ base: 1, sm: 2, md: 3, lg: 4 }} gap="md">
|
|
63
|
+
{Array.from({ length: 8 }, (_, i) => (
|
|
64
|
+
<Cell key={i} label={`Cell ${i + 1}`} />
|
|
65
|
+
))}
|
|
66
|
+
</SimpleGrid>
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const GapVariants: StoryObj = {
|
|
72
|
+
render: () => (
|
|
73
|
+
<div className="space-y-6">
|
|
74
|
+
{(["xs", "md", "xl"] as const).map((gap) => (
|
|
75
|
+
<div key={gap}>
|
|
76
|
+
<p className="mb-2 text-xs text-muted-foreground">{`gap="${gap}"`}</p>
|
|
77
|
+
<SimpleGrid cols={3} gap={gap}>
|
|
78
|
+
{Array.from({ length: 3 }, (_, i) => (
|
|
79
|
+
<Cell key={i} label={`${i + 1}`} />
|
|
80
|
+
))}
|
|
81
|
+
</SimpleGrid>
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const RealisticUse: StoryObj = {
|
|
89
|
+
render: () => (
|
|
90
|
+
<SimpleGrid cols={{ base: 1, sm: 2, lg: 3 }}>
|
|
91
|
+
<Card>
|
|
92
|
+
<CardHeader>
|
|
93
|
+
<CardTitle>Tokens v2 proposal</CardTitle>
|
|
94
|
+
<CardDescription>Jordan Reeves — review May 26, 2026</CardDescription>
|
|
95
|
+
</CardHeader>
|
|
96
|
+
<CardContent>
|
|
97
|
+
<p className="text-sm text-muted-foreground">
|
|
98
|
+
Consolidates the spacing scale to eight stops; retires four
|
|
99
|
+
orphaned color tokens.
|
|
100
|
+
</p>
|
|
101
|
+
</CardContent>
|
|
102
|
+
</Card>
|
|
103
|
+
<Card>
|
|
104
|
+
<CardHeader>
|
|
105
|
+
<CardTitle>Component usage export</CardTitle>
|
|
106
|
+
<CardDescription>
|
|
107
|
+
Seo-yun Park — Q3 2026 (component-usage-export-2026-q3.csv)
|
|
108
|
+
</CardDescription>
|
|
109
|
+
</CardHeader>
|
|
110
|
+
<CardContent>
|
|
111
|
+
<p className="text-sm text-muted-foreground">
|
|
112
|
+
Adoption report across the three active product surfaces.
|
|
113
|
+
</p>
|
|
114
|
+
</CardContent>
|
|
115
|
+
</Card>
|
|
116
|
+
<Card>
|
|
117
|
+
<CardHeader>
|
|
118
|
+
<CardTitle>A11y audit findings</CardTitle>
|
|
119
|
+
<CardDescription>Marcus Lindqvist — July 2026</CardDescription>
|
|
120
|
+
</CardHeader>
|
|
121
|
+
<CardContent>
|
|
122
|
+
<p className="text-sm text-muted-foreground">
|
|
123
|
+
Zero AAA contrast failures; two advisory focus-order notes on the
|
|
124
|
+
settings screen.
|
|
125
|
+
</p>
|
|
126
|
+
</CardContent>
|
|
127
|
+
</Card>
|
|
128
|
+
</SimpleGrid>
|
|
129
|
+
),
|
|
130
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Skeleton } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
|
|
2
|
+
import { Skeleton, SkeletonRegion } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Skeleton> = {
|
|
5
5
|
title: "Components/Skeleton",
|
|
@@ -40,6 +40,67 @@ export const Variant_Text: Story = {
|
|
|
40
40
|
),
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
export const Variant_Wave: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<div className="flex items-start gap-3 w-[320px]">
|
|
46
|
+
<Skeleton animation="wave" shape="circle" className="size-12" />
|
|
47
|
+
<div className="flex-1 space-y-2">
|
|
48
|
+
<Skeleton animation="wave" className="h-4 w-[80%]" />
|
|
49
|
+
<Skeleton animation="wave" shape="text" lines={3} />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Variant_NoAnimation: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<div className="flex items-start gap-3 w-[320px]">
|
|
58
|
+
<Skeleton animation={false} shape="circle" className="size-12" />
|
|
59
|
+
<div className="flex-1 space-y-2">
|
|
60
|
+
<Skeleton animation={false} className="h-4 w-[80%]" />
|
|
61
|
+
<Skeleton animation={false} shape="text" lines={3} />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithAnimation: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="w-[320px] space-y-6">
|
|
70
|
+
{(["pulse", "wave", false] as const).map((animation) => (
|
|
71
|
+
<div key={String(animation)} className="space-y-2">
|
|
72
|
+
<p className="text-sm font-medium text-muted-foreground">
|
|
73
|
+
{animation === false ? "none" : animation}
|
|
74
|
+
</p>
|
|
75
|
+
<div className="flex items-center gap-3">
|
|
76
|
+
<Skeleton animation={animation} shape="circle" />
|
|
77
|
+
<div className="flex-1 space-y-2">
|
|
78
|
+
<Skeleton animation={animation} className="h-4 w-[80%]" />
|
|
79
|
+
<Skeleton animation={animation} className="h-4 w-[60%]" />
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const WithRegion: Story = {
|
|
89
|
+
render: () => (
|
|
90
|
+
<SkeletonRegion label="Loading activity feed…" className="w-[320px] space-y-4">
|
|
91
|
+
{Array.from({ length: 3 }, (_, i) => (
|
|
92
|
+
<div key={i} className="flex items-center gap-3">
|
|
93
|
+
<Skeleton shape="circle" className="size-10" />
|
|
94
|
+
<div className="flex-1 space-y-2">
|
|
95
|
+
<Skeleton shape="text" className="w-[55%]" />
|
|
96
|
+
<Skeleton shape="text" className="w-[80%]" />
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
))}
|
|
100
|
+
</SkeletonRegion>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
43
104
|
export const RealisticUse: Story = {
|
|
44
105
|
render: () => (<div className="flex items-start gap-3 w-[320px]">
|
|
45
106
|
<Skeleton shape="circle" className="size-12" />
|
|
@@ -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,140 @@
|
|
|
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
|
+
// tabIndex={0} makes the scrollable region keyboard-accessible (axe scrollable-region-focusable)
|
|
94
|
+
<Group wrap={false} gap="sm" className="overflow-x-auto max-w-xs" tabIndex={0} aria-label="Workflow step progress">
|
|
95
|
+
<Badge variant="secondary">Step 1</Badge>
|
|
96
|
+
<Badge variant="secondary">Step 2</Badge>
|
|
97
|
+
<Badge variant="secondary">Step 3</Badge>
|
|
98
|
+
<Badge variant="secondary">Step 4</Badge>
|
|
99
|
+
<Badge variant="secondary">Step 5</Badge>
|
|
100
|
+
</Group>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// ─── RealisticUse: Stack + Group composing a settings section ─────────────────
|
|
105
|
+
|
|
106
|
+
export const RealisticUse: StoryObj = {
|
|
107
|
+
render: () => (
|
|
108
|
+
<Stack gap="lg" className="w-96 rounded-xl border border-border bg-card p-6">
|
|
109
|
+
<Stack gap="xs">
|
|
110
|
+
<p className="text-sm font-semibold">Notification preferences</p>
|
|
111
|
+
<p className="text-xs text-muted-foreground">
|
|
112
|
+
Choose how you receive release updates.
|
|
113
|
+
</p>
|
|
114
|
+
</Stack>
|
|
115
|
+
|
|
116
|
+
<Stack gap="sm">
|
|
117
|
+
{[
|
|
118
|
+
{ label: "PR reviews", detail: "Instant" },
|
|
119
|
+
{ label: "CI failures", detail: "Instant" },
|
|
120
|
+
{ label: "Weekly digest", detail: "Every Monday, 9 AM" },
|
|
121
|
+
{ label: "Changelog updates", detail: "On release" },
|
|
122
|
+
].map(({ label, detail }) => (
|
|
123
|
+
<Group key={label} justify="between" wrap={false} align="center"
|
|
124
|
+
className="rounded-lg border border-border bg-background px-4 py-3">
|
|
125
|
+
<Stack gap="none">
|
|
126
|
+
<p className="text-sm font-medium">{label}</p>
|
|
127
|
+
<p className="text-xs text-muted-foreground">{detail}</p>
|
|
128
|
+
</Stack>
|
|
129
|
+
<Button variant="outline" size="sm">Edit</Button>
|
|
130
|
+
</Group>
|
|
131
|
+
))}
|
|
132
|
+
</Stack>
|
|
133
|
+
|
|
134
|
+
<Group justify="end" gap="sm">
|
|
135
|
+
<Button variant="ghost" size="sm">Cancel</Button>
|
|
136
|
+
<Button size="sm">Save</Button>
|
|
137
|
+
</Group>
|
|
138
|
+
</Stack>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
@@ -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
|
+
};
|