@behavioral-agentic-design-system/core 0.17.0 → 0.19.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 (79) hide show
  1. package/package.json +1 -1
  2. package/scripts/check-stories.mjs +12 -5
  3. package/scripts/fix-stories.mjs +6 -6
  4. package/scripts/generate-stories.cjs +7 -7
  5. package/src/app/preview/components/page.tsx +119 -98
  6. package/src/components/ui/color-picker.tsx +318 -9
  7. package/src/stories/Accordion.stories.tsx +152 -0
  8. package/src/stories/Alert.stories.tsx +102 -0
  9. package/src/stories/AlertDialog.stories.tsx +125 -0
  10. package/src/stories/AspectRatio.stories.tsx +82 -0
  11. package/src/stories/Avatar.stories.tsx +36 -0
  12. package/src/stories/Badge.stories.tsx +54 -0
  13. package/src/stories/Breadcrumb.stories.tsx +36 -0
  14. package/src/stories/Button.stories.tsx +144 -0
  15. package/src/stories/ButtonGroup.stories.tsx +176 -0
  16. package/src/stories/Calendar.stories.tsx +67 -0
  17. package/src/stories/Card.stories.tsx +43 -0
  18. package/src/stories/Carousel.stories.tsx +233 -0
  19. package/src/stories/Chart.stories.tsx +174 -0
  20. package/src/stories/Checkbox.stories.tsx +32 -0
  21. package/src/stories/CircularProgress.stories.tsx +136 -0
  22. package/src/stories/Code.stories.tsx +131 -0
  23. package/src/stories/Collapsible.stories.tsx +27 -0
  24. package/src/stories/ColorPicker.stories.tsx +186 -0
  25. package/src/stories/Combobox.stories.tsx +168 -0
  26. package/src/stories/Command.stories.tsx +40 -0
  27. package/src/stories/ContextMenu.stories.tsx +293 -0
  28. package/src/stories/CopyButton.stories.tsx +111 -0
  29. package/src/stories/DatePicker.stories.tsx +176 -0
  30. package/src/stories/DateRangePicker.stories.tsx +95 -0
  31. package/src/stories/Dialog.stories.tsx +186 -0
  32. package/src/stories/DropdownMenu.stories.tsx +47 -0
  33. package/src/stories/EmptyState.stories.tsx +199 -0
  34. package/src/stories/Field.stories.tsx +155 -0
  35. package/src/stories/FileUpload.stories.tsx +134 -0
  36. package/src/stories/HoverCard.stories.tsx +149 -0
  37. package/src/stories/Indicator.stories.tsx +255 -0
  38. package/src/stories/Input.stories.tsx +69 -0
  39. package/src/stories/Kbd.stories.tsx +123 -0
  40. package/src/stories/Label.stories.tsx +27 -0
  41. package/src/stories/List.stories.tsx +159 -0
  42. package/src/stories/Menubar.stories.tsx +190 -0
  43. package/src/stories/MultiSelect.stories.tsx +107 -0
  44. package/src/stories/NativeSelect.stories.tsx +107 -0
  45. package/src/stories/NavigationMenu.stories.tsx +322 -0
  46. package/src/stories/NumberInput.stories.tsx +100 -0
  47. package/src/stories/Pagination.stories.tsx +201 -0
  48. package/src/stories/PasswordInput.stories.tsx +62 -0
  49. package/src/stories/PinInput.stories.tsx +136 -0
  50. package/src/stories/Popover.stories.tsx +37 -0
  51. package/src/stories/Progress.stories.tsx +64 -0
  52. package/src/stories/RadioGroup.stories.tsx +39 -0
  53. package/src/stories/RatingGroup.stories.tsx +102 -0
  54. package/src/stories/Resizable.stories.tsx +28 -0
  55. package/src/stories/Reveal.stories.tsx +63 -0
  56. package/src/stories/ScrollArea.stories.tsx +76 -0
  57. package/src/stories/SegmentedControl.stories.tsx +182 -0
  58. package/src/stories/Select.stories.tsx +62 -0
  59. package/src/stories/Separator.stories.tsx +28 -0
  60. package/src/stories/Sheet.stories.tsx +193 -0
  61. package/src/stories/Sidebar.stories.tsx +53 -0
  62. package/src/stories/Skeleton.stories.tsx +32 -0
  63. package/src/stories/Slider.stories.tsx +67 -0
  64. package/src/stories/Sonner.stories.tsx +146 -0
  65. package/src/stories/Spinner.stories.tsx +94 -0
  66. package/src/stories/Stepper.stories.tsx +228 -0
  67. package/src/stories/Switch.stories.tsx +58 -0
  68. package/src/stories/Table.stories.tsx +38 -0
  69. package/src/stories/Tabs.stories.tsx +128 -0
  70. package/src/stories/Tag.stories.tsx +51 -0
  71. package/src/stories/TagsInput.stories.tsx +154 -0
  72. package/src/stories/Textarea.stories.tsx +31 -0
  73. package/src/stories/TimePicker.stories.tsx +54 -0
  74. package/src/stories/Timeline.stories.tsx +263 -0
  75. package/src/stories/Toggle.stories.tsx +45 -0
  76. package/src/stories/ToggleGroup.stories.tsx +39 -0
  77. package/src/stories/Toolbar.stories.tsx +295 -0
  78. package/src/stories/Tooltip.stories.tsx +37 -0
  79. package/src/stories/TreeView.stories.tsx +293 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behavioral-agentic-design-system/core",
