@behavioral-agentic-design-system/core 0.23.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 +4 -3
- package/src/app/preview/components/page.tsx +286 -5
- package/src/components/ui/copy-button.tsx +2 -2
- package/src/components/ui/data-list.tsx +169 -0
- package/src/components/ui/fieldset.tsx +8 -2
- package/src/components/ui/index.ts +2 -0
- package/src/components/ui/input-group.tsx +11 -1
- package/src/components/ui/qr-code.tsx +107 -0
- package/src/data/docs-index.ts +1 -0
- package/src/stories/CopyButton.stories.tsx +1 -1
- package/src/stories/DataList.stories.tsx +160 -0
- package/src/stories/Fieldset.stories.tsx +4 -0
- package/src/stories/InputGroup.stories.tsx +39 -41
- package/src/stories/QrCode.stories.tsx +146 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -112,7 +112,8 @@
|
|
|
112
112
|
"clsx": "^2.1.0",
|
|
113
113
|
"react-markdown": "^10.1.0",
|
|
114
114
|
"remark-gfm": "^4.0.1",
|
|
115
|
-
"tailwind-merge": "^3.0.0"
|
|
115
|
+
"tailwind-merge": "^3.0.0",
|
|
116
|
+
"uqr": "^0.1.3"
|
|
116
117
|
},
|
|
117
118
|
"peerDependencies": {
|
|
118
119
|
"@radix-ui/react-accordion": "*",
|
|
@@ -122,11 +123,11 @@
|
|
|
122
123
|
"@radix-ui/react-collapsible": "*",
|
|
123
124
|
"@radix-ui/react-context-menu": "*",
|
|
124
125
|
"@radix-ui/react-dialog": "*",
|
|
125
|
-
"@radix-ui/react-navigation-menu": "*",
|
|
126
126
|
"@radix-ui/react-dropdown-menu": "*",
|
|
127
127
|
"@radix-ui/react-hover-card": "*",
|
|
128
128
|
"@radix-ui/react-label": "*",
|
|
129
129
|
"@radix-ui/react-menubar": "*",
|
|
130
|
+
"@radix-ui/react-navigation-menu": "*",
|
|
130
131
|
"@radix-ui/react-popover": "*",
|
|
131
132
|
"@radix-ui/react-progress": "*",
|
|
132
133
|
"@radix-ui/react-radio-group": "*",
|
|
@@ -32,6 +32,12 @@ import {
|
|
|
32
32
|
FieldsetHelper,
|
|
33
33
|
FieldsetError,
|
|
34
34
|
} from "@behavioral-agentic-design-system/core/components/ui/fieldset";
|
|
35
|
+
import {
|
|
36
|
+
DataList,
|
|
37
|
+
DataListItem,
|
|
38
|
+
DataListLabel,
|
|
39
|
+
DataListValue,
|
|
40
|
+
} from "@behavioral-agentic-design-system/core/components/ui/data-list";
|
|
35
41
|
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
36
42
|
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
37
43
|
import { Switch } from "@behavioral-agentic-design-system/core/components/ui/switch";
|
|
@@ -268,7 +274,7 @@ import {
|
|
|
268
274
|
SheetTitle,
|
|
269
275
|
SheetTrigger,
|
|
270
276
|
} from "@behavioral-agentic-design-system/core/components/ui/sheet";
|
|
271
|
-
import { TrendingUp, MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search
|
|
277
|
+
import { TrendingUp, MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search } from "lucide-react";
|
|
272
278
|
import {
|
|
273
279
|
Tree,
|
|
274
280
|
TreeItem,
|
|
@@ -284,6 +290,7 @@ import {
|
|
|
284
290
|
EditablePreview,
|
|
285
291
|
EditableSubmit,
|
|
286
292
|
} from "@behavioral-agentic-design-system/core/components/ui/editable";
|
|
293
|
+
import { QRCode } from "@behavioral-agentic-design-system/core/components/ui/qr-code";
|
|
287
294
|
|
|
288
295
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
289
296
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -3069,7 +3076,8 @@ export default function ComponentsPreview() {
|
|
|
3069
3076
|
<InputGroupAddon align="inline-start">
|
|
3070
3077
|
<InputGroupText>https://</InputGroupText>
|
|
3071
3078
|
</InputGroupAddon>
|
|
3072
|
-
|
|
3079
|
+
{/* placeholder, not value — clicking in and typing replaces it */}
|
|
3080
|
+
<InputGroupInput placeholder="design.bads.com" aria-label="Website" />
|
|
3073
3081
|
</InputGroup>
|
|
3074
3082
|
</div>
|
|
3075
3083
|
<div className="space-y-1.5">
|
|
@@ -3080,9 +3088,16 @@ export default function ComponentsPreview() {
|
|
|
3080
3088
|
value="avery.castillo@protonmail.com"
|
|
3081
3089
|
aria-label="Invite email"
|
|
3082
3090
|
/>
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3091
|
+
{/* CopyButton brings the icon-swap + "Copied!" success state
|
|
3092
|
+
and the aria-live announcement — never a dead Copy button */}
|
|
3093
|
+
<CopyButton
|
|
3094
|
+
value="avery.castillo@protonmail.com"
|
|
3095
|
+
variant="ghost"
|
|
3096
|
+
size="sm"
|
|
3097
|
+
className="h-full shrink-0 rounded-none"
|
|
3098
|
+
>
|
|
3099
|
+
Copy
|
|
3100
|
+
</CopyButton>
|
|
3086
3101
|
</InputGroup>
|
|
3087
3102
|
</div>
|
|
3088
3103
|
</div>
|
|
@@ -3142,6 +3157,272 @@ export default function ComponentsPreview() {
|
|
|
3142
3157
|
</Fieldset>
|
|
3143
3158
|
</div>
|
|
3144
3159
|
</Section>
|
|
3160
|
+
|
|
3161
|
+
<Section title="DataList">
|
|
3162
|
+
<div className="space-y-8">
|
|
3163
|
+
<div>
|
|
3164
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3165
|
+
Default (vertical)
|
|
3166
|
+
</p>
|
|
3167
|
+
<DataList className="w-80">
|
|
3168
|
+
<DataListItem>
|
|
3169
|
+
<DataListLabel>Name</DataListLabel>
|
|
3170
|
+
<DataListValue>Jordan Reeves</DataListValue>
|
|
3171
|
+
</DataListItem>
|
|
3172
|
+
<DataListItem>
|
|
3173
|
+
<DataListLabel>Role</DataListLabel>
|
|
3174
|
+
<DataListValue>Design Systems Lead</DataListValue>
|
|
3175
|
+
</DataListItem>
|
|
3176
|
+
<DataListItem>
|
|
3177
|
+
<DataListLabel>Email</DataListLabel>
|
|
3178
|
+
<DataListValue>jordan@reeves.design</DataListValue>
|
|
3179
|
+
</DataListItem>
|
|
3180
|
+
<DataListItem>
|
|
3181
|
+
<DataListLabel>Member since</DataListLabel>
|
|
3182
|
+
<DataListValue>Jan 15, 2026</DataListValue>
|
|
3183
|
+
</DataListItem>
|
|
3184
|
+
</DataList>
|
|
3185
|
+
</div>
|
|
3186
|
+
|
|
3187
|
+
<div>
|
|
3188
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3189
|
+
Orientation: horizontal — label column aligned across rows
|
|
3190
|
+
</p>
|
|
3191
|
+
<DataList orientation="horizontal" className="w-96">
|
|
3192
|
+
<DataListItem>
|
|
3193
|
+
<DataListLabel>Invoice</DataListLabel>
|
|
3194
|
+
<DataListValue>INV-2026-0187</DataListValue>
|
|
3195
|
+
</DataListItem>
|
|
3196
|
+
<DataListItem>
|
|
3197
|
+
<DataListLabel>Billed to</DataListLabel>
|
|
3198
|
+
<DataListValue>Anika Patel</DataListValue>
|
|
3199
|
+
</DataListItem>
|
|
3200
|
+
<DataListItem>
|
|
3201
|
+
<DataListLabel>Billing email</DataListLabel>
|
|
3202
|
+
<DataListValue>anika.patel@stripe.com</DataListValue>
|
|
3203
|
+
</DataListItem>
|
|
3204
|
+
<DataListItem>
|
|
3205
|
+
<DataListLabel>Amount</DataListLabel>
|
|
3206
|
+
<DataListValue>$249.00</DataListValue>
|
|
3207
|
+
</DataListItem>
|
|
3208
|
+
<DataListItem>
|
|
3209
|
+
<DataListLabel>Status</DataListLabel>
|
|
3210
|
+
<DataListValue>
|
|
3211
|
+
<Badge variant="secondary">Paid</Badge>
|
|
3212
|
+
</DataListValue>
|
|
3213
|
+
</DataListItem>
|
|
3214
|
+
</DataList>
|
|
3215
|
+
</div>
|
|
3216
|
+
|
|
3217
|
+
<div className="flex flex-wrap items-start gap-8">
|
|
3218
|
+
<div className="space-y-1.5">
|
|
3219
|
+
<p className="text-xs font-medium text-muted-foreground">Size sm</p>
|
|
3220
|
+
<DataList size="sm" orientation="horizontal" className="w-72">
|
|
3221
|
+
<DataListItem>
|
|
3222
|
+
<DataListLabel>Owner</DataListLabel>
|
|
3223
|
+
<DataListValue>Marcus Lindqvist</DataListValue>
|
|
3224
|
+
</DataListItem>
|
|
3225
|
+
<DataListItem>
|
|
3226
|
+
<DataListLabel>Plan</DataListLabel>
|
|
3227
|
+
<DataListValue>Team · $249.00/yr</DataListValue>
|
|
3228
|
+
</DataListItem>
|
|
3229
|
+
</DataList>
|
|
3230
|
+
</div>
|
|
3231
|
+
<div className="space-y-1.5">
|
|
3232
|
+
<p className="text-xs font-medium text-muted-foreground">Size default</p>
|
|
3233
|
+
<DataList size="default" orientation="horizontal" className="w-72">
|
|
3234
|
+
<DataListItem>
|
|
3235
|
+
<DataListLabel>Owner</DataListLabel>
|
|
3236
|
+
<DataListValue>Marcus Lindqvist</DataListValue>
|
|
3237
|
+
</DataListItem>
|
|
3238
|
+
<DataListItem>
|
|
3239
|
+
<DataListLabel>Plan</DataListLabel>
|
|
3240
|
+
<DataListValue>Team · $249.00/yr</DataListValue>
|
|
3241
|
+
</DataListItem>
|
|
3242
|
+
</DataList>
|
|
3243
|
+
</div>
|
|
3244
|
+
<div className="space-y-1.5">
|
|
3245
|
+
<p className="text-xs font-medium text-muted-foreground">Size lg</p>
|
|
3246
|
+
<DataList size="lg" orientation="horizontal" className="w-80">
|
|
3247
|
+
<DataListItem>
|
|
3248
|
+
<DataListLabel>Owner</DataListLabel>
|
|
3249
|
+
<DataListValue>Marcus Lindqvist</DataListValue>
|
|
3250
|
+
</DataListItem>
|
|
3251
|
+
<DataListItem>
|
|
3252
|
+
<DataListLabel>Plan</DataListLabel>
|
|
3253
|
+
<DataListValue>Team · $249.00/yr</DataListValue>
|
|
3254
|
+
</DataListItem>
|
|
3255
|
+
</DataList>
|
|
3256
|
+
</div>
|
|
3257
|
+
</div>
|
|
3258
|
+
|
|
3259
|
+
<div>
|
|
3260
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3261
|
+
Realistic use — invoice detail card (long values wrap, never bleed)
|
|
3262
|
+
</p>
|
|
3263
|
+
<Card className="w-[26rem]">
|
|
3264
|
+
<CardHeader>
|
|
3265
|
+
<CardTitle className="text-sm">Invoice INV-2026-0187</CardTitle>
|
|
3266
|
+
<CardDescription>
|
|
3267
|
+
Design system license · annual renewal
|
|
3268
|
+
</CardDescription>
|
|
3269
|
+
</CardHeader>
|
|
3270
|
+
<CardContent className="space-y-4">
|
|
3271
|
+
<DataList orientation="horizontal">
|
|
3272
|
+
<DataListItem>
|
|
3273
|
+
<DataListLabel>Billed to</DataListLabel>
|
|
3274
|
+
<DataListValue>Wilhelmina-Constance Featherstonehaugh-Vance</DataListValue>
|
|
3275
|
+
</DataListItem>
|
|
3276
|
+
<DataListItem>
|
|
3277
|
+
<DataListLabel>Email</DataListLabel>
|
|
3278
|
+
<DataListValue>
|
|
3279
|
+
wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org
|
|
3280
|
+
</DataListValue>
|
|
3281
|
+
</DataListItem>
|
|
3282
|
+
<DataListItem>
|
|
3283
|
+
<DataListLabel>Address</DataListLabel>
|
|
3284
|
+
<DataListValue>
|
|
3285
|
+
1401 South Congress Ave, Suite 200, Austin, TX 78704
|
|
3286
|
+
</DataListValue>
|
|
3287
|
+
</DataListItem>
|
|
3288
|
+
<DataListItem>
|
|
3289
|
+
<DataListLabel>Issued</DataListLabel>
|
|
3290
|
+
<DataListValue>May 26, 2026</DataListValue>
|
|
3291
|
+
</DataListItem>
|
|
3292
|
+
<DataListItem>
|
|
3293
|
+
<DataListLabel>Amount due</DataListLabel>
|
|
3294
|
+
<DataListValue className="font-semibold">
|
|
3295
|
+
$12,500.00
|
|
3296
|
+
</DataListValue>
|
|
3297
|
+
</DataListItem>
|
|
3298
|
+
</DataList>
|
|
3299
|
+
<Separator />
|
|
3300
|
+
<DataList size="sm">
|
|
3301
|
+
<DataListItem>
|
|
3302
|
+
<DataListLabel>Includes</DataListLabel>
|
|
3303
|
+
<DataListValue>
|
|
3304
|
+
36 components, all passing AAA contrast
|
|
3305
|
+
</DataListValue>
|
|
3306
|
+
</DataListItem>
|
|
3307
|
+
<DataListItem>
|
|
3308
|
+
<DataListLabel>Support contact</DataListLabel>
|
|
3309
|
+
<DataListValue>seoyun.park@figma.com</DataListValue>
|
|
3310
|
+
</DataListItem>
|
|
3311
|
+
</DataList>
|
|
3312
|
+
</CardContent>
|
|
3313
|
+
</Card>
|
|
3314
|
+
</div>
|
|
3315
|
+
</div>
|
|
3316
|
+
</Section>
|
|
3317
|
+
|
|
3318
|
+
<Section title="QR Code">
|
|
3319
|
+
<div className="space-y-8">
|
|
3320
|
+
<div>
|
|
3321
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3322
|
+
Default — 160px, error correction M. Modules inherit
|
|
3323
|
+
text-foreground, quiet zone is bg-background (dark mode renders
|
|
3324
|
+
an inverted code — still ~21:1, scannable).
|
|
3325
|
+
</p>
|
|
3326
|
+
<QRCode
|
|
3327
|
+
value="https://design.bads.com"
|
|
3328
|
+
title="Scan to open design.bads.com"
|
|
3329
|
+
/>
|
|
3330
|
+
</div>
|
|
3331
|
+
|
|
3332
|
+
<div>
|
|
3333
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3334
|
+
Sizes — 96 / 160 / 240px (don't go below ~96px for
|
|
3335
|
+
at-distance or print scanning)
|
|
3336
|
+
</p>
|
|
3337
|
+
<div className="flex flex-wrap items-end gap-6">
|
|
3338
|
+
<div className="space-y-1.5">
|
|
3339
|
+
<p className="text-xs font-medium text-muted-foreground">96px</p>
|
|
3340
|
+
<QRCode
|
|
3341
|
+
value="https://design.bads.com"
|
|
3342
|
+
size={96}
|
|
3343
|
+
title="Scan to open design.bads.com — 96px"
|
|
3344
|
+
/>
|
|
3345
|
+
</div>
|
|
3346
|
+
<div className="space-y-1.5">
|
|
3347
|
+
<p className="text-xs font-medium text-muted-foreground">160px</p>
|
|
3348
|
+
<QRCode
|
|
3349
|
+
value="https://design.bads.com"
|
|
3350
|
+
size={160}
|
|
3351
|
+
title="Scan to open design.bads.com — 160px"
|
|
3352
|
+
/>
|
|
3353
|
+
</div>
|
|
3354
|
+
<div className="space-y-1.5">
|
|
3355
|
+
<p className="text-xs font-medium text-muted-foreground">240px</p>
|
|
3356
|
+
<QRCode
|
|
3357
|
+
value="https://design.bads.com"
|
|
3358
|
+
size={240}
|
|
3359
|
+
title="Scan to open design.bads.com — 240px"
|
|
3360
|
+
/>
|
|
3361
|
+
</div>
|
|
3362
|
+
</div>
|
|
3363
|
+
</div>
|
|
3364
|
+
|
|
3365
|
+
<div>
|
|
3366
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3367
|
+
Error correction — same value and size; higher levels survive
|
|
3368
|
+
more damage (L 7% → H 30%) at the cost of a denser matrix
|
|
3369
|
+
</p>
|
|
3370
|
+
<div className="flex flex-wrap items-start gap-6">
|
|
3371
|
+
{(["L", "M", "Q", "H"] as const).map((level) => (
|
|
3372
|
+
<div key={level} className="flex flex-col items-center gap-1.5">
|
|
3373
|
+
<QRCode
|
|
3374
|
+
value="https://design.bads.com/docs/getting-started"
|
|
3375
|
+
size={128}
|
|
3376
|
+
errorCorrection={level}
|
|
3377
|
+
title={`Getting-started guide, error correction ${level}`}
|
|
3378
|
+
/>
|
|
3379
|
+
<p className="text-xs font-medium text-muted-foreground">{level}</p>
|
|
3380
|
+
</div>
|
|
3381
|
+
))}
|
|
3382
|
+
</div>
|
|
3383
|
+
</div>
|
|
3384
|
+
|
|
3385
|
+
<div>
|
|
3386
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
3387
|
+
Realistic use — share handoff card. The visible link + working
|
|
3388
|
+
copy button keep a non-scan path to the same destination.
|
|
3389
|
+
</p>
|
|
3390
|
+
<Card className="w-[22rem]">
|
|
3391
|
+
<CardHeader>
|
|
3392
|
+
<CardTitle className="text-sm">Tokens v2 proposal</CardTitle>
|
|
3393
|
+
<CardDescription>
|
|
3394
|
+
Shared by Jordan Reeves · Design Systems Lead
|
|
3395
|
+
</CardDescription>
|
|
3396
|
+
</CardHeader>
|
|
3397
|
+
<CardContent className="space-y-4">
|
|
3398
|
+
<div className="flex justify-center rounded-md border bg-background p-4">
|
|
3399
|
+
<QRCode
|
|
3400
|
+
value="https://design.bads.com/share/tokens-v2-proposal"
|
|
3401
|
+
size={176}
|
|
3402
|
+
title="Scan to open the tokens v2 proposal"
|
|
3403
|
+
/>
|
|
3404
|
+
</div>
|
|
3405
|
+
<Separator />
|
|
3406
|
+
<div className="flex items-center justify-between gap-3">
|
|
3407
|
+
<p
|
|
3408
|
+
className="min-w-0 truncate text-sm text-muted-foreground"
|
|
3409
|
+
title="https://design.bads.com/share/tokens-v2-proposal"
|
|
3410
|
+
>
|
|
3411
|
+
design.bads.com/share/tokens-v2-proposal
|
|
3412
|
+
</p>
|
|
3413
|
+
<CopyButton
|
|
3414
|
+
value="https://design.bads.com/share/tokens-v2-proposal"
|
|
3415
|
+
size="sm"
|
|
3416
|
+
className="min-h-11 shrink-0"
|
|
3417
|
+
>
|
|
3418
|
+
Copy link
|
|
3419
|
+
</CopyButton>
|
|
3420
|
+
</div>
|
|
3421
|
+
</CardContent>
|
|
3422
|
+
</Card>
|
|
3423
|
+
</div>
|
|
3424
|
+
</div>
|
|
3425
|
+
</Section>
|
|
3145
3426
|
</div>
|
|
3146
3427
|
</div>
|
|
3147
3428
|
);
|
|
@@ -75,7 +75,7 @@ function CopyButton({
|
|
|
75
75
|
{/* In labeled mode this span provides the button's accessible name — not aria-hidden */}
|
|
76
76
|
<span
|
|
77
77
|
className={cn(
|
|
78
|
-
"inline-flex items-center gap-
|
|
78
|
+
"inline-flex items-center gap-1.5 transition-all",
|
|
79
79
|
copied ? "opacity-0 scale-75" : "opacity-100 scale-100"
|
|
80
80
|
)}
|
|
81
81
|
style={{
|
|
@@ -90,7 +90,7 @@ function CopyButton({
|
|
|
90
90
|
{/* Always hidden — state announced by the aria-live region */}
|
|
91
91
|
<span
|
|
92
92
|
className={cn(
|
|
93
|
-
"absolute inset-0 inline-flex items-center justify-center gap-
|
|
93
|
+
"absolute inset-0 inline-flex items-center justify-center gap-1.5 text-[var(--success)] transition-all",
|
|
94
94
|
copied ? "opacity-100 scale-100" : "opacity-0 scale-75"
|
|
95
95
|
)}
|
|
96
96
|
style={{
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Semantic key–value list primitive. Renders a native <dl> with <dt>/<dd>
|
|
10
|
+
* pairs, so screen readers announce a description list and associate each
|
|
11
|
+
* term with its description — semantics a div grid or the <ul>-based List
|
|
12
|
+
* primitive cannot produce.
|
|
13
|
+
*
|
|
14
|
+
* Use DataList for read-only detail surfaces: profile panels, invoice and
|
|
15
|
+
* order summaries, settings recaps, metadata blocks, confirmation review
|
|
16
|
+
* steps. It is display-only — no interaction, no focus, no motion. For
|
|
17
|
+
* editable values compose Editable or CopyButton inside DataListValue; for
|
|
18
|
+
* tabular column data use Table.
|
|
19
|
+
*
|
|
20
|
+
* <DataList orientation="horizontal">
|
|
21
|
+
* <DataListItem>
|
|
22
|
+
* <DataListLabel>Billing email</DataListLabel>
|
|
23
|
+
* <DataListValue>jordan@reeves.design</DataListValue>
|
|
24
|
+
* </DataListItem>
|
|
25
|
+
* </DataList>
|
|
26
|
+
*
|
|
27
|
+
* Orientation "vertical" (default) stacks label over value; "horizontal"
|
|
28
|
+
* lays each pair on a grid row with the label column aligned across ALL
|
|
29
|
+
* rows via CSS subgrid (root owns the two-column track, each item spans it
|
|
30
|
+
* with grid-cols-subgrid). Browsers without subgrid degrade to a stacked
|
|
31
|
+
* row — readable, non-breaking.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
type DataListContextValue = {
|
|
35
|
+
orientation: "vertical" | "horizontal";
|
|
36
|
+
size: "sm" | "default" | "lg";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const DataListContext = React.createContext<DataListContextValue>({
|
|
40
|
+
orientation: "vertical",
|
|
41
|
+
size: "default",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function useDataListContext() {
|
|
45
|
+
return React.useContext(DataListContext);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const dataListVariants = cva("min-w-0", {
|
|
49
|
+
variants: {
|
|
50
|
+
orientation: {
|
|
51
|
+
// Stacked pairs; the root is a simple column.
|
|
52
|
+
vertical: "flex flex-col",
|
|
53
|
+
// Root owns the two-column track (label auto-sized, value fills);
|
|
54
|
+
// items span it with subgrid so the label column aligns across rows.
|
|
55
|
+
horizontal: "grid grid-cols-[auto_1fr] gap-x-6",
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
sm: "",
|
|
59
|
+
default: "",
|
|
60
|
+
lg: "",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
compoundVariants: [
|
|
64
|
+
{ orientation: "vertical", size: "sm", className: "gap-3" },
|
|
65
|
+
{ orientation: "vertical", size: "default", className: "gap-4" },
|
|
66
|
+
{ orientation: "vertical", size: "lg", className: "gap-5" },
|
|
67
|
+
{ orientation: "horizontal", size: "sm", className: "gap-y-2" },
|
|
68
|
+
{ orientation: "horizontal", size: "default", className: "gap-y-3" },
|
|
69
|
+
{ orientation: "horizontal", size: "lg", className: "gap-y-4" },
|
|
70
|
+
],
|
|
71
|
+
defaultVariants: { orientation: "vertical", size: "default" },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export interface DataListProps
|
|
75
|
+
extends React.ComponentProps<"dl">,
|
|
76
|
+
VariantProps<typeof dataListVariants> {}
|
|
77
|
+
|
|
78
|
+
function DataList({
|
|
79
|
+
className,
|
|
80
|
+
orientation = "vertical",
|
|
81
|
+
size = "default",
|
|
82
|
+
...props
|
|
83
|
+
}: DataListProps) {
|
|
84
|
+
const ctx = React.useMemo<DataListContextValue>(
|
|
85
|
+
() => ({ orientation: orientation ?? "vertical", size: size ?? "default" }),
|
|
86
|
+
[orientation, size],
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<DataListContext.Provider value={ctx}>
|
|
91
|
+
<dl
|
|
92
|
+
data-slot="data-list"
|
|
93
|
+
data-orientation={ctx.orientation}
|
|
94
|
+
className={cn(dataListVariants({ orientation, size }), className)}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
</DataListContext.Provider>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* One term–description pair. A <div> is spec-valid inside <dl> for grouping
|
|
103
|
+
* a <dt> with its <dd>, and is transparent to the accessibility tree.
|
|
104
|
+
*/
|
|
105
|
+
function DataListItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
106
|
+
const { orientation } = useDataListContext();
|
|
107
|
+
return (
|
|
108
|
+
<div
|
|
109
|
+
data-slot="data-list-item"
|
|
110
|
+
className={cn(
|
|
111
|
+
"min-w-0",
|
|
112
|
+
orientation === "horizontal"
|
|
113
|
+
? // Span the root's two-column track; subgrid keeps every row's
|
|
114
|
+
// label column aligned. No-subgrid browsers fall back to a
|
|
115
|
+
// stacked block row.
|
|
116
|
+
"col-span-2 grid grid-cols-subgrid items-baseline"
|
|
117
|
+
: "flex flex-col gap-1",
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The term (<dt>) — muted, medium weight. */
|
|
126
|
+
function DataListLabel({ className, ...props }: React.ComponentProps<"dt">) {
|
|
127
|
+
const { size } = useDataListContext();
|
|
128
|
+
return (
|
|
129
|
+
<dt
|
|
130
|
+
data-slot="data-list-label"
|
|
131
|
+
className={cn(
|
|
132
|
+
"font-medium text-muted-foreground",
|
|
133
|
+
// BADS scale: text-xs = 14px (AAA floor), text-sm = 16px.
|
|
134
|
+
size === "lg" ? "text-sm" : "text-xs",
|
|
135
|
+
className,
|
|
136
|
+
)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The description (<dd>). Values are arbitrary runtime strings (emails,
|
|
144
|
+
* URLs, IDs), so the long-label overflow contract applies: min-w-0 +
|
|
145
|
+
* overflow-wrap anywhere. m-0 defensively clears the UA stylesheet's
|
|
146
|
+
* <dd> start margin outside preflight contexts.
|
|
147
|
+
*/
|
|
148
|
+
function DataListValue({ className, ...props }: React.ComponentProps<"dd">) {
|
|
149
|
+
const { size } = useDataListContext();
|
|
150
|
+
return (
|
|
151
|
+
<dd
|
|
152
|
+
data-slot="data-list-value"
|
|
153
|
+
className={cn(
|
|
154
|
+
"m-0 min-w-0 text-foreground [overflow-wrap:anywhere]",
|
|
155
|
+
size === "lg" ? "text-base" : "text-sm",
|
|
156
|
+
className,
|
|
157
|
+
)}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
DataList,
|
|
165
|
+
DataListItem,
|
|
166
|
+
DataListLabel,
|
|
167
|
+
DataListValue,
|
|
168
|
+
dataListVariants,
|
|
169
|
+
};
|
|
@@ -165,8 +165,14 @@ function FieldsetLegend({
|
|
|
165
165
|
<legend
|
|
166
166
|
data-slot="fieldset-legend"
|
|
167
167
|
className={cn(
|
|
168
|
-
// float-
|
|
169
|
-
"
|
|
168
|
+
// float-left (not float-none!) is what opts a <legend> OUT of the
|
|
169
|
+
// browser's native "rendered legend" placement — with float:none the
|
|
170
|
+
// legend is drawn straddling the fieldset's top border (HTML rendering
|
|
171
|
+
// spec), which strikes the border line through the title and notches
|
|
172
|
+
// the top edge (shipped broken 2026-07-04, caught by Sir on prod).
|
|
173
|
+
// Inside the flex fieldset the float is then inert and the legend lays
|
|
174
|
+
// out as a normal first flex item; w-full keeps it on its own row.
|
|
175
|
+
"float-left w-full text-sm font-semibold text-foreground",
|
|
170
176
|
"group-data-[disabled]:text-muted-foreground",
|
|
171
177
|
invalid && "text-destructive",
|
|
172
178
|
className,
|
|
@@ -19,6 +19,7 @@ export * from "./collapsible";
|
|
|
19
19
|
export * from "./color-picker";
|
|
20
20
|
export * from "./command";
|
|
21
21
|
export * from "./context-menu";
|
|
22
|
+
export * from "./data-list";
|
|
22
23
|
export * from "./dialog";
|
|
23
24
|
export * from "./dropdown-menu";
|
|
24
25
|
export * from "./fieldset";
|
|
@@ -62,3 +63,4 @@ export * from "./toolbar";
|
|
|
62
63
|
export * from "./tooltip";
|
|
63
64
|
export * from "./tree-view";
|
|
64
65
|
export * from "./editable";
|
|
66
|
+
export * from "./qr-code";
|
|
@@ -19,7 +19,10 @@ const inputGroupVariants = cva(
|
|
|
19
19
|
"rounded-md border border-input bg-transparent shadow-xs",
|
|
20
20
|
"transition-[color,box-shadow]",
|
|
21
21
|
"focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50",
|
|
22
|
-
|
|
22
|
+
// Scope disabled styling to the hosted INPUT — has-[:disabled] matched any
|
|
23
|
+
// descendant, so an inline CopyButton disabling itself during its 2s
|
|
24
|
+
// "Copied!" window faded the whole group to 50% (found 2026-07-06).
|
|
25
|
+
"has-[input:disabled]:pointer-events-none has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50",
|
|
23
26
|
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
24
27
|
],
|
|
25
28
|
{
|
|
@@ -101,6 +104,13 @@ function InputGroupInput({
|
|
|
101
104
|
"placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground",
|
|
102
105
|
"disabled:cursor-not-allowed dark:bg-input/30",
|
|
103
106
|
inputPaddingBySize[size],
|
|
107
|
+
// Collapse the doubled inner edge next to an addon: the addon already
|
|
108
|
+
// carries the group's horizontal rhythm (its outer padding), so the
|
|
109
|
+
// input's full padding on the shared edge reads as a floating gap
|
|
110
|
+
// ("https:// value" — Sir, 2026-07-06). 6px keeps a text prefix
|
|
111
|
+
// reading continuous with the value while an icon addon still breathes.
|
|
112
|
+
"[[data-slot=input-group-addon][data-align=inline-start]+&]:ps-1.5",
|
|
113
|
+
"[&:has(+[data-slot=input-group-addon][data-align=inline-end])]:pe-1.5",
|
|
104
114
|
className
|
|
105
115
|
)}
|
|
106
116
|
{...props}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { encode } from "uqr"
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* QR code display primitive. Encodes an arbitrary string (URL, ID, TOTP
|
|
7
|
+
* URI) into a scannable matrix via `uqr` (zero-dependency Reed–Solomon
|
|
8
|
+
* encoder) and renders the SVG itself so every color stays token-driven:
|
|
9
|
+
* dark modules are a single path filled with `currentColor` (inherits
|
|
10
|
+
* `text-foreground`), and the light modules + quiet zone are transparent —
|
|
11
|
+
* the root paints `bg-background`. No hardcoded #000/#fff anywhere, so
|
|
12
|
+
* brand re-theming propagates and the wcag audit owns the pair.
|
|
13
|
+
*
|
|
14
|
+
* Scannability contract: the module/quiet-zone pair must stay at or above
|
|
15
|
+
* ~3:1 contrast or cameras stop locking on — the default foreground/
|
|
16
|
+
* background pair sits near 21:1 in both modes. Dark mode renders an
|
|
17
|
+
* inverted (light-on-dark) code; modern scanners read inversion fine, but
|
|
18
|
+
* if a surface must serve legacy scanners, place the component on a light
|
|
19
|
+
* `bg-background` island rather than restyling module colors. A 4-module
|
|
20
|
+
* quiet zone (ISO/IEC 18004 recommendation) is baked into the viewBox so
|
|
21
|
+
* it scales with the code and can't be cropped away by padding changes.
|
|
22
|
+
*
|
|
23
|
+
* Display-only — never focusable, no interaction, no motion (same class
|
|
24
|
+
* as Kbd and DataList). The root is `role="img"` with a required
|
|
25
|
+
* accessible name: `aria-label` ?? `title` ?? "QR code: <value>".
|
|
26
|
+
*
|
|
27
|
+
* <QRCode value="https://design.bads.com/share/tokens-v2-proposal"
|
|
28
|
+
* title="Scan to open the tokens proposal" />
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** Quiet-zone width in modules, baked into the SVG viewBox (ISO/IEC 18004). */
|
|
32
|
+
const QUIET_ZONE_MODULES = 4
|
|
33
|
+
|
|
34
|
+
export interface QRCodeProps
|
|
35
|
+
extends Omit<React.ComponentProps<"span">, "children"> {
|
|
36
|
+
/** The string encoded into the matrix (URL, ID, TOTP URI, …). */
|
|
37
|
+
value: string
|
|
38
|
+
/** Rendered width and height in px. Default 160. */
|
|
39
|
+
size?: number
|
|
40
|
+
/**
|
|
41
|
+
* Reed–Solomon error-correction level — how much of the code can be
|
|
42
|
+
* damaged or obscured and still scan. Higher levels densify the matrix.
|
|
43
|
+
* L ≈ 7%, M ≈ 15% (default), Q ≈ 25%, H ≈ 30%.
|
|
44
|
+
*/
|
|
45
|
+
errorCorrection?: "L" | "M" | "Q" | "H"
|
|
46
|
+
/**
|
|
47
|
+
* Accessible name for the code. Also mirrored as the native `title`
|
|
48
|
+
* attribute so sighted users can hover-recover the payload. Falls back
|
|
49
|
+
* to `aria-label`, then to "QR code: <value>".
|
|
50
|
+
*/
|
|
51
|
+
title?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function QRCode({
|
|
55
|
+
value,
|
|
56
|
+
size = 160,
|
|
57
|
+
errorCorrection = "M",
|
|
58
|
+
title,
|
|
59
|
+
className,
|
|
60
|
+
"aria-label": ariaLabel,
|
|
61
|
+
...props
|
|
62
|
+
}: QRCodeProps) {
|
|
63
|
+
// uqr's own defaults are ecc "L" and border 1 — both set explicitly:
|
|
64
|
+
// "M" matches the industry default, and a 1-module quiet zone is too
|
|
65
|
+
// tight for reliable camera lock-on.
|
|
66
|
+
const matrix = encode(value, {
|
|
67
|
+
ecc: errorCorrection,
|
|
68
|
+
border: QUIET_ZONE_MODULES,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// One path segment per dark module; light modules stay transparent so
|
|
72
|
+
// the root's bg-background provides the quiet zone in both themes.
|
|
73
|
+
let d = ""
|
|
74
|
+
for (let y = 0; y < matrix.size; y++) {
|
|
75
|
+
const row = matrix.data[y]
|
|
76
|
+
for (let x = 0; x < matrix.size; x++) {
|
|
77
|
+
if (row[x]) d += `M${x} ${y}h1v1h-1z`
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<span
|
|
83
|
+
data-slot="qr-code"
|
|
84
|
+
role="img"
|
|
85
|
+
aria-label={ariaLabel ?? title ?? `QR code: ${value}`}
|
|
86
|
+
title={title}
|
|
87
|
+
className={cn(
|
|
88
|
+
"inline-flex shrink-0 rounded-sm bg-background text-foreground",
|
|
89
|
+
className,
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
<svg
|
|
94
|
+
viewBox={`0 0 ${matrix.size} ${matrix.size}`}
|
|
95
|
+
width={size}
|
|
96
|
+
height={size}
|
|
97
|
+
shapeRendering="crispEdges"
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
focusable="false"
|
|
100
|
+
>
|
|
101
|
+
<path d={d} fill="currentColor" />
|
|
102
|
+
</svg>
|
|
103
|
+
</span>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { QRCode }
|
package/src/data/docs-index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
27
27
|
{ title: "README", path: "README.md", summary: "The first thing to read — what BADS is, how to run it, where to look next." },
|
|
28
28
|
{ title: "Brief", path: "BRIEF.md", summary: "The one-pager — what BADS is, who it's for, what it refuses." },
|
|
29
29
|
{ title: "Design system stack", path: "DESIGN_SYSTEM_STACK.md", summary: "The 10-layer architecture in one document." },
|
|
30
|
+
{ title: "Tech stack", path: "docs/tech-stack.md", summary: "What BADS is built on and why — framework, tokens, testing, AI layer — plus the 30-second spoken answer." },
|
|
30
31
|
{ title: "Sync model", path: "BADS_SYNC.md", summary: "How forks pull upstream BADS improvements." },
|
|
31
32
|
],
|
|
32
33
|
},
|
|
@@ -10,7 +10,7 @@ const meta: Meta<typeof CopyButton> = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
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. 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.",
|
|
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 visible Copied state renders in the success (green) color with the check + label at gap-1.5 (the confirmation is aria-hidden, so the color is decorative and the 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
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
DataList,
|
|
5
|
+
DataListItem,
|
|
6
|
+
DataListLabel,
|
|
7
|
+
DataListValue,
|
|
8
|
+
} from "@behavioral-agentic-design-system/core/components/ui/data-list";
|
|
9
|
+
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
10
|
+
import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof DataList> = {
|
|
13
|
+
title: "Components/DataList",
|
|
14
|
+
component: DataList,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered",
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component:
|
|
20
|
+
"Semantic key–value list. Renders a native <dl> with <dt>/<dd> pairs, so screen readers announce a description list and associate each term with its description — semantics a div grid cannot produce. Orientation vertical (default) stacks label over value; horizontal lays each pair on a grid row with the label column aligned across all rows via CSS subgrid. Sizes sm / default / lg scale rhythm and type. Display-only: no interaction, no motion. Use for profile panels, invoice summaries, settings recaps, metadata blocks.",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
orientation: { control: "select", options: ["vertical", "horizontal"] },
|
|
26
|
+
size: { control: "select", options: ["sm", "default", "lg"] },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
const pair = (label: string, value: React.ReactNode) => (
|
|
34
|
+
<DataListItem>
|
|
35
|
+
<DataListLabel>{label}</DataListLabel>
|
|
36
|
+
<DataListValue>{value}</DataListValue>
|
|
37
|
+
</DataListItem>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<DataList className="w-80">
|
|
43
|
+
{pair("Name", "Jordan Reeves")}
|
|
44
|
+
{pair("Role", "Design Systems Lead")}
|
|
45
|
+
{pair("Email", "jordan@reeves.design")}
|
|
46
|
+
{pair("Workspace", "design.bads.com")}
|
|
47
|
+
{pair("Member since", "Jan 15, 2026")}
|
|
48
|
+
</DataList>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Orientation_Vertical: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<DataList orientation="vertical" className="w-80">
|
|
55
|
+
{pair("Component", "Button · v2.4.0")}
|
|
56
|
+
{pair("Reviewed by", "Seo-yun Park")}
|
|
57
|
+
{pair("Last token change", "May 26, 2026")}
|
|
58
|
+
{pair("Contrast floor", "7:1 contrast")}
|
|
59
|
+
</DataList>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Orientation_Horizontal: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<DataList orientation="horizontal" className="w-96">
|
|
66
|
+
{pair("Invoice", "INV-2026-0187")}
|
|
67
|
+
{pair("Billed to", "Anika Patel")}
|
|
68
|
+
{pair("Billing email", "anika.patel@stripe.com")}
|
|
69
|
+
{pair("Amount", "$249.00")}
|
|
70
|
+
{pair("Issued", "May 26, 2026")}
|
|
71
|
+
{pair(
|
|
72
|
+
"Status",
|
|
73
|
+
<Badge variant="secondary" className="align-middle">
|
|
74
|
+
Paid
|
|
75
|
+
</Badge>,
|
|
76
|
+
)}
|
|
77
|
+
</DataList>
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Size_Sm: Story = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<DataList size="sm" orientation="horizontal" className="w-80">
|
|
84
|
+
{pair("Owner", "Marcus Lindqvist")}
|
|
85
|
+
{pair("Email", "marcus@lindqvist.dev")}
|
|
86
|
+
{pair("Plan", "Team · $249.00/yr")}
|
|
87
|
+
</DataList>
|
|
88
|
+
),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const Size_Default: Story = {
|
|
92
|
+
render: () => (
|
|
93
|
+
<DataList size="default" orientation="horizontal" className="w-80">
|
|
94
|
+
{pair("Owner", "Marcus Lindqvist")}
|
|
95
|
+
{pair("Email", "marcus@lindqvist.dev")}
|
|
96
|
+
{pair("Plan", "Team · $249.00/yr")}
|
|
97
|
+
</DataList>
|
|
98
|
+
),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const Size_Lg: Story = {
|
|
102
|
+
render: () => (
|
|
103
|
+
<DataList size="lg" orientation="horizontal" className="w-96">
|
|
104
|
+
{pair("Owner", "Marcus Lindqvist")}
|
|
105
|
+
{pair("Email", "marcus@lindqvist.dev")}
|
|
106
|
+
{pair("Plan", "Team · $249.00/yr")}
|
|
107
|
+
</DataList>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const LongValues: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<DataList orientation="horizontal" className="w-80">
|
|
114
|
+
{pair("Full name", "Wilhelmina-Constance Featherstonehaugh-Vance")}
|
|
115
|
+
{pair(
|
|
116
|
+
"Email",
|
|
117
|
+
"wilhelmina.featherstonehaugh-vance@subdomain.consulting.example.org",
|
|
118
|
+
)}
|
|
119
|
+
{pair("Share link", "https://design.bads.com/share/tokens-v2-proposal")}
|
|
120
|
+
</DataList>
|
|
121
|
+
),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const RealisticUse: Story = {
|
|
125
|
+
render: () => (
|
|
126
|
+
<div className="w-[26rem] rounded-lg border bg-card p-5 shadow-sm">
|
|
127
|
+
<div className="space-y-1">
|
|
128
|
+
<h3 className="text-sm font-semibold text-foreground">
|
|
129
|
+
Invoice INV-2026-0187
|
|
130
|
+
</h3>
|
|
131
|
+
<p className="text-sm text-muted-foreground">
|
|
132
|
+
Design system license · annual renewal
|
|
133
|
+
</p>
|
|
134
|
+
</div>
|
|
135
|
+
<Separator className="my-4" />
|
|
136
|
+
<DataList orientation="horizontal">
|
|
137
|
+
{pair("Billed to", "Jordan Reeves")}
|
|
138
|
+
{pair("Email", "jordan@reeves.design")}
|
|
139
|
+
{pair("Address", "1401 South Congress Ave, Suite 200, Austin, TX 78704")}
|
|
140
|
+
{pair("Issued", "May 26, 2026")}
|
|
141
|
+
{pair("Due", "Nov 20, 2026")}
|
|
142
|
+
{pair(
|
|
143
|
+
"Amount due",
|
|
144
|
+
<span className="font-semibold">$12,500.00</span>,
|
|
145
|
+
)}
|
|
146
|
+
{pair(
|
|
147
|
+
"Status",
|
|
148
|
+
<Badge variant="secondary" className="align-middle">
|
|
149
|
+
Awaiting payment
|
|
150
|
+
</Badge>,
|
|
151
|
+
)}
|
|
152
|
+
</DataList>
|
|
153
|
+
<Separator className="my-4" />
|
|
154
|
+
<DataList size="sm">
|
|
155
|
+
{pair("Includes", "36 components, all passing AAA contrast")}
|
|
156
|
+
{pair("Support contact", "seoyun.park@figma.com")}
|
|
157
|
+
</DataList>
|
|
158
|
+
</div>
|
|
159
|
+
),
|
|
160
|
+
};
|
|
@@ -39,6 +39,10 @@ const notificationRow = (id: string, label: string, defaultChecked = false) => (
|
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
41
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.
|
|
42
46
|
export const Default: Story = {
|
|
43
47
|
render: () => (
|
|
44
48
|
<Fieldset className="w-96">
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
InputGroupText,
|
|
8
8
|
InputGroupButton,
|
|
9
9
|
} from "@behavioral-agentic-design-system/core/components/ui/input-group";
|
|
10
|
-
import {
|
|
10
|
+
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button";
|
|
11
|
+
import { Search, Link2 } from "lucide-react";
|
|
11
12
|
|
|
12
13
|
const meta: Meta<typeof InputGroup> = {
|
|
13
14
|
title: "Components/InputGroup",
|
|
@@ -119,37 +120,29 @@ export const TextPrefix: Story = {
|
|
|
119
120
|
),
|
|
120
121
|
};
|
|
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).
|
|
122
128
|
export const WithButton: Story = {
|
|
123
|
-
render: () =>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
},
|
|
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
|
+
),
|
|
153
146
|
};
|
|
154
147
|
|
|
155
148
|
export const Disabled: Story = {
|
|
@@ -186,16 +179,21 @@ export const RealisticUse: Story = {
|
|
|
186
179
|
<label htmlFor="ig-search" className="text-sm font-medium">
|
|
187
180
|
Find a member
|
|
188
181
|
</label>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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>
|
|
199
197
|
</div>
|
|
200
198
|
|
|
201
199
|
<div className="flex flex-col gap-1.5">
|
|
@@ -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
|
+
};
|