@behavioral-agentic-design-system/core 0.22.0 → 0.23.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 +3 -2
- 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 +124 -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/editable.tsx +56 -27
- package/src/components/ui/fieldset.tsx +238 -0
- package/src/components/ui/index.ts +2 -0
- package/src/components/ui/input-group.tsx +194 -0
- package/src/data/docs-index.ts +13 -0
- package/src/stories/Accordion.stories.tsx +21 -0
- package/src/stories/Button.stories.tsx +15 -0
- package/src/stories/CopyButton.stories.tsx +2 -2
- 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 +249 -0
- package/src/stories/InputGroup.stories.tsx +229 -0
- package/src/stories/Label.stories.tsx +2 -2
- package/src/stories/Tabs.stories.tsx +24 -0
- package/src/styles.css +0 -12
- package/src/tokens.json +45 -49
|
@@ -26,7 +26,7 @@ export const Default: Story = {
|
|
|
26
26
|
<Field name="email" required>
|
|
27
27
|
<FieldLabel>Email address</FieldLabel>
|
|
28
28
|
<FieldControl>
|
|
29
|
-
<Input type="email" placeholder="
|
|
29
|
+
<Input type="email" placeholder="jordan@reeves.design" autoComplete="email" />
|
|
30
30
|
</FieldControl>
|
|
31
31
|
<FieldHelper>We'll never share it.</FieldHelper>
|
|
32
32
|
</Field>
|
|
@@ -0,0 +1,249 @@
|
|
|
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
|
+
export const Default: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<Fieldset className="w-96">
|
|
45
|
+
<FieldsetLegend>Notification preferences</FieldsetLegend>
|
|
46
|
+
<FieldsetHelper>Choose how we reach Jordan Reeves.</FieldsetHelper>
|
|
47
|
+
<div className="flex flex-col gap-3">
|
|
48
|
+
{notificationRow("n-email", "Email digest", true)}
|
|
49
|
+
{notificationRow("n-push", "Push notifications", true)}
|
|
50
|
+
{notificationRow("n-sms", "SMS alerts")}
|
|
51
|
+
</div>
|
|
52
|
+
</Fieldset>
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Variant_Unstyled: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<Fieldset variant="unstyled" className="w-96">
|
|
59
|
+
<FieldsetLegend>Release channel</FieldsetLegend>
|
|
60
|
+
<FieldsetHelper>Where Seo-yun Park receives new versions.</FieldsetHelper>
|
|
61
|
+
<RadioGroup defaultValue="stable" className="gap-3">
|
|
62
|
+
<div className="flex items-center gap-2.5">
|
|
63
|
+
<RadioGroupItem value="stable" id="u-stable" />
|
|
64
|
+
<Label htmlFor="u-stable" className="font-normal">
|
|
65
|
+
Stable
|
|
66
|
+
</Label>
|
|
67
|
+
</div>
|
|
68
|
+
<div className="flex items-center gap-2.5">
|
|
69
|
+
<RadioGroupItem value="beta" id="u-beta" />
|
|
70
|
+
<Label htmlFor="u-beta" className="font-normal">
|
|
71
|
+
Beta
|
|
72
|
+
</Label>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="flex items-center gap-2.5">
|
|
75
|
+
<RadioGroupItem value="canary" id="u-canary" />
|
|
76
|
+
<Label htmlFor="u-canary" className="font-normal">
|
|
77
|
+
Canary
|
|
78
|
+
</Label>
|
|
79
|
+
</div>
|
|
80
|
+
</RadioGroup>
|
|
81
|
+
</Fieldset>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const Size_Sm: Story = {
|
|
86
|
+
render: () => (
|
|
87
|
+
<Fieldset size="sm" className="w-80">
|
|
88
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
89
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
90
|
+
<RadioGroup defaultValue="team" className="gap-2.5">
|
|
91
|
+
<div className="flex items-center gap-2.5">
|
|
92
|
+
<RadioGroupItem value="starter" id="s-starter" />
|
|
93
|
+
<Label htmlFor="s-starter" className="font-normal">
|
|
94
|
+
Starter
|
|
95
|
+
</Label>
|
|
96
|
+
</div>
|
|
97
|
+
<div className="flex items-center gap-2.5">
|
|
98
|
+
<RadioGroupItem value="team" id="s-team" />
|
|
99
|
+
<Label htmlFor="s-team" className="font-normal">
|
|
100
|
+
Team
|
|
101
|
+
</Label>
|
|
102
|
+
</div>
|
|
103
|
+
</RadioGroup>
|
|
104
|
+
</Fieldset>
|
|
105
|
+
),
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const Size_Default: Story = {
|
|
109
|
+
render: () => (
|
|
110
|
+
<Fieldset size="default" className="w-80">
|
|
111
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
112
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
113
|
+
<RadioGroup defaultValue="team" className="gap-3">
|
|
114
|
+
<div className="flex items-center gap-2.5">
|
|
115
|
+
<RadioGroupItem value="starter" id="d-starter" />
|
|
116
|
+
<Label htmlFor="d-starter" className="font-normal">
|
|
117
|
+
Starter
|
|
118
|
+
</Label>
|
|
119
|
+
</div>
|
|
120
|
+
<div className="flex items-center gap-2.5">
|
|
121
|
+
<RadioGroupItem value="team" id="d-team" />
|
|
122
|
+
<Label htmlFor="d-team" className="font-normal">
|
|
123
|
+
Team
|
|
124
|
+
</Label>
|
|
125
|
+
</div>
|
|
126
|
+
</RadioGroup>
|
|
127
|
+
</Fieldset>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Size_Lg: Story = {
|
|
132
|
+
render: () => (
|
|
133
|
+
<Fieldset size="lg" className="w-80">
|
|
134
|
+
<FieldsetLegend>Plan tier</FieldsetLegend>
|
|
135
|
+
<FieldsetHelper>Applies to Anika Patel’s workspace.</FieldsetHelper>
|
|
136
|
+
<RadioGroup defaultValue="team" className="gap-3">
|
|
137
|
+
<div className="flex items-center gap-2.5">
|
|
138
|
+
<RadioGroupItem value="starter" id="l-starter" />
|
|
139
|
+
<Label htmlFor="l-starter" className="font-normal">
|
|
140
|
+
Starter
|
|
141
|
+
</Label>
|
|
142
|
+
</div>
|
|
143
|
+
<div className="flex items-center gap-2.5">
|
|
144
|
+
<RadioGroupItem value="team" id="l-team" />
|
|
145
|
+
<Label htmlFor="l-team" className="font-normal">
|
|
146
|
+
Team
|
|
147
|
+
</Label>
|
|
148
|
+
</div>
|
|
149
|
+
</RadioGroup>
|
|
150
|
+
</Fieldset>
|
|
151
|
+
),
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const Disabled: Story = {
|
|
155
|
+
render: () => (
|
|
156
|
+
<Fieldset disabled className="w-96">
|
|
157
|
+
<FieldsetLegend>Notification preferences</FieldsetLegend>
|
|
158
|
+
<FieldsetHelper>
|
|
159
|
+
Locked while Marcus Lindqvist’s plan is read-only.
|
|
160
|
+
</FieldsetHelper>
|
|
161
|
+
<div className="flex flex-col gap-3">
|
|
162
|
+
{notificationRow("dis-email", "Email digest", true)}
|
|
163
|
+
{notificationRow("dis-push", "Push notifications")}
|
|
164
|
+
</div>
|
|
165
|
+
</Fieldset>
|
|
166
|
+
),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const Invalid: Story = {
|
|
170
|
+
render: () => (
|
|
171
|
+
<Fieldset invalid className="w-96">
|
|
172
|
+
<FieldsetLegend>Contact method</FieldsetLegend>
|
|
173
|
+
<FieldsetHelper>We’ll only use this for security alerts.</FieldsetHelper>
|
|
174
|
+
<RadioGroup className="gap-3">
|
|
175
|
+
<div className="flex items-center gap-2.5">
|
|
176
|
+
<RadioGroupItem value="email" id="inv-email" />
|
|
177
|
+
<Label htmlFor="inv-email" className="font-normal">
|
|
178
|
+
Email
|
|
179
|
+
</Label>
|
|
180
|
+
</div>
|
|
181
|
+
<div className="flex items-center gap-2.5">
|
|
182
|
+
<RadioGroupItem value="phone" id="inv-phone" />
|
|
183
|
+
<Label htmlFor="inv-phone" className="font-normal">
|
|
184
|
+
Phone
|
|
185
|
+
</Label>
|
|
186
|
+
</div>
|
|
187
|
+
</RadioGroup>
|
|
188
|
+
<FieldsetError>Choose at least one contact method.</FieldsetError>
|
|
189
|
+
</Fieldset>
|
|
190
|
+
),
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const RealisticUse: Story = {
|
|
194
|
+
render: () => {
|
|
195
|
+
const [country, setCountry] = React.useState("");
|
|
196
|
+
const invalid = country.trim().length === 0;
|
|
197
|
+
return (
|
|
198
|
+
<form
|
|
199
|
+
className="flex w-[26rem] flex-col gap-6"
|
|
200
|
+
onSubmit={(e) => e.preventDefault()}
|
|
201
|
+
>
|
|
202
|
+
<Fieldset>
|
|
203
|
+
<FieldsetLegend>Billing address</FieldsetLegend>
|
|
204
|
+
<FieldsetHelper>Where Jordan Reeves’ invoices are sent.</FieldsetHelper>
|
|
205
|
+
<div className="mt-1 flex flex-col gap-3">
|
|
206
|
+
<div className="flex flex-col gap-1.5">
|
|
207
|
+
<Label htmlFor="ra-line1">Street address</Label>
|
|
208
|
+
<Input
|
|
209
|
+
id="ra-line1"
|
|
210
|
+
defaultValue="1401 South Congress Ave, Suite 200"
|
|
211
|
+
autoComplete="address-line1"
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
<div className="grid grid-cols-2 gap-3">
|
|
215
|
+
<div className="flex flex-col gap-1.5">
|
|
216
|
+
<Label htmlFor="ra-city">City</Label>
|
|
217
|
+
<Input id="ra-city" defaultValue="Austin" autoComplete="address-level2" />
|
|
218
|
+
</div>
|
|
219
|
+
<div className="flex flex-col gap-1.5">
|
|
220
|
+
<Label htmlFor="ra-postal">Postal code</Label>
|
|
221
|
+
<Input id="ra-postal" defaultValue="78704" autoComplete="postal-code" />
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
</Fieldset>
|
|
226
|
+
|
|
227
|
+
<Fieldset invalid={invalid}>
|
|
228
|
+
<FieldsetLegend>Country</FieldsetLegend>
|
|
229
|
+
<FieldsetHelper>Determines tax and currency.</FieldsetHelper>
|
|
230
|
+
<RadioGroup value={country} onValueChange={setCountry} className="gap-3">
|
|
231
|
+
<div className="flex items-center gap-2.5">
|
|
232
|
+
<RadioGroupItem value="us" id="ra-us" />
|
|
233
|
+
<Label htmlFor="ra-us" className="font-normal">
|
|
234
|
+
United States
|
|
235
|
+
</Label>
|
|
236
|
+
</div>
|
|
237
|
+
<div className="flex items-center gap-2.5">
|
|
238
|
+
<RadioGroupItem value="se" id="ra-se" />
|
|
239
|
+
<Label htmlFor="ra-se" className="font-normal">
|
|
240
|
+
Sweden
|
|
241
|
+
</Label>
|
|
242
|
+
</div>
|
|
243
|
+
</RadioGroup>
|
|
244
|
+
<FieldsetError>Select a country to continue.</FieldsetError>
|
|
245
|
+
</Fieldset>
|
|
246
|
+
</form>
|
|
247
|
+
);
|
|
248
|
+
},
|
|
249
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
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 { Search, Link2, Check, Copy } from "lucide-react";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof InputGroup> = {
|
|
13
|
+
title: "Components/InputGroup",
|
|
14
|
+
component: InputGroup,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered",
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component:
|
|
20
|
+
"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.",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof InputGroup>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<InputGroup className="w-80">
|
|
31
|
+
<InputGroupAddon align="inline-start">
|
|
32
|
+
<Search aria-hidden />
|
|
33
|
+
</InputGroupAddon>
|
|
34
|
+
<InputGroupInput placeholder="Search sessions" aria-label="Search" />
|
|
35
|
+
</InputGroup>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Size_Sm: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<InputGroup size="sm" className="w-80">
|
|
42
|
+
<InputGroupAddon align="inline-start">
|
|
43
|
+
<InputGroupText>$</InputGroupText>
|
|
44
|
+
</InputGroupAddon>
|
|
45
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
46
|
+
<InputGroupAddon align="inline-end">
|
|
47
|
+
<InputGroupText>USD</InputGroupText>
|
|
48
|
+
</InputGroupAddon>
|
|
49
|
+
</InputGroup>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Size_Default: Story = {
|
|
54
|
+
render: () => (
|
|
55
|
+
<InputGroup size="default" className="w-80">
|
|
56
|
+
<InputGroupAddon align="inline-start">
|
|
57
|
+
<InputGroupText>$</InputGroupText>
|
|
58
|
+
</InputGroupAddon>
|
|
59
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
60
|
+
<InputGroupAddon align="inline-end">
|
|
61
|
+
<InputGroupText>USD</InputGroupText>
|
|
62
|
+
</InputGroupAddon>
|
|
63
|
+
</InputGroup>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Size_Lg: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<InputGroup size="lg" className="w-80">
|
|
70
|
+
<InputGroupAddon align="inline-start">
|
|
71
|
+
<InputGroupText>$</InputGroupText>
|
|
72
|
+
</InputGroupAddon>
|
|
73
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
74
|
+
<InputGroupAddon align="inline-end">
|
|
75
|
+
<InputGroupText>USD</InputGroupText>
|
|
76
|
+
</InputGroupAddon>
|
|
77
|
+
</InputGroup>
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Size_Xl: Story = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<InputGroup size="xl" className="w-80">
|
|
84
|
+
<InputGroupAddon align="inline-start">
|
|
85
|
+
<InputGroupText>$</InputGroupText>
|
|
86
|
+
</InputGroupAddon>
|
|
87
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
88
|
+
<InputGroupAddon align="inline-end">
|
|
89
|
+
<InputGroupText>USD</InputGroupText>
|
|
90
|
+
</InputGroupAddon>
|
|
91
|
+
</InputGroup>
|
|
92
|
+
),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Size_2xl: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<InputGroup size="2xl" className="w-80">
|
|
98
|
+
<InputGroupAddon align="inline-start">
|
|
99
|
+
<InputGroupText>$</InputGroupText>
|
|
100
|
+
</InputGroupAddon>
|
|
101
|
+
<InputGroupInput placeholder="0.00" inputMode="decimal" aria-label="Amount" />
|
|
102
|
+
<InputGroupAddon align="inline-end">
|
|
103
|
+
<InputGroupText>USD</InputGroupText>
|
|
104
|
+
</InputGroupAddon>
|
|
105
|
+
</InputGroup>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const TextPrefix: Story = {
|
|
110
|
+
name: "Text prefix (protocol)",
|
|
111
|
+
render: () => (
|
|
112
|
+
<InputGroup className="w-96">
|
|
113
|
+
<InputGroupAddon align="inline-start">
|
|
114
|
+
<Link2 aria-hidden />
|
|
115
|
+
<InputGroupText>https://</InputGroupText>
|
|
116
|
+
</InputGroupAddon>
|
|
117
|
+
<InputGroupInput placeholder="ramanathan.co/mei-lin" aria-label="Website URL" />
|
|
118
|
+
</InputGroup>
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const WithButton: Story = {
|
|
123
|
+
render: () => {
|
|
124
|
+
const [copied, setCopied] = React.useState(false);
|
|
125
|
+
const value = "avery.castillo@protonmail.com";
|
|
126
|
+
return (
|
|
127
|
+
<InputGroup className="w-96">
|
|
128
|
+
<InputGroupInput
|
|
129
|
+
readOnly
|
|
130
|
+
value={value}
|
|
131
|
+
aria-label="Invite link email"
|
|
132
|
+
/>
|
|
133
|
+
<InputGroupButton
|
|
134
|
+
aria-label={copied ? "Copied" : "Copy email"}
|
|
135
|
+
onClick={() => {
|
|
136
|
+
setCopied(true);
|
|
137
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{copied ? (
|
|
141
|
+
<>
|
|
142
|
+
<Check aria-hidden /> Copied
|
|
143
|
+
</>
|
|
144
|
+
) : (
|
|
145
|
+
<>
|
|
146
|
+
<Copy aria-hidden /> Copy
|
|
147
|
+
</>
|
|
148
|
+
)}
|
|
149
|
+
</InputGroupButton>
|
|
150
|
+
</InputGroup>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const Disabled: Story = {
|
|
156
|
+
render: () => (
|
|
157
|
+
<InputGroup className="w-80">
|
|
158
|
+
<InputGroupAddon align="inline-start">
|
|
159
|
+
<Search aria-hidden />
|
|
160
|
+
</InputGroupAddon>
|
|
161
|
+
<InputGroupInput placeholder="Search sessions" aria-label="Search" disabled />
|
|
162
|
+
</InputGroup>
|
|
163
|
+
),
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const Invalid: Story = {
|
|
167
|
+
render: () => (
|
|
168
|
+
<InputGroup className="w-80" aria-invalid>
|
|
169
|
+
<InputGroupAddon align="inline-start">
|
|
170
|
+
<InputGroupText>$</InputGroupText>
|
|
171
|
+
</InputGroupAddon>
|
|
172
|
+
<InputGroupInput
|
|
173
|
+
defaultValue="-12.00"
|
|
174
|
+
aria-label="Amount"
|
|
175
|
+
aria-invalid
|
|
176
|
+
inputMode="decimal"
|
|
177
|
+
/>
|
|
178
|
+
</InputGroup>
|
|
179
|
+
),
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const RealisticUse: Story = {
|
|
183
|
+
render: () => (
|
|
184
|
+
<div className="flex w-96 flex-col gap-4">
|
|
185
|
+
<div className="flex flex-col gap-1.5">
|
|
186
|
+
<label htmlFor="ig-search" className="text-sm font-medium">
|
|
187
|
+
Find a member
|
|
188
|
+
</label>
|
|
189
|
+
<InputGroup>
|
|
190
|
+
<InputGroupAddon align="inline-start">
|
|
191
|
+
<Search aria-hidden />
|
|
192
|
+
</InputGroupAddon>
|
|
193
|
+
<InputGroupInput
|
|
194
|
+
id="ig-search"
|
|
195
|
+
placeholder="Priya Ramanathan"
|
|
196
|
+
defaultValue="Mei-Lin Chen"
|
|
197
|
+
/>
|
|
198
|
+
</InputGroup>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div className="flex flex-col gap-1.5">
|
|
202
|
+
<label htmlFor="ig-amount" className="text-sm font-medium">
|
|
203
|
+
Monthly dues
|
|
204
|
+
</label>
|
|
205
|
+
<InputGroup>
|
|
206
|
+
<InputGroupAddon align="inline-start">
|
|
207
|
+
<InputGroupText>$</InputGroupText>
|
|
208
|
+
</InputGroupAddon>
|
|
209
|
+
<InputGroupInput id="ig-amount" defaultValue="49.00" inputMode="decimal" />
|
|
210
|
+
<InputGroupAddon align="inline-end">
|
|
211
|
+
<InputGroupText>/ mo</InputGroupText>
|
|
212
|
+
</InputGroupAddon>
|
|
213
|
+
</InputGroup>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div className="flex flex-col gap-1.5">
|
|
217
|
+
<label htmlFor="ig-handle" className="text-sm font-medium">
|
|
218
|
+
Booking page
|
|
219
|
+
</label>
|
|
220
|
+
<InputGroup>
|
|
221
|
+
<InputGroupAddon align="inline-start">
|
|
222
|
+
<InputGroupText>book.co/</InputGroupText>
|
|
223
|
+
</InputGroupAddon>
|
|
224
|
+
<InputGroupInput id="ig-handle" defaultValue="priya_r2026" />
|
|
225
|
+
</InputGroup>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
),
|
|
229
|
+
};
|
|
@@ -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
|
};
|
|
@@ -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
|
+
};
|
package/src/styles.css
CHANGED
|
@@ -95,18 +95,6 @@
|
|
|
95
95
|
--sidebar-accent-foreground: oklch(0.2050 0 0);
|
|
96
96
|
--sidebar-border: oklch(0.6100 0 0);
|
|
97
97
|
--sidebar-ring: oklch(0.4500 0 0);
|
|
98
|
-
--semantic-text-primary: var(--foreground);
|
|
99
|
-
--semantic-text-secondary: var(--muted-foreground);
|
|
100
|
-
--semantic-text-on-primary: var(--primary-foreground);
|
|
101
|
-
--semantic-surface-page: var(--background);
|
|
102
|
-
--semantic-surface-card: var(--card);
|
|
103
|
-
--semantic-surface-overlay: oklch(0.145 0 0 / 0.8);
|
|
104
|
-
--semantic-border-default: var(--border);
|
|
105
|
-
--semantic-border-input: var(--input);
|
|
106
|
-
--semantic-border-focus: var(--ring);
|
|
107
|
-
--semantic-action-primary: var(--primary);
|
|
108
|
-
--semantic-action-primary-hover: oklch(from var(--primary) calc(l + 0.1) c h);
|
|
109
|
-
--semantic-action-destructive: var(--destructive);
|
|
110
98
|
|
|
111
99
|
--radius: 0.625rem;
|
|
112
100
|
--shadow-opacity: 0.10;
|
package/src/tokens.json
CHANGED
|
@@ -807,6 +807,50 @@
|
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
809
|
},
|
|
810
|
+
"composites": {
|
|
811
|
+
"$description": "Hypertoken-style named bundles — multi-property style fragments that agents and forks reference as a unit instead of reconstructing from primitives. Concept: Jake Albaugh (Figma, Config 2026); see docs/roadmap.md → Layer 3/4 composites for the full activation plan. This group is a DOCUMENTATION LAYER — values here are not read by build-tokens.cjs and do not emit CSS. They exist so: (1) agents calling the MCP get_token / list_tokens tools see the canonical bundle before guessing; (2) forks have a single place to look up what tokens compose a card surface, an elevated popover, or a modal overlay. When a composite is fully specified and tooling support matures, this layer will drive generation. For now, treat each entry as the authoritative spec for hand-authoring — use the cssVars and tailwind fields as the generated equivalents.",
|
|
812
|
+
"textStyle": {
|
|
813
|
+
"$description": "Text style bundles. The canonical source is the `typography` group above — this entry is a cross-reference for agents that search for 'textStyle' or 'heading style'. Use `get_token` with path `typography.heading-xl` etc. Typography bundles: heading-xl, heading-lg, heading-md, heading-sm, body, body-sm, caption, code.",
|
|
814
|
+
"$ref": "typography"
|
|
815
|
+
},
|
|
816
|
+
"surface": {
|
|
817
|
+
"$description": "Named surface bundles — background + border + radius + shadow combined. Use these specs when building custom compositions that don't use a BADS primitive. Prefer the BADS component (Card, Popover, Sheet, Dialog) over hand-rolling; these bundles exist for compositions that genuinely can't use the primitive.",
|
|
818
|
+
"card": {
|
|
819
|
+
"$type": "composite",
|
|
820
|
+
"$description": "Standard card surface. The go-to raised container for content sections, stat tiles, and form groups. Prefer <Card> primitive over hand-rolling.",
|
|
821
|
+
"background": { "$value": "{theme.light.card}", "$type": "color", "$description": "CSS: var(--card). Switches automatically in dark mode." },
|
|
822
|
+
"border": { "$value": "{theme.light.border}", "$type": "color", "$description": "CSS: 1px solid var(--border)." },
|
|
823
|
+
"borderRadius": { "$value": "{borderRadius.lg}", "$type": "dimension", "$description": "CSS: var(--radius-lg). 8px default." },
|
|
824
|
+
"shadow": { "$value": "{shadow.sm}", "$type": "shadow", "$description": "CSS: var(--shadow-sm)." },
|
|
825
|
+
"tailwind": { "$value": "bg-card border border-border rounded-lg shadow-sm", "$type": "string", "$description": "The Tailwind class string equivalent. The lint will flag this combination on a raw div — use <Card> instead." }
|
|
826
|
+
},
|
|
827
|
+
"popover": {
|
|
828
|
+
"$type": "composite",
|
|
829
|
+
"$description": "Elevated floating surface — used by Popover, DropdownMenu, Tooltip, Select content. Renders in a Radix portal; use PortalThemeProvider if your fork uses scoped CSS vars.",
|
|
830
|
+
"background": { "$value": "{theme.light.popover}", "$type": "color", "$description": "CSS: var(--popover)." },
|
|
831
|
+
"border": { "$value": "{theme.light.border}", "$type": "color", "$description": "CSS: 1px solid var(--border)." },
|
|
832
|
+
"borderRadius": { "$value": "{borderRadius.lg}", "$type": "dimension", "$description": "CSS: var(--radius-lg)." },
|
|
833
|
+
"shadow": { "$value": "{shadow.md}", "$type": "shadow", "$description": "CSS: var(--shadow-md). One step above card — signals elevation." },
|
|
834
|
+
"tailwind": { "$value": "bg-popover border border-border rounded-lg shadow-md", "$type": "string" }
|
|
835
|
+
},
|
|
836
|
+
"sheet": {
|
|
837
|
+
"$type": "composite",
|
|
838
|
+
"$description": "Side-anchored overlay panel (drawer). Full-height, no drop shadow — the overlay scrim provides separation. The border is on the inward edge only (border-r for left sheet, border-l for right sheet).",
|
|
839
|
+
"background": { "$value": "{theme.light.card}", "$type": "color", "$description": "CSS: var(--card). Sheets share the card surface." },
|
|
840
|
+
"borderRadius": { "$value": "{borderRadius.none}", "$type": "dimension", "$description": "Sheets are flush — no radius on the viewport edge." },
|
|
841
|
+
"tailwind": { "$value": "bg-card border-r", "$type": "string", "$description": "Adjust border direction (border-l / border-r / border-t / border-b) per anchor side." }
|
|
842
|
+
},
|
|
843
|
+
"modal": {
|
|
844
|
+
"$type": "composite",
|
|
845
|
+
"$description": "Centered blocking overlay (Dialog). The 2xl shadow is intentionally stronger than card/popover — it separates the modal from the scrim behind it.",
|
|
846
|
+
"background": { "$value": "{theme.light.card}", "$type": "color", "$description": "CSS: var(--card)." },
|
|
847
|
+
"border": { "$value": "{theme.light.border}", "$type": "color", "$description": "CSS: 1px solid var(--border)." },
|
|
848
|
+
"borderRadius": { "$value": "{borderRadius.lg}", "$type": "dimension", "$description": "CSS: var(--radius-lg)." },
|
|
849
|
+
"shadow": { "$value": "{shadow.2xl}", "$type": "shadow", "$description": "CSS: var(--shadow-2xl). Deepest elevation tier." },
|
|
850
|
+
"tailwind": { "$value": "bg-card border border-border rounded-lg shadow-2xl", "$type": "string" }
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
},
|
|
810
854
|
"theme": {
|
|
811
855
|
"$description": "Theme tokens — values feed directly into the published styles.css and the preview app's globals.css. The build script (scripts/build-tokens.js) regenerates both files from these values. Edit here, then run `pnpm build:tokens`.",
|
|
812
856
|
"light": {
|
|
@@ -976,54 +1020,6 @@
|
|
|
976
1020
|
"$value": "oklch(0.4500 0 0)",
|
|
977
1021
|
"$type": "color",
|
|
978
1022
|
"$description": "AAA non-text 3:1 on sidebar."
|
|
979
|
-
},
|
|
980
|
-
"semantic-text-primary": {
|
|
981
|
-
"$value": "var(--foreground)",
|
|
982
|
-
"$type": "color"
|
|
983
|
-
},
|
|
984
|
-
"semantic-text-secondary": {
|
|
985
|
-
"$value": "var(--muted-foreground)",
|
|
986
|
-
"$type": "color"
|
|
987
|
-
},
|
|
988
|
-
"semantic-text-on-primary": {
|
|
989
|
-
"$value": "var(--primary-foreground)",
|
|
990
|
-
"$type": "color"
|
|
991
|
-
},
|
|
992
|
-
"semantic-surface-page": {
|
|
993
|
-
"$value": "var(--background)",
|
|
994
|
-
"$type": "color"
|
|
995
|
-
},
|
|
996
|
-
"semantic-surface-card": {
|
|
997
|
-
"$value": "var(--card)",
|
|
998
|
-
"$type": "color"
|
|
999
|
-
},
|
|
1000
|
-
"semantic-surface-overlay": {
|
|
1001
|
-
"$value": "oklch(0.145 0 0 / 0.8)",
|
|
1002
|
-
"$type": "color"
|
|
1003
|
-
},
|
|
1004
|
-
"semantic-border-default": {
|
|
1005
|
-
"$value": "var(--border)",
|
|
1006
|
-
"$type": "color"
|
|
1007
|
-
},
|
|
1008
|
-
"semantic-border-input": {
|
|
1009
|
-
"$value": "var(--input)",
|
|
1010
|
-
"$type": "color"
|
|
1011
|
-
},
|
|
1012
|
-
"semantic-border-focus": {
|
|
1013
|
-
"$value": "var(--ring)",
|
|
1014
|
-
"$type": "color"
|
|
1015
|
-
},
|
|
1016
|
-
"semantic-action-primary": {
|
|
1017
|
-
"$value": "var(--primary)",
|
|
1018
|
-
"$type": "color"
|
|
1019
|
-
},
|
|
1020
|
-
"semantic-action-primary-hover": {
|
|
1021
|
-
"$value": "oklch(from var(--primary) calc(l + 0.1) c h)",
|
|
1022
|
-
"$type": "color"
|
|
1023
|
-
},
|
|
1024
|
-
"semantic-action-destructive": {
|
|
1025
|
-
"$value": "var(--destructive)",
|
|
1026
|
-
"$type": "color"
|
|
1027
1023
|
}
|
|
1028
1024
|
},
|
|
1029
1025
|
"dark": {
|
|
@@ -1238,4 +1234,4 @@
|
|
|
1238
1234
|
"$description": "Chroma multiplier on series 2 only (others inherit primary chroma)."
|
|
1239
1235
|
}
|
|
1240
1236
|
}
|
|
1241
|
-
}
|
|
1237
|
+
}
|