@behavioral-agentic-design-system/core 0.42.0 → 0.47.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 (314) hide show
  1. package/package.json +38 -8
  2. package/scripts/a11y-lint.cjs +101 -14
  3. package/scripts/bads-sync.mjs +1 -1
  4. package/scripts/build-tokens.cjs +122 -7
  5. package/scripts/check-dark-contrast.mjs +204 -0
  6. package/scripts/check-flush-edges.mjs +245 -0
  7. package/scripts/check-spec.mjs +73 -0
  8. package/scripts/deal-directions.mjs +186 -0
  9. package/scripts/design-system-advisory/README.md +239 -0
  10. package/scripts/design-system-advisory/check-copy-punctuation.mjs +44 -0
  11. package/scripts/design-system-advisory/check-even-padding.mjs +35 -0
  12. package/scripts/design-system-advisory/check-hand-built-button.mjs +46 -0
  13. package/scripts/design-system-advisory/check-html-nesting.mjs +51 -0
  14. package/scripts/design-system-advisory/check-icon-sizing.mjs +79 -0
  15. package/scripts/design-system-advisory/check-label-case.mjs +92 -0
  16. package/scripts/design-system-advisory/check-native-form-controls.mjs +53 -0
  17. package/scripts/design-system-advisory/check-radius.mjs +56 -0
  18. package/scripts/design-system-advisory/check-raw-values.mjs +61 -0
  19. package/scripts/design-system-advisory/check-small-text.mjs +72 -0
  20. package/scripts/design-system-advisory/check-tap-target.mjs +70 -0
  21. package/scripts/design-system-advisory/defaults.mjs +90 -0
  22. package/scripts/design-system-advisory/fixtures/clean.tsx.fixture +12 -0
  23. package/scripts/design-system-advisory/fixtures/violations.tsx.fixture +19 -0
  24. package/scripts/design-system-advisory/lib.mjs +255 -0
  25. package/scripts/design-system-advisory/run.mjs +189 -0
  26. package/scripts/design-system-advisory/workflow.yml +82 -0
  27. package/scripts/health-report.mjs +20 -14
  28. package/scripts/lib/copy-strings.mjs +146 -0
  29. package/scripts/lib/counted-lint.mjs +100 -0
  30. package/scripts/lib/dark-contrast.mjs +120 -0
  31. package/scripts/lib/flush-edges.mjs +294 -0
  32. package/scripts/lib/lab-lint.mjs +62 -0
  33. package/scripts/lib/marketing-library.mjs +129 -0
  34. package/scripts/lib/mount-page.mjs +25 -0
  35. package/scripts/lib/on-system.mjs +249 -0
  36. package/scripts/lib/random.mjs +22 -0
  37. package/scripts/lib/source-scan.mjs +173 -0
  38. package/scripts/lib/spec-parse.d.mts +25 -0
  39. package/scripts/lib/spec-parse.mjs +188 -0
  40. package/scripts/lib/tells.mjs +366 -0
  41. package/scripts/lint-arbitrary-tokens.mjs +47 -0
  42. package/scripts/lint-component-token-refs.mjs +63 -0
  43. package/scripts/lint-content-hierarchy.mjs +114 -0
  44. package/scripts/lint-control-baseline.mjs +72 -0
  45. package/scripts/lint-copy-punctuation.mjs +60 -0
  46. package/scripts/lint-css-vars.mjs +175 -0
  47. package/scripts/lint-even-padding.mjs +58 -0
  48. package/scripts/lint-html-nesting.mjs +116 -0
  49. package/scripts/lint-label-case.mjs +219 -0
  50. package/scripts/lint-live-ctas.mjs +138 -0
  51. package/scripts/lint-microanimation.mjs +2 -2
  52. package/scripts/lint-proximity.mjs +181 -0
  53. package/scripts/lint-slop.mjs +1 -1
  54. package/scripts/lint-spacing-scale.mjs +78 -0
  55. package/scripts/lint-target-size.cjs +132 -0
  56. package/scripts/lint-token-primitives.mjs +307 -0
  57. package/scripts/on-system-score.mjs +95 -0
  58. package/scripts/size-audit.cjs +2 -2
  59. package/scripts/slop-rules.mjs +1 -1
  60. package/scripts/source-images.mjs +180 -0
  61. package/scripts/ux-tells.mjs +80 -0
  62. package/scripts/wcag-audit.cjs +25 -4
  63. package/src/api/brand-colors.ts +3 -0
  64. package/src/api/brand-fonts.ts +3 -0
  65. package/src/api/brand-mark.ts +6 -1
  66. package/src/api/dev-write-guard.ts +53 -0
  67. package/src/api/layers/file.ts +9 -4
  68. package/src/api/onboarding-extract.ts +85 -30
  69. package/src/api/onboarding.ts +3 -0
  70. package/src/api/save-tokens.ts +3 -0
  71. package/src/api/site-auth.ts +14 -2
  72. package/src/app/layout.tsx +6 -0
  73. package/src/app/preview/canvas/page.tsx +12 -0
  74. package/src/app/preview/components/page.tsx +828 -14
  75. package/src/app/preview/sticker-sheet/page.tsx +329 -0
  76. package/src/app/preview/sticker-sheet/specimens.tsx +296 -0
  77. package/src/app/preview/studio/blank-screen.tsx +143 -0
  78. package/src/app/preview/studio/page.tsx +7 -0
  79. package/src/app/shell.tsx +164 -47
  80. package/src/components/Foundations/Colors.stories.tsx +119 -8
  81. package/src/components/canvas/canvas.tsx +458 -0
  82. package/src/components/canvas/layout.ts +72 -0
  83. package/src/components/canvas/parse-canvas.ts +32 -0
  84. package/src/components/canvas/sample.ts +90 -0
  85. package/src/components/canvas/spec-frame.tsx +43 -0
  86. package/src/components/canvas/types.ts +33 -0
  87. package/src/components/docs-tab.tsx +7 -7
  88. package/src/components/home-recent.tsx +73 -0
  89. package/src/components/home-tab.tsx +19 -14
  90. package/src/components/layers-tab.tsx +2 -2
  91. package/src/components/markdown-preview.tsx +60 -12
  92. package/src/components/onboarding-wizard.tsx +1 -1
  93. package/src/components/studio/control-panel.tsx +299 -0
  94. package/src/components/studio/control-row.tsx +77 -0
  95. package/src/components/studio/preview-frame.tsx +165 -0
  96. package/src/components/studio/preview-pane.tsx +247 -0
  97. package/src/components/studio/studio.tsx +133 -128
  98. package/src/components/studio/types.ts +218 -0
  99. package/src/components/studio/use-studio-tweaks.ts +128 -0
  100. package/src/components/studio/use-studio-view-state.ts +72 -0
  101. package/src/components/ui/autocomplete.tsx +1 -1
  102. package/src/components/ui/avatar.tsx +4 -0
  103. package/src/components/ui/chart.tsx +134 -42
  104. package/src/components/ui/checkbox-group.tsx +1 -1
  105. package/src/components/ui/checkbox.tsx +1 -1
  106. package/src/components/ui/color-picker.tsx +20 -4
  107. package/src/components/ui/combobox.tsx +1 -0
  108. package/src/components/ui/command.tsx +1 -1
  109. package/src/components/ui/data-table.tsx +64 -3
  110. package/src/components/ui/date-field.tsx +1 -1
  111. package/src/components/ui/date-picker.tsx +2 -0
  112. package/src/components/ui/date-range-picker.tsx +4 -0
  113. package/src/components/ui/editable.tsx +1 -0
  114. package/src/components/ui/faceted-filter.tsx +187 -0
  115. package/src/components/ui/file-upload.tsx +21 -2
  116. package/src/components/ui/gauge-chart.tsx +18 -4
  117. package/src/components/ui/heatmap.tsx +3 -1
  118. package/src/components/ui/inline-edit.tsx +175 -0
  119. package/src/components/ui/input-group.tsx +5 -2
  120. package/src/components/ui/month-picker.tsx +1 -1
  121. package/src/components/ui/multi-select.tsx +1 -0
  122. package/src/components/ui/number-input.tsx +28 -5
  123. package/src/components/ui/otp-input.tsx +208 -0
  124. package/src/components/ui/phone-input.tsx +274 -0
  125. package/src/components/ui/radio-group.tsx +2 -2
  126. package/src/components/ui/search-input.tsx +1 -1
  127. package/src/components/ui/sparkline.tsx +33 -4
  128. package/src/components/ui/spinner.tsx +23 -4
  129. package/src/components/ui/table.tsx +9 -0
  130. package/src/components/ui/tags-input.tsx +1 -1
  131. package/src/components/ui/timer.tsx +1 -0
  132. package/src/components/ui/transfer-list.tsx +13 -26
  133. package/src/components/ui/week-picker.tsx +1 -13
  134. package/src/components/ui/year-picker.tsx +1 -1
  135. package/src/data/component-added.json +966 -0
  136. package/src/data/docs-index.ts +35 -2
  137. package/src/data/history.json +161 -161
  138. package/src/data/sticker-sheet.json +9244 -0
  139. package/src/docs-trace-globs.json +1 -0
  140. package/src/hooks/use-global-mono-font.ts +1 -0
  141. package/src/hooks/use-global-primary-color.ts +1 -0
  142. package/src/hooks/use-global-sans-font.ts +1 -0
  143. package/src/hooks/use-global-serif-font.ts +1 -0
  144. package/src/hooks/use-global-type-scale.ts +17 -2
  145. package/src/hooks/use-mobile.ts +2 -0
  146. package/src/hooks/use-sync-type-scale.ts +7 -11
  147. package/src/lib/chart-motion.ts +41 -0
  148. package/src/lib/get-icon-color.ts +1 -1
  149. package/src/lib/spec-parse.ts +4 -0
  150. package/src/lib/svg-sanitize.ts +19 -9
  151. package/src/stories/Accordion.stories.tsx +7 -0
  152. package/src/stories/ActionBar.stories.tsx +5 -0
  153. package/src/stories/Affix.stories.tsx +4 -0
  154. package/src/stories/AiBadge.stories.tsx +9 -7
  155. package/src/stories/Alert.stories.tsx +13 -0
  156. package/src/stories/AlertDialog.stories.tsx +4 -0
  157. package/src/stories/Anchor.stories.tsx +5 -0
  158. package/src/stories/AngleSlider.stories.tsx +6 -3
  159. package/src/stories/AspectRatio.stories.tsx +4 -0
  160. package/src/stories/Autocomplete.stories.tsx +8 -0
  161. package/src/stories/Avatar.stories.tsx +10 -0
  162. package/src/stories/Badge.stories.tsx +14 -6
  163. package/src/stories/Blockquote.stories.tsx +6 -0
  164. package/src/stories/BottomNavigation.stories.tsx +4 -0
  165. package/src/stories/Breadcrumb.stories.tsx +3 -0
  166. package/src/stories/Burger.stories.tsx +1 -0
  167. package/src/stories/Button.stories.tsx +24 -0
  168. package/src/stories/ButtonGroup.stories.tsx +9 -0
  169. package/src/stories/Calendar.stories.tsx +3 -0
  170. package/src/stories/Canvas.stories.tsx +45 -0
  171. package/src/stories/Card.stories.tsx +4 -0
  172. package/src/stories/Carousel.stories.tsx +6 -0
  173. package/src/stories/Cascader.stories.tsx +4 -0
  174. package/src/stories/Chart.stories.tsx +46 -1
  175. package/src/stories/ChatBubble.stories.tsx +8 -2
  176. package/src/stories/ChatMarker.stories.tsx +1 -0
  177. package/src/stories/Checkbox.stories.tsx +40 -0
  178. package/src/stories/CheckboxCard.stories.tsx +8 -0
  179. package/src/stories/CheckboxGroup.stories.tsx +19 -0
  180. package/src/stories/Chip.stories.tsx +10 -19
  181. package/src/stories/CircularProgress.stories.tsx +13 -27
  182. package/src/stories/Clipboard.stories.tsx +6 -0
  183. package/src/stories/CloseButton.stories.tsx +6 -4
  184. package/src/stories/Code.stories.tsx +8 -1
  185. package/src/stories/Collapsible.stories.tsx +2 -0
  186. package/src/stories/ColorPicker.stories.tsx +46 -0
  187. package/src/stories/ColorSwatch.stories.tsx +1 -0
  188. package/src/stories/Combobox.stories.tsx +9 -0
  189. package/src/stories/Command.stories.tsx +2 -0
  190. package/src/stories/Container.stories.tsx +8 -0
  191. package/src/stories/ContextMenu.stories.tsx +9 -0
  192. package/src/stories/CopyButton.stories.tsx +12 -36
  193. package/src/stories/DataList.stories.tsx +8 -0
  194. package/src/stories/DataTable.stories.tsx +39 -0
  195. package/src/stories/DateField.stories.tsx +28 -0
  196. package/src/stories/DatePicker.stories.tsx +34 -0
  197. package/src/stories/DateRangePicker.stories.tsx +32 -0
  198. package/src/stories/Dialog.stories.tsx +8 -0
  199. package/src/stories/Drawer.stories.tsx +6 -0
  200. package/src/stories/DropdownMenu.stories.tsx +2 -0
  201. package/src/stories/Editable.stories.tsx +12 -0
  202. package/src/stories/EmptyState.stories.tsx +9 -0
  203. package/src/stories/FacetedFilter.stories.tsx +197 -0
  204. package/src/stories/Field.stories.tsx +7 -0
  205. package/src/stories/Fieldset.stories.tsx +8 -0
  206. package/src/stories/FileButton.stories.tsx +4 -0
  207. package/src/stories/FileUpload.stories.tsx +16 -17
  208. package/src/stories/FloatLabel.stories.tsx +3 -8
  209. package/src/stories/FloatingActionButton.stories.tsx +10 -0
  210. package/src/stories/FloatingIndicator.stories.tsx +4 -0
  211. package/src/stories/FloatingPanel.stories.tsx +6 -0
  212. package/src/stories/FocusTrap.stories.tsx +5 -0
  213. package/src/stories/FormatByte.stories.tsx +6 -0
  214. package/src/stories/FormatDate.stories.tsx +8 -0
  215. package/src/stories/FormatNumber.stories.tsx +9 -0
  216. package/src/stories/GaugeChart.stories.tsx +9 -3
  217. package/src/stories/Heatmap.stories.tsx +11 -0
  218. package/src/stories/Highlight.stories.tsx +6 -0
  219. package/src/stories/HoverCard.stories.tsx +4 -0
  220. package/src/stories/Image.stories.tsx +9 -0
  221. package/src/stories/Indicator.stories.tsx +19 -0
  222. package/src/stories/InlineEdit.stories.tsx +106 -0
  223. package/src/stories/Input.stories.tsx +7 -0
  224. package/src/stories/InputClearButton.stories.tsx +3 -0
  225. package/src/stories/InputGroup.stories.tsx +40 -0
  226. package/src/stories/Kbd.stories.tsx +7 -1
  227. package/src/stories/KeyboardShortcut.stories.tsx +2 -0
  228. package/src/stories/Label.stories.tsx +2 -0
  229. package/src/stories/Link.stories.tsx +9 -0
  230. package/src/stories/List.stories.tsx +8 -0
  231. package/src/stories/Listbox.stories.tsx +1 -0
  232. package/src/stories/LoadingDots.stories.tsx +5 -3
  233. package/src/stories/LoadingOverlay.stories.tsx +5 -1
  234. package/src/stories/Mark.stories.tsx +5 -0
  235. package/src/stories/MarkdownPreview.stories.tsx +53 -0
  236. package/src/stories/Marquee.stories.tsx +4 -0
  237. package/src/stories/Masonry.stories.tsx +5 -0
  238. package/src/stories/Menubar.stories.tsx +3 -0
  239. package/src/stories/Meter.stories.tsx +11 -17
  240. package/src/stories/MonthPicker.stories.tsx +26 -1
  241. package/src/stories/MotionToggle.stories.tsx +1 -0
  242. package/src/stories/MultiSelect.stories.tsx +9 -0
  243. package/src/stories/NativeSelect.stories.tsx +1 -0
  244. package/src/stories/NavLink.stories.tsx +7 -0
  245. package/src/stories/NavigationMenu.stories.tsx +5 -0
  246. package/src/stories/NavigationRail.stories.tsx +10 -0
  247. package/src/stories/Notification.stories.tsx +13 -34
  248. package/src/stories/NumberInput.stories.tsx +33 -1
  249. package/src/stories/OtpInput.stories.tsx +110 -0
  250. package/src/stories/Overlay.stories.tsx +5 -1
  251. package/src/stories/Pagination.stories.tsx +8 -0
  252. package/src/stories/PasswordInput.stories.tsx +2 -0
  253. package/src/stories/PhoneInput.stories.tsx +127 -0
  254. package/src/stories/PinInput.stories.tsx +9 -2
  255. package/src/stories/Popover.stories.tsx +2 -0
  256. package/src/stories/Progress.stories.tsx +6 -1
  257. package/src/stories/Prose.stories.tsx +8 -0
  258. package/src/stories/QrCode.stories.tsx +2 -0
  259. package/src/stories/Questionnaire.stories.tsx +7 -0
  260. package/src/stories/RadioGroup.stories.tsx +40 -0
  261. package/src/stories/RatingGroup.stories.tsx +8 -4
  262. package/src/stories/Resizable.stories.tsx +4 -2
  263. package/src/stories/Result.stories.tsx +3 -0
  264. package/src/stories/Reveal.stories.tsx +2 -0
  265. package/src/stories/RollingNumber.stories.tsx +5 -0
  266. package/src/stories/ScrollArea.stories.tsx +3 -1
  267. package/src/stories/SearchInput.stories.tsx +10 -6
  268. package/src/stories/SegmentedControl.stories.tsx +11 -0
  269. package/src/stories/Select.stories.tsx +7 -0
  270. package/src/stories/Separator.stories.tsx +6 -0
  271. package/src/stories/Sheet.stories.tsx +5 -0
  272. package/src/stories/Sidebar.stories.tsx +40 -1
  273. package/src/stories/SimpleGrid.stories.tsx +5 -0
  274. package/src/stories/Skeleton.stories.tsx +8 -0
  275. package/src/stories/SkeletonTable.stories.tsx +6 -5
  276. package/src/stories/SkipLink.stories.tsx +3 -0
  277. package/src/stories/Slider.stories.tsx +2 -1
  278. package/src/stories/Sonner.stories.tsx +7 -0
  279. package/src/stories/Sparkline.stories.tsx +14 -1
  280. package/src/stories/Spinner.stories.tsx +20 -10
  281. package/src/stories/Spoiler.stories.tsx +5 -0
  282. package/src/stories/Squircle.stories.tsx +7 -0
  283. package/src/stories/Stack.stories.tsx +7 -0
  284. package/src/stories/StatusBadge.stories.tsx +12 -6
  285. package/src/stories/Stepper.stories.tsx +5 -0
  286. package/src/stories/Switch.stories.tsx +4 -0
  287. package/src/stories/Table.stories.tsx +10 -1
  288. package/src/stories/Tabs.stories.tsx +8 -0
  289. package/src/stories/Tag.stories.tsx +13 -5
  290. package/src/stories/TagsInput.stories.tsx +15 -0
  291. package/src/stories/Text.stories.tsx +12 -0
  292. package/src/stories/Textarea.stories.tsx +9 -0
  293. package/src/stories/ThemeIcon.stories.tsx +6 -3
  294. package/src/stories/TimePicker.stories.tsx +2 -0
  295. package/src/stories/Timeline.stories.tsx +12 -0
  296. package/src/stories/Timer.stories.tsx +30 -0
  297. package/src/stories/Toggle.stories.tsx +7 -5
  298. package/src/stories/ToggleGroup.stories.tsx +5 -0
  299. package/src/stories/ToggleTip.stories.tsx +4 -0
  300. package/src/stories/Toolbar.stories.tsx +6 -0
  301. package/src/stories/Tooltip.stories.tsx +3 -0
  302. package/src/stories/Tour.stories.tsx +3 -0
  303. package/src/stories/TransferList.stories.tsx +7 -0
  304. package/src/stories/TreeSelect.stories.tsx +4 -0
  305. package/src/stories/TreeView.stories.tsx +5 -0
  306. package/src/stories/TypingIndicator.stories.tsx +4 -0
  307. package/src/stories/VisuallyHidden.stories.tsx +3 -0
  308. package/src/stories/Watermark.stories.tsx +6 -0
  309. package/src/stories/WeekPicker.stories.tsx +25 -1
  310. package/src/stories/WordRotate.stories.tsx +5 -0
  311. package/src/stories/YearPicker.stories.tsx +26 -11
  312. package/src/stories/story-groups.json +22 -16
  313. package/src/styles.css +50 -2
  314. package/src/tokens.json +86 -58
