@behavioral-agentic-design-system/core 0.24.0 → 0.26.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 +5 -2
- package/scripts/build-tokens.cjs +79 -5
- package/src/app/preview/components/page.tsx +4474 -208
- package/src/app/shell.tsx +18 -6
- package/src/components/customize/brand-mark-section.tsx +1 -1
- package/src/components/customize-tab.tsx +2 -2
- package/src/components/home-tab.tsx +2 -2
- package/src/components/ui/action-bar.tsx +142 -0
- package/src/components/ui/affix.tsx +109 -0
- package/src/components/ui/alert.tsx +37 -3
- package/src/components/ui/anchor.tsx +136 -0
- package/src/components/ui/angle-slider.tsx +265 -0
- package/src/components/ui/autocomplete.tsx +223 -0
- package/src/components/ui/avatar.tsx +8 -2
- package/src/components/ui/blockquote.tsx +112 -0
- package/src/components/ui/bottom-navigation.tsx +144 -0
- package/src/components/ui/burger.tsx +117 -0
- package/src/components/ui/button.tsx +101 -3
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/card.tsx +43 -5
- package/src/components/ui/carousel.tsx +10 -5
- package/src/components/ui/cascader.tsx +253 -0
- package/src/components/ui/checkbox-card.tsx +176 -0
- package/src/components/ui/checkbox-group.tsx +231 -0
- package/src/components/ui/checkbox.tsx +14 -3
- package/src/components/ui/chip.tsx +143 -0
- package/src/components/ui/circular-progress.tsx +2 -2
- package/src/components/ui/color-swatch.tsx +73 -0
- package/src/components/ui/copy-button.tsx +21 -4
- package/src/components/ui/date-picker.tsx +6 -3
- package/src/components/ui/date-range-picker.tsx +6 -3
- package/src/components/ui/float-label.tsx +114 -0
- package/src/components/ui/floating-panel.tsx +129 -0
- package/src/components/ui/format-number.tsx +122 -0
- package/src/components/ui/highlight.tsx +85 -0
- package/src/components/ui/image.tsx +195 -0
- package/src/components/ui/index.ts +50 -0
- package/src/components/ui/indicator.tsx +2 -2
- package/src/components/ui/input.tsx +48 -4
- package/src/components/ui/kbd.tsx +1 -1
- package/src/components/ui/link.tsx +158 -0
- package/src/components/ui/listbox.tsx +426 -0
- package/src/components/ui/loading-overlay.tsx +80 -0
- package/src/components/ui/marquee.tsx +193 -0
- package/src/components/ui/masonry.tsx +164 -0
- package/src/components/ui/meter.tsx +186 -0
- package/src/components/ui/motion-toggle.tsx +170 -0
- package/src/components/ui/notification.tsx +175 -0
- package/src/components/ui/overlay.tsx +63 -0
- package/src/components/ui/progress.tsx +95 -4
- package/src/components/ui/rating-group.tsx +1 -0
- package/src/components/ui/separator.tsx +57 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/signature-pad.tsx +381 -0
- package/src/components/ui/skeleton.tsx +59 -2
- package/src/components/ui/skip-link.tsx +117 -0
- package/src/components/ui/slider.tsx +86 -1
- package/src/components/ui/spoiler.tsx +131 -0
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/text.tsx +135 -0
- package/src/components/ui/textarea.tsx +66 -2
- package/src/components/ui/timeline.tsx +71 -14
- package/src/components/ui/timer.tsx +183 -0
- package/src/components/ui/tour.tsx +332 -0
- package/src/components/ui/transfer-list.tsx +308 -0
- package/src/components/ui/visually-hidden.tsx +42 -0
- package/src/components/ui/watermark.tsx +0 -0
- package/src/data/docs-index.ts +9 -2
- package/src/stories/ActionBar.stories.tsx +201 -0
- package/src/stories/Affix.stories.tsx +165 -0
- package/src/stories/Alert.stories.tsx +58 -0
- package/src/stories/Anchor.stories.tsx +236 -0
- package/src/stories/AngleSlider.stories.tsx +128 -0
- package/src/stories/Autocomplete.stories.tsx +216 -0
- package/src/stories/Avatar.stories.tsx +73 -1
- package/src/stories/Blockquote.stories.tsx +148 -0
- package/src/stories/BottomNavigation.stories.tsx +195 -0
- package/src/stories/Burger.stories.tsx +79 -0
- package/src/stories/Button.stories.tsx +103 -2
- package/src/stories/Calendar.stories.tsx +4 -0
- package/src/stories/Card.stories.tsx +30 -0
- package/src/stories/Carousel.stories.tsx +2 -1
- package/src/stories/Cascader.stories.tsx +285 -0
- package/src/stories/Checkbox.stories.tsx +13 -0
- package/src/stories/CheckboxCard.stories.tsx +210 -0
- package/src/stories/CheckboxGroup.stories.tsx +186 -0
- package/src/stories/Chip.stories.tsx +173 -0
- package/src/stories/CircularProgress.stories.tsx +3 -0
- package/src/stories/ColorSwatch.stories.tsx +81 -0
- package/src/stories/CopyButton.stories.tsx +3 -3
- package/src/stories/DatePicker.stories.tsx +3 -0
- package/src/stories/DateRangePicker.stories.tsx +3 -0
- package/src/stories/Editable.stories.tsx +14 -0
- package/src/stories/FloatLabel.stories.tsx +148 -0
- package/src/stories/FloatingPanel.stories.tsx +176 -0
- package/src/stories/FormatNumber.stories.tsx +308 -0
- package/src/stories/Highlight.stories.tsx +140 -0
- package/src/stories/Image.stories.tsx +141 -0
- package/src/stories/Indicator.stories.tsx +3 -0
- package/src/stories/Input.stories.tsx +33 -0
- package/src/stories/Kbd.stories.tsx +3 -0
- package/src/stories/Link.stories.tsx +198 -0
- package/src/stories/Listbox.stories.tsx +240 -0
- package/src/stories/LoadingOverlay.stories.tsx +148 -0
- package/src/stories/Marquee.stories.tsx +170 -0
- package/src/stories/Masonry.stories.tsx +227 -0
- package/src/stories/Meter.stories.tsx +143 -0
- package/src/stories/MotionToggle.stories.tsx +85 -0
- package/src/stories/Notification.stories.tsx +264 -0
- package/src/stories/Overlay.stories.tsx +169 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/Progress.stories.tsx +70 -27
- package/src/stories/RatingGroup.stories.tsx +5 -0
- package/src/stories/Separator.stories.tsx +41 -5
- package/src/stories/Sidebar.stories.tsx +2 -1
- package/src/stories/SignaturePad.stories.tsx +112 -0
- package/src/stories/Skeleton.stories.tsx +23 -4
- package/src/stories/SkipLink.stories.tsx +137 -0
- package/src/stories/Slider.stories.tsx +28 -0
- package/src/stories/Spoiler.stories.tsx +122 -0
- package/src/stories/Tabs.stories.tsx +2 -1
- package/src/stories/Text.stories.tsx +191 -0
- package/src/stories/Textarea.stories.tsx +58 -6
- package/src/stories/Timeline.stories.tsx +82 -0
- package/src/stories/Timer.stories.tsx +160 -0
- package/src/stories/Tour.stories.tsx +191 -0
- package/src/stories/TransferList.stories.tsx +169 -0
- package/src/stories/VisuallyHidden.stories.tsx +105 -0
- package/src/stories/Watermark.stories.tsx +212 -0
- package/src/styles.css +80 -6
- package/src/tokens.json +2 -2
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
CheckboxCard,
|
|
5
|
+
RadioCard,
|
|
6
|
+
} from "@behavioral-agentic-design-system/core/components/ui/checkbox-card";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof CheckboxCard> = {
|
|
9
|
+
title: "Components/CheckboxCard",
|
|
10
|
+
component: CheckboxCard,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: "centered",
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"Card-shaped selection controls where the entire card surface is the hit area. A visually-hidden native input inside the label carries all keyboard and screen-reader behavior — Space toggles a CheckboxCard (multi-select, each card its own tab stop); RadioCards sharing a name form a native radio group (one tab stop, arrow keys move selection). Checked state paints border-primary + bg-primary/10 keyed off CSS :checked, so uncontrolled native radio groups always render correctly; the focus ring travels to the card surface via a peer overlay and appears instantly (excluded from the color transition). Motion: transition-colors on var(--duration-fast) + var(--ease-out).",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof CheckboxCard>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<CheckboxCard className="w-72">
|
|
28
|
+
<span className="text-sm font-medium text-foreground">
|
|
29
|
+
Chromatic visual regression
|
|
30
|
+
</span>
|
|
31
|
+
<span className="text-sm text-muted-foreground">
|
|
32
|
+
Baseline every story; diff every PR.
|
|
33
|
+
</span>
|
|
34
|
+
</CheckboxCard>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Checked: Story = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<CheckboxCard checked className="w-72">
|
|
41
|
+
<span className="text-sm font-medium text-foreground">
|
|
42
|
+
Chromatic visual regression
|
|
43
|
+
</span>
|
|
44
|
+
<span className="text-sm text-muted-foreground">
|
|
45
|
+
Baseline every story; diff every PR.
|
|
46
|
+
</span>
|
|
47
|
+
</CheckboxCard>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Disabled: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<CheckboxCard disabled className="w-72">
|
|
54
|
+
<span className="text-sm font-medium text-foreground">
|
|
55
|
+
Figma token sync
|
|
56
|
+
</span>
|
|
57
|
+
<span className="text-sm text-muted-foreground">
|
|
58
|
+
Deferred — activation signal not fired (docs/roadmap.md).
|
|
59
|
+
</span>
|
|
60
|
+
</CheckboxCard>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const RadioCard_Default: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<RadioCard name="plan-single" value="pro" className="w-72">
|
|
67
|
+
<span className="text-sm font-medium text-foreground">Pro</span>
|
|
68
|
+
<span className="text-sm text-muted-foreground">
|
|
69
|
+
$249.00/mo — every primitive, Chromatic, priority support.
|
|
70
|
+
</span>
|
|
71
|
+
</RadioCard>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const RadioCard_Checked: Story = {
|
|
76
|
+
render: () => (
|
|
77
|
+
<RadioCard checked name="plan-single-checked" value="pro" className="w-72">
|
|
78
|
+
<span className="text-sm font-medium text-foreground">Pro</span>
|
|
79
|
+
<span className="text-sm text-muted-foreground">
|
|
80
|
+
$249.00/mo — every primitive, Chromatic, priority support.
|
|
81
|
+
</span>
|
|
82
|
+
</RadioCard>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const RealisticUse_CheckboxCards: Story = {
|
|
87
|
+
render: function RealisticUseCheckboxCardsStory() {
|
|
88
|
+
// Real content: fork-onboarding service picker from the BADS pool
|
|
89
|
+
// (content/personas/bads.json → jargon, metrics) — Anika Patel scoping
|
|
90
|
+
// which enforcement passes her client fork turns on.
|
|
91
|
+
const services = [
|
|
92
|
+
{
|
|
93
|
+
value: "wcag-audit",
|
|
94
|
+
title: "WCAG AAA token audit",
|
|
95
|
+
description: "7:1 text pairs, 3:1 non-text — fails CI below the floor.",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: "visual-regression",
|
|
99
|
+
title: "Chromatic visual regression",
|
|
100
|
+
description: "Baseline every story; diff every PR.",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "orphan-lint",
|
|
104
|
+
title: "Orphan-token sweep",
|
|
105
|
+
description: "12,417 token references scanned; zeros flagged quarterly.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: "ethics-contract",
|
|
109
|
+
title: "Ethics contract gate",
|
|
110
|
+
description: "Data-entry primitives blocked without an ethicsContract.",
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
const [selected, setSelected] = React.useState<string[]>([
|
|
114
|
+
"wcag-audit",
|
|
115
|
+
"visual-regression",
|
|
116
|
+
]);
|
|
117
|
+
const toggle = (value: string, next: boolean) =>
|
|
118
|
+
setSelected((prev) =>
|
|
119
|
+
next ? [...prev, value] : prev.filter((v) => v !== value)
|
|
120
|
+
);
|
|
121
|
+
return (
|
|
122
|
+
<div className="w-96">
|
|
123
|
+
<div className="mb-3 flex items-baseline justify-between gap-3">
|
|
124
|
+
<p className="text-sm font-medium text-foreground">
|
|
125
|
+
Enforcement passes
|
|
126
|
+
</p>
|
|
127
|
+
<p className="text-sm text-muted-foreground" aria-live="polite">
|
|
128
|
+
{selected.length} of {services.length} enabled
|
|
129
|
+
</p>
|
|
130
|
+
</div>
|
|
131
|
+
<div
|
|
132
|
+
role="group"
|
|
133
|
+
aria-label="Enforcement passes for this fork"
|
|
134
|
+
className="grid gap-3"
|
|
135
|
+
>
|
|
136
|
+
{services.map((service) => (
|
|
137
|
+
<CheckboxCard
|
|
138
|
+
key={service.value}
|
|
139
|
+
value={service.value}
|
|
140
|
+
checked={selected.includes(service.value)}
|
|
141
|
+
onCheckedChange={(next) => toggle(service.value, next)}
|
|
142
|
+
>
|
|
143
|
+
<span className="text-sm font-medium text-foreground">
|
|
144
|
+
{service.title}
|
|
145
|
+
</span>
|
|
146
|
+
<span className="text-sm text-muted-foreground">
|
|
147
|
+
{service.description}
|
|
148
|
+
</span>
|
|
149
|
+
</CheckboxCard>
|
|
150
|
+
))}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const RealisticUse_RadioCards: Story = {
|
|
158
|
+
render: function RealisticUseRadioCardsStory() {
|
|
159
|
+
// Real content: engagement-tier picker — Jordan Reeves choosing a BADS
|
|
160
|
+
// engagement level; amounts from content/personas/bads.json →
|
|
161
|
+
// currency_amounts.
|
|
162
|
+
const plans = [
|
|
163
|
+
{
|
|
164
|
+
value: "starter",
|
|
165
|
+
title: "Starter",
|
|
166
|
+
description: "$0.00 — fork the system, community support, self-serve.",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
value: "pro",
|
|
170
|
+
title: "Pro",
|
|
171
|
+
description: "$249.00/mo — every primitive, Chromatic, priority support.",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
value: "enterprise",
|
|
175
|
+
title: "Enterprise",
|
|
176
|
+
description:
|
|
177
|
+
"$12,500.00/engagement — full brand calibration and onboarding.",
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
const [plan, setPlan] = React.useState("pro");
|
|
181
|
+
return (
|
|
182
|
+
<fieldset className="w-96 border-0 p-0">
|
|
183
|
+
<legend className="mb-3 text-sm font-medium text-foreground">
|
|
184
|
+
Engagement tier
|
|
185
|
+
</legend>
|
|
186
|
+
<div className="grid gap-3">
|
|
187
|
+
{plans.map((option) => (
|
|
188
|
+
<RadioCard
|
|
189
|
+
key={option.value}
|
|
190
|
+
name="engagement-tier"
|
|
191
|
+
value={option.value}
|
|
192
|
+
checked={plan === option.value}
|
|
193
|
+
onChange={() => setPlan(option.value)}
|
|
194
|
+
>
|
|
195
|
+
<span className="text-sm font-medium text-foreground">
|
|
196
|
+
{option.title}
|
|
197
|
+
</span>
|
|
198
|
+
<span className="text-sm text-muted-foreground">
|
|
199
|
+
{option.description}
|
|
200
|
+
</span>
|
|
201
|
+
</RadioCard>
|
|
202
|
+
))}
|
|
203
|
+
</div>
|
|
204
|
+
<p className="mt-3 text-sm text-muted-foreground" aria-live="polite">
|
|
205
|
+
Selected: {plans.find((p) => p.value === plan)?.title}
|
|
206
|
+
</p>
|
|
207
|
+
</fieldset>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
CheckboxGroup,
|
|
5
|
+
CheckboxGroupItem,
|
|
6
|
+
CheckboxGroupSelectAll,
|
|
7
|
+
} from "@behavioral-agentic-design-system/core/components/ui/checkbox-group";
|
|
8
|
+
import {
|
|
9
|
+
Fieldset,
|
|
10
|
+
FieldsetLegend,
|
|
11
|
+
FieldsetHelper,
|
|
12
|
+
} from "@behavioral-agentic-design-system/core/components/ui/fieldset";
|
|
13
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
14
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof CheckboxGroup> = {
|
|
17
|
+
title: "Components/CheckboxGroup",
|
|
18
|
+
component: CheckboxGroup,
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: "centered",
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component:
|
|
24
|
+
"Group orchestration for Checkbox — the multi-select sibling of RadioGroup. Owns the shared string[] value (controlled or uncontrolled via value/defaultValue + onValueChange), propagates disabled and form name to every item, and derives a select-all parent's tri-state (checked / indeterminate / unchecked) from the items actually rendered. Items register on mount, so select-all never needs an allValues prop. Select-all operates on enabled items only: toggling off preserves disabled-but-checked values. The group needs an accessible name — aria-label / aria-labelledby, or wrap in Fieldset + FieldsetLegend. Rendering delegates to the existing BADS Checkbox.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof CheckboxGroup>;
|
|
31
|
+
|
|
32
|
+
const itemRow = (
|
|
33
|
+
value: string,
|
|
34
|
+
id: string,
|
|
35
|
+
label: string,
|
|
36
|
+
disabled = false,
|
|
37
|
+
) => (
|
|
38
|
+
<div className="flex items-center gap-2.5">
|
|
39
|
+
<CheckboxGroupItem value={value} id={id} disabled={disabled} />
|
|
40
|
+
<Label htmlFor={id} className="font-normal">
|
|
41
|
+
{label}
|
|
42
|
+
</Label>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<CheckboxGroup
|
|
49
|
+
aria-label="Notification preferences"
|
|
50
|
+
defaultValue={["email", "push"]}
|
|
51
|
+
className="w-72"
|
|
52
|
+
>
|
|
53
|
+
{itemRow("email", "cg-email", "Email digest")}
|
|
54
|
+
{itemRow("push", "cg-push", "Push notifications")}
|
|
55
|
+
{itemRow("sms", "cg-sms", "SMS alerts")}
|
|
56
|
+
</CheckboxGroup>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Disabled: Story = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<div className="flex w-72 flex-col gap-6">
|
|
63
|
+
<div className="flex flex-col gap-2">
|
|
64
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
65
|
+
Whole group disabled
|
|
66
|
+
</p>
|
|
67
|
+
<CheckboxGroup
|
|
68
|
+
aria-label="Notification preferences (read-only plan)"
|
|
69
|
+
defaultValue={["email"]}
|
|
70
|
+
disabled
|
|
71
|
+
>
|
|
72
|
+
{itemRow("email", "cgd-email", "Email digest")}
|
|
73
|
+
{itemRow("push", "cgd-push", "Push notifications")}
|
|
74
|
+
</CheckboxGroup>
|
|
75
|
+
</div>
|
|
76
|
+
<div className="flex flex-col gap-2">
|
|
77
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
78
|
+
Single item disabled
|
|
79
|
+
</p>
|
|
80
|
+
<CheckboxGroup
|
|
81
|
+
aria-label="Sync targets"
|
|
82
|
+
defaultValue={["tokens", "stories"]}
|
|
83
|
+
>
|
|
84
|
+
{itemRow("tokens", "cgd-tokens", "Design tokens")}
|
|
85
|
+
{itemRow("stories", "cgd-stories", "Storybook stories", true)}
|
|
86
|
+
{itemRow("registry", "cgd-registry", "Component registry")}
|
|
87
|
+
</CheckboxGroup>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const SelectAll: Story = {
|
|
94
|
+
render: function SelectAllStory() {
|
|
95
|
+
const [value, setValue] = React.useState<string[]>(["button", "card"]);
|
|
96
|
+
return (
|
|
97
|
+
<CheckboxGroup
|
|
98
|
+
aria-label="Components to publish"
|
|
99
|
+
allValues={["button", "card", "input", "dialog"]}
|
|
100
|
+
value={value}
|
|
101
|
+
onValueChange={setValue}
|
|
102
|
+
className="w-72"
|
|
103
|
+
>
|
|
104
|
+
<div className="flex items-center gap-2.5">
|
|
105
|
+
<CheckboxGroupSelectAll id="cgsa-all" />
|
|
106
|
+
<Label htmlFor="cgsa-all">Select all</Label>
|
|
107
|
+
</div>
|
|
108
|
+
<Separator />
|
|
109
|
+
{itemRow("button", "cgsa-button", "Button")}
|
|
110
|
+
{itemRow("card", "cgsa-card", "Card")}
|
|
111
|
+
{itemRow("input", "cgsa-input", "Input")}
|
|
112
|
+
{itemRow("dialog", "cgsa-dialog", "Dialog")}
|
|
113
|
+
</CheckboxGroup>
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const Controlled: Story = {
|
|
119
|
+
render: function ControlledStory() {
|
|
120
|
+
const [value, setValue] = React.useState<string[]>(["a11y contract"]);
|
|
121
|
+
return (
|
|
122
|
+
<div className="flex w-80 flex-col gap-4">
|
|
123
|
+
<CheckboxGroup
|
|
124
|
+
aria-label="Review checklist for the Tag primitive"
|
|
125
|
+
value={value}
|
|
126
|
+
onValueChange={setValue}
|
|
127
|
+
>
|
|
128
|
+
{itemRow("design tokens", "cgc-tokens", "Design tokens only")}
|
|
129
|
+
{itemRow("a11y contract", "cgc-a11y", "a11y contract complete")}
|
|
130
|
+
{itemRow("visual regression", "cgc-vr", "Visual regression passed")}
|
|
131
|
+
</CheckboxGroup>
|
|
132
|
+
<p className="text-sm text-muted-foreground">
|
|
133
|
+
Checked:{" "}
|
|
134
|
+
<span className="font-medium text-foreground">
|
|
135
|
+
{value.length > 0 ? value.join(", ") : "none"}
|
|
136
|
+
</span>
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const RealisticUse: Story = {
|
|
144
|
+
render: function RealisticUseStory() {
|
|
145
|
+
const [value, setValue] = React.useState<string[]>([
|
|
146
|
+
"jordan.reeves",
|
|
147
|
+
"seoyun_park",
|
|
148
|
+
]);
|
|
149
|
+
return (
|
|
150
|
+
<form
|
|
151
|
+
className="w-[26rem]"
|
|
152
|
+
onSubmit={(e) => e.preventDefault()}
|
|
153
|
+
>
|
|
154
|
+
<Fieldset>
|
|
155
|
+
<FieldsetLegend>Review reminders</FieldsetLegend>
|
|
156
|
+
<FieldsetHelper>
|
|
157
|
+
Who gets pinged when a token change lands.
|
|
158
|
+
</FieldsetHelper>
|
|
159
|
+
{/* allValues lists only toggleable reviewers — anika.p is disabled
|
|
160
|
+
(on leave), so select-all never touches her entry. */}
|
|
161
|
+
<CheckboxGroup
|
|
162
|
+
aria-label="Reviewers to remind"
|
|
163
|
+
name="reviewers"
|
|
164
|
+
allValues={["jordan.reeves", "seoyun_park", "mlindqvist"]}
|
|
165
|
+
value={value}
|
|
166
|
+
onValueChange={setValue}
|
|
167
|
+
>
|
|
168
|
+
<div className="flex items-center gap-2.5">
|
|
169
|
+
<CheckboxGroupSelectAll id="ru-all" />
|
|
170
|
+
<Label htmlFor="ru-all">All reviewers</Label>
|
|
171
|
+
</div>
|
|
172
|
+
<Separator />
|
|
173
|
+
{itemRow("jordan.reeves", "ru-jordan", "Jordan Reeves")}
|
|
174
|
+
{itemRow("seoyun_park", "ru-seoyun", "Seo-yun Park")}
|
|
175
|
+
{itemRow("mlindqvist", "ru-marcus", "Marcus Lindqvist")}
|
|
176
|
+
{itemRow("anika.p", "ru-anika", "Anika Patel (on leave)", true)}
|
|
177
|
+
</CheckboxGroup>
|
|
178
|
+
<p className="text-sm text-muted-foreground">
|
|
179
|
+
{value.length} of 4 reviewers will be reminded before the
|
|
180
|
+
2026-05-26 release.
|
|
181
|
+
</p>
|
|
182
|
+
</Fieldset>
|
|
183
|
+
</form>
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Palette, Accessibility, GitBranch } from "lucide-react";
|
|
4
|
+
import { Chip } from "@behavioral-agentic-design-system/core/components/ui/chip";
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Chip> = {
|
|
13
|
+
title: "Components/Chip",
|
|
14
|
+
component: Chip,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered",
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component:
|
|
20
|
+
"Interactive filter/facet toggle pill with role=\"checkbox\" semantics. Distinct from Tag (a passive display label): Chip is a stateful selector the user toggles on/off. Each chip is an independent toggle and its own tab stop — not a radiogroup, so arrow keys are deliberately not wired; Space (and Enter) toggles. A leading check icon marks the selected state so it never reads by color alone; a custom leading icon is swapped for the check while selected (the MUI/Mantine chip idiom — slight width shift on toggle is expected). Motion: background/text/border ease via var(--duration-fast) + var(--ease-out); the focus ring is excluded from the transition list so it appears instantly.",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof Chip>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
render: () => <Chip>design tokens</Chip>,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Selected: Story = {
|
|
34
|
+
render: () => <Chip defaultSelected>design tokens</Chip>,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Variant_Default: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<div className="flex flex-wrap gap-2">
|
|
40
|
+
<Chip variant="default">a11y contract</Chip>
|
|
41
|
+
<Chip variant="default" defaultSelected>
|
|
42
|
+
a11y contract
|
|
43
|
+
</Chip>
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Variant_Outline: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div className="flex flex-wrap gap-2">
|
|
51
|
+
<Chip variant="outline">visual regression</Chip>
|
|
52
|
+
<Chip variant="outline" defaultSelected>
|
|
53
|
+
visual regression
|
|
54
|
+
</Chip>
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Size_Sm: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<Chip size="sm" defaultSelected>
|
|
62
|
+
token drift
|
|
63
|
+
</Chip>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Size_Default: Story = {
|
|
68
|
+
render: () => <Chip defaultSelected>token drift</Chip>,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Size_Lg: Story = {
|
|
72
|
+
render: () => (
|
|
73
|
+
<Chip size="lg" defaultSelected>
|
|
74
|
+
token drift
|
|
75
|
+
</Chip>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const WithIcon: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<div className="flex flex-wrap gap-2">
|
|
82
|
+
<Chip icon={<Palette strokeWidth={1.5} />}>design tokens</Chip>
|
|
83
|
+
<Chip icon={<Accessibility strokeWidth={1.5} />} defaultSelected>
|
|
84
|
+
a11y contract
|
|
85
|
+
</Chip>
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Disabled: Story = {
|
|
91
|
+
render: () => <Chip disabled>forced colors</Chip>,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const DisabledSelected: Story = {
|
|
95
|
+
render: () => (
|
|
96
|
+
<Chip disabled defaultSelected>
|
|
97
|
+
forced colors
|
|
98
|
+
</Chip>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Controlled: Story = {
|
|
103
|
+
render: function ControlledStory() {
|
|
104
|
+
const [selected, setSelected] = React.useState(true);
|
|
105
|
+
return (
|
|
106
|
+
<div className="flex flex-col items-center gap-3">
|
|
107
|
+
<Chip
|
|
108
|
+
selected={selected}
|
|
109
|
+
onSelectedChange={setSelected}
|
|
110
|
+
icon={<GitBranch strokeWidth={1.5} />}
|
|
111
|
+
>
|
|
112
|
+
Radix primitive
|
|
113
|
+
</Chip>
|
|
114
|
+
<p className="text-sm text-muted-foreground" aria-live="polite">
|
|
115
|
+
{selected ? "Filter active" : "Filter inactive"}
|
|
116
|
+
</p>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const RealisticUse: Story = {
|
|
123
|
+
render: function RealisticUseStory() {
|
|
124
|
+
// Real content: registry-docs topic facets from the BADS jargon pool
|
|
125
|
+
// (content/personas/bads.json → jargon) — Jordan Reeves filtering the
|
|
126
|
+
// component docs before a token review.
|
|
127
|
+
const topics = [
|
|
128
|
+
"design tokens",
|
|
129
|
+
"a11y contract",
|
|
130
|
+
"CVA variants",
|
|
131
|
+
"visual regression",
|
|
132
|
+
"token drift",
|
|
133
|
+
"focus trap",
|
|
134
|
+
];
|
|
135
|
+
const [active, setActive] = React.useState<string[]>([
|
|
136
|
+
"design tokens",
|
|
137
|
+
"a11y contract",
|
|
138
|
+
]);
|
|
139
|
+
const toggle = (topic: string, next: boolean) =>
|
|
140
|
+
setActive((prev) =>
|
|
141
|
+
next ? [...prev, topic] : prev.filter((t) => t !== topic)
|
|
142
|
+
);
|
|
143
|
+
return (
|
|
144
|
+
<Card className="w-96">
|
|
145
|
+
<CardHeader>
|
|
146
|
+
<CardTitle className="text-2xl">Filter docs</CardTitle>
|
|
147
|
+
<p className="text-sm text-muted-foreground">
|
|
148
|
+
Showing guides matching {active.length} of {topics.length} topics
|
|
149
|
+
</p>
|
|
150
|
+
</CardHeader>
|
|
151
|
+
<CardContent>
|
|
152
|
+
<div
|
|
153
|
+
role="group"
|
|
154
|
+
aria-label="Filter docs by topic"
|
|
155
|
+
className="flex flex-wrap gap-2"
|
|
156
|
+
>
|
|
157
|
+
{topics.map((topic) => (
|
|
158
|
+
<Chip
|
|
159
|
+
key={topic}
|
|
160
|
+
size="sm"
|
|
161
|
+
variant="outline"
|
|
162
|
+
selected={active.includes(topic)}
|
|
163
|
+
onSelectedChange={(next) => toggle(topic, next)}
|
|
164
|
+
>
|
|
165
|
+
{topic}
|
|
166
|
+
</Chip>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
</CardContent>
|
|
170
|
+
</Card>
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
};
|
|
@@ -30,6 +30,9 @@ export const Variant_Muted: Story = {
|
|
|
30
30
|
),
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// success/warning now paint the real oklch token: the class was
|
|
34
|
+
// text-[hsl(var(--success))] — hsl() wrapping an oklch value is invalid CSS and
|
|
35
|
+
// silently fell back — fixed to text-[var(--success)] (2026-07-24 paydown).
|
|
33
36
|
export const Variant_Success: Story = {
|
|
34
37
|
render: () => (
|
|
35
38
|
<CircularProgress value={100} variant="success" label="Complete" />
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import { ColorSwatch } from "@behavioral-agentic-design-system/core/components/ui/color-swatch";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ColorSwatch is a display-only chip that renders any CSS color. It is
|
|
7
|
+
* presentational by default (`aria-hidden`) because a swatch usually sits
|
|
8
|
+
* beside a text label that already names the color; pass `aria-label` when it
|
|
9
|
+
* stands alone. CVA axes: `size` (sm/default/lg) and `shape`
|
|
10
|
+
* (rounded/circle/square). Not interactive — wrap in a Button to make it click.
|
|
11
|
+
*/
|
|
12
|
+
const meta: Meta<typeof ColorSwatch> = {
|
|
13
|
+
title: "Components/ColorSwatch",
|
|
14
|
+
component: ColorSwatch,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered",
|
|
17
|
+
},
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: { color: "#2563eb", "aria-label": "Blue" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Variant_Rounded: Story = {
|
|
29
|
+
args: { color: "#2563eb", shape: "rounded", "aria-label": "Blue" },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Variant_Circle: Story = {
|
|
33
|
+
args: { color: "#16a34a", shape: "circle", "aria-label": "Green" },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Variant_Square: Story = {
|
|
37
|
+
args: { color: "#ea580c", shape: "square", "aria-label": "Orange" },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Size_Sm: Story = {
|
|
41
|
+
args: { color: "#2563eb", size: "sm", "aria-label": "Blue" },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Size_Default: Story = {
|
|
45
|
+
args: { color: "#2563eb", size: "default", "aria-label": "Blue" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Size_Lg: Story = {
|
|
49
|
+
args: { color: "#2563eb", size: "lg", "aria-label": "Blue" },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A brand palette row plus a "selected" swatch that composes a check icon as a
|
|
54
|
+
* child. The check inherits `currentColor`; here it is forced white for
|
|
55
|
+
* contrast against the dark selected swatch.
|
|
56
|
+
*/
|
|
57
|
+
export const RealisticUse: Story = {
|
|
58
|
+
render: () => (
|
|
59
|
+
<div className="flex flex-col gap-6">
|
|
60
|
+
<div className="flex items-center gap-2">
|
|
61
|
+
{[
|
|
62
|
+
{ c: "#ef4444", n: "Red" },
|
|
63
|
+
{ c: "#f97316", n: "Orange" },
|
|
64
|
+
{ c: "#eab308", n: "Amber" },
|
|
65
|
+
{ c: "#22c55e", n: "Green" },
|
|
66
|
+
{ c: "#06b6d4", n: "Cyan" },
|
|
67
|
+
{ c: "#3b82f6", n: "Blue" },
|
|
68
|
+
{ c: "#8b5cf6", n: "Violet" },
|
|
69
|
+
].map((s) => (
|
|
70
|
+
<ColorSwatch key={s.c} color={s.c} shape="circle" aria-label={s.n} />
|
|
71
|
+
))}
|
|
72
|
+
</div>
|
|
73
|
+
<div className="flex items-center gap-3 text-sm">
|
|
74
|
+
<ColorSwatch color="#171717" size="lg" aria-label="Selected: near-black">
|
|
75
|
+
<Check strokeWidth={1.5} className="text-white" />
|
|
76
|
+
</ColorSwatch>
|
|
77
|
+
<span className="text-muted-foreground tabular-nums">#171717 · selected</span>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
),
|
|
81
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Motion: the copy↔copied swap narrowed transition-all → transition-[opacity,transform] (explicit-properties rule).
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
3
|
import * as React from "react"
|
|
3
4
|
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button"
|
|
@@ -10,7 +11,7 @@ const meta: Meta<typeof CopyButton> = {
|
|
|
10
11
|
docs: {
|
|
11
12
|
description: {
|
|
12
13
|
component:
|
|
13
|
-
"Button that copies a string to the clipboard. Idle → Copied state swap via opacity + scale transition (var(--duration-fast) + var(--ease-out)). Announces 'Copied to clipboard' via aria-live=polite. The
|
|
14
|
+
"Button that copies a string to the clipboard. Idle → Copied state swap via opacity + scale transition (var(--duration-fast) + var(--ease-out)). Announces 'Copied to clipboard' via aria-live=polite. The Copied state inherits the button variant's own foreground color (no success-green override) so it reads on any variant — green on a dark default button fails WCAG AAA. The confirmation overlay is centered over the button face (an earlier right-aligned treatment clipped against overflow-hidden on non-px-4 sizes). Compact labeled sizes (sm/xs) drop the check icon in the Copied state — the text alone confirms, and icon+text overflows the tighter padding; icon-only mode always keeps the check. The confirmation is aria-hidden; state is announced via the live region. Icon-only mode requires aria-label. Gracefully falls back to document.execCommand in non-secure contexts. Not a form submit — always type=button via Button primitive.",
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
},
|
|
@@ -107,5 +108,4 @@ export const AllVariants: Story = {
|
|
|
107
108
|
<CopyButton value="ghost" variant="ghost">Ghost</CopyButton>
|
|
108
109
|
</div>
|
|
109
110
|
),
|
|
110
|
-
}
|
|
111
|
-
|
|
111
|
+
}
|