@behavioral-agentic-design-system/core 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/check-stories.mjs +12 -5
- package/scripts/fix-stories.mjs +6 -6
- package/scripts/generate-stories.cjs +7 -7
- package/src/app/preview/components/page.tsx +165 -50
- package/src/components/ui/code.tsx +55 -0
- package/src/components/ui/index.ts +0 -1
- package/src/components/ui/indicator.tsx +9 -7
- package/src/components/ui/native-select.tsx +68 -0
- package/src/components/ui/navigation-menu.tsx +23 -0
- package/src/components/ui/sheet.tsx +23 -6
- package/src/components/ui/spinner.tsx +14 -3
- package/src/components/ui/tags-input.tsx +210 -69
- package/src/stories/Accordion.stories.tsx +152 -0
- package/src/stories/Alert.stories.tsx +102 -0
- package/src/stories/AlertDialog.stories.tsx +125 -0
- package/src/stories/AspectRatio.stories.tsx +82 -0
- package/src/stories/Avatar.stories.tsx +36 -0
- package/src/stories/Badge.stories.tsx +54 -0
- package/src/stories/Breadcrumb.stories.tsx +36 -0
- package/src/stories/Button.stories.tsx +144 -0
- package/src/stories/ButtonGroup.stories.tsx +176 -0
- package/src/stories/Calendar.stories.tsx +67 -0
- package/src/stories/Card.stories.tsx +43 -0
- package/src/stories/Carousel.stories.tsx +233 -0
- package/src/stories/Chart.stories.tsx +174 -0
- package/src/stories/Checkbox.stories.tsx +32 -0
- package/src/stories/CircularProgress.stories.tsx +136 -0
- package/src/stories/Code.stories.tsx +131 -0
- package/src/stories/Collapsible.stories.tsx +27 -0
- package/src/stories/ColorPicker.stories.tsx +155 -0
- package/src/stories/Combobox.stories.tsx +168 -0
- package/src/stories/Command.stories.tsx +40 -0
- package/src/stories/ContextMenu.stories.tsx +293 -0
- package/src/stories/CopyButton.stories.tsx +111 -0
- package/src/stories/DatePicker.stories.tsx +176 -0
- package/src/stories/DateRangePicker.stories.tsx +95 -0
- package/src/stories/Dialog.stories.tsx +186 -0
- package/src/stories/DropdownMenu.stories.tsx +47 -0
- package/src/stories/EmptyState.stories.tsx +199 -0
- package/src/stories/Field.stories.tsx +155 -0
- package/src/stories/FileUpload.stories.tsx +134 -0
- package/src/stories/HoverCard.stories.tsx +149 -0
- package/src/stories/Indicator.stories.tsx +255 -0
- package/src/stories/Input.stories.tsx +69 -0
- package/src/stories/Kbd.stories.tsx +123 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/List.stories.tsx +159 -0
- package/src/stories/Menubar.stories.tsx +190 -0
- package/src/stories/MultiSelect.stories.tsx +107 -0
- package/src/stories/NativeSelect.stories.tsx +107 -0
- package/src/stories/NavigationMenu.stories.tsx +322 -0
- package/src/stories/NumberInput.stories.tsx +100 -0
- package/src/stories/Pagination.stories.tsx +201 -0
- package/src/stories/PasswordInput.stories.tsx +62 -0
- package/src/stories/PinInput.stories.tsx +136 -0
- package/src/stories/Popover.stories.tsx +37 -0
- package/src/stories/Progress.stories.tsx +64 -0
- package/src/stories/RadioGroup.stories.tsx +39 -0
- package/src/stories/RatingGroup.stories.tsx +102 -0
- package/src/stories/Resizable.stories.tsx +28 -0
- package/src/stories/Reveal.stories.tsx +63 -0
- package/src/stories/ScrollArea.stories.tsx +76 -0
- package/src/stories/SegmentedControl.stories.tsx +182 -0
- package/src/stories/Select.stories.tsx +62 -0
- package/src/stories/Separator.stories.tsx +28 -0
- package/src/stories/Sheet.stories.tsx +193 -0
- package/src/stories/Sidebar.stories.tsx +53 -0
- package/src/stories/Skeleton.stories.tsx +32 -0
- package/src/stories/Slider.stories.tsx +67 -0
- package/src/stories/Sonner.stories.tsx +146 -0
- package/src/stories/Spinner.stories.tsx +94 -0
- package/src/stories/Stepper.stories.tsx +228 -0
- package/src/stories/Switch.stories.tsx +58 -0
- package/src/stories/Table.stories.tsx +38 -0
- package/src/stories/Tabs.stories.tsx +128 -0
- package/src/stories/Tag.stories.tsx +51 -0
- package/src/stories/TagsInput.stories.tsx +154 -0
- package/src/stories/Textarea.stories.tsx +31 -0
- package/src/stories/TimePicker.stories.tsx +54 -0
- package/src/stories/Timeline.stories.tsx +263 -0
- package/src/stories/Toggle.stories.tsx +45 -0
- package/src/stories/ToggleGroup.stories.tsx +39 -0
- package/src/stories/Toolbar.stories.tsx +295 -0
- package/src/stories/Tooltip.stories.tsx +37 -0
- package/src/stories/TreeView.stories.tsx +293 -0
- package/src/components/ui/bottom-sheet.tsx +0 -133
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer,
|
|
4
|
+
ChartTooltip,
|
|
5
|
+
ChartTooltipContent,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/chart";
|
|
7
|
+
import {
|
|
8
|
+
Area,
|
|
9
|
+
AreaChart,
|
|
10
|
+
Bar,
|
|
11
|
+
BarChart,
|
|
12
|
+
CartesianGrid,
|
|
13
|
+
Line,
|
|
14
|
+
LineChart,
|
|
15
|
+
PolarAngleAxis,
|
|
16
|
+
PolarGrid,
|
|
17
|
+
Radar,
|
|
18
|
+
RadarChart,
|
|
19
|
+
ReferenceDot,
|
|
20
|
+
XAxis,
|
|
21
|
+
YAxis,
|
|
22
|
+
} from "recharts";
|
|
23
|
+
|
|
24
|
+
const meta: Meta<typeof ChartContainer> = {
|
|
25
|
+
title: "Components/Chart",
|
|
26
|
+
component: ChartContainer,
|
|
27
|
+
parameters: { layout: "centered" },
|
|
28
|
+
tags: ["autodocs"],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof meta>;
|
|
33
|
+
|
|
34
|
+
const monthlyData = [
|
|
35
|
+
{ month: "Jan", desktop: 186, mobile: 80 },
|
|
36
|
+
{ month: "Feb", desktop: 305, mobile: 200 },
|
|
37
|
+
{ month: "Mar", desktop: 237, mobile: 120 },
|
|
38
|
+
{ month: "Apr", desktop: 73, mobile: 190 },
|
|
39
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
40
|
+
{ month: "Jun", desktop: 214, mobile: 140 },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const twoSeriesConfig = {
|
|
44
|
+
desktop: { label: "Desktop", color: "var(--chart-1)" },
|
|
45
|
+
mobile: { label: "Mobile", color: "var(--chart-2)" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<ChartContainer
|
|
51
|
+
config={{ desktop: { label: "Desktop", color: "var(--chart-1)" } }}
|
|
52
|
+
className="h-48 w-[420px]"
|
|
53
|
+
>
|
|
54
|
+
<BarChart
|
|
55
|
+
data={[
|
|
56
|
+
{ month: "Jan", desktop: 186 },
|
|
57
|
+
{ month: "Feb", desktop: 305 },
|
|
58
|
+
{ month: "Mar", desktop: 237 },
|
|
59
|
+
]}
|
|
60
|
+
>
|
|
61
|
+
<CartesianGrid vertical={false} />
|
|
62
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} />
|
|
63
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
64
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
65
|
+
</BarChart>
|
|
66
|
+
</ChartContainer>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Variant_Line: Story = {
|
|
71
|
+
render: () => (
|
|
72
|
+
<ChartContainer config={twoSeriesConfig} className="h-56 w-[520px]">
|
|
73
|
+
<LineChart data={monthlyData} margin={{ top: 8, right: 16, left: 8, bottom: 0 }}>
|
|
74
|
+
<CartesianGrid vertical={false} />
|
|
75
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
|
|
76
|
+
<YAxis tickLine={false} axisLine={false} width={32} />
|
|
77
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
78
|
+
<Line type="monotone" dataKey="desktop" stroke="var(--color-desktop)" strokeWidth={2} dot={false} />
|
|
79
|
+
<Line type="monotone" dataKey="mobile" stroke="var(--color-mobile)" strokeWidth={2} dot={false} />
|
|
80
|
+
</LineChart>
|
|
81
|
+
</ChartContainer>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const Variant_Area: Story = {
|
|
86
|
+
render: () => (
|
|
87
|
+
<ChartContainer config={twoSeriesConfig} className="h-56 w-[520px]">
|
|
88
|
+
<AreaChart data={monthlyData} margin={{ top: 8, right: 16, left: 8, bottom: 0 }}>
|
|
89
|
+
<defs>
|
|
90
|
+
<linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">
|
|
91
|
+
<stop offset="5%" stopColor="var(--color-desktop)" stopOpacity={0.45} />
|
|
92
|
+
<stop offset="95%" stopColor="var(--color-desktop)" stopOpacity={0.05} />
|
|
93
|
+
</linearGradient>
|
|
94
|
+
<linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">
|
|
95
|
+
<stop offset="5%" stopColor="var(--color-mobile)" stopOpacity={0.45} />
|
|
96
|
+
<stop offset="95%" stopColor="var(--color-mobile)" stopOpacity={0.05} />
|
|
97
|
+
</linearGradient>
|
|
98
|
+
</defs>
|
|
99
|
+
<CartesianGrid vertical={false} />
|
|
100
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
|
|
101
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
102
|
+
<Area dataKey="desktop" type="monotone" fill="url(#fillDesktop)" stroke="var(--color-desktop)" strokeWidth={2} />
|
|
103
|
+
<Area dataKey="mobile" type="monotone" fill="url(#fillMobile)" stroke="var(--color-mobile)" strokeWidth={2} />
|
|
104
|
+
</AreaChart>
|
|
105
|
+
</ChartContainer>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const Variant_Radar: Story = {
|
|
110
|
+
render: () => (
|
|
111
|
+
<ChartContainer config={twoSeriesConfig} className="h-72 w-[520px]">
|
|
112
|
+
<RadarChart
|
|
113
|
+
data={[
|
|
114
|
+
{ axis: "Mon", desktop: 186, mobile: 80 },
|
|
115
|
+
{ axis: "Tue", desktop: 305, mobile: 200 },
|
|
116
|
+
{ axis: "Wed", desktop: 237, mobile: 120 },
|
|
117
|
+
{ axis: "Thu", desktop: 73, mobile: 190 },
|
|
118
|
+
{ axis: "Fri", desktop: 209, mobile: 130 },
|
|
119
|
+
{ axis: "Sat", desktop: 214, mobile: 140 },
|
|
120
|
+
{ axis: "Sun", desktop: 290, mobile: 240 },
|
|
121
|
+
]}
|
|
122
|
+
>
|
|
123
|
+
<PolarGrid />
|
|
124
|
+
<PolarAngleAxis dataKey="axis" />
|
|
125
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
126
|
+
<Radar dataKey="desktop" stroke="var(--color-desktop)" fill="var(--color-desktop)" fillOpacity={0.2} />
|
|
127
|
+
<Radar dataKey="mobile" stroke="var(--color-mobile)" fill="var(--color-mobile)" fillOpacity={0.2} />
|
|
128
|
+
</RadarChart>
|
|
129
|
+
</ChartContainer>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const Variant_WithReferenceDot: Story = {
|
|
134
|
+
render: () => (
|
|
135
|
+
<ChartContainer config={twoSeriesConfig} className="h-56 w-[520px]">
|
|
136
|
+
<LineChart data={monthlyData} margin={{ top: 8, right: 16, left: 8, bottom: 0 }}>
|
|
137
|
+
<CartesianGrid vertical={false} />
|
|
138
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
|
|
139
|
+
<YAxis tickLine={false} axisLine={false} width={32} />
|
|
140
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
141
|
+
<Line type="monotone" dataKey="desktop" stroke="var(--color-desktop)" strokeWidth={2} dot={false} />
|
|
142
|
+
<ReferenceDot x="Feb" y={305} r={6} fill="var(--color-desktop)" stroke="var(--background)" strokeWidth={2} />
|
|
143
|
+
</LineChart>
|
|
144
|
+
</ChartContainer>
|
|
145
|
+
),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const Variant_NoAnimation: Story = {
|
|
149
|
+
render: () => (
|
|
150
|
+
<ChartContainer config={twoSeriesConfig} className="h-56 w-[520px]" animate={false}>
|
|
151
|
+
<LineChart data={monthlyData} margin={{ top: 8, right: 16, left: 8, bottom: 0 }}>
|
|
152
|
+
<CartesianGrid vertical={false} />
|
|
153
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
|
|
154
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
155
|
+
<Line type="monotone" dataKey="desktop" stroke="var(--color-desktop)" strokeWidth={2} dot={false} />
|
|
156
|
+
<Line type="monotone" dataKey="mobile" stroke="var(--color-mobile)" strokeWidth={2} dot={false} />
|
|
157
|
+
</LineChart>
|
|
158
|
+
</ChartContainer>
|
|
159
|
+
),
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const RealisticUse: Story = {
|
|
163
|
+
render: () => (
|
|
164
|
+
<ChartContainer config={twoSeriesConfig} className="h-64 w-[520px]">
|
|
165
|
+
<BarChart data={monthlyData}>
|
|
166
|
+
<CartesianGrid vertical={false} />
|
|
167
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} tickMargin={8} />
|
|
168
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
169
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
170
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
171
|
+
</BarChart>
|
|
172
|
+
</ChartContainer>
|
|
173
|
+
),
|
|
174
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Checkbox } from "@behavioral-agentic-design-system/core/components/ui/checkbox";
|
|
3
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Checkbox> = {
|
|
6
|
+
title: "Components/Checkbox",
|
|
7
|
+
component: Checkbox,
|
|
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: () => (<div className="flex items-center gap-2">
|
|
17
|
+
<Checkbox id="terms" defaultChecked />
|
|
18
|
+
<Label htmlFor="terms">I agree to the terms</Label>
|
|
19
|
+
</div>),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Disabled: Story = {
|
|
23
|
+
args: { disabled: true, "aria-label": "I agree to the terms" } as any,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const RealisticUse: Story = {
|
|
27
|
+
render: () => (<div className="flex items-center gap-2">
|
|
28
|
+
<Checkbox id="terms-realistic" defaultChecked />
|
|
29
|
+
<Label htmlFor="terms-realistic">I agree to the terms</Label>
|
|
30
|
+
</div>),
|
|
31
|
+
};
|
|
32
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { CircularProgress } from "@behavioral-agentic-design-system/core/components/ui/circular-progress"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof CircularProgress> = {
|
|
6
|
+
title: "Components/CircularProgress",
|
|
7
|
+
component: CircularProgress,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"SVG ring progress indicator. Determinate (value 0–100) animates strokeDashoffset via var(--duration-base) + var(--ease-out). Indeterminate (no value) spins via animate-spin. role=progressbar with aria-valuenow/min/max satisfies WCAG 2.1 1.3.1. Not interactive — target-size n/a.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof CircularProgress>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<CircularProgress value={65} label="Upload progress" />
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Variant_Muted: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<CircularProgress value={40} variant="muted" label="Background task" />
|
|
30
|
+
),
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const Variant_Success: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<CircularProgress value={100} variant="success" label="Complete" />
|
|
36
|
+
),
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Variant_Warning: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<CircularProgress value={55} variant="warning" label="Warning level" />
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Variant_Destructive: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<CircularProgress value={20} variant="destructive" label="Critical usage" />
|
|
48
|
+
),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Size_Sm: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<CircularProgress value={65} size="sm" label="Small progress" />
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Size_Default: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<CircularProgress value={65} size="default" label="Default progress" />
|
|
60
|
+
),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Size_Lg: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<CircularProgress value={65} size="lg" label="Large progress" />
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Indeterminate: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<CircularProgress label="Loading…" />
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const WithCenterLabel: Story = {
|
|
76
|
+
render: () => (
|
|
77
|
+
<CircularProgress value={72} size="lg" label="Storage usage: 72%">
|
|
78
|
+
<span className="text-xs font-semibold">72%</span>
|
|
79
|
+
</CircularProgress>
|
|
80
|
+
),
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const AllSizes: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<div className="flex items-center gap-6">
|
|
86
|
+
<CircularProgress value={65} size="sm" label="sm" />
|
|
87
|
+
<CircularProgress value={65} size="default" label="default" />
|
|
88
|
+
<CircularProgress value={65} size="lg" label="lg" />
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const AllVariants: Story = {
|
|
94
|
+
render: () => (
|
|
95
|
+
<div className="flex items-center gap-6">
|
|
96
|
+
<CircularProgress value={65} variant="default" label="default" />
|
|
97
|
+
<CircularProgress value={65} variant="muted" label="muted" />
|
|
98
|
+
<CircularProgress value={100} variant="success" label="success" />
|
|
99
|
+
<CircularProgress value={55} variant="warning" label="warning" />
|
|
100
|
+
<CircularProgress value={20} variant="destructive" label="destructive" />
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const RealisticUse: Story = {
|
|
106
|
+
render: () => {
|
|
107
|
+
const [value, setValue] = React.useState(0)
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
const interval = setInterval(() => {
|
|
110
|
+
setValue((v) => {
|
|
111
|
+
if (v >= 100) {
|
|
112
|
+
clearInterval(interval)
|
|
113
|
+
return 100
|
|
114
|
+
}
|
|
115
|
+
return v + 5
|
|
116
|
+
})
|
|
117
|
+
}, 200)
|
|
118
|
+
return () => clearInterval(interval)
|
|
119
|
+
}, [])
|
|
120
|
+
return (
|
|
121
|
+
<div className="flex flex-col items-center gap-4">
|
|
122
|
+
<CircularProgress
|
|
123
|
+
value={value}
|
|
124
|
+
size="lg"
|
|
125
|
+
label={`Upload progress: ${value}%`}
|
|
126
|
+
variant={value === 100 ? "success" : "default"}
|
|
127
|
+
>
|
|
128
|
+
<span className="text-xs font-semibold">{value}%</span>
|
|
129
|
+
</CircularProgress>
|
|
130
|
+
<p className="text-sm text-muted-foreground">
|
|
131
|
+
{value === 100 ? "Upload complete" : "Uploading…"}
|
|
132
|
+
</p>
|
|
133
|
+
</div>
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Code } from "@behavioral-agentic-design-system/core/components/ui/code"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Code> = {
|
|
6
|
+
title: "Components/Code",
|
|
7
|
+
component: Code,
|
|
8
|
+
parameters: { layout: "centered" },
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: { control: "select", options: ["inline", "block"] },
|
|
12
|
+
size: { control: "select", options: ["sm", "default", "lg"] },
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
type Story = StoryObj<typeof meta>
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => <Code>pnpm build:tokens</Code>,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Variant_Inline: Story = {
|
|
24
|
+
render: () => (
|
|
25
|
+
<p className="text-sm text-foreground leading-relaxed max-w-sm">
|
|
26
|
+
Set the primary brand color via{" "}
|
|
27
|
+
<Code>--primary</Code> in{" "}
|
|
28
|
+
<Code>tokens.json</Code> and run{" "}
|
|
29
|
+
<Code>pnpm build:tokens</Code> to regenerate.
|
|
30
|
+
</p>
|
|
31
|
+
),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Variant_Block: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div className="w-[480px]">
|
|
37
|
+
<Code variant="block">
|
|
38
|
+
{`// tokens.json — semantic layer
|
|
39
|
+
{
|
|
40
|
+
"theme": {
|
|
41
|
+
"light": {
|
|
42
|
+
"primary": "#1a1a1a",
|
|
43
|
+
"primary-foreground": "#ffffff"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}`}
|
|
47
|
+
</Code>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Long, non-wrapping lines overflow the container (whitespace-pre), so the block
|
|
53
|
+
// becomes a horizontal scroll region. tabIndex={0} makes it keyboard-reachable
|
|
54
|
+
// and it shows the system focus-visible ring when focused (a11y: SC 2.1.1 / 2.4.7).
|
|
55
|
+
export const Variant_Block_Scroll: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<div className="w-[360px]">
|
|
58
|
+
<Code variant="block">
|
|
59
|
+
{`import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
60
|
+
pnpm --filter @behavioral-agentic-design-system/core build:tokens && pnpm a11y`}
|
|
61
|
+
</Code>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Size_Sm: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<div className="flex flex-col gap-3">
|
|
69
|
+
<Code size="sm">pnpm a11y</Code>
|
|
70
|
+
<div className="w-[400px]">
|
|
71
|
+
<Code variant="block" size="sm">
|
|
72
|
+
{`78 pass · 0 fail · 0 warn`}
|
|
73
|
+
</Code>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Size_Default: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<div className="flex flex-col gap-3">
|
|
82
|
+
<Code size="default">pnpm wcag:audit</Code>
|
|
83
|
+
<div className="w-[400px]">
|
|
84
|
+
<Code variant="block" size="default">
|
|
85
|
+
{`✓ primary on background 12.6:1 AAA`}
|
|
86
|
+
</Code>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const Size_Lg: Story = {
|
|
93
|
+
render: () => (
|
|
94
|
+
<div className="flex flex-col gap-3">
|
|
95
|
+
<Code size="lg">design-tokens</Code>
|
|
96
|
+
<div className="w-[440px]">
|
|
97
|
+
<Code variant="block" size="lg">
|
|
98
|
+
{`@behavioral-agentic-design-system/core@0.16.0`}
|
|
99
|
+
</Code>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const RealisticUse: Story = {
|
|
106
|
+
render: () => (
|
|
107
|
+
<div className="max-w-md space-y-4 text-sm text-foreground leading-relaxed">
|
|
108
|
+
<div className="space-y-1">
|
|
109
|
+
<p className="font-medium text-foreground">Install the package</p>
|
|
110
|
+
<Code variant="block">
|
|
111
|
+
{`pnpm add @behavioral-agentic-design-system/core`}
|
|
112
|
+
</Code>
|
|
113
|
+
</div>
|
|
114
|
+
<p>
|
|
115
|
+
Import tokens via <Code>import "@behavioral-agentic-design-system/core/styles.css"</Code>{" "}
|
|
116
|
+
in your root layout, then use any component:
|
|
117
|
+
</p>
|
|
118
|
+
<Code variant="block">
|
|
119
|
+
{`import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"
|
|
120
|
+
|
|
121
|
+
export function Example() {
|
|
122
|
+
return <Button variant="default">Get started</Button>
|
|
123
|
+
}`}
|
|
124
|
+
</Code>
|
|
125
|
+
<p>
|
|
126
|
+
Override a token by editing <Code>tokens.json</Code> and running{" "}
|
|
127
|
+
<Code>pnpm build:tokens</Code>.
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
),
|
|
131
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@behavioral-agentic-design-system/core/components/ui/collapsible";
|
|
3
|
+
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Collapsible> = {
|
|
6
|
+
title: "Components/Collapsible",
|
|
7
|
+
component: Collapsible,
|
|
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: () => (<Collapsible className="w-[320px] space-y-2">
|
|
17
|
+
<CollapsibleTrigger asChild><Button variant="outline" size="sm">Toggle details</Button></CollapsibleTrigger>
|
|
18
|
+
<CollapsibleContent className="rounded-md border p-3 text-sm">Hidden detail content.</CollapsibleContent>
|
|
19
|
+
</Collapsible>),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const RealisticUse: Story = {
|
|
23
|
+
render: () => (<Collapsible className="w-[320px] space-y-2">
|
|
24
|
+
<CollapsibleTrigger asChild><Button variant="outline" size="sm">Toggle details</Button></CollapsibleTrigger>
|
|
25
|
+
<CollapsibleContent className="rounded-md border p-3 text-sm">Hidden detail content.</CollapsibleContent>
|
|
26
|
+
</Collapsible>),
|
|
27
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { ColorPicker } from "@behavioral-agentic-design-system/core/components/ui/color-picker";
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
5
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
6
|
+
|
|
7
|
+
const BRAND_SWATCHES = [
|
|
8
|
+
"#ef4444", "#f97316", "#eab308", "#22c55e",
|
|
9
|
+
"#06b6d4", "#3b82f6", "#8b5cf6", "#ec4899",
|
|
10
|
+
"#64748b", "#1e293b", "#f8fafc", "#ffffff",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const PASTEL_SWATCHES = [
|
|
14
|
+
"#fecaca", "#fed7aa", "#fef08a", "#bbf7d0",
|
|
15
|
+
"#a5f3fc", "#bfdbfe", "#ddd6fe", "#fbcfe8",
|
|
16
|
+
"#e2e8f0", "#cbd5e1",
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof ColorPicker> = {
|
|
20
|
+
title: "Components/ColorPicker",
|
|
21
|
+
component: ColorPicker,
|
|
22
|
+
parameters: { layout: "centered" },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof ColorPicker>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<ColorPicker
|
|
31
|
+
swatches={BRAND_SWATCHES}
|
|
32
|
+
aria-label="Select a color"
|
|
33
|
+
/>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const WithCustomInput: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div className="space-y-3">
|
|
40
|
+
<ColorPicker
|
|
41
|
+
swatches={BRAND_SWATCHES}
|
|
42
|
+
allowCustom
|
|
43
|
+
aria-label="Select or enter a color"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const PastelPalette: Story = {
|
|
50
|
+
render: () => (
|
|
51
|
+
<ColorPicker
|
|
52
|
+
swatches={PASTEL_SWATCHES}
|
|
53
|
+
aria-label="Select a pastel color"
|
|
54
|
+
/>
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const CustomInputOnly: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<ColorPicker
|
|
61
|
+
swatches={[]}
|
|
62
|
+
allowCustom
|
|
63
|
+
defaultValue="#3b82f6"
|
|
64
|
+
aria-label="Enter a hex color"
|
|
65
|
+
/>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Disabled: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<ColorPicker
|
|
72
|
+
swatches={BRAND_SWATCHES}
|
|
73
|
+
defaultValue="#3b82f6"
|
|
74
|
+
disabled
|
|
75
|
+
aria-label="Color (disabled)"
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Controlled: Story = {
|
|
81
|
+
render: function ControlledPicker() {
|
|
82
|
+
const [color, setColor] = React.useState("#3b82f6");
|
|
83
|
+
return (
|
|
84
|
+
<div className="space-y-3">
|
|
85
|
+
<p className="text-xs text-muted-foreground">
|
|
86
|
+
Selected: <span className="font-mono font-medium text-foreground">{color}</span>
|
|
87
|
+
</p>
|
|
88
|
+
<ColorPicker
|
|
89
|
+
value={color}
|
|
90
|
+
onValueChange={setColor}
|
|
91
|
+
swatches={BRAND_SWATCHES}
|
|
92
|
+
allowCustom
|
|
93
|
+
aria-label="Select a color"
|
|
94
|
+
/>
|
|
95
|
+
<div
|
|
96
|
+
className="h-8 w-full rounded-md border border-input transition-colors"
|
|
97
|
+
style={{ backgroundColor: color }}
|
|
98
|
+
aria-hidden
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
function tagTextColor(hex: string): string {
|
|
106
|
+
const h = hex.replace("#", "");
|
|
107
|
+
const parts = h.length === 3
|
|
108
|
+
? h.split("").map((c) => parseInt(c + c, 16))
|
|
109
|
+
: [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
|
|
110
|
+
const lin = (v: number) => { const s = v / 255; return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4); };
|
|
111
|
+
const L = 0.2126 * lin(parts[0]) + 0.7152 * lin(parts[1]) + 0.0722 * lin(parts[2]);
|
|
112
|
+
return L > 0.179 ? "#000000" : "#ffffff";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const RealisticUse: Story = {
|
|
116
|
+
render: function TagColorPicker() {
|
|
117
|
+
const [tagColor, setTagColor] = React.useState("#3b82f6");
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<Card className="w-72">
|
|
121
|
+
<CardHeader className="pb-3">
|
|
122
|
+
<CardTitle className="text-sm">New tag</CardTitle>
|
|
123
|
+
</CardHeader>
|
|
124
|
+
<CardContent className="space-y-4">
|
|
125
|
+
<div className="space-y-1.5">
|
|
126
|
+
<Label className="text-xs text-muted-foreground">Tag color</Label>
|
|
127
|
+
<ColorPicker
|
|
128
|
+
value={tagColor}
|
|
129
|
+
onValueChange={setTagColor}
|
|
130
|
+
swatches={BRAND_SWATCHES}
|
|
131
|
+
allowCustom
|
|
132
|
+
aria-label="Tag color"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
<div className="flex items-center gap-2">
|
|
136
|
+
<div
|
|
137
|
+
className="flex h-6 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors"
|
|
138
|
+
style={{
|
|
139
|
+
backgroundColor: tagColor,
|
|
140
|
+
color: tagTextColor(tagColor),
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<span
|
|
144
|
+
className="size-1.5 rounded-full opacity-70"
|
|
145
|
+
style={{ backgroundColor: tagTextColor(tagColor) }}
|
|
146
|
+
aria-hidden
|
|
147
|
+
/>
|
|
148
|
+
Breezy Hills
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</CardContent>
|
|
152
|
+
</Card>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
};
|