@behavioral-agentic-design-system/core 0.26.0 → 0.28.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 -4
- package/scripts/build-tokens.cjs +8 -0
- package/src/app/preview/components/page.tsx +1004 -22
- package/src/app/shell.tsx +17 -0
- package/src/components/ui/ai-badge.tsx +74 -0
- package/src/components/ui/chat-bubble.tsx +298 -0
- package/src/components/ui/clipboard.tsx +291 -0
- package/src/components/ui/copy-button.tsx +5 -1
- package/src/components/ui/data-table.tsx +388 -0
- package/src/components/ui/floating-action-button.tsx +179 -0
- package/src/components/ui/focus-trap.tsx +184 -0
- package/src/components/ui/index.ts +8 -0
- package/src/components/ui/mark.tsx +69 -0
- package/src/components/ui/meter.tsx +4 -4
- package/src/components/ui/rolling-number.tsx +200 -0
- package/src/components/ui/transfer-list.tsx +48 -13
- package/src/components/ui/typing-indicator.tsx +96 -0
- package/src/components/ui/word-rotate.tsx +87 -0
- package/src/data/docs-index.ts +1 -0
- package/src/stories/Affix.stories.tsx +1 -1
- package/src/stories/AiBadge.stories.tsx +67 -0
- package/src/stories/Anchor.stories.tsx +4 -4
- package/src/stories/ChatBubble.stories.tsx +222 -0
- package/src/stories/Clipboard.stories.tsx +136 -0
- package/src/stories/CopyButton.stories.tsx +2 -0
- package/src/stories/DataTable.stories.tsx +271 -0
- package/src/stories/FloatingActionButton.stories.tsx +215 -0
- package/src/stories/FocusTrap.stories.tsx +218 -0
- package/src/stories/Mark.stories.tsx +84 -0
- package/src/stories/Meter.stories.tsx +7 -0
- package/src/stories/RollingNumber.stories.tsx +226 -0
- package/src/stories/TransferList.stories.tsx +21 -0
- package/src/stories/TypingIndicator.stories.tsx +140 -0
- package/src/stories/WordRotate.stories.tsx +102 -0
- package/src/styles.css +8 -0
- package/src/tokens.json +1 -1
|
@@ -122,6 +122,13 @@ import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/sp
|
|
|
122
122
|
import { CircularProgress } from "@behavioral-agentic-design-system/core/components/ui/circular-progress";
|
|
123
123
|
import { Indicator } from "@behavioral-agentic-design-system/core/components/ui/indicator";
|
|
124
124
|
import { CopyButton } from "@behavioral-agentic-design-system/core/components/ui/copy-button";
|
|
125
|
+
import {
|
|
126
|
+
Clipboard,
|
|
127
|
+
ClipboardControl,
|
|
128
|
+
ClipboardInput,
|
|
129
|
+
ClipboardLabel,
|
|
130
|
+
ClipboardTrigger,
|
|
131
|
+
} from "@behavioral-agentic-design-system/core/components/ui/clipboard";
|
|
125
132
|
import { List, ListItem } from "@behavioral-agentic-design-system/core/components/ui/list";
|
|
126
133
|
import {
|
|
127
134
|
EmptyState,
|
|
@@ -176,6 +183,8 @@ import {
|
|
|
176
183
|
ChevronLeftIcon,
|
|
177
184
|
ChevronRightIcon,
|
|
178
185
|
ArrowUpIcon,
|
|
186
|
+
SmilePlus,
|
|
187
|
+
Reply,
|
|
179
188
|
} from "lucide-react";
|
|
180
189
|
import {
|
|
181
190
|
Menubar,
|
|
@@ -201,7 +210,10 @@ import {
|
|
|
201
210
|
HoverCardDescription,
|
|
202
211
|
HoverCardTrigger,
|
|
203
212
|
} from "@behavioral-agentic-design-system/core/components/ui/hover-card";
|
|
204
|
-
import { Sparkles, Info, CircleAlert, CalendarIcon, BuildingIcon, CheckIcon, CreditCardIcon, ClipboardCheckIcon, TrophyIcon, UserCheckIcon, XIcon, ZapIcon, StarIcon, ShieldCheckIcon, InboxIcon, WifiOffIcon, ClipboardListIcon, PlusIcon, HomeIcon, SearchIcon, LibraryIcon, PaletteIcon, UserIcon, BellIcon, BookOpenIcon, DownloadIcon, TriangleAlertIcon, CheckCircle2Icon, GitPullRequestIcon, MessageSquareIcon } from "lucide-react";
|
|
213
|
+
import { Sparkles, Info, CircleAlert, CalendarIcon, BuildingIcon, CheckIcon, CreditCardIcon, ClipboardCheckIcon, TrophyIcon, UserCheckIcon, XIcon, ZapIcon, StarIcon, ShieldCheckIcon, InboxIcon, WifiOffIcon, ClipboardListIcon, PlusIcon, HomeIcon, SearchIcon, LibraryIcon, PaletteIcon, UserIcon, BellIcon, BookOpenIcon, DownloadIcon, TriangleAlertIcon, CheckCircle2Icon, GitPullRequestIcon, MessageSquareIcon, PencilIcon } from "lucide-react";
|
|
214
|
+
import { FloatingActionButton } from "@behavioral-agentic-design-system/core/components/ui/floating-action-button";
|
|
215
|
+
import { TypingIndicator } from "@behavioral-agentic-design-system/core/components/ui/typing-indicator";
|
|
216
|
+
import { WordRotate } from "@behavioral-agentic-design-system/core/components/ui/word-rotate";
|
|
205
217
|
import {
|
|
206
218
|
BottomNavigation,
|
|
207
219
|
BottomNavigationItem,
|
|
@@ -349,6 +361,12 @@ import { Highlight } from "@behavioral-agentic-design-system/core/components/ui/
|
|
|
349
361
|
import { Spoiler } from "@behavioral-agentic-design-system/core/components/ui/spoiler";
|
|
350
362
|
import { ActionBar } from "@behavioral-agentic-design-system/core/components/ui/action-bar";
|
|
351
363
|
import { CheckboxCard, RadioCard } from "@behavioral-agentic-design-system/core/components/ui/checkbox-card";
|
|
364
|
+
import { Mark } from "@behavioral-agentic-design-system/core/components/ui/mark";
|
|
365
|
+
import { RollingNumber } from "@behavioral-agentic-design-system/core/components/ui/rolling-number";
|
|
366
|
+
import { AiBadge } from "@behavioral-agentic-design-system/core/components/ui/ai-badge";
|
|
367
|
+
import { ChatBubble, ChatBubbleAction, ChatBubbleActions, ChatBubbleAvatar, ChatBubbleMessage, ChatBubbleReadReceipt, ChatBubbleTimestamp, } from "@behavioral-agentic-design-system/core/components/ui/chat-bubble";
|
|
368
|
+
import { DataTable, type ColumnDef, } from "@behavioral-agentic-design-system/core/components/ui/data-table";
|
|
369
|
+
import { FocusTrap, FocusTrapInitialFocus, } from "@behavioral-agentic-design-system/core/components/ui/focus-trap";
|
|
352
370
|
|
|
353
371
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
354
372
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -426,6 +444,47 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
426
444
|
);
|
|
427
445
|
}
|
|
428
446
|
|
|
447
|
+
/**
|
|
448
|
+
* Defers mounting `children` until this slot scrolls into view. Used for the
|
|
449
|
+
* cmdk `<Command>` demo: cmdk auto-selects its first item on mount and calls
|
|
450
|
+
* `scrollIntoView({block:"nearest"})` on it, which scrolls EVERY ancestor up to
|
|
451
|
+
* the viewport — so an always-mounted Command far down this long page jumps the
|
|
452
|
+
* whole tab on load (corrections.md #012). Mounting it only once it's already
|
|
453
|
+
* on screen makes that scrollIntoView a no-op (the item is visible → nothing to
|
|
454
|
+
* scroll). Reserves `minHeight` before mount so the page layout doesn't jump.
|
|
455
|
+
*/
|
|
456
|
+
function InViewMount({
|
|
457
|
+
children,
|
|
458
|
+
minHeight,
|
|
459
|
+
}: {
|
|
460
|
+
children: React.ReactNode;
|
|
461
|
+
minHeight: number;
|
|
462
|
+
}) {
|
|
463
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
464
|
+
const [shown, setShown] = React.useState(false);
|
|
465
|
+
React.useEffect(() => {
|
|
466
|
+
if (shown) return;
|
|
467
|
+
const el = ref.current;
|
|
468
|
+
if (!el) return;
|
|
469
|
+
const io = new IntersectionObserver(
|
|
470
|
+
(entries) => {
|
|
471
|
+
if (entries.some((e) => e.isIntersecting)) {
|
|
472
|
+
setShown(true);
|
|
473
|
+
io.disconnect();
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
{ rootMargin: "100px" }
|
|
477
|
+
);
|
|
478
|
+
io.observe(el);
|
|
479
|
+
return () => io.disconnect();
|
|
480
|
+
}, [shown]);
|
|
481
|
+
return (
|
|
482
|
+
<div ref={ref} style={shown ? undefined : { minHeight }}>
|
|
483
|
+
{shown ? children : null}
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
429
488
|
function ToolbarFormattingDemo() {
|
|
430
489
|
const [bold, setBold] = React.useState(false);
|
|
431
490
|
const [italic, setItalic] = React.useState(false);
|
|
@@ -2811,25 +2870,27 @@ export default function ComponentsPreview() {
|
|
|
2811
2870
|
power-user accelerator on top of a designed search surface, not the
|
|
2812
2871
|
default search affordance.
|
|
2813
2872
|
</p>
|
|
2814
|
-
<
|
|
2815
|
-
<
|
|
2816
|
-
|
|
2817
|
-
<
|
|
2818
|
-
|
|
2819
|
-
<
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
<
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2873
|
+
<InViewMount minHeight={340}>
|
|
2874
|
+
<Command className="max-w-md rounded-lg border shadow-sm">
|
|
2875
|
+
<CommandInput placeholder="Type a command or search…" />
|
|
2876
|
+
<CommandList>
|
|
2877
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
2878
|
+
<CommandGroup heading="Quick actions">
|
|
2879
|
+
<CommandItem>
|
|
2880
|
+
Open changelog <CommandShortcut>⌘1</CommandShortcut>
|
|
2881
|
+
</CommandItem>
|
|
2882
|
+
<CommandItem>View releases</CommandItem>
|
|
2883
|
+
<CommandItem>Adoption report</CommandItem>
|
|
2884
|
+
</CommandGroup>
|
|
2885
|
+
<CommandSeparator />
|
|
2886
|
+
<CommandGroup heading="Components">
|
|
2887
|
+
<CommandItem>Button</CommandItem>
|
|
2888
|
+
<CommandItem>Data Table</CommandItem>
|
|
2889
|
+
<CommandItem>Combobox</CommandItem>
|
|
2890
|
+
</CommandGroup>
|
|
2891
|
+
</CommandList>
|
|
2892
|
+
</Command>
|
|
2893
|
+
</InViewMount>
|
|
2833
2894
|
</Section>
|
|
2834
2895
|
|
|
2835
2896
|
<Section title="Sheet">
|
|
@@ -5245,6 +5306,75 @@ export default function ComponentsPreview() {
|
|
|
5245
5306
|
<Section title="Signature Pad">
|
|
5246
5307
|
<SignaturePadShowcase />
|
|
5247
5308
|
</Section>
|
|
5309
|
+
<Section title="Floating Action Button">
|
|
5310
|
+
<FloatingActionButtonShowcase />
|
|
5311
|
+
</Section>
|
|
5312
|
+
<Section title="Typing Indicator">
|
|
5313
|
+
<TypingIndicatorShowcase />
|
|
5314
|
+
</Section>
|
|
5315
|
+
<Section title="WordRotate">
|
|
5316
|
+
<WordRotateShowcase />
|
|
5317
|
+
</Section>
|
|
5318
|
+
<Section title="Clipboard">
|
|
5319
|
+
<ClipboardShowcase />
|
|
5320
|
+
</Section>
|
|
5321
|
+
|
|
5322
|
+
<Section title="Chat Bubble">
|
|
5323
|
+
<ChatBubbleShowcase />
|
|
5324
|
+
</Section>
|
|
5325
|
+
|
|
5326
|
+
<Section title="Data Table">
|
|
5327
|
+
<DataTableShowcase />
|
|
5328
|
+
</Section>
|
|
5329
|
+
|
|
5330
|
+
<Section title="Mark">
|
|
5331
|
+
<MarkShowcase />
|
|
5332
|
+
</Section>
|
|
5333
|
+
|
|
5334
|
+
<Section title="FocusTrap">
|
|
5335
|
+
<FocusTrapShowcase />
|
|
5336
|
+
</Section>
|
|
5337
|
+
|
|
5338
|
+
<Section title="Rolling Number">
|
|
5339
|
+
<RollingNumberShowcase />
|
|
5340
|
+
</Section>
|
|
5341
|
+
|
|
5342
|
+
<Section title="AI Badge">
|
|
5343
|
+
<p className="text-sm text-muted-foreground">
|
|
5344
|
+
The canonical disclosure for AI-generated content. Announces
|
|
5345
|
+
“AI-generated content” to assistive tech via{" "}
|
|
5346
|
+
<code className="font-mono">aria-label</code> even when the visible
|
|
5347
|
+
text is just “AI”, so the Transparency floor’s{" "}
|
|
5348
|
+
<code className="font-mono">[AI]</code>-labeling rule is a real,
|
|
5349
|
+
accessible component rather than a hand-typed string. Recognized by{" "}
|
|
5350
|
+
<code className="font-mono">lint:ai-label</code>.
|
|
5351
|
+
</p>
|
|
5352
|
+
<div className="flex flex-col gap-6">
|
|
5353
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
5354
|
+
<AiBadge />
|
|
5355
|
+
<AiBadge variant="solid" />
|
|
5356
|
+
<AiBadge variant="outline" />
|
|
5357
|
+
</div>
|
|
5358
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
5359
|
+
<AiBadge size="sm" />
|
|
5360
|
+
<AiBadge size="default" />
|
|
5361
|
+
<AiBadge showIcon={false} />
|
|
5362
|
+
<AiBadge>AI summary</AiBadge>
|
|
5363
|
+
</div>
|
|
5364
|
+
<div className="max-w-sm space-y-2 rounded-lg border border-border bg-card p-4">
|
|
5365
|
+
<div className="flex items-center gap-2">
|
|
5366
|
+
<span className="text-sm font-semibold text-foreground">
|
|
5367
|
+
Weekly recap
|
|
5368
|
+
</span>
|
|
5369
|
+
<AiBadge size="sm" />
|
|
5370
|
+
</div>
|
|
5371
|
+
<p className="text-sm text-muted-foreground">
|
|
5372
|
+
Deploys were up 18% this week, with the mail service accounting
|
|
5373
|
+
for most of the increase. No incidents were reported.
|
|
5374
|
+
</p>
|
|
5375
|
+
</div>
|
|
5376
|
+
</div>
|
|
5377
|
+
</Section>
|
|
5248
5378
|
</div>
|
|
5249
5379
|
</div>
|
|
5250
5380
|
);
|
|
@@ -5570,7 +5700,11 @@ function BurgerShowcase() {
|
|
|
5570
5700
|
Realistic use — mobile top bar controlling a nav drawer
|
|
5571
5701
|
</p>
|
|
5572
5702
|
<div className="w-full max-w-sm rounded-lg border border-border">
|
|
5573
|
-
<header
|
|
5703
|
+
<header
|
|
5704
|
+
className={`flex items-center justify-between p-2 pl-4 ${
|
|
5705
|
+
navOpen ? "border-b border-border" : ""
|
|
5706
|
+
}`}
|
|
5707
|
+
>
|
|
5574
5708
|
<span className="text-sm font-semibold">BADS Docs</span>
|
|
5575
5709
|
<Burger
|
|
5576
5710
|
opened={navOpen}
|
|
@@ -5853,7 +5987,7 @@ function MeterStorageDemo() {
|
|
|
5853
5987
|
)
|
|
5854
5988
|
}
|
|
5855
5989
|
>
|
|
5856
|
-
Upload
|
|
5990
|
+
Upload batch (+2.4 GB)
|
|
5857
5991
|
</Button>
|
|
5858
5992
|
</CardContent>
|
|
5859
5993
|
</Card>
|
|
@@ -7960,3 +8094,851 @@ function TimerShowcase() {
|
|
|
7960
8094
|
</div>
|
|
7961
8095
|
);
|
|
7962
8096
|
}
|
|
8097
|
+
|
|
8098
|
+
function FloatingActionButtonShowcase() {
|
|
8099
|
+
/**
|
|
8100
|
+
* FABs are `position: fixed`, so each demo lives inside a frame with
|
|
8101
|
+
* `position: relative; overflow: hidden` PLUS `transform: translateZ(0)`.
|
|
8102
|
+
* The transform makes the frame the containing block for fixed descendants
|
|
8103
|
+
* (relative alone does NOT contain `fixed`), and overflow-hidden keeps the
|
|
8104
|
+
* pinned button from escaping the showcase section onto the page viewport.
|
|
8105
|
+
*/
|
|
8106
|
+
const Frame = ({
|
|
8107
|
+
caption,
|
|
8108
|
+
children,
|
|
8109
|
+
tall,
|
|
8110
|
+
}: {
|
|
8111
|
+
caption: React.ReactNode;
|
|
8112
|
+
children: React.ReactNode;
|
|
8113
|
+
tall?: boolean;
|
|
8114
|
+
}) => (
|
|
8115
|
+
<div className="space-y-2">
|
|
8116
|
+
<p className="text-xs font-medium text-muted-foreground">{caption}</p>
|
|
8117
|
+
<div
|
|
8118
|
+
// lint-disable: card-bypass — needs [transform:translateZ(0)] to confine position:fixed FAB children; Card doesn't expose that CSS prop
|
|
8119
|
+
className={`relative ${tall ? "h-52" : "h-40"} overflow-hidden rounded-lg border bg-card [transform:translateZ(0)]`}
|
|
8120
|
+
>
|
|
8121
|
+
<div className="p-4">
|
|
8122
|
+
<p className="text-sm text-muted-foreground">
|
|
8123
|
+
The frame stands in for the viewport.
|
|
8124
|
+
</p>
|
|
8125
|
+
</div>
|
|
8126
|
+
{children}
|
|
8127
|
+
</div>
|
|
8128
|
+
</div>
|
|
8129
|
+
);
|
|
8130
|
+
|
|
8131
|
+
return (
|
|
8132
|
+
<div className="space-y-6">
|
|
8133
|
+
<p className="text-sm text-muted-foreground">
|
|
8134
|
+
Fixed-position circular button for the ONE primary action of a surface
|
|
8135
|
+
— the single-action counterpart to SpeedDial. Wraps Button (focus
|
|
8136
|
+
ring, loading, disabled inherited); md is the 56px thumb-target
|
|
8137
|
+
convention; icon-only form requires{" "}
|
|
8138
|
+
<code className="font-mono">aria-label</code>. Entrance zoom/fade and
|
|
8139
|
+
the shadow lift ride the motion tokens and collapse under
|
|
8140
|
+
reduced-motion.
|
|
8141
|
+
</p>
|
|
8142
|
+
<div className="grid gap-6 lg:grid-cols-2">
|
|
8143
|
+
<Frame caption="Default — primary, bottom-right, md (56px)">
|
|
8144
|
+
<FloatingActionButton
|
|
8145
|
+
icon={<PlusIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8146
|
+
aria-label="Create new"
|
|
8147
|
+
/>
|
|
8148
|
+
</Frame>
|
|
8149
|
+
<Frame caption="Extended — visible label is the accessible name">
|
|
8150
|
+
<FloatingActionButton
|
|
8151
|
+
icon={<PencilIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8152
|
+
label="New review"
|
|
8153
|
+
/>
|
|
8154
|
+
</Frame>
|
|
8155
|
+
<Frame caption="Secondary variant — support chat, bottom-left">
|
|
8156
|
+
<FloatingActionButton
|
|
8157
|
+
variant="secondary"
|
|
8158
|
+
corner="bottom-left"
|
|
8159
|
+
icon={<MessageSquareIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8160
|
+
aria-label="Open support chat"
|
|
8161
|
+
/>
|
|
8162
|
+
</Frame>
|
|
8163
|
+
<Frame
|
|
8164
|
+
tall
|
|
8165
|
+
caption="Sizes — sm 40px (below the 44px floor: dense secondary chrome only), md 56px, lg 64px"
|
|
8166
|
+
>
|
|
8167
|
+
<FloatingActionButton
|
|
8168
|
+
size="sm"
|
|
8169
|
+
variant="secondary"
|
|
8170
|
+
corner="top-left"
|
|
8171
|
+
icon={<PlusIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8172
|
+
aria-label="Add token (compact)"
|
|
8173
|
+
/>
|
|
8174
|
+
<FloatingActionButton
|
|
8175
|
+
size="md"
|
|
8176
|
+
corner="bottom-left"
|
|
8177
|
+
icon={<PlusIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8178
|
+
aria-label="Create new"
|
|
8179
|
+
/>
|
|
8180
|
+
<FloatingActionButton
|
|
8181
|
+
size="lg"
|
|
8182
|
+
icon={<PlusIcon strokeWidth={1.5} aria-hidden="true" />}
|
|
8183
|
+
aria-label="Create new (large)"
|
|
8184
|
+
/>
|
|
8185
|
+
</Frame>
|
|
8186
|
+
</div>
|
|
8187
|
+
</div>
|
|
8188
|
+
);
|
|
8189
|
+
}
|
|
8190
|
+
|
|
8191
|
+
function TypingIndicatorShowcase() {
|
|
8192
|
+
const [phase, setPhase] = React.useState<"idle" | "typing" | "done">("idle")
|
|
8193
|
+
const [response, setResponse] = React.useState("")
|
|
8194
|
+
|
|
8195
|
+
const handleSend = () => {
|
|
8196
|
+
setPhase("typing")
|
|
8197
|
+
setResponse("")
|
|
8198
|
+
setTimeout(() => {
|
|
8199
|
+
setPhase("done")
|
|
8200
|
+
setResponse("Here are three options for animated numbers: RollingNumber (odometer), Timer (countdown), and FormatNumber (static locale). Pick based on whether the value changes live.")
|
|
8201
|
+
}, 2600)
|
|
8202
|
+
}
|
|
8203
|
+
|
|
8204
|
+
return (
|
|
8205
|
+
<div className="flex flex-col gap-6 w-full">
|
|
8206
|
+
{/* Sizes */}
|
|
8207
|
+
<div className="flex flex-col gap-2">
|
|
8208
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Sizes</p>
|
|
8209
|
+
<div className="flex items-center gap-4">
|
|
8210
|
+
<div className="flex flex-col items-start gap-1">
|
|
8211
|
+
<TypingIndicator size="sm" />
|
|
8212
|
+
<span className="text-xs text-muted-foreground">sm</span>
|
|
8213
|
+
</div>
|
|
8214
|
+
<div className="flex flex-col items-start gap-1">
|
|
8215
|
+
<TypingIndicator size="default" />
|
|
8216
|
+
<span className="text-xs text-muted-foreground">default</span>
|
|
8217
|
+
</div>
|
|
8218
|
+
<div className="flex flex-col items-start gap-1">
|
|
8219
|
+
<TypingIndicator size="lg" />
|
|
8220
|
+
<span className="text-xs text-muted-foreground">lg</span>
|
|
8221
|
+
</div>
|
|
8222
|
+
</div>
|
|
8223
|
+
</div>
|
|
8224
|
+
|
|
8225
|
+
{/* Realistic chat UI */}
|
|
8226
|
+
<div className="flex flex-col gap-2">
|
|
8227
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Realistic use</p>
|
|
8228
|
+
<Card className="max-w-sm">
|
|
8229
|
+
<CardContent className="p-4 flex flex-col gap-3">
|
|
8230
|
+
{/* User message */}
|
|
8231
|
+
<div className="flex justify-end">
|
|
8232
|
+
<div className="max-w-[70%] rounded-2xl rounded-tr-sm bg-primary px-3 py-2 text-sm text-primary-foreground">
|
|
8233
|
+
Which component for animated numbers?
|
|
8234
|
+
</div>
|
|
8235
|
+
</div>
|
|
8236
|
+
|
|
8237
|
+
{/* Assistant area */}
|
|
8238
|
+
<div className="flex items-end gap-2 min-h-[36px]">
|
|
8239
|
+
<Avatar size="sm" className="shrink-0">
|
|
8240
|
+
<AvatarFallback>B</AvatarFallback>
|
|
8241
|
+
</Avatar>
|
|
8242
|
+
<div>
|
|
8243
|
+
{phase === "idle" && (
|
|
8244
|
+
<p className="text-sm text-muted-foreground">Click "Ask BADS" to see the typing indicator.</p>
|
|
8245
|
+
)}
|
|
8246
|
+
{phase === "typing" && (
|
|
8247
|
+
<TypingIndicator label="BADS assistant is typing" />
|
|
8248
|
+
)}
|
|
8249
|
+
{phase === "done" && (
|
|
8250
|
+
<div className="rounded-2xl rounded-tl-sm bg-muted px-3 py-2 text-sm">
|
|
8251
|
+
{response}
|
|
8252
|
+
</div>
|
|
8253
|
+
)}
|
|
8254
|
+
</div>
|
|
8255
|
+
</div>
|
|
8256
|
+
|
|
8257
|
+
<Button
|
|
8258
|
+
size="xl"
|
|
8259
|
+
onClick={handleSend}
|
|
8260
|
+
disabled={phase === "typing"}
|
|
8261
|
+
className="w-full"
|
|
8262
|
+
>
|
|
8263
|
+
{phase === "typing" ? "Waiting…" : "Ask BADS"}
|
|
8264
|
+
</Button>
|
|
8265
|
+
</CardContent>
|
|
8266
|
+
</Card>
|
|
8267
|
+
</div>
|
|
8268
|
+
</div>
|
|
8269
|
+
)
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
function WordRotateShowcase() {
|
|
8273
|
+
return (
|
|
8274
|
+
<div className="space-y-6">
|
|
8275
|
+
<p className="text-sm text-muted-foreground">
|
|
8276
|
+
Cycles an array of words in place with a slide-fade exit/entrance. Zero
|
|
8277
|
+
dependencies — pure CSS transitions keyed to{" "}
|
|
8278
|
+
<code className="text-xs">var(--duration-base)</code>. Announced via{" "}
|
|
8279
|
+
<code className="text-xs">aria-live="polite"</code> on each swap.
|
|
8280
|
+
Reduced-motion safe via the base layer.
|
|
8281
|
+
</p>
|
|
8282
|
+
<div className="space-y-8">
|
|
8283
|
+
<div className="space-y-2">
|
|
8284
|
+
<p className="text-xs font-medium text-muted-foreground">Default — 2 s interval in a heading</p>
|
|
8285
|
+
<p className="text-2xl font-semibold text-foreground">
|
|
8286
|
+
Design systems that are{" "}
|
|
8287
|
+
<WordRotate words={["accessible", "beautiful", "consistent"]} />
|
|
8288
|
+
</p>
|
|
8289
|
+
</div>
|
|
8290
|
+
<div className="space-y-2">
|
|
8291
|
+
<p className="text-xs font-medium text-muted-foreground">Branded colour — status rotation, 1 s interval</p>
|
|
8292
|
+
<p className="text-2xl font-semibold text-foreground">
|
|
8293
|
+
Status:{" "}
|
|
8294
|
+
<WordRotate
|
|
8295
|
+
words={["building", "testing", "shipping"]}
|
|
8296
|
+
interval={1000}
|
|
8297
|
+
className="text-primary"
|
|
8298
|
+
/>
|
|
8299
|
+
</p>
|
|
8300
|
+
</div>
|
|
8301
|
+
<div className="space-y-2">
|
|
8302
|
+
<p className="text-xs font-medium text-muted-foreground">Realistic use — marketing hero, 3 s interval</p>
|
|
8303
|
+
<Card className="max-w-sm">
|
|
8304
|
+
<CardContent className="flex flex-col gap-4 p-6">
|
|
8305
|
+
<h2 className="text-2xl font-bold text-card-foreground">
|
|
8306
|
+
Ship{" "}
|
|
8307
|
+
<WordRotate
|
|
8308
|
+
words={["faster", "smarter", "cleaner"]}
|
|
8309
|
+
interval={3000}
|
|
8310
|
+
className="text-primary"
|
|
8311
|
+
/>
|
|
8312
|
+
{" "}with every client.
|
|
8313
|
+
</h2>
|
|
8314
|
+
<p className="text-sm text-muted-foreground">
|
|
8315
|
+
Jordan Reeves · design.bads.com · 88 registry components.
|
|
8316
|
+
</p>
|
|
8317
|
+
</CardContent>
|
|
8318
|
+
</Card>
|
|
8319
|
+
</div>
|
|
8320
|
+
</div>
|
|
8321
|
+
</div>
|
|
8322
|
+
);
|
|
8323
|
+
}
|
|
8324
|
+
|
|
8325
|
+
function ClipboardShowcase() {
|
|
8326
|
+
return (
|
|
8327
|
+
<div className="space-y-6">
|
|
8328
|
+
<p className="text-sm text-muted-foreground">
|
|
8329
|
+
Compound clipboard widget — the copyable value renders inline as a
|
|
8330
|
+
read-only, select-on-focus input beside a copy trigger. The trigger
|
|
8331
|
+
composes <code className="text-xs">CopyButton</code>, so clicking it
|
|
8332
|
+
writes to the clipboard, swaps Copy → Check, and announces
|
|
8333
|
+
"Copied to clipboard" via{" "}
|
|
8334
|
+
<code className="text-xs">aria-live="polite"</code>. Long
|
|
8335
|
+
values truncate with the full string preserved in{" "}
|
|
8336
|
+
<code className="text-xs">title</code>. Distinct from CopyButton,
|
|
8337
|
+
which copies without displaying the value.
|
|
8338
|
+
</p>
|
|
8339
|
+
|
|
8340
|
+
{/* Default */}
|
|
8341
|
+
<div className="flex flex-col gap-2">
|
|
8342
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Default</p>
|
|
8343
|
+
<div className="max-w-md">
|
|
8344
|
+
<Clipboard value="pk_live_5K8mN2qR7tLwYjAb4cDeFgHi">
|
|
8345
|
+
<ClipboardControl>
|
|
8346
|
+
<ClipboardInput />
|
|
8347
|
+
<ClipboardTrigger />
|
|
8348
|
+
</ClipboardControl>
|
|
8349
|
+
</Clipboard>
|
|
8350
|
+
</div>
|
|
8351
|
+
</div>
|
|
8352
|
+
|
|
8353
|
+
{/* With label */}
|
|
8354
|
+
<div className="flex flex-col gap-2">
|
|
8355
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">With label</p>
|
|
8356
|
+
<div className="max-w-md">
|
|
8357
|
+
<Clipboard value="https://design.bads.com/share/tokens-v2-proposal">
|
|
8358
|
+
<ClipboardLabel>Share link</ClipboardLabel>
|
|
8359
|
+
<ClipboardControl>
|
|
8360
|
+
<ClipboardInput />
|
|
8361
|
+
<ClipboardTrigger>Copy link</ClipboardTrigger>
|
|
8362
|
+
</ClipboardControl>
|
|
8363
|
+
</Clipboard>
|
|
8364
|
+
</div>
|
|
8365
|
+
</div>
|
|
8366
|
+
|
|
8367
|
+
{/* Long value truncation */}
|
|
8368
|
+
<div className="flex flex-col gap-2">
|
|
8369
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Long value — truncates, full string on hover</p>
|
|
8370
|
+
<div className="max-w-sm">
|
|
8371
|
+
<Clipboard value="https://design.bads.com/docs/getting-started?utm_source=onboarding&utm_campaign=client-fork-2026&session=jordan.reeves">
|
|
8372
|
+
<ClipboardLabel>Onboarding link</ClipboardLabel>
|
|
8373
|
+
<ClipboardControl>
|
|
8374
|
+
<ClipboardInput />
|
|
8375
|
+
<ClipboardTrigger size="icon-xl" aria-label="Copy onboarding link" />
|
|
8376
|
+
</ClipboardControl>
|
|
8377
|
+
</Clipboard>
|
|
8378
|
+
</div>
|
|
8379
|
+
</div>
|
|
8380
|
+
|
|
8381
|
+
{/* Disabled */}
|
|
8382
|
+
<div className="flex flex-col gap-2">
|
|
8383
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Disabled</p>
|
|
8384
|
+
<div className="max-w-md">
|
|
8385
|
+
<Clipboard value="pk_live_5K8mN2qR7tLwYjAb4cDeFgHi" disabled>
|
|
8386
|
+
<ClipboardLabel>API key</ClipboardLabel>
|
|
8387
|
+
<ClipboardControl>
|
|
8388
|
+
<ClipboardInput />
|
|
8389
|
+
<ClipboardTrigger />
|
|
8390
|
+
</ClipboardControl>
|
|
8391
|
+
</Clipboard>
|
|
8392
|
+
</div>
|
|
8393
|
+
</div>
|
|
8394
|
+
|
|
8395
|
+
{/* Realistic use */}
|
|
8396
|
+
<div className="flex flex-col gap-2">
|
|
8397
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Realistic use</p>
|
|
8398
|
+
<Card className="max-w-md">
|
|
8399
|
+
<CardHeader>
|
|
8400
|
+
<CardTitle>API keys</CardTitle>
|
|
8401
|
+
<CardDescription>
|
|
8402
|
+
Authenticate requests from jordan@reeves.design's workspace.
|
|
8403
|
+
Keep the secret key server-side.
|
|
8404
|
+
</CardDescription>
|
|
8405
|
+
</CardHeader>
|
|
8406
|
+
<CardContent className="flex flex-col gap-6">
|
|
8407
|
+
<Clipboard value="pk_live_5K8mN2qR7tLwYjAb4cDeFgHi">
|
|
8408
|
+
<ClipboardLabel>Publishable key</ClipboardLabel>
|
|
8409
|
+
<ClipboardControl>
|
|
8410
|
+
<ClipboardInput />
|
|
8411
|
+
<ClipboardTrigger />
|
|
8412
|
+
</ClipboardControl>
|
|
8413
|
+
</Clipboard>
|
|
8414
|
+
<Clipboard value="sk-proj-Xk9mNpQ2vR7tLwYjAb4cDeFgHiJkLmNo">
|
|
8415
|
+
<ClipboardLabel>Secret key</ClipboardLabel>
|
|
8416
|
+
<ClipboardControl>
|
|
8417
|
+
<ClipboardInput />
|
|
8418
|
+
<ClipboardTrigger />
|
|
8419
|
+
</ClipboardControl>
|
|
8420
|
+
</Clipboard>
|
|
8421
|
+
</CardContent>
|
|
8422
|
+
</Card>
|
|
8423
|
+
</div>
|
|
8424
|
+
</div>
|
|
8425
|
+
);
|
|
8426
|
+
}
|
|
8427
|
+
|
|
8428
|
+
function ChatBubbleShowcase() {
|
|
8429
|
+
// Real content from content/personas/bads.json — primary persona names
|
|
8430
|
+
// (Jordan Reeves, Seo-yun Park) + design-system chatter from the jargon /
|
|
8431
|
+
// notifications / urls pools.
|
|
8432
|
+
return (
|
|
8433
|
+
<div className="space-y-8">
|
|
8434
|
+
<p className="text-sm text-muted-foreground">
|
|
8435
|
+
Styled message bubble for chat/messaging surfaces — sent (bg-primary)
|
|
8436
|
+
and received (bg-muted) variants with the classic flattened tail
|
|
8437
|
+
corner, a live-region typing indicator, timestamps, read receipts
|
|
8438
|
+
(triple-encoded: icon shape + color + sr-only text), and
|
|
8439
|
+
hover-revealed actions that also reveal on keyboard focus. The
|
|
8440
|
+
conversation container is the consumer's job:{" "}
|
|
8441
|
+
<code className="font-mono">role="log"</code> on a
|
|
8442
|
+
scrollable element.
|
|
8443
|
+
</p>
|
|
8444
|
+
|
|
8445
|
+
<div>
|
|
8446
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
8447
|
+
Conversation thread — sent + received with avatar
|
|
8448
|
+
</p>
|
|
8449
|
+
<div
|
|
8450
|
+
role="log"
|
|
8451
|
+
aria-label="Conversation with Seo-yun Park"
|
|
8452
|
+
className="flex w-full max-w-md flex-col gap-3 rounded-lg border bg-background p-4"
|
|
8453
|
+
>
|
|
8454
|
+
<ChatBubble position="received">
|
|
8455
|
+
<ChatBubbleAvatar fallback="SP" />
|
|
8456
|
+
<ChatBubbleMessage>
|
|
8457
|
+
Just pushed the tokens v2 proposal — can you look before standup?
|
|
8458
|
+
design.bads.com/share/tokens-v2-proposal
|
|
8459
|
+
</ChatBubbleMessage>
|
|
8460
|
+
</ChatBubble>
|
|
8461
|
+
<ChatBubble position="sent">
|
|
8462
|
+
<ChatBubbleMessage>
|
|
8463
|
+
On it. Did the semantic layer change touch --muted-foreground?
|
|
8464
|
+
</ChatBubbleMessage>
|
|
8465
|
+
</ChatBubble>
|
|
8466
|
+
<ChatBubble position="received">
|
|
8467
|
+
<ChatBubbleAvatar fallback="SP" />
|
|
8468
|
+
<ChatBubbleMessage>
|
|
8469
|
+
Yes — nudged it for the 7:1 floor. All 36 components still pass
|
|
8470
|
+
AAA contrast, wcag:audit is green.
|
|
8471
|
+
</ChatBubbleMessage>
|
|
8472
|
+
</ChatBubble>
|
|
8473
|
+
<ChatBubble position="sent">
|
|
8474
|
+
<div className="flex min-w-0 flex-col items-end gap-1">
|
|
8475
|
+
<ChatBubbleMessage>
|
|
8476
|
+
Token changes saved. Running pnpm build:tokens now.
|
|
8477
|
+
</ChatBubbleMessage>
|
|
8478
|
+
<span className="flex items-center gap-1">
|
|
8479
|
+
<ChatBubbleTimestamp timestamp="10:42 AM" />
|
|
8480
|
+
<ChatBubbleReadReceipt status="read" />
|
|
8481
|
+
</span>
|
|
8482
|
+
</div>
|
|
8483
|
+
</ChatBubble>
|
|
8484
|
+
</div>
|
|
8485
|
+
</div>
|
|
8486
|
+
|
|
8487
|
+
<div>
|
|
8488
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
8489
|
+
Typing indicator — role=status, aria-live=polite, dots rest static
|
|
8490
|
+
under reduced motion
|
|
8491
|
+
</p>
|
|
8492
|
+
<ChatBubble position="received">
|
|
8493
|
+
<ChatBubbleAvatar fallback="JR" />
|
|
8494
|
+
<ChatBubbleMessage variant="typing" />
|
|
8495
|
+
</ChatBubble>
|
|
8496
|
+
</div>
|
|
8497
|
+
|
|
8498
|
+
<div>
|
|
8499
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
8500
|
+
Read receipt states — icon shape + color + sr-only text, never color
|
|
8501
|
+
alone
|
|
8502
|
+
</p>
|
|
8503
|
+
<div className="flex flex-col gap-3">
|
|
8504
|
+
<ChatBubble position="sent">
|
|
8505
|
+
<div className="flex min-w-0 flex-col items-end gap-1">
|
|
8506
|
+
<ChatBubbleMessage>
|
|
8507
|
+
Story coverage check passed — all components have matching
|
|
8508
|
+
stories.
|
|
8509
|
+
</ChatBubbleMessage>
|
|
8510
|
+
<span className="flex items-center gap-1">
|
|
8511
|
+
<ChatBubbleTimestamp timestamp="10:38 AM" />
|
|
8512
|
+
<ChatBubbleReadReceipt status="sent" />
|
|
8513
|
+
</span>
|
|
8514
|
+
</div>
|
|
8515
|
+
</ChatBubble>
|
|
8516
|
+
<ChatBubble position="sent">
|
|
8517
|
+
<div className="flex min-w-0 flex-col items-end gap-1">
|
|
8518
|
+
<ChatBubbleMessage>
|
|
8519
|
+
Orphan-token lint came back clean on the quarterly sweep.
|
|
8520
|
+
</ChatBubbleMessage>
|
|
8521
|
+
<span className="flex items-center gap-1">
|
|
8522
|
+
<ChatBubbleTimestamp timestamp="10:40 AM" />
|
|
8523
|
+
<ChatBubbleReadReceipt status="delivered" />
|
|
8524
|
+
</span>
|
|
8525
|
+
</div>
|
|
8526
|
+
</ChatBubble>
|
|
8527
|
+
<ChatBubble position="sent">
|
|
8528
|
+
<div className="flex min-w-0 flex-col items-end gap-1">
|
|
8529
|
+
<ChatBubbleMessage>
|
|
8530
|
+
Merging the focus-ring offset fix — 2px across every
|
|
8531
|
+
interactive component.
|
|
8532
|
+
</ChatBubbleMessage>
|
|
8533
|
+
<span className="flex items-center gap-1">
|
|
8534
|
+
<ChatBubbleTimestamp timestamp="10:41 AM" />
|
|
8535
|
+
<ChatBubbleReadReceipt status="read" />
|
|
8536
|
+
</span>
|
|
8537
|
+
</div>
|
|
8538
|
+
</ChatBubble>
|
|
8539
|
+
</div>
|
|
8540
|
+
</div>
|
|
8541
|
+
|
|
8542
|
+
<div>
|
|
8543
|
+
<p className="mb-3 text-xs text-muted-foreground">
|
|
8544
|
+
Hover actions — hidden until row hover or keyboard focus-within;
|
|
8545
|
+
44×44 ghost buttons with required aria-labels
|
|
8546
|
+
</p>
|
|
8547
|
+
<ChatBubble position="received">
|
|
8548
|
+
<ChatBubbleAvatar fallback="SP" />
|
|
8549
|
+
<ChatBubbleMessage>
|
|
8550
|
+
The token pipeline paid for itself in a week. One tokens.json
|
|
8551
|
+
change, both CSS files regenerate, every fork picks it up.
|
|
8552
|
+
</ChatBubbleMessage>
|
|
8553
|
+
<ChatBubbleActions>
|
|
8554
|
+
<ChatBubbleAction
|
|
8555
|
+
icon={<SmilePlus strokeWidth={1.5} className="size-5" />}
|
|
8556
|
+
label="React to message"
|
|
8557
|
+
/>
|
|
8558
|
+
<ChatBubbleAction
|
|
8559
|
+
icon={<Reply strokeWidth={1.5} className="size-5" />}
|
|
8560
|
+
label="Reply to message"
|
|
8561
|
+
/>
|
|
8562
|
+
</ChatBubbleActions>
|
|
8563
|
+
</ChatBubble>
|
|
8564
|
+
</div>
|
|
8565
|
+
</div>
|
|
8566
|
+
);
|
|
8567
|
+
}
|
|
8568
|
+
|
|
8569
|
+
type ShowcaseAdoptionStatus = "Stable" | "Beta" | "New";
|
|
8570
|
+
|
|
8571
|
+
interface ShowcaseComponentRow {
|
|
8572
|
+
component: string;
|
|
8573
|
+
status: ShowcaseAdoptionStatus;
|
|
8574
|
+
adopters: number;
|
|
8575
|
+
coverage: string;
|
|
8576
|
+
lastUpdated: string;
|
|
8577
|
+
}
|
|
8578
|
+
|
|
8579
|
+
const SHOWCASE_TABLE_DATA: ShowcaseComponentRow[] = [
|
|
8580
|
+
{ component: "Button", status: "Stable", adopters: 14, coverage: "100%", lastUpdated: "2026-07-28" },
|
|
8581
|
+
{ component: "Input", status: "Stable", adopters: 13, coverage: "98%", lastUpdated: "2026-07-22" },
|
|
8582
|
+
{ component: "Card", status: "Stable", adopters: 12, coverage: "95%", lastUpdated: "2026-07-15" },
|
|
8583
|
+
{ component: "Dialog", status: "Stable", adopters: 11, coverage: "91%", lastUpdated: "2026-07-10" },
|
|
8584
|
+
{ component: "DataTable", status: "New", adopters: 1, coverage: "12%", lastUpdated: "2026-08-03" },
|
|
8585
|
+
{ component: "Slider", status: "Beta", adopters: 4, coverage: "42%", lastUpdated: "2026-06-05" },
|
|
8586
|
+
{ component: "Calendar", status: "Beta", adopters: 3, coverage: "38%", lastUpdated: "2026-06-02" },
|
|
8587
|
+
];
|
|
8588
|
+
|
|
8589
|
+
const STATUS_BADGE_MAP: Record<ShowcaseAdoptionStatus, "default" | "secondary" | "outline"> = {
|
|
8590
|
+
Stable: "default",
|
|
8591
|
+
Beta: "secondary",
|
|
8592
|
+
New: "outline",
|
|
8593
|
+
};
|
|
8594
|
+
|
|
8595
|
+
const SHOWCASE_TABLE_COLUMNS: ColumnDef<ShowcaseComponentRow>[] = [
|
|
8596
|
+
{ accessorKey: "component", header: "Component" },
|
|
8597
|
+
{
|
|
8598
|
+
accessorKey: "status",
|
|
8599
|
+
header: "Status",
|
|
8600
|
+
cell: ({ row }) => {
|
|
8601
|
+
const status = row.getValue<ShowcaseAdoptionStatus>("status");
|
|
8602
|
+
return (
|
|
8603
|
+
<Badge variant={STATUS_BADGE_MAP[status]} className="text-xs">
|
|
8604
|
+
{status}
|
|
8605
|
+
</Badge>
|
|
8606
|
+
);
|
|
8607
|
+
},
|
|
8608
|
+
},
|
|
8609
|
+
{
|
|
8610
|
+
accessorKey: "adopters",
|
|
8611
|
+
header: "Adopters",
|
|
8612
|
+
cell: ({ row }) => (
|
|
8613
|
+
<span className="tabular-nums">{row.getValue<number>("adopters")}</span>
|
|
8614
|
+
),
|
|
8615
|
+
},
|
|
8616
|
+
{
|
|
8617
|
+
accessorKey: "coverage",
|
|
8618
|
+
header: "Coverage",
|
|
8619
|
+
cell: ({ row }) => (
|
|
8620
|
+
<span className="tabular-nums font-medium">{row.getValue<string>("coverage")}</span>
|
|
8621
|
+
),
|
|
8622
|
+
},
|
|
8623
|
+
{ accessorKey: "lastUpdated", header: "Last Updated" },
|
|
8624
|
+
];
|
|
8625
|
+
|
|
8626
|
+
|
|
8627
|
+
function DataTableShowcase() {
|
|
8628
|
+
return (
|
|
8629
|
+
<div className="space-y-6">
|
|
8630
|
+
<p className="text-sm text-muted-foreground">
|
|
8631
|
+
Wraps @tanstack/react-table with a declarative{" "}
|
|
8632
|
+
<code className="font-mono">columns + data</code> API. Sorting is on
|
|
8633
|
+
by default — click any column header. Pairs with{" "}
|
|
8634
|
+
<code className="font-mono">pagination</code> and{" "}
|
|
8635
|
+
<code className="font-mono">rowSelection</code> props for full grid
|
|
8636
|
+
functionality. Two density variants: comfortable (default) and dense.
|
|
8637
|
+
</p>
|
|
8638
|
+
<DataTable
|
|
8639
|
+
columns={SHOWCASE_TABLE_COLUMNS}
|
|
8640
|
+
data={SHOWCASE_TABLE_DATA}
|
|
8641
|
+
sorting={true}
|
|
8642
|
+
pagination={{ pageSize: 5 }}
|
|
8643
|
+
rowSelection={true}
|
|
8644
|
+
/>
|
|
8645
|
+
</div>
|
|
8646
|
+
);
|
|
8647
|
+
}
|
|
8648
|
+
|
|
8649
|
+
function MarkShowcase() {
|
|
8650
|
+
return (
|
|
8651
|
+
<div className="space-y-6">
|
|
8652
|
+
<p className="text-sm text-muted-foreground">
|
|
8653
|
+
Semantic <code className="font-mono text-xs">{"<mark>"}</code> wrapper for editorial
|
|
8654
|
+
inline emphasis — the static counterpart to Highlight (which dynamically marks
|
|
8655
|
+
search-query matches). Use when an author intentionally annotates a phrase as
|
|
8656
|
+
relevant. Display-only: no interaction, no focus, no motion.
|
|
8657
|
+
</p>
|
|
8658
|
+
<div className="grid gap-6 lg:grid-cols-2">
|
|
8659
|
+
<div className="space-y-2">
|
|
8660
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8661
|
+
Default — pale amber wash (physical-highlighter register)
|
|
8662
|
+
</p>
|
|
8663
|
+
<p className="text-base leading-relaxed">
|
|
8664
|
+
The most important constraint is{" "}
|
|
8665
|
+
<Mark>token discipline</Mark> — every color, spacing, and
|
|
8666
|
+
border radius traces back to a single authoritative source.
|
|
8667
|
+
</p>
|
|
8668
|
+
</div>
|
|
8669
|
+
<div className="space-y-2">
|
|
8670
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8671
|
+
Primary variant — branded or navigational emphasis
|
|
8672
|
+
</p>
|
|
8673
|
+
<p className="text-base leading-relaxed">
|
|
8674
|
+
Use <Mark variant="primary">primary tint</Mark> when the
|
|
8675
|
+
emphasis should associate with the product's core action
|
|
8676
|
+
or identity.
|
|
8677
|
+
</p>
|
|
8678
|
+
</div>
|
|
8679
|
+
<div className="space-y-2">
|
|
8680
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8681
|
+
Secondary variant — neutral, non-semantic annotation
|
|
8682
|
+
</p>
|
|
8683
|
+
<p className="text-base leading-relaxed">
|
|
8684
|
+
A <Mark variant="secondary">secondary surface mark</Mark>{" "}
|
|
8685
|
+
works for glossary terms or callouts where color association
|
|
8686
|
+
isn't the goal.
|
|
8687
|
+
</p>
|
|
8688
|
+
</div>
|
|
8689
|
+
<div className="space-y-2">
|
|
8690
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8691
|
+
Multiple marks — pale wash stays legible in context
|
|
8692
|
+
</p>
|
|
8693
|
+
<p className="text-base leading-relaxed">
|
|
8694
|
+
<Mark>Night Shift</Mark> runs daily at 06:00 CDT: audits
|
|
8695
|
+
the system, builds <Mark>three components</Mark>, and posts
|
|
8696
|
+
a brief to <Mark variant="primary">#bads</Mark>.
|
|
8697
|
+
</p>
|
|
8698
|
+
</div>
|
|
8699
|
+
</div>
|
|
8700
|
+
</div>
|
|
8701
|
+
);
|
|
8702
|
+
}
|
|
8703
|
+
|
|
8704
|
+
function FocusTrapShowcase() {
|
|
8705
|
+
const [open, setOpen] = React.useState(false);
|
|
8706
|
+
const [withInitial, setWithInitial] = React.useState(false);
|
|
8707
|
+
|
|
8708
|
+
return (
|
|
8709
|
+
<div className="space-y-6">
|
|
8710
|
+
<p className="text-sm text-muted-foreground">
|
|
8711
|
+
Standalone focus-containment utility. Traps Tab/Shift+Tab within its
|
|
8712
|
+
children while <code className="font-mono text-xs">active</code>, and
|
|
8713
|
+
calls <code className="font-mono text-xs">onEscapeKeyDown</code> on
|
|
8714
|
+
Escape. Use when a custom overlay or panel needs WCAG 2.1.2-compliant
|
|
8715
|
+
focus containment without the full Dialog/Sheet weight. Zero
|
|
8716
|
+
dependencies.
|
|
8717
|
+
</p>
|
|
8718
|
+
<div className="grid gap-6 lg:grid-cols-2">
|
|
8719
|
+
<div className="space-y-3">
|
|
8720
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8721
|
+
Default — Tab cycles within, Escape closes
|
|
8722
|
+
</p>
|
|
8723
|
+
<Button size="sm" onClick={() => setOpen(true)} disabled={open}>
|
|
8724
|
+
Open trapped form
|
|
8725
|
+
</Button>
|
|
8726
|
+
{open && (
|
|
8727
|
+
<FocusTrap
|
|
8728
|
+
active
|
|
8729
|
+
onEscapeKeyDown={() => setOpen(false)}
|
|
8730
|
+
className="rounded-lg border bg-card p-4 shadow-sm"
|
|
8731
|
+
>
|
|
8732
|
+
<div role="dialog" aria-modal="true" aria-labelledby="ft-showcase-title">
|
|
8733
|
+
<p id="ft-showcase-title" className="mb-3 text-sm font-medium">
|
|
8734
|
+
Focus is trapped here
|
|
8735
|
+
</p>
|
|
8736
|
+
<div className="flex gap-2">
|
|
8737
|
+
<Button size="sm" onClick={() => setOpen(false)}>Save</Button>
|
|
8738
|
+
<Button size="sm" variant="outline" onClick={() => setOpen(false)}>
|
|
8739
|
+
Cancel
|
|
8740
|
+
</Button>
|
|
8741
|
+
</div>
|
|
8742
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
8743
|
+
Tab cycles · Escape closes
|
|
8744
|
+
</p>
|
|
8745
|
+
</div>
|
|
8746
|
+
</FocusTrap>
|
|
8747
|
+
)}
|
|
8748
|
+
</div>
|
|
8749
|
+
<div className="space-y-3">
|
|
8750
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8751
|
+
FocusTrapInitialFocus — Cancel gets initial focus (not Confirm)
|
|
8752
|
+
</p>
|
|
8753
|
+
<Button size="sm" variant="outline" onClick={() => setWithInitial(true)} disabled={withInitial}>
|
|
8754
|
+
Remove item
|
|
8755
|
+
</Button>
|
|
8756
|
+
{withInitial && (
|
|
8757
|
+
<FocusTrap
|
|
8758
|
+
active
|
|
8759
|
+
onEscapeKeyDown={() => setWithInitial(false)}
|
|
8760
|
+
className="rounded-lg border border-destructive/40 bg-card p-4 shadow-sm"
|
|
8761
|
+
>
|
|
8762
|
+
<div role="dialog" aria-modal="true" aria-labelledby="fti-title">
|
|
8763
|
+
<p id="fti-title" className="mb-3 text-sm font-medium text-foreground">
|
|
8764
|
+
Remove this item permanently?
|
|
8765
|
+
</p>
|
|
8766
|
+
<div className="flex gap-2">
|
|
8767
|
+
<Button variant="destructive" size="sm" onClick={() => setWithInitial(false)}>
|
|
8768
|
+
Confirm
|
|
8769
|
+
</Button>
|
|
8770
|
+
<FocusTrapInitialFocus />
|
|
8771
|
+
<Button size="sm" variant="outline" onClick={() => setWithInitial(false)}>
|
|
8772
|
+
Cancel (initial focus)
|
|
8773
|
+
</Button>
|
|
8774
|
+
</div>
|
|
8775
|
+
</div>
|
|
8776
|
+
</FocusTrap>
|
|
8777
|
+
)}
|
|
8778
|
+
</div>
|
|
8779
|
+
</div>
|
|
8780
|
+
</div>
|
|
8781
|
+
);
|
|
8782
|
+
}
|
|
8783
|
+
|
|
8784
|
+
function RollingNumberShowcase() {
|
|
8785
|
+
const [revenue, setRevenue] = React.useState(142830);
|
|
8786
|
+
const [users, setUsers] = React.useState(8471);
|
|
8787
|
+
const [rate, setRate] = React.useState(94.0);
|
|
8788
|
+
|
|
8789
|
+
return (
|
|
8790
|
+
<div className="space-y-8">
|
|
8791
|
+
<p className="text-sm text-muted-foreground">
|
|
8792
|
+
Animated digit counter — each digit independently scrolls (odometer style)
|
|
8793
|
+
when the value changes. Token-driven motion via{" "}
|
|
8794
|
+
<code className="font-mono">var(--duration-base)</code> +{" "}
|
|
8795
|
+
<code className="font-mono">var(--ease-spring)</code>. Reduced-motion users
|
|
8796
|
+
see an instant swap. Use for KPI milestones and live stat counters — not for
|
|
8797
|
+
values updating faster than ~1s.
|
|
8798
|
+
</p>
|
|
8799
|
+
|
|
8800
|
+
<div className="space-y-2">
|
|
8801
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8802
|
+
Default — integer counter, click to animate
|
|
8803
|
+
</p>
|
|
8804
|
+
<div className="flex items-center gap-4">
|
|
8805
|
+
<RollingNumber value={revenue} className="text-4xl font-bold" />
|
|
8806
|
+
<div className="flex gap-2">
|
|
8807
|
+
<Button
|
|
8808
|
+
size="xl"
|
|
8809
|
+
variant="outline"
|
|
8810
|
+
onClick={() => setRevenue((v) => Math.max(0, v - 1111))}
|
|
8811
|
+
>
|
|
8812
|
+
−1,111
|
|
8813
|
+
</Button>
|
|
8814
|
+
<Button size="xl" onClick={() => setRevenue((v) => v + 1111)}>
|
|
8815
|
+
+1,111
|
|
8816
|
+
</Button>
|
|
8817
|
+
</div>
|
|
8818
|
+
</div>
|
|
8819
|
+
</div>
|
|
8820
|
+
|
|
8821
|
+
<div className="space-y-2">
|
|
8822
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8823
|
+
Currency — prefix="$", thousandSeparator=","
|
|
8824
|
+
</p>
|
|
8825
|
+
<RollingNumber
|
|
8826
|
+
value={revenue}
|
|
8827
|
+
prefix="$"
|
|
8828
|
+
thousandSeparator=","
|
|
8829
|
+
className="text-3xl font-semibold"
|
|
8830
|
+
/>
|
|
8831
|
+
</div>
|
|
8832
|
+
|
|
8833
|
+
<div className="space-y-2">
|
|
8834
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8835
|
+
Percentage — suffix="%", decimalScale=1, fixedDecimalScale
|
|
8836
|
+
</p>
|
|
8837
|
+
<div className="flex items-center gap-4">
|
|
8838
|
+
<RollingNumber
|
|
8839
|
+
value={rate}
|
|
8840
|
+
suffix="%"
|
|
8841
|
+
decimalScale={1}
|
|
8842
|
+
fixedDecimalScale
|
|
8843
|
+
className="text-3xl font-bold"
|
|
8844
|
+
/>
|
|
8845
|
+
<div className="flex gap-2">
|
|
8846
|
+
<Button
|
|
8847
|
+
size="xl"
|
|
8848
|
+
variant="outline"
|
|
8849
|
+
onClick={() =>
|
|
8850
|
+
setRate((v) =>
|
|
8851
|
+
Math.max(0, parseFloat((v - 2.3).toFixed(1)))
|
|
8852
|
+
)
|
|
8853
|
+
}
|
|
8854
|
+
>
|
|
8855
|
+
−2.3
|
|
8856
|
+
</Button>
|
|
8857
|
+
<Button
|
|
8858
|
+
size="xl"
|
|
8859
|
+
onClick={() =>
|
|
8860
|
+
setRate((v) =>
|
|
8861
|
+
Math.min(100, parseFloat((v + 2.3).toFixed(1)))
|
|
8862
|
+
)
|
|
8863
|
+
}
|
|
8864
|
+
>
|
|
8865
|
+
+2.3
|
|
8866
|
+
</Button>
|
|
8867
|
+
</div>
|
|
8868
|
+
</div>
|
|
8869
|
+
</div>
|
|
8870
|
+
|
|
8871
|
+
<div className="space-y-2">
|
|
8872
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
8873
|
+
Realistic use — KPI dashboard. “Simulate update” animates all
|
|
8874
|
+
three counters simultaneously.
|
|
8875
|
+
</p>
|
|
8876
|
+
<div className="grid grid-cols-3 gap-4 max-w-xl">
|
|
8877
|
+
<Card>
|
|
8878
|
+
<CardHeader className="pb-2">
|
|
8879
|
+
<CardDescription>Monthly Revenue</CardDescription>
|
|
8880
|
+
</CardHeader>
|
|
8881
|
+
<CardContent>
|
|
8882
|
+
<RollingNumber
|
|
8883
|
+
value={revenue}
|
|
8884
|
+
prefix="$"
|
|
8885
|
+
thousandSeparator=","
|
|
8886
|
+
className="text-2xl font-bold"
|
|
8887
|
+
/>
|
|
8888
|
+
</CardContent>
|
|
8889
|
+
</Card>
|
|
8890
|
+
<Card>
|
|
8891
|
+
<CardHeader className="pb-2">
|
|
8892
|
+
<CardDescription>Active Users</CardDescription>
|
|
8893
|
+
</CardHeader>
|
|
8894
|
+
<CardContent>
|
|
8895
|
+
<RollingNumber
|
|
8896
|
+
value={users}
|
|
8897
|
+
thousandSeparator=","
|
|
8898
|
+
className="text-2xl font-bold"
|
|
8899
|
+
/>
|
|
8900
|
+
</CardContent>
|
|
8901
|
+
</Card>
|
|
8902
|
+
<Card>
|
|
8903
|
+
<CardHeader className="pb-2">
|
|
8904
|
+
<CardDescription>Uptime</CardDescription>
|
|
8905
|
+
</CardHeader>
|
|
8906
|
+
<CardContent>
|
|
8907
|
+
<RollingNumber
|
|
8908
|
+
value={rate}
|
|
8909
|
+
suffix="%"
|
|
8910
|
+
decimalScale={1}
|
|
8911
|
+
fixedDecimalScale
|
|
8912
|
+
className="text-2xl font-bold"
|
|
8913
|
+
/>
|
|
8914
|
+
</CardContent>
|
|
8915
|
+
</Card>
|
|
8916
|
+
</div>
|
|
8917
|
+
<div className="flex gap-2 max-w-xl">
|
|
8918
|
+
<Button
|
|
8919
|
+
size="xl"
|
|
8920
|
+
className="flex-1"
|
|
8921
|
+
onClick={() => {
|
|
8922
|
+
setRevenue((v) => v + 4200 + Math.floor(v * 0.02));
|
|
8923
|
+
setUsers((v) => v + 38);
|
|
8924
|
+
setRate((v) => Math.min(99.9, parseFloat((v + 0.1).toFixed(1))));
|
|
8925
|
+
}}
|
|
8926
|
+
>
|
|
8927
|
+
Simulate update
|
|
8928
|
+
</Button>
|
|
8929
|
+
<Button
|
|
8930
|
+
size="xl"
|
|
8931
|
+
variant="ghost"
|
|
8932
|
+
onClick={() => {
|
|
8933
|
+
setRevenue(142830);
|
|
8934
|
+
setUsers(8471);
|
|
8935
|
+
setRate(94.0);
|
|
8936
|
+
}}
|
|
8937
|
+
>
|
|
8938
|
+
Reset
|
|
8939
|
+
</Button>
|
|
8940
|
+
</div>
|
|
8941
|
+
</div>
|
|
8942
|
+
</div>
|
|
8943
|
+
);
|
|
8944
|
+
}
|