@behavioral-agentic-design-system/core 0.38.0 → 0.39.1

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 (187) hide show
  1. package/package.json +2 -2
  2. package/scripts/a11y-lint.cjs +47 -34
  3. package/scripts/a11y-ratchet.mjs +10 -23
  4. package/scripts/build-tokens.cjs +42 -5
  5. package/scripts/health-report.mjs +52 -10
  6. package/scripts/lib/scan-roots.cjs +143 -0
  7. package/scripts/lint-slop.mjs +21 -28
  8. package/scripts/lint-token-intent.mjs +10 -16
  9. package/scripts/size-audit.cjs +15 -27
  10. package/src/api/layers/file.ts +1 -0
  11. package/src/app/preview/components/page.tsx +366 -0
  12. package/src/app/preview/health/page.tsx +8 -5
  13. package/src/app/preview/history/page.tsx +11 -0
  14. package/src/app/shell.tsx +262 -86
  15. package/src/components/Foundations/Typography.stories.tsx +82 -21
  16. package/src/components/customize/discipline-section.tsx +94 -0
  17. package/src/components/customize-tab.tsx +2 -0
  18. package/src/components/ui/accordion.tsx +67 -5
  19. package/src/components/ui/alert.tsx +20 -7
  20. package/src/components/ui/avatar.tsx +18 -4
  21. package/src/components/ui/breadcrumb.tsx +47 -0
  22. package/src/components/ui/checkbox-card.tsx +48 -8
  23. package/src/components/ui/checkbox.tsx +17 -8
  24. package/src/components/ui/format-date.tsx +107 -0
  25. package/src/components/ui/progress.tsx +6 -5
  26. package/src/components/ui/sparkline.tsx +210 -0
  27. package/src/components/ui/tag.tsx +17 -1
  28. package/src/components/ui/tags-input.tsx +84 -11
  29. package/src/components/ui/toggle-group.tsx +13 -0
  30. package/src/components/ui/week-picker.tsx +463 -0
  31. package/src/data/docs-index.ts +11 -0
  32. package/src/data/history.json +269 -0
  33. package/src/stories/Accordion.stories.tsx +59 -1
  34. package/src/stories/ActionBar.stories.tsx +1 -1
  35. package/src/stories/Affix.stories.tsx +1 -1
  36. package/src/stories/AiBadge.stories.tsx +1 -1
  37. package/src/stories/Alert.stories.tsx +36 -1
  38. package/src/stories/AlertDialog.stories.tsx +1 -1
  39. package/src/stories/Anchor.stories.tsx +1 -1
  40. package/src/stories/AngleSlider.stories.tsx +1 -1
  41. package/src/stories/AspectRatio.stories.tsx +1 -1
  42. package/src/stories/Autocomplete.stories.tsx +1 -1
  43. package/src/stories/Avatar.stories.tsx +41 -1
  44. package/src/stories/Badge.stories.tsx +1 -1
  45. package/src/stories/Blockquote.stories.tsx +1 -1
  46. package/src/stories/BottomNavigation.stories.tsx +1 -1
  47. package/src/stories/Breadcrumb.stories.tsx +38 -5
  48. package/src/stories/Burger.stories.tsx +1 -1
  49. package/src/stories/Button.stories.tsx +9 -1
  50. package/src/stories/ButtonGroup.stories.tsx +1 -1
  51. package/src/stories/Calendar.stories.tsx +1 -1
  52. package/src/stories/Card.stories.tsx +1 -1
  53. package/src/stories/Carousel.stories.tsx +1 -1
  54. package/src/stories/Cascader.stories.tsx +1 -1
  55. package/src/stories/Chart.stories.tsx +1 -1
  56. package/src/stories/ChatBubble.stories.tsx +1 -1
  57. package/src/stories/ChatMarker.stories.tsx +1 -1
  58. package/src/stories/Checkbox.stories.tsx +36 -5
  59. package/src/stories/CheckboxCard.stories.tsx +37 -2
  60. package/src/stories/CheckboxGroup.stories.tsx +1 -1
  61. package/src/stories/Chip.stories.tsx +1 -1
  62. package/src/stories/CircularProgress.stories.tsx +17 -1
  63. package/src/stories/Clipboard.stories.tsx +1 -1
  64. package/src/stories/CloseButton.stories.tsx +1 -1
  65. package/src/stories/Code.stories.tsx +1 -1
  66. package/src/stories/Collapsible.stories.tsx +1 -1
  67. package/src/stories/ColorPicker.stories.tsx +1 -1
  68. package/src/stories/ColorSwatch.stories.tsx +1 -1
  69. package/src/stories/Combobox.stories.tsx +1 -1
  70. package/src/stories/Command.stories.tsx +1 -1
  71. package/src/stories/Container.stories.tsx +1 -1
  72. package/src/stories/ContextMenu.stories.tsx +1 -1
  73. package/src/stories/CopyButton.stories.tsx +9 -1
  74. package/src/stories/DataList.stories.tsx +1 -1
  75. package/src/stories/DataTable.stories.tsx +1 -1
  76. package/src/stories/DateField.stories.tsx +1 -1
  77. package/src/stories/DatePicker.stories.tsx +1 -1
  78. package/src/stories/DateRangePicker.stories.tsx +1 -1
  79. package/src/stories/Dialog.stories.tsx +1 -1
  80. package/src/stories/Drawer.stories.tsx +1 -1
  81. package/src/stories/DropdownMenu.stories.tsx +1 -1
  82. package/src/stories/Editable.stories.tsx +1 -1
  83. package/src/stories/EmptyState.stories.tsx +1 -1
  84. package/src/stories/Field.stories.tsx +1 -1
  85. package/src/stories/Fieldset.stories.tsx +1 -1
  86. package/src/stories/FileButton.stories.tsx +1 -1
  87. package/src/stories/FileUpload.stories.tsx +1 -1
  88. package/src/stories/FloatLabel.stories.tsx +1 -1
  89. package/src/stories/FloatingActionButton.stories.tsx +1 -1
  90. package/src/stories/FloatingIndicator.stories.tsx +1 -1
  91. package/src/stories/FloatingPanel.stories.tsx +9 -1
  92. package/src/stories/FocusTrap.stories.tsx +1 -1
  93. package/src/stories/FormatByte.stories.tsx +1 -1
  94. package/src/stories/FormatDate.stories.tsx +174 -0
  95. package/src/stories/FormatNumber.stories.tsx +1 -1
  96. package/src/stories/Highlight.stories.tsx +1 -1
  97. package/src/stories/HoverCard.stories.tsx +1 -1
  98. package/src/stories/Image.stories.tsx +1 -1
  99. package/src/stories/Indicator.stories.tsx +17 -1
  100. package/src/stories/Input.stories.tsx +1 -1
  101. package/src/stories/InputClearButton.stories.tsx +1 -1
  102. package/src/stories/InputGroup.stories.tsx +1 -1
  103. package/src/stories/Kbd.stories.tsx +1 -1
  104. package/src/stories/KeyboardShortcut.stories.tsx +1 -1
  105. package/src/stories/Label.stories.tsx +1 -1
  106. package/src/stories/Link.stories.tsx +1 -1
  107. package/src/stories/List.stories.tsx +1 -1
  108. package/src/stories/Listbox.stories.tsx +1 -1
  109. package/src/stories/LoadingDots.stories.tsx +1 -1
  110. package/src/stories/LoadingOverlay.stories.tsx +1 -1
  111. package/src/stories/Mark.stories.tsx +1 -1
  112. package/src/stories/Marquee.stories.tsx +1 -1
  113. package/src/stories/Masonry.stories.tsx +1 -1
  114. package/src/stories/Menubar.stories.tsx +1 -1
  115. package/src/stories/Meter.stories.tsx +1 -1
  116. package/src/stories/MonthPicker.stories.tsx +1 -1
  117. package/src/stories/MotionToggle.stories.tsx +1 -1
  118. package/src/stories/MultiSelect.stories.tsx +1 -1
  119. package/src/stories/NativeSelect.stories.tsx +1 -1
  120. package/src/stories/NavLink.stories.tsx +1 -1
  121. package/src/stories/NavigationMenu.stories.tsx +1 -1
  122. package/src/stories/NavigationRail.stories.tsx +9 -1
  123. package/src/stories/Notification.stories.tsx +1 -1
  124. package/src/stories/NumberInput.stories.tsx +1 -1
  125. package/src/stories/Overlay.stories.tsx +1 -1
  126. package/src/stories/Pagination.stories.tsx +1 -1
  127. package/src/stories/PasswordInput.stories.tsx +1 -1
  128. package/src/stories/PinInput.stories.tsx +1 -1
  129. package/src/stories/Popover.stories.tsx +1 -1
  130. package/src/stories/Progress.stories.tsx +11 -1
  131. package/src/stories/Prose.stories.tsx +1 -1
  132. package/src/stories/QrCode.stories.tsx +1 -1
  133. package/src/stories/Questionnaire.stories.tsx +1 -1
  134. package/src/stories/RadioGroup.stories.tsx +1 -1
  135. package/src/stories/RatingGroup.stories.tsx +1 -1
  136. package/src/stories/Resizable.stories.tsx +1 -1
  137. package/src/stories/Result.stories.tsx +1 -1
  138. package/src/stories/Reveal.stories.tsx +1 -1
  139. package/src/stories/RollingNumber.stories.tsx +1 -1
  140. package/src/stories/ScrollArea.stories.tsx +1 -1
  141. package/src/stories/SearchInput.stories.tsx +1 -1
  142. package/src/stories/SegmentedControl.stories.tsx +1 -1
  143. package/src/stories/Select.stories.tsx +1 -1
  144. package/src/stories/Separator.stories.tsx +1 -1
  145. package/src/stories/Sheet.stories.tsx +10 -4
  146. package/src/stories/Sidebar.stories.tsx +1 -1
  147. package/src/stories/SignaturePad.stories.tsx +1 -1
  148. package/src/stories/SimpleGrid.stories.tsx +1 -1
  149. package/src/stories/Skeleton.stories.tsx +1 -1
  150. package/src/stories/SkeletonTable.stories.tsx +1 -1
  151. package/src/stories/SkipLink.stories.tsx +1 -1
  152. package/src/stories/Slider.stories.tsx +1 -1
  153. package/src/stories/Sonner.stories.tsx +1 -1
  154. package/src/stories/Sparkline.stories.tsx +244 -0
  155. package/src/stories/Spinner.stories.tsx +9 -1
  156. package/src/stories/Spoiler.stories.tsx +1 -1
  157. package/src/stories/Squircle.stories.tsx +1 -1
  158. package/src/stories/Stack.stories.tsx +1 -1
  159. package/src/stories/StatusBadge.stories.tsx +1 -1
  160. package/src/stories/Stepper.stories.tsx +1 -1
  161. package/src/stories/Switch.stories.tsx +1 -1
  162. package/src/stories/Table.stories.tsx +1 -1
  163. package/src/stories/Tabs.stories.tsx +1 -1
  164. package/src/stories/Tag.stories.tsx +23 -1
  165. package/src/stories/TagsInput.stories.tsx +46 -1
  166. package/src/stories/Text.stories.tsx +1 -1
  167. package/src/stories/Textarea.stories.tsx +1 -1
  168. package/src/stories/ThemeIcon.stories.tsx +1 -1
  169. package/src/stories/TimePicker.stories.tsx +1 -1
  170. package/src/stories/Timeline.stories.tsx +9 -1
  171. package/src/stories/Timer.stories.tsx +1 -1
  172. package/src/stories/Toggle.stories.tsx +1 -1
  173. package/src/stories/ToggleGroup.stories.tsx +21 -1
  174. package/src/stories/ToggleTip.stories.tsx +1 -1
  175. package/src/stories/Toolbar.stories.tsx +1 -1
  176. package/src/stories/Tooltip.stories.tsx +1 -1
  177. package/src/stories/Tour.stories.tsx +1 -1
  178. package/src/stories/TransferList.stories.tsx +1 -1
  179. package/src/stories/TreeSelect.stories.tsx +1 -1
  180. package/src/stories/TreeView.stories.tsx +1 -1
  181. package/src/stories/TypingIndicator.stories.tsx +1 -1
  182. package/src/stories/VisuallyHidden.stories.tsx +1 -1
  183. package/src/stories/Watermark.stories.tsx +1 -1
  184. package/src/stories/WeekPicker.stories.tsx +90 -0
  185. package/src/stories/WordRotate.stories.tsx +1 -1
  186. package/src/stories/YearPicker.stories.tsx +1 -1
  187. package/src/stories/story-groups.json +199 -0
