@behavioral-agentic-design-system/core 0.40.0 → 0.45.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.
Files changed (148) hide show
  1. package/README.md +2 -0
  2. package/package.json +41 -9
  3. package/scripts/a11y-lint.cjs +66 -3
  4. package/scripts/check-spec.mjs +73 -0
  5. package/scripts/deal-directions.mjs +186 -0
  6. package/scripts/health-report.mjs +23 -3
  7. package/scripts/lib/counted-lint.mjs +100 -0
  8. package/scripts/lib/marketing-library.mjs +129 -0
  9. package/scripts/lib/on-system.mjs +249 -0
  10. package/scripts/lib/random.mjs +22 -0
  11. package/scripts/lib/spec-parse.d.mts +25 -0
  12. package/scripts/lib/spec-parse.mjs +188 -0
  13. package/scripts/lib/tells.mjs +128 -0
  14. package/scripts/lint-css-vars.mjs +175 -0
  15. package/scripts/lint-html-nesting.mjs +116 -0
  16. package/scripts/lint-live-ctas.mjs +138 -0
  17. package/scripts/lint-slop.mjs +25 -1
  18. package/scripts/on-system-score.mjs +95 -0
  19. package/scripts/slop-rules.mjs +1 -1
  20. package/scripts/source-images.mjs +180 -0
  21. package/scripts/ux-tells.mjs +78 -0
  22. package/scripts/wcag-audit.cjs +72 -5
  23. package/src/api/brand-colors.ts +3 -0
  24. package/src/api/brand-fonts.ts +3 -0
  25. package/src/api/brand-mark.ts +6 -1
  26. package/src/api/dev-write-guard.ts +53 -0
  27. package/src/api/layers/file.ts +7 -4
  28. package/src/api/onboarding-extract.ts +85 -30
  29. package/src/api/onboarding.ts +3 -0
  30. package/src/api/save-tokens.ts +3 -0
  31. package/src/app/layout.tsx +6 -0
  32. package/src/app/opengraph-image.tsx +5 -0
  33. package/src/app/preview/canvas/page.tsx +12 -0
  34. package/src/app/preview/components/page.tsx +2003 -2
  35. package/src/app/preview/studio/blank-screen.tsx +143 -0
  36. package/src/app/preview/studio/page.tsx +7 -0
  37. package/src/app/shell.tsx +168 -49
  38. package/src/components/Foundations/Motion.stories.tsx +1 -0
  39. package/src/components/canvas/canvas.tsx +458 -0
  40. package/src/components/canvas/layout.ts +72 -0
  41. package/src/components/canvas/parse-canvas.ts +32 -0
  42. package/src/components/canvas/sample.ts +90 -0
  43. package/src/components/canvas/spec-frame.tsx +43 -0
  44. package/src/components/canvas/types.ts +33 -0
  45. package/src/components/customize/design-controls.tsx +16 -1
  46. package/src/components/docs-tab.tsx +7 -7
  47. package/src/components/home-recent.tsx +73 -0
  48. package/src/components/home-tab.tsx +13 -13
  49. package/src/components/layers-tab.tsx +2 -2
  50. package/src/components/markdown-preview.tsx +60 -12
  51. package/src/components/studio/control-panel.tsx +299 -0
  52. package/src/components/studio/control-row.tsx +77 -0
  53. package/src/components/studio/preview-frame.tsx +165 -0
  54. package/src/components/studio/preview-pane.tsx +247 -0
  55. package/src/components/studio/studio.tsx +158 -0
  56. package/src/components/studio/types.ts +218 -0
  57. package/src/components/studio/use-studio-tweaks.ts +128 -0
  58. package/src/components/studio/use-studio-view-state.ts +72 -0
  59. package/src/components/ui/anchor.tsx +37 -3
  60. package/src/components/ui/attachment.tsx +211 -0
  61. package/src/components/ui/autocomplete.tsx +1 -1
  62. package/src/components/ui/chart.tsx +3 -0
  63. package/src/components/ui/code.tsx +1 -1
  64. package/src/components/ui/color-picker.tsx +21 -5
  65. package/src/components/ui/data-table.tsx +64 -3
  66. package/src/components/ui/date-field.tsx +1 -1
  67. package/src/components/ui/editable.tsx +1 -0
  68. package/src/components/ui/faceted-filter.tsx +187 -0
  69. package/src/components/ui/gauge-chart.tsx +252 -0
  70. package/src/components/ui/heatmap.tsx +256 -0
  71. package/src/components/ui/index.ts +9 -0
  72. package/src/components/ui/infinite-scroll.tsx +103 -0
  73. package/src/components/ui/inline-edit.tsx +175 -0
  74. package/src/components/ui/json-input.tsx +351 -0
  75. package/src/components/ui/month-picker.tsx +1 -1
  76. package/src/components/ui/navigation-progress.tsx +281 -0
  77. package/src/components/ui/number-input.tsx +27 -7
  78. package/src/components/ui/otp-input.tsx +208 -0
  79. package/src/components/ui/password-input.tsx +2 -1
  80. package/src/components/ui/password-strength-input.tsx +288 -0
  81. package/src/components/ui/phone-input.tsx +274 -0
  82. package/src/components/ui/pill.tsx +140 -0
  83. package/src/components/ui/popover.tsx +27 -4
  84. package/src/components/ui/scroll-progress.tsx +100 -0
  85. package/src/components/ui/search-input.tsx +1 -1
  86. package/src/components/ui/snackbar.tsx +393 -0
  87. package/src/components/ui/sortable-list.tsx +342 -0
  88. package/src/components/ui/squircle.tsx +1 -1
  89. package/src/components/ui/table.tsx +1 -1
  90. package/src/components/ui/tags-input.tsx +1 -1
  91. package/src/components/ui/timer.tsx +1 -0
  92. package/src/components/ui/tour.tsx +1 -3
  93. package/src/components/ui/transfer-list.tsx +13 -26
  94. package/src/components/ui/week-picker.tsx +1 -1
  95. package/src/components/ui/year-picker.tsx +1 -1
  96. package/src/data/component-added.json +958 -0
  97. package/src/data/docs-index.ts +36 -0
  98. package/src/hooks/use-global-mono-font.ts +1 -0
  99. package/src/hooks/use-global-primary-color.ts +1 -0
  100. package/src/hooks/use-global-sans-font.ts +1 -0
  101. package/src/hooks/use-global-serif-font.ts +1 -0
  102. package/src/hooks/use-global-type-scale.ts +17 -2
  103. package/src/hooks/use-mobile.ts +2 -0
  104. package/src/hooks/use-sync-type-scale.ts +7 -11
  105. package/src/lib/clamp.ts +2 -0
  106. package/src/lib/spec-parse.ts +4 -0
  107. package/src/lib/svg-sanitize.ts +19 -9
  108. package/src/stories/Anchor.stories.tsx +54 -0
  109. package/src/stories/Attachment.stories.tsx +189 -0
  110. package/src/stories/Autocomplete.stories.tsx +2 -0
  111. package/src/stories/Canvas.stories.tsx +45 -0
  112. package/src/stories/Chart.stories.tsx +4 -0
  113. package/src/stories/Code.stories.tsx +1 -0
  114. package/src/stories/ColorPicker.stories.tsx +41 -0
  115. package/src/stories/DataTable.stories.tsx +30 -0
  116. package/src/stories/DateField.stories.tsx +21 -0
  117. package/src/stories/Editable.stories.tsx +2 -0
  118. package/src/stories/FacetedFilter.stories.tsx +197 -0
  119. package/src/stories/GaugeChart.stories.tsx +169 -0
  120. package/src/stories/Heatmap.stories.tsx +172 -0
  121. package/src/stories/InfiniteScroll.stories.tsx +225 -0
  122. package/src/stories/InlineEdit.stories.tsx +106 -0
  123. package/src/stories/JsonInput.stories.tsx +212 -0
  124. package/src/stories/MarkdownPreview.stories.tsx +53 -0
  125. package/src/stories/MonthPicker.stories.tsx +21 -0
  126. package/src/stories/NavigationProgress.stories.tsx +159 -0
  127. package/src/stories/NumberInput.stories.tsx +26 -0
  128. package/src/stories/OtpInput.stories.tsx +110 -0
  129. package/src/stories/PasswordInput.stories.tsx +4 -0
  130. package/src/stories/PasswordStrengthInput.stories.tsx +211 -0
  131. package/src/stories/PhoneInput.stories.tsx +127 -0
  132. package/src/stories/Pill.stories.tsx +201 -0
  133. package/src/stories/Popover.stories.tsx +29 -1
  134. package/src/stories/Portal.stories.tsx +3 -1
  135. package/src/stories/ScrollProgress.stories.tsx +117 -0
  136. package/src/stories/SearchInput.stories.tsx +2 -0
  137. package/src/stories/Snackbar.stories.tsx +315 -0
  138. package/src/stories/SortableList.stories.tsx +263 -0
  139. package/src/stories/Squircle.stories.tsx +1 -0
  140. package/src/stories/Table.stories.tsx +1 -0
  141. package/src/stories/TagsInput.stories.tsx +2 -0
  142. package/src/stories/Timer.stories.tsx +26 -0
  143. package/src/stories/Tour.stories.tsx +1 -0
  144. package/src/stories/TransferList.stories.tsx +4 -0
  145. package/src/stories/WeekPicker.stories.tsx +21 -0
  146. package/src/stories/YearPicker.stories.tsx +21 -0
  147. package/src/stories/story-groups.json +33 -16
  148. package/src/tokens.json +82 -54
@@ -34,7 +34,6 @@ import {
34
34
  InputGroupInput,
35
35
  InputGroupAddon,
36
36
  InputGroupText,
37
- InputGroupButton,
38
37
  } from "@behavioral-agentic-design-system/core/components/ui/input-group";
