@behavioral-agentic-design-system/core 0.38.0 → 0.39.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 (172) hide show
  1. package/package.json +2 -2
  2. package/src/app/preview/components/page.tsx +362 -0
  3. package/src/components/Foundations/Typography.stories.tsx +82 -21
  4. package/src/components/ui/accordion.tsx +67 -5
  5. package/src/components/ui/alert.tsx +20 -7
  6. package/src/components/ui/avatar.tsx +18 -4
  7. package/src/components/ui/breadcrumb.tsx +47 -0
  8. package/src/components/ui/checkbox-card.tsx +48 -8
  9. package/src/components/ui/checkbox.tsx +17 -8
  10. package/src/components/ui/format-date.tsx +107 -0
  11. package/src/components/ui/progress.tsx +6 -5
  12. package/src/components/ui/sparkline.tsx +198 -0
  13. package/src/components/ui/tag.tsx +17 -1
  14. package/src/components/ui/tags-input.tsx +84 -11
  15. package/src/components/ui/toggle-group.tsx +13 -0
  16. package/src/components/ui/week-picker.tsx +463 -0
  17. package/src/data/docs-index.ts +7 -0
  18. package/src/stories/Accordion.stories.tsx +59 -1
  19. package/src/stories/ActionBar.stories.tsx +1 -1
  20. package/src/stories/Affix.stories.tsx +1 -1
  21. package/src/stories/AiBadge.stories.tsx +1 -1
  22. package/src/stories/Alert.stories.tsx +36 -1
  23. package/src/stories/AlertDialog.stories.tsx +1 -1
  24. package/src/stories/Anchor.stories.tsx +1 -1
  25. package/src/stories/AngleSlider.stories.tsx +1 -1
  26. package/src/stories/AspectRatio.stories.tsx +1 -1
  27. package/src/stories/Autocomplete.stories.tsx +1 -1
  28. package/src/stories/Avatar.stories.tsx +41 -1
  29. package/src/stories/Badge.stories.tsx +1 -1
  30. package/src/stories/Blockquote.stories.tsx +1 -1
  31. package/src/stories/BottomNavigation.stories.tsx +1 -1
  32. package/src/stories/Breadcrumb.stories.tsx +38 -5
  33. package/src/stories/Burger.stories.tsx +1 -1
  34. package/src/stories/Button.stories.tsx +9 -1
  35. package/src/stories/ButtonGroup.stories.tsx +1 -1
  36. package/src/stories/Calendar.stories.tsx +1 -1
  37. package/src/stories/Card.stories.tsx +1 -1
  38. package/src/stories/Carousel.stories.tsx +1 -1
  39. package/src/stories/Cascader.stories.tsx +1 -1
  40. package/src/stories/Chart.stories.tsx +1 -1
  41. package/src/stories/ChatBubble.stories.tsx +1 -1
  42. package/src/stories/ChatMarker.stories.tsx +1 -1
  43. package/src/stories/Checkbox.stories.tsx +36 -5
  44. package/src/stories/CheckboxCard.stories.tsx +37 -2
  45. package/src/stories/CheckboxGroup.stories.tsx +1 -1
  46. package/src/stories/Chip.stories.tsx +1 -1
  47. package/src/stories/CircularProgress.stories.tsx +17 -1
  48. package/src/stories/Clipboard.stories.tsx +1 -1
  49. package/src/stories/CloseButton.stories.tsx +1 -1
  50. package/src/stories/Code.stories.tsx +1 -1
  51. package/src/stories/Collapsible.stories.tsx +1 -1
  52. package/src/stories/ColorPicker.stories.tsx +1 -1
  53. package/src/stories/ColorSwatch.stories.tsx +1 -1
  54. package/src/stories/Combobox.stories.tsx +1 -1
  55. package/src/stories/Command.stories.tsx +1 -1
  56. package/src/stories/Container.stories.tsx +1 -1
  57. package/src/stories/ContextMenu.stories.tsx +1 -1
  58. package/src/stories/CopyButton.stories.tsx +9 -1
  59. package/src/stories/DataList.stories.tsx +1 -1
  60. package/src/stories/DataTable.stories.tsx +1 -1
  61. package/src/stories/DateField.stories.tsx +1 -1
  62. package/src/stories/DatePicker.stories.tsx +1 -1
  63. package/src/stories/DateRangePicker.stories.tsx +1 -1
  64. package/src/stories/Dialog.stories.tsx +1 -1
  65. package/src/stories/Drawer.stories.tsx +1 -1
  66. package/src/stories/DropdownMenu.stories.tsx +1 -1
  67. package/src/stories/Editable.stories.tsx +1 -1
  68. package/src/stories/EmptyState.stories.tsx +1 -1
  69. package/src/stories/Field.stories.tsx +1 -1
  70. package/src/stories/Fieldset.stories.tsx +1 -1
  71. package/src/stories/FileButton.stories.tsx +1 -1
  72. package/src/stories/FileUpload.stories.tsx +1 -1
  73. package/src/stories/FloatLabel.stories.tsx +1 -1
  74. package/src/stories/FloatingActionButton.stories.tsx +1 -1
  75. package/src/stories/FloatingIndicator.stories.tsx +1 -1
  76. package/src/stories/FloatingPanel.stories.tsx +9 -1
  77. package/src/stories/FocusTrap.stories.tsx +1 -1
  78. package/src/stories/FormatByte.stories.tsx +1 -1
  79. package/src/stories/FormatDate.stories.tsx +174 -0
  80. package/src/stories/FormatNumber.stories.tsx +1 -1
  81. package/src/stories/Highlight.stories.tsx +1 -1
  82. package/src/stories/HoverCard.stories.tsx +1 -1
  83. package/src/stories/Image.stories.tsx +1 -1
  84. package/src/stories/Indicator.stories.tsx +17 -1
  85. package/src/stories/Input.stories.tsx +1 -1
  86. package/src/stories/InputClearButton.stories.tsx +1 -1
  87. package/src/stories/InputGroup.stories.tsx +1 -1
  88. package/src/stories/Kbd.stories.tsx +1 -1
  89. package/src/stories/KeyboardShortcut.stories.tsx +1 -1
  90. package/src/stories/Label.stories.tsx +1 -1
  91. package/src/stories/Link.stories.tsx +1 -1
  92. package/src/stories/List.stories.tsx +1 -1
  93. package/src/stories/Listbox.stories.tsx +1 -1
  94. package/src/stories/LoadingDots.stories.tsx +1 -1
  95. package/src/stories/LoadingOverlay.stories.tsx +1 -1
  96. package/src/stories/Mark.stories.tsx +1 -1
  97. package/src/stories/Marquee.stories.tsx +1 -1
  98. package/src/stories/Masonry.stories.tsx +1 -1
  99. package/src/stories/Menubar.stories.tsx +1 -1
  100. package/src/stories/Meter.stories.tsx +1 -1
  101. package/src/stories/MonthPicker.stories.tsx +1 -1
  102. package/src/stories/MotionToggle.stories.tsx +1 -1
  103. package/src/stories/MultiSelect.stories.tsx +1 -1
  104. package/src/stories/NativeSelect.stories.tsx +1 -1
  105. package/src/stories/NavLink.stories.tsx +1 -1
  106. package/src/stories/NavigationMenu.stories.tsx +1 -1
  107. package/src/stories/NavigationRail.stories.tsx +9 -1
  108. package/src/stories/Notification.stories.tsx +1 -1
  109. package/src/stories/NumberInput.stories.tsx +1 -1
  110. package/src/stories/Overlay.stories.tsx +1 -1
  111. package/src/stories/Pagination.stories.tsx +1 -1
  112. package/src/stories/PasswordInput.stories.tsx +1 -1
  113. package/src/stories/PinInput.stories.tsx +1 -1
  114. package/src/stories/Popover.stories.tsx +1 -1
  115. package/src/stories/Progress.stories.tsx +11 -1
  116. package/src/stories/Prose.stories.tsx +1 -1
  117. package/src/stories/QrCode.stories.tsx +1 -1
  118. package/src/stories/Questionnaire.stories.tsx +1 -1
  119. package/src/stories/RadioGroup.stories.tsx +1 -1
  120. package/src/stories/RatingGroup.stories.tsx +1 -1
  121. package/src/stories/Resizable.stories.tsx +1 -1
  122. package/src/stories/Result.stories.tsx +1 -1
  123. package/src/stories/Reveal.stories.tsx +1 -1
  124. package/src/stories/RollingNumber.stories.tsx +1 -1
  125. package/src/stories/ScrollArea.stories.tsx +1 -1
  126. package/src/stories/SearchInput.stories.tsx +1 -1
  127. package/src/stories/SegmentedControl.stories.tsx +1 -1
  128. package/src/stories/Select.stories.tsx +1 -1
  129. package/src/stories/Separator.stories.tsx +1 -1
  130. package/src/stories/Sheet.stories.tsx +1 -1
  131. package/src/stories/Sidebar.stories.tsx +1 -1
  132. package/src/stories/SignaturePad.stories.tsx +1 -1
  133. package/src/stories/SimpleGrid.stories.tsx +1 -1
  134. package/src/stories/Skeleton.stories.tsx +1 -1
  135. package/src/stories/SkeletonTable.stories.tsx +1 -1
  136. package/src/stories/SkipLink.stories.tsx +1 -1
  137. package/src/stories/Slider.stories.tsx +1 -1
  138. package/src/stories/Sonner.stories.tsx +1 -1
  139. package/src/stories/Sparkline.stories.tsx +208 -0
  140. package/src/stories/Spinner.stories.tsx +9 -1
  141. package/src/stories/Spoiler.stories.tsx +1 -1
  142. package/src/stories/Squircle.stories.tsx +1 -1
  143. package/src/stories/Stack.stories.tsx +1 -1
  144. package/src/stories/StatusBadge.stories.tsx +1 -1
  145. package/src/stories/Stepper.stories.tsx +1 -1
  146. package/src/stories/Switch.stories.tsx +1 -1
  147. package/src/stories/Table.stories.tsx +1 -1
  148. package/src/stories/Tabs.stories.tsx +1 -1
  149. package/src/stories/Tag.stories.tsx +23 -1
  150. package/src/stories/TagsInput.stories.tsx +46 -1
  151. package/src/stories/Text.stories.tsx +1 -1
  152. package/src/stories/Textarea.stories.tsx +1 -1
  153. package/src/stories/ThemeIcon.stories.tsx +1 -1
  154. package/src/stories/TimePicker.stories.tsx +1 -1
  155. package/src/stories/Timeline.stories.tsx +9 -1
  156. package/src/stories/Timer.stories.tsx +1 -1
  157. package/src/stories/Toggle.stories.tsx +1 -1
  158. package/src/stories/ToggleGroup.stories.tsx +21 -1
  159. package/src/stories/ToggleTip.stories.tsx +1 -1
  160. package/src/stories/Toolbar.stories.tsx +1 -1
  161. package/src/stories/Tooltip.stories.tsx +1 -1
  162. package/src/stories/Tour.stories.tsx +1 -1
  163. package/src/stories/TransferList.stories.tsx +1 -1
  164. package/src/stories/TreeSelect.stories.tsx +1 -1
  165. package/src/stories/TreeView.stories.tsx +1 -1
  166. package/src/stories/TypingIndicator.stories.tsx +1 -1
  167. package/src/stories/VisuallyHidden.stories.tsx +1 -1
  168. package/src/stories/Watermark.stories.tsx +1 -1
  169. package/src/stories/WeekPicker.stories.tsx +90 -0
  170. package/src/stories/WordRotate.stories.tsx +1 -1
  171. package/src/stories/YearPicker.stories.tsx +1 -1
  172. package/src/stories/story-groups.json +199 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behavioral-agentic-design-system/core",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