@@ -26,7 +26,7 @@
26
26
  * Run:
27
27
  * pnpm size-audit # report violations, exit 1 on fail
28
28
  * pnpm size-audit:warn # report but exit 0 (advisory)
29
- * node scripts/size-audit.js path/to.tsx # scan a specific file
29
+ * node packages/core/scripts/size-audit.cjs path/to.tsx # scan a specific file
30
30
  *
31
31
  * Rule code: BADS-2. (BADS-1 = raw <button> not using BADS Button.)
32
32
  */
@@ -35,38 +35,21 @@
35
35
 
36
36
  const fs = require('fs');
37
37
  const path = require('path');
38
+ const { resolveScanFiles, guardEmptyScan } = require('./lib/scan-roots.cjs');
38
39
 
39
40
  // Packaged as the `bads-size-audit` bin: runs against the CONSUMER repo
40
41
  // (cwd), so prototype repos and client forks get the CTA size contract
41
42
  // without copying the script. Pass scan roots as positional args
42
- // (`bads-size-audit app components`) or rely on the defaults below.
43
+ // (`bads-size-audit app components`) or rely on the shared defaults in
44
+ // ./lib/scan-roots.cjs (also set BADS_LINT_ROOTS). That file explains why
45
+ // the roots are centralized: this script, a11y-lint, lint-slop,
46
+ // a11y-ratchet and lint-token-intent used to keep drifted copies of the
47
+ // same list.
43
48
  const ROOT = process.cwd();
