@behavioral-agentic-design-system/core 0.39.0 → 0.40.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 +8 -3
- package/scripts/a11y-lint.cjs +93 -39
- package/scripts/a11y-ratchet.mjs +10 -23
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +175 -17
- package/scripts/check-stories.mjs +1 -1
- package/scripts/health-report.mjs +52 -10
- package/scripts/lib/scan-roots.cjs +143 -0
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/lint-slop.mjs +21 -28
- package/scripts/lint-token-intent.mjs +10 -16
- package/scripts/size-audit.cjs +94 -27
- package/scripts/source-of-truth.cjs +58 -0
- package/scripts/ux-smoke.mjs +438 -0
- package/scripts/wcag-audit.cjs +49 -1
- package/src/api/layers/file.ts +2 -0
- package/src/app/preview/components/page.tsx +972 -0
- package/src/app/preview/health/page.tsx +8 -5
- package/src/app/preview/history/page.tsx +11 -0
- package/src/app/shell.tsx +261 -87
- package/src/components/customize/brand-mark-section.tsx +4 -2
- package/src/components/customize/design-controls.tsx +1 -1
- package/src/components/customize/discipline-section.tsx +91 -0
- package/src/components/customize/font-pickers.tsx +1 -1
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/save-bar.tsx +2 -2
- package/src/components/customize/theme-io.tsx +7 -7
- package/src/components/customize/type-scale.tsx +1 -1
- package/src/components/customize-tab.tsx +9 -4
- package/src/components/home-tab.tsx +3 -0
- package/src/components/ui/accordion.tsx +7 -0
- package/src/components/ui/alert.tsx +1 -0
- package/src/components/ui/announcement-bar.tsx +256 -0
- package/src/components/ui/badge.tsx +1 -0
- package/src/components/ui/callout.tsx +218 -0
- package/src/components/ui/chart.tsx +2 -14
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/format-relative-time.tsx +139 -0
- package/src/components/ui/grid.tsx +255 -0
- package/src/components/ui/icon.tsx +108 -0
- package/src/components/ui/index.ts +8 -0
- package/src/components/ui/page-header.tsx +63 -0
- package/src/components/ui/portal.tsx +111 -0
- package/src/components/ui/presence.tsx +172 -0
- package/src/components/ui/progress-stack.tsx +258 -0
- package/src/components/ui/select.tsx +89 -4
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/slider.tsx +83 -3
- package/src/components/ui/sparkline.tsx +15 -15
- package/src/components/ui/textarea.tsx +28 -1
- package/src/data/docs-index.ts +5 -0
- package/src/data/history.json +269 -0
- package/src/hooks/use-reduced-motion.ts +6 -0
- package/src/stories/Accordion.stories.tsx +59 -0
- package/src/stories/Alert.stories.tsx +3 -1
- package/src/stories/AnnouncementBar.stories.tsx +261 -0
- package/src/stories/Badge.stories.tsx +3 -0
- package/src/stories/Calendar.stories.tsx +1 -1
- package/src/stories/Callout.stories.tsx +219 -0
- package/src/stories/Chart.stories.tsx +4 -0
- package/src/stories/ColorPicker.stories.tsx +23 -0
- package/src/stories/FormatRelativeTime.stories.tsx +116 -0
- package/src/stories/Grid.stories.tsx +197 -0
- package/src/stories/Icon.stories.tsx +175 -0
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/PageHeader.stories.tsx +102 -0
- package/src/stories/Portal.stories.tsx +189 -0
- package/src/stories/Presence.stories.tsx +228 -0
- package/src/stories/ProgressStack.stories.tsx +287 -0
- package/src/stories/Select.stories.tsx +25 -0
- package/src/stories/Separator.stories.tsx +3 -0
- package/src/stories/Sheet.stories.tsx +9 -3
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Sparkline.stories.tsx +39 -0
- package/src/stories/Textarea.stories.tsx +18 -0
- package/src/stories/story-groups.json +14 -5
- package/src/styles.css +133 -12
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { Masonry } from "@behavioral-agentic-design-system/core/components/ui/masonry";
|
|
27
27
|
import { FormatNumber } from "@behavioral-agentic-design-system/core/components/ui/format-number";
|
|
28
28
|
import { FormatByte } from "@behavioral-agentic-design-system/core/components/ui/format-byte";
|
|
29
|
+
import { FormatRelativeTime } from "@behavioral-agentic-design-system/core/components/ui/format-relative-time";
|
|
29
30
|
import { ButtonGroup } from "@behavioral-agentic-design-system/core/components/ui/button-group";
|
|
30
31
|
import { Input } from "@behavioral-agentic-design-system/core/components/ui/input";
|
|
31
32
|
import {
|
|
@@ -416,9 +417,18 @@ import {
|
|
|
416
417
|
import { Questionnaire } from "@behavioral-agentic-design-system/core/components/ui/questionnaire";
|
|
417
418
|
import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
|
|
418
419
|
import { SearchInput } from "@behavioral-agentic-design-system/core/components/ui/search-input";
|
|
420
|
+
import { Grid, GridCol } from "@behavioral-agentic-design-system/core/components/ui/grid";
|
|
419
421
|
import { FormatDate } from "@behavioral-agentic-design-system/core/components/ui/format-date";
|
|
420
422
|
import { WeekPicker } from "@behavioral-agentic-design-system/core/components/ui/week-picker";
|
|
421
423
|
import { Sparkline } from "@behavioral-agentic-design-system/core/components/ui/sparkline";
|
|
424
|
+
import { PageHeader } from "@behavioral-agentic-design-system/core/components/ui/page-header";
|
|
425
|
+
import { Presence, PRESENCE_TRANSITIONS, type PresenceTransition } from "@behavioral-agentic-design-system/core/components/ui/presence";
|
|
426
|
+
import { Portal } from "@behavioral-agentic-design-system/core/components/ui/portal";
|
|
427
|
+
import { Icon } from "@behavioral-agentic-design-system/core/components/ui/icon";
|
|
428
|
+
import { ICON_ROLES } from "@behavioral-agentic-design-system/core/lib/get-icon-color";
|
|
429
|
+
import { ProgressStack } from "@behavioral-agentic-design-system/core/components/ui/progress-stack";
|
|
430
|
+
import { Callout } from "@behavioral-agentic-design-system/core/components/ui/callout";
|
|
431
|
+
import { AnnouncementBar } from "@behavioral-agentic-design-system/core/components/ui/announcement-bar";
|
|
422
432
|
|
|
423
433
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
424
434
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -1013,6 +1023,24 @@ export default function ComponentsPreview() {
|
|
|
1013
1023
|
{ value: 100, label: "High" },
|
|
1014
1024
|
]}
|
|
1015
1025
|
/>
|
|
1026
|
+
<Label className="pt-3">Slider with value label</Label>
|
|
1027
|
+
<Slider
|
|
1028
|
+
defaultValue={[120, 375]}
|
|
1029
|
+
min={0}
|
|
1030
|
+
max={500}
|
|
1031
|
+
step={5}
|
|
1032
|
+
aria-label="Retainer range"
|
|
1033
|
+
valueLabel="always"
|
|
1034
|
+
valueLabelFormat={(v) => `$${v}`}
|
|
1035
|
+
/>
|
|
1036
|
+
<Slider
|
|
1037
|
+
defaultValue={[62]}
|
|
1038
|
+
max={100}
|
|
1039
|
+
step={1}
|
|
1040
|
+
aria-label="Volume"
|
|
1041
|
+
valueLabel="auto"
|
|
1042
|
+
valueLabelFormat={(v) => `${v}%`}
|
|
1043
|
+
/>
|
|
1016
1044
|
<Label className="pt-3">Progress</Label>
|
|
1017
1045
|
<Progress value={62} aria-label="Progress" />
|
|
1018
1046
|
<Label className="pt-3">Progress sizes</Label>
|
|
@@ -4174,7 +4202,11 @@ export default function ComponentsPreview() {
|
|
|
4174
4202
|
<ColorSwatch color="#171717" size="lg" aria-label="Selected: near-black">
|
|
4175
4203
|
<CheckIcon strokeWidth={1.5} className="text-white" />
|
|
4176
4204
|
</ColorSwatch>
|
|
4205
|
+
{/* Picker's own label pattern (see CLAUDE.md -> Customize Tab):
|
|
4206
|
+
shows the user's raw hex pick back as text, not a style
|
|
4207
|
+
value — SC 1.4.6 doesn't apply to displayed data. */}
|
|
4177
4208
|
<span className="tabular-nums text-muted-foreground">
|
|
4209
|
+
{/* allow-hex-literal */}
|
|
4178
4210
|
#171717 · selected
|
|
4179
4211
|
</span>
|
|
4180
4212
|
</div>
|
|
@@ -6268,6 +6300,9 @@ export default function ComponentsPreview() {
|
|
|
6268
6300
|
<Section title="SearchInput">
|
|
6269
6301
|
<SearchInputShowcase />
|
|
6270
6302
|
</Section>
|
|
6303
|
+
<Section title="FormatRelativeTime">
|
|
6304
|
+
<FormatRelativeTimeShowcase />
|
|
6305
|
+
</Section>
|
|
6271
6306
|
<Section title="FormatDate">
|
|
6272
6307
|
<FormatDateShowcase />
|
|
6273
6308
|
</Section>
|
|
@@ -6277,6 +6312,30 @@ export default function ComponentsPreview() {
|
|
|
6277
6312
|
<Section title="Sparkline">
|
|
6278
6313
|
<SparklineShowcase />
|
|
6279
6314
|
</Section>
|
|
6315
|
+
<Section title="PageHeader">
|
|
6316
|
+
<PageHeaderShowcase />
|
|
6317
|
+
</Section>
|
|
6318
|
+
<Section title="Presence">
|
|
6319
|
+
<PresenceShowcase />
|
|
6320
|
+
</Section>
|
|
6321
|
+
<Section title="Portal">
|
|
6322
|
+
<PortalShowcase />
|
|
6323
|
+
</Section>
|
|
6324
|
+
<Section title="Icon">
|
|
6325
|
+
<IconShowcase />
|
|
6326
|
+
</Section>
|
|
6327
|
+
<Section title="ProgressStack">
|
|
6328
|
+
<ProgressStackShowcase />
|
|
6329
|
+
</Section>
|
|
6330
|
+
<Section title="Callout">
|
|
6331
|
+
<CalloutShowcase />
|
|
6332
|
+
</Section>
|
|
6333
|
+
<Section title="AnnouncementBar">
|
|
6334
|
+
<AnnouncementBarShowcase />
|
|
6335
|
+
</Section>
|
|
6336
|
+
<Section title="Grid">
|
|
6337
|
+
<GridShowcase />
|
|
6338
|
+
</Section>
|
|
6280
6339
|
</div>
|
|
6281
6340
|
</div>
|
|
6282
6341
|
);
|
|
@@ -12030,6 +12089,38 @@ function SearchInputShowcase() {
|
|
|
12030
12089
|
);
|
|
12031
12090
|
}
|
|
12032
12091
|
|
|
12092
|
+
function FormatRelativeTimeShowcase() {
|
|
12093
|
+
const now = Date.now();
|
|
12094
|
+
const rows: { label: string; date: Date; props?: Record<string, unknown> }[] = [
|
|
12095
|
+
{ label: "Just now", date: new Date(now - 15_000) },
|
|
12096
|
+
{ label: "2 minutes ago", date: new Date(now - 2 * 60_000) },
|
|
12097
|
+
{ label: "Yesterday (auto)", date: new Date(now - 26 * 60 * 60_000), props: { numeric: "auto" } },
|
|
12098
|
+
{ label: "Yesterday (always)", date: new Date(now - 26 * 60 * 60_000), props: { numeric: "always" } },
|
|
12099
|
+
{ label: "3 days ago", date: new Date(now - 3 * 24 * 60 * 60_000) },
|
|
12100
|
+
{ label: "In 4 hours", date: new Date(now + 4 * 60 * 60_000) },
|
|
12101
|
+
{ label: "Narrow style", date: new Date(now - 7 * 60_000), props: { formatStyle: "narrow" } },
|
|
12102
|
+
{ label: "Live off (static)", date: new Date(now - 45_000), props: { live: false } },
|
|
12103
|
+
];
|
|
12104
|
+
return (
|
|
12105
|
+
<div className="space-y-6">
|
|
12106
|
+
<p className="text-sm text-muted-foreground">
|
|
12107
|
+
Locale-aware relative time display. Renders a semantic{" "}
|
|
12108
|
+
<code className="text-xs bg-muted px-1 py-0.5 rounded"><time></code>{" "}
|
|
12109
|
+
element with a machine-readable <code className="text-xs bg-muted px-1 py-0.5 rounded">dateTime</code>{" "}
|
|
12110
|
+
attribute and optionally live-updates every 30 s.
|
|
12111
|
+
</p>
|
|
12112
|
+
<div className="flex flex-col gap-1.5 max-w-sm">
|
|
12113
|
+
{rows.map(({ label, date, props: extraProps }) => (
|
|
12114
|
+
<div key={label} className="flex items-center justify-between text-sm gap-4">
|
|
12115
|
+
<span className="text-muted-foreground">{label}</span>
|
|
12116
|
+
<FormatRelativeTime date={date} className="tabular-nums font-medium shrink-0" {...(extraProps as Record<string, unknown>)} />
|
|
12117
|
+
</div>
|
|
12118
|
+
))}
|
|
12119
|
+
</div>
|
|
12120
|
+
</div>
|
|
12121
|
+
);
|
|
12122
|
+
}
|
|
12123
|
+
|
|
12033
12124
|
function FormatDateShowcase() {
|
|
12034
12125
|
const kickoff = new Date(2026, 0, 15);
|
|
12035
12126
|
const reportDate = new Date(2026, 8, 9);
|
|
@@ -12318,3 +12409,884 @@ function SparklineShowcase() {
|
|
|
12318
12409
|
</div>
|
|
12319
12410
|
);
|
|
12320
12411
|
}
|
|
12412
|
+
|
|
12413
|
+
function PageHeaderShowcase() {
|
|
12414
|
+
return (
|
|
12415
|
+
<div className="space-y-8 w-full">
|
|
12416
|
+
<div>
|
|
12417
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Title only</p>
|
|
12418
|
+
<PageHeader title="Workspace settings" />
|
|
12419
|
+
</div>
|
|
12420
|
+
<div>
|
|
12421
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With description</p>
|
|
12422
|
+
<PageHeader
|
|
12423
|
+
title="Workspace settings"
|
|
12424
|
+
description="Manage your workspace preferences, integrations, and team access."
|
|
12425
|
+
/>
|
|
12426
|
+
</div>
|
|
12427
|
+
<div>
|
|
12428
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With eyebrow</p>
|
|
12429
|
+
<PageHeader
|
|
12430
|
+
eyebrow="Account"
|
|
12431
|
+
title="Billing & plans"
|
|
12432
|
+
description="Manage your subscription and payment methods."
|
|
12433
|
+
/>
|
|
12434
|
+
</div>
|
|
12435
|
+
<div>
|
|
12436
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With action</p>
|
|
12437
|
+
<PageHeader
|
|
12438
|
+
title="Team members"
|
|
12439
|
+
description="Invite people and manage their roles."
|
|
12440
|
+
action={<Button size="xl">Invite member</Button>}
|
|
12441
|
+
/>
|
|
12442
|
+
</div>
|
|
12443
|
+
<div>
|
|
12444
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Bordered + eyebrow + actions</p>
|
|
12445
|
+
<PageHeader
|
|
12446
|
+
eyebrow="Projects"
|
|
12447
|
+
title="Meridian rebrand"
|
|
12448
|
+
description="Brand identity, design tokens, and component library for Meridian Financial."
|
|
12449
|
+
bordered
|
|
12450
|
+
action={
|
|
12451
|
+
<>
|
|
12452
|
+
<Button variant="outline" size="lg">Export</Button>
|
|
12453
|
+
<Button size="xl">New component</Button>
|
|
12454
|
+
</>
|
|
12455
|
+
}
|
|
12456
|
+
/>
|
|
12457
|
+
</div>
|
|
12458
|
+
</div>
|
|
12459
|
+
);
|
|
12460
|
+
}
|
|
12461
|
+
|
|
12462
|
+
function PresenceShowcase() {
|
|
12463
|
+
const [present, setPresent] = React.useState(true);
|
|
12464
|
+
const [transition, setTransition] = React.useState<PresenceTransition>("fade");
|
|
12465
|
+
const [keepMounted, setKeepMounted] = React.useState(false);
|
|
12466
|
+
const [saved, setSaved] = React.useState(false);
|
|
12467
|
+
React.useEffect(() => {
|
|
12468
|
+
if (!saved) return;
|
|
12469
|
+
const t = window.setTimeout(() => setSaved(false), 2400);
|
|
12470
|
+
return () => window.clearTimeout(t);
|
|
12471
|
+
}, [saved]);
|
|
12472
|
+
return (
|
|
12473
|
+
<div className="space-y-8">
|
|
12474
|
+
<p className="text-sm text-muted-foreground">
|
|
12475
|
+
Mount/unmount wrapper with a token-driven enter <em>and exit</em>{" "}
|
|
12476
|
+
animation. <code className="font-mono">present=false</code> plays the
|
|
12477
|
+
exit keyframe and only then unmounts the child — conditional rendering
|
|
12478
|
+
can never do that, because the node is gone before the browser paints.
|
|
12479
|
+
Keyframes ride <code className="font-mono">--duration-base</code> /{" "}
|
|
12480
|
+
<code className="font-mono">--ease-out</code> in the generated
|
|
12481
|
+
styles.css; reduced motion collapses them.
|
|
12482
|
+
</p>
|
|
12483
|
+
|
|
12484
|
+
<div>
|
|
12485
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12486
|
+
Every transition — pick one, then toggle the panel.
|
|
12487
|
+
</p>
|
|
12488
|
+
<div className="flex flex-col gap-4">
|
|
12489
|
+
<SegmentedControl
|
|
12490
|
+
value={transition}
|
|
12491
|
+
onValueChange={(v) => setTransition(v as PresenceTransition)}
|
|
12492
|
+
label="Presence transition"
|
|
12493
|
+
className="w-fit"
|
|
12494
|
+
>
|
|
12495
|
+
{PRESENCE_TRANSITIONS.map((t) => (
|
|
12496
|
+
<SegmentedControlItem key={t} value={t}>
|
|
12497
|
+
{t}
|
|
12498
|
+
</SegmentedControlItem>
|
|
12499
|
+
))}
|
|
12500
|
+
</SegmentedControl>
|
|
12501
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
12502
|
+
<Button
|
|
12503
|
+
variant="outline"
|
|
12504
|
+
size="xl"
|
|
12505
|
+
onClick={() => setPresent((p) => !p)}
|
|
12506
|
+
aria-expanded={present}
|
|
12507
|
+
aria-controls="presence-showcase-panel"
|
|
12508
|
+
>
|
|
12509
|
+
{present ? "Hide panel" : "Show panel"}
|
|
12510
|
+
</Button>
|
|
12511
|
+
<div className="flex items-center gap-2">
|
|
12512
|
+
<Switch
|
|
12513
|
+
id="presence-keep-mounted"
|
|
12514
|
+
checked={keepMounted}
|
|
12515
|
+
onCheckedChange={setKeepMounted}
|
|
12516
|
+
/>
|
|
12517
|
+
<Label htmlFor="presence-keep-mounted">
|
|
12518
|
+
Keep mounted (hidden attribute after exit)
|
|
12519
|
+
</Label>
|
|
12520
|
+
</div>
|
|
12521
|
+
</div>
|
|
12522
|
+
{/* Reserved height so the layout doesn't jump while the exit plays. */}
|
|
12523
|
+
<div className="h-24 max-w-sm">
|
|
12524
|
+
<Presence
|
|
12525
|
+
id="presence-showcase-panel"
|
|
12526
|
+
present={present}
|
|
12527
|
+
transition={transition}
|
|
12528
|
+
unmountOnExit={!keepMounted}
|
|
12529
|
+
// lint-disable: card-bypass — Presence animates its own root; the surface classes must live on the element it mounts/unmounts, not a wrapped Card
|
|
12530
|
+
className="rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm"
|
|
12531
|
+
>
|
|
12532
|
+
<p className="text-sm font-medium">Jordan Reeves</p>
|
|
12533
|
+
<p className="text-sm text-muted-foreground">
|
|
12534
|
+
Northwind Systems · design system lead
|
|
12535
|
+
</p>
|
|
12536
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
12537
|
+
transition: <code className="font-mono">{transition}</code>
|
|
12538
|
+
</p>
|
|
12539
|
+
</Presence>
|
|
12540
|
+
</div>
|
|
12541
|
+
</div>
|
|
12542
|
+
</div>
|
|
12543
|
+
|
|
12544
|
+
<div>
|
|
12545
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12546
|
+
Realistic use — inline confirmation that animates out after 2.4s
|
|
12547
|
+
(asChild, inside an aria-live region).
|
|
12548
|
+
</p>
|
|
12549
|
+
<form
|
|
12550
|
+
// lint-disable: card-bypass — the card surface has to live on the <form> element itself so Presence's live-region confirmation can be a sibling inside it
|
|
12551
|
+
className="flex max-w-sm flex-col gap-5 rounded-lg border border-border bg-card p-6"
|
|
12552
|
+
onSubmit={(e) => {
|
|
12553
|
+
e.preventDefault();
|
|
12554
|
+
setSaved(true);
|
|
12555
|
+
}}
|
|
12556
|
+
>
|
|
12557
|
+
<div>
|
|
12558
|
+
<p className="text-lg font-semibold">Customize your tokens</p>
|
|
12559
|
+
<p className="text-sm text-muted-foreground">
|
|
12560
|
+
36 components, all passing AAA contrast.
|
|
12561
|
+
</p>
|
|
12562
|
+
</div>
|
|
12563
|
+
<div className="flex flex-col gap-3">
|
|
12564
|
+
<Label htmlFor="presence-showcase-scope">npm scope</Label>
|
|
12565
|
+
<Input
|
|
12566
|
+
id="presence-showcase-scope"
|
|
12567
|
+
defaultValue="@behavioral-agentic-design-system"
|
|
12568
|
+
/>
|
|
12569
|
+
</div>
|
|
12570
|
+
<div className="flex items-center gap-3">
|
|
12571
|
+
<Button type="submit" size="xl">
|
|
12572
|
+
Save changes
|
|
12573
|
+
</Button>
|
|
12574
|
+
<Button type="button" variant="ghost" size="xl">
|
|
12575
|
+
Cancel
|
|
12576
|
+
</Button>
|
|
12577
|
+
</div>
|
|
12578
|
+
<div className="min-h-12" aria-live="polite">
|
|
12579
|
+
<Presence present={saved} transition="slide-up" asChild>
|
|
12580
|
+
<div className="flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-sm">
|
|
12581
|
+
<Icon as={CircleCheck} color="success" className="mt-0.5" />
|
|
12582
|
+
<span>
|
|
12583
|
+
<span className="font-medium">Token changes saved.</span>{" "}
|
|
12584
|
+
<span className="text-muted-foreground">
|
|
12585
|
+
Run pnpm build:tokens to regenerate CSS.
|
|
12586
|
+
</span>
|
|
12587
|
+
</span>
|
|
12588
|
+
</div>
|
|
12589
|
+
</Presence>
|
|
12590
|
+
</div>
|
|
12591
|
+
</form>
|
|
12592
|
+
</div>
|
|
12593
|
+
</div>
|
|
12594
|
+
);
|
|
12595
|
+
}
|
|
12596
|
+
|
|
12597
|
+
function ProgressStackShowcase() {
|
|
12598
|
+
const storageSegments = [
|
|
12599
|
+
{ value: 38, label: "Documents" },
|
|
12600
|
+
{ value: 29, label: "Media" },
|
|
12601
|
+
{ value: 16, label: "System" },
|
|
12602
|
+
{ value: 8, label: "Other" },
|
|
12603
|
+
];
|
|
12604
|
+
const budgetSegments = [
|
|
12605
|
+
{ value: 42, label: "Engineering" },
|
|
12606
|
+
{ value: 28, label: "Design" },
|
|
12607
|
+
{ value: 18, label: "Marketing" },
|
|
12608
|
+
{ value: 12, label: "Operations" },
|
|
12609
|
+
];
|
|
12610
|
+
const customColors = [
|
|
12611
|
+
{ value: 40, label: "Q1", color: "var(--primary)" },
|
|
12612
|
+
{ value: 25, label: "Q2", color: "var(--success)" },
|
|
12613
|
+
{ value: 20, label: "Q3", color: "var(--warning)" },
|
|
12614
|
+
{ value: 15, label: "Q4", color: "var(--destructive)" },
|
|
12615
|
+
];
|
|
12616
|
+
return (
|
|
12617
|
+
<div className="space-y-8">
|
|
12618
|
+
<div>
|
|
12619
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12620
|
+
Default — colors from --chart-1..5 family
|
|
12621
|
+
</p>
|
|
12622
|
+
<div className="w-80">
|
|
12623
|
+
<ProgressStack
|
|
12624
|
+
segments={storageSegments}
|
|
12625
|
+
aria-label="Storage breakdown"
|
|
12626
|
+
/>
|
|
12627
|
+
</div>
|
|
12628
|
+
</div>
|
|
12629
|
+
<div>
|
|
12630
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12631
|
+
With legend and values
|
|
12632
|
+
</p>
|
|
12633
|
+
<div className="w-80">
|
|
12634
|
+
<ProgressStack
|
|
12635
|
+
segments={storageSegments}
|
|
12636
|
+
aria-label="Storage breakdown"
|
|
12637
|
+
showLegend
|
|
12638
|
+
showValues
|
|
12639
|
+
/>
|
|
12640
|
+
</div>
|
|
12641
|
+
</div>
|
|
12642
|
+
<div>
|
|
12643
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12644
|
+
Sizes — sm / default / lg
|
|
12645
|
+
</p>
|
|
12646
|
+
<div className="flex w-80 flex-col gap-4">
|
|
12647
|
+
{(["sm", "default", "lg"] as const).map((size) => (
|
|
12648
|
+
<div key={size}>
|
|
12649
|
+
<p className="mb-1.5 text-xs text-muted-foreground">size="{size}"</p>
|
|
12650
|
+
<ProgressStack
|
|
12651
|
+
segments={storageSegments}
|
|
12652
|
+
size={size}
|
|
12653
|
+
aria-label={`Storage breakdown — ${size}`}
|
|
12654
|
+
/>
|
|
12655
|
+
</div>
|
|
12656
|
+
))}
|
|
12657
|
+
</div>
|
|
12658
|
+
</div>
|
|
12659
|
+
<div>
|
|
12660
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12661
|
+
Custom semantic-token colors
|
|
12662
|
+
</p>
|
|
12663
|
+
<div className="w-80">
|
|
12664
|
+
<ProgressStack
|
|
12665
|
+
segments={customColors}
|
|
12666
|
+
aria-label="Quarterly revenue split"
|
|
12667
|
+
showLegend
|
|
12668
|
+
showValues
|
|
12669
|
+
/>
|
|
12670
|
+
</div>
|
|
12671
|
+
</div>
|
|
12672
|
+
<div>
|
|
12673
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12674
|
+
Partial fill via max prop — 70 GB used of 128 GB
|
|
12675
|
+
</p>
|
|
12676
|
+
<div className="w-80">
|
|
12677
|
+
<ProgressStack
|
|
12678
|
+
segments={[
|
|
12679
|
+
{ value: 38, label: "Documents" },
|
|
12680
|
+
{ value: 22, label: "Media" },
|
|
12681
|
+
{ value: 10, label: "System" },
|
|
12682
|
+
]}
|
|
12683
|
+
max={128}
|
|
12684
|
+
aria-label="Storage: 70 of 128 GB used"
|
|
12685
|
+
showLegend
|
|
12686
|
+
formatValue={(v) => `${v} GB`}
|
|
12687
|
+
/>
|
|
12688
|
+
</div>
|
|
12689
|
+
</div>
|
|
12690
|
+
<div>
|
|
12691
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12692
|
+
Realistic use — dashboard card with 2 stacks
|
|
12693
|
+
</p>
|
|
12694
|
+
<Card className="w-[480px]">
|
|
12695
|
+
<CardHeader>
|
|
12696
|
+
<CardTitle>Resource overview</CardTitle>
|
|
12697
|
+
<CardDescription>BADS Austin team — current quarter</CardDescription>
|
|
12698
|
+
</CardHeader>
|
|
12699
|
+
<CardContent className="flex flex-col gap-6">
|
|
12700
|
+
<div>
|
|
12701
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
12702
|
+
Repository storage
|
|
12703
|
+
</p>
|
|
12704
|
+
<ProgressStack
|
|
12705
|
+
segments={storageSegments}
|
|
12706
|
+
aria-label="Repository storage breakdown"
|
|
12707
|
+
showLegend
|
|
12708
|
+
showValues
|
|
12709
|
+
formatValue={(v, t) => `${Math.round((v / t) * 100)}%`}
|
|
12710
|
+
/>
|
|
12711
|
+
</div>
|
|
12712
|
+
<div>
|
|
12713
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
12714
|
+
Q3 budget utilization
|
|
12715
|
+
</p>
|
|
12716
|
+
<ProgressStack
|
|
12717
|
+
segments={budgetSegments}
|
|
12718
|
+
aria-label="Q3 budget by department"
|
|
12719
|
+
showLegend
|
|
12720
|
+
showValues
|
|
12721
|
+
formatValue={(v) => `$${v}k`}
|
|
12722
|
+
/>
|
|
12723
|
+
</div>
|
|
12724
|
+
</CardContent>
|
|
12725
|
+
</Card>
|
|
12726
|
+
</div>
|
|
12727
|
+
</div>
|
|
12728
|
+
);
|
|
12729
|
+
}
|
|
12730
|
+
|
|
12731
|
+
function PortalShowcase() {
|
|
12732
|
+
const [box, setBox] = React.useState<HTMLDivElement | null>(null);
|
|
12733
|
+
const initial = "@behavioral-agentic-design-system";
|
|
12734
|
+
const [value, setValue] = React.useState(initial);
|
|
12735
|
+
const dirty = value !== initial;
|
|
12736
|
+
return (
|
|
12737
|
+
<div className="space-y-8">
|
|
12738
|
+
<p className="text-sm text-muted-foreground">
|
|
12739
|
+
Renders children into another DOM container — by default the{" "}
|
|
12740
|
+
<code className="font-mono"><body></code> of the component's
|
|
12741
|
+
own document (this preview runs in an iframe, so that's the iframe
|
|
12742
|
+
body) — while keeping them in the React tree. The portal root carries
|
|
12743
|
+
the <code className="font-mono">PortalThemeProvider</code> scope class,
|
|
12744
|
+
so theme-scoped CSS variables resolve inside it. Zero new dependencies.
|
|
12745
|
+
</p>
|
|
12746
|
+
|
|
12747
|
+
<div>
|
|
12748
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12749
|
+
Custom container — the badge is declared in the left card, rendered in
|
|
12750
|
+
the dashed target.
|
|
12751
|
+
</p>
|
|
12752
|
+
<div className="grid max-w-2xl gap-4 sm:grid-cols-2">
|
|
12753
|
+
{/* lint-disable: card-bypass — a generic bounded container for the portal-source/target demo, not a Card feature demo */}
|
|
12754
|
+
<div className="rounded-lg border border-border bg-card p-4 text-sm">
|
|
12755
|
+
<p className="font-medium">Source</p>
|
|
12756
|
+
<p className="text-muted-foreground">
|
|
12757
|
+
Declared here, in the React tree.
|
|
12758
|
+
</p>
|
|
12759
|
+
<Portal container={box}>
|
|
12760
|
+
<Badge variant="outline">Rendered into the target</Badge>
|
|
12761
|
+
</Portal>
|
|
12762
|
+
</div>
|
|
12763
|
+
<div
|
|
12764
|
+
ref={setBox}
|
|
12765
|
+
className="flex min-h-16 items-center gap-2 rounded-lg border border-dashed border-border p-4 text-sm"
|
|
12766
|
+
>
|
|
12767
|
+
<span className="text-muted-foreground">Target:</span>
|
|
12768
|
+
</div>
|
|
12769
|
+
</div>
|
|
12770
|
+
</div>
|
|
12771
|
+
|
|
12772
|
+
<div>
|
|
12773
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12774
|
+
Disabled — renders in place.
|
|
12775
|
+
</p>
|
|
12776
|
+
{/* lint-disable: card-bypass — a generic bounded container for the portal-disabled demo, not a Card feature demo */}
|
|
12777
|
+
<div className="flex w-fit items-center gap-3 rounded-lg border border-border bg-card p-4 text-sm">
|
|
12778
|
+
<span className="text-muted-foreground">Inline:</span>
|
|
12779
|
+
<Portal disabled>
|
|
12780
|
+
<Badge variant="outline">Not portaled</Badge>
|
|
12781
|
+
</Portal>
|
|
12782
|
+
</div>
|
|
12783
|
+
</div>
|
|
12784
|
+
|
|
12785
|
+
<div>
|
|
12786
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12787
|
+
Realistic use — edit the field to reveal an unsaved-changes bar that
|
|
12788
|
+
escapes this card's overflow-hidden (Portal + Presence).
|
|
12789
|
+
</p>
|
|
12790
|
+
{/* lint-disable: card-bypass — overflow-hidden is the point of this demo (the Portal bar must escape it); Card doesn't expose that as a prop */}
|
|
12791
|
+
<div className="max-w-sm overflow-hidden rounded-lg border border-border bg-card p-6">
|
|
12792
|
+
<p className="text-lg font-semibold">Customize your tokens</p>
|
|
12793
|
+
<p className="mb-5 text-sm text-muted-foreground">
|
|
12794
|
+
The bar renders at body, so no ancestor can clip it.
|
|
12795
|
+
</p>
|
|
12796
|
+
<div className="flex flex-col gap-3">
|
|
12797
|
+
<Label htmlFor="portal-showcase-scope">npm scope</Label>
|
|
12798
|
+
<Input
|
|
12799
|
+
id="portal-showcase-scope"
|
|
12800
|
+
value={value}
|
|
12801
|
+
onChange={(e) => setValue(e.target.value)}
|
|
12802
|
+
/>
|
|
12803
|
+
</div>
|
|
12804
|
+
<Portal>
|
|
12805
|
+
<Presence present={dirty} transition="slide-up" asChild>
|
|
12806
|
+
<div
|
|
12807
|
+
role="status"
|
|
12808
|
+
className="fixed inset-x-4 bottom-4 z-50 mx-auto flex max-w-lg items-center justify-between gap-4 rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-lg"
|
|
12809
|
+
>
|
|
12810
|
+
<span className="text-sm font-medium">Unsaved changes</span>
|
|
12811
|
+
<div className="flex items-center gap-2">
|
|
12812
|
+
<Button size="xl" variant="ghost" onClick={() => setValue(initial)}>
|
|
12813
|
+
Cancel
|
|
12814
|
+
</Button>
|
|
12815
|
+
<Button size="xl" onClick={() => setValue(initial)}>
|
|
12816
|
+
Save changes
|
|
12817
|
+
</Button>
|
|
12818
|
+
</div>
|
|
12819
|
+
</div>
|
|
12820
|
+
</Presence>
|
|
12821
|
+
</Portal>
|
|
12822
|
+
</div>
|
|
12823
|
+
</div>
|
|
12824
|
+
</div>
|
|
12825
|
+
);
|
|
12826
|
+
}
|
|
12827
|
+
|
|
12828
|
+
function CalloutShowcase() {
|
|
12829
|
+
return (
|
|
12830
|
+
<div className="space-y-8">
|
|
12831
|
+
<div>
|
|
12832
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12833
|
+
All five variants
|
|
12834
|
+
</p>
|
|
12835
|
+
<div className="flex w-[480px] flex-col gap-4">
|
|
12836
|
+
<Callout variant="note" title="Note">
|
|
12837
|
+
General information or contextual aside.
|
|
12838
|
+
</Callout>
|
|
12839
|
+
<Callout variant="tip" title="Tip">
|
|
12840
|
+
A helpful shortcut or recommended practice.
|
|
12841
|
+
</Callout>
|
|
12842
|
+
<Callout variant="warning" title="Warning">
|
|
12843
|
+
Caution: a risk or potential issue to be aware of.
|
|
12844
|
+
</Callout>
|
|
12845
|
+
<Callout variant="danger" title="Danger">
|
|
12846
|
+
Stop: this path leads to data loss or a breaking change.
|
|
12847
|
+
</Callout>
|
|
12848
|
+
<Callout variant="info" title="Info">
|
|
12849
|
+
Neutral reference that is neither an error nor a tip.
|
|
12850
|
+
</Callout>
|
|
12851
|
+
</div>
|
|
12852
|
+
</div>
|
|
12853
|
+
<div>
|
|
12854
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12855
|
+
No title — icon alone carries the variant signal
|
|
12856
|
+
</p>
|
|
12857
|
+
<div className="flex w-[480px] flex-col gap-3">
|
|
12858
|
+
<Callout variant="note">
|
|
12859
|
+
Icon alone signals the variant when the title is omitted.
|
|
12860
|
+
</Callout>
|
|
12861
|
+
<Callout variant="warning">
|
|
12862
|
+
Pass <Code>icon={"{null}"}</Code> to suppress the icon entirely.
|
|
12863
|
+
</Callout>
|
|
12864
|
+
</div>
|
|
12865
|
+
</div>
|
|
12866
|
+
<div>
|
|
12867
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12868
|
+
Rich body content — lists, multiple paragraphs, inline code
|
|
12869
|
+
</p>
|
|
12870
|
+
<div className="w-[480px]">
|
|
12871
|
+
<Callout variant="danger" title="Microanimation patterns to avoid">
|
|
12872
|
+
<p>These patterns compile to nothing in Tailwind v4 and produce silent failures:</p>
|
|
12873
|
+
<ul className="mt-2 list-disc pl-4 space-y-1 text-muted-foreground">
|
|
12874
|
+
<li><Code>duration-fast</Code>, <Code>duration-base</Code>, <Code>duration-slow</Code></li>
|
|
12875
|
+
<li><Code>duration-[var(--duration-fast)]</Code> (arbitrary-value form)</li>
|
|
12876
|
+
<li>Inline <Code>transitionDuration: "200ms"</Code> (literal value bypasses tokens)</li>
|
|
12877
|
+
</ul>
|
|
12878
|
+
<p className="mt-2">
|
|
12879
|
+
Use inline <Code>{`style={{ transitionDuration: "var(--duration-fast)" }}`}</Code> instead.
|
|
12880
|
+
</p>
|
|
12881
|
+
</Callout>
|
|
12882
|
+
</div>
|
|
12883
|
+
</div>
|
|
12884
|
+
<div>
|
|
12885
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12886
|
+
Realistic use — documentation section context
|
|
12887
|
+
</p>
|
|
12888
|
+
<div className="w-[480px] flex flex-col gap-5">
|
|
12889
|
+
<p className="text-sm text-muted-foreground">
|
|
12890
|
+
Run <Code>pnpm rename "Clap Design" clap</Code> to rename a fresh fork.
|
|
12891
|
+
</p>
|
|
12892
|
+
<Callout variant="tip" title="Fast path">
|
|
12893
|
+
The rename script updates every reference in a single pass. Commit
|
|
12894
|
+
with <Code>git add -A && git commit -m "chore: rename to Clap Design"</Code>.
|
|
12895
|
+
</Callout>
|
|
12896
|
+
<Callout variant="warning" title="After renaming">
|
|
12897
|
+
Re-run <Code>pnpm install && pnpm build:tokens</Code> so generated CSS
|
|
12898
|
+
carries the new package namespace. Skipping this causes a silent FOUC on first load.
|
|
12899
|
+
</Callout>
|
|
12900
|
+
<Callout variant="danger">
|
|
12901
|
+
Never run <Code>pnpm rename</Code> on an already-renamed repo — it
|
|
12902
|
+
will do nothing harmful but produces a confusing diff.
|
|
12903
|
+
</Callout>
|
|
12904
|
+
</div>
|
|
12905
|
+
</div>
|
|
12906
|
+
</div>
|
|
12907
|
+
);
|
|
12908
|
+
}
|
|
12909
|
+
|
|
12910
|
+
function IconShowcase() {
|
|
12911
|
+
const sizes = ["sm", "default", "lg", "xl"] as const;
|
|
12912
|
+
return (
|
|
12913
|
+
<div className="space-y-8">
|
|
12914
|
+
<p className="text-sm text-muted-foreground">
|
|
12915
|
+
System wrapper for any Lucide icon. Stroke width is pinned to 1.5 (the
|
|
12916
|
+
prop is omitted on purpose), size is a four-stop ladder, and{" "}
|
|
12917
|
+
<code className="font-mono">color</code> is a semantic role resolved
|
|
12918
|
+
through <code className="font-mono">getIconColor()</code> to the{" "}
|
|
12919
|
+
<code className="font-mono">icon-*</code> token family. Decorative by
|
|
12920
|
+
default; <code className="font-mono">label</code> makes it a named image.
|
|
12921
|
+
</p>
|
|
12922
|
+
|
|
12923
|
+
<div>
|
|
12924
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12925
|
+
Sizes — sm 14 / default 16 / lg 20 / xl 24.
|
|
12926
|
+
</p>
|
|
12927
|
+
<div className="flex flex-col gap-3">
|
|
12928
|
+
{sizes.map((size) => (
|
|
12929
|
+
<div key={size} className="flex items-center gap-4">
|
|
12930
|
+
<Icon as={Search} size={size} />
|
|
12931
|
+
<Icon as={BellIcon} size={size} />
|
|
12932
|
+
<Icon as={PaletteIcon} size={size} />
|
|
12933
|
+
<Icon as={Sparkles} size={size} />
|
|
12934
|
+
<span className="text-xs text-muted-foreground">{size}</span>
|
|
12935
|
+
</div>
|
|
12936
|
+
))}
|
|
12937
|
+
</div>
|
|
12938
|
+
</div>
|
|
12939
|
+
|
|
12940
|
+
<div>
|
|
12941
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12942
|
+
Color roles — every entry in the icon-* token family (inverse sits on
|
|
12943
|
+
a filled primary chip, the only surface it is for).
|
|
12944
|
+
</p>
|
|
12945
|
+
<div className="grid max-w-md grid-cols-3 gap-x-8 gap-y-4 text-sm">
|
|
12946
|
+
{ICON_ROLES.map((role) =>
|
|
12947
|
+
role === "inverse" ? (
|
|
12948
|
+
<div key={role} className="flex items-center gap-2">
|
|
12949
|
+
<span className="inline-flex size-7 items-center justify-center rounded-md bg-primary">
|
|
12950
|
+
<Icon as={Sparkles} color={role} />
|
|
12951
|
+
</span>
|
|
12952
|
+
<span className="text-muted-foreground">{role}</span>
|
|
12953
|
+
</div>
|
|
12954
|
+
) : (
|
|
12955
|
+
<div key={role} className="flex items-center gap-2">
|
|
12956
|
+
<Icon as={Sparkles} size="lg" color={role} />
|
|
12957
|
+
<span className="text-muted-foreground">{role}</span>
|
|
12958
|
+
</div>
|
|
12959
|
+
)
|
|
12960
|
+
)}
|
|
12961
|
+
</div>
|
|
12962
|
+
</div>
|
|
12963
|
+
|
|
12964
|
+
<div>
|
|
12965
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12966
|
+
Decorative vs labeled — a labeled icon announces as an image named by
|
|
12967
|
+
its meaning (“Passing”), not its glyph.
|
|
12968
|
+
</p>
|
|
12969
|
+
<div className="flex flex-col gap-3 text-sm">
|
|
12970
|
+
<div className="flex items-center gap-2">
|
|
12971
|
+
<Icon as={CircleCheck} color="success" />
|
|
12972
|
+
<span>Decorative — the text beside it carries the meaning</span>
|
|
12973
|
+
</div>
|
|
12974
|
+
<div className="flex items-center gap-2">
|
|
12975
|
+
<Icon as={CircleCheck} color="success" label="Passing" />
|
|
12976
|
+
<span className="text-muted-foreground">
|
|
12977
|
+
Labeled — role="img", aria-label="Passing"
|
|
12978
|
+
</span>
|
|
12979
|
+
</div>
|
|
12980
|
+
</div>
|
|
12981
|
+
</div>
|
|
12982
|
+
|
|
12983
|
+
<div>
|
|
12984
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12985
|
+
Realistic use — pre-commit status list, icons colored by role beside
|
|
12986
|
+
their text; buttons inherit currentColor.
|
|
12987
|
+
</p>
|
|
12988
|
+
<Card className="max-w-sm gap-0 p-6">
|
|
12989
|
+
<p className="mb-4 text-lg font-semibold">Pre-commit checks</p>
|
|
12990
|
+
<ul className="flex flex-col gap-3 text-sm">
|
|
12991
|
+
<li className="flex items-start gap-2">
|
|
12992
|
+
<Icon as={CircleCheck} color="success" className="mt-0.5" />
|
|
12993
|
+
<span>
|
|
12994
|
+
<span className="font-medium">Story coverage check passed.</span>{" "}
|
|
12995
|
+
<span className="text-muted-foreground">
|
|
12996
|
+
All 36 components have matching stories.
|
|
12997
|
+
</span>
|
|
12998
|
+
</span>
|
|
12999
|
+
</li>
|
|
13000
|
+
<li className="flex items-start gap-2">
|
|
13001
|
+
<Icon as={CircleAlert} color="error" className="mt-0.5" />
|
|
13002
|
+
<span>
|
|
13003
|
+
<span className="font-medium">Token build failed.</span>{" "}
|
|
13004
|
+
<span className="text-muted-foreground">
|
|
13005
|
+
Check tokens.json for syntax errors and run pnpm build:tokens
|
|
13006
|
+
again.
|
|
13007
|
+
</span>
|
|
13008
|
+
</span>
|
|
13009
|
+
</li>
|
|
13010
|
+
<li className="flex items-start gap-2">
|
|
13011
|
+
<Icon as={TriangleAlert} color="warning" className="mt-0.5" />
|
|
13012
|
+
<span>
|
|
13013
|
+
<span className="font-medium">7:1 contrast</span>{" "}
|
|
13014
|
+
<span className="text-muted-foreground">
|
|
13015
|
+
— two token pairs are AA only.
|
|
13016
|
+
</span>
|
|
13017
|
+
</span>
|
|
13018
|
+
</li>
|
|
13019
|
+
<li className="flex items-start gap-2">
|
|
13020
|
+
<Icon as={Info} color="info" className="mt-0.5" />
|
|
13021
|
+
<span className="text-muted-foreground">
|
|
13022
|
+
44×44px target enforced on every CTA.
|
|
13023
|
+
</span>
|
|
13024
|
+
</li>
|
|
13025
|
+
</ul>
|
|
13026
|
+
<div className="mt-5 flex flex-wrap gap-2">
|
|
13027
|
+
<Button size="xl">
|
|
13028
|
+
<Icon as={Search} size="lg" />
|
|
13029
|
+
Search components
|
|
13030
|
+
</Button>
|
|
13031
|
+
<Button size="xl" variant="outline">
|
|
13032
|
+
<Icon as={PaletteIcon} size="lg" />
|
|
13033
|
+
Customize
|
|
13034
|
+
</Button>
|
|
13035
|
+
</div>
|
|
13036
|
+
</Card>
|
|
13037
|
+
</div>
|
|
13038
|
+
</div>
|
|
13039
|
+
);
|
|
13040
|
+
}
|
|
13041
|
+
|
|
13042
|
+
function AnnouncementBarShowcase() {
|
|
13043
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
13044
|
+
return (
|
|
13045
|
+
<div className="space-y-8">
|
|
13046
|
+
<div>
|
|
13047
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13048
|
+
All five variants
|
|
13049
|
+
</p>
|
|
13050
|
+
<div className="flex flex-col rounded-lg overflow-hidden border border-border">
|
|
13051
|
+
<AnnouncementBar variant="default">
|
|
13052
|
+
BADS v2.4 — ProgressStack, Callout & AnnouncementBar now available.
|
|
13053
|
+
</AnnouncementBar>
|
|
13054
|
+
<AnnouncementBar variant="info">
|
|
13055
|
+
Scheduled maintenance Sunday 2026-09-21 02:00–04:00 CDT.
|
|
13056
|
+
</AnnouncementBar>
|
|
13057
|
+
<AnnouncementBar variant="success">
|
|
13058
|
+
Incident resolved — build pipeline fully operational.
|
|
13059
|
+
</AnnouncementBar>
|
|
13060
|
+
<AnnouncementBar variant="warning">
|
|
13061
|
+
Deprecation: <code className="font-mono text-xs">impactLevel</code> removed in v3.
|
|
13062
|
+
</AnnouncementBar>
|
|
13063
|
+
<AnnouncementBar variant="destructive">
|
|
13064
|
+
Partial outage — Night Shift component builds paused.
|
|
13065
|
+
</AnnouncementBar>
|
|
13066
|
+
</div>
|
|
13067
|
+
</div>
|
|
13068
|
+
<div>
|
|
13069
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13070
|
+
With action link
|
|
13071
|
+
</p>
|
|
13072
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13073
|
+
<AnnouncementBar
|
|
13074
|
+
variant="default"
|
|
13075
|
+
action={
|
|
13076
|
+
<a
|
|
13077
|
+
href="#changelog"
|
|
13078
|
+
className="rounded-sm font-semibold underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1"
|
|
13079
|
+
>
|
|
13080
|
+
View changelog
|
|
13081
|
+
</a>
|
|
13082
|
+
}
|
|
13083
|
+
>
|
|
13084
|
+
BADS v2.4 ships 12 new components, including ProgressStack and Callout.
|
|
13085
|
+
</AnnouncementBar>
|
|
13086
|
+
</div>
|
|
13087
|
+
</div>
|
|
13088
|
+
<div>
|
|
13089
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13090
|
+
Dismissible — with action + dismiss button
|
|
13091
|
+
</p>
|
|
13092
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13093
|
+
{!dismissed ? (
|
|
13094
|
+
<AnnouncementBar
|
|
13095
|
+
variant="info"
|
|
13096
|
+
aria-label="Free plan limit notice"
|
|
13097
|
+
onDismiss={() => setDismissed(true)}
|
|
13098
|
+
action={
|
|
13099
|
+
<a
|
|
13100
|
+
href="#upgrade"
|
|
13101
|
+
className="rounded-sm font-semibold underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1"
|
|
13102
|
+
>
|
|
13103
|
+
Upgrade
|
|
13104
|
+
</a>
|
|
13105
|
+
}
|
|
13106
|
+
>
|
|
13107
|
+
You're on the free plan — 3 active fork limit.
|
|
13108
|
+
</AnnouncementBar>
|
|
13109
|
+
) : (
|
|
13110
|
+
<div className="flex items-center justify-center py-4 text-sm text-muted-foreground">
|
|
13111
|
+
Bar dismissed —{" "}
|
|
13112
|
+
<button
|
|
13113
|
+
type="button"
|
|
13114
|
+
className="ml-1 underline"
|
|
13115
|
+
onClick={() => setDismissed(false)}
|
|
13116
|
+
>
|
|
13117
|
+
restore
|
|
13118
|
+
</button>
|
|
13119
|
+
</div>
|
|
13120
|
+
)}
|
|
13121
|
+
</div>
|
|
13122
|
+
</div>
|
|
13123
|
+
<div>
|
|
13124
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13125
|
+
Realistic use — above a mock app shell
|
|
13126
|
+
</p>
|
|
13127
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13128
|
+
<AnnouncementBar
|
|
13129
|
+
variant="default"
|
|
13130
|
+
action={
|
|
13131
|
+
<a
|
|
13132
|
+
href="#changelog"
|
|
13133
|
+
className="rounded-sm font-semibold underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1"
|
|
13134
|
+
>
|
|
13135
|
+
What's new →
|
|
13136
|
+
</a>
|
|
13137
|
+
}
|
|
13138
|
+
>
|
|
13139
|
+
BADS v2.4 — ProgressStack, Callout & AnnouncementBar are live.
|
|
13140
|
+
</AnnouncementBar>
|
|
13141
|
+
<div className="border-b px-6 py-3 flex items-center gap-3 bg-card">
|
|
13142
|
+
<span className="font-semibold text-sm">BADS</span>
|
|
13143
|
+
<span className="text-xs text-muted-foreground">Design System</span>
|
|
13144
|
+
</div>
|
|
13145
|
+
<div className="px-6 py-8 bg-background text-sm text-muted-foreground">
|
|
13146
|
+
Main content area — the bar sits above, outside the layout shell.
|
|
13147
|
+
</div>
|
|
13148
|
+
</div>
|
|
13149
|
+
</div>
|
|
13150
|
+
</div>
|
|
13151
|
+
);
|
|
13152
|
+
}
|
|
13153
|
+
|
|
13154
|
+
function GridShowcase() {
|
|
13155
|
+
const cell = (label: string) => (
|
|
13156
|
+
// lint-disable: card-bypass — dashed-border placeholder cell for the Grid span demo; visual ruler cell, not content Card
|
|
13157
|
+
<div className="flex h-12 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-card px-2">
|
|
13158
|
+
<span className="truncate text-sm text-muted-foreground">{label}</span>
|
|
13159
|
+
</div>
|
|
13160
|
+
);
|
|
13161
|
+
return (
|
|
13162
|
+
<div className="space-y-8">
|
|
13163
|
+
<p className="text-sm text-muted-foreground">
|
|
13164
|
+
Twelve-track span grid — the SimpleGrid sibling for unequal columns. A{" "}
|
|
13165
|
+
<code className="text-xs">GridCol</code> spans 1–12 tracks and can be
|
|
13166
|
+
pushed right with <code className="text-xs">offset</code>, per
|
|
13167
|
+
breakpoint. Same scanner-safe contract as SimpleGrid: every span and
|
|
13168
|
+
start maps to a literal class, so a dynamic{" "}
|
|
13169
|
+
<code className="text-xs">{"col-span-${n}"}</code> can never silently
|
|
13170
|
+
compile to nothing. No <code className="text-xs">order</code> prop by
|
|
13171
|
+
design — reading order always matches DOM order.
|
|
13172
|
+
</p>
|
|
13173
|
+
|
|
13174
|
+
<div>
|
|
13175
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13176
|
+
Spans — 12 / 6+6 / 4+4+4 / 3+9 with gap="sm".
|
|
13177
|
+
</p>
|
|
13178
|
+
<Grid gap="sm">
|
|
13179
|
+
<GridCol span={12}>{cell("12")}</GridCol>
|
|
13180
|
+
<GridCol span={6}>{cell("6")}</GridCol>
|
|
13181
|
+
<GridCol span={6}>{cell("6")}</GridCol>
|
|
13182
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13183
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13184
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13185
|
+
<GridCol span={3}>{cell("3")}</GridCol>
|
|
13186
|
+
<GridCol span={9}>{cell("9")}</GridCol>
|
|
13187
|
+
</Grid>
|
|
13188
|
+
</div>
|
|
13189
|
+
|
|
13190
|
+
<div>
|
|
13191
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13192
|
+
Offset — leading empty tracks via grid-column-start; a cell that no
|
|
13193
|
+
longer fits its row wraps to the next.
|
|
13194
|
+
</p>
|
|
13195
|
+
<Grid gap="sm">
|
|
13196
|
+
<GridCol span={4} offset={4}>
|
|
13197
|
+
{cell("span 4 · offset 4")}
|
|
13198
|
+
</GridCol>
|
|
13199
|
+
<GridCol span={3} offset={2}>
|
|
13200
|
+
{cell("span 3 · offset 2")}
|
|
13201
|
+
</GridCol>
|
|
13202
|
+
<GridCol span={5}>{cell("span 5")}</GridCol>
|
|
13203
|
+
<GridCol span={6} offset={6}>
|
|
13204
|
+
{cell("span 6 · offset 6")}
|
|
13205
|
+
</GridCol>
|
|
13206
|
+
</Grid>
|
|
13207
|
+
</div>
|
|
13208
|
+
|
|
13209
|
+
<div>
|
|
13210
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13211
|
+
Responsive — span={{ base: 12, md: 8 }} +
|
|
13212
|
+
{{ base: 12, md: 4 }}; quarters are base 6 → lg 3.
|
|
13213
|
+
Resize the window to watch the tracks reflow.
|
|
13214
|
+
</p>
|
|
13215
|
+
<Grid gap="md">
|
|
13216
|
+
<GridCol span={{ base: 12, md: 8 }}>{cell("main")}</GridCol>
|
|
13217
|
+
<GridCol span={{ base: 12, md: 4 }}>{cell("aside")}</GridCol>
|
|
13218
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13219
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13220
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13221
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13222
|
+
</Grid>
|
|
13223
|
+
</div>
|
|
13224
|
+
|
|
13225
|
+
<div>
|
|
13226
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13227
|
+
Realistic use — review detail (8) + reviewers aside (4), then four
|
|
13228
|
+
metric tiles (base 6 → lg 3).
|
|
13229
|
+
</p>
|
|
13230
|
+
<Grid gap="lg">
|
|
13231
|
+
<GridCol span={{ base: 12, lg: 8 }}>
|
|
13232
|
+
<Card>
|
|
13233
|
+
<CardHeader>
|
|
13234
|
+
<CardTitle>Tokens v2 proposal</CardTitle>
|
|
13235
|
+
<CardDescription>
|
|
13236
|
+
Jordan Reeves — review May 26, 2026
|
|
13237
|
+
</CardDescription>
|
|
13238
|
+
</CardHeader>
|
|
13239
|
+
<CardContent>
|
|
13240
|
+
<p className="text-sm text-muted-foreground">
|
|
13241
|
+
Consolidates the spacing scale to eight stops; retires four
|
|
13242
|
+
orphaned color tokens. Both CSS files regenerate from a
|
|
13243
|
+
single tokens.json change, and every fork picks it up on the
|
|
13244
|
+
next core bump.
|
|
13245
|
+
</p>
|
|
13246
|
+
</CardContent>
|
|
13247
|
+
</Card>
|
|
13248
|
+
</GridCol>
|
|
13249
|
+
<GridCol span={{ base: 12, lg: 4 }}>
|
|
13250
|
+
<Card>
|
|
13251
|
+
<CardHeader>
|
|
13252
|
+
<CardTitle>Reviewers</CardTitle>
|
|
13253
|
+
<CardDescription>Sign-off due 2026-05-26</CardDescription>
|
|
13254
|
+
</CardHeader>
|
|
13255
|
+
<CardContent>
|
|
13256
|
+
<ul className="space-y-2 text-sm">
|
|
13257
|
+
{[
|
|
13258
|
+
["Seo-yun Park", "Approved"],
|
|
13259
|
+
["Marcus Lindqvist", "Pending"],
|
|
13260
|
+
["Anika Patel", "Pending"],
|
|
13261
|
+
].map(([name, state]) => (
|
|
13262
|
+
<li key={name} className="flex justify-between gap-3">
|
|
13263
|
+
<span className="min-w-0 truncate">{name}</span>
|
|
13264
|
+
<span className="shrink-0 text-muted-foreground">
|
|
13265
|
+
{state}
|
|
13266
|
+
</span>
|
|
13267
|
+
</li>
|
|
13268
|
+
))}
|
|
13269
|
+
</ul>
|
|
13270
|
+
</CardContent>
|
|
13271
|
+
</Card>
|
|
13272
|
+
</GridCol>
|
|
13273
|
+
{[
|
|
13274
|
+
["Components", "36"],
|
|
13275
|
+
["Contrast floor", "7:1"],
|
|
13276
|
+
["Story coverage", "98.4%"],
|
|
13277
|
+
["Build hours avoided", "1,432"],
|
|
13278
|
+
].map(([label, value]) => (
|
|
13279
|
+
<GridCol key={label} span={{ base: 6, lg: 3 }}>
|
|
13280
|
+
<Card>
|
|
13281
|
+
<CardHeader>
|
|
13282
|
+
<CardDescription>{label}</CardDescription>
|
|
13283
|
+
<CardTitle className="text-2xl tabular-nums">{value}</CardTitle>
|
|
13284
|
+
</CardHeader>
|
|
13285
|
+
</Card>
|
|
13286
|
+
</GridCol>
|
|
13287
|
+
))}
|
|
13288
|
+
</Grid>
|
|
13289
|
+
</div>
|
|
13290
|
+
</div>
|
|
13291
|
+
);
|
|
13292
|
+
}
|