39
38
  import {
40
39
  Fieldset,
@@ -123,6 +122,8 @@ import { PasswordInput } from "@behavioral-agentic-design-system/core/components
123
122
  import { Notification } from "@behavioral-agentic-design-system/core/components/ui/notification";
124
123
  import { FloatingPanel } from "@behavioral-agentic-design-system/core/components/ui/floating-panel";
125
124
  import { NumberInput } from "@behavioral-agentic-design-system/core/components/ui/number-input";
125
+ import { InlineEdit } from "@behavioral-agentic-design-system/core/components/ui/inline-edit";
126
+ import { OTPInput } from "@behavioral-agentic-design-system/core/components/ui/otp-input";
126
127
  import { FileUpload } from "@behavioral-agentic-design-system/core/components/ui/file-upload";
127
128
  import { Spinner } from "@behavioral-agentic-design-system/core/components/ui/spinner";
128
129
  import { CircularProgress } from "@behavioral-agentic-design-system/core/components/ui/circular-progress";
@@ -260,6 +261,7 @@ import { MotionToggle } from "@behavioral-agentic-design-system/core/components/
260
261
  import { Timeline, TimelineItem } from "@behavioral-agentic-design-system/core/components/ui/timeline";
261
262
  import { TagsInput } from "@behavioral-agentic-design-system/core/components/ui/tags-input";
262
263
  import { Tag } from "@behavioral-agentic-design-system/core/components/ui/tag";
264
+ import { Pill, PillGroup } from "@behavioral-agentic-design-system/core/components/ui/pill";
263
265
  import { Autocomplete } from "@behavioral-agentic-design-system/core/components/ui/autocomplete";
264
266
  import { TimePicker } from "@behavioral-agentic-design-system/core/components/ui/time-picker";
265
267
  import { VisuallyHidden } from "@behavioral-agentic-design-system/core/components/ui/visually-hidden";
@@ -356,7 +358,7 @@ import {
356
358
  SheetTitle,
357
359
  SheetTrigger,
358
360
  } from "@behavioral-agentic-design-system/core/components/ui/sheet";
359
- import { TrendingUp, MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search, Archive as ArchiveIcon, Trash2 as Trash2Icon } from "lucide-react";
361
+ import { MoreHorizontal, Folder, File, FileText, Settings as SettingsIcon, Users as UsersIcon, Search, Archive as ArchiveIcon, Trash2 as Trash2Icon } from "lucide-react";
360
362
  import {
361
363
  Tree,
362
364
  TreeItem,
@@ -427,8 +429,46 @@ import { Portal } from "@behavioral-agentic-design-system/core/components/ui/por
427
429
  import { Icon } from "@behavioral-agentic-design-system/core/components/ui/icon";
428
430
  import { ICON_ROLES } from "@behavioral-agentic-design-system/core/lib/get-icon-color";
429
431
  import { ProgressStack } from "@behavioral-agentic-design-system/core/components/ui/progress-stack";
432
+ import { GaugeChart } from "@behavioral-agentic-design-system/core/components/ui/gauge-chart";
433
+ import { PasswordStrengthInput } from "@behavioral-agentic-design-system/core/components/ui/password-strength-input";
434
+ import { InfiniteScroll } from "@behavioral-agentic-design-system/core/components/ui/infinite-scroll";
435
+ import { ScrollProgress } from "@behavioral-agentic-design-system/core/components/ui/scroll-progress";
436
+ import {
437
+ SnackbarProvider,
438
+ useSnackbar,
439
+ SNACKBAR_ANCHORS,
440
+ type SnackbarAnchor,
441
+ } from "@behavioral-agentic-design-system/core/components/ui/snackbar";
442
+ import {
443
+ Archive as SnackbarArchiveIcon,
444
+ CircleCheck as SnackbarCheckIcon,
445
+ Send as SnackbarSendIcon,
446
+ } from "lucide-react";
430
447
  import { Callout } from "@behavioral-agentic-design-system/core/components/ui/callout";
431
448
  import { AnnouncementBar } from "@behavioral-agentic-design-system/core/components/ui/announcement-bar";
449
+ import { JsonInput } from "@behavioral-agentic-design-system/core/components/ui/json-input";
450
+ import { SortableList, type SortableItem } from "@behavioral-agentic-design-system/core/components/ui/sortable-list";
451
+ import { Heatmap } from "@behavioral-agentic-design-system/core/components/ui/heatmap";
452
+ import {
453
+ NavigationProgress,
454
+ useNavigationProgress,
455
+ } from "@behavioral-agentic-design-system/core/components/ui/navigation-progress";
456
+ import {
457
+ FacetedFilter,
458
+ type FacetedFilterOption,
459
+ } from "@behavioral-agentic-design-system/core/components/ui/faceted-filter";
460
+ import { Attachment } from "@behavioral-agentic-design-system/core/components/ui/attachment";
461
+ import {
462
+ Paperclip as AttachmentPaperclipIcon,
463
+ SendHorizontal as AttachmentSendIcon,
464
+ } from "lucide-react";
465
+ import { PhoneInput } from "@behavioral-agentic-design-system/core/components/ui/phone-input";
466
+ import { PaymentMethodCard } from "@/components/payment-method-card";
467
+ import { TwoFactorCard } from "@/components/two-factor-card";
468
+ import { TeamMembersCard } from "@/components/team-members-card";
469
+ import { ActiveSessionsCard } from "@/components/active-sessions-card";
470
+ import { DomainVerificationCard } from "@/components/domain-verification-card";
471
+ import { NotificationPreferencesCard } from "@/components/notification-preferences-card";
432
472
 
433
473
  // Stable, deterministic data for ScrollArea — never use Math.random in
434
474
  // SSR-rendered output, it causes hydration mismatches.
@@ -3271,6 +3311,14 @@ export default function ComponentsPreview() {
3271
3311
  </div>
3272
3312
  </PopoverContent>
3273
3313
  </Popover>
3314
+ <Popover>
3315
+ <PopoverTrigger asChild>
3316
+ <Button variant="outline" size="sm">With arrow</Button>
3317
+ </PopoverTrigger>
3318
+ <PopoverContent showArrow className="w-56">
3319
+ <p className="text-sm">Arrow caret pointing at the trigger. Matches popover border and background.</p>
3320
+ </PopoverContent>
3321
+ </Popover>
3274
3322
  </div>
3275
3323
  </Section>
3276
3324
 
@@ -6336,6 +6384,69 @@ export default function ComponentsPreview() {
6336
6384
  <Section title="Grid">
6337
6385
  <GridShowcase />
6338
6386
  </Section>
6387
+ <Section title="GaugeChart">
6388
+ <GaugeChartShowcase />
6389
+ </Section>
6390
+ <Section title="PasswordStrengthInput">
6391
+ <PasswordStrengthInputShowcase />
6392
+ </Section>
6393
+ <Section title="InfiniteScroll">
6394
+ <InfiniteScrollShowcase />
6395
+ </Section>
6396
+ <Section title="ScrollProgress">
6397
+ <ScrollProgressShowcase />
6398
+ </Section>
6399
+ <Section title="Pill">
6400
+ <PillShowcase />
6401
+ </Section>
6402
+ <Section title="Snackbar">
6403
+ <SnackbarShowcase />
6404
+ </Section>
6405
+ <Section title="JsonInput">
6406
+ <JsonInputShowcase />
6407
+ </Section>
6408
+ <Section title="SortableList">
6409
+ <SortableListShowcase />
6410
+ </Section>
6411
+ <Section title="Heatmap">
6412
+ <HeatmapShowcase />
6413
+ </Section>
6414
+ <Section title="NavigationProgress">
6415
+ <NavigationProgressShowcase />
6416
+ </Section>
6417
+ <Section title="Faceted Filter">
6418
+ <FacetedFilterShowcase />
6419
+ </Section>
6420
+ <Section title="Attachment">
6421
+ <AttachmentShowcase />
6422
+ </Section>
6423
+ <Section title="Phone Input">
6424
+ <PhoneInputShowcase />
6425
+ </Section>
6426
+ <Section title="TwoFactorCard">
6427
+ <TwoFactorCardShowcase />
6428
+ </Section>
6429
+ <Section title="PaymentMethodCard">
6430
+ <PaymentMethodCardShowcase />
6431
+ </Section>
6432
+ <Section title="TeamMembersCard">
6433
+ <TeamMembersCardShowcase />
6434
+ </Section>
6435
+ <Section title="ActiveSessionsCard">
6436
+ <ActiveSessionsCardShowcase />
6437
+ </Section>
6438
+ <Section title="DomainVerificationCard">
6439
+ <DomainVerificationCardShowcase />
6440
+ </Section>
6441
+ <Section title="NotificationPreferencesCard">
6442
+ <NotificationPreferencesCardShowcase />
6443
+ </Section>
6444
+ <Section title="InlineEdit">
6445
+ <InlineEditShowcase />
6446
+ </Section>
6447
+ <Section title="OTPInput">
6448
+ <OTPInputShowcase />
6449
+ </Section>
6339
6450
  </div>
6340
6451
  </div>
6341
6452
  );
@@ -7167,6 +7278,11 @@ function SignaturePadShowcase() {
7167
7278
  }
7168
7279
 
7169
7280
  function AnchorShowcase() {
7281
+ // Controlled demo: mirror the scroll-spy result back in, the way a docs
7282
+ // site keeps the URL hash and the nav in step.
7283
+ const [controlledActive, setControlledActive] = React.useState<string | null>(
7284
+ "anchor-demo-fork"
7285
+ );
7170
7286
  const sections: { id: string; title: string; body: string; depth?: number }[] = [
7171
7287
  {
7172
7288
  id: "anchor-demo-fork",
@@ -7244,6 +7360,26 @@ function AnchorShowcase() {
7244
7360
  ]}
7245
7361
  />
7246
7362
  </div>
7363
+ <div>
7364
+ <p className="mb-3 text-sm font-medium text-muted-foreground">
7365
+ Controlled — pass <code className="font-mono">activeId</code> and{" "}
7366
+ <code className="font-mono">onActiveChange</code> to own the
7367
+ highlight (URL hash, shared store). This one observes the article
7368
+ above and mirrors the result back; currently reading{" "}
7369
+ <span className="font-medium text-foreground">
7370
+ {sections.find((s) => s.id === controlledActive)?.title ?? "none"}
7371
+ </span>
7372
+ . Anchor is BADS&apos;s table-of-contents primitive — the registry
7373
+ lists <code className="font-mono">TableOfContents</code> as its alias.
7374
+ </p>
7375
+ <Anchor
7376
+ className="w-56"
7377
+ label="Onboarding steps (controlled)"
7378
+ activeId={controlledActive}
7379
+ onActiveChange={setControlledActive}
7380
+ items={sections.map((s) => ({ id: s.id, label: s.title, depth: s.depth }))}
7381
+ />
7382
+ </div>
7247
7383
  </div>
7248
7384
  );
7249
7385
  }
@@ -12594,6 +12730,114 @@ function PresenceShowcase() {
12594
12730
  );
12595
12731
  }
12596
12732
 
12733
+ function GaugeChartShowcase() {
12734
+ return (
12735
+ <div className="space-y-8">
12736
+ <p className="text-sm text-muted-foreground">
12737
+ Radial arc dial for a single reading within a known range. A quiet{" "}
12738
+ <code className="text-xs">--muted</code> track sweeps 270°; the value
12739
+ arc in a <code className="text-xs">--chart-*</code> color fills the
12740
+ proportion the reading represents. Root is{" "}
12741
+ <code className="text-xs">{"<div data-slot=\"gauge-chart\" role=\"meter\">"}</code>{" "}
12742
+ with aria-valuenow/min/max/valuetext — the same contract as Meter,
12743
+ drawn radially. Recharts 3.x with the ChartContainer mount-gate.
12744
+ </p>
12745
+
12746
+ <div>
12747
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12748
+ Default — value 72 of 0–100, md size, --chart-1
12749
+ </p>
12750
+ <GaugeChart value={72} className="w-48" />
12751
+ </div>
12752
+
12753
+ <div>
12754
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12755
+ Sizes — sm 120px, md 160px, lg 200px, xl 240px
12756
+ </p>
12757
+ <div className="flex flex-wrap items-end gap-6">
12758
+ {(["sm", "md", "lg", "xl"] as const).map((size) => (
12759
+ <div key={size} className="flex flex-col items-center gap-2">
12760
+ <GaugeChart
12761
+ value={72}
12762
+ size={size}
12763
+ label="Coverage"
12764
+ className="w-auto"
12765
+ style={{ width: { sm: 120, md: 160, lg: 200, xl: 240 }[size] }}
12766
+ />
12767
+ <code className="text-xs text-muted-foreground">{size}</code>
12768
+ </div>
12769
+ ))}
12770
+ </div>
12771
+ </div>
12772
+
12773
+ <div>
12774
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12775
+ With label — caption under the value, also the default accessible name
12776
+ </p>
12777
+ <GaugeChart value={85} label="CPU usage" className="w-48" />
12778
+ </div>
12779
+
12780
+ <div>
12781
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12782
+ Colors — the Okabe-Ito series in palette order
12783
+ </p>
12784
+ <div className="flex flex-wrap items-end gap-6">
12785
+ {[1, 2, 3, 4, 5].map((n) => (
12786
+ <div key={n} className="flex w-32 flex-col items-center gap-2">
12787
+ <GaugeChart
12788
+ value={72}
12789
+ size="sm"
12790
+ color={`var(--chart-${n})`}
12791
+ aria-label={`Sample reading in chart color ${n}`}
12792
+ />
12793
+ <code className="text-xs text-muted-foreground">--chart-{n}</code>
12794
+ </div>
12795
+ ))}
12796
+ </div>
12797
+ </div>
12798
+
12799
+ <div>
12800
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12801
+ Realistic use — system health card, one hero gauge and three small multiples
12802
+ </p>
12803
+ <Card className="w-[480px]">
12804
+ <CardHeader>
12805
+ <CardTitle>System health</CardTitle>
12806
+ <CardDescription>BADS core — nightly gate run, 2026-09-15</CardDescription>
12807
+ </CardHeader>
12808
+ <CardContent className="flex flex-col gap-6">
12809
+ <div className="flex justify-center">
12810
+ <GaugeChart value={67} label="Overall" size="lg" className="w-52" />
12811
+ </div>
12812
+ <div className="grid grid-cols-3 gap-4">
12813
+ <GaugeChart
12814
+ value={98.4}
12815
+ label="Story coverage"
12816
+ size="sm"
12817
+ formatValue={(v) => `${v.toFixed(1)}%`}
12818
+ />
12819
+ <GaugeChart
12820
+ value={88}
12821
+ max={120}
12822
+ label="Registry entries"
12823
+ size="sm"
12824
+ color="var(--chart-2)"
12825
+ />
12826
+ <GaugeChart
12827
+ value={4}
12828
+ max={12}
12829
+ label="Open advisories"
12830
+ size="sm"
12831
+ color="var(--chart-3)"
12832
+ />
12833
+ </div>
12834
+ </CardContent>
12835
+ </Card>
12836
+ </div>
12837
+ </div>
12838
+ );
12839
+ }
12840
+
12597
12841
  function ProgressStackShowcase() {
12598
12842
  const storageSegments = [
12599
12843
  { value: 38, label: "Documents" },
@@ -13290,3 +13534,1760 @@ function GridShowcase() {
13290
13534
  </div>
13291
13535
  );
13292
13536
  }
13537
+
13538
+ function PasswordStrengthInputShowcase() {
13539
+ const [controlled, setControlled] = React.useState("")
13540
+
13541
+ return (
13542
+ <div className="space-y-8">
13543
+ <p className="text-sm text-muted-foreground">
13544
+ Composes PasswordInput + a segmented strength bar + live-region label.
13545
+ Strength is driven by a pluggable{" "}
13546
+ <code className="text-xs font-mono">strengthFn</code> — swap in zxcvbn
13547
+ or a backend scorer without changing the visual contract. Four source
13548
+ parity: Mantine PasswordInput strength prop, shadcn/ui Auth block, MUI
13549
+ PasswordStrength example, Ark UI composition.
13550
+ </p>
13551
+
13552
+ {/* Default uncontrolled */}
13553
+ <div>
13554
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13555
+ Default — 4 segments, label visible, hints hidden
13556
+ </p>
13557
+ <PasswordStrengthInput
13558
+ placeholder="New password"
13559
+ autoComplete="new-password"
13560
+ className="max-w-xs"
13561
+ />
13562
+ </div>
13563
+
13564
+ {/* With hints */}
13565
+ <div>
13566
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13567
+ showHints — requirements list below the bar
13568
+ </p>
13569
+ <PasswordStrengthInput
13570
+ placeholder="New password"
13571
+ autoComplete="new-password"
13572
+ showHints
13573
+ className="max-w-xs"
13574
+ />
13575
+ </div>
13576
+
13577
+ {/* Strength levels side by side */}
13578
+ <div>
13579
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13580
+ Four strength levels — weak · fair · good · strong
13581
+ </p>
13582
+ <div className="grid grid-cols-2 gap-4 sm:grid-cols-4">
13583
+ {(
13584
+ [
13585
+ { value: "pass", label: "Weak" },
13586
+ { value: "password1", label: "Fair" },
13587
+ { value: "Password123", label: "Good" },
13588
+ { value: "P@ssword123!!", label: "Strong" },
13589
+ ] as const
13590
+ ).map(({ value, label }) => (
13591
+ <div key={label} className="flex flex-col gap-1">
13592
+ <span className="text-xs text-muted-foreground">{label}</span>
13593
+ <PasswordStrengthInput
13594
+ value={value}
13595
+ onChange={() => {}}
13596
+ size="sm"
13597
+ showLabel={false}
13598
+ />
13599
+ </div>
13600
+ ))}
13601
+ </div>
13602
+ </div>
13603
+
13604
+ {/* Controlled + segment variants */}
13605
+ <div>
13606
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13607
+ Controlled (live) — 5 segments
13608
+ </p>
13609
+ <PasswordStrengthInput
13610
+ value={controlled}
13611
+ onChange={(e) => setControlled(e.target.value)}
13612
+ placeholder="Type to see strength update"
13613
+ autoComplete="new-password"
13614
+ segments={5}
13615
+ className="max-w-xs"
13616
+ />
13617
+ </div>
13618
+
13619
+ {/* Sizes */}
13620
+ <div>
13621
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13622
+ Sizes — sm · default · lg · xl
13623
+ </p>
13624
+ <div className="flex flex-col gap-4 max-w-xs">
13625
+ {(["sm", "default", "lg", "xl"] as const).map((size) => (
13626
+ <PasswordStrengthInput
13627
+ key={size}
13628
+ size={size}
13629
+ placeholder={`size="${size}"`}
13630
+ autoComplete="new-password"
13631
+ showLabel={false}
13632
+ />
13633
+ ))}
13634
+ </div>
13635
+ </div>
13636
+
13637
+ {/* Disabled */}
13638
+ <div>
13639
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13640
+ Disabled
13641
+ </p>
13642
+ <PasswordStrengthInput
13643
+ disabled
13644
+ placeholder="Disabled"
13645
+ className="max-w-xs"
13646
+ />
13647
+ </div>
13648
+ </div>
13649
+ );
13650
+ }
13651
+
13652
+ function InfiniteScrollShowcase() {
13653
+ type Item = { id: number; name: string; role: string; initials: string }
13654
+ const names = [
13655
+ { name: "Priya Chandrasekaran", role: "Product designer", initials: "PC" },
13656
+ { name: "Marcus Oliveira", role: "Frontend engineer", initials: "MO" },
13657
+ { name: "Aisha Tanaka", role: "Engineering manager", initials: "AT" },
13658
+ { name: "Samuel Adeyemi", role: "Backend engineer", initials: "SA" },
13659
+ { name: "Lena Bergmann", role: "UX researcher", initials: "LB" },
13660
+ ]
13661
+ function makeItems(start: number, count: number): Item[] {
13662
+ return Array.from({ length: count }, (_, i) => ({
13663
+ id: start + i,
13664
+ ...names[(start + i) % names.length],
13665
+ }))
13666
+ }
13667
+ const PAGE = 8
13668
+ const MAX = 32
13669
+ const [items, setItems] = React.useState<Item[]>(() => makeItems(0, PAGE))
13670
+ const [loading, setLoading] = React.useState(false)
13671
+
13672
+ function loadMore() {
13673
+ if (loading) return
13674
+ setLoading(true)
13675
+ setTimeout(() => {
13676
+ setItems((prev) => [...prev, ...makeItems(prev.length, PAGE)])
13677
+ setLoading(false)
13678
+ }, 800)
13679
+ }
13680
+
13681
+ return (
13682
+ <div className="space-y-6">
13683
+ {/* lint-disable: card-bypass — InfiniteScroll wraps the list; a Card here would double-wrap */}
13684
+ <div className="max-h-[360px] overflow-y-auto rounded-lg border bg-card">
13685
+ <InfiniteScroll
13686
+ onLoadMore={loadMore}
13687
+ hasMore={items.length < MAX}
13688
+ endMessage={
13689
+ <p className="py-6 text-center text-sm text-muted-foreground">
13690
+ All {MAX} team members loaded
13691
+ </p>
13692
+ }
13693
+ >
13694
+ <ul>
13695
+ {items.map((item, i) => (
13696
+ <li key={item.id}>
13697
+ {i > 0 && <div className="border-t" />}
13698
+ <div className="flex items-center gap-3 px-4 py-3">
13699
+ <div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium">
13700
+ {item.initials}
13701
+ </div>
13702
+ <div className="min-w-0 flex-1">
13703
+ <p className="truncate text-sm font-medium">{item.name}</p>
13704
+ <p className="truncate text-xs text-muted-foreground">{item.role}</p>
13705
+ </div>
13706
+ </div>
13707
+ </li>
13708
+ ))}
13709
+ </ul>
13710
+ </InfiniteScroll>
13711
+ </div>
13712
+ <p className="text-xs text-muted-foreground">
13713
+ Scroll the list to trigger IntersectionObserver load-more. Loads {PAGE} items per page up to {MAX}.
13714
+ </p>
13715
+ </div>
13716
+ )
13717
+ }
13718
+
13719
+ function ScrollProgressShowcase() {
13720
+ const stickyRef = React.useRef<HTMLDivElement>(null)
13721
+ const inlineRef = React.useRef<HTMLDivElement>(null)
13722
+ return (
13723
+ <div className="space-y-6">
13724
+ <div>
13725
+ <p className="mb-2 text-xs text-muted-foreground">Sticky — inside a scroll container header</p>
13726
+ <div ref={stickyRef} className="relative max-h-[280px] overflow-y-auto rounded-lg border">
13727
+ <ScrollProgress containerRef={stickyRef} position="sticky" />
13728
+ <div className="space-y-4 p-5">
13729
+ {Array.from({ length: 12 }, (_, i) => (
13730
+ <p key={i} className="text-sm text-muted-foreground">
13731
+ Paragraph {i + 1}: Scroll down to see the progress bar advance along the top of this container.
13732
+ </p>
13733
+ ))}
13734
+ </div>
13735
+ </div>
13736
+ </div>
13737
+ <div>
13738
+ <p className="mb-2 text-xs text-muted-foreground">Custom style — 4 px height, destructive color, no track</p>
13739
+ <div ref={inlineRef} className="relative max-h-[200px] overflow-y-auto rounded-lg border">
13740
+ <ScrollProgress
13741
+ containerRef={inlineRef}
13742
+ position="sticky"
13743
+ height="4px"
13744
+ color="var(--destructive)"
13745
+ trackColor="transparent"
13746
+ />
13747
+ <div className="space-y-4 p-5">
13748
+ {Array.from({ length: 10 }, (_, i) => (
13749
+ <p key={i} className="text-sm text-muted-foreground">
13750
+ Item {i + 1}: Custom bar — 4 px height, destructive color, no track.
13751
+ </p>
13752
+ ))}
13753
+ </div>
13754
+ </div>
13755
+ </div>
13756
+ </div>
13757
+ )
13758
+ }
13759
+
13760
+ function PillShowcase() {
13761
+ return (
13762
+ <div className="space-y-6">
13763
+ <p className="text-sm text-muted-foreground">
13764
+ Compact, non-removable, read-only label — the neutral member of the
13765
+ label family. Tag carries a dismiss affordance and status variants,
13766
+ Badge carries status semantics, Chip toggles; Pill is for metadata
13767
+ that is none of those: taxonomy terms, owners, environments, counts.
13768
+ Plain span, no role, never a CTA (the 44px floor does not apply).
13769
+ </p>
13770
+ <div className="space-y-2">
13771
+ <p className="text-xs font-medium text-muted-foreground">
13772
+ Variants — default (secondary) / outline / muted
13773
+ </p>
13774
+ <PillGroup>
13775
+ <Pill>design tokens</Pill>
13776
+ <Pill variant="outline">semantic layer</Pill>
13777
+ <Pill variant="muted">a11y contract</Pill>
13778
+ </PillGroup>
13779
+ </div>
13780
+ <div className="space-y-2">
13781
+ <p className="text-xs font-medium text-muted-foreground">
13782
+ Sizes — sm (default, 14px) / md / lg
13783
+ </p>
13784
+ <PillGroup>
13785
+ <Pill size="sm">CVA variants</Pill>
13786
+ <Pill size="md">Radix primitive</Pill>
13787
+ <Pill size="lg">forced colors</Pill>
13788
+ </PillGroup>
13789
+ </div>
13790
+ <div className="space-y-2">
13791
+ <p className="text-xs font-medium text-muted-foreground">
13792
+ Leading icon slot (strokeWidth 1.5, scaled per size) and a 20px
13793
+ Avatar for owner pills
13794
+ </p>
13795
+ <PillGroup>
13796
+ <Pill icon={<GitPullRequestIcon strokeWidth={1.5} />}>main</Pill>
13797
+ <Pill size="md" variant="outline" icon={<ShieldCheckIcon strokeWidth={1.5} />}>
13798
+ 7:1 contrast
13799
+ </Pill>
13800
+ <Pill
13801
+ size="lg"
13802
+ variant="outline"
13803
+ className="pl-1"
13804
+ icon={
13805
+ <Avatar size="xs">
13806
+ <AvatarFallback className="text-xs">JR</AvatarFallback>
13807
+ </Avatar>
13808
+ }
13809
+ >
13810
+ Jordan Reeves
13811
+ </Pill>
13812
+ </PillGroup>
13813
+ </div>
13814
+ <div className="space-y-2">
13815
+ <p className="text-xs font-medium text-muted-foreground">
13816
+ Disabled — presentational dim only; the owning control conveys the
13817
+ state
13818
+ </p>
13819
+ <PillGroup>
13820
+ <Pill disabled>token drift</Pill>
13821
+ <Pill disabled variant="outline">visual regression</Pill>
13822
+ <Pill disabled variant="muted">focus trap</Pill>
13823
+ </PillGroup>
13824
+ </div>
13825
+ <div className="space-y-2">
13826
+ <p className="text-xs font-medium text-muted-foreground">
13827
+ Long labels truncate inside a narrow parent (full value in title)
13828
+ </p>
13829
+ <div className="w-56 rounded-lg border p-3">
13830
+ <PillGroup>
13831
+ <Pill title="Wilhelmina-Constance Featherstonehaugh-Vance">
13832
+ Wilhelmina-Constance Featherstonehaugh-Vance
13833
+ </Pill>
13834
+ <Pill variant="muted">李雪芹</Pill>
13835
+ </PillGroup>
13836
+ </div>
13837
+ </div>
13838
+ </div>
13839
+ );
13840
+ }
13841
+
13842
+ function SnackbarShowcase() {
13843
+ const [anchor, setAnchor] = React.useState<SnackbarAnchor>("bottom-center");
13844
+ return (
13845
+ <div className="space-y-8">
13846
+ <p className="text-sm text-muted-foreground">
13847
+ One transient feedback message at a time, anchored to the bottom of the
13848
+ screen, that auto-dismisses. <code className="font-mono">useSnackbar()</code>{" "}
13849
+ gives you <code className="font-mono">show()</code> and{" "}
13850
+ <code className="font-mono">dismiss()</code>; the next message queues
13851
+ behind the current one and nothing ever stacks — that is Sonner&apos;s
13852
+ job, for async events the user needs to see several of at once. The
13853
+ timer pauses on hover and focus; a sticky message is always
13854
+ dismissible; the live region is mounted before the first message so
13855
+ screen readers announce it. Enter/exit ride the existing Presence
13856
+ slide-up keyframes.
13857
+ </p>
13858
+ {/* The provider is local to this section: the preview app has no
13859
+ app-level SnackbarProvider, and the outlet portals to this iframe's
13860
+ own <body>, so it pins to the bottom of the Components tab. */}
13861
+ <SnackbarProvider anchor={anchor}>
13862
+ <div className="flex flex-col gap-6">
13863
+ <SegmentedControl
13864
+ value={anchor}
13865
+ onValueChange={(v) => setAnchor(v as SnackbarAnchor)}
13866
+ label="Snackbar anchor"
13867
+ className="w-fit"
13868
+ >
13869
+ {SNACKBAR_ANCHORS.map((a) => (
13870
+ <SegmentedControlItem key={a} value={a}>
13871
+ {a}
13872
+ </SegmentedControlItem>
13873
+ ))}
13874
+ </SegmentedControl>
13875
+ <SnackbarShowcaseTriggers />
13876
+ </div>
13877
+ </SnackbarProvider>
13878
+ </div>
13879
+ );
13880
+ }
13881
+
13882
+ function SnackbarShowcaseTriggers() {
13883
+ const { show, dismiss } = useSnackbar();
13884
+ const [archived, setArchived] = React.useState<string[]>([]);
13885
+ return (
13886
+ <div className="space-y-6">
13887
+ <div>
13888
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13889
+ Default — message only, 4 s
13890
+ </p>
13891
+ <Button variant="outline" size="xl" onClick={() => show("Settings saved")}>
13892
+ Save settings
13893
+ </Button>
13894
+ </div>
13895
+ <div>
13896
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13897
+ With action + icon — Undo restores the archived member
13898
+ </p>
13899
+ <div className="flex flex-wrap items-center gap-3">
13900
+ <Button
13901
+ variant="outline"
13902
+ size="xl"
13903
+ onClick={() => {
13904
+ const name = "Seo-yun Park";
13905
+ setArchived((a) => [...a, name]);
13906
+ show({
13907
+ message: `${name} archived`,
13908
+ icon: <SnackbarArchiveIcon strokeWidth={1.5} />,
13909
+ action: {
13910
+ label: "Undo",
13911
+ onClick: () => setArchived((a) => a.filter((n) => n !== name)),
13912
+ },
13913
+ });
13914
+ }}
13915
+ >
13916
+ Archive Seo-yun Park
13917
+ </Button>
13918
+ <span className="text-sm font-medium text-muted-foreground">
13919
+ {archived.length} archived
13920
+ </span>
13921
+ </div>
13922
+ </div>
13923
+ <div>
13924
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13925
+ Success icon, 1.5 s — a quick confirmation that gets out of the way
13926
+ </p>
13927
+ <Button
13928
+ variant="outline"
13929
+ size="xl"
13930
+ onClick={() =>
13931
+ show({
13932
+ message: "Copied --primary to clipboard",
13933
+ duration: 1500,
13934
+ icon: <SnackbarCheckIcon strokeWidth={1.5} className="text-icon-success" />,
13935
+ })
13936
+ }
13937
+ >
13938
+ Copy token name
13939
+ </Button>
13940
+ </div>
13941
+ <div>
13942
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13943
+ Sticky — duration Infinity, dismiss × shows by default
13944
+ </p>
13945
+ <Button
13946
+ variant="outline"
13947
+ size="xl"
13948
+ onClick={() =>
13949
+ show({
13950
+ message: "You're offline. Changes to Harborline Logistics sync when you reconnect.",
13951
+ duration: Infinity,
13952
+ })
13953
+ }
13954
+ >
13955
+ Go offline
13956
+ </Button>
13957
+ </div>
13958
+ <div>
13959
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
13960
+ Queue — three calls, one visible, the rest wait their turn
13961
+ </p>
13962
+ <div className="flex flex-wrap items-center gap-3">
13963
+ <Button
13964
+ variant="outline"
13965
+ size="xl"
13966
+ onClick={() => {
13967
+ show({
13968
+ message: "Invitation sent to Tomás Herrera",
13969
+ icon: <SnackbarSendIcon strokeWidth={1.5} />,
13970
+ duration: 2000,
13971
+ });
13972
+ show({ message: "Role updated to Editor", duration: 2000 });
13973
+ show({ message: "Workspace settings saved", duration: 2000 });
13974
+ }}
13975
+ >
13976
+ Queue three messages
13977
+ </Button>
13978
+ <Button variant="ghost" size="xl" onClick={() => dismiss("all")}>
13979
+ Clear queue
13980
+ </Button>
13981
+ </div>
13982
+ </div>
13983
+ </div>
13984
+ );
13985
+ }
13986
+
13987
+ // ─── JsonInput ────────────────────────────────────────────────────────────────
13988
+
13989
+ function JsonInputShowcase() {
13990
+ const [value, setValue] = React.useState<string>("");
13991
+ const [parsed, setParsed] = React.useState<unknown>(null);
13992
+ const [error, setError] = React.useState<string | null>(null);
13993
+
13994
+ return (
13995
+ <div className="space-y-8">
13996
+ <p className="text-sm text-muted-foreground">
13997
+ A <code className="font-mono">{"<Textarea>"}</code> specialized for JSON
13998
+ text entry. Validates on every keystroke (or on blur) via native{" "}
13999
+ <code className="font-mono">JSON.parse</code> and shows an inline error
14000
+ with <code className="font-mono">role=&quot;alert&quot;</code> when the
14001
+ text is not valid JSON. Fires{" "}
14002
+ <code className="font-mono">onValidChange(parsed)</code> whenever valid
14003
+ JSON is present. An optional Format button auto-indents the content.
14004
+ Zero new dependencies.
14005
+ </p>
14006
+
14007
+ <div className="space-y-2">
14008
+ <p className="text-xs font-medium text-muted-foreground">
14009
+ Default — empty field, no error shown until the user types
14010
+ </p>
14011
+ <JsonInput placeholder='{"key": "value"}' className="w-80" />
14012
+ </div>
14013
+
14014
+ <div className="space-y-2">
14015
+ <p className="text-xs font-medium text-muted-foreground">
14016
+ With valid JSON pre-filled — Format button is enabled
14017
+ </p>
14018
+ <JsonInput
14019
+ defaultValue={JSON.stringify(
14020
+ { brand: "Meridian Payments", primaryColor: "#1a56db", radius: "md" },
14021
+ null,
14022
+ 2
14023
+ )}
14024
+ className="w-96"
14025
+ />
14026
+ </div>
14027
+
14028
+ <div className="space-y-2">
14029
+ <p className="text-xs font-medium text-muted-foreground">
14030
+ With invalid JSON pre-filled — error shown immediately (dirty on
14031
+ defaultValue)
14032
+ </p>
14033
+ <JsonInput
14034
+ defaultValue='{"brand": "Fieldnote Labs", missing_quote: true}'
14035
+ className="w-96"
14036
+ />
14037
+ </div>
14038
+
14039
+ <div className="space-y-2">
14040
+ <p className="text-xs font-medium text-muted-foreground">
14041
+ Validate on blur — errors deferred until the field loses focus
14042
+ </p>
14043
+ <JsonInput
14044
+ validateOn="blur"
14045
+ placeholder='{"brand": "Lumen Analytics"}'
14046
+ className="w-80"
14047
+ />
14048
+ </div>
14049
+
14050
+ <div className="space-y-2">
14051
+ <p className="text-xs font-medium text-muted-foreground">
14052
+ External error — server-side validation message overrides the built-in
14053
+ parse error
14054
+ </p>
14055
+ <JsonInput
14056
+ defaultValue='{"plan":"enterprise","seats":25}'
14057
+ externalError={'"seats" must be 50 or greater on the enterprise plan'}
14058
+ className="w-96"
14059
+ />
14060
+ </div>
14061
+
14062
+ <div className="space-y-2">
14063
+ <p className="text-xs font-medium text-muted-foreground">
14064
+ Without Format button
14065
+ </p>
14066
+ <JsonInput
14067
+ showFormatButton={false}
14068
+ defaultValue='{"org":"Cedar & Pine Studio","theme":"light","compact":false}'
14069
+ className="w-80"
14070
+ />
14071
+ </div>
14072
+
14073
+ <div className="space-y-2">
14074
+ <p className="text-xs font-medium text-muted-foreground">
14075
+ Disabled — Format button suppressed, textarea non-interactive
14076
+ </p>
14077
+ <JsonInput
14078
+ disabled
14079
+ defaultValue={JSON.stringify(
14080
+ { org: "Northwind Health", locale: "en-US" },
14081
+ null,
14082
+ 2
14083
+ )}
14084
+ className="w-80"
14085
+ />
14086
+ </div>
14087
+
14088
+ <div className="space-y-2">
14089
+ <p className="text-xs font-medium text-muted-foreground">
14090
+ Sizes — sm / default / lg
14091
+ </p>
14092
+ <div className="flex flex-wrap gap-4">
14093
+ <JsonInput size="sm" placeholder='{"key": "value"}' className="w-64" />
14094
+ <JsonInput size="default" placeholder='{"key": "value"}' className="w-72" />
14095
+ <JsonInput size="lg" placeholder='{"key": "value"}' className="w-80" />
14096
+ </div>
14097
+ </div>
14098
+
14099
+ <div className="space-y-2">
14100
+ <p className="text-xs font-medium text-muted-foreground">
14101
+ Realistic use — inside a Field wrapper, controlled state,{" "}
14102
+ <code className="font-mono">onValidChange</code> captures the parsed
14103
+ result
14104
+ </p>
14105
+ <div className="w-96 space-y-4">
14106
+ <div className="space-y-1.5">
14107
+ <Label htmlFor="json-webhook-showcase">Webhook filter rules</Label>
14108
+ <p className="text-xs text-muted-foreground">
14109
+ Enter a JSON object that defines which events trigger this webhook.
14110
+ </p>
14111
+ <JsonInput
14112
+ id="json-webhook-showcase"
14113
+ value={value}
14114
+ onChange={(e) => setValue(e.target.value)}
14115
+ onValidChange={setParsed}
14116
+ onError={setError}
14117
+ placeholder='{"events": ["user.created"], "org": "Harborline Logistics"}'
14118
+ className="w-full"
14119
+ />
14120
+ </div>
14121
+
14122
+ {parsed !== null && (
14123
+ <div className="rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground">
14124
+ <p className="mb-1 font-medium text-foreground">Parsed result:</p>
14125
+ <pre className="whitespace-pre-wrap break-all font-mono text-xs">
14126
+ {JSON.stringify(parsed, null, 2)}
14127
+ </pre>
14128
+ </div>
14129
+ )}
14130
+ {error && (
14131
+ <p className="text-xs text-muted-foreground">
14132
+ Validation state: invalid
14133
+ </p>
14134
+ )}
14135
+ </div>
14136
+ </div>
14137
+ </div>
14138
+ );
14139
+ }
14140
+
14141
+ // ─── SortableList Showcase ────────────────────────────────────────────────────
14142
+
14143
+ const SORTABLE_PIPELINE = [
14144
+ { id: "s1", label: "Qualification" },
14145
+ { id: "s2", label: "Discovery" },
14146
+ { id: "s3", label: "Proposal" },
14147
+ { id: "s4", label: "Negotiation" },
14148
+ { id: "s5", label: "Closed" },
14149
+ ];
14150
+
14151
+ const SORTABLE_PRIORITIES = [
14152
+ { id: "p1", label: "Northwind Health integration", priority: "high" as const },
14153
+ { id: "p2", label: "Token refresh — Cedar & Pine Studio", priority: "medium" as const },
14154
+ { id: "p3", label: "Harborline Logistics onboarding", priority: "medium" as const },
14155
+ { id: "p4", label: "WCAG AAA audit — Meridian Payments", priority: "low" as const },
14156
+ ];
14157
+
14158
+ const SORTABLE_TEAM = [
14159
+ { id: "u1", name: "Jordan Reeves", role: "Design Lead" },
14160
+ { id: "u2", name: "Seo-yun Park", role: "Senior Engineer" },
14161
+ { id: "u3", name: "Marcus Lindqvist", role: "Product Manager" },
14162
+ { id: "u4", name: "Anika Patel", role: "QA Engineer" },
14163
+ ];
14164
+
14165
+ function SortableListShowcase() {
14166
+ const [pipeline, setPipeline] = React.useState(SORTABLE_PIPELINE);
14167
+ const [priorities, setPriorities] = React.useState(SORTABLE_PRIORITIES);
14168
+ const [team, setTeam] = React.useState(SORTABLE_TEAM);
14169
+
14170
+ return (
14171
+ <div className="flex flex-wrap gap-8">
14172
+ {/* Default */}
14173
+ <div className="space-y-2">
14174
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Default</p>
14175
+ <SortableList
14176
+ items={pipeline}
14177
+ onReorder={setPipeline}
14178
+ aria-label="Pipeline stages"
14179
+ className="w-56"
14180
+ renderItem={(item) => (
14181
+ <span className="text-sm text-foreground">{item.label}</span>
14182
+ )}
14183
+ />
14184
+ </div>
14185
+
14186
+ {/* With badges */}
14187
+ <div className="space-y-2">
14188
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">With badges</p>
14189
+ <SortableList
14190
+ items={priorities}
14191
+ onReorder={setPriorities}
14192
+ aria-label="Project priorities"
14193
+ className="w-80"
14194
+ renderItem={(item) => (
14195
+ <div className="flex min-w-0 items-center gap-2">
14196
+ <span className="min-w-0 flex-1 truncate text-sm text-foreground">{item.label}</span>
14197
+ <Badge
14198
+ variant={
14199
+ item.priority === "high" ? "destructive"
14200
+ : item.priority === "medium" ? "secondary"
14201
+ : "outline"
14202
+ }
14203
+ className="shrink-0 text-xs"
14204
+ >
14205
+ {item.priority}
14206
+ </Badge>
14207
+ </div>
14208
+ )}
14209
+ />
14210
+ </div>
14211
+
14212
+ {/* Realistic — team review order */}
14213
+ <div className="space-y-2">
14214
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
14215
+ Realistic — Fieldnote Labs review order
14216
+ </p>
14217
+ <SortableList
14218
+ items={team}
14219
+ onReorder={setTeam}
14220
+ aria-label="Team review order"
14221
+ className="w-72"
14222
+ renderItem={(member) => (
14223
+ <div className="min-w-0">
14224
+ <p className="truncate text-sm font-medium text-foreground">{member.name}</p>
14225
+ <p className="truncate text-xs text-muted-foreground">{member.role}</p>
14226
+ </div>
14227
+ )}
14228
+ />
14229
+ </div>
14230
+
14231
+ {/* Disabled */}
14232
+ <div className="space-y-2">
14233
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Disabled</p>
14234
+ <SortableList
14235
+ items={[
14236
+ { id: "d1", label: "Qualification" },
14237
+ { id: "d2", label: "Discovery" },
14238
+ { id: "d3", label: "Proposal" },
14239
+ ]}
14240
+ onReorder={() => {}}
14241
+ disabled
14242
+ className="w-56"
14243
+ aria-label="Disabled sortable list"
14244
+ renderItem={(item) => (
14245
+ <span className="text-sm text-muted-foreground">{item.label}</span>
14246
+ )}
14247
+ />
14248
+ </div>
14249
+ </div>
14250
+ );
14251
+ }
14252
+
14253
+ // Deterministic matrix for the Heatmap showcase — seeded LCG, never
14254
+ // Math.random (SSR hydration + Chromatic determinism).
14255
+ function heatmapMatrix(rowCount: number, colCount: number, seed: number, max = 24) {
14256
+ let s = seed >>> 0;
14257
+ const next = () => {
14258
+ s = (s * 1664525 + 1013904223) >>> 0;
14259
+ return s / 0x100000000;
14260
+ };
14261
+ return Array.from({ length: rowCount }, (_, r) =>
14262
+ Array.from({ length: colCount }, (_, c) => {
14263
+ const weight = r >= 5 ? 0.35 : 1;
14264
+ const ramp = 0.4 + (c / Math.max(1, colCount - 1)) * 0.6;
14265
+ return Math.round(next() * max * weight * ramp);
14266
+ }),
14267
+ );
14268
+ }
14269
+
14270
+ const HEATMAP_WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
14271
+ const heatmapWeeks = (n: number) => Array.from({ length: n }, (_, i) => `W${i + 1}`);
14272
+
14273
+ function HeatmapShowcase() {
14274
+ const commits = (v: number) => `${v} commits`;
14275
+ return (
14276
+ <div className="space-y-8">
14277
+ <p className="text-sm text-muted-foreground">
14278
+ A matrix of cells whose color intensity encodes a value — the
14279
+ contribution-calendar / hour-by-weekday shape. Built on a native{" "}
14280
+ <code className="font-mono">&lt;table&gt;</code>: row and column
14281
+ headers are the axes and every cell carries its formatted value as
14282
+ screen-reader text, so the chart is its own text alternative. One
14283
+ series color (<code className="font-mono">--chart-1</code> by default)
14284
+ with a five-level opacity ramp; the lowest bucket and &ldquo;no
14285
+ data&rdquo; are <code className="font-mono">--muted</code>. The root is
14286
+ a focusable scroll region for wide matrices.
14287
+ </p>
14288
+ <div className="space-y-2">
14289
+ <p className="text-xs font-medium text-muted-foreground">
14290
+ Default — md cells, Less → More legend, per-cell tooltip
14291
+ </p>
14292
+ <Heatmap
14293
+ rows={HEATMAP_WEEKDAYS}
14294
+ columns={heatmapWeeks(12)}
14295
+ data={heatmapMatrix(7, 12, 7)}
14296
+ label="Token commits by weekday, last 12 weeks"
14297
+ formatValue={commits}
14298
+ />
14299
+ </div>
14300
+ <div className="space-y-2">
14301
+ <p className="text-xs font-medium text-muted-foreground">
14302
+ Sizes — sm (12px) / md (16px) / lg (24px)
14303
+ </p>
14304
+ <div className="flex flex-wrap items-end gap-8">
14305
+ <Heatmap
14306
+ size="sm"
14307
+ rows={HEATMAP_WEEKDAYS}
14308
+ columns={heatmapWeeks(6)}
14309
+ data={heatmapMatrix(7, 6, 3)}
14310
+ label="Token commits by weekday, 6 weeks, small cells"
14311
+ formatValue={commits}
14312
+ showLegend={false}
14313
+ />
14314
+ <Heatmap
14315
+ size="md"
14316
+ rows={HEATMAP_WEEKDAYS}
14317
+ columns={heatmapWeeks(6)}
14318
+ data={heatmapMatrix(7, 6, 3)}
14319
+ label="Token commits by weekday, 6 weeks, medium cells"
14320
+ formatValue={commits}
14321
+ showLegend={false}
14322
+ />
14323
+ <Heatmap
14324
+ size="lg"
14325
+ rows={HEATMAP_WEEKDAYS}
14326
+ columns={heatmapWeeks(6)}
14327
+ data={heatmapMatrix(7, 6, 3)}
14328
+ label="Token commits by weekday, 6 weeks, large cells"
14329
+ formatValue={commits}
14330
+ showLegend={false}
14331
+ />
14332
+ </div>
14333
+ </div>
14334
+ <div className="space-y-2">
14335
+ <p className="text-xs font-medium text-muted-foreground">
14336
+ Series color from the chart palette (--chart-2) and null cells as
14337
+ &ldquo;no data&rdquo;
14338
+ </p>
14339
+ <Heatmap
14340
+ color="var(--chart-2)"
14341
+ rows={HEATMAP_WEEKDAYS}
14342
+ columns={heatmapWeeks(8)}
14343
+ data={heatmapMatrix(7, 8, 11).map((row, r) =>
14344
+ row.map((v, c) => (c > 5 && r > 3 ? null : v)),
14345
+ )}
14346
+ label="Review comments by weekday — weeks 7 and 8 not yet synced"
14347
+ formatValue={(v) => `${v} comments`}
14348
+ />
14349
+ </div>
14350
+ <div className="space-y-2">
14351
+ <p className="text-xs font-medium text-muted-foreground">
14352
+ Hour × weekday — Storybook sessions at Fieldnote Labs
14353
+ </p>
14354
+ <Heatmap
14355
+ size="sm"
14356
+ color="var(--chart-3)"
14357
+ rows={Array.from({ length: 12 }, (_, h) => `${h + 8}:00`)}
14358
+ columns={HEATMAP_WEEKDAYS.slice(0, 5)}
14359
+ data={heatmapMatrix(12, 5, 23, 60)}
14360
+ label="Storybook sessions by hour and weekday, Fieldnote Labs"
14361
+ formatValue={(v) => `${v} sessions`}
14362
+ />
14363
+ </div>
14364
+ <div className="space-y-2">
14365
+ <p className="text-xs font-medium text-muted-foreground">
14366
+ Wide matrix in a narrow card — the root scrolls and is keyboard
14367
+ focusable (52 weeks in 420px)
14368
+ </p>
14369
+ <div className="w-[420px] max-w-full rounded-lg border p-4">
14370
+ <Heatmap
14371
+ rows={HEATMAP_WEEKDAYS}
14372
+ columns={heatmapWeeks(52)}
14373
+ data={heatmapMatrix(7, 52, 19)}
14374
+ label="Jordan Reeves token commits by weekday, 52 weeks"
14375
+ formatValue={commits}
14376
+ />
14377
+ </div>
14378
+ </div>
14379
+ </div>
14380
+ );
14381
+ }
14382
+
14383
+ function NavigationProgressShowcase() {
14384
+ const { progress, active, start, set, increment, stop, complete, reset } =
14385
+ useNavigationProgress();
14386
+ const [size, setSize] = React.useState<"sm" | "md" | "lg">("md");
14387
+ return (
14388
+ <div className="space-y-8">
14389
+ {/* One bar per document: the Components tab is its own iframe, so the
14390
+ bar pins to the top edge of this tab, not the host shell. */}
14391
+ <NavigationProgress size={size} />
14392
+ <p className="text-sm text-muted-foreground">
14393
+ The thin bar at the top of the viewport that fills while a route
14394
+ change or a long request is in flight — the YouTube / GitHub /
14395
+ Next.js pattern. Driven from outside React by an imperative store
14396
+ (<code className="font-mono">navigationProgress.start()</code> …{" "}
14397
+ <code className="font-mono">.complete()</code>) so a router hook or a
14398
+ fetch wrapper can call it with no component in reach;{" "}
14399
+ <code className="font-mono">useNavigationProgress()</code> reads the
14400
+ state. Starts at 8%, trickles toward 90% on a deterministic ladder,
14401
+ fills to 100% on complete, settles for one{" "}
14402
+ <code className="font-mono">--duration-base</code>, fades, resets.
14403
+ Mount once per document — here it pins to the top edge of this tab.
14404
+ </p>
14405
+ <div className="space-y-2">
14406
+ <p className="text-xs font-medium text-muted-foreground">
14407
+ Drive the store — watch the top edge of this tab
14408
+ </p>
14409
+ <p className="text-sm text-muted-foreground" aria-live="polite">
14410
+ {active ? `Loading — ${Math.round(progress)}%` : "Idle — the bar is hidden"}
14411
+ </p>
14412
+ <div className="flex flex-wrap gap-2">
14413
+ <Button size="xl" onClick={() => start()}>Start</Button>
14414
+ <Button size="xl" variant="outline" onClick={() => set(60)}>Set 60%</Button>
14415
+ <Button size="xl" variant="outline" onClick={() => increment(10)}>+10</Button>
14416
+ <Button size="xl" variant="outline" onClick={() => stop()}>Stop</Button>
14417
+ <Button size="xl" variant="secondary" onClick={() => complete()}>Complete</Button>
14418
+ <Button size="xl" variant="ghost" onClick={() => reset()}>Reset</Button>
14419
+ </div>
14420
+ </div>
14421
+ <div className="space-y-2">
14422
+ <p className="text-xs font-medium text-muted-foreground">
14423
+ Sizes — sm (2px) / md (4px, default) / lg (6px)
14424
+ </p>
14425
+ <SegmentedControl
14426
+ value={size}
14427
+ onValueChange={(v) => setSize(v as "sm" | "md" | "lg")}
14428
+ label="Navigation progress size"
14429
+ className="w-fit"
14430
+ >
14431
+ <SegmentedControlItem value="sm">sm</SegmentedControlItem>
14432
+ <SegmentedControlItem value="md">md</SegmentedControlItem>
14433
+ <SegmentedControlItem value="lg">lg</SegmentedControlItem>
14434
+ </SegmentedControl>
14435
+ </div>
14436
+ </div>
14437
+ );
14438
+ }
14439
+
14440
+ // ---------------------------------------------------------------------------
14441
+ // FacetedFilter showcase
14442
+ // ---------------------------------------------------------------------------
14443
+
14444
+ const FACET_STATUS_OPTIONS: FacetedFilterOption[] = [
14445
+ { label: "Active", value: "active", count: 124 },
14446
+ { label: "Inactive", value: "inactive", count: 38 },
14447
+ { label: "Pending", value: "pending", count: 17 },
14448
+ { label: "Archived", value: "archived", count: 6 },
14449
+ ];
14450
+
14451
+ const FACET_ROLE_OPTIONS: FacetedFilterOption[] = [
14452
+ { label: "Admin", value: "admin", count: 8 },
14453
+ { label: "Member", value: "member", count: 93 },
14454
+ { label: "Viewer", value: "viewer", count: 64 },
14455
+ ];
14456
+
14457
+ function FacetedFilterShowcase() {
14458
+ const [statusSelected, setStatusSelected] = React.useState<Set<string>>(
14459
+ new Set()
14460
+ );
14461
+ const [roleSelected, setRoleSelected] = React.useState<Set<string>>(
14462
+ new Set(["admin"])
14463
+ );
14464
+ return (
14465
+ <div className="flex flex-col gap-6">
14466
+ {/* Filter toolbar demo */}
14467
+ {/* lint-disable: card-bypass — inline demo wrapper, not a Card bypass */}
14468
+ <div className="flex flex-wrap items-center gap-2 rounded-lg border bg-card p-4">
14469
+ <span className="text-sm font-medium text-muted-foreground">
14470
+ Filters:
14471
+ </span>
14472
+ <FacetedFilter
14473
+ title="Status"
14474
+ options={FACET_STATUS_OPTIONS}
14475
+ selectedValues={statusSelected}
14476
+ onSelectionChange={setStatusSelected}
14477
+ />
14478
+ <FacetedFilter
14479
+ title="Role"
14480
+ options={FACET_ROLE_OPTIONS}
14481
+ selectedValues={roleSelected}
14482
+ onSelectionChange={setRoleSelected}
14483
+ />
14484
+ </div>
14485
+ {/* Badge count threshold demo — 2 vs 3+ */}
14486
+ <div className="flex flex-wrap gap-3">
14487
+ <FacetedFilter
14488
+ title="2 selected"
14489
+ options={FACET_STATUS_OPTIONS}
14490
+ selectedValues={new Set(["active", "pending"])}
14491
+ />
14492
+ <FacetedFilter
14493
+ title="3+ selected"
14494
+ options={FACET_STATUS_OPTIONS}
14495
+ selectedValues={new Set(["active", "inactive", "pending", "archived"])}
14496
+ />
14497
+ </div>
14498
+ </div>
14499
+ );
14500
+ }
14501
+
14502
+ // ---------------------------------------------------------------------------
14503
+ // Attachment showcase
14504
+ // ---------------------------------------------------------------------------
14505
+
14506
+ // File names and byte counts from content/personas/bads.json → files[].
14507
+ const ATTACHMENT_FILES = [
14508
+ { name: "roi-report-2026-06.pdf", bytes: 1_536_000, type: "application/pdf" },
14509
+ { name: "styles.css", bytes: 42_700, type: "text/css" },
14510
+ { name: "chromatic-snapshots-2026-06.zip", bytes: 1_073_741_824, type: "application/zip" },
14511
+ ] as const;
14512
+
14513
+ function AttachmentShowcase() {
14514
+ const [attached, setAttached] = React.useState<
14515
+ Array<{ name: string; bytes: number; type: string }>
14516
+ >([...ATTACHMENT_FILES]);
14517
+ const [sending, setSending] = React.useState(false);
14518
+ // Removing a chip unmounts the focused button; send focus back to the
14519
+ // composer so a keyboard user is not dropped on <body>. The component
14520
+ // leaves this to the consumer on purpose — only the composer knows where
14521
+ // "back" is.
14522
+ const composerRef = React.useRef<HTMLTextAreaElement>(null);
14523
+
14524
+ return (
14525
+ <div className="space-y-8">
14526
+ <p className="text-sm text-muted-foreground">
14527
+ The pre-send file chip inside a chat composer — the review step
14528
+ between picking a file (FileButton) and sending the message
14529
+ (ChatInput). File-type icon from the MIME type with an extension
14530
+ fallback, truncated name with the full value on{" "}
14531
+ <code className="font-mono">title</code>, size via FormatByte, and
14532
+ a 44px CloseButton labeled{" "}
14533
+ <code className="font-mono">Remove &lt;name&gt;</code>. The root is{" "}
14534
+ <code className="font-mono">role=&quot;group&quot;</code> named{" "}
14535
+ <code className="font-mono">Attached file: &lt;name&gt;</code>. Not a
14536
+ drop zone (that is FileUpload) and not a post-send card (FileCard).
14537
+ </p>
14538
+ <div className="space-y-2">
14539
+ <p className="text-xs font-medium text-muted-foreground">
14540
+ Default — PDF, image, code, archive
14541
+ </p>
14542
+ <div className="flex flex-wrap gap-2">
14543
+ <Attachment
14544
+ fileName="roi-report-2026-06.pdf"
14545
+ fileSize={1_536_000}
14546
+ fileType="application/pdf"
14547
+ onRemove={() => {}}
14548
+ />
14549
+ <Attachment
14550
+ fileName="favicon.svg"
14551
+ fileSize={500}
14552
+ fileType="image/svg+xml"
14553
+ onRemove={() => {}}
14554
+ />
14555
+ <Attachment
14556
+ fileName="styles.css"
14557
+ fileSize={42_700}
14558
+ fileType="text/css"
14559
+ onRemove={() => {}}
14560
+ />
14561
+ <Attachment
14562
+ fileName="chromatic-snapshots-2026-06.zip"
14563
+ fileSize={1_073_741_824}
14564
+ fileType="application/zip"
14565
+ onRemove={() => {}}
14566
+ />
14567
+ </div>
14568
+ </div>
14569
+ <div className="space-y-2">
14570
+ <p className="text-xs font-medium text-muted-foreground">
14571
+ Unknown MIME type (the browser reports &quot;&quot; for .fig) — extension
14572
+ fallback, generic icon
14573
+ </p>
14574
+ <Attachment
14575
+ fileName="tokens-v2-proposal.fig"
14576
+ fileSize={24_618_034}
14577
+ fileType=""
14578
+ onRemove={() => {}}
14579
+ />
14580
+ </div>
14581
+ <div className="space-y-2">
14582
+ <p className="text-xs font-medium text-muted-foreground">
14583
+ Read-only (no onRemove) and disabled (while sending)
14584
+ </p>
14585
+ <div className="flex flex-wrap gap-2">
14586
+ <Attachment
14587
+ fileName="brand-fonts.woff2"
14588
+ fileSize={84_512}
14589
+ fileType="font/woff2"
14590
+ />
14591
+ <Attachment
14592
+ fileName="roi-report-2026-06.pdf"
14593
+ fileSize={1_536_000}
14594
+ fileType="application/pdf"
14595
+ onRemove={() => {}}
14596
+ disabled
14597
+ />
14598
+ </div>
14599
+ </div>
14600
+ <div className="space-y-2">
14601
+ <p className="text-xs font-medium text-muted-foreground">
14602
+ In a composer — remove a chip, re-attach with the paperclip, send to
14603
+ watch the disabled state
14604
+ </p>
14605
+ <Card className="w-[28rem] max-w-full gap-0 p-3">
14606
+ <Textarea
14607
+ ref={composerRef}
14608
+ aria-label="Message to Jordan Reeves"
14609
+ placeholder="Message Jordan Reeves"
14610
+ defaultValue="Here's the June ROI export, the generated stylesheet, and last quarter's Chromatic baseline."
14611
+ className="min-h-20 resize-none border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
14612
+ />
14613
+ {attached.length > 0 && (
14614
+ <div className="mt-2 flex flex-wrap gap-2 px-1" aria-label="Attachments">
14615
+ {attached.map((f) => (
14616
+ <Attachment
14617
+ key={f.name}
14618
+ fileName={f.name}
14619
+ fileSize={f.bytes}
14620
+ fileType={f.type}
14621
+ disabled={sending}
14622
+ onRemove={() => {
14623
+ setAttached((prev) => prev.filter((p) => p.name !== f.name));
14624
+ composerRef.current?.focus();
14625
+ }}
14626
+ />
14627
+ ))}
14628
+ </div>
14629
+ )}
14630
+ <div className="mt-3 flex items-center justify-between gap-2">
14631
+ <Button
14632
+ type="button"
14633
+ variant="ghost"
14634
+ size="icon-xl"
14635
+ aria-label="Attach a file"
14636
+ disabled={sending}
14637
+ onClick={() =>
14638
+ setAttached((prev) =>
14639
+ prev.some((p) => p.name === "favicon.svg")
14640
+ ? prev
14641
+ : [...prev, { name: "favicon.svg", bytes: 500, type: "image/svg+xml" }]
14642
+ )
14643
+ }
14644
+ >
14645
+ <AttachmentPaperclipIcon strokeWidth={1.5} aria-hidden="true" />
14646
+ </Button>
14647
+ <Button
14648
+ type="button"
14649
+ size="xl"
14650
+ disabled={sending}
14651
+ loading={sending}
14652
+ onClick={() => {
14653
+ setSending(true);
14654
+ window.setTimeout(() => {
14655
+ setSending(false);
14656
+ setAttached([]);
14657
+ }, 1200);
14658
+ }}
14659
+ >
14660
+ <AttachmentSendIcon strokeWidth={1.5} aria-hidden="true" />
14661
+ Send
14662
+ </Button>
14663
+ </div>
14664
+ </Card>
14665
+ </div>
14666
+ </div>
14667
+ );
14668
+ }
14669
+
14670
+ function PhoneInputShowcase() {
14671
+ const [value, setValue] = React.useState("+14155550182");
14672
+ const [gbValue, setGbValue] = React.useState("+447911123456");
14673
+ const [emptyValue, setEmptyValue] = React.useState("");
14674
+ return (
14675
+ <div className="space-y-8">
14676
+ <p className="text-sm text-muted-foreground">
14677
+ Composites a country dial-code select with a tel input. Outputs E.164
14678
+ format (+CC localNumber). Stateless — controlled via value + onChange.
14679
+ No libphonenumber validation; wire your own form-layer validation.
14680
+ </p>
14681
+ <div className="space-y-4">
14682
+ <p className="text-xs font-medium text-muted-foreground">
14683
+ Default — US, controlled
14684
+ </p>
14685
+ <div className="grid w-full max-w-xs gap-2">
14686
+ <label htmlFor="phone-demo-us" className="text-sm font-medium">
14687
+ Phone number
14688
+ </label>
14689
+ <PhoneInput
14690
+ id="phone-demo-us"
14691
+ aria-labelledby="phone-demo-us"
14692
+ value={value}
14693
+ onChange={setValue}
14694
+ />
14695
+ <p className="text-xs text-muted-foreground">Value: {value || "(empty)"}</p>
14696
+ </div>
14697
+ </div>
14698
+ <div className="space-y-4">
14699
+ <p className="text-xs font-medium text-muted-foreground">
14700
+ UK default country
14701
+ </p>
14702
+ <div className="grid w-full max-w-xs gap-2">
14703
+ <label htmlFor="phone-demo-gb" className="text-sm font-medium">
14704
+ Mobile number
14705
+ </label>
14706
+ <PhoneInput
14707
+ id="phone-demo-gb"
14708
+ aria-labelledby="phone-demo-gb"
14709
+ value={gbValue}
14710
+ onChange={setGbValue}
14711
+ defaultCountry="GB"
14712
+ />
14713
+ </div>
14714
+ </div>
14715
+ <div className="space-y-4">
14716
+ <p className="text-xs font-medium text-muted-foreground">
14717
+ Error state
14718
+ </p>
14719
+ <div className="grid w-full max-w-xs gap-2">
14720
+ <label htmlFor="phone-demo-error" className="text-sm font-medium">
14721
+ Phone number
14722
+ </label>
14723
+ <PhoneInput
14724
+ id="phone-demo-error"
14725
+ aria-labelledby="phone-demo-error"
14726
+ value={emptyValue}
14727
+ onChange={setEmptyValue}
14728
+ error
14729
+ aria-describedby="phone-demo-error-msg"
14730
+ />
14731
+ <p id="phone-demo-error-msg" className="text-xs text-destructive">
14732
+ A valid phone number is required.
14733
+ </p>
14734
+ </div>
14735
+ </div>
14736
+ <div className="space-y-4">
14737
+ <p className="text-xs font-medium text-muted-foreground">
14738
+ Disabled
14739
+ </p>
14740
+ <div className="grid w-full max-w-xs gap-2">
14741
+ <label htmlFor="phone-demo-disabled" className="text-sm font-medium text-muted-foreground">
14742
+ Phone number
14743
+ </label>
14744
+ <PhoneInput
14745
+ id="phone-demo-disabled"
14746
+ aria-labelledby="phone-demo-disabled"
14747
+ value="+14155550182"
14748
+ onChange={() => {}}
14749
+ disabled
14750
+ />
14751
+ </div>
14752
+ </div>
14753
+ </div>
14754
+ );
14755
+ }
14756
+
14757
+ function TwoFactorCardShowcase() {
14758
+ return (
14759
+ <div className="space-y-8">
14760
+ <p className="text-sm text-muted-foreground">
14761
+ Dedicated two-factor authentication management card. Shows method-by-method
14762
+ status (authenticator app, SMS, hardware key), backup code count with a
14763
+ low-code warning, and a primary manage CTA. Distinct from SecurityCard which
14764
+ is a full security overview.
14765
+ </p>
14766
+
14767
+ <div className="grid grid-cols-1 gap-6 md:grid-cols-2">
14768
+ <div className="space-y-2">
14769
+ <p className="text-xs font-medium text-muted-foreground">Enabled — authenticator only</p>
14770
+ <TwoFactorCard
14771
+ enabled
14772
+ methods={[
14773
+ { method: "authenticator", enabled: true, label: "Google Authenticator" },
14774
+ { method: "sms", enabled: false, label: "" },
14775
+ { method: "hardware-key", enabled: false, label: "" },
14776
+ ]}
14777
+ backupCodesRemaining={7}
14778
+ onManage={() => {}}
14779
+ />
14780
+ </div>
14781
+
14782
+ <div className="space-y-2">
14783
+ <p className="text-xs font-medium text-muted-foreground">Disabled — not set up</p>
14784
+ <TwoFactorCard
14785
+ enabled={false}
14786
+ methods={[
14787
+ { method: "authenticator", enabled: false, label: "" },
14788
+ { method: "sms", enabled: false, label: "" },
14789
+ { method: "hardware-key", enabled: false, label: "" },
14790
+ ]}
14791
+ backupCodesRemaining={0}
14792
+ onManage={() => {}}
14793
+ />
14794
+ </div>
14795
+
14796
+ <div className="space-y-2">
14797
+ <p className="text-xs font-medium text-muted-foreground">Multiple methods + low backup codes</p>
14798
+ <TwoFactorCard
14799
+ enabled
14800
+ methods={[
14801
+ { method: "authenticator", enabled: true, label: "1Password TOTP" },
14802
+ { method: "sms", enabled: true, label: "+1 •••• 5182" },
14803
+ { method: "hardware-key", enabled: false, label: "" },
14804
+ ]}
14805
+ backupCodesRemaining={1}
14806
+ onManage={() => {}}
14807
+ onRegenerateBackupCodes={() => {}}
14808
+ />
14809
+ </div>
14810
+
14811
+ <div className="space-y-2">
14812
+ <p className="text-xs font-medium text-muted-foreground">All methods — no manage CTA</p>
14813
+ <TwoFactorCard
14814
+ enabled
14815
+ methods={[
14816
+ { method: "authenticator", enabled: true, label: "1Password TOTP" },
14817
+ { method: "sms", enabled: true, label: "+1 •••• 3847" },
14818
+ { method: "hardware-key", enabled: true, label: "YubiKey 5C" },
14819
+ ]}
14820
+ backupCodesRemaining={9}
14821
+ />
14822
+ </div>
14823
+ </div>
14824
+ </div>
14825
+ );
14826
+ }
14827
+
14828
+ function PaymentMethodCardShowcase() {
14829
+ return (
14830
+ <div className="flex flex-col gap-6 w-full max-w-md">
14831
+ <div className="space-y-1">
14832
+ <p className="text-xs font-medium text-muted-foreground">Default — one card, add + actions</p>
14833
+ <PaymentMethodCard
14834
+ methods={[
14835
+ { id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Priya Raghavan", isDefault: true },
14836
+ ]}
14837
+ onAddMethod={() => {}}
14838
+ onSetDefault={() => {}}
14839
+ onRemove={() => {}}
14840
+ />
14841
+ </div>
14842
+ <div className="space-y-1">
14843
+ <p className="text-xs font-medium text-muted-foreground">Multiple cards with expired</p>
14844
+ <PaymentMethodCard
14845
+ methods={[
14846
+ { id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Priya Raghavan", isDefault: true },
14847
+ { id: "pm_2", brand: "mastercard", last4: "5555", expiry: "03/26", name: "Priya Raghavan", isDefault: false },
14848
+ { id: "pm_3", brand: "amex", last4: "3782", expiry: "11/24", name: "Priya Raghavan", isDefault: false, isExpired: true },
14849
+ ]}
14850
+ onAddMethod={() => {}}
14851
+ onSetDefault={() => {}}
14852
+ onRemove={() => {}}
14853
+ />
14854
+ </div>
14855
+ <div className="space-y-1">
14856
+ <p className="text-xs font-medium text-muted-foreground">Empty state</p>
14857
+ <PaymentMethodCard methods={[]} onAddMethod={() => {}} />
14858
+ </div>
14859
+ <div className="space-y-1">
14860
+ <p className="text-xs font-medium text-muted-foreground">Read-only (no actions)</p>
14861
+ <PaymentMethodCard
14862
+ methods={[
14863
+ { id: "pm_1", brand: "visa", last4: "4242", expiry: "09/27", name: "Soo-Jin Park", isDefault: true },
14864
+ ]}
14865
+ />
14866
+ </div>
14867
+ </div>
14868
+ );
14869
+ }
14870
+
14871
+ function TeamMembersCardShowcase() {
14872
+ return (
14873
+ <div className="space-y-8">
14874
+ <p className="text-sm text-muted-foreground">
14875
+ Team member list card: avatar, name, email, and role badge per member,
14876
+ with an optional invite action and overflow count. Sources: GitHub repo
14877
+ collaborators/settings, Vercel team page, Linear team settings, Figma
14878
+ team page, Notion workspace members (5 cross-system sources).
14879
+ </p>
14880
+
14881
+ <div className="space-y-4">
14882
+ <p className="text-xs font-medium text-muted-foreground">
14883
+ Default — 5 members, invite action
14884
+ </p>
14885
+ <div className="w-80">
14886
+ <TeamMembersCard
14887
+ members={[
14888
+ { id: "1", name: "Jordan Reeves", email: "jordan@reeves.design", role: "owner" },
14889
+ { id: "2", name: "Seo-yun Park", email: "seoyun.park@figma.com", role: "admin" },
14890
+ { id: "3", name: "Marcus Lindqvist", email: "marcus@lindqvist.dev", role: "member" },
14891
+ { id: "4", name: "Anika Patel", email: "anika.patel@stripe.com", role: "member" },
14892
+ { id: "5", name: "Tomás Herrera", email: "tomas.herrera@vercel.com", role: "viewer" },
14893
+ ]}
14894
+ description="Northwind Health workspace"
14895
+ onInvite={() => {}}
14896
+ />
14897
+ </div>
14898
+ </div>
14899
+
14900
+ <div className="space-y-4">
14901
+ <p className="text-xs font-medium text-muted-foreground">
14902
+ With overflow count — 3 shown of 12
14903
+ </p>
14904
+ <div className="w-80">
14905
+ <TeamMembersCard
14906
+ members={[
14907
+ { id: "1", name: "Jordan Reeves", email: "jordan@reeves.design", role: "owner" },
14908
+ { id: "2", name: "Kofi Asante", email: "kofi@northwindhealth.com", role: "admin" },
14909
+ { id: "3", name: "Seo-yun Park", email: "seoyun.park@figma.com", role: "member" },
14910
+ ]}
14911
+ totalCount={12}
14912
+ description="Meridian Payments · Design Systems"
14913
+ onInvite={() => {}}
14914
+ />
14915
+ </div>
14916
+ </div>
14917
+
14918
+ <div className="space-y-4">
14919
+ <p className="text-xs font-medium text-muted-foreground">
14920
+ Read-only — no invite action (viewer context)
14921
+ </p>
14922
+ <div className="w-80">
14923
+ <TeamMembersCard
14924
+ members={[
14925
+ { id: "1", name: "Yuki Tanaka", email: "yuki@fieldnotelabs.io", role: "owner" },
14926
+ { id: "2", name: "Chloé Dubois-Martin", email: "chloe@harborline.com", role: "admin" },
14927
+ { id: "3", name: "Marcus Lindqvist", email: "marcus@lindqvist.dev", role: "member" },
14928
+ ]}
14929
+ description="Fieldnote Labs workspace"
14930
+ />
14931
+ </div>
14932
+ </div>
14933
+ </div>
14934
+ );
14935
+ }
14936
+
14937
+ function ActiveSessionsCardShowcase() {
14938
+ return (
14939
+ <div className="space-y-8">
14940
+ <p className="text-sm text-muted-foreground">
14941
+ Active login sessions management card — device/browser info, last-seen
14942
+ time, geographic location, and a per-session revoke action. The current
14943
+ session is highlighted with a badge and protected from revoke. An
14944
+ optional footer CTA lets users revoke all other sessions at once. Sources:
14945
+ GitHub Security settings, Vercel account security, Linear security
14946
+ settings, Stripe dashboard, Auth0 (5 cross-system sources).
14947
+ </p>
14948
+
14949
+ <div className="space-y-4">
14950
+ <p className="text-xs font-medium text-muted-foreground">
14951
+ Default — multiple sessions, current highlighted
14952
+ </p>
14953
+ <div className="w-96">
14954
+ <ActiveSessionsCard
14955
+ sessions={[
14956
+ {
14957
+ id: "sess_current",
14958
+ browser: "Chrome 129 on macOS",
14959
+ location: "San Francisco, CA",
14960
+ lastSeen: new Date().toISOString(),
14961
+ isCurrent: true,
14962
+ device: "desktop",
14963
+ },
14964
+ {
14965
+ id: "sess_2",
14966
+ browser: "Firefox 130 on Ubuntu",
14967
+ location: "Austin, TX",
14968
+ lastSeen: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(),
14969
+ device: "desktop",
14970
+ },
14971
+ {
14972
+ id: "sess_3",
14973
+ browser: "Safari 18 on iOS",
14974
+ location: "New York, NY",
14975
+ lastSeen: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString(),
14976
+ device: "mobile",
14977
+ },
14978
+ ]}
14979
+ onRevoke={(id) => console.log("Revoke:", id)}
14980
+ onRevokeAll={() => console.log("Revoke all")}
14981
+ />
14982
+ </div>
14983
+ </div>
14984
+
14985
+ <div className="space-y-4">
14986
+ <p className="text-xs font-medium text-muted-foreground">
14987
+ Single session — no revoke actions rendered
14988
+ </p>
14989
+ <div className="w-96">
14990
+ <ActiveSessionsCard
14991
+ sessions={[
14992
+ {
14993
+ id: "sess_current",
14994
+ browser: "Arc 1.62 on macOS",
14995
+ location: "San Francisco, CA",
14996
+ lastSeen: new Date().toISOString(),
14997
+ isCurrent: true,
14998
+ device: "desktop",
14999
+ },
15000
+ ]}
15001
+ onRevoke={(id) => console.log("Revoke:", id)}
15002
+ />
15003
+ </div>
15004
+ </div>
15005
+
15006
+ <div className="space-y-4">
15007
+ <p className="text-xs font-medium text-muted-foreground">
15008
+ Many devices — desktop, mobile, tablet, with revoke all
15009
+ </p>
15010
+ <div className="w-96">
15011
+ <ActiveSessionsCard
15012
+ sessions={[
15013
+ {
15014
+ id: "sess_current",
15015
+ browser: "Chrome 129 on macOS",
15016
+ location: "San Francisco, CA",
15017
+ lastSeen: new Date().toISOString(),
15018
+ isCurrent: true,
15019
+ device: "desktop",
15020
+ },
15021
+ {
15022
+ id: "sess_2",
15023
+ browser: "Safari 18 on iOS",
15024
+ location: "Chicago, IL",
15025
+ lastSeen: new Date(Date.now() - 30 * 60 * 1000).toISOString(),
15026
+ device: "mobile",
15027
+ },
15028
+ {
15029
+ id: "sess_3",
15030
+ browser: "Safari 18 on iPadOS",
15031
+ location: "New York, NY",
15032
+ lastSeen: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(),
15033
+ device: "tablet",
15034
+ },
15035
+ {
15036
+ id: "sess_4",
15037
+ browser: "Firefox 130 on Ubuntu",
15038
+ location: "Austin, TX",
15039
+ lastSeen: new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString(),
15040
+ device: "desktop",
15041
+ },
15042
+ ]}
15043
+ onRevoke={(id) => console.log("Revoke:", id)}
15044
+ onRevokeAll={() => console.log("Revoke all")}
15045
+ />
15046
+ </div>
15047
+ </div>
15048
+ </div>
15049
+ );
15050
+ }
15051
+
15052
+ function DomainVerificationCardShowcase() {
15053
+ return (
15054
+ <div className="space-y-8">
15055
+ <p className="text-sm text-muted-foreground">
15056
+ Custom domain setup and verification card — DNS record display (CNAME/TXT/A/MX)
15057
+ with copy-to-clipboard, status badge (pending/verifying/verified/failed), and
15058
+ verify/remove actions. Status is never conveyed by color alone. Sources: Vercel
15059
+ custom domains, GitHub Pages, Linear workspace domain, Stripe custom email domain,
15060
+ Resend domain verification (5 cross-system sources).
15061
+ </p>
15062
+
15063
+ <div className="grid grid-cols-1 gap-6 md:grid-cols-2">
15064
+ <div className="space-y-2">
15065
+ <p className="text-xs font-medium text-muted-foreground">Pending — CNAME record</p>
15066
+ <DomainVerificationCard
15067
+ domain="mail.northwindhealth.io"
15068
+ status="pending"
15069
+ records={[
15070
+ { type: "CNAME", name: "_bads", value: "verify.bads.io", ttl: "86400" },
15071
+ ]}
15072
+ onVerify={() => {}}
15073
+ onRemove={() => {}}
15074
+ />
15075
+ </div>
15076
+
15077
+ <div className="space-y-2">
15078
+ <p className="text-xs font-medium text-muted-foreground">Verified — domain confirmed</p>
15079
+ <DomainVerificationCard
15080
+ domain="app.meridianpayments.com"
15081
+ status="verified"
15082
+ records={[
15083
+ { type: "CNAME", name: "_bads", value: "verify.bads.io", ttl: "86400" },
15084
+ ]}
15085
+ onVerify={() => {}}
15086
+ onRemove={() => {}}
15087
+ />
15088
+ </div>
15089
+
15090
+ <div className="space-y-2">
15091
+ <p className="text-xs font-medium text-muted-foreground">Failed — DNS mismatch</p>
15092
+ <DomainVerificationCard
15093
+ domain="fieldnotelabs.io"
15094
+ status="failed"
15095
+ records={[
15096
+ { type: "TXT", name: "@", value: "v=spf1 include:_spf.bads.io ~all", ttl: "86400" },
15097
+ ]}
15098
+ onVerify={() => {}}
15099
+ onRemove={() => {}}
15100
+ />
15101
+ </div>
15102
+
15103
+ <div className="space-y-2">
15104
+ <p className="text-xs font-medium text-muted-foreground">Multiple records — SPF, DKIM, DMARC, MX</p>
15105
+ <DomainVerificationCard
15106
+ domain="mail.northwindhealth.io"
15107
+ status="pending"
15108
+ records={[
15109
+ { type: "TXT", name: "@", value: "v=spf1 include:_spf.bads.io ~all", ttl: "86400" },
15110
+ { type: "TXT", name: "bads._domainkey", value: "bads-verification=a1b2c3d4e5f6", ttl: "86400" },
15111
+ { type: "TXT", name: "_dmarc", value: "v=DMARC1; p=quarantine; rua=mailto:dmarc@northwindhealth.io", ttl: "3600" },
15112
+ { type: "MX", name: "@", value: "inbound-smtp.bads.io", ttl: "300" },
15113
+ ]}
15114
+ onVerify={() => {}}
15115
+ onRemove={() => {}}
15116
+ />
15117
+ </div>
15118
+ </div>
15119
+ </div>
15120
+ );
15121
+ }
15122
+
15123
+ function NotificationPreferencesCardShowcase() {
15124
+ return (
15125
+ <div className="space-y-8">
15126
+ <p className="text-sm text-muted-foreground">
15127
+ Notification preference matrix card — rows are notification types
15128
+ (mentions, comments, deploys, billing, security alerts), columns are
15129
+ delivery channels (email, push, Slack, SMS). Each intersection is a
15130
+ Switch toggle. Column headers use sr-only text. Sources: GitHub, Vercel,
15131
+ Linear, Stripe, Notion notification settings (5 cross-system sources).
15132
+ </p>
15133
+
15134
+ <div className="space-y-4">
15135
+ <p className="text-xs font-medium text-muted-foreground">
15136
+ Default — email + push (2 channels)
15137
+ </p>
15138
+ <div className="w-96">
15139
+ <NotificationPreferencesCard
15140
+ preferences={[
15141
+ { key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: ["email", "push"] },
15142
+ { key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: ["email"] },
15143
+ { key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: [] },
15144
+ { key: "billing", label: "Billing", description: "Invoices and payment alerts", enabledChannels: ["email"] },
15145
+ ]}
15146
+ channels={["email", "push"]}
15147
+ />
15148
+ </div>
15149
+ </div>
15150
+
15151
+ <div className="space-y-4">
15152
+ <p className="text-xs font-medium text-muted-foreground">
15153
+ Three channels — email + push + Slack, with save action
15154
+ </p>
15155
+ <div className="w-[28rem]">
15156
+ <NotificationPreferencesCard
15157
+ preferences={[
15158
+ { key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: ["email", "push", "slack"] },
15159
+ { key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: ["email", "push"] },
15160
+ { key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: ["slack"] },
15161
+ { key: "billing", label: "Billing", description: "Invoices, receipts, and payment alerts", enabledChannels: ["email"] },
15162
+ { key: "security-alerts", label: "Security alerts", description: "New sign-ins and suspicious activity", enabledChannels: ["email", "push", "slack"] },
15163
+ ]}
15164
+ channels={["email", "push", "slack"]}
15165
+ onSave={() => {}}
15166
+ />
15167
+ </div>
15168
+ </div>
15169
+
15170
+ <div className="space-y-4">
15171
+ <p className="text-xs font-medium text-muted-foreground">
15172
+ All off — zero enabled channels (fresh account / reset state)
15173
+ </p>
15174
+ <div className="w-96">
15175
+ <NotificationPreferencesCard
15176
+ preferences={[
15177
+ { key: "mentions", label: "Mentions", description: "When someone @mentions you", enabledChannels: [] },
15178
+ { key: "comments", label: "Comments", description: "New comments on your items", enabledChannels: [] },
15179
+ { key: "deploys", label: "Deploys", description: "Deployment started, succeeded, or failed", enabledChannels: [] },
15180
+ { key: "billing", label: "Billing", description: "Invoices and payment alerts", enabledChannels: [] },
15181
+ ]}
15182
+ channels={["email", "push", "slack"]}
15183
+ />
15184
+ </div>
15185
+ </div>
15186
+ </div>
15187
+ );
15188
+ }
15189
+
15190
+ function InlineEditShowcase() {
15191
+ const [name, setName] = React.useState("Evelyn Nakamura")
15192
+ const [title, setTitle] = React.useState("Senior Product Designer")
15193
+ return (
15194
+ <div className="space-y-8">
15195
+ <p className="text-sm text-muted-foreground">
15196
+ Ghost variant — blends with ambient text; edit affordance revealed on
15197
+ hover. Confirm with Enter or blur; cancel with Escape.
15198
+ </p>
15199
+ <div className="flex w-80 flex-col gap-2">
15200
+ <p className="text-xs font-medium text-muted-foreground">Ghost (default)</p>
15201
+ <InlineEdit defaultValue="Click to rename this project" />
15202
+ </div>
15203
+ <div className="flex w-80 flex-col gap-2">
15204
+ <p className="text-xs font-medium text-muted-foreground">Outline</p>
15205
+ <InlineEdit variant="outline" defaultValue="Outline variant" />
15206
+ </div>
15207
+ <div className="flex w-80 flex-col gap-2">
15208
+ <p className="text-xs font-medium text-muted-foreground">Sizes — sm / default / lg</p>
15209
+ <InlineEdit size="sm" defaultValue="Small (h-8)" />
15210
+ <InlineEdit size="default" defaultValue="Default (h-9)" />
15211
+ <InlineEdit size="lg" defaultValue="Large (h-10)" />
15212
+ </div>
15213
+ <div className="flex w-80 flex-col gap-2">
15214
+ <p className="text-xs font-medium text-muted-foreground">Disabled</p>
15215
+ <InlineEdit disabled defaultValue="Cannot be edited" />
15216
+ </div>
15217
+ <div className="flex w-80 flex-col gap-2">
15218
+ <p className="text-xs font-medium text-muted-foreground">
15219
+ Realistic use — user profile editor
15220
+ </p>
15221
+ <div className="rounded-lg border p-4">
15222
+ <div className="flex flex-col gap-1">
15223
+ <span className="text-xs text-muted-foreground">Name</span>
15224
+ <InlineEdit value={name} onConfirm={setName} variant="outline" />
15225
+ </div>
15226
+ <div className="mt-3 flex flex-col gap-1">
15227
+ <span className="text-xs text-muted-foreground">Title</span>
15228
+ <InlineEdit value={title} onConfirm={setTitle} variant="outline" />
15229
+ </div>
15230
+ </div>
15231
+ </div>
15232
+ </div>
15233
+ )
15234
+ }
15235
+
15236
+ function OTPInputShowcase() {
15237
+ const [value, setValue] = React.useState("")
15238
+ const [status, setStatus] = React.useState<"idle" | "verifying" | "success" | "error">("idle")
15239
+
15240
+ function handleComplete(v: string) {
15241
+ setStatus("verifying")
15242
+ setTimeout(() => {
15243
+ setStatus(v === "000000" ? "error" : "success")
15244
+ }, 800)
15245
+ }
15246
+
15247
+ return (
15248
+ <div className="space-y-8">
15249
+ <p className="text-sm text-muted-foreground">
15250
+ Individual character slots with auto-advance, backspace-retreat, and
15251
+ paste support. Use for 2FA codes, email confirmation, and invite codes.
15252
+ </p>
15253
+ <div className="flex flex-col gap-3">
15254
+ <p className="text-xs font-medium text-muted-foreground">Sizes — sm / default / lg</p>
15255
+ <OTPInput length={6} size="sm" aria-label="Small OTP" />
15256
+ <OTPInput length={6} size="default" aria-label="Default OTP" />
15257
+ <OTPInput length={6} size="lg" aria-label="Large OTP" />
15258
+ </div>
15259
+ <div className="flex flex-col gap-3">
15260
+ <p className="text-xs font-medium text-muted-foreground">With separator (groups of 3)</p>
15261
+ <OTPInput length={6} separatorAfter={2} aria-label="OTP with separator" />
15262
+ </div>
15263
+ <div className="flex flex-col gap-3">
15264
+ <p className="text-xs font-medium text-muted-foreground">States — disabled / invalid</p>
15265
+ <OTPInput length={6} value="123456" disabled aria-label="Disabled OTP" />
15266
+ <OTPInput length={6} value="12345" invalid aria-label="Invalid OTP" />
15267
+ </div>
15268
+ <div className="flex flex-col items-start gap-3">
15269
+ <p className="text-xs font-medium text-muted-foreground">Realistic use — 2FA verification</p>
15270
+ <div className="rounded-lg border p-6">
15271
+ <div className="flex flex-col items-center gap-4 text-center">
15272
+ <div className="space-y-1">
15273
+ <p className="text-sm font-medium">Enter verification code</p>
15274
+ <p className="text-sm text-muted-foreground">Sent to elara.voss@designcraft.co</p>
15275
+ </div>
15276
+ <OTPInput
15277
+ value={value}
15278
+ onChange={(v) => { setValue(v); if (status !== "idle") setStatus("idle") }}
15279
+ onComplete={handleComplete}
15280
+ separatorAfter={2}
15281
+ invalid={status === "error"}
15282
+ disabled={status === "verifying" || status === "success"}
15283
+ aria-label="Email verification code"
15284
+ />
15285
+ {status === "verifying" && <p className="text-sm text-muted-foreground">Verifying…</p>}
15286
+ {status === "success" && <p className="text-sm text-green-600 dark:text-green-400">Verified successfully</p>}
15287
+ {status === "error" && <p className="text-sm text-destructive">Incorrect code. Try again.</p>}
15288
+ </div>
15289
+ </div>
15290
+ </div>
15291
+ </div>
15292
+ )
15293
+ }