5
5
  "license": "MIT",
6
6
  "author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
@@ -261,6 +261,6 @@
261
261
  }
262
262
  },
263
263
  "devDependencies": {
264
- "@types/react-dom": "^19.2.5"
264
+ "@types/react-dom": "^19.2.7"
265
265
  }
266
266
  }
@@ -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>
@@ -6238,6 +6268,15 @@ export default function ComponentsPreview() {
6238
6268
  <Section title="SearchInput">
6239
6269
  <SearchInputShowcase />
6240
6270
  </Section>
6271
+ <Section title="FormatDate">
6272
+ <FormatDateShowcase />
6273
+ </Section>
6274
+ <Section title="WeekPicker">
6275
+ <WeekPickerShowcase />
6276
+ </Section>
6277
+ <Section title="Sparkline">
6278
+ <SparklineShowcase />
6279
+ </Section>
6241
6280
  </div>
6242
6281
  </div>
6243
6282
  );
@@ -8524,6 +8563,32 @@ function CheckboxCardShowcase() {
8524
8563
  </CheckboxCard>
8525
8564
  </div>
8526
8565
  </div>
8566
+ <div>
8567
+ <p className="mb-3 text-sm font-medium text-muted-foreground">
8568
+ Sizes — sm / default / lg set padding, gap, and the inherited base
8569
+ font size (children without a text-* class pick it up)
8570
+ </p>
8571
+ <div className="grid items-start gap-3 sm:grid-cols-3">
8572
+ <CheckboxCard size="sm">
8573
+ <span className="font-medium text-foreground">sm</span>
8574
+ <span className="text-muted-foreground">
8575
+ p-3, text-sm — dense option lists.
8576
+ </span>
8577
+ </CheckboxCard>
8578
+ <CheckboxCard size="default">
8579
+ <span className="font-medium text-foreground">default</span>
8580
+ <span className="text-muted-foreground">
8581
+ p-4, text-sm — unchanged.
8582
+ </span>
8583
+ </CheckboxCard>
8584
+ <CheckboxCard size="lg">
8585
+ <span className="font-medium text-foreground">lg</span>
8586
+ <span className="text-muted-foreground">
8587
+ p-5, text-base — hero pickers.
8588
+ </span>
8589
+ </CheckboxCard>
8590
+ </div>
8591
+ </div>
8527
8592
  <div>
8528
8593
  <p className="mb-3 text-sm font-medium text-muted-foreground">
8529
8594
  Multi-select — enforcement passes for a client fork ({selected.length}{" "}
@@ -11510,6 +11575,14 @@ function TagShowcase() {
11510
11575
  <Tag size="md" variant="success" label="a11y contract" onClose={() => {}} />
11511
11576
  <Tag size="lg" label="design tokens" onClose={() => {}} />
11512
11577
  </div>
11578
+ <p className="text-xs font-medium text-muted-foreground">With icon (leading icon slot)</p>
11579
+ <div className="flex items-center gap-2 flex-wrap">
11580
+ <Tag variant="success" label="Verified" icon={<CheckIcon strokeWidth={1.5} />} />
11581
+ <Tag variant="warning" label="Needs review" icon={<TriangleAlertIcon strokeWidth={1.5} />} />
11582
+ <Tag variant="info" label="Tip" icon={<Info strokeWidth={1.5} />} />
11583
+ <Tag variant="default" size="sm" label="new" icon={<ZapIcon strokeWidth={1.5} />} />
11584
+ <Tag variant="success" size="sm" label="shipped" icon={<CheckIcon strokeWidth={1.5} />} onClose={() => {}} />
11585
+ </div>
11513
11586
  </div>
11514
11587
  </div>
11515
11588
  );
@@ -11956,3 +12029,292 @@ function SearchInputShowcase() {
11956
12029
  </div>
11957
12030
  );
11958
12031
  }
12032
+
12033
+ function FormatDateShowcase() {
12034
+ const kickoff = new Date(2026, 0, 15);
12035
+ const reportDate = new Date(2026, 8, 9);
12036
+ return (
12037
+ <div className="space-y-8">
12038
+ <p className="text-sm text-muted-foreground">
12039
+ Locale-aware date display primitive — wraps{" "}
12040
+ <code className="text-xs">Intl.DateTimeFormat</code> and renders a{" "}
12041
+ <code className="text-xs">{"<span data-slot=\"format-date\">"}</code>.
12042
+ SSR-safe: explicit locale constant, never{" "}
12043
+ <code className="text-xs">navigator.language</code>. Pairs with
12044
+ FormatNumber and FormatByte.
12045
+ </p>
12046
+
12047
+ <div>
12048
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12049
+ dateStyle variants
12050
+ </p>
12051
+ <div className="space-y-1 text-sm text-foreground">
12052
+ <p>
12053
+ full: <FormatDate value={kickoff} dateStyle="full" className="font-medium" />
12054
+ </p>
12055
+ <p>
12056
+ long: <FormatDate value={kickoff} dateStyle="long" className="font-medium" />
12057
+ </p>
12058
+ <p>
12059
+ medium (default):{" "}
12060
+ <FormatDate value={kickoff} className="font-medium" />
12061
+ </p>
12062
+ <p>
12063
+ short: <FormatDate value={kickoff} dateStyle="short" className="font-medium" />
12064
+ </p>
12065
+ </div>
12066
+ </div>
12067
+
12068
+ <div>
12069
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12070
+ With time (dateStyle + timeStyle)
12071
+ </p>
12072
+ <p className="text-sm text-foreground">
12073
+ <FormatDate
12074
+ value={new Date(2026, 8, 9, 14, 30, 0)}
12075
+ dateStyle="long"
12076
+ timeStyle="short"
12077
+ className="font-medium"
12078
+ />
12079
+ </p>
12080
+ </div>
12081
+
12082
+ <div>
12083
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12084
+ Graceful empty — undefined/null value renders empty span
12085
+ </p>
12086
+ <p className="text-sm text-muted-foreground italic">
12087
+ <FormatDate value={undefined} />
12088
+ (nothing rendered above)
12089
+ </p>
12090
+ </div>
12091
+
12092
+ <div>
12093
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12094
+ Realistic use — publication byline
12095
+ </p>
12096
+ <Card className="w-96">
12097
+ <CardHeader>
12098
+ <CardTitle>ROI report</CardTitle>
12099
+ <CardDescription>
12100
+ Austin design systems team — quarterly summary
12101
+ </CardDescription>
12102
+ </CardHeader>
12103
+ <CardContent>
12104
+ <p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
12105
+ Published{" "}
12106
+ <FormatDate value={reportDate} dateStyle="long" className="normal-case" />
12107
+ </p>
12108
+ <p className="mt-2 text-sm text-foreground">
12109
+ The engagement ran from{" "}
12110
+ <FormatDate value={kickoff} dateStyle="long" className="font-medium" />{" "}
12111
+ through{" "}
12112
+ <FormatDate value={new Date(2026, 5, 30)} dateStyle="long" className="font-medium" />,
12113
+ delivering 88 components and $182,450 in documented client savings.
12114
+ </p>
12115
+ </CardContent>
12116
+ </Card>
12117
+ </div>
12118
+ </div>
12119
+ );
12120
+ }
12121
+
12122
+ function WeekPickerShowcase() {
12123
+ const [selectedWeek, setSelectedWeek] = React.useState<Date | undefined>(undefined);
12124
+ const [sprintWeek, setSprintWeek] = React.useState<Date>(new Date(2026, 8, 7));
12125
+
12126
+ return (
12127
+ <div className="space-y-8">
12128
+ <p className="text-sm text-muted-foreground">
12129
+ ISO 8601 week picker — a calendar-month grid where clicking a week row
12130
+ selects that ISO week and fires <code className="text-xs">onValueChange</code>{" "}
12131
+ with the week&apos;s Monday. Trigger shows &quot;Week N, YYYY&quot; format.
12132
+ Keyboard: ArrowUp/Down navigate weeks, PageUp/Down change months,
12133
+ Shift+PageUp/Down change years.
12134
+ </p>
12135
+
12136
+ <div>
12137
+ <p className="mb-3 text-xs font-medium text-muted-foreground">Default</p>
12138
+ <WeekPicker className="rounded-md border" />
12139
+ </div>
12140
+
12141
+ <div>
12142
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12143
+ With value (controlled)
12144
+ </p>
12145
+ <WeekPicker
12146
+ value={sprintWeek}
12147
+ onValueChange={setSprintWeek}
12148
+ className="rounded-md border"
12149
+ />
12150
+ {sprintWeek && (
12151
+ <p className="mt-2 text-xs text-muted-foreground">
12152
+ Selected: {sprintWeek.toLocaleDateString("en-US", { dateStyle: "medium" })}
12153
+ </p>
12154
+ )}
12155
+ </div>
12156
+
12157
+ <div>
12158
+ <p className="mb-3 text-xs font-medium text-muted-foreground">Disabled</p>
12159
+ <WeekPicker
12160
+ disabled
12161
+ defaultValue={new Date(2026, 8, 7)}
12162
+ className="rounded-md border"
12163
+ />
12164
+ </div>
12165
+
12166
+ <div>
12167
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12168
+ Realistic use — sprint planning
12169
+ </p>
12170
+ <Card className="w-fit">
12171
+ <CardHeader>
12172
+ <CardTitle>Sprint planning</CardTitle>
12173
+ <CardDescription>
12174
+ Jordan Reeves · BADS engagement · Select sprint week
12175
+ </CardDescription>
12176
+ </CardHeader>
12177
+ <CardContent className="space-y-3">
12178
+ <label className="text-sm font-medium text-foreground" htmlFor="sprint-week-showcase">
12179
+ Sprint week
12180
+ </label>
12181
+ <WeekPicker
12182
+ id="sprint-week-showcase"
12183
+ value={selectedWeek}
12184
+ onValueChange={setSelectedWeek}
12185
+ placeholder="Select sprint week"
12186
+ className="rounded-md border"
12187
+ />
12188
+ {selectedWeek && (
12189
+ <p className="text-sm text-muted-foreground">
12190
+ Sprint starts{" "}
12191
+ <span className="font-medium text-foreground">
12192
+ {selectedWeek.toLocaleDateString("en-US", { month: "short", day: "numeric" })}
12193
+ </span>
12194
+ </p>
12195
+ )}
12196
+ </CardContent>
12197
+ </Card>
12198
+ </div>
12199
+ </div>
12200
+ );
12201
+ }
12202
+
12203
+ function SparklineShowcase() {
12204
+ const revenueData = [24000, 27500, 25800, 31200, 29400, 34100, 32600, 36200];
12205
+ const userData = [82, 95, 104, 98, 117, 131, 128, 142];
12206
+ const churnData = [8.2, 7.9, 8.5, 7.4, 7.1, 6.8, 6.3, 6.0];
12207
+ const negativeData = [-12, 4, -8, 15, -3, 22, 8, -5];
12208
+
12209
+ return (
12210
+ <div className="space-y-8">
12211
+ <p className="text-sm text-muted-foreground">
12212
+ Compact inline sparkline for trend visualization — no axes, labels, or
12213
+ tooltip. Uses Recharts 3.x with the same ResizeObserver mount-gate as
12214
+ ChartContainer. Root is{" "}
12215
+ <code className="text-xs">{"<span data-slot=\"sparkline\">"}</code> — inline-safe.
12216
+ Always supply <code className="text-xs">aria-label</code>.
12217
+ </p>
12218
+
12219
+ <div>
12220
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12221
+ Type variants
12222
+ </p>
12223
+ <div className="flex flex-col gap-3">
12224
+ <div>
12225
+ <p className="mb-1 text-xs text-muted-foreground">Area (default)</p>
12226
+ <Sparkline
12227
+ data={revenueData}
12228
+ className="w-40"
12229
+ aria-label="Monthly revenue area trend"
12230
+ />
12231
+ </div>
12232
+ <div>
12233
+ <p className="mb-1 text-xs text-muted-foreground">Line</p>
12234
+ <Sparkline
12235
+ data={revenueData}
12236
+ type="line"
12237
+ className="w-40"
12238
+ aria-label="Monthly revenue line trend"
12239
+ />
12240
+ </div>
12241
+ </div>
12242
+ </div>
12243
+
12244
+ <div>
12245
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12246
+ withDot — marks last data point
12247
+ </p>
12248
+ <Sparkline
12249
+ data={revenueData}
12250
+ withDot
12251
+ className="w-40"
12252
+ aria-label="Monthly revenue trend with current-value dot"
12253
+ />
12254
+ </div>
12255
+
12256
+ <div>
12257
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12258
+ Negative / mixed data
12259
+ </p>
12260
+ <div className="flex gap-4">
12261
+ <Sparkline
12262
+ data={negativeData}
12263
+ type="area"
12264
+ className="w-32"
12265
+ aria-label="Mixed positive and negative trend"
12266
+ />
12267
+ <Sparkline
12268
+ data={negativeData}
12269
+ type="line"
12270
+ color="var(--color-destructive)"
12271
+ className="w-32"
12272
+ aria-label="Negative trend in destructive color"
12273
+ />
12274
+ </div>
12275
+ </div>
12276
+
12277
+ <div>
12278
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
12279
+ Realistic use — stat row with 3 sparklines
12280
+ </p>
12281
+ <Card className="w-[480px]">
12282
+ <CardHeader>
12283
+ <CardTitle>Engagement health</CardTitle>
12284
+ <CardDescription>
12285
+ BADS — Austin design systems team, last 8 months
12286
+ </CardDescription>
12287
+ </CardHeader>
12288
+ <CardContent>
12289
+ <div className="grid grid-cols-3 gap-4">
12290
+ {[
12291
+ { label: "Revenue", value: "$36.2K", data: revenueData, ariaLabel: "Monthly revenue trend" },
12292
+ { label: "Active users", value: "142", data: userData, ariaLabel: "Monthly active users trend" },
12293
+ {
12294
+ label: "Churn rate",
12295
+ value: "6.0%",
12296
+ data: churnData,
12297
+ color: "var(--color-destructive)",
12298
+ ariaLabel: "Monthly churn rate trend",
12299
+ },
12300
+ ].map((stat) => (
12301
+ <div key={stat.label} className="flex flex-col gap-2">
12302
+ <p className="text-xs font-medium text-muted-foreground">{stat.label}</p>
12303
+ <p className="text-lg font-semibold tabular-nums text-foreground">{stat.value}</p>
12304
+ <Sparkline
12305
+ data={stat.data}
12306
+ withDot
12307
+ height={36}
12308
+ color={stat.color}
12309
+ className="w-full"
12310
+ aria-label={stat.ariaLabel}
12311
+ />
12312
+ </div>
12313
+ ))}
12314
+ </div>
12315
+ </CardContent>
12316
+ </Card>
12317
+ </div>
12318
+ </div>
12319
+ );
12320
+ }
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import type { Meta, StoryObj } from "@storybook/react";
2
3
 
3
4
  const meta: Meta = {
@@ -7,6 +8,77 @@ const meta: Meta = {
7
8
  export default meta;
8
9
  type Story = StoryObj<typeof meta>;
9
10
 
11
+ /**
12
+ * A font family specimen that also says which font it IS.
13
+ *
14
+ * It used to print the token name and a line of "the quick brown fox", so you
15
+ * could see the shape of the type and had no way to learn its name.
16
+ *
17
+ * The obvious fix — writing "Hyperlegible Sans" beside --font-sans — would be
18
+ * wrong in every fork. Furnished Finder's --font-sans is Inter, so a hardcoded
19
+ * label would name Hyperlegible while Inter rendered on the screen beneath it.
20
+ * A specimen that lies about the specimen is worse than one that says nothing.
21
+ *
22
+ * So it reads the resolved value at runtime. The first family in the stack is
23
+ * the one being asked for and gets the emphasis; the rest are fallbacks, shown
24
+ * quietly, because which one you land on is exactly what matters when the first
25
+ * is missing.
26
+ */
27
+ function FamilySpecimen({
28
+ token,
29
+ sample,
30
+ body,
31
+ }: {
32
+ token: string;
33
+ sample: string;
34
+ body?: string;
35
+ }) {
36
+ const [stack, setStack] = React.useState<string[]>([]);
37
+
38
+ React.useEffect(() => {
39
+ // After mount, deliberately. Before the stylesheet applies, getComputedStyle
40
+ // returns an empty string, and a hardcoded fallback here would be another
41
+ // label that disagrees with the type under it.
42
+ const raw = getComputedStyle(document.documentElement).getPropertyValue(token).trim();
43
+ setStack(
44
+ raw
45
+ .split(",")
46
+ .map((f) => f.trim().replace(/^['"]|['"]$/g, ""))
47
+ .filter(Boolean),
48
+ );
49
+ }, [token]);
50
+
51
+ const [first, ...fallbacks] = stack;
52
+
53
+ return (
54
+ <div>
55
+ <div className="flex flex-wrap items-baseline gap-x-3 gap-y-1">
56
+ <code className="font-mono text-xs text-muted-foreground">{token}</code>
57
+ {first ? (
58
+ <span className="text-sm font-medium text-foreground">{first}</span>
59
+ ) : (
60
+ <span className="text-sm text-muted-foreground">
61
+ not resolved &mdash; is this token defined?
62
+ </span>
63
+ )}
64
+ </div>
65
+ {fallbacks.length > 0 && (
66
+ <p className="mt-1 font-mono text-xs text-muted-foreground">
67
+ falls back to {fallbacks.join(", ")}
68
+ </p>
69
+ )}
70
+ <p className="text-3xl mt-2" style={{ fontFamily: `var(${token})` }}>
71
+ {sample}
72
+ </p>
73
+ {body && (
74
+ <p className="text-base mt-2" style={{ fontFamily: `var(${token})` }}>
75
+ {body}
76
+ </p>
77
+ )}
78
+ </div>
79
+ );
80
+ }
81
+
10
82
  const SCALE = [
11
83
  { name: "text-xs", className: "text-xs", note: "Captions, fine print (14px floor)" },
12
84
  { name: "text-sm", className: "text-sm", note: "Helper text, labels (16px)" },
@@ -41,27 +113,16 @@ export const Families: Story = {
41
113
  <div className="p-8 space-y-8 bg-background text-foreground">
42
114
  <h3 className="text-sm font-semibold text-muted-foreground">Font families</h3>
43
115
  <div className="space-y-6">
44
- <div>
45
- <code className="font-mono text-xs text-muted-foreground">--font-sans</code>
46
- <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-sans)" }}>
47
- The quick brown fox jumps over the lazy dog
48
- </p>
49
- <p className="text-base mt-2" style={{ fontFamily: "var(--font-sans)" }}>
50
- Body weight. Aa Bb Cc 0123456789
51
- </p>
52
- </div>
53
- <div>
54
- <code className="font-mono text-xs text-muted-foreground">--font-serif</code>
55
- <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-serif)" }}>
56
- The quick brown fox jumps over the lazy dog
57
- </p>
58
- </div>
59
- <div>
60
- <code className="font-mono text-xs text-muted-foreground">--font-mono</code>
61
- <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-mono)" }}>
62
- The quick brown fox 0123456789
63
- </p>
64
- </div>
116
+ <FamilySpecimen
117
+ token="--font-sans"
118
+ sample="The quick brown fox jumps over the lazy dog"
119
+ body="Body weight. Aa Bb Cc 0123456789"
120
+ />
121
+ <FamilySpecimen
122
+ token="--font-serif"
123
+ sample="The quick brown fox jumps over the lazy dog"
124
+ />
125
+ <FamilySpecimen token="--font-mono" sample="The quick brown fox 0123456789" />
65
126
  </div>
66
127
  </div>
67
128
  ),
@@ -1,24 +1,78 @@
1
1
  "use client";
2
2
 
3
+ import * as React from "react";
3
4
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
4
5
  import { ChevronDownIcon } from "lucide-react";
5
6
 
6
7
  import { cn } from "@behavioral-agentic-design-system/core/lib/utils";
7
8
 
9
+ // Context propagates the visual variant from Accordion root to AccordionItem
10
+ // and AccordionTrigger / AccordionContent without prop-drilling.
11
+ type AccordionVariant = "default" | "contained" | "separated";
12
+
13
+ const AccordionContext = React.createContext<{ variant: AccordionVariant }>({
14
+ variant: "default",
15
+ });
16
+
17
+ type AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root> & {
18
+ /**
19
+ * Visual container style (peer parity: Mantine contained/separated/filled,
20
+ * Chakra enclosed/flush/elevated, Ant Design bordered/ghost).
21
+ *
22
+ * default — border-b separator between items, no card wrapper (current
23
+ * behavior; unchanged rendering).
24
+ * contained — items sit inside a shared rounded-lg card with divide-y
25
+ * separator lines. Use for settings panels, entity detail
26
+ * drawers, or anywhere an accordion lives on a non-card surface
27
+ * and needs clear visual containment.
28
+ * separated — each item is its own rounded-lg card. Use for content-heavy
29
+ * FAQs and panels where each item should read as independent.
30
+ */
31
+ variant?: AccordionVariant;
32
+ };
33
+
8
34
  function Accordion({
35
+ variant = "default",
36
+ className,
9
37
  ...props
10
- }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
11
- return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
38
+ }: AccordionProps) {
39
+ return (
40
+ <AccordionContext.Provider value={{ variant }}>
41
+ <AccordionPrimitive.Root
42
+ data-slot="accordion"
43
+ data-variant={variant}
44
+ className={cn(
45
+ // contained: shared card — divide-y handles item separators so
46
+ // AccordionItem needs no border of its own.
47
+ variant === "contained" &&
48
+ "overflow-hidden rounded-lg border bg-card divide-y divide-border",
49
+ // separated: flex column with a gap so each card floats independently.
50
+ variant === "separated" && "flex flex-col gap-2",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ </AccordionContext.Provider>
56
+ );
12
57
  }
13
58
 
14
59
  function AccordionItem({
15
60
  className,
16
61
  ...props
17
62
  }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
63
+ const { variant } = React.useContext(AccordionContext);
18
64
  return (
19
65
  <AccordionPrimitive.Item
20
66
  data-slot="accordion-item"
21
- className={cn("border-b last:border-b-0", className)}
67
+ className={cn(
68
+ // default: bottom border on every item except the last.
69
+ variant === "default" && "border-b last:border-b-0",
70
+ // contained: borders come from divide-y on the root; items need nothing.
71
+ variant === "contained" && "",
72
+ // separated: each item is its own rounded card.
73
+ variant === "separated" && "overflow-hidden rounded-lg border bg-card",
74
+ className
75
+ )}
22
76
  {...props}
23
77
  />
24
78
  );
@@ -29,6 +83,8 @@ function AccordionTrigger({
29
83
  children,
30
84
  ...props
31
85
  }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
86
+ const { variant } = React.useContext(AccordionContext);
87
+ const isInset = variant === "contained" || variant === "separated";
32
88
  return (
33
89
  <AccordionPrimitive.Header className="flex">
34
90
  <AccordionPrimitive.Trigger
@@ -37,7 +93,10 @@ function AccordionTrigger({
37
93
  // Layout + interactivity (tokens via Tailwind utilities work for
38
94
  // color/spacing/radius — the v4 namespaces for --color-* and friends
39
95
  // are wired correctly).
40
- "group/accordion-trigger flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium rounded-sm",
96
+ "group/accordion-trigger flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium",
97
+ // contained/separated: triggers are inset — add px-4 and remove
98
+ // rounded-sm so the hover bg fills flush with the card edge.
99
+ isInset ? "rounded-none px-4" : "rounded-sm",
41
100
  // The transition PROPERTY is Tailwind-driven (transition-colors is
42
101
  // a stock utility that maps to transition-property: color, ...).
43
102
  "transition-colors",
@@ -97,6 +156,8 @@ function AccordionContent({
97
156
  children,
98
157
  ...props
99
158
  }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
159
+ const { variant } = React.useContext(AccordionContext);
160
+ const isInset = variant === "contained" || variant === "separated";
100
161
  return (
101
162
  <AccordionPrimitive.Content
102
163
  data-slot="accordion-content"
@@ -109,9 +170,10 @@ function AccordionContent({
109
170
  // var(--duration-base) + var(--ease-out) motion tokens.
110
171
  {...props}
111
172
  >
112
- <div className="pb-4 pt-0">{children}</div>
173
+ <div className={cn("pb-4 pt-0", isInset && "px-4")}>{children}</div>
113
174
  </AccordionPrimitive.Content>
114
175
  );
115
176
  }
116
177
 
117
178
  export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
179
+ export type { AccordionVariant };