@behavioral-agentic-design-system/core 0.39.1 → 0.42.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/README.md +2 -0
- package/package.json +26 -5
- package/scripts/a11y-lint.cjs +88 -8
- package/scripts/bads-components.mjs +118 -0
- package/scripts/build-tokens.cjs +133 -12
- package/scripts/check-stories.mjs +1 -1
- package/scripts/health-report.mjs +16 -2
- package/scripts/lint-component-source.mjs +100 -0
- package/scripts/lint-microanimation.mjs +267 -0
- package/scripts/lint-slop.mjs +25 -1
- package/scripts/size-audit.cjs +79 -0
- package/scripts/source-of-truth.cjs +58 -0
- package/scripts/ux-smoke.mjs +438 -0
- package/scripts/wcag-audit.cjs +121 -6
- package/src/api/layers/file.ts +1 -0
- package/src/app/opengraph-image.tsx +5 -0
- package/src/app/preview/components/page.tsx +2237 -2
- package/src/app/shell.tsx +17 -16
- package/src/components/Foundations/Motion.stories.tsx +1 -0
- package/src/components/customize/brand-mark-section.tsx +4 -2
- package/src/components/customize/design-controls.tsx +17 -2
- package/src/components/customize/discipline-section.tsx +3 -6
- 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 +7 -4
- package/src/components/home-tab.tsx +3 -0
- package/src/components/studio/studio.tsx +153 -0
- package/src/components/ui/accordion.tsx +7 -0
- package/src/components/ui/alert.tsx +1 -0
- package/src/components/ui/anchor.tsx +37 -3
- package/src/components/ui/announcement-bar.tsx +256 -0
- package/src/components/ui/attachment.tsx +211 -0
- package/src/components/ui/badge.tsx +1 -0
- package/src/components/ui/callout.tsx +218 -0
- package/src/components/ui/chart.tsx +5 -14
- package/src/components/ui/code.tsx +1 -1
- package/src/components/ui/color-picker.tsx +2 -2
- package/src/components/ui/format-relative-time.tsx +139 -0
- package/src/components/ui/gauge-chart.tsx +238 -0
- package/src/components/ui/grid.tsx +255 -0
- package/src/components/ui/heatmap.tsx +256 -0
- package/src/components/ui/icon.tsx +108 -0
- package/src/components/ui/index.ts +17 -0
- package/src/components/ui/infinite-scroll.tsx +103 -0
- package/src/components/ui/json-input.tsx +351 -0
- package/src/components/ui/navigation-progress.tsx +281 -0
- package/src/components/ui/number-input.tsx +1 -4
- package/src/components/ui/page-header.tsx +63 -0
- package/src/components/ui/password-input.tsx +2 -1
- package/src/components/ui/password-strength-input.tsx +288 -0
- package/src/components/ui/pill.tsx +140 -0
- package/src/components/ui/popover.tsx +27 -4
- 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/scroll-progress.tsx +100 -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/snackbar.tsx +393 -0
- package/src/components/ui/sortable-list.tsx +342 -0
- package/src/components/ui/sparkline.tsx +2 -14
- package/src/components/ui/squircle.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/textarea.tsx +28 -1
- package/src/components/ui/tour.tsx +1 -3
- package/src/data/docs-index.ts +25 -0
- package/src/hooks/use-reduced-motion.ts +6 -0
- package/src/lib/clamp.ts +2 -0
- package/src/stories/Accordion.stories.tsx +59 -0
- package/src/stories/Alert.stories.tsx +3 -1
- package/src/stories/Anchor.stories.tsx +54 -0
- package/src/stories/AnnouncementBar.stories.tsx +261 -0
- package/src/stories/Attachment.stories.tsx +189 -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 +8 -0
- package/src/stories/Code.stories.tsx +1 -0
- package/src/stories/ColorPicker.stories.tsx +24 -0
- package/src/stories/FormatRelativeTime.stories.tsx +116 -0
- package/src/stories/GaugeChart.stories.tsx +163 -0
- package/src/stories/Grid.stories.tsx +197 -0
- package/src/stories/Heatmap.stories.tsx +172 -0
- package/src/stories/Icon.stories.tsx +175 -0
- package/src/stories/InfiniteScroll.stories.tsx +225 -0
- package/src/stories/JsonInput.stories.tsx +212 -0
- package/src/stories/MultiSelect.stories.tsx +1 -1
- package/src/stories/NavigationProgress.stories.tsx +159 -0
- package/src/stories/NumberInput.stories.tsx +1 -0
- package/src/stories/PageHeader.stories.tsx +102 -0
- package/src/stories/PasswordInput.stories.tsx +4 -0
- package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
- package/src/stories/Pill.stories.tsx +201 -0
- package/src/stories/Popover.stories.tsx +29 -1
- package/src/stories/Portal.stories.tsx +191 -0
- package/src/stories/Presence.stories.tsx +228 -0
- package/src/stories/ProgressStack.stories.tsx +287 -0
- package/src/stories/ScrollProgress.stories.tsx +117 -0
- package/src/stories/Select.stories.tsx +25 -0
- package/src/stories/Separator.stories.tsx +3 -0
- package/src/stories/Slider.stories.tsx +54 -5
- package/src/stories/Snackbar.stories.tsx +315 -0
- package/src/stories/SortableList.stories.tsx +263 -0
- package/src/stories/Sparkline.stories.tsx +3 -0
- package/src/stories/Squircle.stories.tsx +1 -0
- package/src/stories/Table.stories.tsx +1 -0
- package/src/stories/Textarea.stories.tsx +18 -0
- package/src/stories/Tour.stories.tsx +1 -0
- package/src/stories/story-groups.json +26 -6
- package/src/styles.css +133 -12
- package/LICENSE +0 -21
|
@@ -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 {
|
|
@@ -33,7 +34,6 @@ import {
|
|
|
33
34
|
InputGroupInput,
|
|
34
35
|
InputGroupAddon,
|
|
35
36
|
InputGroupText,
|
|
36
|
-
InputGroupButton,
|
|
37
37
|
} from "@behavioral-agentic-design-system/core/components/ui/input-group";
|
|
38
38
|
import {
|
|
39
39
|
Fieldset,
|
|
@@ -259,6 +259,7 @@ import { MotionToggle } from "@behavioral-agentic-design-system/core/components/
|
|
|
259
259
|
import { Timeline, TimelineItem } from "@behavioral-agentic-design-system/core/components/ui/timeline";
|
|
260
260
|
import { TagsInput } from "@behavioral-agentic-design-system/core/components/ui/tags-input";
|
|
261
261
|
import { Tag } from "@behavioral-agentic-design-system/core/components/ui/tag";
|
|
262
|
+
import { Pill, PillGroup } from "@behavioral-agentic-design-system/core/components/ui/pill";
|
|
262
263
|
import { Autocomplete } from "@behavioral-agentic-design-system/core/components/ui/autocomplete";
|
|
263
264
|
import { TimePicker } from "@behavioral-agentic-design-system/core/components/ui/time-picker";
|
|
264
265
|
import { VisuallyHidden } from "@behavioral-agentic-design-system/core/components/ui/visually-hidden";
|
|
@@ -355,7 +356,7 @@ import {
|
|
|
355
356
|
SheetTitle,
|
|
356
357
|
SheetTrigger,
|
|
357
358
|
} from "@behavioral-agentic-design-system/core/components/ui/sheet";
|
|
358
|
-
import {
|
|
359
|
+
import { MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search, Archive as ArchiveIcon, Trash2 as Trash2Icon } from "lucide-react";
|
|
359
360
|
import {
|
|
360
361
|
Tree,
|
|
361
362
|
TreeItem,
|
|
@@ -416,9 +417,45 @@ 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 { GaugeChart } from "@behavioral-agentic-design-system/core/components/ui/gauge-chart";
|
|
431
|
+
import { PasswordStrengthInput } from "@behavioral-agentic-design-system/core/components/ui/password-strength-input";
|
|
432
|
+
import { InfiniteScroll } from "@behavioral-agentic-design-system/core/components/ui/infinite-scroll";
|
|
433
|
+
import { ScrollProgress } from "@behavioral-agentic-design-system/core/components/ui/scroll-progress";
|
|
434
|
+
import {
|
|
435
|
+
SnackbarProvider,
|
|
436
|
+
useSnackbar,
|
|
437
|
+
SNACKBAR_ANCHORS,
|
|
438
|
+
type SnackbarAnchor,
|
|
439
|
+
} from "@behavioral-agentic-design-system/core/components/ui/snackbar";
|
|
440
|
+
import {
|
|
441
|
+
Archive as SnackbarArchiveIcon,
|
|
442
|
+
CircleCheck as SnackbarCheckIcon,
|
|
443
|
+
Send as SnackbarSendIcon,
|
|
444
|
+
} from "lucide-react";
|
|
445
|
+
import { Callout } from "@behavioral-agentic-design-system/core/components/ui/callout";
|
|
446
|
+
import { AnnouncementBar } from "@behavioral-agentic-design-system/core/components/ui/announcement-bar";
|
|
447
|
+
import { JsonInput } from "@behavioral-agentic-design-system/core/components/ui/json-input";
|
|
448
|
+
import { SortableList, type SortableItem } from "@behavioral-agentic-design-system/core/components/ui/sortable-list";
|
|
449
|
+
import { Heatmap } from "@behavioral-agentic-design-system/core/components/ui/heatmap";
|
|
450
|
+
import {
|
|
451
|
+
NavigationProgress,
|
|
452
|
+
useNavigationProgress,
|
|
453
|
+
} from "@behavioral-agentic-design-system/core/components/ui/navigation-progress";
|
|
454
|
+
import { Attachment } from "@behavioral-agentic-design-system/core/components/ui/attachment";
|
|
455
|
+
import {
|
|
456
|
+
Paperclip as AttachmentPaperclipIcon,
|
|
457
|
+
SendHorizontal as AttachmentSendIcon,
|
|
458
|
+
} from "lucide-react";
|
|
422
459
|
|
|
423
460
|
// Stable, deterministic data for ScrollArea — never use Math.random in
|
|
424
461
|
// SSR-rendered output, it causes hydration mismatches.
|
|
@@ -1013,6 +1050,24 @@ export default function ComponentsPreview() {
|
|
|
1013
1050
|
{ value: 100, label: "High" },
|
|
1014
1051
|
]}
|
|
1015
1052
|
/>
|
|
1053
|
+
<Label className="pt-3">Slider with value label</Label>
|
|
1054
|
+
<Slider
|
|
1055
|
+
defaultValue={[120, 375]}
|
|
1056
|
+
min={0}
|
|
1057
|
+
max={500}
|
|
1058
|
+
step={5}
|
|
1059
|
+
aria-label="Retainer range"
|
|
1060
|
+
valueLabel="always"
|
|
1061
|
+
valueLabelFormat={(v) => `$${v}`}
|
|
1062
|
+
/>
|
|
1063
|
+
<Slider
|
|
1064
|
+
defaultValue={[62]}
|
|
1065
|
+
max={100}
|
|
1066
|
+
step={1}
|
|
1067
|
+
aria-label="Volume"
|
|
1068
|
+
valueLabel="auto"
|
|
1069
|
+
valueLabelFormat={(v) => `${v}%`}
|
|
1070
|
+
/>
|
|
1016
1071
|
<Label className="pt-3">Progress</Label>
|
|
1017
1072
|
<Progress value={62} aria-label="Progress" />
|
|
1018
1073
|
<Label className="pt-3">Progress sizes</Label>
|
|
@@ -3243,6 +3298,14 @@ export default function ComponentsPreview() {
|
|
|
3243
3298
|
</div>
|
|
3244
3299
|
</PopoverContent>
|
|
3245
3300
|
</Popover>
|
|
3301
|
+
<Popover>
|
|
3302
|
+
<PopoverTrigger asChild>
|
|
3303
|
+
<Button variant="outline" size="sm">With arrow</Button>
|
|
3304
|
+
</PopoverTrigger>
|
|
3305
|
+
<PopoverContent showArrow className="w-56">
|
|
3306
|
+
<p className="text-sm">Arrow caret pointing at the trigger. Matches popover border and background.</p>
|
|
3307
|
+
</PopoverContent>
|
|
3308
|
+
</Popover>
|
|
3246
3309
|
</div>
|
|
3247
3310
|
</Section>
|
|
3248
3311
|
|
|
@@ -6272,6 +6335,9 @@ export default function ComponentsPreview() {
|
|
|
6272
6335
|
<Section title="SearchInput">
|
|
6273
6336
|
<SearchInputShowcase />
|
|
6274
6337
|
</Section>
|
|
6338
|
+
<Section title="FormatRelativeTime">
|
|
6339
|
+
<FormatRelativeTimeShowcase />
|
|
6340
|
+
</Section>
|
|
6275
6341
|
<Section title="FormatDate">
|
|
6276
6342
|
<FormatDateShowcase />
|
|
6277
6343
|
</Section>
|
|
@@ -6281,6 +6347,63 @@ export default function ComponentsPreview() {
|
|
|
6281
6347
|
<Section title="Sparkline">
|
|
6282
6348
|
<SparklineShowcase />
|
|
6283
6349
|
</Section>
|
|
6350
|
+
<Section title="PageHeader">
|
|
6351
|
+
<PageHeaderShowcase />
|
|
6352
|
+
</Section>
|
|
6353
|
+
<Section title="Presence">
|
|
6354
|
+
<PresenceShowcase />
|
|
6355
|
+
</Section>
|
|
6356
|
+
<Section title="Portal">
|
|
6357
|
+
<PortalShowcase />
|
|
6358
|
+
</Section>
|
|
6359
|
+
<Section title="Icon">
|
|
6360
|
+
<IconShowcase />
|
|
6361
|
+
</Section>
|
|
6362
|
+
<Section title="ProgressStack">
|
|
6363
|
+
<ProgressStackShowcase />
|
|
6364
|
+
</Section>
|
|
6365
|
+
<Section title="Callout">
|
|
6366
|
+
<CalloutShowcase />
|
|
6367
|
+
</Section>
|
|
6368
|
+
<Section title="AnnouncementBar">
|
|
6369
|
+
<AnnouncementBarShowcase />
|
|
6370
|
+
</Section>
|
|
6371
|
+
<Section title="Grid">
|
|
6372
|
+
<GridShowcase />
|
|
6373
|
+
</Section>
|
|
6374
|
+
<Section title="GaugeChart">
|
|
6375
|
+
<GaugeChartShowcase />
|
|
6376
|
+
</Section>
|
|
6377
|
+
<Section title="PasswordStrengthInput">
|
|
6378
|
+
<PasswordStrengthInputShowcase />
|
|
6379
|
+
</Section>
|
|
6380
|
+
<Section title="InfiniteScroll">
|
|
6381
|
+
<InfiniteScrollShowcase />
|
|
6382
|
+
</Section>
|
|
6383
|
+
<Section title="ScrollProgress">
|
|
6384
|
+
<ScrollProgressShowcase />
|
|
6385
|
+
</Section>
|
|
6386
|
+
<Section title="Pill">
|
|
6387
|
+
<PillShowcase />
|
|
6388
|
+
</Section>
|
|
6389
|
+
<Section title="Snackbar">
|
|
6390
|
+
<SnackbarShowcase />
|
|
6391
|
+
</Section>
|
|
6392
|
+
<Section title="JsonInput">
|
|
6393
|
+
<JsonInputShowcase />
|
|
6394
|
+
</Section>
|
|
6395
|
+
<Section title="SortableList">
|
|
6396
|
+
<SortableListShowcase />
|
|
6397
|
+
</Section>
|
|
6398
|
+
<Section title="Heatmap">
|
|
6399
|
+
<HeatmapShowcase />
|
|
6400
|
+
</Section>
|
|
6401
|
+
<Section title="NavigationProgress">
|
|
6402
|
+
<NavigationProgressShowcase />
|
|
6403
|
+
</Section>
|
|
6404
|
+
<Section title="Attachment">
|
|
6405
|
+
<AttachmentShowcase />
|
|
6406
|
+
</Section>
|
|
6284
6407
|
</div>
|
|
6285
6408
|
</div>
|
|
6286
6409
|
);
|
|
@@ -7112,6 +7235,11 @@ function SignaturePadShowcase() {
|
|
|
7112
7235
|
}
|
|
7113
7236
|
|
|
7114
7237
|
function AnchorShowcase() {
|
|
7238
|
+
// Controlled demo: mirror the scroll-spy result back in, the way a docs
|
|
7239
|
+
// site keeps the URL hash and the nav in step.
|
|
7240
|
+
const [controlledActive, setControlledActive] = React.useState<string | null>(
|
|
7241
|
+
"anchor-demo-fork"
|
|
7242
|
+
);
|
|
7115
7243
|
const sections: { id: string; title: string; body: string; depth?: number }[] = [
|
|
7116
7244
|
{
|
|
7117
7245
|
id: "anchor-demo-fork",
|
|
@@ -7189,6 +7317,26 @@ function AnchorShowcase() {
|
|
|
7189
7317
|
]}
|
|
7190
7318
|
/>
|
|
7191
7319
|
</div>
|
|
7320
|
+
<div>
|
|
7321
|
+
<p className="mb-3 text-sm font-medium text-muted-foreground">
|
|
7322
|
+
Controlled — pass <code className="font-mono">activeId</code> and{" "}
|
|
7323
|
+
<code className="font-mono">onActiveChange</code> to own the
|
|
7324
|
+
highlight (URL hash, shared store). This one observes the article
|
|
7325
|
+
above and mirrors the result back; currently reading{" "}
|
|
7326
|
+
<span className="font-medium text-foreground">
|
|
7327
|
+
{sections.find((s) => s.id === controlledActive)?.title ?? "none"}
|
|
7328
|
+
</span>
|
|
7329
|
+
. Anchor is BADS's table-of-contents primitive — the registry
|
|
7330
|
+
lists <code className="font-mono">TableOfContents</code> as its alias.
|
|
7331
|
+
</p>
|
|
7332
|
+
<Anchor
|
|
7333
|
+
className="w-56"
|
|
7334
|
+
label="Onboarding steps (controlled)"
|
|
7335
|
+
activeId={controlledActive}
|
|
7336
|
+
onActiveChange={setControlledActive}
|
|
7337
|
+
items={sections.map((s) => ({ id: s.id, label: s.title, depth: s.depth }))}
|
|
7338
|
+
/>
|
|
7339
|
+
</div>
|
|
7192
7340
|
</div>
|
|
7193
7341
|
);
|
|
7194
7342
|
}
|
|
@@ -12034,6 +12182,38 @@ function SearchInputShowcase() {
|
|
|
12034
12182
|
);
|
|
12035
12183
|
}
|
|
12036
12184
|
|
|
12185
|
+
function FormatRelativeTimeShowcase() {
|
|
12186
|
+
const now = Date.now();
|
|
12187
|
+
const rows: { label: string; date: Date; props?: Record<string, unknown> }[] = [
|
|
12188
|
+
{ label: "Just now", date: new Date(now - 15_000) },
|
|
12189
|
+
{ label: "2 minutes ago", date: new Date(now - 2 * 60_000) },
|
|
12190
|
+
{ label: "Yesterday (auto)", date: new Date(now - 26 * 60 * 60_000), props: { numeric: "auto" } },
|
|
12191
|
+
{ label: "Yesterday (always)", date: new Date(now - 26 * 60 * 60_000), props: { numeric: "always" } },
|
|
12192
|
+
{ label: "3 days ago", date: new Date(now - 3 * 24 * 60 * 60_000) },
|
|
12193
|
+
{ label: "In 4 hours", date: new Date(now + 4 * 60 * 60_000) },
|
|
12194
|
+
{ label: "Narrow style", date: new Date(now - 7 * 60_000), props: { formatStyle: "narrow" } },
|
|
12195
|
+
{ label: "Live off (static)", date: new Date(now - 45_000), props: { live: false } },
|
|
12196
|
+
];
|
|
12197
|
+
return (
|
|
12198
|
+
<div className="space-y-6">
|
|
12199
|
+
<p className="text-sm text-muted-foreground">
|
|
12200
|
+
Locale-aware relative time display. Renders a semantic{" "}
|
|
12201
|
+
<code className="text-xs bg-muted px-1 py-0.5 rounded"><time></code>{" "}
|
|
12202
|
+
element with a machine-readable <code className="text-xs bg-muted px-1 py-0.5 rounded">dateTime</code>{" "}
|
|
12203
|
+
attribute and optionally live-updates every 30 s.
|
|
12204
|
+
</p>
|
|
12205
|
+
<div className="flex flex-col gap-1.5 max-w-sm">
|
|
12206
|
+
{rows.map(({ label, date, props: extraProps }) => (
|
|
12207
|
+
<div key={label} className="flex items-center justify-between text-sm gap-4">
|
|
12208
|
+
<span className="text-muted-foreground">{label}</span>
|
|
12209
|
+
<FormatRelativeTime date={date} className="tabular-nums font-medium shrink-0" {...(extraProps as Record<string, unknown>)} />
|
|
12210
|
+
</div>
|
|
12211
|
+
))}
|
|
12212
|
+
</div>
|
|
12213
|
+
</div>
|
|
12214
|
+
);
|
|
12215
|
+
}
|
|
12216
|
+
|
|
12037
12217
|
function FormatDateShowcase() {
|
|
12038
12218
|
const kickoff = new Date(2026, 0, 15);
|
|
12039
12219
|
const reportDate = new Date(2026, 8, 9);
|
|
@@ -12322,3 +12502,2058 @@ function SparklineShowcase() {
|
|
|
12322
12502
|
</div>
|
|
12323
12503
|
);
|
|
12324
12504
|
}
|
|
12505
|
+
|
|
12506
|
+
function PageHeaderShowcase() {
|
|
12507
|
+
return (
|
|
12508
|
+
<div className="space-y-8 w-full">
|
|
12509
|
+
<div>
|
|
12510
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Title only</p>
|
|
12511
|
+
<PageHeader title="Workspace settings" />
|
|
12512
|
+
</div>
|
|
12513
|
+
<div>
|
|
12514
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With description</p>
|
|
12515
|
+
<PageHeader
|
|
12516
|
+
title="Workspace settings"
|
|
12517
|
+
description="Manage your workspace preferences, integrations, and team access."
|
|
12518
|
+
/>
|
|
12519
|
+
</div>
|
|
12520
|
+
<div>
|
|
12521
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With eyebrow</p>
|
|
12522
|
+
<PageHeader
|
|
12523
|
+
eyebrow="Account"
|
|
12524
|
+
title="Billing & plans"
|
|
12525
|
+
description="Manage your subscription and payment methods."
|
|
12526
|
+
/>
|
|
12527
|
+
</div>
|
|
12528
|
+
<div>
|
|
12529
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">With action</p>
|
|
12530
|
+
<PageHeader
|
|
12531
|
+
title="Team members"
|
|
12532
|
+
description="Invite people and manage their roles."
|
|
12533
|
+
action={<Button size="xl">Invite member</Button>}
|
|
12534
|
+
/>
|
|
12535
|
+
</div>
|
|
12536
|
+
<div>
|
|
12537
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">Bordered + eyebrow + actions</p>
|
|
12538
|
+
<PageHeader
|
|
12539
|
+
eyebrow="Projects"
|
|
12540
|
+
title="Meridian rebrand"
|
|
12541
|
+
description="Brand identity, design tokens, and component library for Meridian Financial."
|
|
12542
|
+
bordered
|
|
12543
|
+
action={
|
|
12544
|
+
<>
|
|
12545
|
+
<Button variant="outline" size="lg">Export</Button>
|
|
12546
|
+
<Button size="xl">New component</Button>
|
|
12547
|
+
</>
|
|
12548
|
+
}
|
|
12549
|
+
/>
|
|
12550
|
+
</div>
|
|
12551
|
+
</div>
|
|
12552
|
+
);
|
|
12553
|
+
}
|
|
12554
|
+
|
|
12555
|
+
function PresenceShowcase() {
|
|
12556
|
+
const [present, setPresent] = React.useState(true);
|
|
12557
|
+
const [transition, setTransition] = React.useState<PresenceTransition>("fade");
|
|
12558
|
+
const [keepMounted, setKeepMounted] = React.useState(false);
|
|
12559
|
+
const [saved, setSaved] = React.useState(false);
|
|
12560
|
+
React.useEffect(() => {
|
|
12561
|
+
if (!saved) return;
|
|
12562
|
+
const t = window.setTimeout(() => setSaved(false), 2400);
|
|
12563
|
+
return () => window.clearTimeout(t);
|
|
12564
|
+
}, [saved]);
|
|
12565
|
+
return (
|
|
12566
|
+
<div className="space-y-8">
|
|
12567
|
+
<p className="text-sm text-muted-foreground">
|
|
12568
|
+
Mount/unmount wrapper with a token-driven enter <em>and exit</em>{" "}
|
|
12569
|
+
animation. <code className="font-mono">present=false</code> plays the
|
|
12570
|
+
exit keyframe and only then unmounts the child — conditional rendering
|
|
12571
|
+
can never do that, because the node is gone before the browser paints.
|
|
12572
|
+
Keyframes ride <code className="font-mono">--duration-base</code> /{" "}
|
|
12573
|
+
<code className="font-mono">--ease-out</code> in the generated
|
|
12574
|
+
styles.css; reduced motion collapses them.
|
|
12575
|
+
</p>
|
|
12576
|
+
|
|
12577
|
+
<div>
|
|
12578
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12579
|
+
Every transition — pick one, then toggle the panel.
|
|
12580
|
+
</p>
|
|
12581
|
+
<div className="flex flex-col gap-4">
|
|
12582
|
+
<SegmentedControl
|
|
12583
|
+
value={transition}
|
|
12584
|
+
onValueChange={(v) => setTransition(v as PresenceTransition)}
|
|
12585
|
+
label="Presence transition"
|
|
12586
|
+
className="w-fit"
|
|
12587
|
+
>
|
|
12588
|
+
{PRESENCE_TRANSITIONS.map((t) => (
|
|
12589
|
+
<SegmentedControlItem key={t} value={t}>
|
|
12590
|
+
{t}
|
|
12591
|
+
</SegmentedControlItem>
|
|
12592
|
+
))}
|
|
12593
|
+
</SegmentedControl>
|
|
12594
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
12595
|
+
<Button
|
|
12596
|
+
variant="outline"
|
|
12597
|
+
size="xl"
|
|
12598
|
+
onClick={() => setPresent((p) => !p)}
|
|
12599
|
+
aria-expanded={present}
|
|
12600
|
+
aria-controls="presence-showcase-panel"
|
|
12601
|
+
>
|
|
12602
|
+
{present ? "Hide panel" : "Show panel"}
|
|
12603
|
+
</Button>
|
|
12604
|
+
<div className="flex items-center gap-2">
|
|
12605
|
+
<Switch
|
|
12606
|
+
id="presence-keep-mounted"
|
|
12607
|
+
checked={keepMounted}
|
|
12608
|
+
onCheckedChange={setKeepMounted}
|
|
12609
|
+
/>
|
|
12610
|
+
<Label htmlFor="presence-keep-mounted">
|
|
12611
|
+
Keep mounted (hidden attribute after exit)
|
|
12612
|
+
</Label>
|
|
12613
|
+
</div>
|
|
12614
|
+
</div>
|
|
12615
|
+
{/* Reserved height so the layout doesn't jump while the exit plays. */}
|
|
12616
|
+
<div className="h-24 max-w-sm">
|
|
12617
|
+
<Presence
|
|
12618
|
+
id="presence-showcase-panel"
|
|
12619
|
+
present={present}
|
|
12620
|
+
transition={transition}
|
|
12621
|
+
unmountOnExit={!keepMounted}
|
|
12622
|
+
// lint-disable: card-bypass — Presence animates its own root; the surface classes must live on the element it mounts/unmounts, not a wrapped Card
|
|
12623
|
+
className="rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm"
|
|
12624
|
+
>
|
|
12625
|
+
<p className="text-sm font-medium">Jordan Reeves</p>
|
|
12626
|
+
<p className="text-sm text-muted-foreground">
|
|
12627
|
+
Northwind Systems · design system lead
|
|
12628
|
+
</p>
|
|
12629
|
+
<p className="mt-2 text-xs text-muted-foreground">
|
|
12630
|
+
transition: <code className="font-mono">{transition}</code>
|
|
12631
|
+
</p>
|
|
12632
|
+
</Presence>
|
|
12633
|
+
</div>
|
|
12634
|
+
</div>
|
|
12635
|
+
</div>
|
|
12636
|
+
|
|
12637
|
+
<div>
|
|
12638
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12639
|
+
Realistic use — inline confirmation that animates out after 2.4s
|
|
12640
|
+
(asChild, inside an aria-live region).
|
|
12641
|
+
</p>
|
|
12642
|
+
<form
|
|
12643
|
+
// 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
|
|
12644
|
+
className="flex max-w-sm flex-col gap-5 rounded-lg border border-border bg-card p-6"
|
|
12645
|
+
onSubmit={(e) => {
|
|
12646
|
+
e.preventDefault();
|
|
12647
|
+
setSaved(true);
|
|
12648
|
+
}}
|
|
12649
|
+
>
|
|
12650
|
+
<div>
|
|
12651
|
+
<p className="text-lg font-semibold">Customize your tokens</p>
|
|
12652
|
+
<p className="text-sm text-muted-foreground">
|
|
12653
|
+
36 components, all passing AAA contrast.
|
|
12654
|
+
</p>
|
|
12655
|
+
</div>
|
|
12656
|
+
<div className="flex flex-col gap-3">
|
|
12657
|
+
<Label htmlFor="presence-showcase-scope">npm scope</Label>
|
|
12658
|
+
<Input
|
|
12659
|
+
id="presence-showcase-scope"
|
|
12660
|
+
defaultValue="@behavioral-agentic-design-system"
|
|
12661
|
+
/>
|
|
12662
|
+
</div>
|
|
12663
|
+
<div className="flex items-center gap-3">
|
|
12664
|
+
<Button type="submit" size="xl">
|
|
12665
|
+
Save changes
|
|
12666
|
+
</Button>
|
|
12667
|
+
<Button type="button" variant="ghost" size="xl">
|
|
12668
|
+
Cancel
|
|
12669
|
+
</Button>
|
|
12670
|
+
</div>
|
|
12671
|
+
<div className="min-h-12" aria-live="polite">
|
|
12672
|
+
<Presence present={saved} transition="slide-up" asChild>
|
|
12673
|
+
<div className="flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-sm">
|
|
12674
|
+
<Icon as={CircleCheck} color="success" className="mt-0.5" />
|
|
12675
|
+
<span>
|
|
12676
|
+
<span className="font-medium">Token changes saved.</span>{" "}
|
|
12677
|
+
<span className="text-muted-foreground">
|
|
12678
|
+
Run pnpm build:tokens to regenerate CSS.
|
|
12679
|
+
</span>
|
|
12680
|
+
</span>
|
|
12681
|
+
</div>
|
|
12682
|
+
</Presence>
|
|
12683
|
+
</div>
|
|
12684
|
+
</form>
|
|
12685
|
+
</div>
|
|
12686
|
+
</div>
|
|
12687
|
+
);
|
|
12688
|
+
}
|
|
12689
|
+
|
|
12690
|
+
function GaugeChartShowcase() {
|
|
12691
|
+
return (
|
|
12692
|
+
<div className="space-y-8">
|
|
12693
|
+
<p className="text-sm text-muted-foreground">
|
|
12694
|
+
Radial arc dial for a single reading within a known range. A quiet{" "}
|
|
12695
|
+
<code className="text-xs">--muted</code> track sweeps 270°; the value
|
|
12696
|
+
arc in a <code className="text-xs">--chart-*</code> color fills the
|
|
12697
|
+
proportion the reading represents. Root is{" "}
|
|
12698
|
+
<code className="text-xs">{"<div data-slot=\"gauge-chart\" role=\"meter\">"}</code>{" "}
|
|
12699
|
+
with aria-valuenow/min/max/valuetext — the same contract as Meter,
|
|
12700
|
+
drawn radially. Recharts 3.x with the ChartContainer mount-gate.
|
|
12701
|
+
</p>
|
|
12702
|
+
|
|
12703
|
+
<div>
|
|
12704
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12705
|
+
Default — value 72 of 0–100, md size, --chart-1
|
|
12706
|
+
</p>
|
|
12707
|
+
<GaugeChart value={72} className="w-48" />
|
|
12708
|
+
</div>
|
|
12709
|
+
|
|
12710
|
+
<div>
|
|
12711
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12712
|
+
Sizes — sm 120px, md 160px, lg 200px, xl 240px
|
|
12713
|
+
</p>
|
|
12714
|
+
<div className="flex flex-wrap items-end gap-6">
|
|
12715
|
+
{(["sm", "md", "lg", "xl"] as const).map((size) => (
|
|
12716
|
+
<div key={size} className="flex flex-col items-center gap-2">
|
|
12717
|
+
<GaugeChart
|
|
12718
|
+
value={72}
|
|
12719
|
+
size={size}
|
|
12720
|
+
label="Coverage"
|
|
12721
|
+
className="w-auto"
|
|
12722
|
+
style={{ width: { sm: 120, md: 160, lg: 200, xl: 240 }[size] }}
|
|
12723
|
+
/>
|
|
12724
|
+
<code className="text-xs text-muted-foreground">{size}</code>
|
|
12725
|
+
</div>
|
|
12726
|
+
))}
|
|
12727
|
+
</div>
|
|
12728
|
+
</div>
|
|
12729
|
+
|
|
12730
|
+
<div>
|
|
12731
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12732
|
+
With label — caption under the value, also the default accessible name
|
|
12733
|
+
</p>
|
|
12734
|
+
<GaugeChart value={85} label="CPU usage" className="w-48" />
|
|
12735
|
+
</div>
|
|
12736
|
+
|
|
12737
|
+
<div>
|
|
12738
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12739
|
+
Colors — the Okabe-Ito series in palette order
|
|
12740
|
+
</p>
|
|
12741
|
+
<div className="flex flex-wrap items-end gap-6">
|
|
12742
|
+
{[1, 2, 3, 4, 5].map((n) => (
|
|
12743
|
+
<div key={n} className="flex w-32 flex-col items-center gap-2">
|
|
12744
|
+
<GaugeChart
|
|
12745
|
+
value={72}
|
|
12746
|
+
size="sm"
|
|
12747
|
+
color={`var(--chart-${n})`}
|
|
12748
|
+
aria-label={`Sample reading in chart color ${n}`}
|
|
12749
|
+
/>
|
|
12750
|
+
<code className="text-xs text-muted-foreground">--chart-{n}</code>
|
|
12751
|
+
</div>
|
|
12752
|
+
))}
|
|
12753
|
+
</div>
|
|
12754
|
+
</div>
|
|
12755
|
+
|
|
12756
|
+
<div>
|
|
12757
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12758
|
+
Realistic use — system health card, one hero gauge and three small multiples
|
|
12759
|
+
</p>
|
|
12760
|
+
<Card className="w-[480px]">
|
|
12761
|
+
<CardHeader>
|
|
12762
|
+
<CardTitle>System health</CardTitle>
|
|
12763
|
+
<CardDescription>BADS core — nightly gate run, 2026-09-15</CardDescription>
|
|
12764
|
+
</CardHeader>
|
|
12765
|
+
<CardContent className="flex flex-col gap-6">
|
|
12766
|
+
<div className="flex justify-center">
|
|
12767
|
+
<GaugeChart value={67} label="Overall" size="lg" className="w-52" />
|
|
12768
|
+
</div>
|
|
12769
|
+
<div className="grid grid-cols-3 gap-4">
|
|
12770
|
+
<GaugeChart
|
|
12771
|
+
value={98.4}
|
|
12772
|
+
label="Story coverage"
|
|
12773
|
+
size="sm"
|
|
12774
|
+
formatValue={(v) => `${v.toFixed(1)}%`}
|
|
12775
|
+
/>
|
|
12776
|
+
<GaugeChart
|
|
12777
|
+
value={88}
|
|
12778
|
+
max={120}
|
|
12779
|
+
label="Registry entries"
|
|
12780
|
+
size="sm"
|
|
12781
|
+
color="var(--chart-2)"
|
|
12782
|
+
/>
|
|
12783
|
+
<GaugeChart
|
|
12784
|
+
value={4}
|
|
12785
|
+
max={12}
|
|
12786
|
+
label="Open advisories"
|
|
12787
|
+
size="sm"
|
|
12788
|
+
color="var(--chart-3)"
|
|
12789
|
+
/>
|
|
12790
|
+
</div>
|
|
12791
|
+
</CardContent>
|
|
12792
|
+
</Card>
|
|
12793
|
+
</div>
|
|
12794
|
+
</div>
|
|
12795
|
+
);
|
|
12796
|
+
}
|
|
12797
|
+
|
|
12798
|
+
function ProgressStackShowcase() {
|
|
12799
|
+
const storageSegments = [
|
|
12800
|
+
{ value: 38, label: "Documents" },
|
|
12801
|
+
{ value: 29, label: "Media" },
|
|
12802
|
+
{ value: 16, label: "System" },
|
|
12803
|
+
{ value: 8, label: "Other" },
|
|
12804
|
+
];
|
|
12805
|
+
const budgetSegments = [
|
|
12806
|
+
{ value: 42, label: "Engineering" },
|
|
12807
|
+
{ value: 28, label: "Design" },
|
|
12808
|
+
{ value: 18, label: "Marketing" },
|
|
12809
|
+
{ value: 12, label: "Operations" },
|
|
12810
|
+
];
|
|
12811
|
+
const customColors = [
|
|
12812
|
+
{ value: 40, label: "Q1", color: "var(--primary)" },
|
|
12813
|
+
{ value: 25, label: "Q2", color: "var(--success)" },
|
|
12814
|
+
{ value: 20, label: "Q3", color: "var(--warning)" },
|
|
12815
|
+
{ value: 15, label: "Q4", color: "var(--destructive)" },
|
|
12816
|
+
];
|
|
12817
|
+
return (
|
|
12818
|
+
<div className="space-y-8">
|
|
12819
|
+
<div>
|
|
12820
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12821
|
+
Default — colors from --chart-1..5 family
|
|
12822
|
+
</p>
|
|
12823
|
+
<div className="w-80">
|
|
12824
|
+
<ProgressStack
|
|
12825
|
+
segments={storageSegments}
|
|
12826
|
+
aria-label="Storage breakdown"
|
|
12827
|
+
/>
|
|
12828
|
+
</div>
|
|
12829
|
+
</div>
|
|
12830
|
+
<div>
|
|
12831
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12832
|
+
With legend and values
|
|
12833
|
+
</p>
|
|
12834
|
+
<div className="w-80">
|
|
12835
|
+
<ProgressStack
|
|
12836
|
+
segments={storageSegments}
|
|
12837
|
+
aria-label="Storage breakdown"
|
|
12838
|
+
showLegend
|
|
12839
|
+
showValues
|
|
12840
|
+
/>
|
|
12841
|
+
</div>
|
|
12842
|
+
</div>
|
|
12843
|
+
<div>
|
|
12844
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12845
|
+
Sizes — sm / default / lg
|
|
12846
|
+
</p>
|
|
12847
|
+
<div className="flex w-80 flex-col gap-4">
|
|
12848
|
+
{(["sm", "default", "lg"] as const).map((size) => (
|
|
12849
|
+
<div key={size}>
|
|
12850
|
+
<p className="mb-1.5 text-xs text-muted-foreground">size="{size}"</p>
|
|
12851
|
+
<ProgressStack
|
|
12852
|
+
segments={storageSegments}
|
|
12853
|
+
size={size}
|
|
12854
|
+
aria-label={`Storage breakdown — ${size}`}
|
|
12855
|
+
/>
|
|
12856
|
+
</div>
|
|
12857
|
+
))}
|
|
12858
|
+
</div>
|
|
12859
|
+
</div>
|
|
12860
|
+
<div>
|
|
12861
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12862
|
+
Custom semantic-token colors
|
|
12863
|
+
</p>
|
|
12864
|
+
<div className="w-80">
|
|
12865
|
+
<ProgressStack
|
|
12866
|
+
segments={customColors}
|
|
12867
|
+
aria-label="Quarterly revenue split"
|
|
12868
|
+
showLegend
|
|
12869
|
+
showValues
|
|
12870
|
+
/>
|
|
12871
|
+
</div>
|
|
12872
|
+
</div>
|
|
12873
|
+
<div>
|
|
12874
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12875
|
+
Partial fill via max prop — 70 GB used of 128 GB
|
|
12876
|
+
</p>
|
|
12877
|
+
<div className="w-80">
|
|
12878
|
+
<ProgressStack
|
|
12879
|
+
segments={[
|
|
12880
|
+
{ value: 38, label: "Documents" },
|
|
12881
|
+
{ value: 22, label: "Media" },
|
|
12882
|
+
{ value: 10, label: "System" },
|
|
12883
|
+
]}
|
|
12884
|
+
max={128}
|
|
12885
|
+
aria-label="Storage: 70 of 128 GB used"
|
|
12886
|
+
showLegend
|
|
12887
|
+
formatValue={(v) => `${v} GB`}
|
|
12888
|
+
/>
|
|
12889
|
+
</div>
|
|
12890
|
+
</div>
|
|
12891
|
+
<div>
|
|
12892
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12893
|
+
Realistic use — dashboard card with 2 stacks
|
|
12894
|
+
</p>
|
|
12895
|
+
<Card className="w-[480px]">
|
|
12896
|
+
<CardHeader>
|
|
12897
|
+
<CardTitle>Resource overview</CardTitle>
|
|
12898
|
+
<CardDescription>BADS Austin team — current quarter</CardDescription>
|
|
12899
|
+
</CardHeader>
|
|
12900
|
+
<CardContent className="flex flex-col gap-6">
|
|
12901
|
+
<div>
|
|
12902
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
12903
|
+
Repository storage
|
|
12904
|
+
</p>
|
|
12905
|
+
<ProgressStack
|
|
12906
|
+
segments={storageSegments}
|
|
12907
|
+
aria-label="Repository storage breakdown"
|
|
12908
|
+
showLegend
|
|
12909
|
+
showValues
|
|
12910
|
+
formatValue={(v, t) => `${Math.round((v / t) * 100)}%`}
|
|
12911
|
+
/>
|
|
12912
|
+
</div>
|
|
12913
|
+
<div>
|
|
12914
|
+
<p className="text-xs font-medium uppercase tracking-wide text-muted-foreground mb-3">
|
|
12915
|
+
Q3 budget utilization
|
|
12916
|
+
</p>
|
|
12917
|
+
<ProgressStack
|
|
12918
|
+
segments={budgetSegments}
|
|
12919
|
+
aria-label="Q3 budget by department"
|
|
12920
|
+
showLegend
|
|
12921
|
+
showValues
|
|
12922
|
+
formatValue={(v) => `$${v}k`}
|
|
12923
|
+
/>
|
|
12924
|
+
</div>
|
|
12925
|
+
</CardContent>
|
|
12926
|
+
</Card>
|
|
12927
|
+
</div>
|
|
12928
|
+
</div>
|
|
12929
|
+
);
|
|
12930
|
+
}
|
|
12931
|
+
|
|
12932
|
+
function PortalShowcase() {
|
|
12933
|
+
const [box, setBox] = React.useState<HTMLDivElement | null>(null);
|
|
12934
|
+
const initial = "@behavioral-agentic-design-system";
|
|
12935
|
+
const [value, setValue] = React.useState(initial);
|
|
12936
|
+
const dirty = value !== initial;
|
|
12937
|
+
return (
|
|
12938
|
+
<div className="space-y-8">
|
|
12939
|
+
<p className="text-sm text-muted-foreground">
|
|
12940
|
+
Renders children into another DOM container — by default the{" "}
|
|
12941
|
+
<code className="font-mono"><body></code> of the component's
|
|
12942
|
+
own document (this preview runs in an iframe, so that's the iframe
|
|
12943
|
+
body) — while keeping them in the React tree. The portal root carries
|
|
12944
|
+
the <code className="font-mono">PortalThemeProvider</code> scope class,
|
|
12945
|
+
so theme-scoped CSS variables resolve inside it. Zero new dependencies.
|
|
12946
|
+
</p>
|
|
12947
|
+
|
|
12948
|
+
<div>
|
|
12949
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12950
|
+
Custom container — the badge is declared in the left card, rendered in
|
|
12951
|
+
the dashed target.
|
|
12952
|
+
</p>
|
|
12953
|
+
<div className="grid max-w-2xl gap-4 sm:grid-cols-2">
|
|
12954
|
+
{/* lint-disable: card-bypass — a generic bounded container for the portal-source/target demo, not a Card feature demo */}
|
|
12955
|
+
<div className="rounded-lg border border-border bg-card p-4 text-sm">
|
|
12956
|
+
<p className="font-medium">Source</p>
|
|
12957
|
+
<p className="text-muted-foreground">
|
|
12958
|
+
Declared here, in the React tree.
|
|
12959
|
+
</p>
|
|
12960
|
+
<Portal container={box}>
|
|
12961
|
+
<Badge variant="outline">Rendered into the target</Badge>
|
|
12962
|
+
</Portal>
|
|
12963
|
+
</div>
|
|
12964
|
+
<div
|
|
12965
|
+
ref={setBox}
|
|
12966
|
+
className="flex min-h-16 items-center gap-2 rounded-lg border border-dashed border-border p-4 text-sm"
|
|
12967
|
+
>
|
|
12968
|
+
<span className="text-muted-foreground">Target:</span>
|
|
12969
|
+
</div>
|
|
12970
|
+
</div>
|
|
12971
|
+
</div>
|
|
12972
|
+
|
|
12973
|
+
<div>
|
|
12974
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12975
|
+
Disabled — renders in place.
|
|
12976
|
+
</p>
|
|
12977
|
+
{/* lint-disable: card-bypass — a generic bounded container for the portal-disabled demo, not a Card feature demo */}
|
|
12978
|
+
<div className="flex w-fit items-center gap-3 rounded-lg border border-border bg-card p-4 text-sm">
|
|
12979
|
+
<span className="text-muted-foreground">Inline:</span>
|
|
12980
|
+
<Portal disabled>
|
|
12981
|
+
<Badge variant="outline">Not portaled</Badge>
|
|
12982
|
+
</Portal>
|
|
12983
|
+
</div>
|
|
12984
|
+
</div>
|
|
12985
|
+
|
|
12986
|
+
<div>
|
|
12987
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
12988
|
+
Realistic use — edit the field to reveal an unsaved-changes bar that
|
|
12989
|
+
escapes this card's overflow-hidden (Portal + Presence).
|
|
12990
|
+
</p>
|
|
12991
|
+
{/* 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 */}
|
|
12992
|
+
<div className="max-w-sm overflow-hidden rounded-lg border border-border bg-card p-6">
|
|
12993
|
+
<p className="text-lg font-semibold">Customize your tokens</p>
|
|
12994
|
+
<p className="mb-5 text-sm text-muted-foreground">
|
|
12995
|
+
The bar renders at body, so no ancestor can clip it.
|
|
12996
|
+
</p>
|
|
12997
|
+
<div className="flex flex-col gap-3">
|
|
12998
|
+
<Label htmlFor="portal-showcase-scope">npm scope</Label>
|
|
12999
|
+
<Input
|
|
13000
|
+
id="portal-showcase-scope"
|
|
13001
|
+
value={value}
|
|
13002
|
+
onChange={(e) => setValue(e.target.value)}
|
|
13003
|
+
/>
|
|
13004
|
+
</div>
|
|
13005
|
+
<Portal>
|
|
13006
|
+
<Presence present={dirty} transition="slide-up" asChild>
|
|
13007
|
+
<div
|
|
13008
|
+
role="status"
|
|
13009
|
+
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"
|
|
13010
|
+
>
|
|
13011
|
+
<span className="text-sm font-medium">Unsaved changes</span>
|
|
13012
|
+
<div className="flex items-center gap-2">
|
|
13013
|
+
<Button size="xl" variant="ghost" onClick={() => setValue(initial)}>
|
|
13014
|
+
Cancel
|
|
13015
|
+
</Button>
|
|
13016
|
+
<Button size="xl" onClick={() => setValue(initial)}>
|
|
13017
|
+
Save changes
|
|
13018
|
+
</Button>
|
|
13019
|
+
</div>
|
|
13020
|
+
</div>
|
|
13021
|
+
</Presence>
|
|
13022
|
+
</Portal>
|
|
13023
|
+
</div>
|
|
13024
|
+
</div>
|
|
13025
|
+
</div>
|
|
13026
|
+
);
|
|
13027
|
+
}
|
|
13028
|
+
|
|
13029
|
+
function CalloutShowcase() {
|
|
13030
|
+
return (
|
|
13031
|
+
<div className="space-y-8">
|
|
13032
|
+
<div>
|
|
13033
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13034
|
+
All five variants
|
|
13035
|
+
</p>
|
|
13036
|
+
<div className="flex w-[480px] flex-col gap-4">
|
|
13037
|
+
<Callout variant="note" title="Note">
|
|
13038
|
+
General information or contextual aside.
|
|
13039
|
+
</Callout>
|
|
13040
|
+
<Callout variant="tip" title="Tip">
|
|
13041
|
+
A helpful shortcut or recommended practice.
|
|
13042
|
+
</Callout>
|
|
13043
|
+
<Callout variant="warning" title="Warning">
|
|
13044
|
+
Caution: a risk or potential issue to be aware of.
|
|
13045
|
+
</Callout>
|
|
13046
|
+
<Callout variant="danger" title="Danger">
|
|
13047
|
+
Stop: this path leads to data loss or a breaking change.
|
|
13048
|
+
</Callout>
|
|
13049
|
+
<Callout variant="info" title="Info">
|
|
13050
|
+
Neutral reference that is neither an error nor a tip.
|
|
13051
|
+
</Callout>
|
|
13052
|
+
</div>
|
|
13053
|
+
</div>
|
|
13054
|
+
<div>
|
|
13055
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13056
|
+
No title — icon alone carries the variant signal
|
|
13057
|
+
</p>
|
|
13058
|
+
<div className="flex w-[480px] flex-col gap-3">
|
|
13059
|
+
<Callout variant="note">
|
|
13060
|
+
Icon alone signals the variant when the title is omitted.
|
|
13061
|
+
</Callout>
|
|
13062
|
+
<Callout variant="warning">
|
|
13063
|
+
Pass <Code>icon={"{null}"}</Code> to suppress the icon entirely.
|
|
13064
|
+
</Callout>
|
|
13065
|
+
</div>
|
|
13066
|
+
</div>
|
|
13067
|
+
<div>
|
|
13068
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13069
|
+
Rich body content — lists, multiple paragraphs, inline code
|
|
13070
|
+
</p>
|
|
13071
|
+
<div className="w-[480px]">
|
|
13072
|
+
<Callout variant="danger" title="Microanimation patterns to avoid">
|
|
13073
|
+
<p>These patterns compile to nothing in Tailwind v4 and produce silent failures:</p>
|
|
13074
|
+
<ul className="mt-2 list-disc pl-4 space-y-1 text-muted-foreground">
|
|
13075
|
+
<li><Code>duration-fast</Code>, <Code>duration-base</Code>, <Code>duration-slow</Code></li>
|
|
13076
|
+
<li><Code>duration-[var(--duration-fast)]</Code> (arbitrary-value form)</li>
|
|
13077
|
+
<li>Inline <Code>transitionDuration: "200ms"</Code> (literal value bypasses tokens)</li>
|
|
13078
|
+
</ul>
|
|
13079
|
+
<p className="mt-2">
|
|
13080
|
+
Use inline <Code>{`style={{ transitionDuration: "var(--duration-fast)" }}`}</Code> instead.
|
|
13081
|
+
</p>
|
|
13082
|
+
</Callout>
|
|
13083
|
+
</div>
|
|
13084
|
+
</div>
|
|
13085
|
+
<div>
|
|
13086
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13087
|
+
Realistic use — documentation section context
|
|
13088
|
+
</p>
|
|
13089
|
+
<div className="w-[480px] flex flex-col gap-5">
|
|
13090
|
+
<p className="text-sm text-muted-foreground">
|
|
13091
|
+
Run <Code>pnpm rename "Clap Design" clap</Code> to rename a fresh fork.
|
|
13092
|
+
</p>
|
|
13093
|
+
<Callout variant="tip" title="Fast path">
|
|
13094
|
+
The rename script updates every reference in a single pass. Commit
|
|
13095
|
+
with <Code>git add -A && git commit -m "chore: rename to Clap Design"</Code>.
|
|
13096
|
+
</Callout>
|
|
13097
|
+
<Callout variant="warning" title="After renaming">
|
|
13098
|
+
Re-run <Code>pnpm install && pnpm build:tokens</Code> so generated CSS
|
|
13099
|
+
carries the new package namespace. Skipping this causes a silent FOUC on first load.
|
|
13100
|
+
</Callout>
|
|
13101
|
+
<Callout variant="danger">
|
|
13102
|
+
Never run <Code>pnpm rename</Code> on an already-renamed repo — it
|
|
13103
|
+
will do nothing harmful but produces a confusing diff.
|
|
13104
|
+
</Callout>
|
|
13105
|
+
</div>
|
|
13106
|
+
</div>
|
|
13107
|
+
</div>
|
|
13108
|
+
);
|
|
13109
|
+
}
|
|
13110
|
+
|
|
13111
|
+
function IconShowcase() {
|
|
13112
|
+
const sizes = ["sm", "default", "lg", "xl"] as const;
|
|
13113
|
+
return (
|
|
13114
|
+
<div className="space-y-8">
|
|
13115
|
+
<p className="text-sm text-muted-foreground">
|
|
13116
|
+
System wrapper for any Lucide icon. Stroke width is pinned to 1.5 (the
|
|
13117
|
+
prop is omitted on purpose), size is a four-stop ladder, and{" "}
|
|
13118
|
+
<code className="font-mono">color</code> is a semantic role resolved
|
|
13119
|
+
through <code className="font-mono">getIconColor()</code> to the{" "}
|
|
13120
|
+
<code className="font-mono">icon-*</code> token family. Decorative by
|
|
13121
|
+
default; <code className="font-mono">label</code> makes it a named image.
|
|
13122
|
+
</p>
|
|
13123
|
+
|
|
13124
|
+
<div>
|
|
13125
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13126
|
+
Sizes — sm 14 / default 16 / lg 20 / xl 24.
|
|
13127
|
+
</p>
|
|
13128
|
+
<div className="flex flex-col gap-3">
|
|
13129
|
+
{sizes.map((size) => (
|
|
13130
|
+
<div key={size} className="flex items-center gap-4">
|
|
13131
|
+
<Icon as={Search} size={size} />
|
|
13132
|
+
<Icon as={BellIcon} size={size} />
|
|
13133
|
+
<Icon as={PaletteIcon} size={size} />
|
|
13134
|
+
<Icon as={Sparkles} size={size} />
|
|
13135
|
+
<span className="text-xs text-muted-foreground">{size}</span>
|
|
13136
|
+
</div>
|
|
13137
|
+
))}
|
|
13138
|
+
</div>
|
|
13139
|
+
</div>
|
|
13140
|
+
|
|
13141
|
+
<div>
|
|
13142
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13143
|
+
Color roles — every entry in the icon-* token family (inverse sits on
|
|
13144
|
+
a filled primary chip, the only surface it is for).
|
|
13145
|
+
</p>
|
|
13146
|
+
<div className="grid max-w-md grid-cols-3 gap-x-8 gap-y-4 text-sm">
|
|
13147
|
+
{ICON_ROLES.map((role) =>
|
|
13148
|
+
role === "inverse" ? (
|
|
13149
|
+
<div key={role} className="flex items-center gap-2">
|
|
13150
|
+
<span className="inline-flex size-7 items-center justify-center rounded-md bg-primary">
|
|
13151
|
+
<Icon as={Sparkles} color={role} />
|
|
13152
|
+
</span>
|
|
13153
|
+
<span className="text-muted-foreground">{role}</span>
|
|
13154
|
+
</div>
|
|
13155
|
+
) : (
|
|
13156
|
+
<div key={role} className="flex items-center gap-2">
|
|
13157
|
+
<Icon as={Sparkles} size="lg" color={role} />
|
|
13158
|
+
<span className="text-muted-foreground">{role}</span>
|
|
13159
|
+
</div>
|
|
13160
|
+
)
|
|
13161
|
+
)}
|
|
13162
|
+
</div>
|
|
13163
|
+
</div>
|
|
13164
|
+
|
|
13165
|
+
<div>
|
|
13166
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13167
|
+
Decorative vs labeled — a labeled icon announces as an image named by
|
|
13168
|
+
its meaning (“Passing”), not its glyph.
|
|
13169
|
+
</p>
|
|
13170
|
+
<div className="flex flex-col gap-3 text-sm">
|
|
13171
|
+
<div className="flex items-center gap-2">
|
|
13172
|
+
<Icon as={CircleCheck} color="success" />
|
|
13173
|
+
<span>Decorative — the text beside it carries the meaning</span>
|
|
13174
|
+
</div>
|
|
13175
|
+
<div className="flex items-center gap-2">
|
|
13176
|
+
<Icon as={CircleCheck} color="success" label="Passing" />
|
|
13177
|
+
<span className="text-muted-foreground">
|
|
13178
|
+
Labeled — role="img", aria-label="Passing"
|
|
13179
|
+
</span>
|
|
13180
|
+
</div>
|
|
13181
|
+
</div>
|
|
13182
|
+
</div>
|
|
13183
|
+
|
|
13184
|
+
<div>
|
|
13185
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13186
|
+
Realistic use — pre-commit status list, icons colored by role beside
|
|
13187
|
+
their text; buttons inherit currentColor.
|
|
13188
|
+
</p>
|
|
13189
|
+
<Card className="max-w-sm gap-0 p-6">
|
|
13190
|
+
<p className="mb-4 text-lg font-semibold">Pre-commit checks</p>
|
|
13191
|
+
<ul className="flex flex-col gap-3 text-sm">
|
|
13192
|
+
<li className="flex items-start gap-2">
|
|
13193
|
+
<Icon as={CircleCheck} color="success" className="mt-0.5" />
|
|
13194
|
+
<span>
|
|
13195
|
+
<span className="font-medium">Story coverage check passed.</span>{" "}
|
|
13196
|
+
<span className="text-muted-foreground">
|
|
13197
|
+
All 36 components have matching stories.
|
|
13198
|
+
</span>
|
|
13199
|
+
</span>
|
|
13200
|
+
</li>
|
|
13201
|
+
<li className="flex items-start gap-2">
|
|
13202
|
+
<Icon as={CircleAlert} color="error" className="mt-0.5" />
|
|
13203
|
+
<span>
|
|
13204
|
+
<span className="font-medium">Token build failed.</span>{" "}
|
|
13205
|
+
<span className="text-muted-foreground">
|
|
13206
|
+
Check tokens.json for syntax errors and run pnpm build:tokens
|
|
13207
|
+
again.
|
|
13208
|
+
</span>
|
|
13209
|
+
</span>
|
|
13210
|
+
</li>
|
|
13211
|
+
<li className="flex items-start gap-2">
|
|
13212
|
+
<Icon as={TriangleAlert} color="warning" className="mt-0.5" />
|
|
13213
|
+
<span>
|
|
13214
|
+
<span className="font-medium">7:1 contrast</span>{" "}
|
|
13215
|
+
<span className="text-muted-foreground">
|
|
13216
|
+
— two token pairs are AA only.
|
|
13217
|
+
</span>
|
|
13218
|
+
</span>
|
|
13219
|
+
</li>
|
|
13220
|
+
<li className="flex items-start gap-2">
|
|
13221
|
+
<Icon as={Info} color="info" className="mt-0.5" />
|
|
13222
|
+
<span className="text-muted-foreground">
|
|
13223
|
+
44×44px target enforced on every CTA.
|
|
13224
|
+
</span>
|
|
13225
|
+
</li>
|
|
13226
|
+
</ul>
|
|
13227
|
+
<div className="mt-5 flex flex-wrap gap-2">
|
|
13228
|
+
<Button size="xl">
|
|
13229
|
+
<Icon as={Search} size="lg" />
|
|
13230
|
+
Search components
|
|
13231
|
+
</Button>
|
|
13232
|
+
<Button size="xl" variant="outline">
|
|
13233
|
+
<Icon as={PaletteIcon} size="lg" />
|
|
13234
|
+
Customize
|
|
13235
|
+
</Button>
|
|
13236
|
+
</div>
|
|
13237
|
+
</Card>
|
|
13238
|
+
</div>
|
|
13239
|
+
</div>
|
|
13240
|
+
);
|
|
13241
|
+
}
|
|
13242
|
+
|
|
13243
|
+
function AnnouncementBarShowcase() {
|
|
13244
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
13245
|
+
return (
|
|
13246
|
+
<div className="space-y-8">
|
|
13247
|
+
<div>
|
|
13248
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13249
|
+
All five variants
|
|
13250
|
+
</p>
|
|
13251
|
+
<div className="flex flex-col rounded-lg overflow-hidden border border-border">
|
|
13252
|
+
<AnnouncementBar variant="default">
|
|
13253
|
+
BADS v2.4 — ProgressStack, Callout & AnnouncementBar now available.
|
|
13254
|
+
</AnnouncementBar>
|
|
13255
|
+
<AnnouncementBar variant="info">
|
|
13256
|
+
Scheduled maintenance Sunday 2026-09-21 02:00–04:00 CDT.
|
|
13257
|
+
</AnnouncementBar>
|
|
13258
|
+
<AnnouncementBar variant="success">
|
|
13259
|
+
Incident resolved — build pipeline fully operational.
|
|
13260
|
+
</AnnouncementBar>
|
|
13261
|
+
<AnnouncementBar variant="warning">
|
|
13262
|
+
Deprecation: <code className="font-mono text-xs">impactLevel</code> removed in v3.
|
|
13263
|
+
</AnnouncementBar>
|
|
13264
|
+
<AnnouncementBar variant="destructive">
|
|
13265
|
+
Partial outage — Night Shift component builds paused.
|
|
13266
|
+
</AnnouncementBar>
|
|
13267
|
+
</div>
|
|
13268
|
+
</div>
|
|
13269
|
+
<div>
|
|
13270
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13271
|
+
With action link
|
|
13272
|
+
</p>
|
|
13273
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13274
|
+
<AnnouncementBar
|
|
13275
|
+
variant="default"
|
|
13276
|
+
action={
|
|
13277
|
+
<a
|
|
13278
|
+
href="#changelog"
|
|
13279
|
+
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"
|
|
13280
|
+
>
|
|
13281
|
+
View changelog
|
|
13282
|
+
</a>
|
|
13283
|
+
}
|
|
13284
|
+
>
|
|
13285
|
+
BADS v2.4 ships 12 new components, including ProgressStack and Callout.
|
|
13286
|
+
</AnnouncementBar>
|
|
13287
|
+
</div>
|
|
13288
|
+
</div>
|
|
13289
|
+
<div>
|
|
13290
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13291
|
+
Dismissible — with action + dismiss button
|
|
13292
|
+
</p>
|
|
13293
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13294
|
+
{!dismissed ? (
|
|
13295
|
+
<AnnouncementBar
|
|
13296
|
+
variant="info"
|
|
13297
|
+
aria-label="Free plan limit notice"
|
|
13298
|
+
onDismiss={() => setDismissed(true)}
|
|
13299
|
+
action={
|
|
13300
|
+
<a
|
|
13301
|
+
href="#upgrade"
|
|
13302
|
+
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"
|
|
13303
|
+
>
|
|
13304
|
+
Upgrade
|
|
13305
|
+
</a>
|
|
13306
|
+
}
|
|
13307
|
+
>
|
|
13308
|
+
You're on the free plan — 3 active fork limit.
|
|
13309
|
+
</AnnouncementBar>
|
|
13310
|
+
) : (
|
|
13311
|
+
<div className="flex items-center justify-center py-4 text-sm text-muted-foreground">
|
|
13312
|
+
Bar dismissed —{" "}
|
|
13313
|
+
<button
|
|
13314
|
+
type="button"
|
|
13315
|
+
className="ml-1 underline"
|
|
13316
|
+
onClick={() => setDismissed(false)}
|
|
13317
|
+
>
|
|
13318
|
+
restore
|
|
13319
|
+
</button>
|
|
13320
|
+
</div>
|
|
13321
|
+
)}
|
|
13322
|
+
</div>
|
|
13323
|
+
</div>
|
|
13324
|
+
<div>
|
|
13325
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13326
|
+
Realistic use — above a mock app shell
|
|
13327
|
+
</p>
|
|
13328
|
+
<div className="rounded-lg overflow-hidden border border-border">
|
|
13329
|
+
<AnnouncementBar
|
|
13330
|
+
variant="default"
|
|
13331
|
+
action={
|
|
13332
|
+
<a
|
|
13333
|
+
href="#changelog"
|
|
13334
|
+
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"
|
|
13335
|
+
>
|
|
13336
|
+
What's new →
|
|
13337
|
+
</a>
|
|
13338
|
+
}
|
|
13339
|
+
>
|
|
13340
|
+
BADS v2.4 — ProgressStack, Callout & AnnouncementBar are live.
|
|
13341
|
+
</AnnouncementBar>
|
|
13342
|
+
<div className="border-b px-6 py-3 flex items-center gap-3 bg-card">
|
|
13343
|
+
<span className="font-semibold text-sm">BADS</span>
|
|
13344
|
+
<span className="text-xs text-muted-foreground">Design System</span>
|
|
13345
|
+
</div>
|
|
13346
|
+
<div className="px-6 py-8 bg-background text-sm text-muted-foreground">
|
|
13347
|
+
Main content area — the bar sits above, outside the layout shell.
|
|
13348
|
+
</div>
|
|
13349
|
+
</div>
|
|
13350
|
+
</div>
|
|
13351
|
+
</div>
|
|
13352
|
+
);
|
|
13353
|
+
}
|
|
13354
|
+
|
|
13355
|
+
function GridShowcase() {
|
|
13356
|
+
const cell = (label: string) => (
|
|
13357
|
+
// lint-disable: card-bypass — dashed-border placeholder cell for the Grid span demo; visual ruler cell, not content Card
|
|
13358
|
+
<div className="flex h-12 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-card px-2">
|
|
13359
|
+
<span className="truncate text-sm text-muted-foreground">{label}</span>
|
|
13360
|
+
</div>
|
|
13361
|
+
);
|
|
13362
|
+
return (
|
|
13363
|
+
<div className="space-y-8">
|
|
13364
|
+
<p className="text-sm text-muted-foreground">
|
|
13365
|
+
Twelve-track span grid — the SimpleGrid sibling for unequal columns. A{" "}
|
|
13366
|
+
<code className="text-xs">GridCol</code> spans 1–12 tracks and can be
|
|
13367
|
+
pushed right with <code className="text-xs">offset</code>, per
|
|
13368
|
+
breakpoint. Same scanner-safe contract as SimpleGrid: every span and
|
|
13369
|
+
start maps to a literal class, so a dynamic{" "}
|
|
13370
|
+
<code className="text-xs">{"col-span-${n}"}</code> can never silently
|
|
13371
|
+
compile to nothing. No <code className="text-xs">order</code> prop by
|
|
13372
|
+
design — reading order always matches DOM order.
|
|
13373
|
+
</p>
|
|
13374
|
+
|
|
13375
|
+
<div>
|
|
13376
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13377
|
+
Spans — 12 / 6+6 / 4+4+4 / 3+9 with gap="sm".
|
|
13378
|
+
</p>
|
|
13379
|
+
<Grid gap="sm">
|
|
13380
|
+
<GridCol span={12}>{cell("12")}</GridCol>
|
|
13381
|
+
<GridCol span={6}>{cell("6")}</GridCol>
|
|
13382
|
+
<GridCol span={6}>{cell("6")}</GridCol>
|
|
13383
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13384
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13385
|
+
<GridCol span={4}>{cell("4")}</GridCol>
|
|
13386
|
+
<GridCol span={3}>{cell("3")}</GridCol>
|
|
13387
|
+
<GridCol span={9}>{cell("9")}</GridCol>
|
|
13388
|
+
</Grid>
|
|
13389
|
+
</div>
|
|
13390
|
+
|
|
13391
|
+
<div>
|
|
13392
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13393
|
+
Offset — leading empty tracks via grid-column-start; a cell that no
|
|
13394
|
+
longer fits its row wraps to the next.
|
|
13395
|
+
</p>
|
|
13396
|
+
<Grid gap="sm">
|
|
13397
|
+
<GridCol span={4} offset={4}>
|
|
13398
|
+
{cell("span 4 · offset 4")}
|
|
13399
|
+
</GridCol>
|
|
13400
|
+
<GridCol span={3} offset={2}>
|
|
13401
|
+
{cell("span 3 · offset 2")}
|
|
13402
|
+
</GridCol>
|
|
13403
|
+
<GridCol span={5}>{cell("span 5")}</GridCol>
|
|
13404
|
+
<GridCol span={6} offset={6}>
|
|
13405
|
+
{cell("span 6 · offset 6")}
|
|
13406
|
+
</GridCol>
|
|
13407
|
+
</Grid>
|
|
13408
|
+
</div>
|
|
13409
|
+
|
|
13410
|
+
<div>
|
|
13411
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13412
|
+
Responsive — span={{ base: 12, md: 8 }} +
|
|
13413
|
+
{{ base: 12, md: 4 }}; quarters are base 6 → lg 3.
|
|
13414
|
+
Resize the window to watch the tracks reflow.
|
|
13415
|
+
</p>
|
|
13416
|
+
<Grid gap="md">
|
|
13417
|
+
<GridCol span={{ base: 12, md: 8 }}>{cell("main")}</GridCol>
|
|
13418
|
+
<GridCol span={{ base: 12, md: 4 }}>{cell("aside")}</GridCol>
|
|
13419
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13420
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13421
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13422
|
+
<GridCol span={{ base: 6, lg: 3 }}>{cell("quarter")}</GridCol>
|
|
13423
|
+
</Grid>
|
|
13424
|
+
</div>
|
|
13425
|
+
|
|
13426
|
+
<div>
|
|
13427
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13428
|
+
Realistic use — review detail (8) + reviewers aside (4), then four
|
|
13429
|
+
metric tiles (base 6 → lg 3).
|
|
13430
|
+
</p>
|
|
13431
|
+
<Grid gap="lg">
|
|
13432
|
+
<GridCol span={{ base: 12, lg: 8 }}>
|
|
13433
|
+
<Card>
|
|
13434
|
+
<CardHeader>
|
|
13435
|
+
<CardTitle>Tokens v2 proposal</CardTitle>
|
|
13436
|
+
<CardDescription>
|
|
13437
|
+
Jordan Reeves — review May 26, 2026
|
|
13438
|
+
</CardDescription>
|
|
13439
|
+
</CardHeader>
|
|
13440
|
+
<CardContent>
|
|
13441
|
+
<p className="text-sm text-muted-foreground">
|
|
13442
|
+
Consolidates the spacing scale to eight stops; retires four
|
|
13443
|
+
orphaned color tokens. Both CSS files regenerate from a
|
|
13444
|
+
single tokens.json change, and every fork picks it up on the
|
|
13445
|
+
next core bump.
|
|
13446
|
+
</p>
|
|
13447
|
+
</CardContent>
|
|
13448
|
+
</Card>
|
|
13449
|
+
</GridCol>
|
|
13450
|
+
<GridCol span={{ base: 12, lg: 4 }}>
|
|
13451
|
+
<Card>
|
|
13452
|
+
<CardHeader>
|
|
13453
|
+
<CardTitle>Reviewers</CardTitle>
|
|
13454
|
+
<CardDescription>Sign-off due 2026-05-26</CardDescription>
|
|
13455
|
+
</CardHeader>
|
|
13456
|
+
<CardContent>
|
|
13457
|
+
<ul className="space-y-2 text-sm">
|
|
13458
|
+
{[
|
|
13459
|
+
["Seo-yun Park", "Approved"],
|
|
13460
|
+
["Marcus Lindqvist", "Pending"],
|
|
13461
|
+
["Anika Patel", "Pending"],
|
|
13462
|
+
].map(([name, state]) => (
|
|
13463
|
+
<li key={name} className="flex justify-between gap-3">
|
|
13464
|
+
<span className="min-w-0 truncate">{name}</span>
|
|
13465
|
+
<span className="shrink-0 text-muted-foreground">
|
|
13466
|
+
{state}
|
|
13467
|
+
</span>
|
|
13468
|
+
</li>
|
|
13469
|
+
))}
|
|
13470
|
+
</ul>
|
|
13471
|
+
</CardContent>
|
|
13472
|
+
</Card>
|
|
13473
|
+
</GridCol>
|
|
13474
|
+
{[
|
|
13475
|
+
["Components", "36"],
|
|
13476
|
+
["Contrast floor", "7:1"],
|
|
13477
|
+
["Story coverage", "98.4%"],
|
|
13478
|
+
["Build hours avoided", "1,432"],
|
|
13479
|
+
].map(([label, value]) => (
|
|
13480
|
+
<GridCol key={label} span={{ base: 6, lg: 3 }}>
|
|
13481
|
+
<Card>
|
|
13482
|
+
<CardHeader>
|
|
13483
|
+
<CardDescription>{label}</CardDescription>
|
|
13484
|
+
<CardTitle className="text-2xl tabular-nums">{value}</CardTitle>
|
|
13485
|
+
</CardHeader>
|
|
13486
|
+
</Card>
|
|
13487
|
+
</GridCol>
|
|
13488
|
+
))}
|
|
13489
|
+
</Grid>
|
|
13490
|
+
</div>
|
|
13491
|
+
</div>
|
|
13492
|
+
);
|
|
13493
|
+
}
|
|
13494
|
+
|
|
13495
|
+
function PasswordStrengthInputShowcase() {
|
|
13496
|
+
const [controlled, setControlled] = React.useState("")
|
|
13497
|
+
|
|
13498
|
+
return (
|
|
13499
|
+
<div className="space-y-8">
|
|
13500
|
+
<p className="text-sm text-muted-foreground">
|
|
13501
|
+
Composes PasswordInput + a segmented strength bar + live-region label.
|
|
13502
|
+
Strength is driven by a pluggable{" "}
|
|
13503
|
+
<code className="text-xs font-mono">strengthFn</code> — swap in zxcvbn
|
|
13504
|
+
or a backend scorer without changing the visual contract. Four source
|
|
13505
|
+
parity: Mantine PasswordInput strength prop, shadcn/ui Auth block, MUI
|
|
13506
|
+
PasswordStrength example, Ark UI composition.
|
|
13507
|
+
</p>
|
|
13508
|
+
|
|
13509
|
+
{/* Default uncontrolled */}
|
|
13510
|
+
<div>
|
|
13511
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13512
|
+
Default — 4 segments, label visible, hints hidden
|
|
13513
|
+
</p>
|
|
13514
|
+
<PasswordStrengthInput
|
|
13515
|
+
placeholder="New password"
|
|
13516
|
+
autoComplete="new-password"
|
|
13517
|
+
className="max-w-xs"
|
|
13518
|
+
/>
|
|
13519
|
+
</div>
|
|
13520
|
+
|
|
13521
|
+
{/* With hints */}
|
|
13522
|
+
<div>
|
|
13523
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13524
|
+
showHints — requirements list below the bar
|
|
13525
|
+
</p>
|
|
13526
|
+
<PasswordStrengthInput
|
|
13527
|
+
placeholder="New password"
|
|
13528
|
+
autoComplete="new-password"
|
|
13529
|
+
showHints
|
|
13530
|
+
className="max-w-xs"
|
|
13531
|
+
/>
|
|
13532
|
+
</div>
|
|
13533
|
+
|
|
13534
|
+
{/* Strength levels side by side */}
|
|
13535
|
+
<div>
|
|
13536
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13537
|
+
Four strength levels — weak · fair · good · strong
|
|
13538
|
+
</p>
|
|
13539
|
+
<div className="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
|
13540
|
+
{(
|
|
13541
|
+
[
|
|
13542
|
+
{ value: "pass", label: "Weak" },
|
|
13543
|
+
{ value: "password1", label: "Fair" },
|
|
13544
|
+
{ value: "Password123", label: "Good" },
|
|
13545
|
+
{ value: "P@ssword123!!", label: "Strong" },
|
|
13546
|
+
] as const
|
|
13547
|
+
).map(({ value, label }) => (
|
|
13548
|
+
<div key={label} className="flex flex-col gap-1">
|
|
13549
|
+
<span className="text-xs text-muted-foreground">{label}</span>
|
|
13550
|
+
<PasswordStrengthInput
|
|
13551
|
+
value={value}
|
|
13552
|
+
onChange={() => {}}
|
|
13553
|
+
size="sm"
|
|
13554
|
+
showLabel={false}
|
|
13555
|
+
/>
|
|
13556
|
+
</div>
|
|
13557
|
+
))}
|
|
13558
|
+
</div>
|
|
13559
|
+
</div>
|
|
13560
|
+
|
|
13561
|
+
{/* Controlled + segment variants */}
|
|
13562
|
+
<div>
|
|
13563
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13564
|
+
Controlled (live) — 5 segments
|
|
13565
|
+
</p>
|
|
13566
|
+
<PasswordStrengthInput
|
|
13567
|
+
value={controlled}
|
|
13568
|
+
onChange={(e) => setControlled(e.target.value)}
|
|
13569
|
+
placeholder="Type to see strength update"
|
|
13570
|
+
autoComplete="new-password"
|
|
13571
|
+
segments={5}
|
|
13572
|
+
className="max-w-xs"
|
|
13573
|
+
/>
|
|
13574
|
+
</div>
|
|
13575
|
+
|
|
13576
|
+
{/* Sizes */}
|
|
13577
|
+
<div>
|
|
13578
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13579
|
+
Sizes — sm · default · lg · xl
|
|
13580
|
+
</p>
|
|
13581
|
+
<div className="flex flex-col gap-4 max-w-xs">
|
|
13582
|
+
{(["sm", "default", "lg", "xl"] as const).map((size) => (
|
|
13583
|
+
<PasswordStrengthInput
|
|
13584
|
+
key={size}
|
|
13585
|
+
size={size}
|
|
13586
|
+
placeholder={`size="${size}"`}
|
|
13587
|
+
autoComplete="new-password"
|
|
13588
|
+
showLabel={false}
|
|
13589
|
+
/>
|
|
13590
|
+
))}
|
|
13591
|
+
</div>
|
|
13592
|
+
</div>
|
|
13593
|
+
|
|
13594
|
+
{/* Disabled */}
|
|
13595
|
+
<div>
|
|
13596
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13597
|
+
Disabled
|
|
13598
|
+
</p>
|
|
13599
|
+
<PasswordStrengthInput
|
|
13600
|
+
disabled
|
|
13601
|
+
placeholder="Disabled"
|
|
13602
|
+
className="max-w-xs"
|
|
13603
|
+
/>
|
|
13604
|
+
</div>
|
|
13605
|
+
</div>
|
|
13606
|
+
);
|
|
13607
|
+
}
|
|
13608
|
+
|
|
13609
|
+
function InfiniteScrollShowcase() {
|
|
13610
|
+
type Item = { id: number; name: string; role: string; initials: string }
|
|
13611
|
+
const names = [
|
|
13612
|
+
{ name: "Priya Chandrasekaran", role: "Product designer", initials: "PC" },
|
|
13613
|
+
{ name: "Marcus Oliveira", role: "Frontend engineer", initials: "MO" },
|
|
13614
|
+
{ name: "Aisha Tanaka", role: "Engineering manager", initials: "AT" },
|
|
13615
|
+
{ name: "Samuel Adeyemi", role: "Backend engineer", initials: "SA" },
|
|
13616
|
+
{ name: "Lena Bergmann", role: "UX researcher", initials: "LB" },
|
|
13617
|
+
]
|
|
13618
|
+
function makeItems(start: number, count: number): Item[] {
|
|
13619
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
13620
|
+
id: start + i,
|
|
13621
|
+
...names[(start + i) % names.length],
|
|
13622
|
+
}))
|
|
13623
|
+
}
|
|
13624
|
+
const PAGE = 8
|
|
13625
|
+
const MAX = 32
|
|
13626
|
+
const [items, setItems] = React.useState<Item[]>(() => makeItems(0, PAGE))
|
|
13627
|
+
const [loading, setLoading] = React.useState(false)
|
|
13628
|
+
|
|
13629
|
+
function loadMore() {
|
|
13630
|
+
if (loading) return
|
|
13631
|
+
setLoading(true)
|
|
13632
|
+
setTimeout(() => {
|
|
13633
|
+
setItems((prev) => [...prev, ...makeItems(prev.length, PAGE)])
|
|
13634
|
+
setLoading(false)
|
|
13635
|
+
}, 800)
|
|
13636
|
+
}
|
|
13637
|
+
|
|
13638
|
+
return (
|
|
13639
|
+
<div className="space-y-6">
|
|
13640
|
+
{/* lint-disable: card-bypass — InfiniteScroll wraps the list; a Card here would double-wrap */}
|
|
13641
|
+
<div className="max-h-[360px] overflow-y-auto rounded-lg border bg-card">
|
|
13642
|
+
<InfiniteScroll
|
|
13643
|
+
onLoadMore={loadMore}
|
|
13644
|
+
hasMore={items.length < MAX}
|
|
13645
|
+
endMessage={
|
|
13646
|
+
<p className="py-6 text-center text-sm text-muted-foreground">
|
|
13647
|
+
All {MAX} team members loaded
|
|
13648
|
+
</p>
|
|
13649
|
+
}
|
|
13650
|
+
>
|
|
13651
|
+
<ul>
|
|
13652
|
+
{items.map((item, i) => (
|
|
13653
|
+
<li key={item.id}>
|
|
13654
|
+
{i > 0 && <div className="border-t" />}
|
|
13655
|
+
<div className="flex items-center gap-3 px-4 py-3">
|
|
13656
|
+
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium">
|
|
13657
|
+
{item.initials}
|
|
13658
|
+
</div>
|
|
13659
|
+
<div className="min-w-0 flex-1">
|
|
13660
|
+
<p className="truncate text-sm font-medium">{item.name}</p>
|
|
13661
|
+
<p className="truncate text-xs text-muted-foreground">{item.role}</p>
|
|
13662
|
+
</div>
|
|
13663
|
+
</div>
|
|
13664
|
+
</li>
|
|
13665
|
+
))}
|
|
13666
|
+
</ul>
|
|
13667
|
+
</InfiniteScroll>
|
|
13668
|
+
</div>
|
|
13669
|
+
<p className="text-xs text-muted-foreground">
|
|
13670
|
+
Scroll the list to trigger IntersectionObserver load-more. Loads {PAGE} items per page up to {MAX}.
|
|
13671
|
+
</p>
|
|
13672
|
+
</div>
|
|
13673
|
+
)
|
|
13674
|
+
}
|
|
13675
|
+
|
|
13676
|
+
function ScrollProgressShowcase() {
|
|
13677
|
+
const stickyRef = React.useRef<HTMLDivElement>(null)
|
|
13678
|
+
const inlineRef = React.useRef<HTMLDivElement>(null)
|
|
13679
|
+
return (
|
|
13680
|
+
<div className="space-y-6">
|
|
13681
|
+
<div>
|
|
13682
|
+
<p className="mb-2 text-xs text-muted-foreground">Sticky — inside a scroll container header</p>
|
|
13683
|
+
<div ref={stickyRef} className="relative max-h-[280px] overflow-y-auto rounded-lg border">
|
|
13684
|
+
<ScrollProgress containerRef={stickyRef} position="sticky" />
|
|
13685
|
+
<div className="space-y-4 p-5">
|
|
13686
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
13687
|
+
<p key={i} className="text-sm text-muted-foreground">
|
|
13688
|
+
Paragraph {i + 1}: Scroll down to see the progress bar advance along the top of this container.
|
|
13689
|
+
</p>
|
|
13690
|
+
))}
|
|
13691
|
+
</div>
|
|
13692
|
+
</div>
|
|
13693
|
+
</div>
|
|
13694
|
+
<div>
|
|
13695
|
+
<p className="mb-2 text-xs text-muted-foreground">Custom style — 4 px height, destructive color, no track</p>
|
|
13696
|
+
<div ref={inlineRef} className="relative max-h-[200px] overflow-y-auto rounded-lg border">
|
|
13697
|
+
<ScrollProgress
|
|
13698
|
+
containerRef={inlineRef}
|
|
13699
|
+
position="sticky"
|
|
13700
|
+
height="4px"
|
|
13701
|
+
color="var(--destructive)"
|
|
13702
|
+
trackColor="transparent"
|
|
13703
|
+
/>
|
|
13704
|
+
<div className="space-y-4 p-5">
|
|
13705
|
+
{Array.from({ length: 10 }, (_, i) => (
|
|
13706
|
+
<p key={i} className="text-sm text-muted-foreground">
|
|
13707
|
+
Item {i + 1}: Custom bar — 4 px height, destructive color, no track.
|
|
13708
|
+
</p>
|
|
13709
|
+
))}
|
|
13710
|
+
</div>
|
|
13711
|
+
</div>
|
|
13712
|
+
</div>
|
|
13713
|
+
</div>
|
|
13714
|
+
)
|
|
13715
|
+
}
|
|
13716
|
+
|
|
13717
|
+
function PillShowcase() {
|
|
13718
|
+
return (
|
|
13719
|
+
<div className="space-y-6">
|
|
13720
|
+
<p className="text-sm text-muted-foreground">
|
|
13721
|
+
Compact, non-removable, read-only label — the neutral member of the
|
|
13722
|
+
label family. Tag carries a dismiss affordance and status variants,
|
|
13723
|
+
Badge carries status semantics, Chip toggles; Pill is for metadata
|
|
13724
|
+
that is none of those: taxonomy terms, owners, environments, counts.
|
|
13725
|
+
Plain span, no role, never a CTA (the 44px floor does not apply).
|
|
13726
|
+
</p>
|
|
13727
|
+
<div className="space-y-2">
|
|
13728
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13729
|
+
Variants — default (secondary) / outline / muted
|
|
13730
|
+
</p>
|
|
13731
|
+
<PillGroup>
|
|
13732
|
+
<Pill>design tokens</Pill>
|
|
13733
|
+
<Pill variant="outline">semantic layer</Pill>
|
|
13734
|
+
<Pill variant="muted">a11y contract</Pill>
|
|
13735
|
+
</PillGroup>
|
|
13736
|
+
</div>
|
|
13737
|
+
<div className="space-y-2">
|
|
13738
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13739
|
+
Sizes — sm (default, 14px) / md / lg
|
|
13740
|
+
</p>
|
|
13741
|
+
<PillGroup>
|
|
13742
|
+
<Pill size="sm">CVA variants</Pill>
|
|
13743
|
+
<Pill size="md">Radix primitive</Pill>
|
|
13744
|
+
<Pill size="lg">forced colors</Pill>
|
|
13745
|
+
</PillGroup>
|
|
13746
|
+
</div>
|
|
13747
|
+
<div className="space-y-2">
|
|
13748
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13749
|
+
Leading icon slot (strokeWidth 1.5, scaled per size) and a 20px
|
|
13750
|
+
Avatar for owner pills
|
|
13751
|
+
</p>
|
|
13752
|
+
<PillGroup>
|
|
13753
|
+
<Pill icon={<GitPullRequestIcon strokeWidth={1.5} />}>main</Pill>
|
|
13754
|
+
<Pill size="md" variant="outline" icon={<ShieldCheckIcon strokeWidth={1.5} />}>
|
|
13755
|
+
7:1 contrast
|
|
13756
|
+
</Pill>
|
|
13757
|
+
<Pill
|
|
13758
|
+
size="lg"
|
|
13759
|
+
variant="outline"
|
|
13760
|
+
className="pl-1"
|
|
13761
|
+
icon={
|
|
13762
|
+
<Avatar size="xs">
|
|
13763
|
+
<AvatarFallback className="text-xs">JR</AvatarFallback>
|
|
13764
|
+
</Avatar>
|
|
13765
|
+
}
|
|
13766
|
+
>
|
|
13767
|
+
Jordan Reeves
|
|
13768
|
+
</Pill>
|
|
13769
|
+
</PillGroup>
|
|
13770
|
+
</div>
|
|
13771
|
+
<div className="space-y-2">
|
|
13772
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13773
|
+
Disabled — presentational dim only; the owning control conveys the
|
|
13774
|
+
state
|
|
13775
|
+
</p>
|
|
13776
|
+
<PillGroup>
|
|
13777
|
+
<Pill disabled>token drift</Pill>
|
|
13778
|
+
<Pill disabled variant="outline">visual regression</Pill>
|
|
13779
|
+
<Pill disabled variant="muted">focus trap</Pill>
|
|
13780
|
+
</PillGroup>
|
|
13781
|
+
</div>
|
|
13782
|
+
<div className="space-y-2">
|
|
13783
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13784
|
+
Long labels truncate inside a narrow parent (full value in title)
|
|
13785
|
+
</p>
|
|
13786
|
+
<div className="w-56 rounded-lg border p-3">
|
|
13787
|
+
<PillGroup>
|
|
13788
|
+
<Pill title="Wilhelmina-Constance Featherstonehaugh-Vance">
|
|
13789
|
+
Wilhelmina-Constance Featherstonehaugh-Vance
|
|
13790
|
+
</Pill>
|
|
13791
|
+
<Pill variant="muted">李雪芹</Pill>
|
|
13792
|
+
</PillGroup>
|
|
13793
|
+
</div>
|
|
13794
|
+
</div>
|
|
13795
|
+
</div>
|
|
13796
|
+
);
|
|
13797
|
+
}
|
|
13798
|
+
|
|
13799
|
+
function SnackbarShowcase() {
|
|
13800
|
+
const [anchor, setAnchor] = React.useState<SnackbarAnchor>("bottom-center");
|
|
13801
|
+
return (
|
|
13802
|
+
<div className="space-y-8">
|
|
13803
|
+
<p className="text-sm text-muted-foreground">
|
|
13804
|
+
One transient feedback message at a time, anchored to the bottom of the
|
|
13805
|
+
screen, that auto-dismisses. <code className="font-mono">useSnackbar()</code>{" "}
|
|
13806
|
+
gives you <code className="font-mono">show()</code> and{" "}
|
|
13807
|
+
<code className="font-mono">dismiss()</code>; the next message queues
|
|
13808
|
+
behind the current one and nothing ever stacks — that is Sonner's
|
|
13809
|
+
job, for async events the user needs to see several of at once. The
|
|
13810
|
+
timer pauses on hover and focus; a sticky message is always
|
|
13811
|
+
dismissible; the live region is mounted before the first message so
|
|
13812
|
+
screen readers announce it. Enter/exit ride the existing Presence
|
|
13813
|
+
slide-up keyframes.
|
|
13814
|
+
</p>
|
|
13815
|
+
{/* The provider is local to this section: the preview app has no
|
|
13816
|
+
app-level SnackbarProvider, and the outlet portals to this iframe's
|
|
13817
|
+
own <body>, so it pins to the bottom of the Components tab. */}
|
|
13818
|
+
<SnackbarProvider anchor={anchor}>
|
|
13819
|
+
<div className="flex flex-col gap-6">
|
|
13820
|
+
<SegmentedControl
|
|
13821
|
+
value={anchor}
|
|
13822
|
+
onValueChange={(v) => setAnchor(v as SnackbarAnchor)}
|
|
13823
|
+
label="Snackbar anchor"
|
|
13824
|
+
className="w-fit"
|
|
13825
|
+
>
|
|
13826
|
+
{SNACKBAR_ANCHORS.map((a) => (
|
|
13827
|
+
<SegmentedControlItem key={a} value={a}>
|
|
13828
|
+
{a}
|
|
13829
|
+
</SegmentedControlItem>
|
|
13830
|
+
))}
|
|
13831
|
+
</SegmentedControl>
|
|
13832
|
+
<SnackbarShowcaseTriggers />
|
|
13833
|
+
</div>
|
|
13834
|
+
</SnackbarProvider>
|
|
13835
|
+
</div>
|
|
13836
|
+
);
|
|
13837
|
+
}
|
|
13838
|
+
|
|
13839
|
+
function SnackbarShowcaseTriggers() {
|
|
13840
|
+
const { show, dismiss } = useSnackbar();
|
|
13841
|
+
const [archived, setArchived] = React.useState<string[]>([]);
|
|
13842
|
+
return (
|
|
13843
|
+
<div className="space-y-6">
|
|
13844
|
+
<div>
|
|
13845
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13846
|
+
Default — message only, 4 s
|
|
13847
|
+
</p>
|
|
13848
|
+
<Button variant="outline" size="xl" onClick={() => show("Settings saved")}>
|
|
13849
|
+
Save settings
|
|
13850
|
+
</Button>
|
|
13851
|
+
</div>
|
|
13852
|
+
<div>
|
|
13853
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13854
|
+
With action + icon — Undo restores the archived member
|
|
13855
|
+
</p>
|
|
13856
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
13857
|
+
<Button
|
|
13858
|
+
variant="outline"
|
|
13859
|
+
size="xl"
|
|
13860
|
+
onClick={() => {
|
|
13861
|
+
const name = "Seo-yun Park";
|
|
13862
|
+
setArchived((a) => [...a, name]);
|
|
13863
|
+
show({
|
|
13864
|
+
message: `${name} archived`,
|
|
13865
|
+
icon: <SnackbarArchiveIcon strokeWidth={1.5} />,
|
|
13866
|
+
action: {
|
|
13867
|
+
label: "Undo",
|
|
13868
|
+
onClick: () => setArchived((a) => a.filter((n) => n !== name)),
|
|
13869
|
+
},
|
|
13870
|
+
});
|
|
13871
|
+
}}
|
|
13872
|
+
>
|
|
13873
|
+
Archive Seo-yun Park
|
|
13874
|
+
</Button>
|
|
13875
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
13876
|
+
{archived.length} archived
|
|
13877
|
+
</span>
|
|
13878
|
+
</div>
|
|
13879
|
+
</div>
|
|
13880
|
+
<div>
|
|
13881
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13882
|
+
Success icon, 1.5 s — a quick confirmation that gets out of the way
|
|
13883
|
+
</p>
|
|
13884
|
+
<Button
|
|
13885
|
+
variant="outline"
|
|
13886
|
+
size="xl"
|
|
13887
|
+
onClick={() =>
|
|
13888
|
+
show({
|
|
13889
|
+
message: "Copied --primary to clipboard",
|
|
13890
|
+
duration: 1500,
|
|
13891
|
+
icon: <SnackbarCheckIcon strokeWidth={1.5} className="text-icon-success" />,
|
|
13892
|
+
})
|
|
13893
|
+
}
|
|
13894
|
+
>
|
|
13895
|
+
Copy token name
|
|
13896
|
+
</Button>
|
|
13897
|
+
</div>
|
|
13898
|
+
<div>
|
|
13899
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13900
|
+
Sticky — duration Infinity, dismiss × shows by default
|
|
13901
|
+
</p>
|
|
13902
|
+
<Button
|
|
13903
|
+
variant="outline"
|
|
13904
|
+
size="xl"
|
|
13905
|
+
onClick={() =>
|
|
13906
|
+
show({
|
|
13907
|
+
message: "You're offline. Changes to Harborline Logistics sync when you reconnect.",
|
|
13908
|
+
duration: Infinity,
|
|
13909
|
+
})
|
|
13910
|
+
}
|
|
13911
|
+
>
|
|
13912
|
+
Go offline
|
|
13913
|
+
</Button>
|
|
13914
|
+
</div>
|
|
13915
|
+
<div>
|
|
13916
|
+
<p className="mb-3 text-xs font-medium text-muted-foreground">
|
|
13917
|
+
Queue — three calls, one visible, the rest wait their turn
|
|
13918
|
+
</p>
|
|
13919
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
13920
|
+
<Button
|
|
13921
|
+
variant="outline"
|
|
13922
|
+
size="xl"
|
|
13923
|
+
onClick={() => {
|
|
13924
|
+
show({
|
|
13925
|
+
message: "Invitation sent to Tomás Herrera",
|
|
13926
|
+
icon: <SnackbarSendIcon strokeWidth={1.5} />,
|
|
13927
|
+
duration: 2000,
|
|
13928
|
+
});
|
|
13929
|
+
show({ message: "Role updated to Editor", duration: 2000 });
|
|
13930
|
+
show({ message: "Workspace settings saved", duration: 2000 });
|
|
13931
|
+
}}
|
|
13932
|
+
>
|
|
13933
|
+
Queue three messages
|
|
13934
|
+
</Button>
|
|
13935
|
+
<Button variant="ghost" size="xl" onClick={() => dismiss("all")}>
|
|
13936
|
+
Clear queue
|
|
13937
|
+
</Button>
|
|
13938
|
+
</div>
|
|
13939
|
+
</div>
|
|
13940
|
+
</div>
|
|
13941
|
+
);
|
|
13942
|
+
}
|
|
13943
|
+
|
|
13944
|
+
// ─── JsonInput ────────────────────────────────────────────────────────────────
|
|
13945
|
+
|
|
13946
|
+
function JsonInputShowcase() {
|
|
13947
|
+
const [value, setValue] = React.useState<string>("");
|
|
13948
|
+
const [parsed, setParsed] = React.useState<unknown>(null);
|
|
13949
|
+
const [error, setError] = React.useState<string | null>(null);
|
|
13950
|
+
|
|
13951
|
+
return (
|
|
13952
|
+
<div className="space-y-8">
|
|
13953
|
+
<p className="text-sm text-muted-foreground">
|
|
13954
|
+
A <code className="font-mono">{"<Textarea>"}</code> specialized for JSON
|
|
13955
|
+
text entry. Validates on every keystroke (or on blur) via native{" "}
|
|
13956
|
+
<code className="font-mono">JSON.parse</code> and shows an inline error
|
|
13957
|
+
with <code className="font-mono">role="alert"</code> when the
|
|
13958
|
+
text is not valid JSON. Fires{" "}
|
|
13959
|
+
<code className="font-mono">onValidChange(parsed)</code> whenever valid
|
|
13960
|
+
JSON is present. An optional Format button auto-indents the content.
|
|
13961
|
+
Zero new dependencies.
|
|
13962
|
+
</p>
|
|
13963
|
+
|
|
13964
|
+
<div className="space-y-2">
|
|
13965
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13966
|
+
Default — empty field, no error shown until the user types
|
|
13967
|
+
</p>
|
|
13968
|
+
<JsonInput placeholder='{"key": "value"}' className="w-80" />
|
|
13969
|
+
</div>
|
|
13970
|
+
|
|
13971
|
+
<div className="space-y-2">
|
|
13972
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13973
|
+
With valid JSON pre-filled — Format button is enabled
|
|
13974
|
+
</p>
|
|
13975
|
+
<JsonInput
|
|
13976
|
+
defaultValue={JSON.stringify(
|
|
13977
|
+
{ brand: "Meridian Payments", primaryColor: "#1a56db", radius: "md" },
|
|
13978
|
+
null,
|
|
13979
|
+
2
|
|
13980
|
+
)}
|
|
13981
|
+
className="w-96"
|
|
13982
|
+
/>
|
|
13983
|
+
</div>
|
|
13984
|
+
|
|
13985
|
+
<div className="space-y-2">
|
|
13986
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13987
|
+
With invalid JSON pre-filled — error shown immediately (dirty on
|
|
13988
|
+
defaultValue)
|
|
13989
|
+
</p>
|
|
13990
|
+
<JsonInput
|
|
13991
|
+
defaultValue='{"brand": "Fieldnote Labs", missing_quote: true}'
|
|
13992
|
+
className="w-96"
|
|
13993
|
+
/>
|
|
13994
|
+
</div>
|
|
13995
|
+
|
|
13996
|
+
<div className="space-y-2">
|
|
13997
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
13998
|
+
Validate on blur — errors deferred until the field loses focus
|
|
13999
|
+
</p>
|
|
14000
|
+
<JsonInput
|
|
14001
|
+
validateOn="blur"
|
|
14002
|
+
placeholder='{"brand": "Lumen Analytics"}'
|
|
14003
|
+
className="w-80"
|
|
14004
|
+
/>
|
|
14005
|
+
</div>
|
|
14006
|
+
|
|
14007
|
+
<div className="space-y-2">
|
|
14008
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14009
|
+
External error — server-side validation message overrides the built-in
|
|
14010
|
+
parse error
|
|
14011
|
+
</p>
|
|
14012
|
+
<JsonInput
|
|
14013
|
+
defaultValue='{"plan":"enterprise","seats":25}'
|
|
14014
|
+
externalError={'"seats" must be 50 or greater on the enterprise plan'}
|
|
14015
|
+
className="w-96"
|
|
14016
|
+
/>
|
|
14017
|
+
</div>
|
|
14018
|
+
|
|
14019
|
+
<div className="space-y-2">
|
|
14020
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14021
|
+
Without Format button
|
|
14022
|
+
</p>
|
|
14023
|
+
<JsonInput
|
|
14024
|
+
showFormatButton={false}
|
|
14025
|
+
defaultValue='{"org":"Cedar & Pine Studio","theme":"light","compact":false}'
|
|
14026
|
+
className="w-80"
|
|
14027
|
+
/>
|
|
14028
|
+
</div>
|
|
14029
|
+
|
|
14030
|
+
<div className="space-y-2">
|
|
14031
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14032
|
+
Disabled — Format button suppressed, textarea non-interactive
|
|
14033
|
+
</p>
|
|
14034
|
+
<JsonInput
|
|
14035
|
+
disabled
|
|
14036
|
+
defaultValue={JSON.stringify(
|
|
14037
|
+
{ org: "Northwind Health", locale: "en-US" },
|
|
14038
|
+
null,
|
|
14039
|
+
2
|
|
14040
|
+
)}
|
|
14041
|
+
className="w-80"
|
|
14042
|
+
/>
|
|
14043
|
+
</div>
|
|
14044
|
+
|
|
14045
|
+
<div className="space-y-2">
|
|
14046
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14047
|
+
Sizes — sm / default / lg
|
|
14048
|
+
</p>
|
|
14049
|
+
<div className="flex flex-wrap gap-4">
|
|
14050
|
+
<JsonInput size="sm" placeholder='{"key": "value"}' className="w-64" />
|
|
14051
|
+
<JsonInput size="default" placeholder='{"key": "value"}' className="w-72" />
|
|
14052
|
+
<JsonInput size="lg" placeholder='{"key": "value"}' className="w-80" />
|
|
14053
|
+
</div>
|
|
14054
|
+
</div>
|
|
14055
|
+
|
|
14056
|
+
<div className="space-y-2">
|
|
14057
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14058
|
+
Realistic use — inside a Field wrapper, controlled state,{" "}
|
|
14059
|
+
<code className="font-mono">onValidChange</code> captures the parsed
|
|
14060
|
+
result
|
|
14061
|
+
</p>
|
|
14062
|
+
<div className="w-96 space-y-4">
|
|
14063
|
+
<div className="space-y-1.5">
|
|
14064
|
+
<Label htmlFor="json-webhook-showcase">Webhook filter rules</Label>
|
|
14065
|
+
<p className="text-xs text-muted-foreground">
|
|
14066
|
+
Enter a JSON object that defines which events trigger this webhook.
|
|
14067
|
+
</p>
|
|
14068
|
+
<JsonInput
|
|
14069
|
+
id="json-webhook-showcase"
|
|
14070
|
+
value={value}
|
|
14071
|
+
onChange={(e) => setValue(e.target.value)}
|
|
14072
|
+
onValidChange={setParsed}
|
|
14073
|
+
onError={setError}
|
|
14074
|
+
placeholder='{"events": ["user.created"], "org": "Harborline Logistics"}'
|
|
14075
|
+
className="w-full"
|
|
14076
|
+
/>
|
|
14077
|
+
</div>
|
|
14078
|
+
|
|
14079
|
+
{parsed !== null && (
|
|
14080
|
+
<div className="rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground">
|
|
14081
|
+
<p className="mb-1 font-medium text-foreground">Parsed result:</p>
|
|
14082
|
+
<pre className="whitespace-pre-wrap break-all font-mono text-xs">
|
|
14083
|
+
{JSON.stringify(parsed, null, 2)}
|
|
14084
|
+
</pre>
|
|
14085
|
+
</div>
|
|
14086
|
+
)}
|
|
14087
|
+
{error && (
|
|
14088
|
+
<p className="text-xs text-muted-foreground">
|
|
14089
|
+
Validation state: invalid
|
|
14090
|
+
</p>
|
|
14091
|
+
)}
|
|
14092
|
+
</div>
|
|
14093
|
+
</div>
|
|
14094
|
+
</div>
|
|
14095
|
+
);
|
|
14096
|
+
}
|
|
14097
|
+
|
|
14098
|
+
// ─── SortableList Showcase ────────────────────────────────────────────────────
|
|
14099
|
+
|
|
14100
|
+
const SORTABLE_PIPELINE = [
|
|
14101
|
+
{ id: "s1", label: "Qualification" },
|
|
14102
|
+
{ id: "s2", label: "Discovery" },
|
|
14103
|
+
{ id: "s3", label: "Proposal" },
|
|
14104
|
+
{ id: "s4", label: "Negotiation" },
|
|
14105
|
+
{ id: "s5", label: "Closed" },
|
|
14106
|
+
];
|
|
14107
|
+
|
|
14108
|
+
const SORTABLE_PRIORITIES = [
|
|
14109
|
+
{ id: "p1", label: "Northwind Health integration", priority: "high" as const },
|
|
14110
|
+
{ id: "p2", label: "Token refresh — Cedar & Pine Studio", priority: "medium" as const },
|
|
14111
|
+
{ id: "p3", label: "Harborline Logistics onboarding", priority: "medium" as const },
|
|
14112
|
+
{ id: "p4", label: "WCAG AAA audit — Meridian Payments", priority: "low" as const },
|
|
14113
|
+
];
|
|
14114
|
+
|
|
14115
|
+
const SORTABLE_TEAM = [
|
|
14116
|
+
{ id: "u1", name: "Jordan Reeves", role: "Design Lead" },
|
|
14117
|
+
{ id: "u2", name: "Seo-yun Park", role: "Senior Engineer" },
|
|
14118
|
+
{ id: "u3", name: "Marcus Lindqvist", role: "Product Manager" },
|
|
14119
|
+
{ id: "u4", name: "Anika Patel", role: "QA Engineer" },
|
|
14120
|
+
];
|
|
14121
|
+
|
|
14122
|
+
function SortableListShowcase() {
|
|
14123
|
+
const [pipeline, setPipeline] = React.useState(SORTABLE_PIPELINE);
|
|
14124
|
+
const [priorities, setPriorities] = React.useState(SORTABLE_PRIORITIES);
|
|
14125
|
+
const [team, setTeam] = React.useState(SORTABLE_TEAM);
|
|
14126
|
+
|
|
14127
|
+
return (
|
|
14128
|
+
<div className="flex flex-wrap gap-8">
|
|
14129
|
+
{/* Default */}
|
|
14130
|
+
<div className="space-y-2">
|
|
14131
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Default</p>
|
|
14132
|
+
<SortableList
|
|
14133
|
+
items={pipeline}
|
|
14134
|
+
onReorder={setPipeline}
|
|
14135
|
+
aria-label="Pipeline stages"
|
|
14136
|
+
className="w-56"
|
|
14137
|
+
renderItem={(item) => (
|
|
14138
|
+
<span className="text-sm text-foreground">{item.label}</span>
|
|
14139
|
+
)}
|
|
14140
|
+
/>
|
|
14141
|
+
</div>
|
|
14142
|
+
|
|
14143
|
+
{/* With badges */}
|
|
14144
|
+
<div className="space-y-2">
|
|
14145
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">With badges</p>
|
|
14146
|
+
<SortableList
|
|
14147
|
+
items={priorities}
|
|
14148
|
+
onReorder={setPriorities}
|
|
14149
|
+
aria-label="Project priorities"
|
|
14150
|
+
className="w-80"
|
|
14151
|
+
renderItem={(item) => (
|
|
14152
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
14153
|
+
<span className="min-w-0 flex-1 truncate text-sm text-foreground">{item.label}</span>
|
|
14154
|
+
<Badge
|
|
14155
|
+
variant={
|
|
14156
|
+
item.priority === "high" ? "destructive"
|
|
14157
|
+
: item.priority === "medium" ? "secondary"
|
|
14158
|
+
: "outline"
|
|
14159
|
+
}
|
|
14160
|
+
className="shrink-0 text-xs"
|
|
14161
|
+
>
|
|
14162
|
+
{item.priority}
|
|
14163
|
+
</Badge>
|
|
14164
|
+
</div>
|
|
14165
|
+
)}
|
|
14166
|
+
/>
|
|
14167
|
+
</div>
|
|
14168
|
+
|
|
14169
|
+
{/* Realistic — team review order */}
|
|
14170
|
+
<div className="space-y-2">
|
|
14171
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
|
|
14172
|
+
Realistic — Fieldnote Labs review order
|
|
14173
|
+
</p>
|
|
14174
|
+
<SortableList
|
|
14175
|
+
items={team}
|
|
14176
|
+
onReorder={setTeam}
|
|
14177
|
+
aria-label="Team review order"
|
|
14178
|
+
className="w-72"
|
|
14179
|
+
renderItem={(member) => (
|
|
14180
|
+
<div className="min-w-0">
|
|
14181
|
+
<p className="truncate text-sm font-medium text-foreground">{member.name}</p>
|
|
14182
|
+
<p className="truncate text-xs text-muted-foreground">{member.role}</p>
|
|
14183
|
+
</div>
|
|
14184
|
+
)}
|
|
14185
|
+
/>
|
|
14186
|
+
</div>
|
|
14187
|
+
|
|
14188
|
+
{/* Disabled */}
|
|
14189
|
+
<div className="space-y-2">
|
|
14190
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Disabled</p>
|
|
14191
|
+
<SortableList
|
|
14192
|
+
items={[
|
|
14193
|
+
{ id: "d1", label: "Qualification" },
|
|
14194
|
+
{ id: "d2", label: "Discovery" },
|
|
14195
|
+
{ id: "d3", label: "Proposal" },
|
|
14196
|
+
]}
|
|
14197
|
+
onReorder={() => {}}
|
|
14198
|
+
disabled
|
|
14199
|
+
className="w-56"
|
|
14200
|
+
aria-label="Disabled sortable list"
|
|
14201
|
+
renderItem={(item) => (
|
|
14202
|
+
<span className="text-sm text-muted-foreground">{item.label}</span>
|
|
14203
|
+
)}
|
|
14204
|
+
/>
|
|
14205
|
+
</div>
|
|
14206
|
+
</div>
|
|
14207
|
+
);
|
|
14208
|
+
}
|
|
14209
|
+
|
|
14210
|
+
// Deterministic matrix for the Heatmap showcase — seeded LCG, never
|
|
14211
|
+
// Math.random (SSR hydration + Chromatic determinism).
|
|
14212
|
+
function heatmapMatrix(rowCount: number, colCount: number, seed: number, max = 24) {
|
|
14213
|
+
let s = seed >>> 0;
|
|
14214
|
+
const next = () => {
|
|
14215
|
+
s = (s * 1664525 + 1013904223) >>> 0;
|
|
14216
|
+
return s / 0x100000000;
|
|
14217
|
+
};
|
|
14218
|
+
return Array.from({ length: rowCount }, (_, r) =>
|
|
14219
|
+
Array.from({ length: colCount }, (_, c) => {
|
|
14220
|
+
const weight = r >= 5 ? 0.35 : 1;
|
|
14221
|
+
const ramp = 0.4 + (c / Math.max(1, colCount - 1)) * 0.6;
|
|
14222
|
+
return Math.round(next() * max * weight * ramp);
|
|
14223
|
+
}),
|
|
14224
|
+
);
|
|
14225
|
+
}
|
|
14226
|
+
|
|
14227
|
+
const HEATMAP_WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
14228
|
+
const heatmapWeeks = (n: number) => Array.from({ length: n }, (_, i) => `W${i + 1}`);
|
|
14229
|
+
|
|
14230
|
+
function HeatmapShowcase() {
|
|
14231
|
+
const commits = (v: number) => `${v} commits`;
|
|
14232
|
+
return (
|
|
14233
|
+
<div className="space-y-8">
|
|
14234
|
+
<p className="text-sm text-muted-foreground">
|
|
14235
|
+
A matrix of cells whose color intensity encodes a value — the
|
|
14236
|
+
contribution-calendar / hour-by-weekday shape. Built on a native{" "}
|
|
14237
|
+
<code className="font-mono"><table></code>: row and column
|
|
14238
|
+
headers are the axes and every cell carries its formatted value as
|
|
14239
|
+
screen-reader text, so the chart is its own text alternative. One
|
|
14240
|
+
series color (<code className="font-mono">--chart-1</code> by default)
|
|
14241
|
+
with a five-level opacity ramp; the lowest bucket and “no
|
|
14242
|
+
data” are <code className="font-mono">--muted</code>. The root is
|
|
14243
|
+
a focusable scroll region for wide matrices.
|
|
14244
|
+
</p>
|
|
14245
|
+
<div className="space-y-2">
|
|
14246
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14247
|
+
Default — md cells, Less → More legend, per-cell tooltip
|
|
14248
|
+
</p>
|
|
14249
|
+
<Heatmap
|
|
14250
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14251
|
+
columns={heatmapWeeks(12)}
|
|
14252
|
+
data={heatmapMatrix(7, 12, 7)}
|
|
14253
|
+
label="Token commits by weekday, last 12 weeks"
|
|
14254
|
+
formatValue={commits}
|
|
14255
|
+
/>
|
|
14256
|
+
</div>
|
|
14257
|
+
<div className="space-y-2">
|
|
14258
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14259
|
+
Sizes — sm (12px) / md (16px) / lg (24px)
|
|
14260
|
+
</p>
|
|
14261
|
+
<div className="flex flex-wrap items-end gap-8">
|
|
14262
|
+
<Heatmap
|
|
14263
|
+
size="sm"
|
|
14264
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14265
|
+
columns={heatmapWeeks(6)}
|
|
14266
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14267
|
+
label="Token commits by weekday, 6 weeks, small cells"
|
|
14268
|
+
formatValue={commits}
|
|
14269
|
+
showLegend={false}
|
|
14270
|
+
/>
|
|
14271
|
+
<Heatmap
|
|
14272
|
+
size="md"
|
|
14273
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14274
|
+
columns={heatmapWeeks(6)}
|
|
14275
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14276
|
+
label="Token commits by weekday, 6 weeks, medium cells"
|
|
14277
|
+
formatValue={commits}
|
|
14278
|
+
showLegend={false}
|
|
14279
|
+
/>
|
|
14280
|
+
<Heatmap
|
|
14281
|
+
size="lg"
|
|
14282
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14283
|
+
columns={heatmapWeeks(6)}
|
|
14284
|
+
data={heatmapMatrix(7, 6, 3)}
|
|
14285
|
+
label="Token commits by weekday, 6 weeks, large cells"
|
|
14286
|
+
formatValue={commits}
|
|
14287
|
+
showLegend={false}
|
|
14288
|
+
/>
|
|
14289
|
+
</div>
|
|
14290
|
+
</div>
|
|
14291
|
+
<div className="space-y-2">
|
|
14292
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14293
|
+
Series color from the chart palette (--chart-2) and null cells as
|
|
14294
|
+
“no data”
|
|
14295
|
+
</p>
|
|
14296
|
+
<Heatmap
|
|
14297
|
+
color="var(--chart-2)"
|
|
14298
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14299
|
+
columns={heatmapWeeks(8)}
|
|
14300
|
+
data={heatmapMatrix(7, 8, 11).map((row, r) =>
|
|
14301
|
+
row.map((v, c) => (c > 5 && r > 3 ? null : v)),
|
|
14302
|
+
)}
|
|
14303
|
+
label="Review comments by weekday — weeks 7 and 8 not yet synced"
|
|
14304
|
+
formatValue={(v) => `${v} comments`}
|
|
14305
|
+
/>
|
|
14306
|
+
</div>
|
|
14307
|
+
<div className="space-y-2">
|
|
14308
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14309
|
+
Hour × weekday — Storybook sessions at Fieldnote Labs
|
|
14310
|
+
</p>
|
|
14311
|
+
<Heatmap
|
|
14312
|
+
size="sm"
|
|
14313
|
+
color="var(--chart-3)"
|
|
14314
|
+
rows={Array.from({ length: 12 }, (_, h) => `${h + 8}:00`)}
|
|
14315
|
+
columns={HEATMAP_WEEKDAYS.slice(0, 5)}
|
|
14316
|
+
data={heatmapMatrix(12, 5, 23, 60)}
|
|
14317
|
+
label="Storybook sessions by hour and weekday, Fieldnote Labs"
|
|
14318
|
+
formatValue={(v) => `${v} sessions`}
|
|
14319
|
+
/>
|
|
14320
|
+
</div>
|
|
14321
|
+
<div className="space-y-2">
|
|
14322
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14323
|
+
Wide matrix in a narrow card — the root scrolls and is keyboard
|
|
14324
|
+
focusable (52 weeks in 420px)
|
|
14325
|
+
</p>
|
|
14326
|
+
<div className="w-[420px] max-w-full rounded-lg border p-4">
|
|
14327
|
+
<Heatmap
|
|
14328
|
+
rows={HEATMAP_WEEKDAYS}
|
|
14329
|
+
columns={heatmapWeeks(52)}
|
|
14330
|
+
data={heatmapMatrix(7, 52, 19)}
|
|
14331
|
+
label="Jordan Reeves token commits by weekday, 52 weeks"
|
|
14332
|
+
formatValue={commits}
|
|
14333
|
+
/>
|
|
14334
|
+
</div>
|
|
14335
|
+
</div>
|
|
14336
|
+
</div>
|
|
14337
|
+
);
|
|
14338
|
+
}
|
|
14339
|
+
|
|
14340
|
+
function NavigationProgressShowcase() {
|
|
14341
|
+
const { progress, active, start, set, increment, stop, complete, reset } =
|
|
14342
|
+
useNavigationProgress();
|
|
14343
|
+
const [size, setSize] = React.useState<"sm" | "md" | "lg">("md");
|
|
14344
|
+
return (
|
|
14345
|
+
<div className="space-y-8">
|
|
14346
|
+
{/* One bar per document: the Components tab is its own iframe, so the
|
|
14347
|
+
bar pins to the top edge of this tab, not the host shell. */}
|
|
14348
|
+
<NavigationProgress size={size} />
|
|
14349
|
+
<p className="text-sm text-muted-foreground">
|
|
14350
|
+
The thin bar at the top of the viewport that fills while a route
|
|
14351
|
+
change or a long request is in flight — the YouTube / GitHub /
|
|
14352
|
+
Next.js pattern. Driven from outside React by an imperative store
|
|
14353
|
+
(<code className="font-mono">navigationProgress.start()</code> …{" "}
|
|
14354
|
+
<code className="font-mono">.complete()</code>) so a router hook or a
|
|
14355
|
+
fetch wrapper can call it with no component in reach;{" "}
|
|
14356
|
+
<code className="font-mono">useNavigationProgress()</code> reads the
|
|
14357
|
+
state. Starts at 8%, trickles toward 90% on a deterministic ladder,
|
|
14358
|
+
fills to 100% on complete, settles for one{" "}
|
|
14359
|
+
<code className="font-mono">--duration-base</code>, fades, resets.
|
|
14360
|
+
Mount once per document — here it pins to the top edge of this tab.
|
|
14361
|
+
</p>
|
|
14362
|
+
<div className="space-y-2">
|
|
14363
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14364
|
+
Drive the store — watch the top edge of this tab
|
|
14365
|
+
</p>
|
|
14366
|
+
<p className="text-sm text-muted-foreground" aria-live="polite">
|
|
14367
|
+
{active ? `Loading — ${Math.round(progress)}%` : "Idle — the bar is hidden"}
|
|
14368
|
+
</p>
|
|
14369
|
+
<div className="flex flex-wrap gap-2">
|
|
14370
|
+
<Button size="xl" onClick={() => start()}>Start</Button>
|
|
14371
|
+
<Button size="xl" variant="outline" onClick={() => set(60)}>Set 60%</Button>
|
|
14372
|
+
<Button size="xl" variant="outline" onClick={() => increment(10)}>+10</Button>
|
|
14373
|
+
<Button size="xl" variant="outline" onClick={() => stop()}>Stop</Button>
|
|
14374
|
+
<Button size="xl" variant="secondary" onClick={() => complete()}>Complete</Button>
|
|
14375
|
+
<Button size="xl" variant="ghost" onClick={() => reset()}>Reset</Button>
|
|
14376
|
+
</div>
|
|
14377
|
+
</div>
|
|
14378
|
+
<div className="space-y-2">
|
|
14379
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14380
|
+
Sizes — sm (2px) / md (4px, default) / lg (6px)
|
|
14381
|
+
</p>
|
|
14382
|
+
<SegmentedControl
|
|
14383
|
+
value={size}
|
|
14384
|
+
onValueChange={(v) => setSize(v as "sm" | "md" | "lg")}
|
|
14385
|
+
label="Navigation progress size"
|
|
14386
|
+
className="w-fit"
|
|
14387
|
+
>
|
|
14388
|
+
<SegmentedControlItem value="sm">sm</SegmentedControlItem>
|
|
14389
|
+
<SegmentedControlItem value="md">md</SegmentedControlItem>
|
|
14390
|
+
<SegmentedControlItem value="lg">lg</SegmentedControlItem>
|
|
14391
|
+
</SegmentedControl>
|
|
14392
|
+
</div>
|
|
14393
|
+
</div>
|
|
14394
|
+
);
|
|
14395
|
+
}
|
|
14396
|
+
|
|
14397
|
+
// File names and byte counts from content/personas/bads.json → files[].
|
|
14398
|
+
const ATTACHMENT_FILES = [
|
|
14399
|
+
{ name: "roi-report-2026-06.pdf", bytes: 1_536_000, type: "application/pdf" },
|
|
14400
|
+
{ name: "styles.css", bytes: 42_700, type: "text/css" },
|
|
14401
|
+
{ name: "chromatic-snapshots-2026-06.zip", bytes: 1_073_741_824, type: "application/zip" },
|
|
14402
|
+
] as const;
|
|
14403
|
+
|
|
14404
|
+
function AttachmentShowcase() {
|
|
14405
|
+
const [attached, setAttached] = React.useState<
|
|
14406
|
+
Array<{ name: string; bytes: number; type: string }>
|
|
14407
|
+
>([...ATTACHMENT_FILES]);
|
|
14408
|
+
const [sending, setSending] = React.useState(false);
|
|
14409
|
+
// Removing a chip unmounts the focused button; send focus back to the
|
|
14410
|
+
// composer so a keyboard user is not dropped on <body>. The component
|
|
14411
|
+
// leaves this to the consumer on purpose — only the composer knows where
|
|
14412
|
+
// "back" is.
|
|
14413
|
+
const composerRef = React.useRef<HTMLTextAreaElement>(null);
|
|
14414
|
+
|
|
14415
|
+
return (
|
|
14416
|
+
<div className="space-y-8">
|
|
14417
|
+
<p className="text-sm text-muted-foreground">
|
|
14418
|
+
The pre-send file chip inside a chat composer — the review step
|
|
14419
|
+
between picking a file (FileButton) and sending the message
|
|
14420
|
+
(ChatInput). File-type icon from the MIME type with an extension
|
|
14421
|
+
fallback, truncated name with the full value on{" "}
|
|
14422
|
+
<code className="font-mono">title</code>, size via FormatByte, and
|
|
14423
|
+
a 44px CloseButton labeled{" "}
|
|
14424
|
+
<code className="font-mono">Remove <name></code>. The root is{" "}
|
|
14425
|
+
<code className="font-mono">role="group"</code> named{" "}
|
|
14426
|
+
<code className="font-mono">Attached file: <name></code>. Not a
|
|
14427
|
+
drop zone (that is FileUpload) and not a post-send card (FileCard).
|
|
14428
|
+
</p>
|
|
14429
|
+
<div className="space-y-2">
|
|
14430
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14431
|
+
Default — PDF, image, code, archive
|
|
14432
|
+
</p>
|
|
14433
|
+
<div className="flex flex-wrap gap-2">
|
|
14434
|
+
<Attachment
|
|
14435
|
+
fileName="roi-report-2026-06.pdf"
|
|
14436
|
+
fileSize={1_536_000}
|
|
14437
|
+
fileType="application/pdf"
|
|
14438
|
+
onRemove={() => {}}
|
|
14439
|
+
/>
|
|
14440
|
+
<Attachment
|
|
14441
|
+
fileName="favicon.svg"
|
|
14442
|
+
fileSize={500}
|
|
14443
|
+
fileType="image/svg+xml"
|
|
14444
|
+
onRemove={() => {}}
|
|
14445
|
+
/>
|
|
14446
|
+
<Attachment
|
|
14447
|
+
fileName="styles.css"
|
|
14448
|
+
fileSize={42_700}
|
|
14449
|
+
fileType="text/css"
|
|
14450
|
+
onRemove={() => {}}
|
|
14451
|
+
/>
|
|
14452
|
+
<Attachment
|
|
14453
|
+
fileName="chromatic-snapshots-2026-06.zip"
|
|
14454
|
+
fileSize={1_073_741_824}
|
|
14455
|
+
fileType="application/zip"
|
|
14456
|
+
onRemove={() => {}}
|
|
14457
|
+
/>
|
|
14458
|
+
</div>
|
|
14459
|
+
</div>
|
|
14460
|
+
<div className="space-y-2">
|
|
14461
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14462
|
+
Unknown MIME type (the browser reports "" for .fig) — extension
|
|
14463
|
+
fallback, generic icon
|
|
14464
|
+
</p>
|
|
14465
|
+
<Attachment
|
|
14466
|
+
fileName="tokens-v2-proposal.fig"
|
|
14467
|
+
fileSize={24_618_034}
|
|
14468
|
+
fileType=""
|
|
14469
|
+
onRemove={() => {}}
|
|
14470
|
+
/>
|
|
14471
|
+
</div>
|
|
14472
|
+
<div className="space-y-2">
|
|
14473
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14474
|
+
Read-only (no onRemove) and disabled (while sending)
|
|
14475
|
+
</p>
|
|
14476
|
+
<div className="flex flex-wrap gap-2">
|
|
14477
|
+
<Attachment
|
|
14478
|
+
fileName="brand-fonts.woff2"
|
|
14479
|
+
fileSize={84_512}
|
|
14480
|
+
fileType="font/woff2"
|
|
14481
|
+
/>
|
|
14482
|
+
<Attachment
|
|
14483
|
+
fileName="roi-report-2026-06.pdf"
|
|
14484
|
+
fileSize={1_536_000}
|
|
14485
|
+
fileType="application/pdf"
|
|
14486
|
+
onRemove={() => {}}
|
|
14487
|
+
disabled
|
|
14488
|
+
/>
|
|
14489
|
+
</div>
|
|
14490
|
+
</div>
|
|
14491
|
+
<div className="space-y-2">
|
|
14492
|
+
<p className="text-xs font-medium text-muted-foreground">
|
|
14493
|
+
In a composer — remove a chip, re-attach with the paperclip, send to
|
|
14494
|
+
watch the disabled state
|
|
14495
|
+
</p>
|
|
14496
|
+
<Card className="w-[28rem] max-w-full gap-0 p-3">
|
|
14497
|
+
<Textarea
|
|
14498
|
+
ref={composerRef}
|
|
14499
|
+
aria-label="Message to Jordan Reeves"
|
|
14500
|
+
placeholder="Message Jordan Reeves"
|
|
14501
|
+
defaultValue="Here's the June ROI export, the generated stylesheet, and last quarter's Chromatic baseline."
|
|
14502
|
+
className="min-h-20 resize-none border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
|
|
14503
|
+
/>
|
|
14504
|
+
{attached.length > 0 && (
|
|
14505
|
+
<div className="mt-2 flex flex-wrap gap-2 px-1" aria-label="Attachments">
|
|
14506
|
+
{attached.map((f) => (
|
|
14507
|
+
<Attachment
|
|
14508
|
+
key={f.name}
|
|
14509
|
+
fileName={f.name}
|
|
14510
|
+
fileSize={f.bytes}
|
|
14511
|
+
fileType={f.type}
|
|
14512
|
+
disabled={sending}
|
|
14513
|
+
onRemove={() => {
|
|
14514
|
+
setAttached((prev) => prev.filter((p) => p.name !== f.name));
|
|
14515
|
+
composerRef.current?.focus();
|
|
14516
|
+
}}
|
|
14517
|
+
/>
|
|
14518
|
+
))}
|
|
14519
|
+
</div>
|
|
14520
|
+
)}
|
|
14521
|
+
<div className="mt-3 flex items-center justify-between gap-2">
|
|
14522
|
+
<Button
|
|
14523
|
+
type="button"
|
|
14524
|
+
variant="ghost"
|
|
14525
|
+
size="icon-xl"
|
|
14526
|
+
aria-label="Attach a file"
|
|
14527
|
+
disabled={sending}
|
|
14528
|
+
onClick={() =>
|
|
14529
|
+
setAttached((prev) =>
|
|
14530
|
+
prev.some((p) => p.name === "favicon.svg")
|
|
14531
|
+
? prev
|
|
14532
|
+
: [...prev, { name: "favicon.svg", bytes: 500, type: "image/svg+xml" }]
|
|
14533
|
+
)
|
|
14534
|
+
}
|
|
14535
|
+
>
|
|
14536
|
+
<AttachmentPaperclipIcon strokeWidth={1.5} aria-hidden="true" />
|
|
14537
|
+
</Button>
|
|
14538
|
+
<Button
|
|
14539
|
+
type="button"
|
|
14540
|
+
size="xl"
|
|
14541
|
+
disabled={sending}
|
|
14542
|
+
loading={sending}
|
|
14543
|
+
onClick={() => {
|
|
14544
|
+
setSending(true);
|
|
14545
|
+
window.setTimeout(() => {
|
|
14546
|
+
setSending(false);
|
|
14547
|
+
setAttached([]);
|
|
14548
|
+
}, 1200);
|
|
14549
|
+
}}
|
|
14550
|
+
>
|
|
14551
|
+
<AttachmentSendIcon strokeWidth={1.5} aria-hidden="true" />
|
|
14552
|
+
Send
|
|
14553
|
+
</Button>
|
|
14554
|
+
</div>
|
|
14555
|
+
</Card>
|
|
14556
|
+
</div>
|
|
14557
|
+
</div>
|
|
14558
|
+
);
|
|
14559
|
+
}
|