@behavioral-agentic-design-system/core 0.2.0 → 0.3.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 (44) hide show
  1. package/package.json +36 -5
  2. package/scripts/bads-sync.mjs +81 -0
  3. package/scripts/build-tokens.cjs +430 -0
  4. package/src/app/font-ready.tsx +51 -0
  5. package/src/app/layout.tsx +152 -0
  6. package/src/app/page.tsx +267 -0
  7. package/src/app/preview/cards/page.tsx +8 -0
  8. package/src/app/preview/components/page.tsx +232 -0
  9. package/src/app/preview/dark-mode-client.tsx +24 -0
  10. package/src/app/preview/dashboard/page.tsx +4 -0
  11. package/src/app/preview/global-font-client.tsx +36 -0
  12. package/src/app/preview/layout.tsx +13 -0
  13. package/src/app/preview/mail/page.tsx +4 -0
  14. package/src/app/preview/pricing/page.tsx +4 -0
  15. package/src/app/preview/typography/page.tsx +11 -0
  16. package/src/app/providers.tsx +49 -0
  17. package/src/components/Foundations/Colors.stories.tsx +85 -0
  18. package/src/components/Foundations/Motion.stories.tsx +169 -0
  19. package/src/components/Foundations/Radius.stories.tsx +36 -0
  20. package/src/components/Foundations/Shadows.stories.tsx +30 -0
  21. package/src/components/Foundations/Spacing.stories.tsx +35 -0
  22. package/src/components/Foundations/Typography.stories.tsx +68 -0
  23. package/src/components/bads-update-banner.tsx +120 -0
  24. package/src/components/customize/design-controls.tsx +165 -0
  25. package/src/components/customize/font-pickers.tsx +118 -0
  26. package/src/components/customize/letter-spacing.tsx +105 -0
  27. package/src/components/customize/save-bar.tsx +379 -0
  28. package/src/components/customize/theme-io.tsx +245 -0
  29. package/src/components/customize/type-scale.tsx +134 -0
  30. package/src/components/customize-tab.tsx +502 -0
  31. package/src/components/home-tab.tsx +1227 -0
  32. package/src/components/layers-tab.tsx +225 -0
  33. package/src/components/ui/alert.tsx +5 -1
  34. package/src/hooks/use-global-design-controls.ts +117 -0
  35. package/src/hooks/use-global-mono-font.ts +73 -0
  36. package/src/hooks/use-global-primary-color.ts +544 -0
  37. package/src/hooks/use-global-sans-font.ts +98 -0
  38. package/src/hooks/use-global-serif-font.ts +77 -0
  39. package/src/hooks/use-global-theme.ts +259 -0
  40. package/src/hooks/use-global-type-scale.ts +141 -0
  41. package/src/hooks/use-sync-type-scale.ts +51 -0
  42. package/src/hooks/use-token-overrides.ts +98 -0
  43. package/src/styles.css +20 -5
  44. package/src/tokens.json +5 -5
