@behavioral-agentic-design-system/core 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behavioral-agentic-design-system/core",
3
- "version": "0.30.0",
3
+ "version": "0.32.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)",
@@ -52,6 +52,7 @@
52
52
  "./package.json": "./package.json",
53
53
  "./styles.css": "./src/styles.css",
54
54
  "./fonts.css": "./src/fonts.css",
55
+ "./fonts-cdn.css": "./src/fonts-cdn.css",
55
56
  "./brand-fonts.css": "./src/brand-fonts.css",
56
57
  "./density.css": "./src/density.css",
57
58
  "./fonts/*": "./src/fonts/*",
@@ -33,6 +33,7 @@ const path = require('path');
33
33
  const ROOT = process.cwd();
34
34
  const TOKENS = path.join(ROOT, 'packages/core/src/tokens.json');
35
35
  const PKG_CSS = path.join(ROOT, 'packages/core/src/styles.css');
36
+ const PKG_FONTS_CDN_CSS = path.join(ROOT, 'packages/core/src/fonts-cdn.css');
36
37
  const APP_CSS = path.join(ROOT, 'styles/globals.css');
37
38
  const CLIENT_EXTRAS = path.join(ROOT, 'styles/client-extras.css');
38
39
 
@@ -1060,20 +1061,31 @@ const pkgCss = `${banner}
1060
1061
  /* @behavioral-agentic-design-system/core — single-file theme import.
1061
1062
  *
1062
1063
  * Usage in your app's global stylesheet:
1064
+ * @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
1063
1065
  * @import "tailwindcss";
1064
1066
  * @import "tw-animate-css";
1065
1067
  * @import "@behavioral-agentic-design-system/core/styles.css";
1066
1068
  *
1067
- * Atkinson Hyperlegible loaded from Google Fonts; zero font setup required.
1068
- * Override any token by re-declaring it after this @import.
1069
+ * fonts-cdn.css goes FIRST and is optional — skip it if the app loads Inter
1070
+ * and Atkinson Hyperlegible itself (next/font, self-hosted woff2). Everything
1071
+ * else about font setup is zero-config. Override any token by re-declaring it
1072
+ * after this @import.
1069
1073
  */
1070
1074
 
1071
- /* Inter Variable leads (the default sans) as the zero-setup CDN fallback;
1072
- * Atkinson Hyperlegible stays as the accessibility-preserving secondary.
1073
- * Self-hosted equivalents in fonts.css win when consumers copy the binaries
1074
- * (see note below). */
1075
- @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1076
- @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
1075
+ /* This file deliberately contains NO remote \`@import url(...)\`.
1076
+ *
1077
+ * CSS only allows @import ahead of all rules. A consumer imports this file
1078
+ * AFTER \`@import "tailwindcss"\`, which expands into real rules — so a remote
1079
+ * @import here parses as invalid CSS, lightningcss/Turbopack fails the whole
1080
+ * stylesheet, and every route 500s. It went unnoticed for a long time because
1081
+ * the preview app in this repo never imports this file the way a consumer
1082
+ * does; it reads styles/globals.css, where the font imports lead. The Google
1083
+ * Fonts CDN faces now live in the separate fonts-cdn.css, which a consumer
1084
+ * places before Tailwind. check:consumer-css compiles the documented usage
1085
+ * above and fails if this ever regresses.
1086
+ *
1087
+ * The relative imports below are fine: the bundler inlines them rather than
1088
+ * leaving an @import statement in the output. */
1077
1089
 
1078
1090
  /* Self-hosted brand faces shipped inside this package. fonts.css holds the
1079
1091
  * canonical SIL OFL defaults (Hyperlegible Sans, 6 weights). brand-fonts.css
@@ -1082,8 +1094,9 @@ const pkgCss = `${banner}
1082
1094
  * — consumers copy the binaries from