@@ -0,0 +1,329 @@
1
+ "use client";
2
+
3
+ // Sticker sheet: every registered component, every declared state, light and
4
+ // dark, with the measured contrast beside it. The registry supplies the list,
5
+ // data/sticker-sheet.json (generated from wcag-audit --json) supplies every
6
+ // number, and specimens.tsx supplies the states. A registry key with no
7
+ // specimen renders as a dashed "not defined" box, never as a blank.
8
+ import * as React from "react";
9
+ import registry from "@/layer-5-component-registry/component-registry.json";
10
+ import data from "../../../data/sticker-sheet.json";
11
+ import { SPECIMENS, STATE_LABEL, stateAttrs, type Specimen } from "./specimens";
12
+
13
+ type Theme = "light" | "dark";
14
+ type Pair = (typeof data.contrast)[number];
15
+ type TokenMap = Record<string, { hex: string; alpha?: number }>;
16
+
17
+ const THEMES: Theme[] = ["light", "dark"];
18
+
19
+ interface StoryEntry {
20
+ id: string;
21
+ name: string;
22
+ }
23
+ interface StoryGroup {
24
+ title: string;
25
+ entries: StoryEntry[];
26
+ }
27
+ const STORIES = data.stories as Record<string, StoryGroup>;
28
+ const OTHER_STORIES = data.otherStories as StoryGroup[];
29
+
30
+ // Same resolution the shell uses for its Storybook link: a fork can point
31
+ // NEXT_PUBLIC_STORYBOOK_URL at its own deploy, dev uses the local server, and
32
+ // production uses the static build served same-origin.
33
+ const STORYBOOK_BASE = (
34
+ process.env.NEXT_PUBLIC_STORYBOOK_URL ??
35
+ (process.env.NODE_ENV === "development"
36
+ ? "http://localhost:6080"
37
+ : `/storybook/${process.env.NEXT_PUBLIC_STORYBOOK_VERSION || "dev"}`)
38
+ ).replace(/\/index\.html$/, "").replace(/\/$/, "");
39
+
40
+ const storyHref = (id: string) => `${STORYBOOK_BASE}/?path=/story/${id}`;
41
+ const storyFrame = (id: string, theme: Theme) => `${STORYBOOK_BASE}/iframe.html?id=${id}&viewMode=story&globals=theme:${theme}`;
42
+
43
+ // ~1,600 stories x 2 themes is far too many live iframes for one page (headless
44
+ // Chromium crashes). Mount a pair only while its cell is within ~1.5 screens of
45
+ // the viewport and drop it again after it leaves, so memory stays bounded and
46
+ // scrolling still lands on a loaded frame.
47
+ //
48
+ // `?all=1` mounts every frame up front with native loading="lazy"; the static
49
+ // export (scripts/export-sticker-sheet.mjs) uses it so the saved HTML carries
50
+ // every frame's src.
51
+ function useNearViewport<T extends Element>() {
52
+ const ref = React.useRef<T>(null);
53
+ const [near, setNear] = React.useState(false);
54
+ React.useEffect(() => {
55
+ const el = ref.current;
56
+ if (!el || typeof IntersectionObserver === "undefined" || new URLSearchParams(window.location.search).has("all")) {
57
+ setNear(true);
58
+ return;
59
+ }
60
+ const io = new IntersectionObserver(([entry]) => setNear(entry.isIntersecting), { rootMargin: "1400px 0px" });
61
+ io.observe(el);
62
+ return () => io.disconnect();
63
+ }, []);
64
+ return [ref, near] as const;
65
+ }
66
+
67
+ function StoryCell({ entry }: { entry: StoryEntry }) {
68
+ const [ref, near] = useNearViewport<HTMLDivElement>();
69
+ // Whole-screen stories need room; a single control does not. The frame is
70
+ // resizable either way, and Storybook is one click away for the rest.
71
+ const tall = /realistic|screen|page|layout|dashboard/i.test(entry.name);
72
+ const height = tall ? "h-96" : "h-44";
73
+ return (
74
+ <div className="flex min-w-0 flex-col gap-2" data-story={entry.id}>
75
+ <div className="flex flex-wrap items-baseline justify-between gap-x-3">
76
+ <h4 className="text-sm font-medium">{entry.name}</h4>
77
+ <a href={storyHref(entry.id)} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-xs underline underline-offset-4">
78
+ Open in Storybook
79
+ </a>
80
+ </div>
81
+ <div ref={ref} className="grid gap-3 sm:grid-cols-2">
82
+ {THEMES.map((theme) =>
83
+ near ? (
84
+ <iframe
85
+ key={theme}
86
+ loading="lazy"
87
+ src={storyFrame(entry.id, theme)}
88
+ title={`${entry.name}, ${theme}`}
89
+ className={`${height} w-full resize-y rounded-md border border-border bg-background`}
90
+ />
91
+ ) : (
92
+ <div key={theme} aria-hidden className={`${height} w-full rounded-md border border-dashed border-border`} />
93
+ ),
94
+ )}
95
+ </div>
96
+ </div>
97
+ );
98
+ }
99
+
100
+ function StoryList({ group }: { group: StoryGroup }) {
101
+ return (
102
+ <div className="flex flex-col gap-6">
103
+ {group.entries.map((e) => (
104
+ <StoryCell key={e.id} entry={e} />
105
+ ))}
106
+ </div>
107
+ );
108
+ }
109
+ const TOKENS = data.tokens as Record<Theme, TokenMap>;
110
+
111
+ function pairFor(theme: Theme, key: string): Pair | undefined {
112
+ const [fg, bg] = key.split("|");
113
+ return data.contrast.find((p) => p.mode === theme && p.fgKey === fg && p.bgKey === bg);
114
+ }
115
+
116
+ function Verdict({ pair }: { pair: Pair | undefined }) {
117
+ if (!pair) return <span className="rounded border border-dashed border-border px-2 py-0.5 text-xs text-muted-foreground">not audited</span>;
118
+ const pass = pair.ratio >= pair.floor;
119
+ return (
120
+ <span className="tabular-nums">
121
+ {pair.ratio.toFixed(2)}:1 <span className="text-muted-foreground">/ {pair.floor}:1</span>{" "}
122
+ <span className="font-semibold">{pass ? "pass" : "FAIL"}</span>
123
+ </span>
124
+ );
125
+ }
126
+
127
+ function Swatch({ token, theme }: { token: string; theme: Theme }) {
128
+ const entry = TOKENS[theme][token];
129
+ return (
130
+ <li className="flex items-center gap-2">
131
+ {/* lint-disable: checkbox-bypass a square token color chip, not a control */}
132
+ <span aria-hidden className="size-4 shrink-0 rounded-sm border border-border" style={{ background: `var(--${token})` }} />
133
+ <code className="text-xs">{token}</code>
134
+ <span className="text-xs text-muted-foreground tabular-nums">{entry ? `${entry.hex}${entry.alpha ? ` @ ${entry.alpha}` : ""}` : "unresolved"}</span>
135
+ </li>
136
+ );
137
+ }
138
+
139
+ function Band({ name, specimen, theme }: { name: string; specimen: Specimen; theme: Theme }) {
140
+ const rows = specimen.variants ?? [{ label: "default", props: {} }];
141
+ return (
142
+ <div
143
+ data-theme-band={theme}
144
+ className={`${theme === "dark" ? "dark " : ""}rounded-lg border border-border bg-background p-6 text-foreground`}
145
+ >
146
+ <p className="mb-4 text-xs font-medium uppercase tracking-wide text-muted-foreground">{theme}</p>
147
+ <div className="flex flex-col gap-6">
148
+ {rows.map((row) => (
149
+ <div key={row.label}>
150
+ {specimen.variants && <p className="mb-2 text-sm font-medium">{row.label}</p>}
151
+ <div className="flex flex-wrap gap-x-8 gap-y-5">
152
+ {specimen.states.map((state) => (
153
+ <div key={state} className="flex min-w-0 flex-col gap-2" data-specimen={`${theme}:${name}:${row.label}:${state}`}>
154
+ <span className="text-xs text-muted-foreground">{STATE_LABEL[state]}</span>
155
+ <div className="min-h-11 overflow-hidden p-1">
156
+ {specimen.render({ variant: row.props ?? {}, state, attrs: stateAttrs(state) })}
157
+ </div>
158
+ </div>
159
+ ))}
160
+ </div>
161
+ </div>
162
+ ))}
163
+ </div>
164
+ {specimen.limits?.map((note) => (
165
+ <p key={note} className="mt-4 rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground">
166
+ Pinning limit: {note}
167
+ </p>
168
+ ))}
169
+ <div className="mt-6 grid gap-6 border-t border-border pt-4 sm:grid-cols-2">
170
+ <div>
171
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">Contrast</p>
172
+ <ul className="flex flex-col gap-1 text-xs">
173
+ {specimen.pairs.map((key) => (
174
+ <li key={key} className="flex flex-wrap items-baseline justify-between gap-x-3">
175
+ <code>{key.replace("|", " on ")}</code>
176
+ <Verdict pair={pairFor(theme, key)} />
177
+ </li>
178
+ ))}
179
+ </ul>
180
+ </div>
181
+ <div>
182
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">Tokens</p>
183
+ <ul className="flex flex-col gap-1">
184
+ {specimen.tokens.map((t) => (
185
+ <Swatch key={t} token={t} theme={theme} />
186
+ ))}
187
+ </ul>
188
+ </div>
189
+ </div>
190
+ </div>
191
+ );
192
+ }
193
+
194
+ export default function StickerSheetPage() {
195
+ // The sheet shows both themes itself, so the document must be light: the
196
+ // light band reads :root, and a dark document would repaint it. Runs after
197
+ // DarkModeClient's effect, so it wins over ?dark=1.
198
+ React.useEffect(() => {
199
+ document.documentElement.classList.remove("dark");
200
+ }, []);
201
+
202
+ const [query, setQuery] = React.useState("");
203
+ const deferred = React.useDeferredValue(query.trim().toLowerCase());
204
+
205
+ const keys = Object.keys(registry as Record<string, unknown>);
206
+ const noStories = keys.filter((k) => !STORIES[k] && !SPECIMENS[k]);
207
+ const pinned = keys.filter((k) => SPECIMENS[k]);
208
+ const storyCount = Object.values(STORIES).reduce((n, g) => n + g.entries.length, 0);
209
+ const failing = data.contrast.filter((p) => p.ratio < p.floor);
210
+ const shown = keys.filter((k) => (STORIES[k] || SPECIMENS[k]) && k.toLowerCase().includes(deferred));
211
+
212
+ return (
213
+ <main className="mx-auto flex max-w-6xl flex-col gap-10 px-4 py-8 sm:px-6">
214
+ <header className="flex flex-col gap-4">
215
+ <h1 className="text-2xl font-semibold">Sticker sheet</h1>
216
+ <p className="max-w-prose text-sm text-muted-foreground">
217
+ {keys.length} registered components. {keys.length - noStories.length} have stories ({storyCount} in all, each shown in light and dark and linked to Storybook), {pinned.length} also have a pinned state matrix, and {noStories.length} have neither. Every contrast number comes from <code>wcag:audit</code>, which currently reports {failing.length} failing pairs across {data.contrast.length}.
218
+ </p>
219
+ <label className="flex max-w-sm flex-col gap-2 text-sm">
220
+ Filter components
221
+ <input
222
+ type="search"
223
+ value={query}
224
+ onChange={(e) => setQuery(e.target.value)}
225
+ placeholder="Button, Dialog, Tabs"
226
+ className="min-h-11 rounded-md border border-input bg-background px-3 text-sm"
227
+ />
228
+ </label>
229
+ </header>
230
+
231
+ {shown.map((name) => {
232
+ const group = STORIES[name];
233
+ return (
234
+ <section key={name} id={name} aria-labelledby={`${name}-h`} className="flex flex-col gap-4 border-t border-border pt-8">
235
+ <div className="flex flex-wrap items-baseline justify-between gap-x-4">
236
+ <h2 id={`${name}-h`} className="text-xl font-semibold">
237
+ {name}
238
+ </h2>
239
+ {group && (
240
+ <a href={`${STORYBOOK_BASE}/?path=/docs/${group.entries[0].id.split("--")[0]}--docs`} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-sm underline underline-offset-4">
241
+ {group.title} in Storybook
242
+ </a>
243
+ )}
244
+ </div>
245
+ {SPECIMENS[name] ? (
246
+ <div className="flex flex-col gap-4">
247
+ {THEMES.map((theme) => (
248
+ <Band key={theme} name={name} specimen={SPECIMENS[name]} theme={theme} />
249
+ ))}
250
+ </div>
251
+ ) : (
252
+ <p className="rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground">Pinned state matrix: not defined</p>
253
+ )}
254
+ {group ? <StoryList group={group} /> : <p className="rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground">Stories: not defined</p>}
255
+ </section>
256
+ );
257
+ })}
258
+
259
+ {OTHER_STORIES.length > 0 && !deferred && (
260
+ <section aria-labelledby="other-h" className="flex flex-col gap-6 border-t border-border pt-8">
261
+ <h2 id="other-h" className="text-xl font-semibold">
262
+ Stories with no registry entry
263
+ </h2>
264
+ {OTHER_STORIES.map((g) => (
265
+ <div key={g.title} className="flex flex-col gap-4">
266
+ <h3 className="text-base font-semibold">{g.title}</h3>
267
+ <StoryList group={g} />
268
+ </div>
269
+ ))}
270
+ </section>
271
+ )}
272
+
273
+ {noStories.length > 0 && (
274
+ <section aria-labelledby="gaps-h" className="flex flex-col gap-4 border-t border-border pt-8">
275
+ <h2 id="gaps-h" className="text-xl font-semibold">
276
+ Not defined ({noStories.length})
277
+ </h2>
278
+ <ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
279
+ {noStories.map((k) => (
280
+ <li key={k} className="min-w-0 overflow-hidden rounded-md border border-dashed border-border p-3">
281
+ <p className="truncate text-sm font-medium" title={k}>
282
+ {k}
283
+ </p>
284
+ <p className="text-xs text-muted-foreground">registered, no story</p>
285
+ </li>
286
+ ))}
287
+ </ul>
288
+ </section>
289
+ )}
290
+
291
+ <section aria-labelledby="pairs-h" className="flex flex-col gap-4">
292
+ <h2 id="pairs-h" className="text-xl font-semibold">
293
+ Every audited pair
294
+ </h2>
295
+ {THEMES.map((theme) => (
296
+ <details key={theme} className="rounded-lg border border-border p-4">
297
+ <summary className="min-h-11 cursor-pointer text-sm font-medium">
298
+ {theme} ({data.contrast.filter((p) => p.mode === theme).length} pairs)
299
+ </summary>
300
+ <table className="mt-3 w-full text-xs">
301
+ <thead>
302
+ <tr className="text-left text-muted-foreground">
303
+ <th className="py-1 pr-3 font-medium">Pair</th>
304
+ <th className="py-1 pr-3 font-medium">Kind</th>
305
+ <th className="py-1 font-medium">Ratio</th>
306
+ </tr>
307
+ </thead>
308
+ <tbody>
309
+ {data.contrast
310
+ .filter((p) => p.mode === theme)
311
+ .map((p) => (
312
+ <tr key={`${p.fgKey}|${p.bgKey}`} className="border-t border-border">
313
+ <td className="py-1 pr-3">
314
+ <code>{p.fgKey}</code> on <code>{p.bgKey}</code>
315
+ </td>
316
+ <td className="py-1 pr-3">{p.kind}</td>
317
+ <td className="py-1">
318
+ <Verdict pair={p} />
319
+ </td>
320
+ </tr>
321
+ ))}
322
+ </tbody>
323
+ </table>
324
+ </details>
325
+ ))}
326
+ </section>
327
+ </main>
328
+ );
329
+ }
@@ -0,0 +1,296 @@
1
+ "use client";
2
+
3
+ // Specimens for the sticker sheet: one entry per registry key that has a
4
+ // declared state matrix. This file is also the fork adapter. A fork that owns
5
+ // its components replaces it with its own `{ [registryKey]: Specimen }` map
6
+ // (see docs/sticker-sheet.md); the page only reads the shape below.
7
+ import * as React from "react";
8
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../components/ui/accordion";
9
+ import { Alert, AlertDescription, AlertTitle } from "../../../components/ui/alert";
10
+ import { Badge } from "../../../components/ui/badge";
11
+ import { Button } from "../../../components/ui/button";
12
+ import { Checkbox } from "../../../components/ui/checkbox";
13
+ import { Chip } from "../../../components/ui/chip";
14
+ import { Kbd } from "../../../components/ui/kbd";
15
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select";
16
+ import { Skeleton } from "../../../components/ui/skeleton";
17
+ import { Spinner } from "../../../components/ui/spinner";
18
+ import { StatusBadge } from "../../../components/ui/status-badge";
19
+ import { Tabs, TabsList, TabsTrigger } from "../../../components/ui/tabs";
20
+ import { ToggleGroup, ToggleGroupItem } from "../../../components/ui/toggle-group";
21
+ import { Input } from "../../../components/ui/input";
22
+ import { Progress } from "../../../components/ui/progress";
23
+ import { RadioGroup, RadioGroupItem } from "../../../components/ui/radio-group";
24
+ import { Slider } from "../../../components/ui/slider";
25
+ import { Switch } from "../../../components/ui/switch";
26
+ import { Textarea } from "../../../components/ui/textarea";
27
+ import { Toggle } from "../../../components/ui/toggle";
28
+
29
+ export type StateKey =
30
+ | "default"
31
+ | "hover"
32
+ | "focus"
33
+ | "pressed"
34
+ | "disabled"
35
+ | "invalid"
36
+ | "checked"
37
+ | "checkedHover"
38
+ | "indeterminate";
39
+
40
+ export const STATE_LABEL: Record<StateKey, string> = {
41
+ default: "Default",
42
+ hover: "Hover",
43
+ focus: "Focus",
44
+ pressed: "Pressed",
45
+ disabled: "Disabled",
46
+ invalid: "Invalid",
47
+ checked: "Checked",
48
+ checkedHover: "Checked + hover",
49
+ indeterminate: "Indeterminate",
50
+ };
51
+
52
+ /** Attributes that put a specimen in a state without touching the component. */
53
+ export function stateAttrs(state: StateKey): Record<string, unknown> {
54
+ switch (state) {
55
+ case "hover":
56
+ case "checkedHover":
57
+ return { "data-pin": "hover" };
58
+ case "focus":
59
+ return { "data-pin": "focus" };
60
+ case "pressed":
61
+ return { "data-pin": "pressed" };
62
+ case "disabled":
63
+ return { disabled: true };
64
+ case "invalid":
65
+ return { "aria-invalid": true };
66
+ default:
67
+ return {};
68
+ }
69
+ }
70
+
71
+ export interface Variant {
72
+ label: string;
73
+ props?: Record<string, unknown>;
74
+ }
75
+
76
+ export interface Specimen {
77
+ /** Rows: one per variant or size. Omit for a component with a single look. */
78
+ variants?: Variant[];
79
+ states: StateKey[];
80
+ render: (args: { variant: Record<string, unknown>; state: StateKey; attrs: Record<string, unknown> }) => React.ReactNode;
81
+ /** Contrast pairings this component depends on, as "fgToken|bgToken". Looked up in the wcag-audit output. */
82
+ pairs: string[];
83
+ /** Tokens the component paints with. Shown with their resolved value per theme. */
84
+ tokens: string[];
85
+ /** Where pinning can't reproduce the real state. Shown under the band so the tile isn't read as the truth. */
86
+ limits?: string[];
87
+ }
88
+
89
+ const FORM = ["default", "hover", "focus", "disabled", "invalid"] satisfies StateKey[];
90
+ const CHECKABLE = ["default", "hover", "focus", "checked", "checkedHover", "indeterminate", "disabled", "invalid"] satisfies StateKey[];
91
+ const checkedFor = (state: StateKey) =>
92
+ state === "checked" || state === "checkedHover" ? true : state === "indeterminate" ? "indeterminate" : false;
93
+
94
+ export const SPECIMENS: Record<string, Specimen> = {
95
+ Button: {
96
+ variants: ["default", "secondary", "outline", "ghost", "destructive", "accent", "link"].map((v) => ({ label: v, props: { variant: v } })),
97
+ states: ["default", "hover", "focus", "pressed", "disabled"],
98
+ render: ({ variant, attrs }) => (
99
+ <Button {...variant} {...attrs}>
100
+ Save changes
101
+ </Button>
102
+ ),
103
+ pairs: ["primary-foreground|primary", "secondary-foreground|secondary", "accent-foreground|accent", "destructive-foreground|destructive", "ring|background"],
104
+ tokens: ["primary", "primary-foreground", "secondary", "accent", "destructive", "ring"],
105
+ },
106
+ Input: {
107
+ variants: ["outline", "ghost", "filled"].map((v) => ({ label: v, props: { variant: v } })),
108
+ states: FORM,
109
+ render: ({ variant, attrs }) => <Input aria-label="Email address" placeholder="maya@example.org" {...variant} {...attrs} />,
110
+ pairs: ["foreground|background", "muted-foreground|background", "input|card", "ring|background", "destructive|background"],
111
+ tokens: ["input", "ring", "destructive", "muted-foreground"],
112
+ },
113
+ Textarea: {
114
+ variants: ["sm", "default", "lg"].map((v) => ({ label: `size ${v}`, props: { size: v } })),
115
+ states: FORM,
116
+ render: ({ variant, attrs }) => <Textarea aria-label="Notes" placeholder="Anything we should know?" {...variant} {...attrs} />,
117
+ pairs: ["foreground|background", "muted-foreground|background", "input|card", "ring|background", "destructive|background"],
118
+ tokens: ["input", "ring", "destructive", "muted-foreground"],
119
+ },
120
+ Checkbox: {
121
+ variants: ["sm", "default", "lg"].map((v) => ({ label: `size ${v}`, props: { size: v } })),
122
+ states: CHECKABLE,
123
+ render: ({ variant, state, attrs }) => <Checkbox aria-label="Agree to terms" checked={checkedFor(state)} {...variant} {...attrs} />,
124
+ pairs: ["primary-foreground|primary", "primary|background", "ring|background", "destructive|background"],
125
+ tokens: ["primary", "primary-foreground", "ring", "destructive"],
126
+ },
127
+ Switch: {
128
+ variants: ["sm", "default", "lg"].map((v) => ({ label: `size ${v}`, props: { size: v } })),
129
+ states: ["default", "hover", "focus", "checked", "checkedHover", "disabled"],
130
+ render: ({ variant, state, attrs }) => <Switch aria-label="Email notifications" checked={checkedFor(state) === true} {...variant} {...attrs} />,
131
+ pairs: ["primary|background", "input|card", "ring|background"],
132
+ tokens: ["primary", "input", "ring"],
133
+ },
134
+ Toggle: {
135
+ variants: ["default", "outline"].map((v) => ({ label: v, props: { variant: v } })),
136
+ states: ["default", "hover", "focus", "pressed", "checked", "disabled"],
137
+ render: ({ variant, state, attrs }) => (
138
+ <Toggle aria-label="Bold" pressed={state === "checked"} {...variant} {...attrs}>
139
+ B
140
+ </Toggle>
141
+ ),
142
+ pairs: ["accent-foreground|accent", "input|card", "ring|background"],
143
+ tokens: ["accent", "accent-foreground", "input", "ring"],
144
+ },
145
+ Badge: {
146
+ variants: ["default", "secondary", "destructive", "outline", "success", "warning", "info"].map((v) => ({ label: v, props: { variant: v } })),
147
+ states: ["default", "focus"],
148
+ render: ({ variant, attrs }) => (
149
+ <Badge {...variant} {...attrs}>
150
+ In review
151
+ </Badge>
152
+ ),
153
+ pairs: ["primary-foreground|primary", "secondary-foreground|secondary", "destructive-foreground|destructive", "success|background", "warning|background", "info|background"],
154
+ tokens: ["primary", "secondary", "destructive", "success", "warning", "info"],
155
+ },
156
+ RadioGroup: {
157
+ variants: ["sm", "default", "lg"].map((v) => ({ label: `size ${v}`, props: { size: v } })),
158
+ states: CHECKABLE.filter((s) => s !== "indeterminate"),
159
+ render: ({ variant, state, attrs }) => (
160
+ <RadioGroup value={state === "checked" || state === "checkedHover" ? "a" : ""} aria-label="Plan">
161
+ <RadioGroupItem value="a" aria-label="Monthly plan" {...variant} {...attrs} />
162
+ </RadioGroup>
163
+ ),
164
+ pairs: ["primary|background", "ring|background", "destructive|background"],
165
+ tokens: ["primary", "ring", "destructive"],
166
+ },
167
+ Slider: {
168
+ states: ["default", "hover", "focus", "disabled"],
169
+ render: ({ attrs }) => (
170
+ <div className="w-48">
171
+ <Slider aria-label="Volume" defaultValue={[40]} {...attrs} />
172
+ </div>
173
+ ),
174
+ pairs: ["primary|background", "ring|background"],
175
+ tokens: ["primary", "ring"],
176
+ },
177
+ Progress: {
178
+ variants: ["default", "success", "warning", "error", "info"].map((v) => ({ label: v, props: { intent: v } })),
179
+ states: ["default"],
180
+ render: ({ variant }) => (
181
+ <div className="w-48">
182
+ <Progress aria-label="Upload" value={60} {...variant} />
183
+ </div>
184
+ ),
185
+ pairs: ["primary|background", "success|background", "warning|background", "destructive|background", "info|background"],
186
+ tokens: ["primary", "success", "warning", "destructive", "info"],
187
+ },
188
+ Alert: {
189
+ variants: ["default", "destructive", "success", "warning", "info"].map((v) => ({ label: v, props: { variant: v } })),
190
+ states: ["default"],
191
+ render: ({ variant }) => (
192
+ <Alert className="w-72" {...variant}>
193
+ <AlertTitle>Heads up</AlertTitle>
194
+ <AlertDescription>Your plan renews on the first of the month.</AlertDescription>
195
+ </Alert>
196
+ ),
197
+ pairs: ["foreground|background", "destructive|background", "success|background", "warning|background", "info|background"],
198
+ tokens: ["destructive", "success", "warning", "info"],
199
+ },
200
+ Select: {
201
+ states: FORM,
202
+ render: ({ attrs }) => (
203
+ <Select>
204
+ <SelectTrigger className="w-56" aria-label="Pick a fruit" {...attrs}>
205
+ <SelectValue placeholder="Pick a fruit" />
206
+ </SelectTrigger>
207
+ <SelectContent>
208
+ <SelectItem value="apple">Apple</SelectItem>
209
+ </SelectContent>
210
+ </Select>
211
+ ),
212
+ pairs: ["foreground|background", "muted-foreground|background", "input|card", "ring|background", "destructive|background"],
213
+ tokens: ["input", "ring", "destructive", "muted-foreground"],
214
+ },
215
+ Tabs: {
216
+ // Overview is the selected tab; the states act on the unselected "Usage"
217
+ // trigger. "Checked" flips the selection to show the active look instead.
218
+ states: ["default", "hover", "focus", "pressed", "checked", "disabled"],
219
+ render: ({ state, attrs }) => (
220
+ <Tabs value={state === "checked" ? "b" : "a"}>
221
+ <TabsList>
222
+ <TabsTrigger value="a">Overview</TabsTrigger>
223
+ <TabsTrigger value="b" {...(state === "checked" ? {} : attrs)}>
224
+ Usage
225
+ </TabsTrigger>
226
+ </TabsList>
227
+ </Tabs>
228
+ ),
229
+ pairs: ["foreground|background", "muted-foreground|muted", "ring|background"],
230
+ tokens: ["muted", "muted-foreground", "ring"],
231
+ },
232
+ Accordion: {
233
+ variants: ["default", "contained", "separated"].map((v) => ({ label: v, props: { variant: v } })),
234
+ states: ["default", "hover", "focus", "checked", "disabled"],
235
+ render: ({ variant, state, attrs }) => (
236
+ <Accordion type="single" collapsible className="w-72" defaultValue={state === "checked" ? "a" : undefined} {...variant}>
237
+ <AccordionItem value="a" disabled={state === "disabled"}>
238
+ <AccordionTrigger {...(state === "disabled" ? {} : attrs)}>What is BADS?</AccordionTrigger>
239
+ <AccordionContent>A portable design system for client work.</AccordionContent>
240
+ </AccordionItem>
241
+ </Accordion>
242
+ ),
243
+ pairs: ["foreground|background", "border|background", "ring|background"],
244
+ tokens: ["border", "ring"],
245
+ limits: [
246
+ "Contained and separated draw the focus ring on the item through :has(:focus-visible), which data-pin can't reach. The Focus tile for those two variants shows no ring. Tab through the live stories to see it.",
247
+ ],
248
+ },
249
+ ToggleGroup: {
250
+ variants: ["default", "outline"].map((v) => ({ label: v, props: { variant: v } })),
251
+ states: ["default", "hover", "focus", "pressed", "checked", "disabled"],
252
+ render: ({ variant, state, attrs }) => (
253
+ <ToggleGroup type="multiple" value={state === "checked" ? ["bold"] : []} {...variant}>
254
+ <ToggleGroupItem value="bold" aria-label="Bold" {...attrs}>
255
+ B
256
+ </ToggleGroupItem>
257
+ <ToggleGroupItem value="italic" aria-label="Italic">
258
+ I
259
+ </ToggleGroupItem>
260
+ </ToggleGroup>
261
+ ),
262
+ pairs: ["accent-foreground|accent", "input|card", "ring|background"],
263
+ tokens: ["accent", "accent-foreground", "input", "ring"],
264
+ },
265
+ Chip: {
266
+ states: ["default", "hover", "focus", "disabled"],
267
+ render: ({ attrs }) => <Chip {...attrs}>design tokens</Chip>,
268
+ pairs: ["foreground|background", "border|background"],
269
+ tokens: ["border", "muted"],
270
+ },
271
+ StatusBadge: {
272
+ variants: ["active", "pending", "processing", "error", "offline", "warning"].map((v) => ({ label: v, props: { status: v } })),
273
+ states: ["default"],
274
+ render: ({ variant }) => <StatusBadge {...(variant as { status: "active" })} />,
275
+ pairs: ["foreground|background", "success|background", "warning|background", "destructive|background"],
276
+ tokens: ["success", "warning", "destructive"],
277
+ },
278
+ Skeleton: {
279
+ states: ["default"],
280
+ render: () => <Skeleton className="h-4 w-48" />,
281
+ pairs: ["muted|background"],
282
+ tokens: ["muted"],
283
+ },
284
+ Spinner: {
285
+ states: ["default"],
286
+ render: () => <Spinner />,
287
+ pairs: ["foreground|background"],
288
+ tokens: ["foreground"],
289
+ },
290
+ Kbd: {
291
+ states: ["default"],
292
+ render: () => <Kbd>⌘K</Kbd>,
293
+ pairs: ["muted-foreground|muted"],
294
+ tokens: ["muted", "muted-foreground"],
295
+ },
296
+ };