@behavioral-agentic-design-system/core 0.27.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/src/app/preview/components/page.tsx +771 -24
- 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/focus-trap.tsx +184 -0
- package/src/components/ui/index.ts +7 -0
- package/src/components/ui/mark.tsx +69 -0
- package/src/components/ui/rolling-number.tsx +200 -0
- package/src/components/ui/typing-indicator.tsx +2 -2
- package/src/components/ui/word-rotate.tsx +6 -1
- package/src/stories/AiBadge.stories.tsx +67 -0
- 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/FocusTrap.stories.tsx +218 -0
- package/src/stories/Mark.stories.tsx +84 -0
- package/src/stories/RollingNumber.stories.tsx +226 -0
- package/src/stories/TypingIndicator.stories.tsx +1 -0
- package/src/stories/WordRotate.stories.tsx +1 -0
|
@@ -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,
|
|
@@ -352,6 +361,12 @@ import { Highlight } from "@behavioral-agentic-design-system/core/components/ui/
|
|
|
352
361
|
import { Spoiler } from "@behavioral-agentic-design-system/core/components/ui/spoiler";
|
|
353
362
|
import { ActionBar } from "@behavioral-agentic-design-system/core/components/ui/action-bar";
|
|
354
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";
|
|
355
370
|
|
|
356
371
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
357
372
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -429,6 +444,47 @@ function Section({ title, children }: { title: string; children: React.ReactNode
|
|
|
429
444
|
);
|
|
430
445
|
}
|
|
431
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
|
+
|
|
432
488
|
function ToolbarFormattingDemo() {
|
|
433
489
|
const [bold, setBold] = React.useState(false);
|
|
434
490
|
const [italic, setItalic] = React.useState(false);
|
|
@@ -2814,25 +2870,27 @@ export default function ComponentsPreview() {
|
|
|
2814
2870
|
power-user accelerator on top of a designed search surface, not the
|
|
2815
2871
|
default search affordance.
|
|
2816
2872
|
</p>
|
|
2817
|
-
<
|
|
2818
|
-
<
|
|
2819
|
-
|
|
2820
|
-
<
|
|
2821
|
-
|
|
2822
|
-
<
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
<
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
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>
|
|
2836
2894
|
</Section>
|
|
2837
2895
|
|
|
2838
2896
|
<Section title="Sheet">
|
|
@@ -5257,6 +5315,66 @@ export default function ComponentsPreview() {
|
|
|
5257
5315
|
<Section title="WordRotate">
|
|
5258
5316
|
<WordRotateShowcase />
|
|
5259
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>
|
|
5260
5378
|
</div>
|
|
5261
5379
|
</div>
|
|
5262
5380
|
);
|
|
@@ -5582,7 +5700,11 @@ function BurgerShowcase() {
|
|
|
5582
5700
|
Realistic use — mobile top bar controlling a nav drawer
|
|
5583
5701
|
</p>
|
|
5584
5702
|
<div className="w-full max-w-sm rounded-lg border border-border">
|
|
5585
|
-
<header
|
|
5703
|
+
<header
|
|
5704
|
+
className={`flex items-center justify-between p-2 pl-4 ${
|
|
5705
|
+
navOpen ? "border-b border-border" : ""
|
|
5706
|
+
}`}
|
|
5707
|
+
>
|
|
5586
5708
|
<span className="text-sm font-semibold">BADS Docs</span>
|
|
5587
5709
|
<Burger
|
|
5588
5710
|
opened={navOpen}
|
|
@@ -5865,7 +5987,7 @@ function MeterStorageDemo() {
|
|
|
5865
5987
|
)
|
|
5866
5988
|
}
|
|
5867
5989
|
>
|
|
5868
|
-
Upload
|
|
5990
|
+
Upload batch (+2.4 GB)
|
|
5869
5991
|
</Button>
|
|
5870
5992
|
</CardContent>
|
|
5871
5993
|
</Card>
|
|
@@ -8103,7 +8225,8 @@ function TypingIndicatorShowcase() {
|
|
|
8103
8225
|
{/* Realistic chat UI */}
|
|
8104
8226
|
<div className="flex flex-col gap-2">
|
|
8105
8227
|
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Realistic use</p>
|
|
8106
|
-
<
|
|
8228
|
+
<Card className="max-w-sm">
|
|
8229
|
+
<CardContent className="p-4 flex flex-col gap-3">
|
|
8107
8230
|
{/* User message */}
|
|
8108
8231
|
<div className="flex justify-end">
|
|
8109
8232
|
<div className="max-w-[70%] rounded-2xl rounded-tr-sm bg-primary px-3 py-2 text-sm text-primary-foreground">
|
|
@@ -8139,7 +8262,8 @@ function TypingIndicatorShowcase() {
|
|
|
8139
8262
|
>
|
|
8140
8263
|
{phase === "typing" ? "Waiting…" : "Ask BADS"}
|
|
8141
8264
|
</Button>
|
|
8142
|
-
|
|
8265
|
+
</CardContent>
|
|
8266
|
+
</Card>
|
|
8143
8267
|
</div>
|
|
8144
8268
|
</div>
|
|
8145
8269
|
)
|
|
@@ -8176,7 +8300,8 @@ function WordRotateShowcase() {
|
|
|
8176
8300
|
</div>
|
|
8177
8301
|
<div className="space-y-2">
|
|
8178
8302
|
<p className="text-xs font-medium text-muted-foreground">Realistic use — marketing hero, 3 s interval</p>
|
|
8179
|
-
<
|
|
8303
|
+
<Card className="max-w-sm">
|
|
8304
|
+
<CardContent className="flex flex-col gap-4 p-6">
|
|
8180
8305
|
<h2 className="text-2xl font-bold text-card-foreground">
|
|
8181
8306
|
Ship{" "}
|
|
8182
8307
|
<WordRotate
|
|
@@ -8189,9 +8314,631 @@ function WordRotateShowcase() {
|
|
|
8189
8314
|
<p className="text-sm text-muted-foreground">
|
|
8190
8315
|
Jordan Reeves · design.bads.com · 88 registry components.
|
|
8191
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>
|
|
8192
8817
|
</div>
|
|
8193
8818
|
</div>
|
|
8194
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>
|
|
8195
8942
|
</div>
|
|
8196
8943
|
);
|
|
8197
8944
|
}
|