1083
1095
  * \`node_modules/@behavioral-agentic-design-system/core/fonts/\` into their own
1084
1096
  * \`public/fonts/\` so the URLs resolve. See CLIENT_ONBOARDING.md → Shipping
1085
- * fonts. CSS @import order: Google Fonts first (lowest priority fallback),
1086
- * then local @font-face rules so the brand stack wins.
1097
+ * fonts. Load order still puts the CDN faces first (lowest priority fallback)
1098
+ * and these local @font-face rules after, so the brand stack wins — that
1099
+ * ordering is now the consumer's import order, not this file's.
1087
1100
  */
1088
1101
  @import "./fonts.css";
1089
1102
  @import "./brand-fonts.css";
@@ -1145,6 +1158,42 @@ ${borderColorUtilities}
1145
1158
  fs.writeFileSync(PKG_CSS, pkgCss);
1146
1159
  console.log(`✓ wrote ${path.relative(ROOT, PKG_CSS)}`);
1147
1160
 
1161
+ // ---- packages/core/src/fonts-cdn.css (consumer-facing, opt-in) ------------
1162
+
1163
+ // The Google Fonts CDN faces live here, alone, because a remote `@import
1164
+ // url(...)` is only valid ahead of every rule. Consumers import this file
1165
+ // FIRST — before `@import "tailwindcss"` — and styles.css third, which is the
1166
+ // only ordering CSS actually permits. Keep this file rule-free: one comment
1167
+ // and the @import statements, nothing else.
1168
+ const pkgFontsCdnCss = `${banner}
1169
+
1170
+ /* @behavioral-agentic-design-system/core — Google Fonts CDN faces (opt-in).
1171
+ *
1172
+ * Import this FIRST in your global stylesheet, ahead of Tailwind:
1173
+ * @import "@behavioral-agentic-design-system/core/fonts-cdn.css";
1174
+ * @import "tailwindcss";
1175
+ * @import "tw-animate-css";
1176
+ * @import "@behavioral-agentic-design-system/core/styles.css";
1177
+ *
1178
+ * Remote @import statements are legal only before any rule, and Tailwind
1179
+ * expands into rules — so these cannot live in styles.css, which is imported
1180
+ * after it. Skip this file entirely if the app already loads Inter and
1181
+ * Atkinson Hyperlegible itself (next/font, or self-hosted woff2 copied out of
1182
+ * this package's fonts/ directory); the CDN is the zero-setup fallback, and
1183
+ * the local @font-face rules in fonts.css win over it either way.
1184
+ *
1185
+ * Inter Variable leads as the default sans; Atkinson Hyperlegible stays as
1186
+ * the accessibility-preserving secondary.
1187
+ *
1188
+ * This file must contain NO rules of its own — a single rule here would make
1189
+ * the @import statements below invalid for anyone importing it. */
1190
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1191
+ @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
1192
+ `;
1193
+
1194
+ fs.writeFileSync(PKG_FONTS_CDN_CSS, pkgFontsCdnCss);
1195
+ console.log(`✓ wrote ${path.relative(ROOT, PKG_FONTS_CDN_CSS)}`);
1196
+
1148
1197
  // ---- styles/globals.css (preview app) ------------------------------------
1149
1198
 
1150
1199
  // Note: Google Fonts @imports are intentionally NOT emitted for the preview app.
@@ -74,7 +74,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@beha
74
74
  import { Alert, AlertDescription, AlertTitle } from "@behavioral-agentic-design-system/core/components/ui/alert";
