Files
HiveGrid-Wireframes/hivegrid-cloud/apps/storybook/.storybook/preview.css
T

181 lines
5.9 KiB
CSS

/*
* Storybook preview stylesheet.
*
* Layered as:
* 1. `@import "tailwindcss"` — pulls the full Tailwind v4 runtime via the
* @tailwindcss/vite plugin wired in `.storybook/main.ts`. This unlocks
* Tailwind utility classes inside stories that import real
* `packages/ui` / `apps/web` components. Today's 21 stories use inline
* styles + the CSS-variable tokens declared further down, so the
* Tailwind import is additive — no visual change to existing stories.
* 2. `@custom-variant dark` — mirrors apps/web/app/globals.css so the
* `dark:` utility flips alongside the `.dark` root class that
* `withThemeByClassName` applies from the theme toolbar global.
* 3. The CSS-variable token block below — the design-token surface the
* existing demo primitives (`_demo-primitives.tsx`) read via
* `var(--color-primary)` etc. Kept verbatim so the 21 in-flight
* stories stay visually stable while the real-component migration
* ramps up (#62 follow-up).
*
* The web app's full theme (HSL channel system, Tremor palette, typography
* scale) lives in apps/web/app/globals.css; we keep the Storybook surface
* intentionally narrow so the preview builds quickly and stays readable.
*/
@import "tailwindcss";
/*
* Subframe design-system theme + content sources.
* Storybook runs its own Tailwind-v4 pipeline rooted at apps/storybook, so it neither loads
* the Subframe theme tokens nor scans the Subframe component files in apps/web/app. Without
* these, Subframe-backed components (Button, TextInput, …) render unstyled here and in
* lostpixel visual regression. Mirror apps/web/app/globals.css's Subframe wiring.
*/
@import "../../../apps/web/app/ui/theme.css";
@source "../../../apps/web/app/ui";
@source "../../../apps/web/app/components/ui";
@custom-variant dark (&:is(.dark *));
/*
* apps/web design-token surface (#62 follow-up).
*
* Mirrors apps/web/app/globals.css so real shadcn components imported from
* apps/web/app/components/ui resolve `bg-primary`, `text-foreground`,
* `border-border`, etc. The HSL channel system + `@theme inline` mapping is
* load-bearing for the cva variants in those components.
*
* The legacy `--color-bg`/`--color-fg`/etc. block at the bottom is kept for
* backward compatibility with un-migrated demo primitives.
*/
:root {
--background: hsl(0 0% 100%);
--foreground: hsl(240 10% 3.9%);
--muted: hsl(240 4.8% 95.9%);
--muted-foreground: hsl(240 3.8% 46.1%);
--popover: hsl(0 0% 100%);
--popover-foreground: hsl(240 10% 3.9%);
--card: hsl(0 0% 100%);
--card-foreground: hsl(240 10% 3.9%);
--border: hsl(240 5.9% 90%);
--input: hsl(240 5.9% 90%);
--primary: hsl(240 5.9% 10%);
--primary-foreground: hsl(0 0% 98%);
--secondary: hsl(240 4.8% 95.9%);
--secondary-foreground: hsl(240 5.9% 10%);
--accent: hsl(240 4.8% 95.9%);
--accent-foreground: hsl(240 5.9% 10%);
--destructive: hsl(0 84.2% 60.2%);
--destructive-foreground: hsl(0 0% 98%);
--ring: hsl(240 5.9% 10%);
--radius: 0.5rem;
/* Legacy demo-primitive tokens (kept for un-migrated stories). */
--color-bg: #ffffff;
--color-fg: #0f172a;
--color-muted: #64748b;
--color-border: #e2e8f0;
--color-success: #16a34a;
--color-warning: #d97706;
color-scheme: light;
}
.dark {
--background: hsl(240 10% 3.9%);
--foreground: hsl(0 0% 98%);
--muted: hsl(240 3.7% 15.9%);
--muted-foreground: hsl(240 5% 64.9%);
--popover: hsl(240 10% 3.9%);
--popover-foreground: hsl(0 0% 98%);
--card: hsl(240 10% 3.9%);
--card-foreground: hsl(0 0% 98%);
--border: hsl(240 3.7% 15.9%);
--input: hsl(240 3.7% 15.9%);
--primary: hsl(0 0% 98%);
--primary-foreground: hsl(240 5.9% 10%);
--secondary: hsl(240 3.7% 15.9%);
--secondary-foreground: hsl(0 0% 98%);
--accent: hsl(240 3.7% 15.9%);
--accent-foreground: hsl(0 0% 98%);
--destructive: hsl(0 62.8% 30.6%);
--destructive-foreground: hsl(0 0% 98%);
--ring: hsl(240 4.9% 83.9%);
/* Legacy demo-primitive tokens (kept for un-migrated stories). */
--color-bg: #0b0b0c;
--color-fg: #f8fafc;
--color-muted: #94a3b8;
--color-border: #1f2937;
color-scheme: dark;
}
@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
}
html,
body {
background: var(--color-bg);
color: var(--color-fg);
font-family:
Inter,
ui-sans-serif,
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
margin: 0;
}
/*
* Coarse Tailwind-like helpers retained so the preview's `withWrapper`
* decorator works even if a story disables the Tailwind pipeline via
* `parameters.tailwind.disable` (escape hatch — none in use today). When
* the Tailwind v4 plugin is active these are shadowed by the real utility
* generation, so removing them is safe once we're confident no stories
* rely on the bespoke definitions.
*/
.font-sans {
font-family:
Inter,
ui-sans-serif,
system-ui,
sans-serif;
}
.text-sm {
font-size: 0.875rem;
}
.text-foreground {
color: var(--color-fg);
}
.bg-background {
background: var(--color-bg);
}
.min-h-\[60px\] {
min-height: 60px;
}
.p-6 {
padding: 1.5rem;
}