@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
|
@@ -19,6 +19,25 @@ import {
|
|
|
19
19
|
import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
|
|
20
20
|
import { ButtonGroup } from "@behavioral-agentic-design-system/core/components/ui/button-group";
|
|
21
21
|
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
22
|
+
import {
|
|
23
|
+
InputGroup,
|
|
24
|
+
InputGroupInput,
|
|
25
|
+
InputGroupAddon,
|
|
26
|
+
InputGroupText,
|
|
27
|
+
InputGroupButton,
|
|
28
|
+
} from "@behavioral-agentic-design-system/core/components/ui/input-group";
|
|
29
|
+
import {
|
|
30
|
+
Fieldset,
|
|
31
|
+
FieldsetLegend,
|
|
32
|
+
FieldsetHelper,
|
|
33
|
+
FieldsetError,
|
|
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";
|
|
22
41
|
import { Label } from "@behavioral-agentic-design-system/core/components/ui/label";
|
|
23
42
|
import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
|
|
24
43
|
import { Switch } from "@behavioral-agentic-design-system/core/components/ui/switch";
|
|
@@ -255,7 +274,7 @@ import {
|
|
|
255
274
|
SheetTitle,
|
|
256
275
|
SheetTrigger,
|
|
257
276
|
} from "@behavioral-agentic-design-system/core/components/ui/sheet";
|
|
258
|
-
import { TrendingUp, MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon } from "lucide-react";
|
|
277
|
+
import { TrendingUp, MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search } from "lucide-react";
|
|
259
278
|
import {
|
|
260
279
|
Tree,
|
|
261
280
|
TreeItem,
|
|
@@ -271,6 +290,7 @@ import {
|
|
|
271
290
|
EditablePreview,
|
|
272
291
|
EditableSubmit,
|
|
273
292
|
} from "@behavioral-agentic-design-system/core/components/ui/editable";
|
|
293
|
+
import { QRCode } from "@behavioral-agentic-design-system/core/components/ui/qr-code";
|
|
274
294
|
|
|
275
295
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
276
296
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -636,20 +656,20 @@ export default function ComponentsPreview() {
|
|
|
636
656
|
<Section title="Form controls">
|
|
637
657
|
<div className="flex flex-wrap items-center gap-6">
|
|
638
658
|
<div className="flex items-center gap-2">
|
|
639
|
-
<Switch id="sw" defaultChecked />
|
|
659
|
+
<Switch id="sw" defaultChecked aria-label="Switch" />
|
|
640
660
|
<Label htmlFor="sw">Switch</Label>
|
|
641
661
|
</div>
|
|
642
662
|
<div className="flex items-center gap-2">
|
|
643
|
-
<Checkbox id="cb" defaultChecked />
|
|
663
|
+
<Checkbox id="cb" defaultChecked aria-label="Checkbox" />
|
|
644
664
|
<Label htmlFor="cb">Checkbox</Label>
|
|
645
665
|
</div>
|
|
646
666
|
<RadioGroup defaultValue="a" className="flex items-center gap-3">
|
|
647
667
|
<div className="flex items-center gap-2">
|
|
648
|
-
<RadioGroupItem id="r-a" value="a" />
|
|
668
|
+
<RadioGroupItem id="r-a" value="a" aria-label="Option A" />
|
|
649
669
|
<Label htmlFor="r-a">Option A</Label>
|
|
650
670
|
</div>
|
|
651
671
|
<div className="flex items-center gap-2">
|
|
652
|
-
<RadioGroupItem id="r-b" value="b" />
|
|
672
|
+
<RadioGroupItem id="r-b" value="b" aria-label="Option B" />
|
|
653
673
|
<Label htmlFor="r-b">Option B</Label>
|
|
654
674
|
</div>
|
|
655
675
|
</RadioGroup>
|
|
@@ -3023,6 +3043,386 @@ export default function ComponentsPreview() {
|
|
|
3023
3043
|
</div>
|
|
3024
3044
|
</div>
|
|
3025
3045
|
</Section>
|
|
3046
|
+
|
|
3047
|
+
<Section title="Input Group">
|
|
3048
|
+
<div className="flex flex-col gap-6">
|
|
3049
|
+
<div className="flex flex-wrap items-start gap-8">
|
|
3050
|
+
<div className="space-y-1.5">
|
|
3051
|
+
<p className="text-xs font-medium text-muted-foreground">Leading icon</p>
|
|
3052
|
+
<InputGroup className="w-72">
|
|
3053
|
+
<InputGroupAddon align="inline-start">
|
|
3054
|
+
<Search aria-hidden />
|
|
3055
|
+
</InputGroupAddon>
|
|
3056
|
+
<InputGroupInput placeholder="Search sessions" aria-label="Search" />
|
|
3057
|
+
</InputGroup>
|
|
3058
|
+
</div>
|
|
3059
|
+
<div className="space-y-1.5">
|
|
3060
|
+
<p className="text-xs font-medium text-muted-foreground">Currency prefix + unit suffix</p>
|
|
3061
|
+
<InputGroup className="w-72">
|
|
3062
|
+
<InputGroupAddon align="inline-start">
|
|
3063
|
+
<InputGroupText>$</InputGroupText>
|
|
3064
|
+
</InputGroupAddon>
|
|
3065
|
+
<InputGroupInput defaultValue="49.00" inputMode="decimal" aria-label="Amount" />
|
|
3066
|
+
<InputGroupAddon align="inline-end">
|
|
3067
|
+
<InputGroupText>/ mo</InputGroupText>
|
|
3068
|
+
</InputGroupAddon>
|
|
3069
|
+
</InputGroup>
|
|
3070
|
+
</div>
|
|
3071
|
+
</div>
|
|
3072
|
+
<div className="flex flex-wrap items-start gap-8">
|
|
3073
|
+
<div className="space-y-1.5">
|
|
3074
|
+
<p className="text-xs font-medium text-muted-foreground">Protocol prefix</p>
|
|
3075
|
+
<InputGroup className="w-72">
|
|
3076
|
+
<InputGroupAddon align="inline-start">
|
|
3077
|
+
<InputGroupText>https://</InputGroupText>
|
|
3078
|
+
</InputGroupAddon>
|
|
3079
|
+
{/* placeholder, not value — clicking in and typing replaces it */}
|
|
3080
|
+
<InputGroupInput placeholder="design.bads.com" aria-label="Website" />
|
|
3081
|
+
</InputGroup>
|
|
3082
|
+
</div>
|
|
3083
|
+
<div className="space-y-1.5">
|
|
3084
|
+
<p className="text-xs font-medium text-muted-foreground">Inline action</p>
|
|
3085
|
+
<InputGroup className="w-72">
|
|
3086
|
+
<InputGroupInput
|
|
3087
|
+
readOnly
|
|
3088
|
+
value="avery.castillo@protonmail.com"
|
|
3089
|
+
aria-label="Invite email"
|
|
3090
|
+
/>
|
|
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>
|
|
3101
|
+
</InputGroup>
|
|
3102
|
+
</div>
|
|
3103
|
+
</div>
|
|
3104
|
+
</div>
|
|
3105
|
+
</Section>
|
|
3106
|
+
|
|
3107
|
+
<Section title="Fieldset">
|
|
3108
|
+
<div className="flex flex-wrap items-start gap-8">
|
|
3109
|
+
<Fieldset className="w-80">
|
|
3110
|
+
<FieldsetLegend>Notification preferences</FieldsetLegend>
|
|
3111
|
+
<FieldsetHelper>Choose how we reach Jordan Reeves.</FieldsetHelper>
|
|
3112
|
+
<div className="flex flex-col gap-3">
|
|
3113
|
+
<div className="flex items-center gap-2.5">
|
|
3114
|
+
<Checkbox id="fs-email" defaultChecked />
|
|
3115
|
+
<Label htmlFor="fs-email" className="font-normal">Email digest</Label>
|
|
3116
|
+
</div>
|
|
3117
|
+
<div className="flex items-center gap-2.5">
|
|
3118
|
+
<Checkbox id="fs-push" defaultChecked />
|
|
3119
|
+
<Label htmlFor="fs-push" className="font-normal">Push notifications</Label>
|
|
3120
|
+
</div>
|
|
3121
|
+
<div className="flex items-center gap-2.5">
|
|
3122
|
+
<Checkbox id="fs-sms" />
|
|
3123
|
+
<Label htmlFor="fs-sms" className="font-normal">SMS alerts</Label>
|
|
3124
|
+
</div>
|
|
3125
|
+
</div>
|
|
3126
|
+
</Fieldset>
|
|
3127
|
+
|
|
3128
|
+
<Fieldset invalid className="w-80">
|
|
3129
|
+
<FieldsetLegend>Contact method</FieldsetLegend>
|
|
3130
|
+
<FieldsetHelper>We’ll only use this for security alerts.</FieldsetHelper>
|
|
3131
|
+
<RadioGroup className="gap-3">
|
|
3132
|
+
<div className="flex items-center gap-2.5">
|
|
3133
|
+
<RadioGroupItem value="email" id="fs-c-email" />
|
|
3134
|
+
<Label htmlFor="fs-c-email" className="font-normal">Email</Label>
|
|
3135
|
+
</div>
|
|
3136
|
+
<div className="flex items-center gap-2.5">
|
|
3137
|
+
<RadioGroupItem value="phone" id="fs-c-phone" />
|
|
3138
|
+
<Label htmlFor="fs-c-phone" className="font-normal">Phone</Label>
|
|
3139
|
+
</div>
|
|
3140
|
+
</RadioGroup>
|
|
3141
|
+
<FieldsetError>Choose at least one contact method.</FieldsetError>
|
|
3142
|
+
</Fieldset>
|
|
3143
|
+
|
|
3144
|
+
<Fieldset disabled variant="unstyled" className="w-72">
|
|
3145
|
+
<FieldsetLegend>Release channel (locked)</FieldsetLegend>
|
|
3146
|
+
<FieldsetHelper>Locked while Marcus Lindqvist’s plan is read-only.</FieldsetHelper>
|
|
3147
|
+
<RadioGroup defaultValue="stable" className="gap-3">
|
|
3148
|
+
<div className="flex items-center gap-2.5">
|
|
3149
|
+
<RadioGroupItem value="stable" id="fs-r-stable" />
|
|
3150
|
+
<Label htmlFor="fs-r-stable" className="font-normal">Stable</Label>
|
|
3151
|
+
</div>
|
|
3152
|
+
<div className="flex items-center gap-2.5">
|
|
3153
|
+
<RadioGroupItem value="beta" id="fs-r-beta" />
|
|
3154
|
+
<Label htmlFor="fs-r-beta" className="font-normal">Beta</Label>
|
|
3155
|
+
</div>
|
|
3156
|
+
</RadioGroup>
|
|
3157
|
+
</Fieldset>
|
|
3158
|
+
</div>
|
|
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>
|
|
3026
3426
|
</div>
|
|
3027
3427
|
</div>
|
|
3028
3428
|
);
|
package/src/app/shell.tsx
CHANGED
|
@@ -57,10 +57,13 @@ export function IframePreview({
|
|
|
57
57
|
src,
|
|
58
58
|
minWidth,
|
|
59
59
|
dark,
|
|
60
|
+
title,
|
|
60
61
|
}: {
|
|
61
62
|
src: string;
|
|
62
63
|
minWidth?: string;
|
|
63
64
|
dark: boolean;
|
|
65
|
+
/** Accessible label for the iframe — required by screen readers. Falls back to the src path. */
|
|
66
|
+
title?: string;
|
|
64
67
|
}) {
|
|
65
68
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
66
69
|
// Capture the initial src once on mount. After load, dark mode is applied via
|
|
@@ -99,6 +102,7 @@ export function IframePreview({
|
|
|
99
102
|
<iframe
|
|
100
103
|
ref={iframeRef}
|
|
101
104
|
src={initialSrcRef.current}
|
|
105
|
+
title={title ?? src}
|
|
102
106
|
onLoad={() => {
|
|
103
107
|
syncDarkMode();
|
|
104
108
|
setLoaded(true);
|
|
@@ -174,12 +178,12 @@ export type ShellProps = {
|
|
|
174
178
|
export const DEFAULT_TABS: ShellTab[] = [
|
|
175
179
|
{ value: "home", label: "Home", render: ({ goToTab }) => <HomeTab onBrowseDocs={() => goToTab("docs")} onBrowseComponents={() => goToTab("components")} /> },
|
|
176
180
|
{ value: "docs", label: "Docs", render: () => <DocsTab /> },
|
|
177
|
-
{ value: "components", label: "Components", render: ({ dark }) => <IframePreview dark={dark} src="/preview/components" /> },
|
|
178
|
-
{ value: "cards", label: "Cards", render: ({ dark }) => <IframePreview dark={dark} src="/preview/cards" /> },
|
|
179
|
-
{ value: "dashboard", label: "Dashboard", hidden: "md", render: ({ dark }) => <IframePreview dark={dark} src="/preview/dashboard" minWidth="1400px" /> },
|
|
181
|
+
{ value: "components", label: "Components", render: ({ dark }) => <IframePreview dark={dark} src="/preview/components" title="Components preview" /> },
|
|
182
|
+
{ value: "cards", label: "Cards", render: ({ dark }) => <IframePreview dark={dark} src="/preview/cards" title="Cards preview" /> },
|
|
183
|
+
{ value: "dashboard", label: "Dashboard", hidden: "md", render: ({ dark }) => <IframePreview dark={dark} src="/preview/dashboard" minWidth="1400px" title="Dashboard preview" /> },
|
|
180
184
|
{ value: "layers", label: "Layers", render: () => <LayersTab /> },
|
|
181
|
-
{ value: "icons", label: "Icons", noPreload: true, render: ({ dark }) => <IframePreview dark={dark} src="/preview/icons" /> },
|
|
182
|
-
{ value: "
|
|
185
|
+
{ value: "icons", label: "Icons", noPreload: true, render: ({ dark }) => <IframePreview dark={dark} src="/preview/icons" title="Icons preview" /> },
|
|
186
|
+
{ value: "customize", label: "Customize", render: () => <CustomizeTab /> },
|
|
183
187
|
];
|
|
184
188
|
|
|
185
189
|
/**
|
|
@@ -408,6 +412,14 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
408
412
|
return (
|
|
409
413
|
<ShellNavContext.Provider value={navValue}>
|
|
410
414
|
<div className="min-h-screen bg-background flex flex-col">
|
|
415
|
+
{/* Skip-to-content: visually hidden until focused so keyboard users can
|
|
416
|
+
bypass the header and tab strip and jump straight to the panel area. */}
|
|
417
|
+
<a
|
|
418
|
+
href="#main-content"
|
|
419
|
+
className="sr-only focus:not-sr-only focus:absolute focus:z-50 focus:top-2 focus:left-2 focus:rounded-md focus:bg-primary focus:px-3 focus:py-2 focus:text-primary-foreground"
|
|
420
|
+
>
|
|
421
|
+
Skip to main content
|
|
422
|
+
</a>
|
|
411
423
|
<header className="border-b bg-card shrink-0">
|
|
412
424
|
<div className="flex h-14 items-center px-4 sm:px-6">
|
|
413
425
|
<div className="flex items-center gap-2 min-w-0">
|
|
@@ -547,7 +559,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
547
559
|
</TabsList>
|
|
548
560
|
</div>
|
|
549
561
|
|
|
550
|
-
<section className="relative flex-1 min-h-0 w-full overflow-hidden">
|
|
562
|
+
<section id="main-content" tabIndex={-1} className="relative flex-1 min-h-0 w-full overflow-hidden">
|
|
551
563
|
<div className="absolute inset-x-4 top-1 bottom-4 isolate overflow-hidden rounded-lg">
|
|
552
564
|
<TabsPanels>
|
|
553
565
|
{tabs.map((tab) => {
|
|
@@ -555,8 +567,20 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
555
567
|
// everything else mounts once seen and stays for instant
|
|
556
568
|
// cross-fades. See ShellTab.noPreload.
|
|
557
569
|
const mounted = tab.noPreload ? activeTab === tab.value : seen.has(tab.value);
|
|
570
|
+
const isActive = activeTab === tab.value;
|
|
571
|
+
// Inactive forceMount panels are hidden from the a11y tree:
|
|
572
|
+
// `aria-hidden` removes them from the accessibility tree, and
|
|
573
|
+
// `inert` blocks focus into them — together they prevent multiple
|
|
574
|
+
// live <h1>s and duplicate landmark navigation while keeping the
|
|
575
|
+
// DOM mounted for the cross-fade. Active panel gets neither.
|
|
558
576
|
return mounted ? (
|
|
559
|
-
<TabsContent
|
|
577
|
+
<TabsContent
|
|
578
|
+
key={tab.value}
|
|
579
|
+
value={tab.value}
|
|
580
|
+
forceMount
|
|
581
|
+
aria-hidden={isActive ? undefined : true}
|
|
582
|
+
inert={isActive ? undefined : true}
|
|
583
|
+
>
|
|
560
584
|
{tab.render(ctx)}
|
|
561
585
|
</TabsContent>
|
|
562
586
|
) : null;
|