44
49
  const advisory = process.argv.includes('--warn');
45
- const argPaths = process.argv.slice(2).filter((a) => !a.startsWith('--'));
46
- const argRoots = argPaths.filter((p) => fs.existsSync(p) && fs.statSync(p).isDirectory());
47
- const explicitPaths = argPaths.filter((p) => !argRoots.includes(p));
48
-
49
- const SCAN_ROOTS = argRoots.length
50
- ? argRoots
51
- : ['app', 'components', 'src'].filter((r) => fs.existsSync(path.join(ROOT, r)));
52
-
53
- function walk(dir, out = []) {
54
- if (!fs.existsSync(dir)) return out;
55
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
56
- if (entry.name.startsWith('.') || entry.name === 'node_modules') continue;
57
- const full = path.join(dir, entry.name);
58
- if (entry.isDirectory()) {
59
- walk(full, out);
60
- } else if (/\.tsx?$/.test(entry.name)) {
61
- out.push(full);
62
- }
63
- }
64
- return out;
65
- }
66
50
 
67
- const files = explicitPaths.length
68
- ? explicitPaths.map((p) => path.resolve(p))
69
- : SCAN_ROOTS.flatMap((r) => walk(path.join(ROOT, r)));
51
+ const scan = resolveScanFiles({ root: ROOT, argv: process.argv.slice(2), allowDirArgs: true });
52
+ const files = scan.files;
70
53
 
