@behavioral-agentic-design-system/core 0.22.0 → 0.24.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 +6 -4
- package/scripts/size-audit.cjs +147 -0
- package/src/api/layers/file.ts +0 -1
- package/src/app/layout.tsx +29 -4
- package/src/app/opengraph-image.tsx +103 -0
- package/src/app/preview/components/page.tsx +405 -5
- package/src/app/shell.tsx +31 -7
- package/src/components/customize-tab.tsx +111 -139
- package/src/components/home-tab.tsx +7 -14
- package/src/components/layers-tab.tsx +5 -0
- package/src/components/onboarding-wizard.tsx +1 -1
- package/src/components/ui/copy-button.tsx +2 -2
- package/src/components/ui/data-list.tsx +169 -0
- package/src/components/ui/editable.tsx +56 -27
- package/src/components/ui/fieldset.tsx +244 -0
- package/src/components/ui/index.ts +4 -0
- package/src/components/ui/input-group.tsx +204 -0
- package/src/components/ui/qr-code.tsx +107 -0
- package/src/data/docs-index.ts +14 -0
- package/src/stories/Accordion.stories.tsx +21 -0
- package/src/stories/Button.stories.tsx +15 -0
- package/src/stories/CopyButton.stories.tsx +3 -3
- package/src/stories/DataList.stories.tsx +160 -0
- package/src/stories/Dialog.stories.tsx +33 -0
- package/src/stories/Editable.stories.tsx +34 -7
- package/src/stories/Field.stories.tsx +1 -1
- package/src/stories/Fieldset.stories.tsx +253 -0
- package/src/stories/InputGroup.stories.tsx +227 -0
- package/src/stories/Label.stories.tsx +2 -2
- package/src/stories/QrCode.stories.tsx +146 -0
- package/src/stories/Tabs.stories.tsx +24 -0
- package/src/styles.css +0 -12
- package/src/tokens.json +45 -49
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Fieldset,
|
|
5
|
+
FieldsetLegend,
|
|
6
|
+
FieldsetHelper,
|
|
7
|
+
FieldsetError,
|
|
8
|
+
} from "@behavioral-agentic-design-system/core/components/ui/fieldset";
|
|
9
|
+
import {
|
|
10
|
+
RadioGroup,
|
|
11
|
+
RadioGroupItem,
|
|
12
|
+
} from "@behavioral-agentic-design-system/core/components/ui/radio-group";
|
|
13
|
+
import { Checkbox } from "@behavioral-agentic-design-system/core/components/ui/checkbox";
|
|
14
|
+
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
15
|
+
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
16
|
+
|
|
17
|
+
const meta: Meta<typeof Fieldset> = {
|
|
18
|
+
title: "Components/Fieldset",
|
|
19
|
+
component: Fieldset,
|
|
20
|
+
parameters: {
|
|
21
|
+
layout: "centered",
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component:
|
|
25
|
+
"Semantic grouping for related form controls. Renders a native <fieldset> + <legend>, so the group gets a real accessible name (announced when focus enters any nested control) and native <fieldset disabled> cascade-disables every control inside — something the div-based FieldGroup cannot do. The legend must be the first child. Group description/error wire to the fieldset via aria-describedby using a registration pattern, so the reference never dangles. Helper hides when invalid so the error is the single announced description. Variants: default (bordered box) / unstyled. Sizes: sm / default / lg.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof Fieldset>;
|
|
32
|
+
|
|
33
|
+
const notificationRow = (id: string, label: string, defaultChecked = false) => (
|
|
34
|
+
<div className="flex items-center gap-2.5">
|
|
35
|
+
<Checkbox id={id} defaultChecked={defaultChecked} />
|
|
36
|
+
<Label htmlFor={id} className="font-normal">
|
|
37
|
+
{label}
|
|
38
|
+
</Label>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Regression guard note: the legend must render IN FLOW (float-left opts out
|
|
43
|
+
// of the browser's native in-border "rendered legend" placement). If the
|
|
44
|
+
// border ever strikes through the legend title again, fieldset.tsx's
|
|
45
|
+
// FieldsetLegend float rule regressed — see the 2026-07-06 prod fix.
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<Fieldset className="w-96">
|
|
49
|
+
<FieldsetLegend>Notification preferences</FieldsetLegend>
|
|
50
|
+
<FieldsetHelper>Choose how we reach Jordan Reeves.</FieldsetHelper>
|
|
51
|
+
<div className="flex flex-col gap-3">
|
|
52
|
+
{notificationRow("n-email", "Email digest", true)}
|
|
53
|
+
{notificationRow("n-push", "Push notifications", true)}
|
|
54
|
+
{notificationRow("n-sms", "SMS alerts")}
|
|
55
|
+
</div>
|
|
56
|
+
</Fieldset>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Variant_Unstyled: Story = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<Fieldset variant="unstyled" className="w-96">
|
|
63
|
+
<FieldsetLegend>Release channel</FieldsetLegend>
|
|
64
|
+
<FieldsetHelper>Where Seo-yun Park receives new versions.</FieldsetHelper>
|
|
65
|
+
<RadioGroup defaultValue="stable" className="gap-3">
|
|
66
|
+
<div className="flex items-center gap-2.5">
|
|
67
|
+
<RadioGroupItem value="stable" id="u-stable" />
|
|
68
|
+
<Label htmlFor="u-stable" className="font-normal">
|
|
69
|
+
Stable
|
|
70
|
+
</Label>
|
|
71
|
+
</div>
|
|
72
|
+
<div className="flex items-center gap-2.5">
|
|
73
|
+
<RadioGroupItem value="beta" id="u-beta" />
|
|
74
|
+
<Label htmlFor="u-beta" className="font-normal">
|
|
75
|
+
Beta
|
|
76
|
+
</Label>
|
|
77
|
+
</div>
|
|
78
|
+
<div className="flex items-center gap-2.5">
|
|
79
|
+
<RadioGroupItem value="canary" id="u-canary" />
|
|
80
|
+
<Label htmlFor="u-canary" className="font-normal">
|
|
81
|
+
Canary
|
|
82
|
+
</Label>
|
|
83
|
+
</div>
|
|
84
|
+
</RadioGroup>
|
|
85
|
+
</Fieldset>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Size_Sm: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<Fieldset size="sm" className="w-80">
|
|
92
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
93
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
94
|
+
<RadioGroup defaultValue="team" className="gap-2.5">
|
|
95
|
+
<div className="flex items-center gap-2.5">
|
|
96
|
+
<RadioGroupItem value="starter" id="s-starter" />
|
|
97
|
+
<Label htmlFor="s-starter" className="font-normal">
|
|
98
|
+
Starter
|
|
99
|
+
</Label>
|
|
100
|
+
</div>
|
|
101
|
+
<div className="flex items-center gap-2.5">
|
|
102
|
+
<RadioGroupItem value="team" id="s-team" />
|
|
103
|
+
<Label htmlFor="s-team" className="font-normal">
|
|
104
|
+
Team
|
|
105
|
+
</Label>
|
|
106
|
+
</div>
|
|
107
|
+
</RadioGroup>
|
|
108
|
+
</Fieldset>
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const Size_Default: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<Fieldset size="default" className="w-80">
|
|
115
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
116
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
117
|
+
<RadioGroup defaultValue="team" className="gap-3">
|
|
118
|
+
<div className="flex items-center gap-2.5">
|
|
119
|
+
<RadioGroupItem value="starter" id="d-starter" />
|
|
120
|
+
<Label htmlFor="d-starter" className="font-normal">
|
|
121
|
+
Starter
|
|
122
|
+
</Label>
|
|
123
|
+
</div>
|
|
124
|
+
<div className="flex items-center gap-2.5">
|
|
125
|
+
<RadioGroupItem value="team" id="d-team" />
|
|
126
|
+
<Label htmlFor="d-team" className="font-normal">
|
|
127
|
+
Team
|
|
128
|
+
</Label>
|
|
129
|
+
</div>
|
|
130
|
+
</RadioGroup>
|
|
131
|
+
</Fieldset>
|
|
132
|
+
),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const Size_Lg: Story = {
|
|
136
|
+
render: () => (
|
|
137
|
+
<Fieldset size="lg" className="w-80">
|
|
138
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
139
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
140
|
+
<RadioGroup defaultValue="team" className="gap-3">
|
|
141
|
+
<div className="flex items-center gap-2.5">
|
|
142
|
+
<RadioGroupItem value="starter" id="l-starter" />
|
|
143
|
+
<Label htmlFor="l-starter" className="font-normal">
|
|
144
|
+
Starter
|
|
145
|
+
</Label>
|
|
146
|
+
</div>
|
|
147
|
+
<div className="flex items-center gap-2.5">
|
|
148
|
+
<RadioGroupItem value="team" id="l-team" />
|
|
149
|
+
<Label htmlFor="l-team" className="font-normal">
|
|
150
|
+
Team
|
|
151
|
+
</Label>
|
|
152
|
+
</div>
|
|
153
|
+
</RadioGroup>
|
|
154
|
+
</Fieldset>
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const Disabled: Story = {
|
|
159
|
+
render: () => (
|
|
160
|
+
<Fieldset disabled className="w-96">
|
|
161
|
+
<FieldsetLegend>Notification preferences</FieldsetLegend>
|
|
162
|
+
<FieldsetHelper>
|
|
163
|
+
Locked while Marcus Lindqvist’s plan is read-only.
|
|
164
|
+
</FieldsetHelper>
|
|
165
|
+
<div className="flex flex-col gap-3">
|
|
166
|
+
{notificationRow("dis-email", "Email digest", true)}
|
|
167
|
+
{notificationRow("dis-push", "Push notifications")}
|
|
168
|
+
</div>
|
|
169
|
+
</Fieldset>
|
|
170
|
+
),
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const Invalid: Story = {
|
|
174
|
+
render: () => (
|
|
175
|
+
<Fieldset invalid className="w-96">
|
|
176
|
+
<FieldsetLegend>Contact method</FieldsetLegend>
|
|
177
|
+
<FieldsetHelper>We’ll only use this for security alerts.</FieldsetHelper>
|
|
178
|
+
<RadioGroup className="gap-3">
|
|
179
|
+
<div className="flex items-center gap-2.5">
|
|
180
|
+
<RadioGroupItem value="email" id="inv-email" />
|
|
181
|
+
<Label htmlFor="inv-email" className="font-normal">
|
|
182
|
+
Email
|
|
183
|
+
</Label>
|
|
184
|
+
</div>
|
|
185
|
+
<div className="flex items-center gap-2.5">
|
|
186
|
+
<RadioGroupItem value="phone" id="inv-phone" />
|
|
187
|
+
<Label htmlFor="inv-phone" className="font-normal">
|
|
188
|
+
Phone
|
|
189
|
+
</Label>
|
|
190
|
+
</div>
|
|
191
|
+
</RadioGroup>
|
|
192
|
+
<FieldsetError>Choose at least one contact method.</FieldsetError>
|
|
193
|
+
</Fieldset>
|
|
194
|
+
),
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const RealisticUse: Story = {
|
|
198
|
+
render: () => {
|
|
199
|
+
const [country, setCountry] = React.useState("");
|
|
200
|
+
const invalid = country.trim().length === 0;
|
|
201
|
+
return (
|
|
202
|
+
<form
|
|
203
|
+
className="flex w-[26rem] flex-col gap-6"
|
|
204
|
+
onSubmit={(e) => e.preventDefault()}
|
|
205
|
+
>
|
|
206
|
+
<Fieldset>
|
|
207
|
+
<FieldsetLegend>Billing address</FieldsetLegend>
|
|
208
|
+
<FieldsetHelper>Where Jordan Reeves’ invoices are sent.</FieldsetHelper>
|
|
209
|
+
<div className="mt-1 flex flex-col gap-3">
|
|
210
|
+
<div className="flex flex-col gap-1.5">
|
|
211
|
+
<Label htmlFor="ra-line1">Street address</Label>
|
|
212
|
+
<Input
|
|
213
|
+
id="ra-line1"
|
|
214
|
+
defaultValue="1401 South Congress Ave, Suite 200"
|
|
215
|
+
autoComplete="address-line1"
|
|
216
|
+
/>
|
|
217
|
+
</div>
|
|
218
|
+
<div className="grid grid-cols-2 gap-3">
|
|
219
|
+
<div className="flex flex-col gap-1.5">
|
|
220
|
+
<Label htmlFor="ra-city">City</Label>
|
|
221
|
+
<Input id="ra-city" defaultValue="Austin" autoComplete="address-level2" />
|
|
222
|
+
</div>
|
|
223
|
+
<div className="flex flex-col gap-1.5">
|
|
224
|
+
<Label htmlFor="ra-postal">Postal code</Label>
|
|
225
|
+
<Input id="ra-postal" defaultValue="78704" autoComplete="postal-code" />
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</Fieldset>
|
|
230
|
+
|
|
231
|
+
<Fieldset invalid={invalid}>
|
|
232
|
+
<FieldsetLegend>Country</FieldsetLegend>
|
|
233
|
+
<FieldsetHelper>Determines tax and currency.</FieldsetHelper>
|
|
234
|
+
<RadioGroup value={country} onValueChange={setCountry} className="gap-3">
|
|
235
|
+
<div className="flex items-center gap-2.5">
|
|
236
|
+
<RadioGroupItem value="us" id="ra-us" />
|
|
237
|
+
<Label htmlFor="ra-us" className="font-normal">
|
|
238
|
+
United States
|
|
239
|
+
</Label>
|
|
240
|
+
</div>
|
|
241
|
+
<div className="flex items-center gap-2.5">
|
|
242
|
+
<RadioGroupItem value="se" id="ra-se" />
|
|
243
|
+
<Label htmlFor="ra-se" className="font-normal">
|
|
244
|
+
Sweden
|
|
245
|
+
</Label>
|
|
246
|
+
</div>
|
|
247
|
+
</RadioGroup>
|
|
248
|
+
<FieldsetError>Select a country to continue.</FieldsetError>
|
|
249
|
+
</Fieldset>
|
|
250
|
+
</form>
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
InputGroup,
|
|
5
|
+
InputGroupInput,
|
|
6
|
+
InputGroupAddon,
|
|
7
|
+
InputGroupText,
|
|
8
|
+
InputGroupButton,
|
|
9
|
+
} from "@behavioral-agentic-design-system/core/components/ui/input-group";
|
|
10
|
+
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button";
|
|
11
|
+
import { Search, Link2 } from "lucide-react";
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof InputGroup> = {
|
|
14
|
+
title: "Components/InputGroup",
|
|
15
|
+
component: InputGroup,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
"Compound input container that attaches leading/trailing icons, text addons (currency, units, protocols) and inline action buttons to a text input. The group owns the single focus-within ring; the hosted input is borderless + outline-none so there is exactly one focus indicator (HCM-safe), mirroring PasswordInput. Addons and buttons are siblings of the input — never wrapping it — to satisfy axe nested-interactive. InputGroupText is aria-hidden (presentation); label the field itself. Five sizes match Input.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
type Story = StoryObj<typeof InputGroup>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<InputGroup className="w-80">
|
|
32
|
+
<InputGroupAddon align="inline-start">
|
|
33
|
+
<Search aria-hidden />
|
|
34
|
+
</InputGroupAddon>
|
|
35
|
+
<InputGroupInput placeholder="Search sessions" aria-label="Search" />
|
|
36
|
+
</InputGroup>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Size_Sm: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<InputGroup size="sm" className="w-80">
|
|
43
|
+
<InputGroupAddon align="inline-start">
|
|
44
|
+
<InputGroupText>$</InputGroupText>
|
|
45
|
+
</InputGroupAddon>
|
|
46
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
47
|
+
<InputGroupAddon align="inline-end">
|
|
48
|
+
<InputGroupText>USD</InputGroupText>
|
|
49
|
+
</InputGroupAddon>
|
|
50
|
+
</InputGroup>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Size_Default: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<InputGroup size="default" className="w-80">
|
|
57
|
+
<InputGroupAddon align="inline-start">
|
|
58
|
+
<InputGroupText>$</InputGroupText>
|
|
59
|
+
</InputGroupAddon>
|
|
60
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
61
|
+
<InputGroupAddon align="inline-end">
|
|
62
|
+
<InputGroupText>USD</InputGroupText>
|
|
63
|
+
</InputGroupAddon>
|
|
64
|
+
</InputGroup>
|
|
65
|
+
),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Size_Lg: Story = {
|
|
69
|
+
render: () => (
|
|
70
|
+
<InputGroup size="lg" className="w-80">
|
|
71
|
+
<InputGroupAddon align="inline-start">
|
|
72
|
+
<InputGroupText>$</InputGroupText>
|
|
73
|
+
</InputGroupAddon>
|
|
74
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
75
|
+
<InputGroupAddon align="inline-end">
|
|
76
|
+
<InputGroupText>USD</InputGroupText>
|
|
77
|
+
</InputGroupAddon>
|
|
78
|
+
</InputGroup>
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const Size_Xl: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<InputGroup size="xl" className="w-80">
|
|
85
|
+
<InputGroupAddon align="inline-start">
|
|
86
|
+
<InputGroupText>$</InputGroupText>
|
|
87
|
+
</InputGroupAddon>
|
|
88
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
89
|
+
<InputGroupAddon align="inline-end">
|
|
90
|
+
<InputGroupText>USD</InputGroupText>
|
|
91
|
+
</InputGroupAddon>
|
|
92
|
+
</InputGroup>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const Size_2xl: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<InputGroup size="2xl" className="w-80">
|
|
99
|
+
<InputGroupAddon align="inline-start">
|
|
100
|
+
<InputGroupText>$</InputGroupText>
|
|
101
|
+
</InputGroupAddon>
|
|
102
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
103
|
+
<InputGroupAddon align="inline-end">
|
|
104
|
+
<InputGroupText>USD</InputGroupText>
|
|
105
|
+
</InputGroupAddon>
|
|
106
|
+
</InputGroup>
|
|
107
|
+
),
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const TextPrefix: Story = {
|
|
111
|
+
name: "Text prefix (protocol)",
|
|
112
|
+
render: () => (
|
|
113
|
+
<InputGroup className="w-96">
|
|
114
|
+
<InputGroupAddon align="inline-start">
|
|
115
|
+
<Link2 aria-hidden />
|
|
116
|
+
<InputGroupText>https://</InputGroupText>
|
|
117
|
+
</InputGroupAddon>
|
|
118
|
+
<InputGroupInput placeholder="ramanathan.co/mei-lin" aria-label="Website URL" />
|
|
119
|
+
</InputGroup>
|
|
120
|
+
),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// Inline copy actions compose the CopyButton primitive — it owns the real
|
|
124
|
+
// clipboard write, the token-driven icon-swap "Copied!" animation, and the
|
|
125
|
+
// aria-live announcement. Never hand-roll a copied state (the first version
|
|
126
|
+
// of this story did, and the showcase demo then shipped a dead Copy button —
|
|
127
|
+
// Sir caught it on prod, 2026-07-06).
|
|
128
|
+
export const WithButton: Story = {
|
|
129
|
+
render: () => (
|
|
130
|
+
<InputGroup className="w-96">
|
|
131
|
+
<InputGroupInput
|
|
132
|
+
readOnly
|
|
133
|
+
value="avery.castillo@protonmail.com"
|
|
134
|
+
aria-label="Invite link email"
|
|
135
|
+
/>
|
|
136
|
+
<CopyButton
|
|
137
|
+
value="avery.castillo@protonmail.com"
|
|
138
|
+
variant="ghost"
|
|
139
|
+
size="sm"
|
|
140
|
+
className="h-full shrink-0 rounded-none"
|
|
141
|
+
>
|
|
142
|
+
Copy
|
|
143
|
+
</CopyButton>
|
|
144
|
+
</InputGroup>
|
|
145
|
+
),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const Disabled: Story = {
|
|
149
|
+
render: () => (
|
|
150
|
+
<InputGroup className="w-80">
|
|
151
|
+
<InputGroupAddon align="inline-start">
|
|
152
|
+
<Search aria-hidden />
|
|
153
|
+
</InputGroupAddon>
|
|
154
|
+
<InputGroupInput placeholder="Search sessions" aria-label="Search" disabled />
|
|
155
|
+
</InputGroup>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const Invalid: Story = {
|
|
160
|
+
render: () => (
|
|
161
|
+
<InputGroup className="w-80" aria-invalid>
|
|
162
|
+
<InputGroupAddon align="inline-start">
|
|
163
|
+
<InputGroupText>$</InputGroupText>
|
|
164
|
+
</InputGroupAddon>
|
|
165
|
+
<InputGroupInput
|
|
166
|
+
defaultValue="-12.00"
|
|
167
|
+
aria-label="Amount"
|
|
168
|
+
aria-invalid
|
|
169
|
+
inputMode="decimal"
|
|
170
|
+
/>
|
|
171
|
+
</InputGroup>
|
|
172
|
+
),
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const RealisticUse: Story = {
|
|
176
|
+
render: () => (
|
|
177
|
+
<div className="flex w-96 flex-col gap-4">
|
|
178
|
+
<div className="flex flex-col gap-1.5">
|
|
179
|
+
<label htmlFor="ig-search" className="text-sm font-medium">
|
|
180
|
+
Find a member
|
|
181
|
+
</label>
|
|
182
|
+
{/* InputGroupButton is for non-copy inline actions (submit, clear).
|
|
183
|
+
Copy actions use CopyButton — see WithButton above. */}
|
|
184
|
+
<form action="#" onSubmit={(e) => e.preventDefault()}>
|
|
185
|
+
<InputGroup>
|
|
186
|
+
<InputGroupAddon align="inline-start">
|
|
187
|
+
<Search aria-hidden />
|
|
188
|
+
</InputGroupAddon>
|
|
189
|
+
<InputGroupInput
|
|
190
|
+
id="ig-search"
|
|
191
|
+
placeholder="Priya Ramanathan"
|
|
192
|
+
defaultValue="Mei-Lin Chen"
|
|
193
|
+
/>
|
|
194
|
+
<InputGroupButton type="submit">Search</InputGroupButton>
|
|
195
|
+
</InputGroup>
|
|
196
|
+
</form>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div className="flex flex-col gap-1.5">
|
|
200
|
+
<label htmlFor="ig-amount" className="text-sm font-medium">
|
|
201
|
+
Monthly dues
|
|
202
|
+
</label>
|
|
203
|
+
<InputGroup>
|
|
204
|
+
<InputGroupAddon align="inline-start">
|
|
205
|
+
<InputGroupText>$</InputGroupText>
|
|
206
|
+
</InputGroupAddon>
|
|
207
|
+
<InputGroupInput id="ig-amount" defaultValue="49.00" inputMode="decimal" />
|
|
208
|
+
<InputGroupAddon align="inline-end">
|
|
209
|
+
<InputGroupText>/ mo</InputGroupText>
|
|
210
|
+
</InputGroupAddon>
|
|
211
|
+
</InputGroup>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<div className="flex flex-col gap-1.5">
|
|
215
|
+
<label htmlFor="ig-handle" className="text-sm font-medium">
|
|
216
|
+
Booking page
|
|
217
|
+
</label>
|
|
218
|
+
<InputGroup>
|
|
219
|
+
<InputGroupAddon align="inline-start">
|
|
220
|
+
<InputGroupText>book.co/</InputGroupText>
|
|
221
|
+
</InputGroupAddon>
|
|
222
|
+
<InputGroupInput id="ig-handle" defaultValue="priya_r2026" />
|
|
223
|
+
</InputGroup>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
),
|
|
227
|
+
};
|
|
@@ -15,13 +15,13 @@ type Story = StoryObj<typeof meta>;
|
|
|
15
15
|
export const Default: Story = {
|
|
16
16
|
render: () => (<div className="flex flex-col gap-2 w-[280px]">
|
|
17
17
|
<Label htmlFor="email">Email</Label>
|
|
18
|
-
<Input id="email" type="email" placeholder="
|
|
18
|
+
<Input id="email" type="email" placeholder="jordan@reeves.design" />
|
|
19
19
|
</div>),
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const RealisticUse: Story = {
|
|
23
23
|
render: () => (<div className="flex flex-col gap-2 w-[280px]">
|
|
24
24
|
<Label htmlFor="email">Email</Label>
|
|
25
|
-
<Input id="email" type="email" placeholder="
|
|
25
|
+
<Input id="email" type="email" placeholder="jordan@reeves.design" />
|
|
26
26
|
</div>),
|
|
27
27
|
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { QRCode } from "@behavioral-agentic-design-system/core/components/ui/qr-code";
|
|
4
|
+
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button";
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
} from "@behavioral-agentic-design-system/core/components/ui/card";
|
|
12
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
13
|
+
|
|
14
|
+
const meta: Meta<typeof QRCode> = {
|
|
15
|
+
title: "Components/QRCode",
|
|
16
|
+
component: QRCode,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "centered",
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component:
|
|
22
|
+
"QR code display primitive. Encodes a string (URL, ID, TOTP URI) via the zero-dependency uqr encoder and renders the SVG with token-driven colors: dark modules inherit text-foreground through currentColor, the quiet zone comes from bg-background — no hardcoded #000/#fff, so brand re-theming propagates. A 4-module quiet zone (ISO/IEC 18004) is baked into the viewBox. Display-only: role=img with a required accessible name (aria-label ?? title ?? derived from value), never focusable, no motion. Scannability contract: keep the module/quiet-zone pair at or above ~3:1 contrast — the default pair sits near 21:1 in both modes. Dark mode renders an inverted (light-on-dark) code, which modern scanners read fine.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
value: { control: "text" },
|
|
28
|
+
size: { control: { type: "number", min: 48, max: 480, step: 8 } },
|
|
29
|
+
errorCorrection: { control: "select", options: ["L", "M", "Q", "H"] },
|
|
30
|
+
title: { control: "text" },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
value: "https://design.bads.com",
|
|
40
|
+
title: "Scan to open design.bads.com",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Size_Sm: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
value: "https://design.bads.com",
|
|
47
|
+
size: 96,
|
|
48
|
+
title: "Scan to open design.bads.com",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Size_Default: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
value: "https://design.bads.com",
|
|
55
|
+
size: 160,
|
|
56
|
+
title: "Scan to open design.bads.com",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Size_Lg: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
value: "https://design.bads.com",
|
|
63
|
+
size: 240,
|
|
64
|
+
title: "Scan to open design.bads.com",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Higher error-correction levels survive more damage (L ≈ 7% → H ≈ 30%)
|
|
70
|
+
* at the cost of a denser matrix — same value, same rendered size, four
|
|
71
|
+
* densities side by side.
|
|
72
|
+
*/
|
|
73
|
+
export const ErrorCorrection_Levels: Story = {
|
|
74
|
+
render: () => (
|
|
75
|
+
<div className="flex flex-wrap items-start gap-6">
|
|
76
|
+
{(["L", "M", "Q", "H"] as const).map((level) => (
|
|
77
|
+
<div key={level} className="flex flex-col items-center gap-2">
|
|
78
|
+
<QRCode
|
|
79
|
+
value="https://design.bads.com/docs/getting-started"
|
|
80
|
+
size={128}
|
|
81
|
+
errorCorrection={level}
|
|
82
|
+
title={`Getting-started guide, error correction ${level}`}
|
|
83
|
+
/>
|
|
84
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
85
|
+
{level} ·{" "}
|
|
86
|
+
{level === "L"
|
|
87
|
+
? "7%"
|
|
88
|
+
: level === "M"
|
|
89
|
+
? "15%"
|
|
90
|
+
: level === "Q"
|
|
91
|
+
? "25%"
|
|
92
|
+
: "30%"}{" "}
|
|
93
|
+
recovery
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A longer payload densifies the matrix at the same rendered size — the
|
|
103
|
+
* quiet zone and module contrast hold because both scale with the viewBox.
|
|
104
|
+
*/
|
|
105
|
+
export const LongValue: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
value:
|
|
108
|
+
"mailto:wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org?subject=Tokens%20v2%20proposal",
|
|
109
|
+
size: 200,
|
|
110
|
+
title: "Scan to email Wilhelmina-Constance Featherstonehaugh-Vance",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const RealisticUse: Story = {
|
|
115
|
+
render: () => {
|
|
116
|
+
const shareUrl = "https://design.bads.com/share/tokens-v2-proposal";
|
|
117
|
+
return (
|
|
118
|
+
<Card className="w-[22rem]">
|
|
119
|
+
<CardHeader>
|
|
120
|
+
<CardTitle className="text-sm">Tokens v2 proposal</CardTitle>
|
|
121
|
+
<CardDescription>
|
|
122
|
+
Shared by Jordan Reeves · Design Systems Lead
|
|
123
|
+
</CardDescription>
|
|
124
|
+
</CardHeader>
|
|
125
|
+
<CardContent className="space-y-4">
|
|
126
|
+
<div className="flex justify-center rounded-md border bg-background p-4">
|
|
127
|
+
<QRCode
|
|
128
|
+
value={shareUrl}
|
|
129
|
+
size={176}
|
|
130
|
+
title="Scan to open the tokens v2 proposal"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
<Separator />
|
|
134
|
+
<div className="flex items-center justify-between gap-3">
|
|
135
|
+
<p className="min-w-0 truncate text-sm text-muted-foreground" title={shareUrl}>
|
|
136
|
+
{shareUrl}
|
|
137
|
+
</p>
|
|
138
|
+
<CopyButton value={shareUrl} size="sm" className="min-h-11 shrink-0">
|
|
139
|
+
Copy link
|
|
140
|
+
</CopyButton>
|
|
141
|
+
</div>
|
|
142
|
+
</CardContent>
|
|
143
|
+
</Card>
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// scrollbar-none (Tailwind v4.3 utility) replaces old scrollbar-width/webkit-scrollbar workaround
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
import { userEvent, within, expect } from "storybook/test";
|
|
4
5
|
import {
|
|
5
6
|
Tabs,
|
|
6
7
|
TabsList,
|
|
@@ -126,3 +127,26 @@ function ResponsiveTabs() {
|
|
|
126
127
|
export const ResponsiveDropdown: Story = {
|
|
127
128
|
render: () => <ResponsiveTabs />,
|
|
128
129
|
};
|
|
130
|
+
|
|
131
|
+
export const Interaction_Switches: Story = {
|
|
132
|
+
tags: ["test"],
|
|
133
|
+
render: () => (
|
|
134
|
+
<Tabs defaultValue="overview" className="w-[480px]">
|
|
135
|
+
<TabsList>
|
|
136
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
137
|
+
<TabsTrigger value="usage">Usage</TabsTrigger>
|
|
138
|
+
<TabsTrigger value="billing">Billing</TabsTrigger>
|
|
139
|
+
</TabsList>
|
|
140
|
+
<TabsContent value="overview">Overview panel content.</TabsContent>
|
|
141
|
+
<TabsContent value="usage">Usage statistics panel.</TabsContent>
|
|
142
|
+
<TabsContent value="billing">Billing settings panel.</TabsContent>
|
|
143
|
+
</Tabs>
|
|
144
|
+
),
|
|
145
|
+
play: async ({ canvasElement }) => {
|
|
146
|
+
const canvas = within(canvasElement);
|
|
147
|
+
const usageTab = canvas.getByRole("tab", { name: /usage/i });
|
|
148
|
+
await userEvent.click(usageTab);
|
|
149
|
+
expect(usageTab).toHaveAttribute("data-state", "active");
|
|
150
|
+
expect(canvas.getByText("Usage statistics panel.")).toBeVisible();
|
|
151
|
+
},
|
|
152
|
+
};
|