@behavioral-agentic-design-system/core 0.17.0 → 0.19.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 +119 -98
- package/src/components/ui/color-picker.tsx +318 -9
- 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 +186 -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
|
@@ -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,186 @@
|
|
|
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 Wheel: Story = {
|
|
50
|
+
render: function WheelPicker() {
|
|
51
|
+
const [color, setColor] = React.useState("#3b82f6");
|
|
52
|
+
return (
|
|
53
|
+
<div className="space-y-3">
|
|
54
|
+
<ColorPicker
|
|
55
|
+
value={color}
|
|
56
|
+
onValueChange={setColor}
|
|
57
|
+
wheel
|
|
58
|
+
aria-label="Pick a color from the wheel"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const WheelWithSwatches: Story = {
|
|
66
|
+
render: function WheelSwatchesPicker() {
|
|
67
|
+
const [color, setColor] = React.useState("#8b5cf6");
|
|
68
|
+
return (
|
|
69
|
+
<ColorPicker
|
|
70
|
+
value={color}
|
|
71
|
+
onValueChange={setColor}
|
|
72
|
+
wheel
|
|
73
|
+
swatches={BRAND_SWATCHES}
|
|
74
|
+
aria-label="Pick a color from the wheel or a swatch"
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const PastelPalette: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<ColorPicker
|
|
83
|
+
swatches={PASTEL_SWATCHES}
|
|
84
|
+
aria-label="Select a pastel color"
|
|
85
|
+
/>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const CustomInputOnly: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<ColorPicker
|
|
92
|
+
swatches={[]}
|
|
93
|
+
allowCustom
|
|
94
|
+
defaultValue="#3b82f6"
|
|
95
|
+
aria-label="Enter a hex color"
|
|
96
|
+
/>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const Disabled: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<ColorPicker
|
|
103
|
+
swatches={BRAND_SWATCHES}
|
|
104
|
+
defaultValue="#3b82f6"
|
|
105
|
+
disabled
|
|
106
|
+
aria-label="Color (disabled)"
|
|
107
|
+
/>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const Controlled: Story = {
|
|
112
|
+
render: function ControlledPicker() {
|
|
113
|
+
const [color, setColor] = React.useState("#3b82f6");
|
|
114
|
+
return (
|
|
115
|
+
<div className="space-y-3">
|
|
116
|
+
<p className="text-xs text-muted-foreground">
|
|
117
|
+
Selected: <span className="font-mono font-medium text-foreground">{color}</span>
|
|
118
|
+
</p>
|
|
119
|
+
<ColorPicker
|
|
120
|
+
value={color}
|
|
121
|
+
onValueChange={setColor}
|
|
122
|
+
swatches={BRAND_SWATCHES}
|
|
123
|
+
allowCustom
|
|
124
|
+
aria-label="Select a color"
|
|
125
|
+
/>
|
|
126
|
+
<div
|
|
127
|
+
className="h-8 w-full rounded-md border border-input transition-colors"
|
|
128
|
+
style={{ backgroundColor: color }}
|
|
129
|
+
aria-hidden
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
function tagTextColor(hex: string): string {
|
|
137
|
+
const h = hex.replace("#", "");
|
|
138
|
+
const parts = h.length === 3
|
|
139
|
+
? h.split("").map((c) => parseInt(c + c, 16))
|
|
140
|
+
: [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
|
|
141
|
+
const lin = (v: number) => { const s = v / 255; return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4); };
|
|
142
|
+
const L = 0.2126 * lin(parts[0]) + 0.7152 * lin(parts[1]) + 0.0722 * lin(parts[2]);
|
|
143
|
+
return L > 0.179 ? "#000000" : "#ffffff";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const RealisticUse: Story = {
|
|
147
|
+
render: function TagColorPicker() {
|
|
148
|
+
const [tagColor, setTagColor] = React.useState("#3b82f6");
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<Card className="w-72">
|
|
152
|
+
<CardHeader className="pb-3">
|
|
153
|
+
<CardTitle className="text-sm">New tag</CardTitle>
|
|
154
|
+
</CardHeader>
|
|
155
|
+
<CardContent className="space-y-4">
|
|
156
|
+
<div className="space-y-1.5">
|
|
157
|
+
<Label className="text-xs text-muted-foreground">Tag color</Label>
|
|
158
|
+
<ColorPicker
|
|
159
|
+
value={tagColor}
|
|
160
|
+
onValueChange={setTagColor}
|
|
161
|
+
swatches={BRAND_SWATCHES}
|
|
162
|
+
allowCustom
|
|
163
|
+
aria-label="Tag color"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
<div className="flex items-center gap-2">
|
|
167
|
+
<div
|
|
168
|
+
className="flex h-6 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors"
|
|
169
|
+
style={{
|
|
170
|
+
backgroundColor: tagColor,
|
|
171
|
+
color: tagTextColor(tagColor),
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<span
|
|
175
|
+
className="size-1.5 rounded-full opacity-70"
|
|
176
|
+
style={{ backgroundColor: tagTextColor(tagColor) }}
|
|
177
|
+
aria-hidden
|
|
178
|
+
/>
|
|
179
|
+
Breezy Hills
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</CardContent>
|
|
183
|
+
</Card>
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Combobox } from "@behavioral-agentic-design-system/core/components/ui/combobox";
|
|
4
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
5
|
+
|
|
6
|
+
// Trigger uses aria-haspopup=listbox + aria-expanded on a native <button>.
|
|
7
|
+
// role=combobox is intentionally omitted — ARIA 1.2 requires aria-controls when
|
|
8
|
+
// it's present, which cannot be wired across a portal without a ref handshake.
|
|
9
|
+
const meta: Meta<typeof Combobox> = {
|
|
10
|
+
title: "Components/Combobox",
|
|
11
|
+
component: Combobox,
|
|
12
|
+
parameters: { layout: "centered" },
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (
|
|
16
|
+
<div className="flex min-h-[320px] w-[300px] items-start justify-center pt-8">
|
|
17
|
+
<div className="w-full">
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
const frameworks = [
|
|
29
|
+
{ value: "next", label: "Next.js" },
|
|
30
|
+
{ value: "sveltekit", label: "SvelteKit" },
|
|
31
|
+
{ value: "nuxt", label: "Nuxt.js" },
|
|
32
|
+
{ value: "remix", label: "Remix" },
|
|
33
|
+
{ value: "astro", label: "Astro" },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
render: () => {
|
|
38
|
+
const [value, setValue] = React.useState("");
|
|
39
|
+
return (
|
|
40
|
+
<Combobox
|
|
41
|
+
options={frameworks}
|
|
42
|
+
value={value}
|
|
43
|
+
onValueChange={setValue}
|
|
44
|
+
placeholder="Select framework..."
|
|
45
|
+
searchPlaceholder="Search frameworks..."
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WithValue: Story = {
|
|
52
|
+
render: () => {
|
|
53
|
+
const [value, setValue] = React.useState("next");
|
|
54
|
+
return (
|
|
55
|
+
<Combobox
|
|
56
|
+
options={frameworks}
|
|
57
|
+
value={value}
|
|
58
|
+
onValueChange={setValue}
|
|
59
|
+
placeholder="Select framework..."
|
|
60
|
+
searchPlaceholder="Search frameworks..."
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Disabled: Story = {
|
|
67
|
+
render: () => (
|
|
68
|
+
<Combobox
|
|
69
|
+
options={frameworks}
|
|
70
|
+
value="next"
|
|
71
|
+
disabled
|
|
72
|
+
placeholder="Select framework..."
|
|
73
|
+
/>
|
|
74
|
+
),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const WithDisabledOptions: Story = {
|
|
78
|
+
render: () => {
|
|
79
|
+
const [value, setValue] = React.useState("");
|
|
80
|
+
const options = [
|
|
81
|
+
{ value: "next", label: "Next.js" },
|
|
82
|
+
{ value: "sveltekit", label: "SvelteKit", disabled: true },
|
|
83
|
+
{ value: "nuxt", label: "Nuxt.js" },
|
|
84
|
+
{ value: "remix", label: "Remix", disabled: true },
|
|
85
|
+
{ value: "astro", label: "Astro" },
|
|
86
|
+
];
|
|
87
|
+
return (
|
|
88
|
+
<Combobox
|
|
89
|
+
options={options}
|
|
90
|
+
value={value}
|
|
91
|
+
onValueChange={setValue}
|
|
92
|
+
placeholder="Select framework..."
|
|
93
|
+
searchPlaceholder="Search frameworks..."
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const RealisticUse: Story = {
|
|
100
|
+
decorators: [
|
|
101
|
+
(Story) => (
|
|
102
|
+
<div className="flex min-h-[400px] w-[380px] items-start justify-center pt-8">
|
|
103
|
+
<div className="w-full rounded-lg border bg-card p-6 shadow-sm">
|
|
104
|
+
<Story />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
],
|
|
109
|
+
render: () => {
|
|
110
|
+
const [country, setCountry] = React.useState("");
|
|
111
|
+
const [timezone, setTimezone] = React.useState("");
|
|
112
|
+
|
|
113
|
+
const countries = [
|
|
114
|
+
{ value: "us", label: "United States" },
|
|
115
|
+
{ value: "ca", label: "Canada" },
|
|
116
|
+
{ value: "gb", label: "United Kingdom" },
|
|
117
|
+
{ value: "de", label: "Germany" },
|
|
118
|
+
{ value: "fr", label: "France" },
|
|
119
|
+
{ value: "au", label: "Australia" },
|
|
120
|
+
{ value: "jp", label: "Japan" },
|
|
121
|
+
{ value: "sg", label: "Singapore" },
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const timezones = [
|
|
125
|
+
{ value: "utc-8", label: "Pacific Time (UTC-8)" },
|
|
126
|
+
{ value: "utc-7", label: "Mountain Time (UTC-7)" },
|
|
127
|
+
{ value: "utc-6", label: "Central Time (UTC-6)" },
|
|
128
|
+
{ value: "utc-5", label: "Eastern Time (UTC-5)" },
|
|
129
|
+
{ value: "utc+0", label: "UTC" },
|
|
130
|
+
{ value: "utc+1", label: "Central European Time (UTC+1)" },
|
|
131
|
+
{ value: "utc+8", label: "Singapore Time (UTC+8)" },
|
|
132
|
+
{ value: "utc+9", label: "Japan Standard Time (UTC+9)" },
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div className="space-y-5">
|
|
137
|
+
<div>
|
|
138
|
+
<h3 className="text-sm font-semibold text-foreground">Account location</h3>
|
|
139
|
+
<p className="mt-0.5 text-sm text-muted-foreground">Set your country and timezone for accurate scheduling.</p>
|
|
140
|
+
</div>
|
|
141
|
+
<div className="space-y-3">
|
|
142
|
+
<div className="space-y-1.5">
|
|
143
|
+
<Label htmlFor="country">Country</Label>
|
|
144
|
+
<Combobox
|
|
145
|
+
options={countries}
|
|
146
|
+
value={country}
|
|
147
|
+
onValueChange={setCountry}
|
|
148
|
+
placeholder="Select country..."
|
|
149
|
+
searchPlaceholder="Search countries..."
|
|
150
|
+
emptyText="Country not found."
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
<div className="space-y-1.5">
|
|
154
|
+
<Label htmlFor="timezone">Timezone</Label>
|
|
155
|
+
<Combobox
|
|
156
|
+
options={timezones}
|
|
157
|
+
value={timezone}
|
|
158
|
+
onValueChange={setTimezone}
|
|
159
|
+
placeholder="Select timezone..."
|
|
160
|
+
searchPlaceholder="Search timezones..."
|
|
161
|
+
emptyText="Timezone not found."
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@behavioral-agentic-design-system/core/components/ui/command";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Command> = {
|
|
5
|
+
title: "Components/Command",
|
|
6
|
+
component: Command,
|
|
7
|
+
parameters: { layout: "centered" },
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (<Command className="rounded-lg border w-[320px]">
|
|
16
|
+
<CommandInput placeholder="Search..." />
|
|
17
|
+
<CommandList>
|
|
18
|
+
<CommandEmpty>No results.</CommandEmpty>
|
|
19
|
+
<CommandGroup heading="Suggestions">
|
|
20
|
+
<CommandItem>Calendar</CommandItem>
|
|
21
|
+
<CommandItem>Settings</CommandItem>
|
|
22
|
+
<CommandItem>Profile</CommandItem>
|
|
23
|
+
</CommandGroup>
|
|
24
|
+
</CommandList>
|
|
25
|
+
</Command>),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const RealisticUse: Story = {
|
|
29
|
+
render: () => (<Command className="rounded-lg border w-[320px]">
|
|
30
|
+
<CommandInput placeholder="Search..." />
|
|
31
|
+
<CommandList>
|
|
32
|
+
<CommandEmpty>No results.</CommandEmpty>
|
|
33
|
+
<CommandGroup heading="Suggestions">
|
|
34
|
+
<CommandItem>Calendar</CommandItem>
|
|
35
|
+
<CommandItem>Settings</CommandItem>
|
|
36
|
+
<CommandItem>Profile</CommandItem>
|
|
37
|
+
</CommandGroup>
|
|
38
|
+
</CommandList>
|
|
39
|
+
</Command>),
|
|
40
|
+
};
|