71
54
  const issues = [];
72
55
 
@@ -124,7 +107,12 @@ for (const file of files) {
124
107
  }
125
108
 
126
109
  if (issues.length === 0) {
127
- console.log('✓ size-audit: every CTA reads at text-sm. No size divergence.');
110
+ if (guardEmptyScan(scan, 'size-audit')) { /* exited */ }
111
+ console.log(
112
+ scan.files.length
113
+ ? '✓ size-audit: every CTA reads at text-sm. No size divergence.'
114
+ : '✓ size-audit: every CTA reads at text-sm (0 files matched under existing scan roots).'
115
+ );
128
116
  process.exit(0);
129
117
  }
130
118
 
@@ -47,6 +47,7 @@ function isAllowed(rel: string) {
47
47
  if (norm === "packages/core/src/tokens.json") return true;
48
48
  if (/^layer-[\w-]+\//.test(norm) && /\.(md|json)$/.test(norm)) return true;
49
49
  if (/^docs\/[\w.-]+\.md$/.test(norm)) return true;
50
+ if (/^disciplines\/[\w./-]+\.(md|json)$/.test(norm)) return true;
50
51
  if (/^prompts\/[\w.-]+\.md$/.test(norm)) return true;
51
52
  if (/^\.claude\/skills\/[\w.-]+\/SKILL\.md$/.test(norm)) return true;
52
53
  if (/^(ledgers|aggregator|automation|roi)\/README\.md$/.test(norm)) return true;
@@ -416,6 +416,9 @@ import {
416
416
  import { Questionnaire } from "@behavioral-agentic-design-system/core/components/ui/questionnaire";
417
417
  import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
418
418
  import { SearchInput } from "@behavioral-agentic-design-system/core/components/ui/search-input";
419
+ import { FormatDate } from "@behavioral-agentic-design-system/core/components/ui/format-date";
420
+ import { WeekPicker } from "@behavioral-agentic-design-system/core/components/ui/week-picker";
421
+ import { Sparkline } from "@behavioral-agentic-design-system/core/components/ui/sparkline";
419
422
 
420
423
  // Stable, deterministic data for ScrollArea — never use Math.random in
421
424
  // SSR-rendered output, it causes hydration mismatches.
@@ -969,6 +972,10 @@ export default function ComponentsPreview() {
969
972
  <Checkbox id="cb-default-size" defaultChecked />
970
973
  <Label htmlFor="cb-default-size">Default (32px)</Label>
971
974
  </div>
975
+ <div className="flex items-center gap-3">
976
+ <Checkbox id="cb-lg" size="lg" defaultChecked />
977
+ <Label htmlFor="cb-lg">Large (40px)</Label>
978
+ </div>
972
979
  </div>
973
980
  <Label>Radio sizes</Label>
974
981
  <RadioGroup defaultValue="default" className="flex items-center gap-6">
@@ -1104,6 +1111,14 @@ export default function ComponentsPreview() {
1104
1111
  <Skeleton className="h-9 w-9 rounded-full" />
1105
1112
  <Skeleton className="h-9 w-32" />
1106
1113
  </div>
1114
+ <div className="mt-3 flex items-end gap-2">
1115
+ <span className="text-xs font-medium text-muted-foreground">size:</span>
1116
+ {(["xs", "sm", "default", "lg", "xl"] as const).map((size) => (
1117
+ <Avatar key={size} size={size}>
1118
+ <AvatarFallback>NN</AvatarFallback>
1119
+ </Avatar>
1120
+ ))}
1121
+ </div>
1107
1122
  <div className="mt-3 flex items-center gap-3">
1108
1123
  <span className="text-xs font-medium text-muted-foreground">shape:</span>
1109
1124
  <Avatar shape="circle" size="lg">
@@ -2763,6 +2778,15 @@ export default function ComponentsPreview() {
2763
2778
  ]}
2764
2779
  />
2765
2780
  </div>
2781
+ <div className="space-y-3">
2782
+ <p className="text-sm font-medium text-muted-foreground">Sizes — sm (36px) · default (44px) · lg (48px) · xl (56px)</p>
2783
+ <div className="space-y-3">
2784
+ <TagsInputShowcase size="sm" initialTags={["button", "input"]} placeholder="sm…" />
2785
+ <TagsInputShowcase size="default" initialTags={["button", "input"]} placeholder="default…" />
2786
+ <TagsInputShowcase size="lg" initialTags={["button", "input"]} placeholder="lg…" />
2787
+ <TagsInputShowcase size="xl" initialTags={["button", "input"]} placeholder="xl…" />
2788
+ </div>
2789
+ </div>
2766
2790
  <div className="space-y-3">
2767
2791
  <p className="text-sm font-medium text-muted-foreground">Max tags (4)</p>
2768
2792
  <TagsInputShowcase
@@ -3186,6 +3210,12 @@ export default function ComponentsPreview() {
3186
3210
  <ToggleGroupItem value="italic" aria-label="Italic"><ItalicIcon className="size-4" strokeWidth={1.5} /></ToggleGroupItem>
3187
3211
  <ToggleGroupItem value="underline" aria-label="Underline"><UnderlineIcon className="size-4" strokeWidth={1.5} /></ToggleGroupItem>
3188
3212
  </ToggleGroup>
3213
+ <p className="text-sm font-medium text-muted-foreground">Toggle group — vertical orientation</p>
3214
+ <ToggleGroup type="single" orientation="vertical" variant="outline" aria-label="Text alignment vertical">
3215
+ <ToggleGroupItem value="left" aria-label="Align left"><AlignLeftIcon className="size-4" strokeWidth={1.5} /></ToggleGroupItem>
3216
+ <ToggleGroupItem value="center" aria-label="Align center"><AlignCenterIcon className="size-4" strokeWidth={1.5} /></ToggleGroupItem>
3217
+ <ToggleGroupItem value="right" aria-label="Align right"><AlignRightIcon className="size-4" strokeWidth={1.5} /></ToggleGroupItem>
3218
+ </ToggleGroup>
3189
3219
  </div>
3190
3220
  </div>
3191
3221
  </Section>
@@ -4144,7 +4174,11 @@ export default function ComponentsPreview() {
4144
4174
  <ColorSwatch color="#171717" size="lg" aria-label="Selected: near-black">
4145
4175
  <CheckIcon strokeWidth={1.5} className="text-white" />
4146
4176
  </ColorSwatch>
4177
+ {/* Picker's own label pattern (see CLAUDE.md -> Customize Tab):
4178
+ shows the user's raw hex pick back as text, not a style
4179
+ value — SC 1.4.6 doesn't apply to displayed data. */}
4147
4180
  <span className="tabular-nums text-muted-foreground">
4181
+ {/* allow-hex-literal */}
4148
4182
  #171717 · selected
4149
4183
  </span>
4150
4184
  </div>
@@ -6238,6 +6272,15 @@ export default function ComponentsPreview() {
6238
6272
  <Section title="SearchInput">
6239
6273
  <SearchInputShowcase />
6240
6274
  </Section>
6275
+ <Section title="FormatDate">
6276
+ <FormatDateShowcase />
6277
+ </Section>
6278
+ <Section title="WeekPicker">
6279
+ <WeekPickerShowcase />
6280
+ </Section>
6281
+ <Section title="Sparkline">
6282
+ <SparklineShowcase />
6283
+ </Section>
6241
6284
  </div>
6242
6285
  </div>
6243
6286
  );
@@ -8524,6 +8567,32 @@ function CheckboxCardShowcase() {
8524
8567
  </CheckboxCard>
8525
8568
  </div>
8526
8569
  </div>
8570
+ <div>
8571
+ <p className="mb-3 text-sm font-medium text-muted-foreground">
8572
+ Sizes — sm / default / lg set padding, gap, and the inherited base
8573
+ font size (children without a text-* class pick it up)
8574
+ </p>
8575
+ <div className="grid items-start gap-3 sm:grid-cols-3">
8576
+ <CheckboxCard size="sm">
8577
+ <span className="font-medium text-foreground">sm</span>
8578
+ <span className="text-muted-foreground">
8579
+ p-3, text-sm — dense option lists.
8580
+ </span>
8581
+ </CheckboxCard>
8582
+ <CheckboxCard size="default">
8583
+ <span className="font-medium text-foreground">default</span>
8584
+ <span className="text-muted-foreground">
8585
+ p-4, text-sm — unchanged.
8586
+ </span>
8587
+ </CheckboxCard>
8588
+ <CheckboxCard size="lg">
8589
+ <span className="font-medium text-foreground">lg</span>
8590
+ <span className="text-muted-foreground">
8591
+ p-5, text-base — hero pickers.
8592
+ </span>
8593
+ </CheckboxCard>
8594
+ </div>
8595
+ </div>
8527
8596
  <div>
8528
8597
  <p className="mb-3 text-sm font-medium text-muted-foreground">
8529
8598
  Multi-select — enforcement passes for a client fork ({selected.length}{" "}
@@ -11510,6 +11579,14 @@ function TagShowcase() {
11510
11579
  <Tag size="md" variant="success" label="a11y contract" onClose={() => {}} />
11511
11580
  <Tag size="lg" label="design tokens" onClose={() => {}} />
11512
11581
  </div>
11582
+ <p className="text-xs font-medium text-muted-foreground">With icon (leading icon slot)</p>
11583
+ <div className="flex items-center gap-2 flex-wrap">
11584
+ <Tag variant="success" label="Verified" icon={<CheckIcon strokeWidth={1.5} />} />
11585
+ <Tag variant="warning" label="Needs review" icon={<TriangleAlertIcon strokeWidth={1.5} />} />
11586
+ <Tag variant="info" label="Tip" icon={<Info strokeWidth={1.5} />} />
11587
+ <Tag variant="default" size="sm" label="new" icon={<ZapIcon strokeWidth={1.5} />} />
11588
+ <Tag variant="success" size="sm" label="shipped" icon={<CheckIcon strokeWidth={1.5} />} onClose={() => {}} />
11589
+ </div>
11513
11590
  </div>
11514
11591
  </div>
11515
11592
  );
@@ -11956,3 +12033,292 @@ function SearchInputShowcase() {
11956
12033
  </div>
11957
12034
  );
11958
12035
  }
12036
+
12037
+ function FormatDateShowcase() {
12038
+ const kickoff = new Date(2026, 0, 15);
12039
+ const reportDate = new Date(2026, 8, 9);
12040
+ return (
12041
+ <div className="space-y-8">
12042
+ <p className="text-sm text-muted-foreground">
12043
+ Locale-aware date display primitive — wraps{" "}
12044
+ <code className="text-xs">Intl.DateTimeFormat</code> and renders a{" "}
12045
+ <code className="text-xs">{"<span data-slot=\"format-date\">"}</code>.
12046
+ SSR-safe: explicit locale constant, never{" "}
12047
+ <code className="text-xs">navigator.language</code>. Pairs with
12048
+ FormatNumber and FormatByte.
12049
+ </p>
12050
+
12051
+ <div>
12052
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12053
+ dateStyle variants
12054
+ </p>
12055
+ <div className="space-y-1 text-sm text-foreground">
12056
+ <p>
12057
+ full: <FormatDate value={kickoff} dateStyle="full" className="font-medium" />
12058
+ </p>
12059
+ <p>
12060
+ long: <FormatDate value={kickoff} dateStyle="long" className="font-medium" />
12061
+ </p>
12062
+ <p>
12063
+ medium (default):{" "}
12064
+ <FormatDate value={kickoff} className="font-medium" />
12065
+ </p>
12066
+ <p>
12067
+ short: <FormatDate value={kickoff} dateStyle="short" className="font-medium" />
12068
+ </p>
12069
+ </div>
12070
+ </div>
12071
+
12072
+ <div>
12073
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12074
+ With time (dateStyle + timeStyle)
12075
+ </p>
12076
+ <p className="text-sm text-foreground">
12077
+ <FormatDate
12078
+ value={new Date(2026, 8, 9, 14, 30, 0)}
12079
+ dateStyle="long"
12080
+ timeStyle="short"
12081
+ className="font-medium"
12082
+ />
12083
+ </p>
12084
+ </div>
12085
+
12086
+ <div>
12087
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12088
+ Graceful empty — undefined/null value renders empty span
12089
+ </p>
12090
+ <p className="text-sm text-muted-foreground italic">
12091
+ <FormatDate value={undefined} />
12092
+ (nothing rendered above)
12093
+ </p>
12094
+ </div>
12095
+
12096
+ <div>
12097
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12098
+ Realistic use — publication byline
12099
+ </p>
12100
+ <Card className="w-96">
12101
+ <CardHeader>
12102
+ <CardTitle>ROI report</CardTitle>
12103
+ <CardDescription>
12104
+ Austin design systems team — quarterly summary
12105
+ </CardDescription>
12106
+ </CardHeader>
12107
+ <CardContent>
12108
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
12109
+ Published{" "}
12110
+ <FormatDate value={reportDate} dateStyle="long" className="normal-case" />
12111
+ </p>
12112
+ <p className="mt-2 text-sm text-foreground">
12113
+ The engagement ran from{" "}
12114
+ <FormatDate value={kickoff} dateStyle="long" className="font-medium" />{" "}
12115
+ through{" "}
12116
+ <FormatDate value={new Date(2026, 5, 30)} dateStyle="long" className="font-medium" />,
12117
+ delivering 88 components and $182,450 in documented client savings.
12118
+ </p>
12119
+ </CardContent>
12120
+ </Card>
12121
+ </div>
12122
+ </div>
12123
+ );
12124
+ }
12125
+
12126
+ function WeekPickerShowcase() {
12127
+ const [selectedWeek, setSelectedWeek] = React.useState<Date | undefined>(undefined);
12128
+ const [sprintWeek, setSprintWeek] = React.useState<Date>(new Date(2026, 8, 7));
12129
+
12130
+ return (
12131
+ <div className="space-y-8">
12132
+ <p className="text-sm text-muted-foreground">
12133
+ ISO 8601 week picker — a calendar-month grid where clicking a week row
12134
+ selects that ISO week and fires <code className="text-xs">onValueChange</code>{" "}
12135
+ with the week&apos;s Monday. Trigger shows &quot;Week N, YYYY&quot; format.
12136
+ Keyboard: ArrowUp/Down navigate weeks, PageUp/Down change months,
12137
+ Shift+PageUp/Down change years.
12138
+ </p>
12139
+
12140
+ <div>
12141
+ <p className="mb-3 text-xs font-medium text-muted-foreground">Default</p>
12142
+ <WeekPicker className="rounded-md border" />
12143
+ </div>
12144
+
12145
+ <div>
12146
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12147
+ With value (controlled)
12148
+ </p>
12149
+ <WeekPicker
12150
+ value={sprintWeek}
12151
+ onValueChange={setSprintWeek}
12152
+ className="rounded-md border"
12153
+ />
12154
+ {sprintWeek && (
12155
+ <p className="mt-2 text-xs text-muted-foreground">
12156
+ Selected: {sprintWeek.toLocaleDateString("en-US", { dateStyle: "medium" })}
12157
+ </p>
12158
+ )}
12159
+ </div>
12160
+
12161
+ <div>
12162
+ <p className="mb-3 text-xs font-medium text-muted-foreground">Disabled</p>
12163
+ <WeekPicker
12164
+ disabled
12165
+ defaultValue={new Date(2026, 8, 7)}
12166
+ className="rounded-md border"
12167
+ />
12168
+ </div>
12169
+
12170
+ <div>
12171
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12172
+ Realistic use — sprint planning
12173
+ </p>
12174
+ <Card className="w-fit">
12175
+ <CardHeader>
12176
+ <CardTitle>Sprint planning</CardTitle>
12177
+ <CardDescription>
12178
+ Jordan Reeves · BADS engagement · Select sprint week
12179
+ </CardDescription>
12180
+ </CardHeader>
12181
+ <CardContent className="space-y-3">
12182
+ <label className="text-sm font-medium text-foreground" htmlFor="sprint-week-showcase">
12183
+ Sprint week
12184
+ </label>
12185
+ <WeekPicker
12186
+ id="sprint-week-showcase"
12187
+ value={selectedWeek}
12188
+ onValueChange={setSelectedWeek}
12189
+ placeholder="Select sprint week"
12190
+ className="rounded-md border"
12191
+ />
12192
+ {selectedWeek && (
12193
+ <p className="text-sm text-muted-foreground">
12194
+ Sprint starts{" "}
12195
+ <span className="font-medium text-foreground">
12196
+ {selectedWeek.toLocaleDateString("en-US", { month: "short", day: "numeric" })}
12197
+ </span>
12198
+ </p>
12199
+ )}
12200
+ </CardContent>
12201
+ </Card>
12202
+ </div>
12203
+ </div>
12204
+ );
12205
+ }
12206
+
12207
+ function SparklineShowcase() {
12208
+ const revenueData = [24000, 27500, 25800, 31200, 29400, 34100, 32600, 36200];
12209
+ const userData = [82, 95, 104, 98, 117, 131, 128, 142];
12210
+ const churnData = [8.2, 7.9, 8.5, 7.4, 7.1, 6.8, 6.3, 6.0];
12211
+ const negativeData = [-12, 4, -8, 15, -3, 22, 8, -5];
12212
+
12213
+ return (
12214
+ <div className="space-y-8">
12215
+ <p className="text-sm text-muted-foreground">
12216
+ Compact inline sparkline for trend visualization — no axes, labels, or
12217
+ tooltip. Uses Recharts 3.x with the same ResizeObserver mount-gate as
12218
+ ChartContainer. Root is{" "}
12219
+ <code className="text-xs">{"<span data-slot=\"sparkline\">"}</code> — inline-safe.
12220
+ Always supply <code className="text-xs">aria-label</code>.
12221
+ </p>
12222
+
12223
+ <div>
12224
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12225
+ Type variants
12226
+ </p>
12227
+ <div className="flex flex-col gap-3">
12228
+ <div>
12229
+ <p className="mb-1 text-xs text-muted-foreground">Area (default)</p>
12230
+ <Sparkline
12231
+ data={revenueData}
12232
+ className="w-40"
12233
+ aria-label="Monthly revenue area trend"
12234
+ />
12235
+ </div>
12236
+ <div>
12237
+ <p className="mb-1 text-xs text-muted-foreground">Line</p>
12238
+ <Sparkline
12239
+ data={revenueData}
12240
+ type="line"
12241
+ className="w-40"
12242
+ aria-label="Monthly revenue line trend"
12243
+ />
12244
+ </div>
12245
+ </div>
12246
+ </div>
12247
+
12248
+ <div>
12249
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12250
+ withDot — marks last data point
12251
+ </p>
12252
+ <Sparkline
12253
+ data={revenueData}
12254
+ withDot
12255
+ className="w-40"
12256
+ aria-label="Monthly revenue trend with current-value dot"
12257
+ />
12258
+ </div>
12259
+
12260
+ <div>
12261
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12262
+ Negative / mixed data
12263
+ </p>
12264
+ <div className="flex gap-4">
12265
+ <Sparkline
12266
+ data={negativeData}
12267
+ type="area"
12268
+ className="w-32"
12269
+ aria-label="Mixed positive and negative trend"
12270
+ />
12271
+ <Sparkline
12272
+ data={negativeData}
12273
+ type="line"
12274
+ color="var(--color-destructive)"
12275
+ className="w-32"
12276
+ aria-label="Negative trend in destructive color"
12277
+ />
12278
+ </div>
12279
+ </div>
12280
+
12281
+ <div>
12282
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12283
+ Realistic use — stat row with 3 sparklines
12284
+ </p>
12285
+ <Card className="w-[480px]">
12286
+ <CardHeader>
12287
+ <CardTitle>Engagement health</CardTitle>
12288
+ <CardDescription>
12289
+ BADS — Austin design systems team, last 8 months
12290
+ </CardDescription>
12291
+ </CardHeader>
12292
+ <CardContent>
12293
+ <div className="grid grid-cols-3 gap-4">
12294
+ {[
12295
+ { label: "Revenue", value: "$36.2K", data: revenueData, ariaLabel: "Monthly revenue trend" },
12296
+ { label: "Active users", value: "142", data: userData, ariaLabel: "Monthly active users trend" },
12297
+ {
12298
+ label: "Churn rate",
12299
+ value: "6.0%",
12300
+ data: churnData,
12301
+ color: "var(--color-destructive)",
12302
+ ariaLabel: "Monthly churn rate trend",
12303
+ },
12304
+ ].map((stat) => (
12305
+ <div key={stat.label} className="flex flex-col gap-2">
12306
+ <p className="text-xs font-medium text-muted-foreground">{stat.label}</p>
12307
+ <p className="text-lg font-semibold tabular-nums text-foreground">{stat.value}</p>
12308
+ <Sparkline
12309
+ data={stat.data}
12310
+ withDot
12311
+ height={36}
12312
+ color={stat.color}
12313
+ className="w-full"
12314
+ aria-label={stat.ariaLabel}
12315
+ />
12316
+ </div>
12317
+ ))}
12318
+ </div>
12319
+ </CardContent>
12320
+ </Card>
12321
+ </div>
12322
+ </div>
12323
+ );
12324
+ }
@@ -175,21 +175,24 @@ export default function HealthPage() {
175
175
  <h2 className="text-lg font-semibold">Open drift ({drift.length})</h2>
176
176
  {drift.length === 0 ? (
177
177
  <p className="text-sm text-muted-foreground">
178
- Drift ledger is clear. Rows land here from the token-intent lint and month-over-month score drops.
178
+ Drift ledger is clear. Rows land here from the token-intent lint, month-over-month score drops, and
179
+ eval agreement runs that split on a rule.
179
180
  </p>
180
181
  ) : (
181
182
  <Card>
182
183
  <CardContent className="divide-y divide-border p-0">
183
184
  {drift.map((d, i) => (
184
- <div key={i} className="flex items-start gap-3 p-4">
185
- <Badge variant={d.severity === "high" ? "destructive" : "secondary"}>{d.source}</Badge>
186
- <div className="min-w-0">
185
+ <div key={i} className="flex flex-col gap-2 p-4 sm:flex-row sm:items-start sm:gap-3">
186
+ <Badge className="self-start" variant={d.severity === "high" ? "destructive" : "secondary"}>
187
+ {d.source}
188
+ </Badge>
189
+ <div className="min-w-0 sm:flex-1">
187
190
  <p className="truncate text-sm font-medium" title={d.target}>
188
191
  {d.target}
189
192
  </p>
190
193
  <p className="text-sm text-muted-foreground">{d.signal}</p>
191
194
  </div>
192
- <span className="ml-auto shrink-0 text-sm text-muted-foreground">{d.date}</span>
195
+ <span className="shrink-0 text-sm text-muted-foreground sm:ml-auto">{d.date}</span>
193
196
  </div>
194
197
  ))}
195
198
  </CardContent>
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import dynamic from "next/dynamic";
4
+
5
+ const HistoryTimeline = dynamic(() => import("@/components/examples/history/history-timeline"), {
6
+ ssr: false,
7
+ });
8
+
9
+ export default function HistoryPreview() {
10
+ return <HistoryTimeline />;
11
+ }