3
- "version": "0.17.0",
3
+ "version": "0.19.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)",
@@ -3,8 +3,14 @@
3
3
  * Storybook coverage check.
4
4
  *
5
5
  * Strict rule: every primitive in packages/core/src/components/ui/*.tsx must
6
- * have a matching components/<PascalCase>.stories.tsx. When a component file
7
- * is touched in a commit, its story file must be touched in the same commit.
6
+ * have a matching packages/core/src/stories/<PascalCase>.stories.tsx. When a
7
+ * component file is touched in a commit, its story file must be touched in the
8
+ * same commit.
9
+ *
10
+ * Stories live INSIDE the published @core package (under src/) so they ship to
11
+ * forks over npm the same way the Foundations stories already do — a fork's
12
+ * Storybook globs node_modules/@.../core/src/stories/*.stories.tsx and gets
13
+ * every upstream story automatically on the next @core bump.
8
14
  *
9
15
  * Modes:
10
16
  * pnpm check:stories → precommit mode (staged-only, used by hook)
@@ -19,7 +25,7 @@ import { join, basename } from "node:path";
19
25
 
20
26
  const ROOT = process.cwd();
21
27
  const COMPONENTS_DIR = join(ROOT, "packages/core/src/components/ui");
22
- const STORIES_DIR = join(ROOT, "components");
28
+ const STORIES_DIR = join(ROOT, "packages/core/src/stories");
23
29
 
24
30
  const ALL = process.argv.includes("--all");
25
31
 
@@ -32,8 +38,9 @@ function pascal(kebab) {
32
38
  }
33
39
 
34
40
  function componentToStoryPath(componentRel) {
35
- // packages/core/src/components/ui/dropdown-menu.tsx → components/DropdownMenu.stories.tsx
36
- return `components/${pascal(basename(componentRel))}.stories.tsx`;
41
+ // packages/core/src/components/ui/dropdown-menu.tsx
42
+ // → packages/core/src/stories/DropdownMenu.stories.tsx
43
+ return `packages/core/src/stories/${pascal(basename(componentRel))}.stories.tsx`;
37
44
  }
38
45
 
39
46
  function listAllComponents() {
@@ -20,14 +20,14 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
20
20
  import { join, basename, dirname } from "node:path";
21
21
  import { fileURLToPath } from "node:url";
22
22
 
23
- // Shipped as the `bads-fix-stories` bin. The component SOURCE is package-owned,
24
- // so resolve it relative to this script inside the core package (works in the
25
- // monorepo and from node_modules in a fork — the fork's packages/core/src is a
26
- // stub with no components/ui). The stories OUTPUT is consumer-owned.
23
+ // Shipped as the `bads-fix-stories` bin. Both the component SOURCE and the
24
+ // stories OUTPUT are package-owned: stories now live in the core package under
25
+ // src/stories/ so they ship to forks over npm (a fork's Storybook globs
26
+ // node_modules/@.../core/src/stories/*.stories.tsx). Resolve both relative to
27
+ // this script's own location inside the package.
27
28
  const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
28
- const ROOT = process.cwd();
29
29
  const COMPONENTS_DIR = join(SCRIPT_DIR, "..", "src/components/ui");
30
- const STORIES_DIR = join(ROOT, "components");
30
+ const STORIES_DIR = join(SCRIPT_DIR, "..", "src/stories");
31
31
  if (!existsSync(STORIES_DIR)) mkdirSync(STORIES_DIR, { recursive: true });
32
32
 
33
33
  function pascal(kebab) {
@@ -3,16 +3,16 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
 
6
- // Shipped as the `bads-generate-stories` bin. The component SOURCE is
7
- // package-owned, so resolve it relative to this script's own location inside
8
- // the core package (works in the monorepo and from node_modules in a fork).
9
- // The stories OUTPUT and the import-path scope are consumer-facing: stories
10
- // land in the fork's components/ dir, and imports always reference the core
6
+ // Shipped as the `bads-generate-stories` bin. Both the component SOURCE and the
7
+ // stories OUTPUT are package-owned: stories live under the core package's
8
+ // src/stories/ so they ship to forks over npm. Resolve both relative to this
9
+ // script's own location inside the package. Imports still reference the core
11
10
  // package by its real published name (read from core's own package.json, so a
12
- // fork's rename never corrupts the scope).
11
+ // fork's rename never corrupts the scope) — the specifier self-resolves both
12
+ // inside the package and from a consumer's node_modules.
13
13
  const CORE = require(path.join(__dirname, '..', 'package.json')).name;
14
14
  const componentDir = path.join(__dirname, '..', 'src/components/ui');
15
- const storiesDir = path.join(process.cwd(), 'components');
15
+ const storiesDir = path.join(__dirname, '..', 'src/stories');
16
16
 
17
17
  if (!fs.existsSync(storiesDir)) fs.mkdirSync(storiesDir, { recursive: true });
18
18
 
@@ -1903,58 +1903,6 @@ export default function ComponentsPreview() {
1903
1903
  </div>
1904
1904
  </div>
1905
1905
  </Section>
1906
- <Section title="Code">
1907
- <div className="space-y-6">
1908
- <div className="space-y-2">
1909
- <p className="text-sm font-medium text-muted-foreground">Inline (default)</p>
1910
- <p className="text-sm text-foreground leading-relaxed max-w-sm">
1911
- Set the primary brand color via{" "}
1912
- <Code>--primary</Code> in{" "}
1913
- <Code>tokens.json</Code> and run{" "}
1914
- <Code>pnpm build:tokens</Code> to regenerate.
1915
- </p>
1916
- </div>
1917
- <div className="space-y-2">
1918
- <p className="text-sm font-medium text-muted-foreground">Block variant</p>
1919
- <div className="w-[480px]">
1920
- <Code variant="block">
1921
- {`// tokens.json — semantic layer\n{\n "theme": {\n "light": {\n "primary": "#1a1a1a",\n "primary-foreground": "#ffffff"\n }\n }\n}`}
1922
- </Code>
1923
- </div>
1924
- </div>
1925
- <div className="space-y-2">
1926
- <p className="text-sm font-medium text-muted-foreground">Sizes — sm / default / lg</p>
1927
- <div className="flex flex-col gap-3">
1928
- <div className="flex items-center gap-3">
1929
- <Code size="sm">pnpm a11y</Code>
1930
- <Code size="default">pnpm wcag:audit</Code>
1931
- <Code size="lg">design-tokens</Code>
1932
- </div>
1933
- <div className="w-[440px] space-y-1.5">
1934
- <Code variant="block" size="sm">{`78 pass · 0 fail · 0 warn`}</Code>
1935
- <Code variant="block" size="default">{`✓ primary on background 12.6:1 AAA`}</Code>
1936
- <Code variant="block" size="lg">{`@behavioral-agentic-design-system/core@0.16.0`}</Code>
1937
- </div>
1938
- </div>
1939
- </div>
1940
- <div className="space-y-2">
1941
- <p className="text-sm font-medium text-muted-foreground">Realistic use</p>
1942
- <div className="max-w-md space-y-4 text-sm text-foreground leading-relaxed">
1943
- <div className="space-y-1">
1944
- <p className="font-medium text-foreground">Install the package</p>
1945
- <Code variant="block">{`pnpm add @behavioral-agentic-design-system/core`}</Code>
1946
- </div>
1947
- <p>
1948
- Import tokens via <Code>import "@behavioral-agentic-design-system/core/styles.css"</Code>{" "}
1949
- in your root layout, then use any component:
1950
- </p>
1951
- <Code variant="block">
1952
- {`import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"\n\nexport function Example() {\n return <Button variant="default">Get started</Button>\n}`}
1953
- </Code>
1954
- </div>
1955
- </div>
1956
- </div>
1957
- </Section>
1958
1906
  <Section title="Combobox">
1959
1907
  <div className="space-y-6">
1960
1908
  <div className="grid grid-cols-1 gap-6 sm:grid-cols-2">
@@ -2491,52 +2439,6 @@ export default function ComponentsPreview() {
2491
2439
  </div>
2492
2440
  </Section>
2493
2441
 
2494
- <Section title="Native Select">
2495
- <div className="grid gap-6 sm:grid-cols-2">
2496
- <div className="space-y-2">
2497
- <Label htmlFor="ns-focus">Design Focus Area</Label>
2498
- <NativeSelect id="ns-focus" defaultValue="components">
2499
- <option value="">Choose a focus area</option>
2500
- <option value="tokens">Design Tokens</option>
2501
- <option value="components">Components</option>
2502
- <option value="patterns">Patterns</option>
2503
- <option value="a11y">Accessibility</option>
2504
- <option value="motion">Motion &amp; Animation</option>
2505
- </NativeSelect>
2506
- </div>
2507
- <div className="space-y-2">
2508
- <Label htmlFor="ns-disabled">Disabled</Label>
2509
- <NativeSelect id="ns-disabled" disabled defaultValue="components">
2510
- <option value="components">Components (locked)</option>
2511
- </NativeSelect>
2512
- </div>
2513
- <div className="space-y-2">
2514
- <Label htmlFor="ns-invalid">Invalid</Label>
2515
- <NativeSelect id="ns-invalid" aria-invalid defaultValue="">
2516
- <option value="">Select a valid option</option>
2517
- <option value="tokens">Design Tokens</option>
2518
- </NativeSelect>
2519
- </div>
2520
- <div className="space-y-2">
2521
- <p className="text-sm font-medium text-foreground">Sizes</p>
2522
- <div className="flex flex-col gap-2">
2523
- <NativeSelect size="sm" defaultValue="sm">
2524
- <option value="sm">Small (sm)</option>
2525
- </NativeSelect>
2526
- <NativeSelect size="default" defaultValue="default">
2527
- <option value="default">Default</option>
2528
- </NativeSelect>
2529
- <NativeSelect size="lg" defaultValue="lg">
2530
- <option value="lg">Large (lg)</option>
2531
- </NativeSelect>
2532
- <NativeSelect size="xl" defaultValue="xl">
2533
- <option value="xl">Extra Large (xl)</option>
2534
- </NativeSelect>
2535
- </div>
2536
- </div>
2537
- </div>
2538
- </Section>
2539
-
2540
2442
  <Section title="Textarea">
2541
2443
  <div className="grid gap-6 sm:grid-cols-2">
2542
2444
  <div className="space-y-2">
@@ -2933,6 +2835,26 @@ export default function ComponentsPreview() {
2933
2835
 
2934
2836
  <Section title="Color Picker">
2935
2837
  <div className="flex flex-wrap gap-8 items-start">
2838
+ <div className="space-y-1.5">
2839
+ <p className="text-xs font-medium text-muted-foreground">Color wheel</p>
2840
+ <ColorPicker
2841
+ wheel
2842
+ defaultValue="#3b82f6"
2843
+ aria-label="Pick a color from the wheel"
2844
+ />
2845
+ </div>
2846
+ <div className="space-y-1.5">
2847
+ <p className="text-xs font-medium text-muted-foreground">Wheel + swatches</p>
2848
+ <ColorPicker
2849
+ wheel
2850
+ swatches={[
2851
+ "#ef4444", "#f97316", "#eab308", "#22c55e",
2852
+ "#06b6d4", "#3b82f6", "#8b5cf6", "#ec4899",
2853
+ ]}
2854
+ defaultValue="#8b5cf6"
2855
+ aria-label="Pick a color from the wheel or a swatch"
2856
+ />
2857
+ </div>
2936
2858
  <div className="space-y-1.5">
2937
2859
  <p className="text-xs font-medium text-muted-foreground">Swatches</p>
2938
2860
  <ColorPicker
@@ -2970,6 +2892,105 @@ export default function ComponentsPreview() {
2970
2892
  </div>
2971
2893
  </div>
2972
2894
  </Section>
2895
+
2896
+ <Section title="Code">
2897
+ <div className="space-y-6">
2898
+ <div className="space-y-2">
2899
+ <p className="text-sm font-medium text-muted-foreground">Inline (default)</p>
2900
+ <p className="text-sm text-foreground leading-relaxed max-w-sm">
2901
+ Set the primary brand color via{" "}
2902
+ <Code>--primary</Code> in{" "}
2903
+ <Code>tokens.json</Code> and run{" "}
2904
+ <Code>pnpm build:tokens</Code> to regenerate.
2905
+ </p>
2906
+ </div>
2907
+ <div className="space-y-2">
2908
+ <p className="text-sm font-medium text-muted-foreground">Block variant</p>
2909
+ <div className="w-[480px]">
2910
+ <Code variant="block">
2911
+ {`// tokens.json — semantic layer\n{\n "theme": {\n "light": {\n "primary": "#1a1a1a",\n "primary-foreground": "#ffffff"\n }\n }\n}`}
2912
+ </Code>
2913
+ </div>
2914
+ </div>
2915
+ <div className="space-y-2">
2916
+ <p className="text-sm font-medium text-muted-foreground">Sizes — sm / default / lg</p>
2917
+ <div className="flex flex-col gap-3">
2918
+ <div className="flex items-center gap-3">
2919
+ <Code size="sm">pnpm a11y</Code>
2920
+ <Code size="default">pnpm wcag:audit</Code>
2921
+ <Code size="lg">design-tokens</Code>
2922
+ </div>
2923
+ <div className="w-[440px] space-y-1.5">
2924
+ <Code variant="block" size="sm">{`78 pass · 0 fail · 0 warn`}</Code>
2925
+ <Code variant="block" size="default">{`✓ primary on background 12.6:1 AAA`}</Code>
2926
+ <Code variant="block" size="lg">{`@behavioral-agentic-design-system/core@0.16.0`}</Code>
2927
+ </div>
2928
+ </div>
2929
+ </div>
2930
+ <div className="space-y-2">
2931
+ <p className="text-sm font-medium text-muted-foreground">Realistic use</p>
2932
+ <div className="max-w-md space-y-4 text-sm text-foreground leading-relaxed">
2933
+ <div className="space-y-1">
2934
+ <p className="font-medium text-foreground">Install the package</p>
2935
+ <Code variant="block">{`pnpm add @behavioral-agentic-design-system/core`}</Code>
2936
+ </div>
2937
+ <p>
2938
+ Import tokens via <Code>import "@behavioral-agentic-design-system/core/styles.css"</Code>{" "}
2939
+ in your root layout, then use any component:
2940
+ </p>
2941
+ <Code variant="block">
2942
+ {`import { Button } from "@behavioral-agentic-design-system/core/components/ui/button"\n\nexport function Example() {\n return <Button variant="default">Get started</Button>\n}`}
2943
+ </Code>
2944
+ </div>
2945
+ </div>
2946
+ </div>
2947
+ </Section>
2948
+
2949
+ <Section title="Native Select">
2950
+ <div className="grid gap-6 sm:grid-cols-2">
2951
+ <div className="space-y-2">
2952
+ <Label htmlFor="ns-focus">Design Focus Area</Label>
2953
+ <NativeSelect id="ns-focus" defaultValue="components">
2954
+ <option value="">Choose a focus area</option>
2955
+ <option value="tokens">Design Tokens</option>
2956
+ <option value="components">Components</option>
2957
+ <option value="patterns">Patterns</option>
2958
+ <option value="a11y">Accessibility</option>
2959
+ <option value="motion">Motion &amp; Animation</option>
2960
+ </NativeSelect>
2961
+ </div>
2962
+ <div className="space-y-2">
2963
+ <Label htmlFor="ns-disabled">Disabled</Label>
2964
+ <NativeSelect id="ns-disabled" disabled defaultValue="components">
2965
+ <option value="components">Components (locked)</option>
2966
+ </NativeSelect>
2967
+ </div>
2968
+ <div className="space-y-2">
2969
+ <Label htmlFor="ns-invalid">Invalid</Label>
2970
+ <NativeSelect id="ns-invalid" aria-invalid defaultValue="">
2971
+ <option value="">Select a valid option</option>
2972
+ <option value="tokens">Design Tokens</option>
2973
+ </NativeSelect>
2974
+ </div>
2975
+ <div className="space-y-2">
2976
+ <p className="text-sm font-medium text-foreground">Sizes</p>
2977
+ <div className="flex flex-col gap-2">
2978
+ <NativeSelect size="sm" defaultValue="sm">
2979
+ <option value="sm">Small (sm)</option>
2980
+ </NativeSelect>
2981
+ <NativeSelect size="default" defaultValue="default">
2982
+ <option value="default">Default</option>
2983
+ </NativeSelect>
2984
+ <NativeSelect size="lg" defaultValue="lg">
2985
+ <option value="lg">Large (lg)</option>
2986
+ </NativeSelect>
2987
+ <NativeSelect size="xl" defaultValue="xl">
2988
+ <option value="xl">Extra Large (xl)</option>
2989
+ </NativeSelect>
2990
+ </div>
2991
+ </div>
2992
+ </div>
2993
+ </Section>
2973
2994
  </div>
2974
2995
  </div>
2975
2996
  );