@@ -0,0 +1,24 @@
1
+ "use client";
2
+
3
+ import { useSearchParams } from "next/navigation";
4
+ import { Suspense, useEffect } from "react";
5
+
6
+ function DarkModeHandler() {
7
+ const searchParams = useSearchParams();
8
+ const isDark = searchParams.get("dark") === "1";
9
+
10
+ useEffect(() => {
11
+ document.documentElement.classList.toggle("dark", isDark);
12
+ }, [isDark]);
13
+
14
+ return null;
15
+ }
16
+
17
+ export default function DarkModeClient({ children }: { children: React.ReactNode }) {
18
+ return (
19
+ <Suspense>
20
+ <DarkModeHandler />
21
+ {children}
22
+ </Suspense>
23
+ );
24
+ }
@@ -0,0 +1,4 @@
1
+ import Dashboard from "@/components/examples/dashboard";
2
+ export default function DashboardPreview() {
3
+ return <Dashboard />;
4
+ }
@@ -0,0 +1,36 @@
1
+ "use client";
2
+
3
+ import { useGlobalSansFont } from "@behavioral-agentic-design-system/core/hooks/use-global-sans-font";
4
+ import { useGlobalSerifFont } from "@behavioral-agentic-design-system/core/hooks/use-global-serif-font";
5
+ import { useGlobalMonoFont } from "@behavioral-agentic-design-system/core/hooks/use-global-mono-font";
6
+ import { useGlobalPrimaryColor } from "@behavioral-agentic-design-system/core/hooks/use-global-primary-color";
7
+ import { useTokenOverrides } from "@behavioral-agentic-design-system/core/hooks/use-token-overrides";
8
+ import { useGlobalDesignControls } from "@behavioral-agentic-design-system/core/hooks/use-global-design-controls";
9
+ import { useGlobalTypeScale } from "@behavioral-agentic-design-system/core/hooks/use-global-type-scale";
10
+ import { useSyncTypeScale } from "@behavioral-agentic-design-system/core/hooks/use-sync-type-scale";
11
+
12
+ /**
13
+ * Iframe-side mirror of GlobalThemeSync (see app/providers.tsx). Every hook
14
+ * mounted here ALSO needs to be mounted in providers.tsx — they're the same
15
+ * set, just running in two trees (parent app + each preview iframe).
16
+ *
17
+ * If you add a hook to providers but not here, the iframe previews
18
+ * (Components / Cards / Dashboard / Mail / Pricing) won't pick it up — the
19
+ * hook's value will only apply when the user opens a tab whose component
20
+ * tree happens to include the picker for it.
21
+ *
22
+ * Order rule: useTokenOverrides FIRST. Anything before it gets wiped by
23
+ * clearManagedInlineThemeProperties. See providers.tsx for the full
24
+ * explanation.
25
+ */
26
+ export default function GlobalFontClient() {
27
+ useTokenOverrides();
28
+ useSyncTypeScale();
29
+ useGlobalSansFont();
30
+ useGlobalSerifFont();
31
+ useGlobalMonoFont();
32
+ useGlobalPrimaryColor();
33
+ useGlobalDesignControls();
34
+ useGlobalTypeScale();
35
+ return null;
36
+ }
@@ -0,0 +1,13 @@
1
+ import "@/styles/globals.css";
2
+ import { TooltipProvider } from "@behavioral-agentic-design-system/core/components/ui/tooltip";
3
+ import DarkModeClient from "./dark-mode-client";
4
+ import GlobalFontClient from "./global-font-client";
5
+
6
+ export default function PreviewLayout({ children }: { children: React.ReactNode }) {
7
+ return (
8
+ <TooltipProvider>
9
+ <GlobalFontClient />
10
+ <DarkModeClient>{children}</DarkModeClient>
11
+ </TooltipProvider>
12
+ );
13
+ }
@@ -0,0 +1,4 @@
1
+ import Mail from "@/components/examples/mail";
2
+ export default function MailPreview() {
3
+ return <Mail />;
4
+ }
@@ -0,0 +1,4 @@
1
+ import Pricing from "@/components/examples/pricing/pricing";
2
+ export default function PricingPreview() {
3
+ return <Pricing />;
4
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import dynamic from "next/dynamic";
4
+
5
+ const TypographyDemo = dynamic(() => import("@/components/examples/typography/typography-demo"), {
6
+ ssr: false,
7
+ });
8
+
9
+ export default function TypographyPreview() {
10
+ return <TypographyDemo />;
11
+ }
@@ -0,0 +1,49 @@
1
+ "use client";
2
+
3
+ import { TooltipProvider } from "@behavioral-agentic-design-system/core/components/ui/tooltip";
4
+ import { useGlobalSansFont } from "@behavioral-agentic-design-system/core/hooks/use-global-sans-font";
5
+ import { useGlobalSerifFont } from "@behavioral-agentic-design-system/core/hooks/use-global-serif-font";
6
+ import { useGlobalMonoFont } from "@behavioral-agentic-design-system/core/hooks/use-global-mono-font";
7
+ import { useGlobalPrimaryColor } from "@behavioral-agentic-design-system/core/hooks/use-global-primary-color";
8
+ import { useTokenOverrides } from "@behavioral-agentic-design-system/core/hooks/use-token-overrides";
9
+ import { useGlobalDesignControls } from "@behavioral-agentic-design-system/core/hooks/use-global-design-controls";
10
+ import { useGlobalTypeScale } from "@behavioral-agentic-design-system/core/hooks/use-global-type-scale";
11
+ import { useSyncTypeScale } from "@behavioral-agentic-design-system/core/hooks/use-sync-type-scale";
12
+
13
+ /**
14
+ * Global theme sync — runs every "set CSS variable on mount" hook in one
15
+ * place so the picks the user made (font, color, radius, type scale, etc.)
16
+ * apply on every page load, not just inside the Customize tab.
17
+ *
18
+ * RULES for adding a new global state hook:
19
+ * 1. The hook should read its value from localStorage on mount and apply it
20
+ * to documentElement.style.
21
+ * 2. Mount it in BOTH this component AND app/preview/global-font-client.tsx
22
+ * so it works inside iframe previews too. (Forgetting the iframe one was
23
+ * the "Dashboard / Cards font is wrong" bug.)
24
+ * 3. Mount it AFTER useTokenOverrides. That hook calls
25
+ * clearManagedInlineThemeProperties which strips --font-sans / -serif /
26
+ * -mono, --radius, --spacing, and theme color keys from
27
+ * documentElement.style. Anything set before useTokenOverrides gets
28
+ * wiped; anything after sticks.
29
+ */
30
+ function GlobalThemeSync() {
31
+ useTokenOverrides();
32
+ useSyncTypeScale();
33
+ useGlobalSansFont();
34
+ useGlobalSerifFont();
35
+ useGlobalMonoFont();
36
+ useGlobalPrimaryColor();
37
+ useGlobalDesignControls();
38
+ useGlobalTypeScale();
39
+ return null;
40
+ }
41
+
42
+ export default function Providers({ children }: { children: React.ReactNode }) {
43
+ return (
44
+ <TooltipProvider>
45
+ <GlobalThemeSync />
46
+ {children}
47
+ </TooltipProvider>
48
+ );
49
+ }
@@ -0,0 +1,85 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta: Meta = {
4
+ title: "Foundations/Colors",
5
+ parameters: { layout: "fullscreen" },
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+
10
+ const GROUPS: Record<string, { name: string; var: string; bg: string; fg?: string }[]> = {
11
+ "Primary": [
12
+ { name: "Background", var: "--background", bg: "bg-background", fg: "text-foreground" },
13
+ { name: "Foreground", var: "--foreground", bg: "bg-foreground", fg: "text-background" },
14
+ { name: "Primary", var: "--primary", bg: "bg-primary", fg: "text-primary-foreground" },
15
+ { name: "Primary FG", var: "--primary-foreground", bg: "bg-primary-foreground", fg: "text-primary" },
16
+ ],
17
+ "Secondary & Accent": [
18
+ { name: "Secondary", var: "--secondary", bg: "bg-secondary", fg: "text-secondary-foreground" },
19
+ { name: "Secondary FG", var: "--secondary-foreground", bg: "bg-secondary-foreground", fg: "text-secondary" },
20
+ { name: "Accent", var: "--accent", bg: "bg-accent", fg: "text-accent-foreground" },
21
+ { name: "Accent FG", var: "--accent-foreground", bg: "bg-accent-foreground", fg: "text-accent" },
22
+ ],
23
+ "UI Surfaces": [
24
+ { name: "Card", var: "--card", bg: "bg-card", fg: "text-card-foreground" },
25
+ { name: "Card FG", var: "--card-foreground", bg: "bg-card-foreground", fg: "text-card" },
26
+ { name: "Popover", var: "--popover", bg: "bg-popover", fg: "text-popover-foreground" },
27
+ { name: "Popover FG", var: "--popover-foreground", bg: "bg-popover-foreground", fg: "text-popover" },
28
+ { name: "Muted", var: "--muted", bg: "bg-muted", fg: "text-muted-foreground" },
29
+ { name: "Muted FG", var: "--muted-foreground", bg: "bg-muted-foreground", fg: "text-muted" },
30
+ ],
31
+ "Utility": [
32
+ { name: "Border", var: "--border", bg: "bg-border" },
33
+ { name: "Input", var: "--input", bg: "bg-input" },
34
+ { name: "Ring", var: "--ring", bg: "bg-ring" },
35
+ ],
36
+ "Status": [
37
+ { name: "Destructive", var: "--destructive", bg: "bg-destructive", fg: "text-destructive-foreground" },
38
+ { name: "Destructive FG", var: "--destructive-foreground", bg: "bg-destructive-foreground", fg: "text-destructive" },
39
+ ],
40
+ "Charts": [
41
+ { name: "Chart 1", var: "--chart-1", bg: "bg-chart-1", fg: "text-white" },
42
+ { name: "Chart 2", var: "--chart-2", bg: "bg-chart-2", fg: "text-white" },
43
+ { name: "Chart 3", var: "--chart-3", bg: "bg-chart-3", fg: "text-white" },
44
+ { name: "Chart 4", var: "--chart-4", bg: "bg-chart-4", fg: "text-white" },
45
+ { name: "Chart 5", var: "--chart-5", bg: "bg-chart-5", fg: "text-white" },
46
+ ],
47
+ "Sidebar": [
48
+ { name: "Sidebar", var: "--sidebar", bg: "bg-sidebar", fg: "text-sidebar-foreground" },
49
+ { name: "Sidebar FG", var: "--sidebar-foreground", bg: "bg-sidebar-foreground", fg: "text-sidebar" },
50
+ { name: "Sidebar Primary", var: "--sidebar-primary", bg: "bg-sidebar-primary", fg: "text-sidebar-primary-foreground" },
51
+ { name: "Sidebar Primary FG", var: "--sidebar-primary-foreground", bg: "bg-sidebar-primary-foreground", fg: "text-sidebar-primary" },
52
+ { name: "Sidebar Accent", var: "--sidebar-accent", bg: "bg-sidebar-accent", fg: "text-sidebar-accent-foreground" },
53
+ { name: "Sidebar Accent FG", var: "--sidebar-accent-foreground", bg: "bg-sidebar-accent-foreground", fg: "text-sidebar-accent" },
54
+ { name: "Sidebar Border", var: "--sidebar-border", bg: "bg-sidebar-border" },
55
+ { name: "Sidebar Ring", var: "--sidebar-ring", bg: "bg-sidebar-ring" },
56
+ ],
57
+ };
58
+
59
+ function Swatch({ name, var: v, bg, fg }: { name: string; var: string; bg: string; fg?: string }) {
60
+ return (
61
+ <div className="flex flex-col">
62
+ <div className={`h-20 rounded-lg border border-border ${bg} ${fg ?? ""} flex items-end p-2.5`}>
63
+ <span className="text-sm font-medium">{name}</span>
64
+ </div>
65
+ <p className="text-xs text-muted-foreground font-mono mt-1.5">{v}</p>
66
+ </div>
67
+ );
68
+ }
69
+
70
+ export const All: Story = {
71
+ render: () => (
72
+ <div className="p-8 space-y-8 bg-background">
73
+ {Object.entries(GROUPS).map(([title, swatches]) => (
74
+ <section key={title}>
75
+ <h3 className="text-sm font-semibold text-muted-foreground mb-3">{title}</h3>
76
+ <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3">
77
+ {swatches.map((s) => (
78
+ <Swatch key={s.var} {...s} />
79
+ ))}
80
+ </div>
81
+ </section>
82
+ ))}
83
+ </div>
84
+ ),
85
+ };
@@ -0,0 +1,169 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { useState } from "react";
3
+
4
+ const meta: Meta = {
5
+ title: "Foundations/Motion",
6
+ parameters: { layout: "fullscreen" },
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+
11
+ const DURATIONS = [
12
+ { name: "fast", value: "150ms", note: "Hovers, focus rings, micro-feedback" },
13
+ { name: "base", value: "200ms", note: "Default for opens/closes, theme swaps" },
14
+ { name: "slow", value: "300ms", note: "Sheets, dialogs, larger surface motion" },
15
+ ];
16
+
17
+ const EASINGS = [
18
+ {
19
+ name: "ease-in",
20
+ value: "cubic-bezier(0.4, 0, 1, 1)",
21
+ note: "Exit motion (element leaving screen)",
22
+ },
23
+ {
24
+ name: "ease-out",
25
+ value: "cubic-bezier(0, 0, 0.2, 1)",
26
+ note: "Entrance motion (element arriving)",
27
+ },
28
+ {
29
+ name: "ease-in-out",
30
+ value: "cubic-bezier(0.4, 0, 0.2, 1)",
31
+ note: "In-place motion (toggles, transitions)",
32
+ },
33
+ {
34
+ name: "ease-spring",
35
+ value: "cubic-bezier(0.34, 1.56, 0.64, 1)",
36
+ note: "Playful overshoot (drag-drop, success states)",
37
+ },
38
+ ];
39
+
40
+ function DemoBox({
41
+ duration,
42
+ easing,
43
+ trigger,
44
+ }: {
45
+ duration: string;
46
+ easing: string;
47
+ trigger: number;
48
+ }) {
49
+ return (
50
+ <div
51
+ key={trigger}
52
+ className="h-12 w-12 rounded-md bg-primary"
53
+ style={{
54
+ transition: `transform ${duration} ${easing}`,
55
+ transform: trigger % 2 === 0 ? "translateX(0)" : "translateX(180px)",
56
+ }}
57
+ />
58
+ );
59
+ }
60
+
61
+ export const Durations: Story = {
62
+ render: () => {
63
+ const [tick, setTick] = useState(0);
64
+ return (
65
+ <div className="p-8 bg-background">
66
+ <div className="flex items-baseline justify-between mb-6">
67
+ <h3 className="text-sm font-semibold text-muted-foreground">Duration scale</h3>
68
+ <button
69
+ type="button"
70
+ onClick={() => setTick((t) => t + 1)}
71
+ className="text-sm font-medium underline underline-offset-4 hover:text-primary"
72
+ >
73
+ Replay
74
+ </button>
75
+ </div>
76
+ <div className="space-y-6">
77
+ {DURATIONS.map((d) => (
78
+ <div key={d.name} className="flex items-center gap-6">
79
+ <div className="w-32 shrink-0">
80
+ <code className="text-xs font-mono text-foreground">--duration-{d.name}</code>
81
+ <p className="text-xs text-muted-foreground font-mono mt-0.5">{d.value}</p>
82
+ </div>
83
+ <div className="relative h-12 flex-1 max-w-[260px]">
84
+ <DemoBox duration={d.value} easing="cubic-bezier(0, 0, 0.2, 1)" trigger={tick} />
85
+ </div>
86
+ <p className="text-sm text-muted-foreground">{d.note}</p>
87
+ </div>
88
+ ))}
89
+ </div>
90
+ </div>
91
+ );
92
+ },
93
+ };
94
+
95
+ export const Easings: Story = {
96
+ render: () => {
97
+ const [tick, setTick] = useState(0);
98
+ return (
99
+ <div className="p-8 bg-background">
100
+ <div className="flex items-baseline justify-between mb-6">
101
+ <h3 className="text-sm font-semibold text-muted-foreground">Easing curves</h3>
102
+ <button
103
+ type="button"
104
+ onClick={() => setTick((t) => t + 1)}
105
+ className="text-sm font-medium underline underline-offset-4 hover:text-primary"
106
+ >
107
+ Replay
108
+ </button>
109
+ </div>
110
+ <div className="space-y-6">
111
+ {EASINGS.map((e) => (
112
+ <div key={e.name} className="flex items-center gap-6">
113
+ <div className="w-40 shrink-0">
114
+ <code className="text-xs font-mono text-foreground">--{e.name}</code>
115
+ <p className="text-xs text-muted-foreground font-mono mt-0.5 truncate">
116
+ {e.value}
117
+ </p>
118
+ </div>
119
+ <div className="relative h-12 flex-1 max-w-[260px]">
120
+ <DemoBox duration="600ms" easing={e.value} trigger={tick} />
121
+ </div>
122
+ <p className="text-sm text-muted-foreground">{e.note}</p>
123
+ </div>
124
+ ))}
125
+ </div>
126
+ </div>
127
+ );
128
+ },
129
+ };
130
+
131
+ export const ReducedMotion: Story = {
132
+ parameters: {
133
+ docs: {
134
+ description: {
135
+ story:
136
+ "All motion in BADS collapses at the token layer when prefers-reduced-motion is set. Toggle reduced motion in your OS settings to verify — animations should snap to their end state instantly.",
137
+ },
138
+ },
139
+ },
140
+ render: () => {
141
+ const [tick, setTick] = useState(0);
142
+ return (
143
+ <div className="p-8 bg-background">
144
+ <h3 className="text-sm font-semibold text-muted-foreground mb-2">Reduced motion</h3>
145
+ <p className="text-sm text-muted-foreground mb-6 max-w-prose">
146
+ With <code className="text-xs">prefers-reduced-motion: reduce</code>, this should jump
147
+ instantly. Otherwise it animates at <code className="text-xs">--duration-base</code>.
148
+ </p>
149
+ <button
150
+ type="button"
151
+ onClick={() => setTick((t) => t + 1)}
152
+ className="text-sm font-medium underline underline-offset-4 hover:text-primary mb-4"
153
+ >
154
+ Replay
155
+ </button>
156
+ <style>{`
157
+ @media (prefers-reduced-motion: no-preference) {
158
+ .reduced-motion-demo { transition: transform 200ms cubic-bezier(0, 0, 0.2, 1); }
159
+ }
160
+ `}</style>
161
+ <div
162
+ key={tick}
163
+ className="reduced-motion-demo h-12 w-12 rounded-md bg-primary"
164
+ style={{ transform: tick % 2 === 0 ? "translateX(0)" : "translateX(220px)" }}
165
+ />
166
+ </div>
167
+ );
168
+ },
169
+ };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta: Meta = {
4
+ title: "Foundations/Radius",
5
+ parameters: { layout: "fullscreen" },
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+
10
+ const RADII = [
11
+ { name: "radius-sm", v: "var(--radius-sm)", note: "Tight UI corners (chips, micro inputs)" },
12
+ { name: "radius-md", v: "var(--radius-md)", note: "Most controls (buttons, inputs)" },
13
+ { name: "radius-lg", v: "var(--radius-lg)", note: "Cards, dialogs (also raw --radius)" },
14
+ { name: "radius-xl", v: "var(--radius-xl)", note: "Hero surfaces, marketing panels" },
15
+ ];
16
+
17
+ export const Scale: Story = {
18
+ render: () => (
19
+ <div className="p-8 bg-background">
20
+ <h3 className="text-sm font-semibold text-muted-foreground mb-6">Radius scale</h3>
21
+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-6">
22
+ {RADII.map((r) => (
23
+ <div key={r.name} className="flex flex-col items-center gap-3">
24
+ <div
25
+ className="h-20 w-20 bg-primary"
26
+ style={{ borderRadius: r.v }}
27
+ aria-hidden="true"
28
+ />
29
+ <code className="font-mono text-xs">{r.name}</code>
30
+ <p className="text-xs text-muted-foreground text-center max-w-[14ch]">{r.note}</p>
31
+ </div>
32
+ ))}
33
+ </div>
34
+ </div>
35
+ ),
36
+ };
@@ -0,0 +1,30 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta: Meta = {
4
+ title: "Foundations/Shadows",
5
+ parameters: { layout: "fullscreen" },
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+
10
+ const SHADOWS = ["2xs", "xs", "sm", "default", "md", "lg", "xl", "2xl"];
11
+
12
+ export const Scale: Story = {
13
+ render: () => (
14
+ <div className="p-8 bg-background">
15
+ <h3 className="text-sm font-semibold text-muted-foreground mb-6">Shadow scale</h3>
16
+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-8 p-6">
17
+ {SHADOWS.map((s) => (
18
+ <div key={s} className="flex flex-col items-center gap-3">
19
+ <div
20
+ className="h-20 w-20 rounded-md bg-card border border-border"
21
+ style={{ boxShadow: s === "default" ? "var(--shadow)" : `var(--shadow-${s})` }}
22
+ aria-hidden="true"
23
+ />
24
+ <code className="font-mono text-xs">shadow{s === "default" ? "" : `-${s}`}</code>
25
+ </div>
26
+ ))}
27
+ </div>
28
+ </div>
29
+ ),
30
+ };
@@ -0,0 +1,35 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta: Meta = {
4
+ title: "Foundations/Spacing",
5
+ parameters: { layout: "fullscreen" },
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+
10
+ const STEPS = [1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24];
11
+
12
+ export const Scale: Story = {
13
+ render: () => (
14
+ <div className="p-8 bg-background">
15
+ <h3 className="text-sm font-semibold text-muted-foreground mb-6">
16
+ Spacing scale (multiplier × <code className="font-mono">--spacing</code>)
17
+ </h3>
18
+ <div className="space-y-3">
19
+ {STEPS.map((step) => (
20
+ <div key={step} className="flex items-center gap-4">
21
+ <code className="font-mono text-xs text-muted-foreground w-12 shrink-0">{step}</code>
22
+ <div
23
+ className="h-4 bg-primary rounded-sm"
24
+ style={{ width: `calc(var(--spacing) * ${step})` }}
25
+ aria-hidden="true"
26
+ />
27
+ <span className="text-xs text-muted-foreground font-mono">
28
+ {(0.25 * step).toFixed(2)}rem default
29
+ </span>
30
+ </div>
31
+ ))}
32
+ </div>
33
+ </div>
34
+ ),
35
+ };
@@ -0,0 +1,68 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ const meta: Meta = {
4
+ title: "Foundations/Typography",
5
+ parameters: { layout: "fullscreen" },
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+
10
+ const SCALE = [
11
+ { name: "text-xs", className: "text-xs", note: "Captions, fine print (14px floor)" },
12
+ { name: "text-sm", className: "text-sm", note: "Helper text, labels (16px)" },
13
+ { name: "text-base", className: "text-base", note: "Body (18px)" },
14
+ { name: "text-lg", className: "text-lg", note: "Lead, emphasis (20px)" },
15
+ { name: "text-xl", className: "text-xl", note: "Card titles (24px)" },
16
+ { name: "text-2xl", className: "text-2xl", note: "Section headers (28px)" },
17
+ { name: "text-3xl", className: "text-3xl", note: "Page titles (32px)" },
18
+ ];
19
+
20
+ export const Scale: Story = {
21
+ render: () => (
22
+ <div className="p-8 space-y-6 bg-background text-foreground">
23
+ <h3 className="text-sm font-semibold text-muted-foreground">Type scale</h3>
24
+ <div className="space-y-5">
25
+ {SCALE.map((s) => (
26
+ <div key={s.name} className="flex items-baseline gap-6 border-b border-border pb-4">
27
+ <code className="font-mono text-xs text-muted-foreground w-24 shrink-0">{s.name}</code>
28
+ <div className="flex-1">
29
+ <p className={s.className}>The quick brown fox jumps over the lazy dog</p>
30
+ <p className="text-xs text-muted-foreground mt-1">{s.note}</p>
31
+ </div>
32
+ </div>
33
+ ))}
34
+ </div>
35
+ </div>
36
+ ),
37
+ };
38
+
39
+ export const Families: Story = {
40
+ render: () => (
41
+ <div className="p-8 space-y-8 bg-background text-foreground">
42
+ <h3 className="text-sm font-semibold text-muted-foreground">Font families</h3>
43
+ <div className="space-y-6">
44
+ <div>
45
+ <code className="font-mono text-xs text-muted-foreground">--font-sans</code>
46
+ <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-sans)" }}>
47
+ The quick brown fox jumps over the lazy dog
48
+ </p>
49
+ <p className="text-base mt-2" style={{ fontFamily: "var(--font-sans)" }}>
50
+ Body weight. Aa Bb Cc 0123456789
51
+ </p>
52
+ </div>
53
+ <div>
54
+ <code className="font-mono text-xs text-muted-foreground">--font-serif</code>
55
+ <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-serif)" }}>
56
+ The quick brown fox jumps over the lazy dog
57
+ </p>
58
+ </div>
59
+ <div>
60
+ <code className="font-mono text-xs text-muted-foreground">--font-mono</code>
61
+ <p className="text-3xl mt-2" style={{ fontFamily: "var(--font-mono)" }}>
62
+ The quick brown fox 0123456789
63
+ </p>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ ),
68
+ };