75
75
  import { Avatar, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "@behavioral-agentic-design-system/core/components/ui/avatar";
76
76
  import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
77
- import { Skeleton } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
77
+ import { Skeleton, SkeletonTable } from "@behavioral-agentic-design-system/core/components/ui/skeleton";
78
78
  import { Progress } from "@behavioral-agentic-design-system/core/components/ui/progress";
79
79
  import { Slider } from "@behavioral-agentic-design-system/core/components/ui/slider";
80
80
  import { ScrollArea } from "@behavioral-agentic-design-system/core/components/ui/scroll-area";
@@ -413,6 +413,7 @@ import {
413
413
  type TreeSelectNode,
414
414
  } from "@behavioral-agentic-design-system/core/components/ui/tree-select";
415
415
  import { Questionnaire } from "@behavioral-agentic-design-system/core/components/ui/questionnaire";
416
+ import { ToggleTip } from "@behavioral-agentic-design-system/core/components/ui/toggle-tip";
416
417
 
417
418
  // Stable, deterministic data for ScrollArea — never use Math.random in
418
419
  // SSR-rendered output, it causes hydration mismatches.
@@ -933,6 +934,17 @@ export default function ComponentsPreview() {
933
934
  </div>
934
935
  <Separator className="my-4" />
935
936
  <div className="space-y-3">
937
+ <Label>Checkbox sizes</Label>
938
+ <div className="flex items-center gap-6">
939
+ <div className="flex items-center gap-2">
940
+ <Checkbox id="cb-sm" size="sm" defaultChecked />
941
+ <Label htmlFor="cb-sm">Small (24px)</Label>
942
+ </div>
943
+ <div className="flex items-center gap-2">
944
+ <Checkbox id="cb-default-size" defaultChecked />
945
+ <Label htmlFor="cb-default-size">Default (32px)</Label>
946
+ </div>
947
+ </div>
936
948
  <Label id="form-controls-slider-label">Slider</Label>
937
949
  <Slider
938
950
  defaultValue={[40]}
@@ -974,6 +986,13 @@ export default function ComponentsPreview() {
974
986
  getValueLabel={(value, max) => `${value} of ${max} components`}
975
987
  />
976
988
  </div>
989
+ <Label className="pt-3">Progress intents</Label>
990
+ <div className="space-y-4">
991
+ <Progress value={100} intent="success" label="Deployment complete" showValue />
992
+ <Progress value={78} intent="warning" label="Disk quota: 78% used" showValue />
993
+ <Progress value={100} intent="error" label="Build failed" showValue />
994
+ <Progress value={42} intent="info" label="Syncing design tokens" showValue />
995
+ </div>
977
996
  </div>
978
997
  </Section>
979
998
 
@@ -999,6 +1018,33 @@ export default function ComponentsPreview() {
999
1018
  Preview
1000
1019
  </Badge>
1001
1020
  </div>
1021
+ <div className="mt-4 space-y-2">
1022
+ <p className="text-xs font-medium text-muted-foreground">sizes:</p>
1023
+ <div className="flex flex-wrap items-center gap-2">
1024
+ <Badge size="sm">v2.4.1</Badge>
1025
+ <Badge size="sm" variant="success">
1026
+ <CircleCheck strokeWidth={1.5} aria-hidden />
1027
+ Passing
1028
+ </Badge>
1029
+ <Badge size="sm" variant="outline">sm</Badge>
1030
+ </div>
1031
+ <div className="flex flex-wrap items-center gap-2">
1032
+ <Badge>v2.4.1</Badge>
1033
+ <Badge variant="success">
1034
+ <CircleCheck strokeWidth={1.5} aria-hidden />
1035
+ Passing
1036
+ </Badge>
1037
+ <Badge variant="outline">default</Badge>
1038
+ </div>
1039
+ <div className="flex flex-wrap items-center gap-2">
1040
+ <Badge size="lg">v2.4.1</Badge>
1041
+ <Badge size="lg" variant="success">
1042
+ <CircleCheck strokeWidth={1.5} aria-hidden />
1043
+ Passing
1044
+ </Badge>
1045
+ <Badge size="lg" variant="outline">lg</Badge>
1046
+ </div>
1047
+ </div>
1002
1048
  <Separator className="my-4" />
1003
1049
  <div className="flex items-center gap-3">
1004
1050
  <Avatar>
@@ -6013,6 +6059,89 @@ export default function ComponentsPreview() {
6013
6059
  <Section title="Questionnaire">
6014
6060
  <QuestionnaireShowcase />
6015
6061
  </Section>
6062
+
6063
+ <Section title="Toggle Tip">
6064
+ <ToggleTipShowcase />
6065
+ </Section>
6066
+ <Section title="SkeletonTable">
6067
+ <SkeletonTableShowcase />
6068
+ </Section>
6069
+ </div>
6070
+ </div>
6071
+ );
6072
+ }
6073
+
6074
+ function ToggleTipShowcase() {
6075
+ return (
6076
+ <div className="space-y-8">
6077
+ <p className="text-sm text-muted-foreground">
6078
+ Click-triggered, toggleable information overlay with an arrow — the
6079
+ touch- and keyboard-accessible counterpart to Tooltip. Opens on
6080
+ click/tap/Enter/Space and toggles closed; Escape and outside-click
6081
+ dismiss. Rides the normal Popover token surface, so normal semantic
6082
+ tokens are safe inside. Not for interactive content (that&apos;s
6083
+ Popover) and not a Tooltip replacement on hover surfaces.
6084
+ </p>
6085
+
6086
+ <div>
6087
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
6088
+ Default — ghost icon Button trigger, tip on top.
6089
+ </p>
6090
+ <ToggleTip content="Semantic tokens alias primitives, so one brand change propagates everywhere.">
6091
+ <Button
6092
+ variant="ghost"
6093
+ size="icon"
6094
+ aria-label="More about semantic tokens"
6095
+ >
6096
+ <Info strokeWidth={1.5} className="size-4" />
6097
+ </Button>
6098
+ </ToggleTip>
6099
+ </div>
6100
+
6101
+ <div>
6102
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
6103
+ Disabled — the tip never opens while the trigger is disabled.
6104
+ </p>
6105
+ <ToggleTip
6106
+ disabled
6107
+ content="This tip never opens while the trigger is disabled."
6108
+ >
6109
+ <Button
6110
+ variant="ghost"
6111
+ size="icon"
6112
+ aria-label="More about semantic tokens"
6113
+ >
6114
+ <Info strokeWidth={1.5} className="size-4" />
6115
+ </Button>
6116
+ </ToggleTip>
6117
+ </div>
6118
+
6119
+ <div>
6120
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
6121
+ Form-label composition — the canonical placement: an info icon
6122
+ beside a Label, tip opening to the right.
6123
+ </p>
6124
+ <div className="w-80 space-y-3">
6125
+ <div className="flex items-center gap-1">
6126
+ <Label htmlFor="toggle-tip-npm-scope">npm scope</Label>
6127
+ <ToggleTip
6128
+ side="right"
6129
+ content="The package prefix your forks import from. The npm package name stays @behavioral-agentic-design-system/core even after a rename."
6130
+ >
6131
+ <Button
6132
+ variant="ghost"
6133
+ size="icon-sm"
6134
+ aria-label="What is an npm scope?"
6135
+ >
6136
+ <Info strokeWidth={1.5} className="size-4" />
6137
+ </Button>
6138
+ </ToggleTip>
6139
+ </div>
6140
+ <Input
6141
+ id="toggle-tip-npm-scope"
6142
+ defaultValue="@behavioral-agentic-design-system"
6143
+ />
6144
+ </div>
6016
6145
  </div>
6017
6146
  </div>
6018
6147
  );
@@ -11534,7 +11663,7 @@ function QuestionnaireShowcase() {
11534
11663
  Realistic use — agent clarification flow with all three question types
11535
11664
  including a skippable freeform step.
11536
11665
  </p>
11537
- <div className="w-[420px] rounded-xl border border-border bg-card p-6 shadow-sm">
11666
+ <Card className="w-[420px] rounded-xl p-6">
11538
11667
  <p className="mb-4 text-xs font-medium uppercase tracking-wide text-muted-foreground">
11539
11668
  Agent · Clarify intent
11540
11669
  </p>
@@ -11543,7 +11672,64 @@ function QuestionnaireShowcase() {
11543
11672
  onComplete={(answers) => console.log("Questionnaire complete", answers)}
11544
11673
  onSkip={(id) => console.log("Skipped", id)}
11545
11674
  />
11546
- </div>
11675
+ </Card>
11676
+ </div>
11677
+ </div>
11678
+ );
11679
+ }
11680
+
11681
+ function SkeletonTableShowcase() {
11682
+ return (
11683
+ <div className="space-y-8">
11684
+ <p className="text-sm text-muted-foreground">
11685
+ Table-shaped loading skeleton. Closes the DataTable loading-state gap —
11686
+ use while async data fetches, then swap for the real table on load. Row
11687
+ and column counts should match the real table shape; organic cell widths
11688
+ prevent the identical-block look.
11689
+ </p>
11690
+
11691
+ <div>
11692
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
11693
+ Default — 5 rows × 4 columns, header row, pulse animation.
11694
+ </p>
11695
+ <SkeletonTable />
11696
+ </div>
11697
+
11698
+ <div>
11699
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
11700
+ No header — for tables whose header is rendered separately or sticky.
11701
+ </p>
11702
+ <SkeletonTable showHeader={false} />
11703
+ </div>
11704
+
11705
+ <div>
11706
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
11707
+ Custom shape — 3 rows × 6 columns.
11708
+ </p>
11709
+ <SkeletonTable rows={3} columns={6} />
11710
+ </div>
11711
+
11712
+ <div>
11713
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
11714
+ Wave animation — same as Skeleton wave mode.
11715
+ </p>
11716
+ <SkeletonTable animation="wave" rows={3} />
11717
+ </div>
11718
+
11719
+ <div>
11720
+ <p className="mb-3 text-xs font-medium text-muted-foreground">
11721
+ Realistic use — DataTable card with title + action button skeletons
11722
+ above the table.
11723
+ </p>
11724
+ <Card className="w-full">
11725
+ <CardHeader className="flex flex-row items-center justify-between pb-3">
11726
+ <Skeleton className="h-5 w-44" />
11727
+ <Skeleton className="h-9 w-24 rounded-md" />
11728
+ </CardHeader>
11729
+ <CardContent>
11730
+ <SkeletonTable rows={5} columns={4} showHeader />
11731
+ </CardContent>
11732
+ </Card>
11547
11733
  </div>
11548
11734
  </div>
11549
11735
  );
package/src/app/shell.tsx CHANGED
@@ -434,18 +434,54 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
434
434
  // small — every extra % here steals deceleration from the visible sweep
435
435
  // (1.12 was tried first: crossing stayed a 2-frame blink).
436
436
  // (See the theme-reveal comment in build-tokens.cjs.)
437
+ const cx = event.clientX;
438
+ const cy = event.clientY;
437
439
  const radius = Math.hypot(
438
- Math.max(event.clientX, window.innerWidth - event.clientX),
439
- Math.max(event.clientY, window.innerHeight - event.clientY)
440
+ Math.max(cx, window.innerWidth - cx),
441
+ Math.max(cy, window.innerHeight - cy)
440
442
  );
441
- root.style.setProperty("--r", `${Math.ceil(radius * 1.03)}px`);
443
+ const r = Math.ceil(radius * 1.03);
444
+ root.style.setProperty("--r", `${r}px`);
442
445
  const transition = (document as Document & {
443
- startViewTransition: (cb: () => void) => { finished: Promise<void> };
446
+ startViewTransition: (cb: () => void) => { finished: Promise<void>; ready: Promise<void> };
444
447
  }).startViewTransition(() => {
445
448
  syncHost();
446
449
  syncVisibleIframes();
447
450
  setDark(next);
448
451
  });
452
+ // Drive the reveal's ORIGIN from JS (literal px), not from --x/--y read
453
+ // inside the CSS keyframe. Current Chrome stopped propagating custom
454
+ // properties set on <html> into the ::view-transition pseudo tree, so the
455
+ // keyframe's `circle(... at var(--x,50%) var(--y,50%))` fell back to 50%
456
+ // 50% and the wipe started dead-center instead of at the toggle (WebKit
457
+ // still inherits them, which is why it only broke in Chrome). The WAAPI
458
+ // animation carries the same duration/easing/radius as the CSS keyframe
459
+ // (so the theme-old-out tail-guard's 92%/98% offsets still line up) and,
460
+ // being a scripted animation, wins the cascade over the CSS one — which
461
+ // stays as the coordinate-free fallback for engines without pseudoElement
462
+ // support. `ready` starts before the first animation frame paints, so the
463
+ // WAAPI origin is in place before any centered CSS frame is visible.
464
+ transition.ready.then(
465
+ () => {
466
+ try {
467
+ root.animate(
468
+ {
469
+ clipPath: [
470
+ `circle(0px at ${cx}px ${cy}px)`,
471
+ `circle(${r}px at ${cx}px ${cy}px)`,
472
+ ],
473
+ },
474
+ {
475
+ duration: 400,
476
+ easing: "ease-in-out",
477
+ fill: "forwards",
478
+ pseudoElement: "::view-transition-new(root)",
479
+ }
480
+ );
481
+ } catch {}
482
+ },
483
+ () => {}
484
+ );
449
485
  // `finished` rejects when a newer transition skips this one — converge
450
486
  // either way. Two rAFs past `finished` so the overlay-teardown frame
451
487
  // paints before the hidden-iframe recalc lands: with the exact radius the
@@ -14,13 +14,30 @@ import { Button } from "@behavioral-agentic-design-system/core/components/ui/but
14
14
  import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
15
15
  import { Dialog, DialogContent } from "@behavioral-agentic-design-system/core/components/ui/dialog";
16
16
  import { MarkdownPreview } from "@behavioral-agentic-design-system/core/components/markdown-preview";
17
- import { DOCS_INDEX, DOCS_TOTAL, type DocEntry, type DocGroup } from "@behavioral-agentic-design-system/core/data/docs-index";
17
+ import {
18
+ docsTotal,
19
+ visibleDocGroups,
20
+ type DocEntry,
21
+ type DocGroup,
22
+ } from "@behavioral-agentic-design-system/core/data/docs-index";
23
+ import { IS_CLIENT_FORK } from "@behavioral-agentic-design-system/core/lib/fork";
24
+
25
+ // The groups this repo actually surfaces. A renamed client fork drops the
26
+ // onboarding group (see `retireAfterRename` in docs-index) — it describes work
27
+ // that already happened here, so leaving it in the sidebar tells this fork's own
28
+ // staff to re-onboard their live design system. Resolved at build time, so the
29
+ // server render and the hydrated render agree.
30
+ //
31
+ // Module scope, not a hook: IS_CLIENT_FORK is a build-time constant, so this
32
+ // list can never change during a session.
33
+ const GROUPS: DocGroup[] = visibleDocGroups(IS_CLIENT_FORK);
34
+ const TOTAL = docsTotal(GROUPS);
18
35
 
19
36
  // Persist last-viewed doc across reloads so the tab restores cleanly.
20
37
  const ACTIVE_DOC_KEY = "bads:docs:active-path";
21
38
 
22
39
  function findEntryByPath(path: string): DocEntry | undefined {
23
- for (const group of DOCS_INDEX) {
40
+ for (const group of GROUPS) {
24
41
  const hit = group.entries.find((e) => e.path === path);
25
42
  if (hit) return hit;
26
43
  }
@@ -28,7 +45,7 @@ function findEntryByPath(path: string): DocEntry | undefined {
28
45
  }
29
46
 
30
47
  function flatEntries(): DocEntry[] {
31
- return DOCS_INDEX.flatMap((g) => g.entries);
48
+ return GROUPS.flatMap((g) => g.entries);
32
49
  }
33
50
 
34
51
  // Tiny fuzzy match: every search-token (split on whitespace) must appear
@@ -45,7 +62,7 @@ function matches(haystack: string, query: string): boolean {
45
62
  }
46
63
 
47
64
  export function DocsTab() {
48
- const defaultEntry = DOCS_INDEX[0]?.entries[0];
65
+ const defaultEntry = GROUPS[0]?.entries[0];
49
66
  const [activePath, setActivePath] = useState<string>(defaultEntry?.path ?? "");
50
67
  const [content, setContent] = useState<string>("");
51
68
  const [loading, setLoading] = useState<boolean>(false);
@@ -148,8 +165,8 @@ export function DocsTab() {
148
165
  // Sidebar items use the same matcher so sidebar + palette share behavior.
149
166
  const sidebarGroups = useMemo<DocGroup[]>(() => {
150
167
  const q = paletteQuery.trim();
151
- if (!q) return DOCS_INDEX;
152
- return DOCS_INDEX.map((g): DocGroup => ({
168
+ if (!q) return GROUPS;
169
+ return GROUPS.map((g): DocGroup => ({
153
170
  ...g,
154
171
  entries: g.entries.filter((e) => matches(`${e.title} ${e.path} ${e.summary ?? ""}`, q)),
155
172
  })).filter((g) => g.entries.length > 0);
@@ -204,7 +221,7 @@ export function DocsTab() {
204
221
  <BookOpen className="size-4 text-primary" strokeWidth={1.5} />
205
222
  <span className="text-sm font-semibold">Docs</span>
206
223
  <Badge variant="secondary" className="ml-1">
207
- {DOCS_TOTAL}
224
+ {TOTAL}
208
225
  </Badge>
209
226
  </div>
210
227
  <Button
@@ -268,7 +285,7 @@ export function DocsTab() {
268
285
  <BookOpen className="size-4 text-primary" strokeWidth={1.5} />
269
286
  <span className="text-sm font-semibold">Docs</span>
270
287
  <Badge variant="secondary" className="ml-1">
271
- {DOCS_TOTAL}
288
+ {TOTAL}
272
289
  </Badge>
273
290
  <Button
274
291
  variant="outline"
@@ -317,7 +334,7 @@ export function DocsTab() {
317
334
  setPaletteIndex(0);
318
335
  }}
319
336
  onKeyDown={onPaletteKey}
320
- placeholder={`Search ${DOCS_TOTAL} docs…`}
337
+ placeholder={`Search ${TOTAL} docs…`}
321
338
  aria-label="Search documentation"
322
339
  className="h-9 border-0 px-0 text-sm shadow-none focus-visible:ring-0"
323
340
  />
@@ -32,7 +32,11 @@ import { Separator } from "@behavioral-agentic-design-system/core/components/ui/
32
32
  import { BadsUpdateBanner } from "@behavioral-agentic-design-system/core/components/bads-update-banner";
33
33
  import registry from "@/layer-5-component-registry/component-registry.json";
34
34
  import tokens from "@/packages/core/src/tokens.json";
35
- import { AUTOMATION_COUNT, DOCS_INDEX, DOCS_TOTAL } from "@behavioral-agentic-design-system/core/data/docs-index";
35
+ import {
36
+ AUTOMATION_COUNT,
37
+ visibleDocGroups,
38
+ } from "@behavioral-agentic-design-system/core/data/docs-index";
39
+ import { IS_CLIENT_FORK } from "@behavioral-agentic-design-system/core/lib/fork";
36
40
 
37
41
  type HomeTabProps = {
38
42
  onBrowseDocs?: () => void;
@@ -49,6 +53,11 @@ const primitiveTokenCount = Object.values(
49
53
  ).reduce((sum, group) => sum + Object.keys(group).length, 0);
50
54
  const LAYER_COUNT = 10;
51
55
 
56
+ // Must match what the Docs tab actually renders, since clicking a badge here
57
+ // opens that group's first doc there — a badge for a group the tab has retired
58
+ // would open nothing. Both sides derive from visibleDocGroups(IS_CLIENT_FORK).
59
+ const DOC_GROUPS = visibleDocGroups(IS_CLIENT_FORK);
60
+
52
61
  // Curated entry-points. Each points at a real path in the Docs tab so
53
62
  // clicking through lands on a meaningful first read, not a TOC.
54
63
  type StarterCard = {
@@ -412,10 +421,10 @@ export function HomeTab({ onBrowseDocs, onBrowseComponents }: HomeTabProps) {
412
421
 
413
422
  <section className="flex flex-col gap-4">
414
423
  <h2 className="text-sm font-semibold uppercase tracking-wide text-muted-foreground">
415
- The Docs tab indexes {DOCS_INDEX.length} categories
424
+ The Docs tab indexes {DOC_GROUPS.length} categories
416
425
  </h2>
417
426
  <div className="flex flex-wrap gap-2">
418
- {DOCS_INDEX.map((group) => (
427
+ {DOC_GROUPS.map((group) => (
419
428
  <Badge
420
429
  key={group.id}
421
430
  variant="outline"
@@ -5,7 +5,7 @@ import { Slot } from "@radix-ui/react-slot"
5
5
  import { cn } from "../../lib/utils"
6
6
 
7
7
  const badgeVariants = cva(
8
- "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
8
+ "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none",
9
9
  {
10
10
  variants: {
11
11
  variant: {
@@ -38,9 +38,21 @@ const badgeVariants = cva(
38
38
  info:
39
39
  "border-[var(--info)]! bg-info/10 text-foreground [&>svg]:text-info dark:bg-info/15",
40
40
  },
41
+ /**
42
+ * Badge height ladder (peer parity: Mantine Badge size, MUI Chip size,
43
+ * Chakra Badge size). sm = dense list rows / inline labels; default =
44
+ * unchanged; lg = prominent status surfaces / feature flags.
45
+ * BADS text-xs = 14px and text-sm = 16px — never below 14px (AAA floor).
46
+ */
47
+ size: {
48
+ sm: "px-1.5 py-0 text-xs font-medium [&>svg]:size-2.5",
49
+ default: "px-2 py-0.5 text-xs font-medium [&>svg]:size-3",
50
+ lg: "px-2.5 py-1 text-sm font-medium [&>svg]:size-4",
51
+ },
41
52
  },
42
53
  defaultVariants: {
43
54
  variant: "default",
55
+ size: "default",
44
56
  },
45
57
  }
46
58
  )
@@ -48,6 +60,7 @@ const badgeVariants = cva(
48
60
  function Badge({
49
61
  className,
50
62
  variant = "default",
63
+ size = "default",
51
64
  asChild = false,
52
65
  ...props
53
66
  }: React.ComponentProps<"span"> &
@@ -58,7 +71,8 @@ function Badge({
58
71
  <Comp
59
72
  data-slot="badge"
60
73
  data-variant={variant}
61
- className={cn(badgeVariants({ variant }), className)}
74
+ data-size={size}
75
+ className={cn(badgeVariants({ variant, size }), className)}
62
76
  {...props}
63
77
  />
64
78
  )
@@ -6,23 +6,38 @@ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
6
6
 
7
7
  import { cn } from "../../lib/utils"
8
8
 
9
+ type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root> & {
10
+ /**
11
+ * Visual size of the checkbox box (peer parity: Mantine size, MUI size,
12
+ * Chakra size).
13
+ * sm = 24px visible box · default = 32px visible box (unchanged).
14
+ * The transparent ::before hit-area stays 44px in both sizes (WCAG 2.2
15
+ * SC 2.5.5 Enhanced — the AAA pointer-target floor). An explicit size
16
+ * utility in className still wins for one-off overrides.
17
+ */
18
+ size?: "sm" | "default"
19
+ }
20
+
9
21
  function Checkbox({
10
22
  className,
23
+ size = "default",
11
24
  ...props
12
- }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
25
+ }: CheckboxProps) {
13
26
  return (
14
27
  <CheckboxPrimitive.Root
15
28
  data-slot="checkbox"
29
+ data-size={size}
16
30
  className={cn(
17
- // The visible box stays 32px (size-8) for tonal density, but the
31
+ // The visible box is 24px (sm) or 32px (default), but the
18
32
  // POINTER TARGET must hit WCAG 2.2 SC 2.5.5 Enhanced (44×44, the AAA
19
33
  // floor). A centered transparent ::before overlay (before:size-11 =
20
34
  // 44px) extends the interactive area without enlarging the box — a
21
35
  // pseudo-element hit-tests to its host, so clicks in the padding toggle
22
36
  // the checkbox. It's absolutely positioned, so it adds zero layout
23
37
  // (respects the no-jump / layout-stability principle) and never touches
24
- // a neighbor's flow. Focus ring stays on the visible 32px box.
25
- "peer relative inline-flex size-8 shrink-0 items-center justify-center rounded-[4px] border-2 border-muted-foreground/60 bg-white leading-none shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none before:absolute before:left-1/2 before:top-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
38
+ // a neighbor's flow. Focus ring stays on the visible box.
39
+ "peer relative inline-flex shrink-0 items-center justify-center border-2 border-muted-foreground/60 bg-white leading-none shadow-xs transition-[background-color,border-color,color] duration-[210ms] ease-in-out outline-none before:absolute before:left-1/2 before:top-1/2 before:size-11 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
40
+ size === "sm" ? "size-6 rounded-[3px]" : "size-8 rounded-[4px]",
26
41
  className
27
42
  )}
28
43
  {...props}
@@ -37,11 +52,11 @@ function Checkbox({
37
52
  which Radix already announces). Icons keep the CheckIcon's stroke
38
53
  weight so the glyphs read identically inside the same indicator. */}
39
54
  <CheckIcon
40
- className="hidden size-6 group-data-[state=checked]/indicator:block"
55
+ className={cn("hidden group-data-[state=checked]/indicator:block", size === "sm" ? "size-4" : "size-6")}
41
56
  strokeWidth={3}
42
57
  />
43
58
  <MinusIcon
44
- className="hidden size-6 group-data-[state=indeterminate]/indicator:block"
59
+ className={cn("hidden group-data-[state=indeterminate]/indicator:block", size === "sm" ? "size-4" : "size-6")}
45
60
  strokeWidth={3}
46
61
  />
47
62
  </CheckboxPrimitive.Indicator>