🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update .gitignore to include design-sync related directories and files for better project organization.
Bill Yang3b04c4b6adc5
diff --git a/.design-sync/AUTHORING.md b/.design-sync/AUTHORING.mdnew file mode 100644index 000000000..59488fb90--- /dev/null+++ b/.design-sync/AUTHORING.md@@ -0,0 +1,65 @@+# design-sync preview authoring brief (shared by every batch agent)++Repo root: /Users/bill/Desktop/rybbit. You are authoring preview cards + usage docs for Rybbit's+shadcn-style UI kit so a design agent (claude.ai/design) can build on-brand dashboards with the REAL+components. Rybbit = open-source, privacy-friendly web analytics (dark-mode-first instrument panel:+neutral grays, ONE emerald accent for primary actions/success, periwinkle for chart data). Read+/Users/bill/Desktop/rybbit/DESIGN.md sections 1-3 once for the voice.++## What exists+- Component sources: client/src/components/ui/<kebab-name>.tsx. Read each one you own: parts,+ variants (cva), props. Every part is a flat named export of the "@rybbit/ui" facade+ (e.g. Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel).+ BasicTabs family is exported as BasicTabs/BasicTabsList/BasicTabsTrigger/BasicTabsContent.+- Every preview is auto-wrapped in <RybbitTheme> (dark class on <html> + wrapper, Inter font,+ bg-background, TooltipProvider). Don't add providers yourself.+- Worked examples that already grade "good": .design-sync/previews/Button.tsx, Dialog.tsx, Table.tsx+ and docs .design-sync/docs/Button.md, Dialog.md, Table.md. Match their style.+- Compiled CSS = the app's Tailwind v4 build, scanned over client/src (+ previews at FULL rebuild+ only). preview-rebuild does NOT recompile CSS, so prefer utilities the app already uses+ (flex, grid, gap-*, p-*, w-*, max-w-*, text-*, rounded-lg, border-neutral-800, bg-neutral-900…).+ If a utility visibly has no effect, note it in your learnings file and use a common one.++## Deliverables per component <Name>+1. `.design-sync/previews/<Name>.tsx` — named exports, each a React component (function), realistic+ Rybbit content (sites like tomato.gg / rybbit.com, pages, visitors, sessions, goals, funnels,+ countries, browsers — never foo/bar/lorem). 2-6 exports: one canonical story, the main variant+ axis swept, static states (disabled/error/loading/checked/open), realistic composition for+ compounds. Wrap each story's root in a padded container, e.g. `<div className="p-4 w-[420px]">`+ (or w-full / max-w-md), so the dark panel has breathing room. Imports allowed: "react",+ "@rybbit/ui", "lucide-react", "react-hook-form" (Form only). Overlays render OPEN+ (`open` / `defaultOpen`, Tooltip `open`); states that can't render statically (hover, drag) are+ skipped — say so in the doc.+2. `.design-sync/docs/<Name>.md` — frontmatter `---\ncategory: <Category>\n---` (category given+ per component below), then: one paragraph what/when; the parts and their roles (flat export+ names); conventions (variants, sizes, when to use vs. siblings); ONE tsx example ≤ 30 lines.+ This body becomes the design agent's whole usage reference (it replaces auto examples), so be+ concrete and name real exports/props only.+3. Grade file `.design-sync/.cache/review/<Name>.grade.json`:+ `{"cells":{"<ExportName>":{"verdict":"good"|"needs-work","note":"..."}}}` — keys = export+ names exactly (the capture log prints them).++## Loop (per component or per batch)+```+cd /Users/bill/Desktop/rybbit+node .ds-sync/lib/preview-rebuild.mjs --config .design-sync/config.json --node-modules client/node_modules --out ./ds-bundle --components A,B,C+node .ds-sync/package-capture.mjs --out ./ds-bundle --components A,B,C+```+Then Read `ds-bundle/_screenshots/review/*__<Name>.png` (group prefix may be "general" until the+orchestrator's full rebuild — use the glob) and grade on the absolute rubric: Styled (Rybbit+tokens/Inter visibly applied, dark panel), Complete (nothing collapsed/missing/error cell "⚠"),+Plausible (a Rybbit engineer would recognize it). `needs-work` → fix the .tsx → rebuild →+recapture → regrade, until every cell is `good` (cap ~4 iterations; if still stuck, leave it+needs-work with a precise note). A cell whose compile failed shows in the rebuild log as+`! preview build failed: <Name>` — fix the TSX. Never grade a sheet you haven't Read this iteration.++## Hard rules+- Edit ONLY your assigned previews/<Name>.tsx, docs/<Name>.md, your grade files, and+ `.design-sync/learnings/<BATCH>.md`. Never touch config.json, NOTES.md, pkg/, other agents' files.+- NEVER run package-build.mjs, package-validate.mjs, or package-capture without --components.+- Need a config change (cardMode single/column, viewport WxH, a skip)? Write it in your learnings+ file — the orchestrator applies it. Overlay families already have cardMode single + a viewport.+- Same root cause in 2+ components, or anything config-level (provider/css/font/import+ resolution) → STOP on those and report in learnings; that's global.+- Finish with `git status --short .design-sync` and confirm only your files changed. Final+ report: per component, exports + verdicts, and anything the orchestrator must do.diff --git a/.design-sync/NOTES.md b/.design-sync/NOTES.mdnew file mode 100644index 000000000..0abbb2965--- /dev/null+++ b/.design-sync/NOTES.md@@ -0,0 +1,98 @@+# design-sync notes (Rybbit)++Repo-specific facts a future sync needs. Config lives in `config.json`; this file holds the why.++## Shape and layout+- Rybbit is a Next.js app, not a package: the design system is `client/src/components/ui/*.tsx`+ (shadcn new-york style, Tailwind v4, Radix). No Storybook anywhere; shape = `package`.+- `.design-sync/pkg/` is a committed **facade package** (`@rybbit/ui`) built by `node .design-sync/pkg/build.mjs`+ (= `cfg.buildCmd`, run before every converter run):+ - `src/index.ts` barrel: one `export *` per ui file. `basic-tabs` clashes with `tabs` on+ Tabs/TabsList/TabsTrigger/TabsContent, so it's re-exported as `BasicTabs*`.+ - `src/shims/utils.ts` replaces `@/lib/utils` (the real one imports luxon, Avatar, the app store).+ Exports `cn` + `formatter` (input-with-suggestions uses `formatter`). Add here if a ui file+ starts importing something else from `@/lib/utils` (esbuild fails loudly: "No matching export").+ - `src/RybbitTheme.tsx`: the `cfg.provider`. Adds `dark` to `<html>` (portals!) and the wrapper,+ Inter font, `bg-background text-foreground`, wraps `TooltipProvider` (Radix Tooltip throws without it).+ - `src/styles.css`: `@import`s the app's `globals.css`, scans `client/src` + `.design-sync/previews`,+ vendors Inter (`fonts/*.woff2`, copied from `client/.next/static/media` next/font output; latin ++ latin-ext, SIL OFL), and carries a **`@source inline()` safelist** so utilities the app never uses+ (`grid-cols-3`, `bg-card`, `md:` variants, `/20` tints, fractions) still exist for the design+ agent. Output ~650 KB. Trim the safelist if the README size warning ever fires body-side.+ - tsc emits declarations with `rootDir: ../..` → `dist/types/{client,.design-sync}/...`;+ `dist/types/index.d.ts` is the types root (so ts-morph parses the whole tree); `@/` specifiers+ in the emitted d.ts are rewritten to relative paths by build.mjs.+ - `pkg/node_modules` is a symlink to `client/node_modules` created by build.mjs (gitignored).+ - Toolchain: esbuild from `.ds-sync/node_modules` (the staged converter deps); typescript,+ postcss, @tailwindcss/postcss from `client/node_modules`. So `.ds-sync` must be staged ++ installed BEFORE running build.mjs on a fresh clone.+- Converter invocation: `--entry .design-sync/pkg/dist/index.js --node-modules client/node_modules`.+ PKG_DIR resolves to `.design-sync/pkg` (walk-up to the named package.json).+- Cards are **one per family** (39): every PascalCase sub-part (DialogContent, TableRow, …) is+ `null` in `cfg.componentSrcMap` (134 entries) but still ships on `window.Rybbit`. Each family's+ `.design-sync/docs/<Name>.md` lists its parts; a doc body REPLACES the synthesized examples in+ `.prompt.md`, so every doc must carry an example.+- Grouping comes from the docs' `category:` frontmatter (`ui/` is a generic dir name, so+ src-derived groups would all be "general"). Categories: Actions, Forms, Overlays, Navigation,+ Data display, Feedback, Replay.+- `cfg.guidelinesGlob` pulls repo-root `DESIGN.md` + `PRODUCT.md` into `guidelines/`.+- Sub-part exclusion means `Toaster` needs an explicit src pin (`sonner.tsx`).++## Verification harness+- Chromium is cached at `~/Library/Caches/ms-playwright/chromium-1234` (+1228). `[email protected]`+ pins 1234, so `.ds-sync` installs `[email protected]` and no browser download is needed.+ If the cache moves, set `DS_CHROMIUM_PATH` to the executable instead of reinstalling.+- `preview-rebuild.mjs` does NOT recompile the facade CSS; a preview using a utility outside the+ app's usage + safelist only renders after `build.mjs` + a full converter run.++## Preview-authoring learnings (folded from the first-sync batches)+- Authoring brief for future previews: `.design-sync/AUTHORING.md` (what subagents were told; keep it current).+- Overriding a component colour that the component sets with a `dark:` prefix needs a `dark:` prefix too+ (`dark:border-red-400`, `dark:bg-neutral-700`), or the component's own rule wins on specificity.+- Arbitrary values (`w-[420px]`, `aria-[invalid=true]:…`) only exist in the CSS if the app or an authored+ preview uses them at FULL rebuild time; the safelist covers scale values only. Prefer `w-64/72/80/96`,+ `max-w-*`, `grid-cols-*`. `preview-rebuild` never recompiles CSS.+- `[CONFIG_STALE]`: adding `cfg.overrides.<Name>` after a full build blocks `preview-rebuild --components <Name>`+ until the next `package-build.mjs`. Set card modes BEFORE fanning out, or expect the wave to report blocked+ components (first sync: Select, MultiSelect, InputWithSuggestions, DropdownMenu, Toaster).+- Capture clock is pinned to 2024-05-15: Calendar previews use `defaultMonth` May 2024.+- Radix Popover autofocuses its first focusable child → blue browser ring in captures; previews pass+ `onOpenAutoFocus={e => e.preventDefault()}`.+- MultiSelect has no `open` prop (mount effect clicks the combobox); InputWithSuggestions opens on focus+ (mount effect focuses + dispatches `focusin`); NavigationMenu opens statically via `value` on root + item.+- Toaster: react-hot-toast auto-dismisses success at 2s, others at 4s; the preview fires toasts from a+ mount effect, so a capture slower than ~2s loses the Success cell.+- `CommandList` caps at 300px (`max-h-[300px]`): keep palette previews ≤7 rows.+- Slider / TimelineSlider `disabled` looks identical to enabled (the `disabled:` utility sits on a span).+- Solo `?story=` capture bodies are white in emit.mjs; RybbitTheme now paints `<body>` with+ `bg-background text-foreground` (as the app's root layout does), so portalled overlays composite over dark.+- `CardLoader` and `Toaster` read next-themes `useTheme()`: RybbitTheme mounts a forced-theme ThemeProvider.++## Known render warns+- `[TOKENS_MISSING] --card, --card-foreground, --radix-navigation-menu-viewport-height/width`: globals.css+ declares `--color-card: hsl(var(--card))` in `@theme` but never defines `--card` (the app never uses+ `bg-card`); the radix vars are set at runtime by NavigationMenu. Harmless; conventions.md steers the+ agent to `bg-neutral-900` for cards.+- First-sync floor cards flagged `[RENDER_BLANK]` for ActivitySlider/Checkbox/Input/Progress/Slider/+ Textarea/TimelineSlider — gone once previews were authored; a re-sync that drops a preview will+ bring one back.++## Re-sync risks+- Vendored Inter subsets in `pkg/fonts/` are a snapshot of next/font output; if the app changes fonts,+ re-copy from `client/.next/static/media` (the `.p.woff2` = latin) and update `src/styles.css` ranges.+- `.ds-sync/` must be staged + `npm i esbuild ts-morph @types/react [email protected]` (chromium-1234+ cache) BEFORE `build.mjs`, which borrows esbuild from there. A newer chromium cache needs the matching+ playwright or `DS_CHROMIUM_PATH`.+- The safelist in `pkg/src/styles.css` is hand-curated: new token families added to globals.css (a new+ colour role, a new radius) must be appended there or the design agent can't reach them.+- `componentSrcMap` nulls enumerate 134 sub-part exports by name. A NEW ui file with new PascalCase parts+ will surface each part as its own card until its parts are added as `null` (and a `docs/<Name>.md`+ with a `category:` is written) — the `components:` count jumping past 39 is the tell.+- Toaster's Success cell depends on capture finishing within ~2s of load (react-hot-toast auto-dismiss).+- Previews assume the capture clock is pinned to 2024-05-15 (Calendar) and a 720px-wide single-card+ viewport for ResponsiveDialog's dialog branch.+- Capture stamps for AlertDialog/Sheet/Drawer/ResponsiveDialog/Popover/Tooltip were first minted from a+ scratch copy of ds-bundle (batch C worked around [CONFIG_STALE]); they carried forward cleanly on the+ final driver run, so no action — noted only in case a future run reports them as cleared.+- `pkg/build.mjs` runs `tsc` over client sources under `strict`; type errors are printed but do not+ block emit. If `dist/types/.design-sync/pkg/src/index.d.ts` disappears, the build exits 1.diff --git a/.design-sync/config.json b/.design-sync/config.jsonnew file mode 100644index 000000000..b0cf1548a--- /dev/null+++ b/.design-sync/config.json@@ -0,0 +1,257 @@+{+ "projectId": "919373d2-dae3-4b32-b062-a45a4f918356",+ "shape": "package",+ "pkg": "@rybbit/ui",+ "globalName": "Rybbit",+ "entry": ".design-sync/pkg/dist/index.js",+ "buildCmd": "node .design-sync/pkg/build.mjs",+ "srcDir": "../../client/src/components/ui",+ "cssEntry": "dist/styles.css",+ "docsDir": "../docs",+ "provider": {+ "component": "RybbitTheme"+ },+ "componentSrcMap": {+ "Toaster": "../../client/src/components/ui/sonner.tsx",+ "RybbitTheme": null,+ "AlertDescription": null,+ "AlertDialogAction": null,+ "AlertDialogCancel": null,+ "AlertDialogContent": null,+ "AlertDialogDescription": null,+ "AlertDialogFooter": null,+ "AlertDialogHeader": null,+ "AlertDialogOverlay": null,+ "AlertDialogPortal": null,+ "AlertDialogTitle": null,+ "AlertDialogTrigger": null,+ "AlertTitle": null,+ "BasicTabsContent": null,+ "BasicTabsList": null,+ "BasicTabsTrigger": null,+ "BreadcrumbEllipsis": null,+ "BreadcrumbItem": null,+ "BreadcrumbLink": null,+ "BreadcrumbList": null,+ "BreadcrumbPage": null,+ "BreadcrumbSeparator": null,+ "ButtonGroupSeparator": null,+ "ButtonGroupText": null,+ "CalendarDayButton": null,+ "CardContent": null,+ "CardDescription": null,+ "CardFooter": null,+ "CardHeader": null,+ "CardLoader": null,+ "CardTitle": null,+ "CarouselContent": null,+ "CarouselItem": null,+ "CarouselNext": null,+ "CarouselPrevious": null,+ "CommandDialog": null,+ "CommandEmpty": null,+ "CommandGroup": null,+ "CommandInput": null,+ "CommandItem": null,+ "CommandList": null,+ "CommandSeparator": null,+ "CommandShortcut": null,+ "DialogClose": null,+ "DialogContent": null,+ "DialogContentFullScreen": null,+ "DialogDescription": null,+ "DialogFooter": null,+ "DialogHeader": null,+ "DialogOverlay": null,+ "DialogPortal": null,+ "DialogTitle": null,+ "DialogTrigger": null,+ "DrawerClose": null,+ "DrawerContent": null,+ "DrawerDescription": null,+ "DrawerFooter": null,+ "DrawerHeader": null,+ "DrawerOverlay": null,+ "DrawerPortal": null,+ "DrawerTitle": null,+ "DrawerTrigger": null,+ "DropdownMenuCheckboxItem": null,+ "DropdownMenuContent": null,+ "DropdownMenuGroup": null,+ "DropdownMenuItem": null,+ "DropdownMenuLabel": null,+ "DropdownMenuPortal": null,+ "DropdownMenuRadioGroup": null,+ "DropdownMenuRadioItem": null,+ "DropdownMenuSeparator": null,+ "DropdownMenuShortcut": null,+ "DropdownMenuSub": null,+ "DropdownMenuSubContent": null,+ "DropdownMenuSubTrigger": null,+ "DropdownMenuTrigger": null,+ "FormControl": null,+ "FormDescription": null,+ "FormField": null,+ "FormItem": null,+ "FormLabel": null,+ "FormMessage": null,+ "NavigationMenuContent": null,+ "NavigationMenuIndicator": null,+ "NavigationMenuItem": null,+ "NavigationMenuLink": null,+ "NavigationMenuList": null,+ "NavigationMenuTrigger": null,+ "NavigationMenuViewport": null,+ "PopoverAnchor": null,+ "PopoverContent": null,+ "PopoverTrigger": null,+ "RadioGroupItem": null,+ "ResponsiveDialogClose": null,+ "ResponsiveDialogContent": null,+ "ResponsiveDialogDescription": null,+ "ResponsiveDialogFooter": null,+ "ResponsiveDialogHeader": null,+ "ResponsiveDialogOverlay": null,+ "ResponsiveDialogPortal": null,+ "ResponsiveDialogTitle": null,+ "ResponsiveDialogTrigger": null,+ "ScrollBar": null,+ "SelectContent": null,+ "SelectGroup": null,+ "SelectItem": null,+ "SelectLabel": null,+ "SelectScrollDownButton": null,+ "SelectScrollUpButton": null,+ "SelectSeparator": null,+ "SelectTrigger": null,+ "SelectValue": null,+ "SheetClose": null,+ "SheetContent": null,+ "SheetDescription": null,+ "SheetFooter": null,+ "SheetHeader": null,+ "SheetOverlay": null,+ "SheetPortal": null,+ "SheetTitle": null,+ "SheetTrigger": null,+ "TableBody": null,+ "TableCaption": null,+ "TableCell": null,+ "TableFooter": null,+ "TableHead": null,+ "TableHeader": null,+ "TableRow": null,+ "TableSortIndicator": null,+ "TabsContent": null,+ "TabsList": null,+ "TabsTrigger": null,+ "TooltipContent": null,+ "TooltipProvider": null,+ "TooltipTrigger": null+ },+ "overrides": {+ "Dialog": {+ "cardMode": "single",+ "viewport": "720x520",+ "primaryStory": "CreateSite"+ },+ "Table": {+ "cardMode": "column"+ },+ "AlertDialog": {+ "cardMode": "single",+ "viewport": "720x480"+ },+ "Sheet": {+ "cardMode": "single",+ "viewport": "800x520"+ },+ "Drawer": {+ "cardMode": "single",+ "viewport": "720x560"+ },+ "ResponsiveDialog": {+ "cardMode": "single",+ "viewport": "720x520"+ },+ "Popover": {+ "cardMode": "single",+ "viewport": "520x400"+ },+ "Tooltip": {+ "cardMode": "single",+ "viewport": "480x260",+ "primaryStory": "Placements"+ },+ "DropdownMenu": {+ "cardMode": "single",+ "viewport": "520x460"+ },+ "Select": {+ "cardMode": "single",+ "viewport": "520x420"+ },+ "MultiSelect": {+ "cardMode": "single",+ "viewport": "560x440",+ "primaryStory": "CountriesOpen"+ },+ "InputWithSuggestions": {+ "cardMode": "single",+ "viewport": "560x400",+ "primaryStory": "PagePathOpen"+ },+ "Toaster": {+ "cardMode": "single",+ "viewport": "720x400"+ },+ "NavigationMenu": {+ "cardMode": "column"+ },+ "Carousel": {+ "cardMode": "column"+ },+ "ButtonGroup": {+ "cardMode": "column"+ },+ "Skeleton": {+ "cardMode": "column"+ },+ "Checkbox": {+ "cardMode": "column"+ },+ "Input": {+ "cardMode": "column"+ },+ "Label": {+ "cardMode": "column"+ },+ "RadioGroup": {+ "cardMode": "column"+ },+ "Slider": {+ "cardMode": "column"+ },+ "Switch": {+ "cardMode": "column"+ },+ "Textarea": {+ "cardMode": "column"+ },+ "BasicTabs": {+ "cardMode": "column"+ },+ "Tabs": {+ "cardMode": "column"+ },+ "Command": {+ "cardMode": "single",+ "primaryStory": "Palette"+ }+ },+ "guidelinesGlob": [+ "../../DESIGN.md",+ "../../PRODUCT.md"+ ],+ "readmeHeader": ".design-sync/conventions.md"+}diff --git a/.design-sync/conventions.md b/.design-sync/conventions.mdnew file mode 100644index 000000000..4d49c8b40--- /dev/null+++ b/.design-sync/conventions.md@@ -0,0 +1,74 @@+# Building with Rybbit UI++Rybbit is a dark-mode-first analytics dashboard: a flat grayscale "instrument panel" with exactly two chromatic voices — **emerald** for the one primary action / success / current selection, **periwinkle** (`dataviz`) for chart series only. No resting shadows, 1px hairline borders, tight radii (`rounded-lg` = 4.8px), 36px controls, Inter everywhere. Read `guidelines/DESIGN.md` for the rules before composing a screen.++## 1. Wrap everything in `RybbitTheme`++```jsx+const { RybbitTheme, Card, CardHeader, CardTitle, CardContent, Button } = window.Rybbit;+<RybbitTheme> {/* theme="light" for the light mirror */}+ <div className="min-h-screen bg-background p-6">…</div>+</RybbitTheme>+```++`RybbitTheme` puts the `dark` class on `<html>` and its root `div`, sets Inter, paints `bg-background text-foreground`, and mounts the `TooltipProvider` Radix tooltips require. Without it: light tokens, Arial, and every `Tooltip` throws. Portalled overlays (`DialogContent`, `DropdownMenuContent`, `SelectContent`, `PopoverContent`, `SheetContent`) render to `<body>` and pick the theme up from `<html>`, so one wrapper at the root is enough.++## 2. Styling idiom: Tailwind utility classes on `className`++Components take `className` (merged with `cn`/tailwind-merge, so your class overrides theirs). There are no style props. Compose layout with utilities; pick colors from the token families below (all compiled into `styles.css`; `hover:`, `dark:`, `sm:/md:/lg:`, `/20`-style opacity, and fractions like `w-1/2` are available for the color and layout families).++| Family | Use | Real class names |+|---|---|---|+| Canvas / surfaces | page → panel → raised chrome | `bg-background` · `bg-neutral-900` (card/panel) · `bg-neutral-850` (raised) · `bg-neutral-800` (hover) · `bg-muted` |+| Text | primary / secondary / muted | `text-foreground` · `text-neutral-300` · `text-muted-foreground` (= `text-neutral-400`) · `text-neutral-500` |+| Borders | always 1px hairlines | `border border-neutral-800` (panels) · `border-neutral-850` (cards) · `border-neutral-750` (raised chrome) · `border-border` |+| Accent (action/success) | ONE per view | `bg-accent-600 text-neutral-50 border-accent-700` (dark fill) · `text-accent-400` · `bg-accent-500/20 text-accent-400` (tint) |+| Data viz | chart series only, never chrome | `bg-dataviz` · `bg-dataviz-2` · `text-dataviz` |+| State | only when state demands | `text-red-400` / `bg-red-500/20` · `text-yellow-400` / `bg-yellow-500/20` · `text-blue-400` / `bg-blue-500/20` |+| Type scale | weight + size only, one family | headline `text-3xl font-semibold tabular-nums` · title `text-base font-semibold leading-none tracking-tight` · body `text-sm` · label `text-xs font-medium` |+| Shape & density | | `rounded-lg` (4.8px) · `rounded-md` (badges, xs buttons) · `p-4` card padding · `gap-2`/`gap-3` control gaps · `h-9` controls |++Raw CSS variables exist too when you need a value outside a class: `var(--color-background)`, `var(--color-neutral-900)`, `var(--color-accent-500)`, `var(--color-dataviz)`, `var(--color-muted-foreground)`, `var(--color-border)`, `var(--radius)` (0.3rem).++Rules that are easy to break: no `shadow-*` at rest (step the neutral instead); no emerald backgrounds on surfaces; no periwinkle on buttons or chrome; no gradients; numbers get `tabular-nums` and right alignment in tables.++## 3. Where the truth lives++- `styles.css` → `_ds_bundle.css`: the app's compiled Tailwind v4 stylesheet (tokens in `:root` / `.dark`, the full utility set above).+- `guidelines/DESIGN.md` (visual system, named rules) and `guidelines/PRODUCT.md` (register, users, anti-references).+- `components/<group>/<Name>/<Name>.prompt.md`: each family's parts, variants, and a real example. Compound families export their parts FLAT on `window.Rybbit` (`Dialog`, `DialogTrigger`, `DialogContent`, `DialogTitle`… ; `Select`, `SelectTrigger`, `SelectValue`, `SelectContent`, `SelectItem`…; `Table`, `TableHeader`, `TableRow`, `TableHead`, `TableBody`, `TableCell`…; `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`; `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`). The family card's prompt.md lists every part.+- Icons: pass `lucide-react` icons as children; `Button` sizes any `svg` child to 16px.++## 4. One idiomatic screen fragment++```jsx+const { RybbitTheme, Card, CardHeader, CardTitle, CardDescription, CardContent,+ Button, Badge, Table, TableHeader, TableRow, TableHead, TableBody, TableCell } = window.Rybbit;++<RybbitTheme>+ <main className="min-h-screen bg-background p-6 space-y-6">+ <header className="flex items-center justify-between">+ <h1 className="text-base font-semibold leading-none tracking-tight">tomato.gg</h1>+ <div className="flex gap-2">+ <Button variant="outline" size="sm">Export CSV</Button>+ <Button variant="accent" size="sm">Add site</Button>+ </div>+ </header>+ <div className="grid grid-cols-1 gap-4 md:grid-cols-3">+ <Card>+ <CardHeader><CardDescription>Unique visitors</CardDescription>+ <CardTitle className="text-3xl tabular-nums">18.4K</CardTitle></CardHeader>+ <CardContent className="text-xs text-muted-foreground">+12% vs. previous 30 days</CardContent>+ </Card>+ </div>+ <Table>+ <TableHeader><TableRow><TableHead>Page</TableHead><TableHead className="text-right">Visitors</TableHead><TableHead>Status</TableHead></TableRow></TableHeader>+ <TableBody><TableRow>+ <TableCell className="font-medium">/pricing</TableCell>+ <TableCell className="text-right tabular-nums">6,120</TableCell>+ <TableCell><Badge variant="success">Tracking</Badge></TableCell>+ </TableRow></TableBody>+ </Table>+ </main>+</RybbitTheme>+```diff --git a/.design-sync/docs/ActivitySlider.md b/.design-sync/docs/ActivitySlider.mdnew file mode 100644index 000000000..d4354cc31--- /dev/null+++ b/.design-sync/docs/ActivitySlider.md@@ -0,0 +1,28 @@+---+category: Replay+---++The session-replay scrubber: a Radix slider whose track shows where the visitor was active and whose rail above it plots the meaningful events (clicks, navigations, typing, rage clicks, console errors) as colored 8px dots, so you can jump straight to the interesting moment. It is the "activity" view of the replay player; `TimelineSlider` is the plain thin transport rail used when there is no event data.++Single part: `ActivitySlider`. It extends every Radix `Slider.Root` prop (`value`/`defaultValue` as `[ms]`, `max`, `step`, `onValueChange`, `disabled`) plus three of its own:+- `duration` (ms, the recording length; ALSO pass it as `max` so the thumb and the rail agree),+- `activityPeriods` (`{ start, end }[]` in ms; drawn as neutral-600 segments on the neutral-700 idle track),+- `events` (raw rrweb events `{ timestamp, type, data }`; the slider runs them through `getMeaningfulEvents` from the replay module, so feed it what the player already has: type 4 Meta for session start/navigation, type 3 source 2 for clicks, source 5 for input, type 6 console plugin for logs).++Marker hues: navigation/console log blue-400, click/double click violet-500, right click fuchsia-500, rage click red-500, typing amber-500, resize cyan-500, console warning yellow-500, console error red-500. Each dot has a 2px ring in the panel color (`ring-neutral-900` in dark) so overlapping dots stay distinct, and its `title` shows the label and offset on hover (not capturable statically). Over 160 markers the plain clicks/typing are sampled while every navigation, rage click and console event is kept. The played portion of the track is emerald (`accent-500`); the thumb is a 16px white disc with an emerald border.++Conventions: mount it inside the player card (neutral-900) with the session identity on the left and `m:ss / m:ss` on the right in 12px muted tabular figures; drive `value` from the player's current time.++```tsx+import { ActivitySlider } from "@rybbit/ui";++<ActivitySlider+ duration={duration}+ max={duration}+ step={100}+ value={[currentTime]}+ onValueChange={([t]) => player.seek(t)}+ activityPeriods={[{ start: 0, end: 30_000 }, { start: 34_000, end: 78_000 }]}+ events={rrwebEvents}+/>+```diff --git a/.design-sync/docs/Alert.md b/.design-sync/docs/Alert.mdnew file mode 100644index 000000000..06ba4ff86--- /dev/null+++ b/.design-sync/docs/Alert.md@@ -0,0 +1,20 @@+---+category: Feedback+---++Inline, non-dismissing status message that lives in the page flow (a settings panel, the top of a report, an onboarding step). Use it for state the user needs to see when they arrive: tracking detected, a plan limit approaching, a failed verification. For a transient confirmation after an action use `Toaster`/`toast`; for something that must be acknowledged use `AlertDialog`.++Parts: `Alert` (root, `role="alert"`, full width, 4.8px radius, 16px/12px padding, tinted fill) → a lucide icon as the first child (absolutely positioned top-left, 16px, tinted to the variant; the text shifts right 28px automatically) → `AlertTitle` (14px medium, one line) → `AlertDescription` (14px, wraps; nested `<p>` get relaxed leading, so an action row can follow the text).++Variants (`variant` on `Alert`): `default` (neutral-800 fill, gray icon) · `info` (blue tint) · `success` (emerald tint) · `warning` (yellow tint) · `destructive` (red tint). There is no border; the hue is carried by the 12-15% tint and the icon only, so the alert sits flat on the panel like everything else in the instrument. Title in sentence case, description says the consequence or the next step; title-only and description-only are both fine for one-liners. Give the icon `className="h-4 w-4"`.++```tsx+import { Alert, AlertDescription, AlertTitle } from "@rybbit/ui";+import { AlertTriangle } from "lucide-react";++<Alert variant="warning">+ <AlertTriangle className="h-4 w-4" />+ <AlertTitle>Approaching your event limit</AlertTitle>+ <AlertDescription>You have used 91% of 1M monthly events. Upgrade to keep collecting after the cap.</AlertDescription>+</Alert>+```diff --git a/.design-sync/docs/AlertDialog.md b/.design-sync/docs/AlertDialog.mdnew file mode 100644index 000000000..328a1abca--- /dev/null+++ b/.design-sync/docs/AlertDialog.md@@ -0,0 +1,29 @@+---+category: Overlays+---++Focus-trapped confirmation prompt (Radix AlertDialog). Unlike `Dialog`, it has no close X, cannot be dismissed by clicking the overlay, and always ends in a choice. Use it before an irreversible or costly action (delete a site, leave an organization, regenerate a key); use `Dialog` for forms and everything else.++Parts: `AlertDialog` (root, `open`/`onOpenChange`) → `AlertDialogTrigger` (`asChild` around a Button) → `AlertDialogContent` (centered 512px panel) → `AlertDialogHeader` / `AlertDialogTitle` / `AlertDialogDescription` → optional body → `AlertDialogFooter` with `AlertDialogCancel` (already styled as an `outline` Button, closes on click) and `AlertDialogAction` (accepts Button `variant` and `size`; closes on click, so attach the real work to `onClick`).++Conventions: title is a question naming the object ("Delete tomato.gg?"); description states the consequence and whether it can be undone; the cancel label is a verb ("Keep site"), not "No". The action is `variant="destructive"` for deletes and `variant="accent"` for non-destructive confirms. Never put more than two buttons in the footer.++```tsx+<AlertDialog>+ <AlertDialogTrigger asChild>+ <Button variant="destructive">Delete site</Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete tomato.gg?</AlertDialogTitle>+ <AlertDialogDescription>+ This removes the site and its 2.4M events. This cannot be undone.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Keep site</AlertDialogCancel>+ <AlertDialogAction variant="destructive" onClick={deleteSite}>Delete site</AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+</AlertDialog>+```diff --git a/.design-sync/docs/Badge.md b/.design-sync/docs/Badge.mdnew file mode 100644index 000000000..043fca3b7--- /dev/null+++ b/.design-sync/docs/Badge.md@@ -0,0 +1,24 @@+---+category: Data display+---++Small inline status label: 12px medium text, 2px/6px padding, 2.8px radius (`rounded-md`), inline-flex. One export, `Badge`, with a `variant` prop; it renders a `div`, so it is not clickable — wrap it or use a `Button size="xs"` when it must act.++Variants:+- `default` — neutral-800 fill, neutral-100 text. Plan names, generic labels ("Pro").+- `secondary` — one notch quieter (panel fill, neutral-300 text). Counts and low-emphasis tags.+- `success` — emerald 20% tint, emerald-400 text. "Tracking", "Enabled", "Verified".+- `warning` — yellow tint. "No data", "Paused", thresholds.+- `destructive` — red tint. "Bot", "Blocked", "Failed".+- `info` — blue tint. "Beta", "New", informational only (never for data-series color).+- `outline` — neutral-700 border, transparent fill. Environment / category tags.+- `ghost` — no border or fill. Inline keywords.++Conventions: colored variants are semantic, so use them only when the state has that meaning — a status column is the canonical place. Put a 12px lucide icon (`className="h-3 w-3"`) as the first child and add `gap-1`; add `tabular-nums` for counts and `font-mono` for paths. Badges do not change size; if you need a larger pill, it is a `Button`.++```tsx+<Badge variant="success">Tracking</Badge>+<Badge variant="warning">No data</Badge>+<Badge variant="destructive" className="gap-1"><Bot className="h-3 w-3" /> Bot</Badge>+<Badge variant="secondary" className="tabular-nums">2,140</Badge>+```diff --git a/.design-sync/docs/BasicTabs.md b/.design-sync/docs/BasicTabs.mdnew file mode 100644index 000000000..e36ea44c0--- /dev/null+++ b/.design-sync/docs/BasicTabs.md@@ -0,0 +1,22 @@+---+category: Navigation+---++Underline tabs (Radix), the quiet sibling of `Tabs`. There is no filled strip: triggers are muted text sitting on a transparent 32px row, and the active one turns bright with a 2px bottom border. Use it inside cards and section headers to switch a breakdown (Countries / Regions / Cities, Channels / Referrers) where a pill strip would be too heavy; use `Tabs` for top-level view switching.++Parts (exported with the `BasicTabs` prefix because the source file shares names with `tabs.tsx`): `BasicTabs` (root; `defaultValue` or `value` / `onValueChange`) → `BasicTabsList` (`inline-flex` row with 12px gaps) → `BasicTabsTrigger` (`value`, `disabled`) and `BasicTabsContent` (`value`; adds `mt-2`).++Conventions: short one-word labels; an optional count after the label as `<span className="ml-1 text-xs text-neutral-500 tabular-nums">48</span>`; keep the list flush-left with the card's content edge. Never mix `BasicTabs` and `Tabs` parts in one tree.++```tsx+<BasicTabs defaultValue="countries">+ <BasicTabsList>+ <BasicTabsTrigger value="countries">Countries</BasicTabsTrigger>+ <BasicTabsTrigger value="regions">Regions</BasicTabsTrigger>+ <BasicTabsTrigger value="cities">Cities</BasicTabsTrigger>+ </BasicTabsList>+ <BasicTabsContent value="countries">{/* ranked list */}</BasicTabsContent>+ <BasicTabsContent value="regions">…</BasicTabsContent>+ <BasicTabsContent value="cities">…</BasicTabsContent>+</BasicTabs>+```diff --git a/.design-sync/docs/Breadcrumb.md b/.design-sync/docs/Breadcrumb.mdnew file mode 100644index 000000000..0f622724e--- /dev/null+++ b/.design-sync/docs/Breadcrumb.md@@ -0,0 +1,27 @@+---+category: Navigation+---++Location trail for deep pages (a user profile, a funnel, an org settings sub-page). Ancestors are muted links, the current page is bright plain text, and a small chevron separates them. Use it only when the page is two or more levels below a sidebar destination; top-level report pages do not need one.++Parts: `Breadcrumb` (`<nav aria-label="breadcrumb">`) → `BreadcrumbList` (`<ol>`, 14px muted text, wraps) → `BreadcrumbItem` (`<li>`) containing either `BreadcrumbLink` (`href`, or `asChild` to wrap a router `Link`) or `BreadcrumbPage` (current page, `aria-current="page"`). Put a `BreadcrumbSeparator` between items: with no children it renders a 14px `ChevronRight`; pass any node (e.g. `<Slash />`) to replace it. `BreadcrumbEllipsis` is a 36px "…" placeholder for collapsed middle levels; wrap it in its own `BreadcrumbItem`.++Conventions: the site domain (`tomato.gg`) is the first crumb inside a site; keep at most four visible crumbs and collapse the rest with the ellipsis; the last item is always a `BreadcrumbPage`, never a link. Hover brightening on links is a live state and is not shown statically.++```tsx+<Breadcrumb>+ <BreadcrumbList>+ <BreadcrumbItem>+ <BreadcrumbLink href="/tomato.gg">tomato.gg</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbLink href="/tomato.gg/users">Users</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbPage>usr_8f3a91c2</BreadcrumbPage>+ </BreadcrumbItem>+ </BreadcrumbList>+</Breadcrumb>+```diff --git a/.design-sync/docs/Button.md b/.design-sync/docs/Button.mdnew file mode 100644index 000000000..22749d66f--- /dev/null+++ b/.design-sync/docs/Button.md@@ -0,0 +1,23 @@+---+category: Actions+---++The primary control. Nine visual variants on one shared shape (36px tall, 4.8px radius, 14px medium text, 4px icon gap).++- `accent` — the ONE emerald primary action on a surface ("Add site", "Save", "Publish"). At most one per view.+- `default` — the raised gray chrome button (neutral-850 fill, neutral-750 border in dark). The everyday secondary action.+- `secondary` — one notch quieter than `default` (panel-colored fill).+- `outline` — bordered, transparent; toolbar and filter chrome.+- `ghost` — no border or fill until hover; icon buttons, "Cancel", inline actions.+- `link` — text only with underline on hover; navigation-like actions.+- `success` / `warning` / `destructive` — state-colored actions (emerald, yellow, red). Use for confirmations, never as decoration.++Sizes: `lg` (40px) · `default` (36px) · `sm` (32px) · `xs` (24px) · `icon` (36px square) · `smIcon` (28px square). Put a lucide icon as the first child; the button sizes it to 16px automatically.++`asChild` renders the styles onto the child element (e.g. an `<a>`), keeping one DOM node.++```tsx+<Button variant="accent"><Plus /> New goal</Button>+<Button variant="outline" size="sm">Export CSV</Button>+<Button size="icon" variant="ghost" aria-label="Settings"><Settings /></Button>+```diff --git a/.design-sync/docs/ButtonGroup.md b/.design-sync/docs/ButtonGroup.mdnew file mode 100644index 000000000..373f6b4d4--- /dev/null+++ b/.design-sync/docs/ButtonGroup.md@@ -0,0 +1,27 @@+---+category: Actions+---++Joins adjacent `Button`s (and inputs/select triggers) into one control: inner corners are squared and the shared border is collapsed so a Day/Week/Month switch, a zoom toolbar or a split "range + chevron" trigger reads as a single piece of chrome. Use it whenever two or more related actions sit flush; use plain `flex gap-2` for unrelated buttons.++Parts: `ButtonGroup` (root, `role="group"`, `flex w-fit items-stretch`; `orientation="horizontal"` (default) removes left borders/radii between children, `"vertical"` stacks them and removes the top ones) → children are ordinary `Button`s. `ButtonGroupSeparator` is a hairline `Separator` (neutral-800, stretches to the group height) for splitting clusters inside one group. `ButtonGroupText` is a static label cell with the same height and border (neutral-800 fill; `asChild` to render it as a label or link); put a lucide icon first and it is sized to 16px. Nesting a `ButtonGroup` directly inside a `ButtonGroup` inserts an 8px gap between the clusters, which is how you build a filter bar.++Conventions: members share one `size` (`sm` for filter chips, `icon` for tool rails). Use `variant="outline"` for the members and `variant="default"` (the raised neutral-850 chrome) for the selected one; `accent` only for the single primary action at the end of a group. `buttonGroupVariants` is exported if you need the classes on a custom element.++```tsx+import { Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "@rybbit/ui";+import { Calendar, ChevronDown, Download } from "lucide-react";++<ButtonGroup>+ <Button variant="outline" size="sm">Day</Button>+ <Button variant="default" size="sm">Week</Button>+ <Button variant="outline" size="sm">Month</Button>+</ButtonGroup>++<ButtonGroup>+ <ButtonGroupText><Calendar /> Last 30 days</ButtonGroupText>+ <Button variant="outline" aria-label="Change range"><ChevronDown /></Button>+ <ButtonGroupSeparator />+ <Button variant="outline"><Download /> Export</Button>+</ButtonGroup>+```diff --git a/.design-sync/docs/Calendar.md b/.design-sync/docs/Calendar.mdnew file mode 100644index 000000000..c9aa686f6--- /dev/null+++ b/.design-sync/docs/Calendar.md@@ -0,0 +1,20 @@+---+category: Forms+---++Month-grid date picker (react-day-picker v9) that lives inside the date-range popover and any "pick a day" dialog. One component plus its day cell: `Calendar` (all DayPicker props pass through) and `CalendarDayButton` (the `ghost`/`icon` Button used per day, swappable via `components`). Key props: `mode="single"` with `selected: Date` / `onSelect(date)`, or `mode="range"` with `selected: { from, to }` / `onSelect(range)`; `defaultMonth` (always set it so the render is deterministic); `disabled` (a matcher such as `{ after: new Date() }` to block future days); `captionLayout="label"` (default, static "May 2024") or `"dropdown"` (month + year selects, needs `startMonth`/`endMonth`); `numberOfMonths={2}` for a side-by-side range picker; `showOutsideDays` (default true).++Appearance: a `w-fit` neutral-850 panel with 12px padding and 32px cells (`--cell-size`), muted weekday letters, the selected day as a light (neutral-200) pill with dark text, today as a neutral-700 pill, range middles as a continuous neutral-700 band with square inner corners, disabled days at 50% opacity. Inside a `PopoverContent` or `CardContent` the panel background goes transparent to sit on the host. Keep it for picking days; pair it with the preset range list (Last 7/30/90 days) rather than replacing it, and use `Input type="time"` for times.++```tsx+const [range, setRange] = React.useState<{ from?: Date; to?: Date }>();++<Calendar+ mode="range"+ selected={range}+ onSelect={setRange}+ defaultMonth={new Date(2024, 4, 1)}+ disabled={{ after: new Date() }}+ numberOfMonths={2}+/>+```diff --git a/.design-sync/docs/Card.md b/.design-sync/docs/Card.mdnew file mode 100644index 000000000..b0325103e--- /dev/null+++ b/.design-sync/docs/Card.md@@ -0,0 +1,31 @@+---+category: Data display+---++The panel. Every dashboard section, stat tile, and settings block sits in a `Card`: a neutral-900 surface one step off the canvas, 1px neutral-850 border, 4.8px radius, `overflow-hidden`, no shadow. Flat parts, all optional:++- `Card` — the surface (`relative`, so loaders and absolute children anchor to it).+- `CardHeader` — vertical stack with 16px padding; holds `CardTitle` (16px semibold, tight tracking) and `CardDescription` (14px, neutral-400 muted).+- `CardContent` — 16px padding with the top padding removed (`p-4 pt-0`) so it butts against the header. Put your rows, table, or chart here.+- `CardFooter` — horizontal flex row, same padding rule; put `Button`s here (`justify-end gap-2` for an action row, ONE `accent`).+- `CardLoader` — an indeterminate progress bar for "refetching in place". It is `absolute top-0 left-0 w-full` with a -15px top margin, so render it as the first child of a `Card` (or inside any `relative` container) and the card's `overflow-hidden` clips it to a thin line along the top edge. It needs no props; it reads the theme via next-themes and colors itself neutral-400 in dark mode. Use it with `Skeleton` content underneath on first load, or alone over stale data while refetching.++Conventions: stat tiles do not use `CardHeader` — they are a `Card` with `px-3 py-2`, a 12px `text-muted-foreground` label, and a 24px `font-medium` figure (delta in `text-emerald-400` / `text-red-400`). Lists inside `CardContent` use `border-b border-neutral-800` hairlines between rows, not nested cards. Never nest a `Card` in a `Card`.++```tsx+<Card>+ <CardLoader />+ <CardHeader>+ <CardTitle>Top pages</CardTitle>+ <CardDescription>Last 7 days on tomato.gg</CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-2">+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ </CardContent>+ <CardFooter className="justify-end gap-2">+ <Button variant="ghost" size="sm">Cancel</Button>+ <Button variant="accent" size="sm">Save changes</Button>+ </CardFooter>+</Card>+```diff --git a/.design-sync/docs/Carousel.md b/.design-sync/docs/Carousel.mdnew file mode 100644index 000000000..8406c950c--- /dev/null+++ b/.design-sync/docs/Carousel.md@@ -0,0 +1,33 @@+---+category: Data display+---++Horizontal (or vertical) slide deck driven by Embla, for a row of stat cards, onboarding steps or screenshots that would not fit side by side. In an analytics UI reach for it rarely: a grid or a scrollable row is usually clearer; use a carousel when the slides are peers and only a few need to be visible at once.++Parts: `Carousel` (root, `role="region"`; props `orientation="horizontal" | "vertical"`, `opts` passed straight to Embla, e.g. `{ loop: true, startIndex: 1, align: "start" }`, `plugins`, `setApi` to receive the `CarouselApi` for programmatic scrolling; arrow keys work out of the box) → `CarouselContent` (the overflow-hidden viewport; its inner flex track has a -16px start margin so items are spaced by their own 16px padding) → `CarouselItem` (one slide, `basis-full` by default; set `style={{ flexBasis: "33.3333%" }}` or a `basis-*` class for N-up) → `CarouselPrevious` / `CarouselNext` (32px round `outline` icon buttons, absolutely positioned 48px OUTSIDE the track: `-left-12` / `-right-12`, or above/below and rotated when vertical; they disable themselves at the ends unless `loop` is on). Both buttons accept every `Button` prop, so pass `variant`/`className` to reposition them inside the track if the parent has no gutter.++Conventions: reserve a 64px side gutter in the parent for the arrows; give a vertical `CarouselContent` an explicit height; slides are `Card`s with the stat-tile layout (12px muted label, 24px semibold tabular number, emerald/red delta line). Keep the visible slide count at 1-3.++```tsx+import { Card, CardContent, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@rybbit/ui";++<div style={{ padding: "16px 64px" }}>+ <Carousel opts={{ align: "start" }}>+ <CarouselContent>+ {stats.map((s) => (+ <CarouselItem key={s.label} style={{ flexBasis: "33.3333%" }}>+ <Card>+ <CardContent className="p-4">+ <div className="text-xs font-medium text-neutral-400">{s.label}</div>+ <div className="mt-1 text-2xl font-semibold tabular-nums">{s.value}</div>+ <div className="mt-1 text-xs text-emerald-400">{s.delta} vs. previous 30 days</div>+ </CardContent>+ </Card>+ </CarouselItem>+ ))}+ </CarouselContent>+ <CarouselPrevious />+ <CarouselNext />+ </Carousel>+</div>+```diff --git a/.design-sync/docs/Checkbox.md b/.design-sync/docs/Checkbox.mdnew file mode 100644index 000000000..adafd185c--- /dev/null+++ b/.design-sync/docs/Checkbox.md@@ -0,0 +1,28 @@+---+category: Forms+---++Radix checkbox, 16px square, 4.8px radius. Unchecked: 1px `neutral-700` border on a faint `neutral-900/30` fill. Checked: emerald (`accent-500`) border and fill with a white lucide `Check`. Focus shows a 3px emerald ring. Use it for independent on/off choices in a list (columns to include, sites to notify, filters to apply); use `Switch` for a single setting that applies immediately, and `RadioGroup` for mutually exclusive options.++Parts: `Checkbox` only (indicator is internal). Props: `checked` / `defaultChecked`, `onCheckedChange`, `disabled`, `id`, `name`, `className`.++Conventions:+- Always give it an `id` and a sibling `Label htmlFor` in a `flex items-center gap-2` row; the label toggles it.+- With a description: `flex items-start gap-3`, add `className="mt-0.5"` to the checkbox so it aligns with the first text line, and put the description in `text-xs text-neutral-400`.+- Option lists live in a `grid gap-2.5` inside a `rounded-lg border border-neutral-800 bg-neutral-900 p-4` panel with a `text-sm font-medium` heading; option labels use `font-normal`.+- `disabled` fades the box to 50%; add `opacity-70` to its label. Hover and indeterminate are not shown in the previews.++```tsx+<div className="flex items-center gap-2">+ <Checkbox id="exclude-bots" defaultChecked />+ <Label htmlFor="exclude-bots">Exclude known bots</Label>+</div>++<div className="flex items-start gap-3">+ <Checkbox id="salt" className="mt-0.5" />+ <div className="grid gap-1">+ <Label htmlFor="salt">Salt user IDs daily</Label>+ <p className="text-xs text-neutral-400">Returning-visitor stats reset at midnight UTC.</p>+ </div>+</div>+```diff --git a/.design-sync/docs/Command.md b/.design-sync/docs/Command.mdnew file mode 100644index 000000000..9fdf4e698--- /dev/null+++ b/.design-sync/docs/Command.md@@ -0,0 +1,30 @@+---+category: Overlays+---++Searchable command list built on cmdk. Typing in `CommandInput` filters `CommandItem`s by their text (or `value` / `keywords`), arrow keys move the highlight, Enter fires `onSelect`. Use it for the ⌘K palette, site switchers, and any pick-from-many list that needs a search box; for a plain menu of actions use `DropdownMenu`, and for a form value use `Select`.++Parts: `Command` (root; transparent background, so wrap it in your own panel such as `rounded-lg border border-neutral-800 bg-neutral-900`, or use `CommandDialog`) → `CommandInput` (search icon + input, hairline bottom border; `placeholder`, `value` / `onValueChange`) → `CommandList` (scroll container capped at 300px) containing `CommandEmpty` (shown only when nothing matches), `CommandGroup` (`heading` renders a small muted label), `CommandItem` (`value`, `keywords`, `onSelect`, `disabled`; highlighted row is a raised neutral), `CommandShortcut` (right-aligned key hint) and `CommandSeparator`. `CommandDialog` wraps the same children in a `Dialog` (`open` / `onOpenChange`, `title` / `description` for screen readers, `showCloseButton`) with taller 48px rows.++Conventions: put a 16px lucide icon with `mr-2 size-4 text-neutral-400` before item text; group by kind (Sites / Go to / Actions) with a separator between groups; keep the first item selected by default (cmdk does this). Keyboard navigation and the filtered state are live behaviors and are not shown statically.++```tsx+<CommandDialog open={open} onOpenChange={setOpen} title="Command palette">+ <CommandInput placeholder="Search sites, pages, or commands…" />+ <CommandList>+ <CommandEmpty>No results found.</CommandEmpty>+ <CommandGroup heading="Sites">+ <CommandItem onSelect={() => go("/tomato.gg")}>+ <Globe className="mr-2 size-4 text-neutral-400" /> tomato.gg+ </CommandItem>+ </CommandGroup>+ <CommandSeparator />+ <CommandGroup heading="Go to">+ <CommandItem>+ <Users className="mr-2 size-4 text-neutral-400" /> Sessions+ <CommandShortcut>⌘2</CommandShortcut>+ </CommandItem>+ </CommandGroup>+ </CommandList>+</CommandDialog>+```diff --git a/.design-sync/docs/Dialog.md b/.design-sync/docs/Dialog.mdnew file mode 100644index 000000000..1e7e724eb--- /dev/null+++ b/.design-sync/docs/Dialog.md@@ -0,0 +1,24 @@+---+category: Overlays+---++Modal dialog (Radix). Compose the flat parts: `Dialog` (root, controls `open`) → `DialogTrigger` (wraps the opener, `asChild` for a Button) → `DialogContent` (portalled panel, 512px max, close X built in; `hideClose` removes it) → `DialogHeader` / `DialogTitle` / `DialogDescription` → body → `DialogFooter` (actions, right-aligned on desktop). `DialogClose` wraps any element that should dismiss. `DialogContentFullScreen` is the edge-to-edge editor surface with no overlay or padding.++Rules of thumb: title in sentence case; description explains the consequence; footer holds a `ghost`/`outline` cancel and ONE `accent` (or `destructive`) confirm. For screen-size-adaptive dialogs use `ResponsiveDialog` (dialog on desktop, drawer on mobile). For a plain confirm/cancel prompt with focus trapping use `AlertDialog`.++```tsx+<Dialog>+ <DialogTrigger asChild><Button variant="accent">Add site</Button></DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Add a website</DialogTitle>+ <DialogDescription>Enter the domain you want to track.</DialogDescription>+ </DialogHeader>+ <Input placeholder="example.com" />+ <DialogFooter>+ <DialogClose asChild><Button variant="ghost">Cancel</Button></DialogClose>+ <Button variant="accent">Add site</Button>+ </DialogFooter>+ </DialogContent>+</Dialog>+```diff --git a/.design-sync/docs/Drawer.md b/.design-sync/docs/Drawer.mdnew file mode 100644index 000000000..611ab0224--- /dev/null+++ b/.design-sync/docs/Drawer.md@@ -0,0 +1,29 @@+---+category: Overlays+---++Touch-first panel built on vaul: slides up from the bottom with a drag handle and swipe-to-dismiss. Use it on mobile layouts for short forms and detail cards (a goal editor, a session summary, a filter list). On desktop prefer `Dialog` or `Sheet`; `ResponsiveDialog` switches between the two for you.++Parts: `Drawer` (root, `open`/`onOpenChange`; `direction="bottom" | "top" | "left" | "right"`, default `bottom`) → `DrawerTrigger` (`asChild` around a Button) → `DrawerContent` (portalled panel with overlay; the drag handle is rendered automatically for `bottom`) → `DrawerHeader` / `DrawerTitle` / `DrawerDescription` → your content → `DrawerFooter` (stacked, full-width actions pushed to the bottom with `mt-auto`). `DrawerClose` wraps any element that should dismiss.++Conventions: header and footer carry their own `p-4`, so pad body content with `px-4` to line up. Footer buttons stack vertically at full width — put the `accent` action first and a `ghost` cancel below it. Bottom drawers center their header text; side drawers (`left`/`right`) behave like a `Sheet` and are capped at `max-w-sm`. Keep bottom drawers under ~60% of the viewport; anything taller belongs in a page.++```tsx+<Drawer>+ <DrawerTrigger asChild><Button variant="accent">New goal</Button></DrawerTrigger>+ <DrawerContent>+ <DrawerHeader>+ <DrawerTitle>New goal</DrawerTitle>+ <DrawerDescription>Count a conversion whenever a visitor reaches this page.</DrawerDescription>+ </DrawerHeader>+ <div className="grid gap-3 px-4">+ <Label htmlFor="path">Path</Label>+ <Input id="path" defaultValue="/welcome" />+ </div>+ <DrawerFooter>+ <Button variant="accent">Create goal</Button>+ <DrawerClose asChild><Button variant="ghost">Cancel</Button></DrawerClose>+ </DrawerFooter>+ </DrawerContent>+</Drawer>+```diff --git a/.design-sync/docs/DropdownMenu.md b/.design-sync/docs/DropdownMenu.mdnew file mode 100644index 000000000..de9c364a3--- /dev/null+++ b/.design-sync/docs/DropdownMenu.md@@ -0,0 +1,30 @@+---+category: Overlays+---++Contextual action menu (Radix) that opens from a trigger and closes on select or outside click. Use it for per-row/per-site actions, column toggles, and quick single-choice settings; use `Select` when the value is a form field, and `Popover` when the content is not a list of commands.++Parts: `DropdownMenu` (root, `open` / `onOpenChange`) → `DropdownMenuTrigger` (renders as a Button and accepts Button `variant` / `size`; pass `asChild` to supply your own element, or `unstyled` to opt out of button styling) → `DropdownMenuContent` (portalled panel, `align="start" | "end"`, `sideOffset` 4 by default; give it a width like `className="w-56"`). Inside: `DropdownMenuLabel` (section heading), `DropdownMenuGroup`, `DropdownMenuItem` (a leading lucide icon is auto-sized to 16px; `inset` indents to align with checkbox rows; `disabled` dims it), `DropdownMenuShortcut` (right-aligned key hint), `DropdownMenuSeparator`, `DropdownMenuCheckboxItem` (`checked` / `onCheckedChange`, emerald check indicator), `DropdownMenuRadioGroup` + `DropdownMenuRadioItem` (`value`, emerald dot), and `DropdownMenuSub` + `DropdownMenuSubTrigger` (chevron built in) + `DropdownMenuSubContent` for a nested level. `DropdownMenuPortal` is only needed when you portal sub-content yourself.++Conventions: one label per section, separators between sections, the destructive action last and colored with `text-red-400`. Keep menus to ~8 rows; put value pickers with many options in `Select`. Hover/focus highlight is a raised neutral, never emerald: emerald appears only on the check/radio indicator.++```tsx+<DropdownMenu>+ <DropdownMenuTrigger variant="outline" size="sm">+ tomato.gg <ChevronDown className="size-4" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-56">+ <DropdownMenuLabel>tomato.gg</DropdownMenuLabel>+ <DropdownMenuSeparator />+ <DropdownMenuItem>+ <Settings /> Site settings+ <DropdownMenuShortcut>⌘,</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuCheckboxItem checked>Show bounce rate</DropdownMenuCheckboxItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem className="text-red-400 focus:text-red-400">+ <Trash2 /> Delete site+ </DropdownMenuItem>+ </DropdownMenuContent>+</DropdownMenu>+```diff --git a/.design-sync/docs/Form.md b/.design-sync/docs/Form.mdnew file mode 100644index 000000000..f1e2b75fe--- /dev/null+++ b/.design-sync/docs/Form.md@@ -0,0 +1,33 @@+---+category: Forms+---++The react-hook-form wiring layer for every settings and create dialog. `Form` is react-hook-form's `FormProvider`: spread the object from `useForm()` into it, then put a real `<form onSubmit={form.handleSubmit(fn)}>` inside. Each field is `FormField` (`control={form.control}`, `name`, and a `render={({ field }) => ...}` that spreads `field` onto the input) → `FormItem` (a `space-y-2` stack that owns the ids) → `FormLabel` (turns red on error) → `FormControl` (a Slot that stamps `id`, `aria-describedby`, `aria-invalid` on the single child control) → `FormDescription` (muted 12.8px helper) → `FormMessage` (red 12.8px; renders the field's error message automatically, or its children, or nothing). `useFormField()` exposes the ids and error inside custom controls.++Conventions: one `FormItem` per field, `grid gap-5` (or `space-y-4`) between them, actions in a right-aligned `flex justify-end gap-2` row with a `ghost` cancel and ONE `accent` submit. Bind non-input controls via their own props: a `Select` takes `value={field.value} onValueChange={field.onChange}` with `FormControl` wrapping the `SelectTrigger`; a `Switch`/`Checkbox` takes `checked={field.value} onCheckedChange={field.onChange}`. Show errors from validation, or set them with `form.setError("domain", { message })`. Use plain `Label` + `Input` only for a single uncontrolled field outside a form.++```tsx+const form = useForm({ defaultValues: { domain: "" } });++<Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="grid gap-5">+ <FormField+ control={form.control}+ name="domain"+ rules={{ required: "Domain is required." }}+ render={({ field }) => (+ <FormItem>+ <FormLabel>Domain</FormLabel>+ <FormControl><Input placeholder="example.com" {...field} /></FormControl>+ <FormDescription>The hostname the tracking script will report from.</FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <div className="flex justify-end gap-2">+ <Button type="button" variant="ghost">Cancel</Button>+ <Button type="submit" variant="accent">Add site</Button>+ </div>+ </form>+</Form>+```diff --git a/.design-sync/docs/Input.md b/.design-sync/docs/Input.mdnew file mode 100644index 000000000..d6d553366--- /dev/null+++ b/.design-sync/docs/Input.md@@ -0,0 +1,28 @@+---+category: Forms+---++Single-line text field. Transparent fill, 1px `neutral-800` border, 4.8px radius, placeholder in `neutral-400`, and a 1px `neutral-300` ring on focus. Use it for every free-text, number, URL and password field in settings and dialogs; pair it with `Label` above via `htmlFor`.++Parts: `Input` only. It forwards every native `<input>` prop (`type`, `placeholder`, `defaultValue`, `disabled`, `aria-invalid`, `ref`).++Conventions:+- `inputSize="default"` (36px, 14px text) for forms; `inputSize="sm"` (28px, 12px text) for toolbar filters and table headers.+- `isSearch` renders a leading lucide `Search` icon and pads the text past it. Use it for every "Search / Filter …" box.+- `aria-invalid="true"` turns the border red; put the error text in a `text-xs text-red-400` line below.+- `disabled` drops the field to 50% opacity. Width comes from the container: it is `w-full`, so constrain with `className="w-32"` or a grid.+- Stack `Label` + `Input` in a `grid gap-1.5`; use `grid grid-cols-2 gap-3` for side-by-side fields. Prefer `Textarea` for multi-line, `Select` for enumerations.++```tsx+<div className="grid gap-1.5">+ <Label htmlFor="domain">Domain</Label>+ <Input id="domain" placeholder="example.com" defaultValue="tomato.gg" />+</div>++<Input isSearch inputSize="sm" placeholder="Search pages…" />++<div className="grid gap-1.5">+ <Input aria-invalid="true" defaultValue="not a domain" />+ <p className="text-xs text-red-400">Enter a valid domain, like tomato.gg</p>+</div>+```diff --git a/.design-sync/docs/InputWithSuggestions.md b/.design-sync/docs/InputWithSuggestions.mdnew file mode 100644index 000000000..afe2f625e--- /dev/null+++ b/.design-sync/docs/InputWithSuggestions.md@@ -0,0 +1,23 @@+---+category: Forms+---++A text `Input` that shows a filterable list of known values underneath while typing: page paths, event names, referrers, UTM values. Free text is always allowed; the suggestions are hints, not constraints. One component, no sub-parts: `InputWithSuggestions`. Props: `suggestions: { value, label?, count? }[]` (`count` renders right-aligned in compact form, e.g. 6.1K), `value` + `onValueChange(text)` for controlled use (uncontrolled works too), plus every `Input` prop (`placeholder`, `disabled`, `onChange`, `className`). Forwards its ref to the input element.++Conventions: the list opens on focus and on every keystroke, filters by case-insensitive substring of the current value, closes on outside click or when a row is picked, and is portalled (into the nearest `role="dialog"` or `body`) so it escapes overflow clipping. Sort suggestions by `count` descending so the most common value is first. Prefer it over `Select` when the value space is open-ended (any path could be typed) and over `MultiSelect` when only one value is being entered.++```tsx+const pages = [+ { value: "/pricing", count: 6120 },+ { value: "/docs/script", count: 4890 },+ { value: "/signup", count: 1975 },+];+const [path, setPath] = React.useState("");++<InputWithSuggestions+ value={path}+ onValueChange={setPath}+ suggestions={pages}+ placeholder="/checkout"+/>+```diff --git a/.design-sync/docs/Label.md b/.design-sync/docs/Label.mdnew file mode 100644index 000000000..4b8cbe796--- /dev/null+++ b/.design-sync/docs/Label.md@@ -0,0 +1,26 @@+---+category: Forms+---++Form label built on Radix Label: 14px, medium weight, `leading-none`, inherits the foreground color. Always wire it to its control with `htmlFor` + `id` so clicking the text focuses the input or toggles the checkbox/switch. It is the only text style for field names; helper text below a field is a plain `p.text-xs.text-neutral-400`.++Parts: `Label` only. Forwards every native `<label>` prop and `className`.++Conventions:+- Above a field: `grid gap-1.5` with `Label` first, then `Input` / `Textarea` / `Select`.+- Beside a toggle: `flex items-center gap-2` with the `Checkbox` / `RadioGroupItem` / `Switch` first, then the `Label`. For lists of options use `className="font-normal"` so only the group heading is medium.+- When the control has `peer` and is `disabled`, the label auto-fades to 70% (`peer-disabled:opacity-70`); otherwise add `className="opacity-70"` yourself.+- Required marker: `<span className="text-red-400">*</span>` inside the label. A trailing hint sits on the same row with `flex items-baseline justify-between`.++```tsx+<div className="grid gap-1.5">+ <Label htmlFor="site-name">Site name</Label>+ <Input id="site-name" defaultValue="rybbit.com" />+ <p className="text-xs text-neutral-400">Shown in the site switcher.</p>+</div>++<div className="flex items-center gap-2">+ <Checkbox id="exclude-bots" defaultChecked />+ <Label htmlFor="exclude-bots">Exclude known bots</Label>+</div>+```diff --git a/.design-sync/docs/MultiSelect.md b/.design-sync/docs/MultiSelect.mdnew file mode 100644index 000000000..0317c4838--- /dev/null+++ b/.design-sync/docs/MultiSelect.md@@ -0,0 +1,25 @@+---+category: Forms+---++Searchable multi-value picker for filters (countries, browsers, pages, sites): an `outline` combobox button that grows to hold the chosen values as `secondary` badges with an X to remove, and a Popover + Command list with a search box and check marks. One component, no sub-parts: `MultiSelect`. Props: `options: { value, label, disabled? }[]`, `value: string[]` + `onValueChange(values)` (controlled; keep the array in state), `placeholder` (empty-state text, default "Select items..."), `searchPlaceholder`, `emptyText` ("No items found."), `disabled`, `className` (trigger), `badgeClassName` (chips).++Conventions: the trigger is `w-full` and at least 36px tall; chips wrap onto extra rows rather than truncating, so give it a bounded width (form column or `w-96`). The list opens on click only (no `open` prop) and filters by label substring; selecting toggles membership and keeps the list open. Use it when more than one value can be active at once; for a single choice use `Select`; for free text use `InputWithSuggestions`.++```tsx+const countries = [+ { value: "US", label: "United States" },+ { value: "DE", label: "Germany" },+ { value: "GB", label: "United Kingdom" },+];+const [selected, setSelected] = React.useState<string[]>(["US"]);++<MultiSelect+ options={countries}+ value={selected}+ onValueChange={setSelected}+ placeholder="Filter by country"+ searchPlaceholder="Search countries"+ emptyText="No country matches."+/>+```diff --git a/.design-sync/docs/NavigationMenu.md b/.design-sync/docs/NavigationMenu.mdnew file mode 100644index 000000000..5866ce1d6--- /dev/null+++ b/.design-sync/docs/NavigationMenu.md@@ -0,0 +1,32 @@+---+category: Navigation+---++Horizontal top-level nav bar (Radix) whose triggers open a content panel that drops from below the bar. It is for marketing/site-wide headers with a few sections, not for the dashboard sidebar (which is a plain list) and not for per-item actions (`DropdownMenu`). Plain links live in the same bar via `NavigationMenuLink` styled with `navigationMenuTriggerStyle()`.++Parts: `NavigationMenu` (root; renders the `NavigationMenuViewport` for you. Uncontrolled by default; pass `value` / `onValueChange` to force an item open) → `NavigationMenuList` (flex row) → `NavigationMenuItem` (give it `value` when controlling) containing either `NavigationMenuTrigger` (36px button, chevron built in and flips when open) + `NavigationMenuContent` (the panel body; size it yourself, e.g. `w-[400px] p-2`), or a bare `NavigationMenuLink` (`href`, `asChild`). `NavigationMenuIndicator` is an optional caret under the active trigger. The panel is a `bg-neutral-950` surface with a hairline `border-neutral-800`.++Conventions: 2-4 triggers plus 1-2 plain links; inside a panel list links as `block rounded-md p-3 hover:bg-neutral-800` blocks with a 14px medium title and a 12px `text-neutral-400` description. Give the container enough height below the bar for the panel. Hover-to-open and the slide animation are live behaviors; the preview forces the panel open with `value`.++```tsx+<NavigationMenu>+ <NavigationMenuList>+ <NavigationMenuItem>+ <NavigationMenuTrigger>Reports</NavigationMenuTrigger>+ <NavigationMenuContent>+ <div className="grid w-[400px] gap-1 p-2">+ <NavigationMenuLink asChild>+ <a href="/overview" className="block rounded-md p-3 hover:bg-neutral-800">+ <div className="text-sm font-medium">Overview</div>+ <p className="mt-1 text-xs text-neutral-400">Visitors, pageviews and top pages.</p>+ </a>+ </NavigationMenuLink>+ </div>+ </NavigationMenuContent>+ </NavigationMenuItem>+ <NavigationMenuItem>+ <NavigationMenuLink href="/docs" className={navigationMenuTriggerStyle()}>Docs</NavigationMenuLink>+ </NavigationMenuItem>+ </NavigationMenuList>+</NavigationMenu>+```diff --git a/.design-sync/docs/Popover.md b/.design-sync/docs/Popover.mdnew file mode 100644index 000000000..ce7abae9c--- /dev/null+++ b/.design-sync/docs/Popover.md@@ -0,0 +1,29 @@+---+category: Overlays+---++Non-modal floating panel anchored to a trigger (Radix Popover). Use it for small, focused controls that belong next to the thing they change: date-range presets, a filter's value picker, the site selector, a one-paragraph explanation. Use `DropdownMenu` for a list of commands, `Tooltip` for a label that needs no interaction, and `Dialog` for anything that needs a title and footer.++Parts: `Popover` (root, `open`/`onOpenChange`) → `PopoverTrigger` (`asChild` around a Button) → `PopoverContent` (portalled panel: `w-72 p-4 rounded-md`, raised neutral surface; props `align="start" | "center" | "end"` (default `center`), `side`, `sideOffset` (default 4), `onOpenAutoFocus`). `PopoverAnchor` positions the panel against an element other than the trigger.++Conventions: prefer `align="start"` so the panel lines up with the trigger's left edge. Override width per use (`w-64`, `w-80`, or `w-[var(--radix-popover-trigger-width)]` to match the trigger); pass `p-0` when the content is a `Command` list or a `Calendar`. Inside, use `text-sm`, muted labels in `text-xs text-neutral-400`, and a right-aligned `size="sm"` action row. Inputs inside inherit a slightly lighter border automatically.++```tsx+<Popover>+ <PopoverTrigger asChild>+ <Button variant="outline" size="sm"><CalendarIcon /> Last 7 days</Button>+ </PopoverTrigger>+ <PopoverContent align="start" className="w-64">+ <div className="grid gap-1">+ {["Today", "Last 7 days", "Last 30 days"].map(p => (+ <button key={p} className="rounded-md px-2 py-1.5 text-left text-sm hover:bg-neutral-700/60">{p}</button>+ ))}+ </div>+ <Separator className="my-3 dark:bg-neutral-700" />+ <div className="grid grid-cols-2 gap-2">+ <Input defaultValue="2026-09-06" className="h-8 text-xs" />+ <Input defaultValue="2026-09-13" className="h-8 text-xs" />+ </div>+ </PopoverContent>+</Popover>+```diff --git a/.design-sync/docs/Progress.md b/.design-sync/docs/Progress.mdnew file mode 100644index 000000000..83a21d005--- /dev/null+++ b/.design-sync/docs/Progress.md@@ -0,0 +1,18 @@+---+category: Data display+---++Determinate progress / usage meter (Radix Progress). One export, `Progress`: an 8px-tall, fully rounded neutral-800 track with an emerald (`accent-500`) indicator that slides in by `value` percent. Props: `value` (0-100, `undefined` renders empty), `max` (Radix, default 100), `className` on the track. There is no indeterminate mode — for "loading" use `CardLoader` or `Skeleton`.++Conventions: the bar carries no text, so always pair it with a label and a figure. The canonical usage meter is a `flex justify-between text-sm` row (name left, `812K / 1M` in `tabular-nums text-neutral-400` right), the bar, then a 12px muted note. For inline rows (countries, browsers) shrink the track with `h-1.5` and give the bar `flex-1` between a fixed-width name and a right-aligned percentage. Emerald here means "amount used / achieved", not success; do not recolor the indicator per row (chart series use periwinkle in Nivo, not this component). Use `Slider` when the user should change the value.++```tsx+<div className="flex flex-col gap-2">+ <div className="flex items-center justify-between text-sm">+ <span className="font-medium">Events this month</span>+ <span className="tabular-nums text-neutral-400">812K / 1M</span>+ </div>+ <Progress value={81} />+ <div className="text-xs text-muted-foreground">Resets in 9 days · Pro plan</div>+</div>+```diff --git a/.design-sync/docs/RadioGroup.md b/.design-sync/docs/RadioGroup.mdnew file mode 100644index 000000000..00f194289--- /dev/null+++ b/.design-sync/docs/RadioGroup.md@@ -0,0 +1,28 @@+---+category: Forms+---++Radix radio group for one-of-N choices that need every option visible (retention period, chart interval, visitor scope). Items are 16px circles: 1px `neutral-700` border when idle, emerald (`accent-500`) fill with a white dot when selected, 3px emerald focus ring. Use `Select` instead when there are more than ~5 options or space is tight; use `Checkbox` when choices are independent.++Parts:+- `RadioGroup` — the root (`grid gap-2` by default). Props: `value` / `defaultValue`, `onValueChange`, `disabled`, `name`, `className`.+- `RadioGroupItem` — one option. Props: `value` (required), `id`, `disabled`, `className`. Indicator is internal.++Conventions:+- Each item sits in a `flex items-center gap-2` row with a `Label htmlFor` matching its `id`; option labels use `className="font-normal"`, the group heading is `text-sm font-medium` above.+- Horizontal: `<RadioGroup className="flex gap-4">` for short enums like hour / day / week.+- With descriptions: `flex items-start gap-3`, `className="mt-0.5"` on the item, description in `text-xs text-neutral-400`.+- `disabled` on an item fades it to 50%; add `opacity-70` to that label.++```tsx+<RadioGroup defaultValue="365">+ <div className="flex items-center gap-2">+ <RadioGroupItem value="90" id="r-90" />+ <Label htmlFor="r-90" className="font-normal">90 days</Label>+ </div>+ <div className="flex items-center gap-2">+ <RadioGroupItem value="365" id="r-365" />+ <Label htmlFor="r-365" className="font-normal">1 year</Label>+ </div>+</RadioGroup>+```diff --git a/.design-sync/docs/ResponsiveDialog.md b/.design-sync/docs/ResponsiveDialog.mdnew file mode 100644index 000000000..bfe312786--- /dev/null+++ b/.design-sync/docs/ResponsiveDialog.md@@ -0,0 +1,26 @@+---+category: Overlays+---++One overlay, two presentations: at viewports ≥640px it renders a centered Radix `Dialog`; below that it renders a vaul `Drawer` (bottom sheet with drag handle). Use it for any dialog that also has to work on phones — invite a member, edit a goal, expand a dashboard card. If you only ever need one presentation, use `Dialog`, `Sheet` or `Drawer` directly.++Parts: `ResponsiveDialog` (root; `open`/`onOpenChange`, plus `direction` for the drawer side, `onlyDialog` / `onlyDrawer` to pin a presentation, `dismissible={false}` to block overlay/Escape, `alert` to make it an un-dismissable confirm with no X) → `ResponsiveDialogTrigger` → `ResponsiveDialogContent` (`showCloseButton`, `closeButtonClassName`, `dragHandleClassName`) → `ResponsiveDialogHeader` / `ResponsiveDialogTitle` / `ResponsiveDialogDescription` → body → `ResponsiveDialogFooter` (row on desktop, reversed column on mobile). `ResponsiveDialogClose` wraps a dismissing element. `useResponsiveDialog()` (call inside the root) returns `{ modal, dismissible, direction, onlyDrawer, onlyDialog, alert }` for custom parts.++Conventions: `ResponsiveDialogContent` sets no width or padding, so always pass them — `className="max-w-md p-6"` for a form, `max-w-[1000px] w-[calc(100vw-2rem)] p-4` for a wide card expansion. In drawer mode add `px-4 pb-4` instead. Same footer rule as Dialog: one `accent`/`destructive` confirm, one `ghost`/`outline` cancel.++```tsx+<ResponsiveDialog>+ <ResponsiveDialogTrigger asChild><Button variant="accent">Invite</Button></ResponsiveDialogTrigger>+ <ResponsiveDialogContent className="max-w-md p-6">+ <ResponsiveDialogHeader>+ <ResponsiveDialogTitle>Invite a teammate</ResponsiveDialogTitle>+ <ResponsiveDialogDescription>They get access to every site in Tomato Labs.</ResponsiveDialogDescription>+ </ResponsiveDialogHeader>+ <Input placeholder="[email protected]" />+ <ResponsiveDialogFooter>+ <ResponsiveDialogClose asChild><Button variant="ghost">Cancel</Button></ResponsiveDialogClose>+ <Button variant="accent">Send invite</Button>+ </ResponsiveDialogFooter>+ </ResponsiveDialogContent>+</ResponsiveDialog>+```diff --git a/.design-sync/docs/ScrollArea.md b/.design-sync/docs/ScrollArea.mdnew file mode 100644index 000000000..8f199c052--- /dev/null+++ b/.design-sync/docs/ScrollArea.md@@ -0,0 +1,27 @@+---+category: Data display+---++Custom-scrollbar container for any fixed-height list or wide row (Radix ScrollArea, with a touch-device fallback to native scrolling). Parts: `ScrollArea` (root + viewport; already includes a vertical `ScrollBar`, a corner, and an edge-fade mask) and `ScrollBar` (add one with `orientation="horizontal"` as a child when the content is wider than the panel).++`ScrollArea` props beyond Radix's: `viewportClassName` (classes on the scrolling viewport, e.g. `pr-3`), `maskHeight` (px, default 30; `0` disables the fade), `maskClassName`. Radix props pass through — `type="always"` keeps the bar visible, the default (`hover`, `scrollHideDelay={0}`) reveals it only while the pointer is over the area. The mask is a panel-colored (`neutral-900`) gradient that appears only on edges with more content, so it tells the user "there is more" without a visible scrollbar.++Conventions: the root needs a height (`h-64`, `h-[314px]`, or `h-full min-h-0` inside a flex column) or nothing scrolls; put padding on the inner content, not the root, so the mask and bar sit at the true edge. Use it for dashboard lists (countries, pages, bot rows), dialog bodies, and chip rows; use plain `Table` for short lists that fit. Rows inside are ordinary `flex justify-between` lines with `tabular-nums` figures. The mask assumes the panel is `neutral-900`; on the raw canvas set `maskClassName` or `maskHeight={0}`.++```tsx+<ScrollArea className="h-64 rounded-lg border border-neutral-800 bg-neutral-900">+ <div className="flex flex-col p-2 text-sm">+ {countries.map(([name, n]) => (+ <div key={name} className="flex items-center justify-between px-2 py-1.5">+ <span>{name}</span>+ <span className="tabular-nums text-neutral-400">{n.toLocaleString()}</span>+ </div>+ ))}+ </div>+</ScrollArea>++<ScrollArea className="rounded-lg border border-neutral-800">+ <div className="flex w-max gap-2 p-3">{chips}</div>+ <ScrollBar orientation="horizontal" />+</ScrollArea>+```diff --git a/.design-sync/docs/Select.md b/.design-sync/docs/Select.mdnew file mode 100644index 000000000..6f034a9b6--- /dev/null+++ b/.design-sync/docs/Select.md@@ -0,0 +1,25 @@+---+category: Forms+---++Single-value dropdown (Radix Select) for picking one option from a short, known list: time range, site, timezone, metric. Compose the flat parts: `Select` (root; `value`/`defaultValue`, `onValueChange`, `open`, `disabled`) → `SelectTrigger` (the 36px bordered field; `size="sm"` for the 28px toolbar variant) containing `SelectValue` (shows the chosen item's text or its `placeholder`) → `SelectContent` (portalled popper list, dark neutral-800 panel; pass the same `size`) → `SelectItem` (`value` required; the chosen one shows an emerald check on the right; `disabled` dims it). Group with `SelectGroup` + `SelectLabel` heading and separate groups with `SelectSeparator`. `SelectScrollUpButton` / `SelectScrollDownButton` are already inside `SelectContent`.++Conventions: the trigger is `w-full` by default, so size it with the parent. Keep `size` consistent across Trigger/Content/Item/Label. Use Select when there are 3-12 mutually exclusive options; for 2 options use a `RadioGroup` or `Switch`, for many searchable options use `MultiSelect`/`Command`, for free text with hints use `InputWithSuggestions`. Inside a `Form`, wrap the `SelectTrigger` in `FormControl` and bind `value={field.value} onValueChange={field.onChange}`.++```tsx+<Select defaultValue="7d" onValueChange={setRange}>+ <SelectTrigger>+ <SelectValue placeholder="Pick a range" />+ </SelectTrigger>+ <SelectContent>+ <SelectGroup>+ <SelectLabel>Recent</SelectLabel>+ <SelectItem value="24h">Last 24 hours</SelectItem>+ <SelectItem value="7d">Last 7 days</SelectItem>+ <SelectItem value="30d">Last 30 days</SelectItem>+ </SelectGroup>+ <SelectSeparator />+ <SelectItem value="all">All time</SelectItem>+ </SelectContent>+</Select>+```diff --git a/.design-sync/docs/Separator.md b/.design-sync/docs/Separator.mdnew file mode 100644index 000000000..99e24d508--- /dev/null+++ b/.design-sync/docs/Separator.md@@ -0,0 +1,19 @@+---+category: Data display+---++A 1px hairline (Radix Separator) in neutral-800, the same tone as table row borders. One export, `Separator`. Props: `orientation` (`"horizontal"` default → `h-[1px] w-full`; `"vertical"` → `h-full w-[1px]`), `decorative` (default `true`, so it is hidden from assistive tech; set `false` only when the division is semantic), and `className` for margins or an explicit height.++Conventions: horizontal separators divide text blocks inside a `Card` or settings page — give them vertical breathing room with `my-4` (or `my-3` in dense lists). Between list rows prefer `border-b border-neutral-800` on the row itself rather than a `Separator` per row. A vertical separator is `h-full`, so its parent must have a height: either make the row a fixed-height flex container (`flex h-4 items-center`) or set the height directly (`className="h-5"`) when dividing toolbar button groups. Do not use separators as decoration between every element; the grayscale ramp and spacing should do most of the dividing.++```tsx+<div className="text-sm font-medium">Tracking script</div>+<Separator className="my-4" />+<div className="text-sm font-medium">Data retention</div>++<div className="flex h-9 items-center gap-2">+ <Button variant="ghost" size="sm">Filter</Button>+ <Separator orientation="vertical" className="h-5" />+ <Button variant="ghost" size="sm">Export</Button>+</div>+```diff --git a/.design-sync/docs/Sheet.md b/.design-sync/docs/Sheet.mdnew file mode 100644index 000000000..601920654--- /dev/null+++ b/.design-sync/docs/Sheet.md@@ -0,0 +1,31 @@+---+category: Overlays+---++Edge-anchored panel that slides in over a dimmed page (Radix Dialog under the hood). Use it for secondary work that keeps the page in context: site settings, a site switcher, a filter editor, a bulk-action strip. For a centered task use `Dialog`; for a touch-first bottom panel with drag-to-dismiss use `Drawer`.++Parts: `Sheet` (root, `open`/`onOpenChange`) → `SheetTrigger` (`asChild` around a Button) → `SheetContent` (portalled panel; `side="right" | "left" | "top" | "bottom"`, default `right`; `showClose={false}` hides the built-in X) → `SheetHeader` / `SheetTitle` / `SheetDescription` → your content → `SheetFooter` (right-aligned actions). `SheetClose` wraps any element that should dismiss.++Conventions: `right` is the default and the one to reach for; `left` reads as navigation; `bottom`/`top` are full-width strips, so keep them short (a title line plus actions). Side panels are `w-3/4` capped at `max-w-sm` (384px), so lay the body out as a single column with `grid gap-4 py-6`. Footer holds one `accent` confirm plus a `ghost`/`outline` cancel. Group settings rows as bordered cards (`rounded-lg border border-neutral-800 p-3`) with a `Switch` on the right.++```tsx+<Sheet>+ <SheetTrigger asChild><Button variant="outline">Settings</Button></SheetTrigger>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>Site settings</SheetTitle>+ <SheetDescription>tomato.gg</SheetDescription>+ </SheetHeader>+ <div className="grid gap-4 py-6">+ <div className="grid gap-1.5">+ <Label htmlFor="domain">Domain</Label>+ <Input id="domain" defaultValue="tomato.gg" />+ </div>+ </div>+ <SheetFooter>+ <SheetClose asChild><Button variant="ghost">Cancel</Button></SheetClose>+ <Button variant="accent">Save changes</Button>+ </SheetFooter>+ </SheetContent>+</Sheet>+```diff --git a/.design-sync/docs/Skeleton.md b/.design-sync/docs/Skeleton.mdnew file mode 100644index 000000000..898da68a0--- /dev/null+++ b/.design-sync/docs/Skeleton.md@@ -0,0 +1,24 @@+---+category: Data display+---++Loading placeholder. `Skeleton` is a single `div` with `animate-pulse`, 2.8px radius, and a neutral-850 fill (one step above the card surface); it has no intrinsic size, so every instance needs a height and width class. Compose skeletons to mirror the shape of the content they replace — the layout should not jump when real data lands.++Conventions:+- Stat tile: keep the real label, replace the figure with `h-9 w-[60px]` and the delta with `h-5 w-[50px]` (this is exactly what the overview does).+- Table / list: one `h-4` bar per row, `flex-1` for the name column and a fixed `w-12` for the figure column; 5-6 rows.+- Text: `h-5` for a title, `h-4 w-full` body lines, make the last line shorter (`w-64`).+- Avatar: `h-8 w-8 rounded-full`.+- Put skeletons inside the same `Card` / `CardContent` the data will use; for an in-place refetch over existing data use `CardLoader` instead.++```tsx+<Card>+ <div className="flex flex-col px-3 py-2">+ <div className="text-xs font-medium text-muted-foreground">Unique visitors</div>+ <div className="flex items-center justify-between">+ <Skeleton className="h-9 w-[60px] rounded-md" />+ <Skeleton className="h-5 w-[50px] rounded-md" />+ </div>+ </div>+</Card>+```diff --git a/.design-sync/docs/Slider.md b/.design-sync/docs/Slider.mdnew file mode 100644index 000000000..e1ea8d3de--- /dev/null+++ b/.design-sync/docs/Slider.md@@ -0,0 +1,20 @@+---+category: Forms+---++Numeric range control (Radix Slider) for settings that are tuned rather than typed: replay sample rate, session-duration filter, retention window. One component, no sub-parts: `Slider`. Props are Radix's: `defaultValue` / `value` as a number array (one entry per thumb, so `[40]` is a single thumb and `[30, 300]` is a two-thumb range), `onValueChange(values)`, `min` / `max` (default 0-100), `step`, `disabled`, `orientation`. It stretches to `w-full`.++Appearance: a 6px neutral-800 track, the filled range in emerald (`accent-500`), 16px near-black thumbs with a neutral-800 border. There is no built-in value label; pair it with a `Label` and put the current value in a muted `text-sm tabular-nums text-neutral-400` span on the same row. `disabled` blocks interaction but draws the same (Radix puts the disabled state on a span, so the thumb's opacity rule never matches); dim the whole row yourself if the state must read visually. Use `Slider` for approximate values where seeing the position matters; use an `Input type="number"` when the exact figure matters.++```tsx+const [rate, setRate] = React.useState([40]);++<div className="flex items-center justify-between mb-3">+ <Label>Session replay sample rate</Label>+ <span className="text-sm tabular-nums text-neutral-400">{rate[0]}%</span>+</div>+<Slider value={rate} onValueChange={setRate} max={100} step={5} />++// two thumbs = range+<Slider defaultValue={[30, 300]} min={0} max={600} step={10} />+```diff --git a/.design-sync/docs/Switch.md b/.design-sync/docs/Switch.mdnew file mode 100644index 000000000..62c1c3032--- /dev/null+++ b/.design-sync/docs/Switch.md@@ -0,0 +1,23 @@+---+category: Forms+---++Radix toggle for a single setting that takes effect immediately (session replay on/off, public dashboard, live mode). Track is 36×20px with a 16px white thumb: emerald (`accent-500`) when on, `neutral-800` when off, 50% opacity when disabled. Use `Checkbox` when the choice is submitted with a form or is one of many, and `RadioGroup` for mutually exclusive options.++Parts: `Switch` only (thumb is internal). Props: `checked` / `defaultChecked`, `onCheckedChange`, `disabled`, `id`, `name`, `className`. It carries the `peer` class, so a following `Label` fades automatically when the switch is disabled.++Conventions:+- Inline: `flex items-center gap-2` with the `Switch` first, then `Label htmlFor`.+- Settings list (the common case): rows of `flex items-center justify-between gap-4 px-4 py-3` inside a `divide-y divide-neutral-800 rounded-lg border border-neutral-800 bg-neutral-900` panel; label + `text-xs text-neutral-400` description on the left, switch on the right.+- One switch per row; never stack switches horizontally. Keep the label a noun phrase ("Web vitals"), not a verb.+- Hover/pressed transitions are not shown in previews.++```tsx+<div className="flex items-center justify-between gap-4 px-4 py-3">+ <div className="grid gap-0.5">+ <Label htmlFor="replay">Session replay</Label>+ <p className="text-xs text-neutral-400">Record sessions for the last 7 days.</p>+ </div>+ <Switch id="replay" defaultChecked />+</div>+```diff --git a/.design-sync/docs/Table.md b/.design-sync/docs/Table.mdnew file mode 100644index 000000000..f8dc5d727--- /dev/null+++ b/.design-sync/docs/Table.md@@ -0,0 +1,24 @@+---+category: Data display+---++Data table for dense analytics lists. Parts: `Table` (scroll wrapper + `<table>`) → `TableHeader` (neutral-850 band) → `TableRow` → `TableHead`; `TableBody` → `TableRow` → `TableCell`; optional `TableFooter` (totals) and `TableCaption` (below the table, muted). `TableSortIndicator` renders the sort chevrons for a sortable column: `sortDirection="asc" | "desc"` shows a blue arrow, `undefined` shows the neutral double chevron, `canSort={false}` hides it.++Conventions: 14px text, 8px cell padding, hairline row borders, no zebra striping. Right-align numeric columns and add `tabular-nums`. Keep the first column a name/path in `font-medium`. Use `Badge` for status cells and `Skeleton` rows while loading.++```tsx+<Table>+ <TableHeader>+ <TableRow>+ <TableHead>Page</TableHead>+ <TableHead className="text-right">Visitors <TableSortIndicator sortDirection="desc" /></TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ <TableRow>+ <TableCell className="font-medium">/pricing</TableCell>+ <TableCell className="text-right tabular-nums">6,120</TableCell>+ </TableRow>+ </TableBody>+</Table>+```diff --git a/.design-sync/docs/Tabs.md b/.design-sync/docs/Tabs.mdnew file mode 100644index 000000000..dc608a525--- /dev/null+++ b/.design-sync/docs/Tabs.md@@ -0,0 +1,25 @@+---+category: Navigation+---++Segmented tabs (Radix). A filled `TabsList` pill strip where the active `TabsTrigger` lifts to a darker surface; each `TabsContent` panel shows only while its `value` is active. Use it to switch between views of one thing (Overview / Sessions / Goals, Desktop / Mobile). For the lighter underline style used inside report cards use `BasicTabs`.++Parts: `Tabs` (root; `defaultValue` for uncontrolled, `value` / `onValueChange` for controlled) → `TabsList` (36px strip, `bg-neutral-800`, `inline-flex` by default; add `grid w-full grid-cols-N` to stretch triggers evenly) → `TabsTrigger` (`value`, `disabled`; active state is `bg-neutral-950` with bright text) and `TabsContent` (`value`; adds `mt-2`).++Conventions: 2-5 triggers, sentence-case labels, no icons. Keep the list left-aligned above its content; stretch it full-width only for two-way toggles. Disable a trigger for a feature the plan lacks rather than hiding it. Focus rings are keyboard-only and are not shown in the static preview.++```tsx+<Tabs defaultValue="overview">+ <TabsList>+ <TabsTrigger value="overview">Overview</TabsTrigger>+ <TabsTrigger value="sessions">Sessions</TabsTrigger>+ <TabsTrigger value="goals">Goals</TabsTrigger>+ <TabsTrigger value="replay" disabled>Replay</TabsTrigger>+ </TabsList>+ <TabsContent value="overview">+ <div className="grid grid-cols-2 gap-3">{/* stat cards */}</div>+ </TabsContent>+ <TabsContent value="sessions">…</TabsContent>+ <TabsContent value="goals">…</TabsContent>+</Tabs>+```diff --git a/.design-sync/docs/Textarea.md b/.design-sync/docs/Textarea.mdnew file mode 100644index 000000000..189a13ad3--- /dev/null+++ b/.design-sync/docs/Textarea.md@@ -0,0 +1,22 @@+---+category: Forms+---++Multi-line text field for notes, descriptions and pasted snippets. Same chassis as `Input` (transparent fill, 1px `neutral-800` border, `neutral-400` placeholder, ring on focus) with a 60px minimum height and vertical resize. Use it for annotation notes, site descriptions, alert messages, and raw filter/config text; use `Input` for anything that fits on one line.++Parts: `Textarea` only. Forwards every native `<textarea>` prop (`rows`, `placeholder`, `defaultValue`, `disabled`, `aria-invalid`, `ref`).++Conventions:+- Default height is `min-h-[60px]`; set `rows={5}` (or `className="min-h-32"`) for longer content.+- Text is 14px at md+ (`text-base` on phones so iOS doesn't zoom). Add `font-mono text-xs` for code-like content such as rule DSLs.+- There is no invalid style baked in (unlike `Input`): pass `aria-invalid="true"` for accessibility plus `className="dark:border-red-400"` for the red border (the `dark:` prefix is required: the component's own `dark:border-neutral-800` overrides a bare `border-red-400`), and put the message in a `text-xs text-red-400` line below. A right-aligned `text-xs text-neutral-400 tabular-nums` counter goes on the same row.+- `disabled` fades to 50% opacity. Always pair with a `Label` via `htmlFor`.++```tsx+<div className="grid gap-1.5">+ <Label htmlFor="note">Annotation note</Label>+ <Textarea id="note" placeholder="What changed on this date?" />+</div>++<Textarea rows={5} className="font-mono text-xs" defaultValue={"path contains /docs\nAND country is Germany"} />+```diff --git a/.design-sync/docs/TimelineSlider.md b/.design-sync/docs/TimelineSlider.mdnew file mode 100644index 000000000..2b20db67e--- /dev/null+++ b/.design-sync/docs/TimelineSlider.md@@ -0,0 +1,28 @@+---+category: Replay+---++The minimal playback rail of the session-replay transport bar: a 2px neutral-800 track, an emerald (`accent-500`) played range and a 10px emerald-300 thumb that scales up on hover and shows a grab cursor. Use it for any "position in time" control (replay progress, a funnel-step scrubber); use `Slider` for a value input with a visible track height, and `ActivitySlider` when the rail should also plot events and activity.++Single part: `TimelineSlider`, a thin wrapper over Radix `Slider.Root`, so the whole Radix API applies: `value` / `defaultValue` as a one-element array in the unit you choose (milliseconds for replay), `max` (the duration), `min`, `step`, `onValueChange`, `onValueCommit` (seek on release), `disabled`, `orientation`. Pass `className="flex-1"` so it fills the space between the elapsed and total times.++Conventions: sit it in a `flex items-center gap-3` bar on a neutral-900 panel with ghost `smIcon` transport buttons on the left, `m:ss` elapsed and total in 12px muted tabular figures on either side, and a playback-rate label at the end. Hover/active scaling can't be rendered statically. The thumb hue is the only chromatic element on the bar; everything else stays neutral.++```tsx+import { Button, TimelineSlider } from "@rybbit/ui";+import { Pause } from "lucide-react";++<div className="flex items-center gap-3 rounded-lg border border-neutral-800 bg-neutral-900 px-4 py-3">+ <Button size="smIcon" variant="ghost" aria-label="Pause"><Pause /></Button>+ <span className="text-xs tabular-nums text-neutral-400">0:42</span>+ <TimelineSlider+ className="flex-1"+ max={duration}+ step={100}+ value={[currentTime]}+ onValueChange={([t]) => setCurrentTime(t)}+ onValueCommit={([t]) => player.seek(t)}+ />+ <span className="text-xs tabular-nums text-neutral-400">3:00</span>+</div>+```diff --git a/.design-sync/docs/Toaster.md b/.design-sync/docs/Toaster.mdnew file mode 100644index 000000000..8e83d75de--- /dev/null+++ b/.design-sync/docs/Toaster.md@@ -0,0 +1,31 @@+---+category: Feedback+---++Transient confirmations after an action ("Settings saved", "Couldn't verify domain"). Mount ONE `<Toaster />` at the app root (it is a configured react-hot-toast host: bottom-right, neutral-850 card with neutral-200 text in dark mode, 4.8px radius, 14px medium) and fire messages from anywhere with the `toast` function. Toasts stack newest at the bottom and auto-dismiss (success ~2s, default/error ~4s), so keep the message to one line that reads on its own. For state that must persist on the page use `Alert`; for something the user must acknowledge use `AlertDialog`.++Parts: `Toaster` (the host, no props) and `toast` (the API). The API takes a plain string: `toast(message)` (no icon), `toast.success(message)` (emerald check), `toast.error(message)` (red cross), `toast.info(message)` (an "i" glyph), `toast.dismiss(id?)` (dismiss one or all), `toast.custom(node, opts)` (escape hatch for a fully custom body). Every call returns the toast id.++Conventions: one toast per user action; name the object ("Goal “Signup completed” created", "Settings saved for tomato.gg"); an error says what to do next. Never use a toast for validation (that belongs in `FormMessage`) or for anything the user has to read later.++```tsx+import { Button, Toaster, toast } from "@rybbit/ui";++// once, at the root+<Toaster />++// anywhere+<Button+ variant="accent"+ onClick={async () => {+ try {+ await saveSettings();+ toast.success("Settings saved for tomato.gg");+ } catch {+ toast.error("Couldn't save settings. Try again.");+ }+ }}+>+ Save changes+</Button>+```diff --git a/.design-sync/docs/Tooltip.md b/.design-sync/docs/Tooltip.mdnew file mode 100644index 000000000..16888d3c8--- /dev/null+++ b/.design-sync/docs/Tooltip.md@@ -0,0 +1,30 @@+---+category: Overlays+---++Hover/focus label (Radix Tooltip). Use it to name icon-only buttons and to explain a metric or setting in one or two short lines. It is not interactive: if the content needs a link, a button or more than a couple of sentences, use `Popover` instead. `RybbitTheme` already mounts the required `TooltipProvider`, so never add another.++Parts: `Tooltip` (root; `open` for a controlled state, `delayDuration` default 300ms) → `TooltipTrigger` (`asChild` around the Button or icon) → `TooltipContent` (portalled: `text-xs`, raised neutral surface with a hairline border; props `side="top" | "right" | "bottom" | "left"` (default `top`), `align`, `sideOffset` default 4). `TooltipProvider` is exported but only for apps that opt out of `RybbitTheme`.++Conventions: keep the default `top` unless the trigger sits at a viewport edge. Content is sentence case, no trailing period for a single label. For a two-line explainer, put a `font-medium` heading first and the body in `text-neutral-400`, and cap width with `max-w-56`. Always give icon-only triggers an `aria-label` that matches the tooltip text. The hover-in state cannot be rendered statically; the previews use `open`.++```tsx+<Tooltip>+ <TooltipTrigger asChild>+ <Button variant="outline" size="icon" aria-label="Site settings">+ <Settings />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Site settings</TooltipContent>+</Tooltip>++<Tooltip>+ <TooltipTrigger asChild>+ <button type="button" aria-label="What is bounce rate?"><Info className="h-3.5 w-3.5" /></button>+ </TooltipTrigger>+ <TooltipContent side="right" align="start" className="max-w-56">+ <p className="font-medium">Bounce rate</p>+ <p className="mt-1 text-neutral-400">Sessions with one pageview and no events.</p>+ </TooltipContent>+</Tooltip>+```diff --git a/.design-sync/pkg/build.mjs b/.design-sync/pkg/build.mjsnew file mode 100644index 000000000..3e04b34e5--- /dev/null+++ b/.design-sync/pkg/build.mjs@@ -0,0 +1,99 @@+// Builds the design-sync facade package from the app's real sources:+// dist/index.js ESM bundle of src/index.ts (deps stay external)+// dist/types/**/*.d.ts tsc declarations (rootDir = repo root)+// dist/styles.css client/src/app/globals.css compiled by Tailwind v4+// dist/fonts/*.woff2 Inter subsets vendored from the Next build+// Toolchain: esbuild from ../../.ds-sync (the staged converter deps),+// typescript / postcss / @tailwindcss/postcss from ../../client/node_modules.+import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";+import { createRequire } from "node:module";+import { dirname, join, relative, resolve } from "node:path";+import { spawnSync } from "node:child_process";+import { fileURLToPath } from "node:url";++const PKG = dirname(fileURLToPath(import.meta.url));+const REPO = resolve(PKG, "../..");+const CLIENT = join(REPO, "client");+const CLIENT_NM = join(CLIENT, "node_modules");+const DIST = join(PKG, "dist");++// 1. node_modules symlink so tsc, ts-morph, and node resolution see the app's deps.+const nmLink = join(PKG, "node_modules");+if (!existsSync(nmLink)) symlinkSync(relative(PKG, CLIENT_NM), nmLink, "dir");++rmSync(DIST, { recursive: true, force: true });+mkdirSync(DIST, { recursive: true });++// 2. JS bundle.+const dsRequire = createRequire(join(REPO, ".ds-sync", "package.json"));+const clientRequire = createRequire(join(CLIENT, "package.json"));+const esbuild = dsRequire("esbuild");+const aliasPlugin = {+ name: "rybbit-alias",+ setup(b) {+ b.onResolve({ filter: /^@\// }, (args) => {+ if (args.path === "@/lib/utils") return { path: join(PKG, "src/shims/utils.ts") };+ const stem = join(CLIENT, "src", args.path.slice(2));+ for (const ext of ["", ".ts", ".tsx", "/index.ts", "/index.tsx"]) {+ const p = stem + ext;+ if (existsSync(p) && !(ext === "" && !/\.[tj]sx?$/.test(p))) return { path: p };+ }+ return { errors: [{ text: `unresolved alias ${args.path}` }] };+ });+ },+};+const res = await esbuild.build({+ entryPoints: [join(PKG, "src/index.ts")],+ outfile: join(DIST, "index.js"),+ bundle: true,+ format: "esm",+ platform: "browser",+ target: "es2020",+ jsx: "automatic",+ packages: "external",+ plugins: [aliasPlugin],+ logLevel: "silent",+ nodePaths: [CLIENT_NM],+});+const realWarnings = res.warnings.filter((w) => !/use client/.test(w.text));+for (const w of realWarnings) console.error(` esbuild: ${w.text}`);+console.error(` dist/index.js: ${(readFileSync(join(DIST, "index.js")).length / 1024).toFixed(0)} KB`);++// 3. Declarations.+const tsc = join(CLIENT_NM, ".bin", "tsc");+const r = spawnSync(tsc, ["-p", join(PKG, "tsconfig.json")], { cwd: PKG, encoding: "utf8" });+const tsErrors = (r.stdout.match(/error TS\d+/g) ?? []).length;+if (tsErrors) console.error(` tsc: ${tsErrors} type error(s) (declarations still emitted):\n${r.stdout.split("\n").slice(0, 8).join("\n")}`);+const typesEntry = join(DIST, "types/.design-sync/pkg/src/index.d.ts");+if (!existsSync(typesEntry)) { console.error(` tsc: no declarations emitted\n${r.stdout}${r.stderr}`); process.exit(1); }+// tsc keeps `@/` specifiers verbatim; rewrite them to relative paths so the+// .d.ts tree resolves without a paths-aware host.+const walk = (d) => readdirSync(d, { withFileTypes: true }).flatMap((e) => e.isDirectory() ? walk(join(d, e.name)) : e.name.endsWith(".d.ts") ? [join(d, e.name)] : []);+const typesRoot = join(DIST, "types");+let rewritten = 0;+for (const f of walk(typesRoot)) {+ const src = readFileSync(f, "utf8");+ const out = src.replace(/(from\s+|import\()["']@\/([^"']+)["']/g, (_, pre, rest) => {+ const target = rest === "lib/utils"+ ? join(typesRoot, ".design-sync/pkg/src/shims/utils")+ : join(typesRoot, "client/src", rest);+ let rel = relative(dirname(f), target).split("\\").join("/");+ if (!rel.startsWith(".")) rel = "./" + rel;+ return `${pre}"${rel}"`;+ });+ if (out !== src) { writeFileSync(f, out); rewritten++; }+}+// Root-level entry so the types root is dist/types (the converter parses the+// whole tree under dirname(package.json#types)).+writeFileSync(join(typesRoot, "index.d.ts"), 'export * from "./.design-sync/pkg/src/index";\n');+console.error(` dist/types: ${walk(typesRoot).length} .d.ts files (${rewritten} alias-rewritten)`);++// 4. CSS + fonts.+const postcss = clientRequire("postcss");+const tailwind = clientRequire("@tailwindcss/postcss");+const cssIn = join(PKG, "src/styles.css");+const cssRes = await postcss([tailwind({ base: PKG })]).process(readFileSync(cssIn, "utf8"), { from: cssIn, to: join(DIST, "styles.css"), map: false });+writeFileSync(join(DIST, "styles.css"), cssRes.css);+mkdirSync(join(DIST, "fonts"), { recursive: true });+for (const f of readdirSync(join(PKG, "fonts"))) if (/\.woff2?$/.test(f)) cpSync(join(PKG, "fonts", f), join(DIST, "fonts", f));+console.error(` dist/styles.css: ${(cssRes.css.length / 1024).toFixed(0)} KB; fonts: ${readdirSync(join(DIST, "fonts")).join(", ")}`);diff --git a/.design-sync/pkg/fonts/inter-latin-ext.woff2 b/.design-sync/pkg/fonts/inter-latin-ext.woff2new file mode 100644index 000000000..57da6f8d4Binary files /dev/null and b/.design-sync/pkg/fonts/inter-latin-ext.woff2 differdiff --git a/.design-sync/pkg/fonts/inter-latin.woff2 b/.design-sync/pkg/fonts/inter-latin.woff2new file mode 100644index 000000000..91dc3e852Binary files /dev/null and b/.design-sync/pkg/fonts/inter-latin.woff2 differdiff --git a/.design-sync/pkg/package.json b/.design-sync/pkg/package.jsonnew file mode 100644index 000000000..90b90f1fe--- /dev/null+++ b/.design-sync/pkg/package.json@@ -0,0 +1,12 @@+{+ "name": "@rybbit/ui",+ "version": "2.9.1",+ "private": true,+ "description": "Design-sync facade over client/src/components/ui (built by build.mjs, never published)",+ "type": "module",+ "module": "dist/index.js",+ "types": "dist/types/index.d.ts",+ "scripts": {+ "build": "node build.mjs"+ }+}diff --git a/.design-sync/pkg/src/RybbitTheme.tsx b/.design-sync/pkg/src/RybbitTheme.tsxnew file mode 100644index 000000000..a58f9db5a--- /dev/null+++ b/.design-sync/pkg/src/RybbitTheme.tsx@@ -0,0 +1,44 @@+"use client";++import * as React from "react";+import { ThemeProvider } from "next-themes";+import { TooltipProvider } from "@/components/ui/tooltip";+import { cn } from "@/lib/utils";++export interface RybbitThemeProps {+ /** Rybbit is dark-mode-first; "light" mirrors every token. */+ theme?: "dark" | "light";+ className?: string;+ children?: React.ReactNode;+}++/**+ * Root wrapper for anything built with the Rybbit UI kit. Mirrors the app's+ * root layout + Providers: the theme class on <html> (tokens live on `.dark` /+ * `:root`, and portalled overlays read it from there), the canvas colours on+ * <body>, the Inter font stack, next-themes context (CardLoader / Toaster+ * read `useTheme`), and the TooltipProvider that Radix tooltips require.+ */+export function RybbitTheme({ theme = "dark", className, children }: RybbitThemeProps) {+ React.useLayoutEffect(() => {+ const root = document.documentElement;+ root.classList.toggle("dark", theme === "dark");+ root.style.colorScheme = theme;+ // Inline styles: the host page may paint <body> with an unlayered rule+ // that beats layered utility classes.+ document.body.style.backgroundColor = "var(--color-background)";+ document.body.style.color = "var(--color-foreground)";+ }, [theme]);+ return (+ <ThemeProvider attribute="class" forcedTheme={theme} enableSystem={false} disableTransitionOnChange>+ <TooltipProvider delayDuration={200}>+ <div+ data-rybbit-theme={theme}+ className={cn("rybbit-theme bg-background text-foreground", theme === "dark" && "dark", className)}+ >+ {children}+ </div>+ </TooltipProvider>+ </ThemeProvider>+ );+}diff --git a/.design-sync/pkg/src/index.ts b/.design-sync/pkg/src/index.tsnew file mode 100644index 000000000..03857ed36--- /dev/null+++ b/.design-sync/pkg/src/index.ts@@ -0,0 +1,48 @@+// Barrel over client/src/components/ui. One `export *` per file so the shipped+// bundle is exactly the app's own primitives. basic-tabs shares its export+// names with tabs, so its four exports are re-exported under a BasicTabs prefix.+export * from "@/components/ui/activity-slider";+export * from "@/components/ui/alert";+export * from "@/components/ui/alert-dialog";+export * from "@/components/ui/badge";+export {+ Tabs as BasicTabs,+ TabsList as BasicTabsList,+ TabsTrigger as BasicTabsTrigger,+ TabsContent as BasicTabsContent,+} from "@/components/ui/basic-tabs";+export * from "@/components/ui/breadcrumb";+export * from "@/components/ui/button";+export * from "@/components/ui/button-group";+export * from "@/components/ui/calendar";+export * from "@/components/ui/card";+export * from "@/components/ui/carousel";+export * from "@/components/ui/checkbox";+export * from "@/components/ui/command";+export * from "@/components/ui/dialog";+export * from "@/components/ui/drawer";+export * from "@/components/ui/dropdown-menu";+export * from "@/components/ui/form";+export * from "@/components/ui/input";+export * from "@/components/ui/input-with-suggestions";+export * from "@/components/ui/label";+export * from "@/components/ui/multi-select";+export * from "@/components/ui/navigation-menu";+export * from "@/components/ui/popover";+export * from "@/components/ui/progress";+export * from "@/components/ui/radio-group";+export * from "@/components/ui/responsive-dialog";+export * from "@/components/ui/scroll-area";+export * from "@/components/ui/select";+export * from "@/components/ui/separator";+export * from "@/components/ui/sheet";+export * from "@/components/ui/skeleton";+export * from "@/components/ui/slider";+export * from "@/components/ui/sonner";+export * from "@/components/ui/switch";+export * from "@/components/ui/table";+export * from "@/components/ui/tabs";+export * from "@/components/ui/textarea";+export * from "@/components/ui/timeline-slider";+export * from "@/components/ui/tooltip";+export * from "./RybbitTheme";diff --git a/.design-sync/pkg/src/shims/utils.ts b/.design-sync/pkg/src/shims/utils.tsnew file mode 100644index 000000000..fe67d6dcc--- /dev/null+++ b/.design-sync/pkg/src/shims/utils.ts@@ -0,0 +1,13 @@+// Design-sync shim for client/src/lib/utils. The real module drags in luxon,+// the Avatar component, and the app store; the ui/ primitives only use cn().+import { clsx, type ClassValue } from "clsx";+import { twMerge } from "tailwind-merge";++export function cn(...inputs: ClassValue[]) {+ return twMerge(clsx(inputs));+}++const userLocale = typeof navigator !== "undefined" ? navigator.language : "en-US";++/** Compact number formatter (1.2K, 3.4M) — same as the app's. */+export const formatter = Intl.NumberFormat(userLocale, { notation: "compact" }).format;diff --git a/.design-sync/pkg/src/styles.css b/.design-sync/pkg/src/styles.cssnew file mode 100644index 000000000..4c8b2234b--- /dev/null+++ b/.design-sync/pkg/src/styles.css@@ -0,0 +1,95 @@+/* Design-sync stylesheet entry. Compiles the app's real globals.css (Tailwind+ v4 + tokens) against the whole client app, the authored previews, and this+ package, then adds the Inter faces the app normally gets from next/font. */+@import "../../../client/src/app/globals.css";+@source "../../../client/src";+@source "../../previews";+@source "./";++/* ---- Safelist: utilities a design agent reaches for that the app itself may+ not use. Tailwind v4 `@source inline()` with brace expansion; every class+ below is generated regardless of scanning. Keep it to the DS vocabulary. ---- */+@source inline("{,hover:,dark:,dark:hover:}{bg,text,border}-{neutral-{0,50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000},accent-{50,100,200,300,400,500,600,700,800,900,950},emerald-{50,100,200,300,400,500,600,700,800,900,950},red-{50,100,200,300,400,500,600,700,800,900,950},yellow-{50,100,200,300,400,500,600,700,800,900,950},blue-{50,100,200,300,400,500,600,700,800,900,950},green-{50,100,200,300,400,500,600,700,800,900,950},amber-{100,200,300,400,500,600,700,800,900},orange-{100,200,300,400,500,600,700,800,900},violet-{100,200,300,400,500,600,700,800,900},background,foreground,card,card-foreground,popover,popover-foreground,muted,muted-foreground,accent,accent-foreground,primary,primary-foreground,secondary,secondary-foreground,destructive,destructive-foreground,border,input,ring,dataviz,dataviz-2,white,black,transparent}");+@source inline("{bg,text,border}-{neutral-{400,500,800,850,900},accent-{400,500,600},emerald-{400,500,600},red-{400,500},yellow-{400,500},blue-{400,500},dataviz,white,black}/{5,10,15,20,30,40,50,60,70,80,90}");+@source inline("{p,px,py,pt,pb,pl,pr,m,mx,my,mt,mb,ml,mr,gap,gap-x,gap-y,space-x,space-y}-{0,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32}");+@source inline("{mx,ml,mr,mt,mb}-auto");+@source inline("{w,h,min-w,min-h,max-w,max-h,size}-{0,1,2,3,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,px,full,screen,auto,fit,min,max}");+@source inline("{w,h}-{1/2,1/3,2/3,1/4,3/4,1/5,2/5,3/5,4/5,1/6,5/6}");+@source inline("max-w-{xs,sm,md,lg,xl,2xl,3xl,4xl,5xl,6xl,7xl,prose,none}");+@source inline("{min-h,h}-{dvh,svh}");+@source inline("{,sm:,md:,lg:,xl:}grid-cols-{1,2,3,4,5,6,7,8,9,10,11,12,none}");+@source inline("{,sm:,md:,lg:}col-span-{1,2,3,4,5,6,7,8,9,10,11,12,full}");+@source inline("{grid-rows,row-span}-{1,2,3,4,5,6}");+@source inline("{,sm:,md:,lg:}{flex,grid,block,inline,inline-block,inline-flex,hidden,contents}");+@source inline("{,sm:,md:,lg:}flex-{row,row-reverse,col,col-reverse,wrap,nowrap,1,auto,initial,none}");+@source inline("{grow,grow-0,shrink,shrink-0,basis-0,basis-full,basis-auto}");+@source inline("{items,self}-{start,end,center,baseline,stretch}");+@source inline("{justify,content}-{start,end,center,between,around,evenly,stretch}");+@source inline("{justify-items,place-items}-{start,end,center,stretch}");+@source inline("order-{1,2,3,first,last}");+@source inline("text-{xs,sm,base,lg,xl,2xl,3xl,4xl,5xl,left,center,right,justify}");+@source inline("font-{normal,medium,semibold,bold,mono,sans}");+@source inline("leading-{none,tight,snug,normal,relaxed,3,4,5,6,7,8}");+@source inline("tracking-{tighter,tight,normal,wide,wider}");+@source inline("{truncate,tabular-nums,uppercase,lowercase,capitalize,normal-case,underline,no-underline,line-through,italic,not-italic,whitespace-nowrap,whitespace-pre-wrap,break-words,break-all,antialiased,sr-only}");+@source inline("line-clamp-{1,2,3,4}");+@source inline("underline-offset-{2,4}");+@source inline("rounded-{none,xs,sm,md,lg,xl,2xl,3xl,full}");+@source inline("rounded-{t,b,l,r,tl,tr,bl,br}-{none,sm,md,lg,xl,full}");+@source inline("border-{0,2,4,t,b,l,r,x,y,t-0,b-0,l-0,r-0}");+@source inline("{border,divide-x,divide-y,divide-y-0,ring,ring-0,ring-1,ring-2,ring-inset,outline-none,border-dashed,border-dotted,border-solid}");+@source inline("divide-{neutral-{100,150,200,800,850,900},border}");+@source inline("ring-{neutral-{300,700,800,950},accent-500,red-500,ring}");+@source inline("{ring,border,outline}-offset-{0,1,2}");+@source inline("shadow-{none,xs,sm,md,lg,xl}");+@source inline("opacity-{0,5,10,20,25,30,40,50,60,70,75,80,90,100}");+@source inline("{hover:,}opacity-{50,70,80,90,100}");+@source inline("{relative,absolute,fixed,sticky,static,inset-0,inset-x-0,inset-y-0,isolate}");+@source inline("{top,bottom,left,right}-{0,1,2,3,4,6,8,1/2,full,auto}");+@source inline("z-{0,10,20,30,40,50,auto}");+@source inline("overflow-{hidden,auto,visible,scroll,x-auto,y-auto,x-hidden,y-hidden,clip}");+@source inline("{cursor-pointer,cursor-default,cursor-not-allowed,select-none,select-text,pointer-events-none,pointer-events-auto,appearance-none,resize-none}");+@source inline("{transition,transition-all,transition-colors,transition-opacity,transition-transform,duration-100,duration-150,duration-200,duration-300,ease-in-out,ease-out,animate-pulse,animate-spin,animate-none}");+@source inline("{scale,hover:scale}-{95,100,105}");+@source inline("{translate-x,translate-y,-translate-x,-translate-y}-{0,1,2,1/2,full}");+@source inline("aspect-{square,video,auto}");+@source inline("object-{cover,contain,center}");+@source inline("list-{none,disc,decimal,inside,outside}");+@source inline("{table,table-auto,table-fixed,border-collapse,border-separate,caption-bottom,align-middle,align-top,align-bottom}");+@source inline("{bg-gradient-to-r,bg-gradient-to-b,bg-gradient-to-t}");+@source inline("{from,to,via}-{neutral-{800,900,950},background,transparent}");+@source inline("{focus-visible:,focus:}{ring-1,ring-2,ring-neutral-300,ring-neutral-950,outline-none,border-neutral-600}");+@source inline("{disabled:opacity-50,disabled:pointer-events-none,disabled:cursor-not-allowed}");+@source inline("{group,group-hover:opacity-100,group-hover:text-foreground,group-hover:bg-neutral-800,peer}");+@source inline("[&_svg]:size-{3,4,5}");+@source inline("{h,w,size}-{3,3.5,4,5,6}");+@source inline("{sm:,md:,lg:}{p,px,py,gap}-{2,3,4,6,8}");+@source inline("{sm:,md:,lg:}{text-sm,text-base,text-lg,text-xl,text-2xl,text-3xl}");+@source inline("{sm:,md:,lg:}{w,max-w}-{64,72,80,96,full,sm,md,lg,xl,2xl,3xl}");+@source inline("{first:,last:}{border-0,border-t-0,border-b-0,rounded-t-lg,rounded-b-lg,pt-0,pb-0}");+@source inline("{even:,odd:}bg-{neutral-900,neutral-950,neutral-50}");+@source inline("{dark:,}{placeholder:text-neutral-400,placeholder:text-neutral-500}");++@font-face {+ font-family: Inter;+ font-style: normal;+ font-weight: 100 900;+ font-display: swap;+ src: url(./fonts/inter-latin.woff2) format("woff2");+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;+}+@font-face {+ font-family: Inter;+ font-style: normal;+ font-weight: 100 900;+ font-display: swap;+ src: url(./fonts/inter-latin-ext.woff2) format("woff2");+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;+}++/* The app sets Inter on <body> through next/font's generated class; the kit+ sets it on the RybbitTheme root instead. */+.rybbit-theme {+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;+ -webkit-font-smoothing: antialiased;+}diff --git a/.design-sync/pkg/tsconfig.json b/.design-sync/pkg/tsconfig.jsonnew file mode 100644index 000000000..54fdd0b88--- /dev/null+++ b/.design-sync/pkg/tsconfig.json@@ -0,0 +1,23 @@+{+ "compilerOptions": {+ "target": "ES2020",+ "lib": ["dom", "dom.iterable", "esnext"],+ "module": "esnext",+ "moduleResolution": "bundler",+ "jsx": "react-jsx",+ "strict": true,+ "skipLibCheck": true,+ "esModuleInterop": true,+ "isolatedModules": true,+ "allowJs": false,+ "declaration": true,+ "emitDeclarationOnly": true,+ "rootDir": "../..",+ "outDir": "dist/types",+ "paths": {+ "@/lib/utils": ["./src/shims/utils.ts"],+ "@/*": ["../../client/src/*"]+ }+ },+ "include": ["src"]+}diff --git a/.design-sync/previews/ActivitySlider.tsx b/.design-sync/previews/ActivitySlider.tsxnew file mode 100644index 000000000..c83a68b95--- /dev/null+++ b/.design-sync/previews/ActivitySlider.tsx@@ -0,0 +1,115 @@+import * as React from "react";+import { ActivitySlider } from "@rybbit/ui";++// Raw rrweb-shaped events (what the replay player feeds the slider):+// type 4 Meta = session start / navigation · type 3 source 2 = mouse interaction+// (data.type 2 click · 3 right click · 4 double click) · type 3 source 5 = input+// type 6 plugin rrweb/console@1 = console log/warn/error.+const T0 = 1715774400000;+const at = (s: number) => T0 + Math.round(s * 1000);+const meta = (s: number, path: string) => ({ timestamp: at(s), type: 4, data: { href: `https://tomato.gg${path}`, width: 1440, height: 900 } });+const click = (s: number, x: number, y: number, kind: 2 | 3 | 4 = 2) => ({ timestamp: at(s), type: 3, data: { source: 2, type: kind, id: 1, x, y } });+const keystroke = (s: number, id: number) => ({ timestamp: at(s), type: 3, data: { source: 5, id, text: "…" } });+const log = (s: number, level: "info" | "warn" | "error", msg: string) => ({+ timestamp: at(s),+ type: 6,+ data: { plugin: "rrweb/console@1", payload: { level, payload: [msg] } },+});++const DURATION = 180_000; // 3:00++const session = [+ meta(0, "/"),+ click(4, 210, 118),+ click(9, 640, 340),+ click(15, 912, 402),+ ...[22, 22.3, 22.6, 22.9, 23.2].map((s) => keystroke(s, 7)),+ click(28, 700, 560),+ meta(31, "/pricing"),+ click(36, 380, 420),+ click(42, 560, 610),+ click(48, 560, 610, 4),+ meta(55, "/pricing/compare"),+ log(61, "warn", "Deprecated API: window.rybbit.track"),+ click(66, 300, 300),+ // Four clicks inside 1s on the same spot → one rage click marker.+ click(71, 640, 420),+ click(71.2, 642, 421),+ click(71.45, 641, 419),+ click(71.7, 640, 420),+ log(74, "error", "POST /api/checkout 500"),+ click(90, 980, 220),+ meta(96, "/signup"),+ ...[101, 101.4, 101.8, 102.2, 102.6, 103].map((s) => keystroke(s, 12)),+ click(110, 500, 500, 3),+ click(118, 500, 640),+ click(126, 760, 640),+ log(131, "info", "signup:submitted"),+ meta(140, "/welcome"),+ click(150, 320, 240),+ click(162, 320, 400),+ click(171, 900, 400),+].sort((a, b) => a.timestamp - b.timestamp);++const activity = [+ { start: 0, end: 30_000 },+ { start: 34_000, end: 78_000 },+ { start: 88_000, end: 135_000 },+ { start: 146_000, end: 178_000 },+];++function fmt(ms: number) {+ const t = Math.floor(ms / 1000);+ return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;+}++/** Replay-player chrome: session line above, elapsed / total below. The marker ring reads bg-neutral-900. */+function Player({ title, position, children }: { title: string; position: number; children: React.ReactNode }) {+ return (+ <div className="p-4 w-full max-w-xl">+ <div className="rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <div className="mb-3 flex items-center justify-between text-xs text-neutral-400">+ <span>{title}</span>+ <span className="tabular-nums">{fmt(position)} / {fmt(DURATION)}</span>+ </div>+ {children}+ </div>+ </div>+ );+}++/** Canonical: playhead at 1:05. Grey = active periods, emerald = played; dots are clicks, navigations, typing, a rage click and console errors. */+export function Playing() {+ return (+ <Player title="tomato.gg · Chrome on macOS · Berlin" position={65_000}>+ <ActivitySlider duration={DURATION} activityPeriods={activity} events={session} max={DURATION} step={100} value={[65_000]} />+ </Player>+ );+}++/** Before playback: value 0, the whole rail still shows where the activity is. */+export function AtStart() {+ return (+ <Player title="rybbit.com · Safari on iOS · Toronto" position={0}>+ <ActivitySlider duration={DURATION} activityPeriods={activity} events={session} max={DURATION} step={100} value={[0]} />+ </Player>+ );+}++/** A busy session: 400+ clicks are sampled down to ~160 markers but every navigation, rage click and console event is kept. */+export function Dense() {+ const dense = React.useMemo(() => {+ const extra: typeof session = [];+ for (let i = 0; i < 420; i++) {+ const s = 2 + i * 0.42;+ // Spread clicks across the page so they never collapse into rage clicks.+ extra.push(click(s, 100 + ((i * 137) % 1200), 80 + ((i * 89) % 700)));+ }+ return [...session, ...extra].sort((a, b) => a.timestamp - b.timestamp);+ }, []);+ return (+ <Player title="tomato.gg · Firefox on Windows · São Paulo" position={158_000}>+ <ActivitySlider duration={DURATION} activityPeriods={activity} events={dense} max={DURATION} step={100} value={[158_000]} />+ </Player>+ );+}diff --git a/.design-sync/previews/Alert.tsx b/.design-sync/previews/Alert.tsxnew file mode 100644index 000000000..d391bef06--- /dev/null+++ b/.design-sync/previews/Alert.tsx@@ -0,0 +1,87 @@+import * as React from "react";+import { Alert, AlertDescription, AlertTitle, Button } from "@rybbit/ui";+import { AlertCircle, AlertTriangle, CheckCircle2, Info, Terminal } from "lucide-react";++/** Canonical inline alert: a lucide icon, a short title, one sentence of consequence. */+export function Canonical() {+ return (+ <div className="p-4 w-full max-w-lg">+ <Alert variant="success">+ <CheckCircle2 className="h-4 w-4" />+ <AlertTitle>Tracking script detected</AlertTitle>+ <AlertDescription>tomato.gg sent its first pageview 12 seconds ago. Data will appear on the dashboard shortly.</AlertDescription>+ </Alert>+ </div>+ );+}++/** The variant axis: default, info, success, warning, destructive. Fill is a tint, icon carries the hue. */+export function Variants() {+ return (+ <div className="p-4 w-full max-w-lg flex flex-col gap-3">+ <Alert>+ <Terminal className="h-4 w-4" />+ <AlertTitle>Script snippet copied</AlertTitle>+ <AlertDescription>Paste it before the closing head tag on every page you want to track.</AlertDescription>+ </Alert>+ <Alert variant="info">+ <Info className="h-4 w-4" />+ <AlertTitle>Data is delayed by up to 2 minutes</AlertTitle>+ <AlertDescription>Real-time counts update immediately; aggregated reports lag slightly.</AlertDescription>+ </Alert>+ <Alert variant="success">+ <CheckCircle2 className="h-4 w-4" />+ <AlertTitle>Goal created</AlertTitle>+ <AlertDescription>“Signup completed” will start counting from the next matching event.</AlertDescription>+ </Alert>+ <Alert variant="warning">+ <AlertTriangle className="h-4 w-4" />+ <AlertTitle>Approaching your event limit</AlertTitle>+ <AlertDescription>You have used 91% of 1M monthly events. Upgrade to keep collecting after the cap.</AlertDescription>+ </Alert>+ <Alert variant="destructive">+ <AlertCircle className="h-4 w-4" />+ <AlertTitle>Domain verification failed</AlertTitle>+ <AlertDescription>No TXT record was found for rybbit.com. DNS changes can take up to an hour to propagate.</AlertDescription>+ </Alert>+ </div>+ );+}++/** Single-line alerts: title only, and description only, with and without an icon. */+export function Compact() {+ return (+ <div className="p-4 w-full max-w-lg flex flex-col gap-3">+ <Alert variant="info">+ <Info className="h-4 w-4" />+ <AlertTitle>Bot filtering is on for this site</AlertTitle>+ </Alert>+ <Alert variant="warning">+ <AlertTriangle className="h-4 w-4" />+ <AlertDescription>Session replay is paused because storage is full.</AlertDescription>+ </Alert>+ <Alert>+ <AlertDescription>Showing sampled data for the last 90 days.</AlertDescription>+ </Alert>+ </div>+ );+}++/** An alert that carries its own action; keep the button small and quiet. */+export function WithAction() {+ return (+ <div className="p-4 w-full max-w-lg">+ <Alert variant="warning">+ <AlertTriangle className="h-4 w-4" />+ <AlertTitle>No data received in the last 24 hours</AlertTitle>+ <AlertDescription>+ <p>The script may have been removed from staging.rybbit.dev during the last deploy.</p>+ <div className="mt-3 flex gap-2">+ <Button size="sm" variant="outline">View install guide</Button>+ <Button size="sm" variant="ghost">Dismiss</Button>+ </div>+ </AlertDescription>+ </Alert>+ </div>+ );+}diff --git a/.design-sync/previews/AlertDialog.tsx b/.design-sync/previews/AlertDialog.tsxnew file mode 100644index 000000000..cafb8c469--- /dev/null+++ b/.design-sync/previews/AlertDialog.tsx@@ -0,0 +1,76 @@+import * as React from "react";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@rybbit/ui";++/** Canonical destructive confirm, rendered open. In the app the opener is a Button inside AlertDialogTrigger. */+export function DeleteSite() {+ return (+ <AlertDialog open>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete tomato.gg?</AlertDialogTitle>+ <AlertDialogDescription>+ This removes the site, its 2.4M events, goals, funnels and every session replay. This action cannot be+ undone.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Keep site</AlertDialogCancel>+ <AlertDialogAction variant="destructive">Delete site</AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+}++/** Non-destructive confirm: the action takes the accent variant. */+export function ClearFilters() {+ return (+ <AlertDialog open>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Apply the new bot rules?</AlertDialogTitle>+ <AlertDialogDescription>+ Traffic from the 3 flagged ASNs will be excluded from rybbit.com going forward. Historical data is not+ changed.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction variant="accent">Apply rules</AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+}++/** Irreversible account-level action with a short consequence list in the body. */+export function LeaveOrganization() {+ return (+ <AlertDialog open>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Leave Tomato Labs?</AlertDialogTitle>+ <AlertDialogDescription>You will lose access to everything in this organization.</AlertDialogDescription>+ </AlertDialogHeader>+ <ul className="list-disc space-y-1 pl-5 text-sm text-neutral-400">+ <li>4 sites, including tomato.gg and rybbit.com</li>+ <li>Saved segments, goals and funnels you created</li>+ <li>Your organization API keys</li>+ </ul>+ <AlertDialogFooter>+ <AlertDialogCancel>Stay</AlertDialogCancel>+ <AlertDialogAction variant="destructive">Leave organization</AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+}diff --git a/.design-sync/previews/Badge.tsx b/.design-sync/previews/Badge.tsxnew file mode 100644index 000000000..6978a425e--- /dev/null+++ b/.design-sync/previews/Badge.tsx@@ -0,0 +1,66 @@+import * as React from "react";+import { Badge } from "@rybbit/ui";+import { Bot, Globe } from "lucide-react";++/** All eight variants. Colored variants are 20% tints with a matching 400-level text color. */+export function Variants() {+ return (+ <div className="flex flex-wrap items-center gap-2 p-4">+ <Badge variant="default">Default</Badge>+ <Badge variant="secondary">Secondary</Badge>+ <Badge variant="success">Success</Badge>+ <Badge variant="warning">Warning</Badge>+ <Badge variant="destructive">Destructive</Badge>+ <Badge variant="info">Info</Badge>+ <Badge variant="outline">Outline</Badge>+ <Badge variant="ghost">Ghost</Badge>+ </div>+ );+}++/** The statuses Rybbit actually shows: site health, traffic classification, plan. */+export function Statuses() {+ return (+ <div className="flex flex-wrap items-center gap-2 p-4">+ <Badge variant="success">Tracking</Badge>+ <Badge variant="warning">No data</Badge>+ <Badge variant="destructive">Bot</Badge>+ <Badge variant="info">Beta</Badge>+ <Badge variant="default">Pro</Badge>+ <Badge variant="secondary">Free</Badge>+ <Badge variant="outline">Self-hosted</Badge>+ </div>+ );+}++/** Icons and counts sit inline: a 12px lucide icon before the label, numbers in tabular figures. */+export function WithIcons() {+ return (+ <div className="flex flex-wrap items-center gap-2 p-4">+ <Badge variant="destructive" className="gap-1"><Bot className="h-3 w-3" /> Bot</Badge>+ <Badge variant="info" className="gap-1"><Globe className="h-3 w-3" /> 42 countries</Badge>+ <Badge variant="secondary" className="tabular-nums">2,140</Badge>+ <Badge variant="outline" className="font-mono">/pricing</Badge>+ </div>+ );+}++/** Badges next to text at their real size (12px text, 2px/6px padding) — a site row. */+export function InRow() {+ return (+ <div className="flex w-full max-w-md flex-col rounded-lg border border-neutral-800 bg-neutral-900 p-4 text-sm">+ <div className="flex items-center justify-between border-b border-neutral-800 py-2">+ <span className="font-medium">tomato.gg</span>+ <Badge variant="success">Tracking</Badge>+ </div>+ <div className="flex items-center justify-between border-b border-neutral-800 py-2">+ <span className="font-medium">rybbit.com</span>+ <Badge variant="success">Tracking</Badge>+ </div>+ <div className="flex items-center justify-between py-2">+ <span className="font-medium">staging.rybbit.dev</span>+ <Badge variant="warning">No data</Badge>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/BasicTabs.tsx b/.design-sync/previews/BasicTabs.tsxnew file mode 100644index 000000000..fa82fa5c3--- /dev/null+++ b/.design-sync/previews/BasicTabs.tsx@@ -0,0 +1,75 @@+import * as React from "react";+import { BasicTabs, BasicTabsContent, BasicTabsList, BasicTabsTrigger } from "@rybbit/ui";++const countries = [+ { name: "United States", visitors: "6,210", share: "34%" },+ { name: "Germany", visitors: "2,104", share: "11%" },+ { name: "United Kingdom", visitors: "1,880", share: "10%" },+ { name: "Brazil", visitors: "1,132", share: "6%" },+];++function RankedList({ rows }: { rows: { name: string; visitors: string; share: string }[] }) {+ return (+ <div className="rounded-lg border border-neutral-800 bg-neutral-900">+ {rows.map((r) => (+ <div key={r.name} className="flex items-center justify-between border-b border-neutral-800 px-3 py-2 text-sm">+ <span>{r.name}</span>+ <span className="flex gap-3 tabular-nums">+ <span>{r.visitors}</span>+ <span className="w-10 text-right text-neutral-400">{r.share}</span>+ </span>+ </div>+ ))}+ </div>+ );+}++/** Underline tabs that switch a section's breakdown (the pattern on every rollup card). */+export function SectionTabs() {+ return (+ <div className="w-[400px] p-4">+ <BasicTabs defaultValue="countries">+ <BasicTabsList>+ <BasicTabsTrigger value="countries">Countries</BasicTabsTrigger>+ <BasicTabsTrigger value="regions">Regions</BasicTabsTrigger>+ <BasicTabsTrigger value="cities">Cities</BasicTabsTrigger>+ </BasicTabsList>+ <BasicTabsContent value="countries">+ <RankedList rows={countries} />+ </BasicTabsContent>+ <BasicTabsContent value="regions">Regions</BasicTabsContent>+ <BasicTabsContent value="cities">Cities</BasicTabsContent>+ </BasicTabs>+ </div>+ );+}++/** Triggers carry counts; one is disabled. Active tab is the second one. */+export function WithCounts() {+ return (+ <div className="w-[400px] p-4">+ <BasicTabs defaultValue="referrers">+ <BasicTabsList>+ <BasicTabsTrigger value="channels">+ Channels <span className="ml-1 text-xs text-neutral-500 tabular-nums">6</span>+ </BasicTabsTrigger>+ <BasicTabsTrigger value="referrers">+ Referrers <span className="ml-1 text-xs text-neutral-500 tabular-nums">48</span>+ </BasicTabsTrigger>+ <BasicTabsTrigger value="campaigns" disabled>+ Campaigns <span className="ml-1 text-xs text-neutral-500 tabular-nums">0</span>+ </BasicTabsTrigger>+ </BasicTabsList>+ <BasicTabsContent value="referrers">+ <RankedList+ rows={[+ { name: "google.com", visitors: "4,902", share: "27%" },+ { name: "github.com", visitors: "1,377", share: "7%" },+ { name: "news.ycombinator.com", visitors: "912", share: "5%" },+ ]}+ />+ </BasicTabsContent>+ </BasicTabs>+ </div>+ );+}diff --git a/.design-sync/previews/Breadcrumb.tsx b/.design-sync/previews/Breadcrumb.tsxnew file mode 100644index 000000000..fe028f1c5--- /dev/null+++ b/.design-sync/previews/Breadcrumb.tsx@@ -0,0 +1,88 @@+import * as React from "react";+import {+ Breadcrumb,+ BreadcrumbEllipsis,+ BreadcrumbItem,+ BreadcrumbLink,+ BreadcrumbList,+ BreadcrumbPage,+ BreadcrumbSeparator,+} from "@rybbit/ui";+import { Slash } from "lucide-react";++/** Canonical trail: site → section → current record. Links are muted, the current page is bright. */+export function UserTrail() {+ return (+ <div className="p-4">+ <Breadcrumb>+ <BreadcrumbList>+ <BreadcrumbItem>+ <BreadcrumbLink href="#">tomato.gg</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbLink href="#">Users</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbPage>usr_8f3a91c2</BreadcrumbPage>+ </BreadcrumbItem>+ </BreadcrumbList>+ </Breadcrumb>+ </div>+ );+}++/** Deep paths collapse the middle with BreadcrumbEllipsis. */+export function Collapsed() {+ return (+ <div className="p-4">+ <Breadcrumb>+ <BreadcrumbList>+ <BreadcrumbItem>+ <BreadcrumbLink href="#">rybbit.com</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbEllipsis />+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbLink href="#">Funnels</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator />+ <BreadcrumbItem>+ <BreadcrumbPage>Signup → first event</BreadcrumbPage>+ </BreadcrumbItem>+ </BreadcrumbList>+ </Breadcrumb>+ </div>+ );+}++/** Any node can replace the chevron: pass it as BreadcrumbSeparator children. */+export function SlashSeparator() {+ return (+ <div className="p-4">+ <Breadcrumb>+ <BreadcrumbList>+ <BreadcrumbItem>+ <BreadcrumbLink href="#">Organization</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator>+ <Slash />+ </BreadcrumbSeparator>+ <BreadcrumbItem>+ <BreadcrumbLink href="#">Members</BreadcrumbLink>+ </BreadcrumbItem>+ <BreadcrumbSeparator>+ <Slash />+ </BreadcrumbSeparator>+ <BreadcrumbItem>+ <BreadcrumbPage>Invite</BreadcrumbPage>+ </BreadcrumbItem>+ </BreadcrumbList>+ </Breadcrumb>+ </div>+ );+}diff --git a/.design-sync/previews/Button.tsx b/.design-sync/previews/Button.tsxnew file mode 100644index 000000000..5a0f23fcf--- /dev/null+++ b/.design-sync/previews/Button.tsx@@ -0,0 +1,66 @@+import * as React from "react";+import { Button } from "@rybbit/ui";+import { Download, Plus, RefreshCw, Settings, Trash2 } from "lucide-react";++/** The variant axis. `accent` is the emerald primary action; `default` is the raised gray chrome button. */+export function Variants() {+ return (+ <div className="flex flex-wrap items-center gap-2">+ <Button variant="accent">Add site</Button>+ <Button variant="default">Export CSV</Button>+ <Button variant="secondary">Secondary</Button>+ <Button variant="outline">Outline</Button>+ <Button variant="ghost">Ghost</Button>+ <Button variant="link">View docs</Button>+ <Button variant="success">Enable tracking</Button>+ <Button variant="warning">Pause site</Button>+ <Button variant="destructive">Delete site</Button>+ </div>+ );+}++export function Sizes() {+ return (+ <div className="flex flex-wrap items-center gap-2">+ <Button size="lg" variant="accent">Large</Button>+ <Button variant="accent">Default</Button>+ <Button size="sm" variant="accent">Small</Button>+ <Button size="xs" variant="accent">Extra small</Button>+ <Button size="icon" variant="default" aria-label="Settings"><Settings /></Button>+ <Button size="smIcon" variant="outline" aria-label="Refresh"><RefreshCw /></Button>+ </div>+ );+}++export function WithIcons() {+ return (+ <div className="flex flex-wrap items-center gap-2">+ <Button variant="accent"><Plus /> New goal</Button>+ <Button variant="default"><Download /> Download report</Button>+ <Button variant="destructive"><Trash2 /> Remove</Button>+ </div>+ );+}++export function States() {+ return (+ <div className="flex flex-wrap items-center gap-2">+ <Button variant="accent" disabled>Saving…</Button>+ <Button variant="default" disabled>Disabled</Button>+ <Button variant="outline" disabled>Disabled outline</Button>+ </div>+ );+}++/** A real footer row: secondary on the left, the single accent action on the right. */+export function ActionRow() {+ return (+ <div className="flex w-full max-w-md items-center justify-between rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <Button variant="ghost" size="sm">Cancel</Button>+ <div className="flex gap-2">+ <Button variant="outline" size="sm">Save draft</Button>+ <Button variant="accent" size="sm">Publish</Button>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/ButtonGroup.tsx b/.design-sync/previews/ButtonGroup.tsxnew file mode 100644index 000000000..451103194--- /dev/null+++ b/.design-sync/previews/ButtonGroup.tsx@@ -0,0 +1,86 @@+import * as React from "react";+import { Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "@rybbit/ui";+import { Calendar, ChevronDown, Download, Maximize2, RefreshCw, Share2, ZoomIn, ZoomOut } from "lucide-react";++/** Canonical segmented control: outline siblings share borders; the selected one is the raised `default` chrome. */+export function Segmented() {+ return (+ <div className="p-4">+ <ButtonGroup>+ <Button variant="outline" size="sm">Day</Button>+ <Button variant="default" size="sm">Week</Button>+ <Button variant="outline" size="sm">Month</Button>+ <Button variant="outline" size="sm">Year</Button>+ </ButtonGroup>+ </div>+ );+}++/** A chart toolbar: icon buttons, a hairline `ButtonGroupSeparator`, then a text action. */+export function Toolbar() {+ return (+ <div className="p-4">+ <ButtonGroup>+ <Button variant="outline" size="icon" aria-label="Zoom out"><ZoomOut /></Button>+ <Button variant="outline" size="icon" aria-label="Zoom in"><ZoomIn /></Button>+ <Button variant="outline" size="icon" aria-label="Fit to screen"><Maximize2 /></Button>+ <ButtonGroupSeparator />+ <Button variant="outline"><Download /> Export</Button>+ <Button variant="outline"><Share2 /> Share</Button>+ </ButtonGroup>+ </div>+ );+}++/** `ButtonGroupText` is a static label cell that shares the group's borders; pair it with a split trigger. */+export function WithText() {+ return (+ <div className="p-4 flex flex-col gap-3 items-start">+ <ButtonGroup>+ <ButtonGroupText><Calendar /> Last 30 days</ButtonGroupText>+ <Button variant="outline" aria-label="Change range"><ChevronDown /></Button>+ </ButtonGroup>+ <ButtonGroup>+ <ButtonGroupText>tomato.gg</ButtonGroupText>+ <Button variant="outline"><RefreshCw /> Refresh</Button>+ <Button variant="accent">Add site</Button>+ </ButtonGroup>+ </div>+ );+}++/** `orientation="vertical"` stacks the members and merges the horizontal borders instead. */+export function Vertical() {+ return (+ <div className="p-4">+ <ButtonGroup orientation="vertical">+ <Button variant="outline" size="sm">Visitors</Button>+ <Button variant="default" size="sm">Pageviews</Button>+ <Button variant="outline" size="sm">Sessions</Button>+ <Button variant="outline" size="sm">Bounce rate</Button>+ </ButtonGroup>+ </div>+ );+}++/** Nesting groups inside a group inserts an 8px gap between the clusters (a real filter bar). */+export function Nested() {+ return (+ <div className="p-4">+ <ButtonGroup>+ <ButtonGroup>+ <Button variant="outline" size="sm">Day</Button>+ <Button variant="default" size="sm">Week</Button>+ <Button variant="outline" size="sm">Month</Button>+ </ButtonGroup>+ <ButtonGroup>+ <Button variant="outline" size="sm">Line</Button>+ <Button variant="outline" size="sm">Bar</Button>+ </ButtonGroup>+ <ButtonGroup>+ <Button variant="outline" size="sm" disabled>Compare</Button>+ </ButtonGroup>+ </ButtonGroup>+ </div>+ );+}diff --git a/.design-sync/previews/Calendar.tsx b/.design-sync/previews/Calendar.tsxnew file mode 100644index 000000000..81091a640--- /dev/null+++ b/.design-sync/previews/Calendar.tsx@@ -0,0 +1,47 @@+import * as React from "react";+import { Calendar } from "@rybbit/ui";++// Fixed month so the render is deterministic (the capture clock is pinned to 2024-05-15, which is "today").+const may2024 = new Date(2024, 4, 1);++/** Canonical single-date picker: one selected day (light pill), today outlined in the neutral ramp. */+export function SingleDate() {+ const [date, setDate] = React.useState<Date | undefined>(new Date(2024, 4, 8));+ return (+ <div className="p-4">+ <Calendar mode="single" selected={date} onSelect={setDate} defaultMonth={may2024} />+ </div>+ );+}++/** Range mode: start/end get the solid pill, the days between get the neutral-700 band. */+export function DateRange() {+ const [range, setRange] = React.useState<{ from?: Date; to?: Date } | undefined>({+ from: new Date(2024, 4, 6),+ to: new Date(2024, 4, 19),+ });+ return (+ <div className="p-4">+ <Calendar mode="range" selected={range} onSelect={setRange} defaultMonth={may2024} />+ </div>+ );+}++/** Future days disabled (the common "up to today" analytics picker) plus month/year dropdown caption. */+export function DisabledFutureDropdown() {+ const [date, setDate] = React.useState<Date | undefined>(new Date(2024, 4, 15));+ return (+ <div className="p-4">+ <Calendar+ mode="single"+ selected={date}+ onSelect={setDate}+ defaultMonth={may2024}+ disabled={{ after: new Date(2024, 4, 15) }}+ captionLayout="dropdown"+ startMonth={new Date(2023, 0, 1)}+ endMonth={new Date(2024, 11, 1)}+ />+ </div>+ );+}diff --git a/.design-sync/previews/Card.tsx b/.design-sync/previews/Card.tsxnew file mode 100644index 000000000..adc0bffc1--- /dev/null+++ b/.design-sync/previews/Card.tsx@@ -0,0 +1,125 @@+import * as React from "react";+import {+ Badge,+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardLoader,+ CardTitle,+ Skeleton,+} from "@rybbit/ui";+import { ArrowUp, ArrowDown } from "lucide-react";++/** The overview stat tile: muted 12px label, 24px figure, delta vs. the previous period. */+export function StatCard() {+ return (+ <div className="flex w-full max-w-xl gap-3 p-4">+ <Card className="flex-1">+ <div className="flex flex-col px-3 py-2">+ <div className="text-xs font-medium text-muted-foreground">Unique visitors</div>+ <div className="flex items-center justify-between gap-2 text-2xl font-medium">+ <span className="tabular-nums">18.4K</span>+ <span className="inline-flex items-center gap-1 text-sm text-emerald-400">+ <ArrowUp className="h-3 w-3" strokeWidth={3} /> 12%+ </span>+ </div>+ </div>+ </Card>+ <Card className="flex-1">+ <div className="flex flex-col px-3 py-2">+ <div className="text-xs font-medium text-muted-foreground">Bounce rate</div>+ <div className="flex items-center justify-between gap-2 text-2xl font-medium">+ <span className="tabular-nums">41%</span>+ <span className="inline-flex items-center gap-1 text-sm text-red-400">+ <ArrowDown className="h-3 w-3" strokeWidth={3} /> 3%+ </span>+ </div>+ </div>+ </Card>+ </div>+ );+}++/** Full composition: header (title + description), content, footer with the single accent action. */+export function SettingsCard() {+ return (+ <div className="w-full max-w-md p-4">+ <Card>+ <CardHeader>+ <CardTitle>Bot detection</CardTitle>+ <CardDescription>Filter automated traffic out of tomato.gg before it reaches your reports.</CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-3 text-sm">+ <div className="flex items-center justify-between">+ <span>Status</span>+ <Badge variant="success">Enabled</Badge>+ </div>+ <div className="flex items-center justify-between">+ <span>Blocked in the last 24h</span>+ <span className="tabular-nums text-neutral-300">12,930 events</span>+ </div>+ <div className="flex items-center justify-between">+ <span>Sensitivity</span>+ <span className="text-neutral-300">Balanced</span>+ </div>+ </CardContent>+ <CardFooter className="justify-end gap-2">+ <Button variant="ghost" size="sm">Reset</Button>+ <Button variant="accent" size="sm">Save changes</Button>+ </CardFooter>+ </Card>+ </div>+ );+}++/** Loading: CardLoader is an absolutely positioned indeterminate bar pinned to the card's top edge. */+export function LoadingCard() {+ return (+ <div className="w-full max-w-md p-4">+ <Card>+ <CardLoader />+ <CardHeader>+ <CardTitle>Top pages</CardTitle>+ <CardDescription>Last 7 days</CardDescription>+ </CardHeader>+ <CardContent className="flex flex-col gap-2">+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ </CardContent>+ </Card>+ </div>+ );+}++/** A list card: header row with a count badge, hairline-divided rows in the content. */+export function ListCard() {+ const rows = [+ { name: "Chrome", share: "64.2%" },+ { name: "Safari", share: "21.8%" },+ { name: "Firefox", share: "7.5%" },+ { name: "Edge", share: "4.1%" },+ ];+ return (+ <div className="w-full max-w-md p-4">+ <Card>+ <CardHeader className="flex-row items-center justify-between space-y-0">+ <CardTitle>Browsers</CardTitle>+ <Badge variant="secondary">4</Badge>+ </CardHeader>+ <CardContent className="flex flex-col text-sm">+ {rows.map((r) => (+ <div key={r.name} className="flex items-center justify-between border-b border-neutral-800 py-2">+ <span>{r.name}</span>+ <span className="tabular-nums text-neutral-400">{r.share}</span>+ </div>+ ))}+ </CardContent>+ </Card>+ </div>+ );+}diff --git a/.design-sync/previews/Carousel.tsx b/.design-sync/previews/Carousel.tsxnew file mode 100644index 000000000..9e8c6fb56--- /dev/null+++ b/.design-sync/previews/Carousel.tsx@@ -0,0 +1,94 @@+import * as React from "react";+import { Card, CardContent, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@rybbit/ui";++const stats = [+ { label: "Visitors", value: "18.4K", delta: "+12.4%", up: true },+ { label: "Pageviews", value: "26.3K", delta: "+8.1%", up: true },+ { label: "Sessions", value: "21.0K", delta: "+9.6%", up: true },+ { label: "Bounce rate", value: "41%", delta: "−2.3 pt", up: true },+ { label: "Avg. session", value: "1m 12s", delta: "+4s", up: true },+ { label: "Events", value: "2.4M", delta: "−0.8%", up: false },+];++function StatCard({ label, value, delta, up }: (typeof stats)[number]) {+ return (+ <Card>+ <CardContent className="p-4">+ <div className="text-xs font-medium text-neutral-400">{label}</div>+ <div className="mt-1 text-2xl font-semibold tabular-nums">{value}</div>+ <div className={up ? "mt-1 text-xs tabular-nums text-emerald-400" : "mt-1 text-xs tabular-nums text-red-400"}>{delta} vs. previous 30 days</div>+ </CardContent>+ </Card>+ );+}++/**+ * Canonical: three stat cards per view. The prev/next buttons sit 48px OUTSIDE the track+ * (-left-12 / -right-12), so the parent reserves that gutter. At index 0 "Previous" is disabled.+ */+export function StatCards() {+ return (+ <div style={{ padding: "16px 64px" }} className="w-full">+ <Carousel>+ <CarouselContent>+ {stats.map((s) => (+ <CarouselItem key={s.label} style={{ flexBasis: "33.3333%" }}>+ <StatCard {...s} />+ </CarouselItem>+ ))}+ </CarouselContent>+ <CarouselPrevious />+ <CarouselNext />+ </Carousel>+ </div>+ );+}++/** One slide per view with `opts={{ loop: true, startIndex: 1 }}`: both arrows enabled, mid-deck. */+export function SingleSlide() {+ const pages = [+ { site: "tomato.gg", path: "/", visitors: "18,420" },+ { site: "tomato.gg", path: "/pricing", visitors: "6,120" },+ { site: "rybbit.com", path: "/docs/script", visitors: "4,890" },+ ];+ return (+ <div style={{ padding: "16px 64px" }} className="w-full max-w-lg">+ <Carousel opts={{ loop: true, startIndex: 1 }}>+ <CarouselContent>+ {pages.map((p) => (+ <CarouselItem key={p.path}>+ <Card>+ <CardContent className="p-4">+ <div className="text-xs font-medium text-neutral-400">Top page · {p.site}</div>+ <div className="mt-1 text-lg font-semibold">{p.path}</div>+ <div className="mt-1 text-sm text-neutral-400 tabular-nums">{p.visitors} visitors in the last 30 days</div>+ </CardContent>+ </Card>+ </CarouselItem>+ ))}+ </CarouselContent>+ <CarouselPrevious />+ <CarouselNext />+ </Carousel>+ </div>+ );+}++/** `orientation="vertical"`: give CarouselContent a fixed height and `align: "start"` so whole slides show; the arrows move above/below and rotate. */+export function Vertical() {+ return (+ <div style={{ padding: "64px 16px" }} className="w-96">+ <Carousel orientation="vertical" opts={{ startIndex: 1, align: "start" }}>+ <CarouselContent style={{ height: 240 }}>+ {stats.slice(0, 4).map((s) => (+ <CarouselItem key={s.label} style={{ flexBasis: "50%" }}>+ <StatCard {...s} />+ </CarouselItem>+ ))}+ </CarouselContent>+ <CarouselPrevious />+ <CarouselNext />+ </Carousel>+ </div>+ );+}diff --git a/.design-sync/previews/Checkbox.tsx b/.design-sync/previews/Checkbox.tsxnew file mode 100644index 000000000..33d5021e0--- /dev/null+++ b/.design-sync/previews/Checkbox.tsx@@ -0,0 +1,69 @@+import * as React from "react";+import { Checkbox, Label } from "@rybbit/ui";++/** The three static states: unchecked, checked (emerald fill, white check), and disabled. */+export function States() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <div className="flex items-center gap-2">+ <Checkbox id="unchecked" />+ <Label htmlFor="unchecked">Unchecked</Label>+ </div>+ <div className="flex items-center gap-2">+ <Checkbox id="checked" defaultChecked />+ <Label htmlFor="checked">Checked</Label>+ </div>+ <div className="flex items-center gap-2">+ <Checkbox id="disabled" disabled />+ <Label htmlFor="disabled" className="opacity-70">Disabled</Label>+ </div>+ <div className="flex items-center gap-2">+ <Checkbox id="disabled-checked" disabled defaultChecked />+ <Label htmlFor="disabled-checked" className="opacity-70">Disabled, checked</Label>+ </div>+ </div>+ );+}++/** A column-picker list, the typical multi-select use in report settings. */+export function ColumnPicker() {+ const columns = [+ { id: "visitors", label: "Visitors", on: true },+ { id: "pageviews", label: "Pageviews", on: true },+ { id: "bounce", label: "Bounce rate", on: true },+ { id: "duration", label: "Session duration", on: false },+ { id: "conversions", label: "Goal conversions", on: false },+ ];+ return (+ <div className="w-[420px] p-4">+ <div className="rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <p className="mb-3 text-sm font-medium">Columns in weekly report</p>+ <div className="grid gap-2.5">+ {columns.map(c => (+ <div key={c.id} className="flex items-center gap-2">+ <Checkbox id={c.id} defaultChecked={c.on} />+ <Label htmlFor={c.id} className="font-normal">{c.label}</Label>+ </div>+ ))}+ </div>+ </div>+ </div>+ );+}++/** Checkbox with a description line, for consequential settings. */+export function WithDescription() {+ return (+ <div className="w-[420px] p-4">+ <div className="flex items-start gap-3">+ <Checkbox id="salt" defaultChecked className="mt-0.5" />+ <div className="grid gap-1">+ <Label htmlFor="salt">Salt user IDs daily</Label>+ <p className="text-xs text-neutral-400">+ Visitors get a new anonymous ID every day. Returning-visitor stats reset at midnight UTC.+ </p>+ </div>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/Command.tsx b/.design-sync/previews/Command.tsxnew file mode 100644index 000000000..59f658365--- /dev/null+++ b/.design-sync/previews/Command.tsx@@ -0,0 +1,100 @@+import * as React from "react";+import {+ Command,+ CommandDialog,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+ CommandSeparator,+ CommandShortcut,+} from "@rybbit/ui";+import { Filter, Globe, LayoutDashboard, Target, Users } from "lucide-react";++/** CommandList caps at 300px and scrolls; `compact` keeps the dialog's taller rows inside that cap. */+function PaletteItems({ compact }: { compact?: boolean }) {+ return (+ <>+ <CommandEmpty>No results found.</CommandEmpty>+ <CommandGroup heading="Sites">+ <CommandItem>+ <Globe className="mr-2 size-4 text-neutral-400" /> tomato.gg+ </CommandItem>+ <CommandItem>+ <Globe className="mr-2 size-4 text-neutral-400" /> rybbit.com+ </CommandItem>+ {compact ? null : (+ <CommandItem>+ <Globe className="mr-2 size-4 text-neutral-400" /> staging.rybbit.dev+ </CommandItem>+ )}+ </CommandGroup>+ <CommandSeparator />+ <CommandGroup heading="Go to">+ <CommandItem>+ <LayoutDashboard className="mr-2 size-4 text-neutral-400" /> Overview+ <CommandShortcut>⌘1</CommandShortcut>+ </CommandItem>+ <CommandItem>+ <Users className="mr-2 size-4 text-neutral-400" /> Sessions+ <CommandShortcut>⌘2</CommandShortcut>+ </CommandItem>+ <CommandItem>+ <Target className="mr-2 size-4 text-neutral-400" /> Goals+ <CommandShortcut>⌘3</CommandShortcut>+ </CommandItem>+ {compact ? null : (+ <CommandItem>+ <Filter className="mr-2 size-4 text-neutral-400" /> Funnels+ <CommandShortcut>⌘4</CommandShortcut>+ </CommandItem>+ )}+ </CommandGroup>+ </>+ );+}++/** Inline command palette inside a panel: input, grouped items with icons, separators, shortcuts. */+export function Palette() {+ return (+ <div className="p-4">+ <div className="w-[400px] rounded-lg border border-neutral-800 bg-neutral-900">+ <Command>+ <CommandInput placeholder="Search sites, pages, or commands…" />+ <CommandList>+ <PaletteItems />+ </CommandList>+ </Command>+ </div>+ </div>+ );+}++/** A typed query with no matches shows CommandEmpty. cmdk filters items by the input value. */+export function NoResults() {+ return (+ <div className="p-4">+ <div className="w-[400px] rounded-lg border border-neutral-800 bg-neutral-900">+ <Command>+ <CommandInput placeholder="Search sites, pages, or commands…" value="checkout funnel v2" />+ <CommandList>+ <PaletteItems />+ </CommandList>+ </Command>+ </div>+ </div>+ );+}++/** The ⌘K modal: CommandDialog wraps the same parts in a Dialog with larger rows. */+export function PaletteDialog() {+ return (+ <CommandDialog open title="Command palette" description="Jump to a site, page, or action">+ <CommandInput placeholder="Type a command or search…" />+ <CommandList>+ <PaletteItems compact />+ </CommandList>+ </CommandDialog>+ );+}diff --git a/.design-sync/previews/Dialog.tsx b/.design-sync/previews/Dialog.tsxnew file mode 100644index 000000000..cb10090b1--- /dev/null+++ b/.design-sync/previews/Dialog.tsx@@ -0,0 +1,60 @@+import * as React from "react";+import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Input,+ Label,+} from "@rybbit/ui";++/** Canonical form dialog, rendered open. In the app the trigger is a Button wrapped in DialogTrigger. */+export function CreateSite() {+ return (+ <Dialog open>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Add a website</DialogTitle>+ <DialogDescription>Enter the domain you want to track. You can add the script afterwards.</DialogDescription>+ </DialogHeader>+ <div className="grid gap-3 py-2">+ <div className="grid gap-1.5">+ <Label htmlFor="domain">Domain</Label>+ <Input id="domain" placeholder="example.com" defaultValue="tomato.gg" />+ </div>+ <div className="grid gap-1.5">+ <Label htmlFor="name">Display name</Label>+ <Input id="name" placeholder="Optional" />+ </div>+ </div>+ <DialogFooter>+ <Button variant="ghost">Cancel</Button>+ <Button variant="accent">Add site</Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}++/** Confirmation with a destructive action and no close button. */+export function ConfirmDelete() {+ return (+ <Dialog open>+ <DialogContent hideClose>+ <DialogHeader>+ <DialogTitle>Delete tomato.gg?</DialogTitle>+ <DialogDescription>+ All 2.4M events and every session replay for this site will be removed. This cannot be undone.+ </DialogDescription>+ </DialogHeader>+ <DialogFooter>+ <Button variant="outline">Keep site</Button>+ <Button variant="destructive">Delete permanently</Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}diff --git a/.design-sync/previews/Drawer.tsx b/.design-sync/previews/Drawer.tsxnew file mode 100644index 000000000..5d8551b89--- /dev/null+++ b/.design-sync/previews/Drawer.tsx@@ -0,0 +1,104 @@+import * as React from "react";+import {+ Button,+ Drawer,+ DrawerContent,+ DrawerDescription,+ DrawerFooter,+ DrawerHeader,+ DrawerTitle,+ Input,+ Label,+} from "@rybbit/ui";++/** Canonical bottom drawer (vaul), rendered open with the drag handle. Opener is a Button inside DrawerTrigger. */+export function CreateGoal() {+ return (+ <div className="min-h-screen">+ <Drawer open>+ <DrawerContent>+ <DrawerHeader>+ <DrawerTitle>New goal</DrawerTitle>+ <DrawerDescription>Count a conversion whenever a visitor reaches this page.</DrawerDescription>+ </DrawerHeader>+ <div className="grid gap-3 px-4">+ <div className="grid gap-1.5">+ <Label htmlFor="goal-name">Goal name</Label>+ <Input id="goal-name" defaultValue="Signup complete" />+ </div>+ <div className="grid gap-1.5">+ <Label htmlFor="goal-path">Path</Label>+ <Input id="goal-path" defaultValue="/welcome" />+ </div>+ </div>+ <DrawerFooter>+ <Button variant="accent">Create goal</Button>+ <Button variant="ghost">Cancel</Button>+ </DrawerFooter>+ </DrawerContent>+ </Drawer>+ </div>+ );+}++/** Bottom drawer used as a detail card: a visitor's session summary with a single action. */+export function SessionSummary() {+ const rows = [+ ["Country", "Germany"],+ ["Browser", "Firefox 130"],+ ["Entry page", "/pricing"],+ ["Pages", "6"],+ ["Duration", "4m 12s"],+ ];+ return (+ <div className="min-h-screen">+ <Drawer open>+ <DrawerContent>+ <DrawerHeader>+ <DrawerTitle>Session 8f3a21</DrawerTitle>+ <DrawerDescription>tomato.gg · 14 minutes ago</DrawerDescription>+ </DrawerHeader>+ <dl className="grid gap-2 px-4 text-sm">+ {rows.map(([k, v]) => (+ <div key={k} className="flex items-center justify-between border-b border-neutral-800 pb-2">+ <dt className="text-neutral-400">{k}</dt>+ <dd className="font-medium">{v}</dd>+ </div>+ ))}+ </dl>+ <DrawerFooter>+ <Button variant="accent">Watch replay</Button>+ </DrawerFooter>+ </DrawerContent>+ </Drawer>+ </div>+ );+}++/** direction="right": the same parts as a side panel (no drag handle is rendered for side drawers). */+export function FiltersRight() {+ const filters = ["Country is Germany", "Browser is Firefox", "Path starts with /pricing"];+ return (+ <div className="min-h-screen">+ <Drawer open direction="right">+ <DrawerContent>+ <DrawerHeader>+ <DrawerTitle>Filters</DrawerTitle>+ <DrawerDescription>3 active on rybbit.com</DrawerDescription>+ </DrawerHeader>+ <ul className="grid gap-2 px-4 text-sm">+ {filters.map(f => (+ <li key={f} className="rounded-lg border border-neutral-800 px-3 py-2">+ {f}+ </li>+ ))}+ </ul>+ <DrawerFooter>+ <Button variant="accent">Apply</Button>+ <Button variant="ghost">Clear all</Button>+ </DrawerFooter>+ </DrawerContent>+ </Drawer>+ </div>+ );+}diff --git a/.design-sync/previews/DropdownMenu.tsx b/.design-sync/previews/DropdownMenu.tsxnew file mode 100644index 000000000..e4749d4a2--- /dev/null+++ b/.design-sync/previews/DropdownMenu.tsx@@ -0,0 +1,115 @@+import * as React from "react";+import {+ DropdownMenu,+ DropdownMenuCheckboxItem,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuSeparator,+ DropdownMenuShortcut,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuTrigger,+} from "@rybbit/ui";+import { ChevronDown, Code, Copy, Download, Settings, Trash2 } from "lucide-react";++/** Canonical site actions menu, rendered open. The trigger is a Button-styled DropdownMenuTrigger. */+export function SiteActions() {+ return (+ <div className="p-4">+ <DropdownMenu open>+ <DropdownMenuTrigger variant="outline" size="sm">+ tomato.gg <ChevronDown className="size-4" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-56">+ <DropdownMenuLabel>tomato.gg</DropdownMenuLabel>+ <DropdownMenuSeparator />+ <DropdownMenuGroup>+ <DropdownMenuItem>+ <Code /> Tracking script+ <DropdownMenuShortcut>⌘I</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ <Copy /> Copy site ID+ <DropdownMenuShortcut>⌘C</DropdownMenuShortcut>+ </DropdownMenuItem>+ <DropdownMenuItem>+ <Settings /> Site settings+ <DropdownMenuShortcut>⌘,</DropdownMenuShortcut>+ </DropdownMenuItem>+ </DropdownMenuGroup>+ <DropdownMenuSeparator />+ <DropdownMenuItem disabled>+ <Download /> Export events+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem className="text-red-400 focus:text-red-400">+ <Trash2 /> Delete site+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ );+}++/** Checkbox items toggle table columns; a radio group picks one value. Emerald indicators mark selection. */+export function ColumnsAndRange() {+ return (+ <div className="p-4">+ <DropdownMenu open>+ <DropdownMenuTrigger variant="outline" size="sm">+ Columns <ChevronDown className="size-4" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-56">+ <DropdownMenuLabel>Show columns</DropdownMenuLabel>+ <DropdownMenuCheckboxItem checked>Visitors</DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem checked>Pageviews</DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem>Bounce rate</DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem checked>Avg. time</DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem disabled>Revenue</DropdownMenuCheckboxItem>+ <DropdownMenuSeparator />+ <DropdownMenuLabel>Time range</DropdownMenuLabel>+ <DropdownMenuRadioGroup value="7d">+ <DropdownMenuRadioItem value="24h">Last 24 hours</DropdownMenuRadioItem>+ <DropdownMenuRadioItem value="7d">Last 7 days</DropdownMenuRadioItem>+ <DropdownMenuRadioItem value="30d">Last 30 days</DropdownMenuRadioItem>+ </DropdownMenuRadioGroup>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ );+}++/** A nested sub-menu (DropdownMenuSub) rendered open to the right of its trigger row. */+export function WithSubmenu() {+ return (+ <div className="p-4">+ <DropdownMenu open>+ <DropdownMenuTrigger variant="outline" size="sm">+ Export <ChevronDown className="size-4" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-56">+ <DropdownMenuItem>+ <Copy /> Copy link to report+ </DropdownMenuItem>+ <DropdownMenuSub open>+ <DropdownMenuSubTrigger>+ <Download /> Download as+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ <DropdownMenuItem>CSV</DropdownMenuItem>+ <DropdownMenuItem>JSON</DropdownMenuItem>+ <DropdownMenuItem>Parquet</DropdownMenuItem>+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ <DropdownMenuSeparator />+ <DropdownMenuItem>Schedule weekly email</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ );+}diff --git a/.design-sync/previews/Form.tsx b/.design-sync/previews/Form.tsxnew file mode 100644index 000000000..1a892a6d4--- /dev/null+++ b/.design-sync/previews/Form.tsx@@ -0,0 +1,143 @@+import * as React from "react";+import {+ Button,+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@rybbit/ui";+import { useForm } from "react-hook-form";++type SiteValues = { domain: string; name: string; timezone: string };++/** Canonical: Form (react-hook-form's FormProvider) wrapping FormField → FormItem → FormLabel/FormControl/FormDescription. */+export function AddSite() {+ const form = useForm<SiteValues>({ defaultValues: { domain: "tomato.gg", name: "", timezone: "UTC" } });+ return (+ <div className="p-4 w-full max-w-md">+ <Form {...form}>+ <form className="grid gap-5" onSubmit={form.handleSubmit(() => {})}>+ <FormField+ control={form.control}+ name="domain"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Domain</FormLabel>+ <FormControl>+ <Input placeholder="example.com" {...field} />+ </FormControl>+ <FormDescription>The hostname the tracking script will report from.</FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="name"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Display name</FormLabel>+ <FormControl>+ <Input placeholder="Optional" {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="timezone"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Timezone</FormLabel>+ <Select value={field.value} onValueChange={field.onChange}>+ <FormControl>+ <SelectTrigger>+ <SelectValue placeholder="Select a timezone" />+ </SelectTrigger>+ </FormControl>+ <SelectContent>+ <SelectItem value="UTC">UTC</SelectItem>+ <SelectItem value="America/New_York">America/New_York</SelectItem>+ <SelectItem value="Europe/Berlin">Europe/Berlin</SelectItem>+ </SelectContent>+ </Select>+ <FormDescription>Daily reports roll over at midnight in this zone.</FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <div className="flex justify-end gap-2">+ <Button type="button" variant="ghost">Cancel</Button>+ <Button type="submit" variant="accent">Add site</Button>+ </div>+ </form>+ </Form>+ </div>+ );+}++/** Validation error state: FormLabel and FormMessage turn red; FormControl sets aria-invalid. */+export function WithErrors() {+ const form = useForm<SiteValues>({ defaultValues: { domain: "not a domain", name: "", timezone: "" } });+ React.useEffect(() => {+ form.setError("domain", { type: "pattern", message: "Enter a bare hostname like tomato.gg (no protocol or path)." });+ form.setError("timezone", { type: "required", message: "Timezone is required." });+ }, [form]);+ return (+ <div className="p-4 w-full max-w-md">+ <Form {...form}>+ <form className="grid gap-5" onSubmit={form.handleSubmit(() => {})}>+ <FormField+ control={form.control}+ name="domain"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Domain</FormLabel>+ <FormControl>+ <Input placeholder="example.com" {...field} />+ </FormControl>+ <FormDescription>The hostname the tracking script will report from.</FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="timezone"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Timezone</FormLabel>+ <Select value={field.value} onValueChange={field.onChange}>+ <FormControl>+ <SelectTrigger>+ <SelectValue placeholder="Select a timezone" />+ </SelectTrigger>+ </FormControl>+ <SelectContent>+ <SelectItem value="UTC">UTC</SelectItem>+ <SelectItem value="Europe/Berlin">Europe/Berlin</SelectItem>+ </SelectContent>+ </Select>+ <FormMessage />+ </FormItem>+ )}+ />+ <div className="flex justify-end gap-2">+ <Button type="button" variant="ghost">Cancel</Button>+ <Button type="submit" variant="accent">Add site</Button>+ </div>+ </form>+ </Form>+ </div>+ );+}diff --git a/.design-sync/previews/Input.tsx b/.design-sync/previews/Input.tsxnew file mode 100644index 000000000..703238607--- /dev/null+++ b/.design-sync/previews/Input.tsx@@ -0,0 +1,69 @@+import * as React from "react";+import { Input, Label } from "@rybbit/ui";++/** The canonical labelled field: 36px tall, transparent fill, hairline neutral-800 border. */+export function Default() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <Label htmlFor="domain">Domain</Label>+ <Input id="domain" placeholder="example.com" defaultValue="tomato.gg" />+ </div>+ );+}++/** The `inputSize` axis: default (36px, 14px text) and sm (28px, 12px text) for dense toolbars. */+export function Sizes() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <Input placeholder="Site name (default)" />+ <Input inputSize="sm" placeholder="Site name (sm)" />+ </div>+ );+}++/** `isSearch` adds the leading lucide Search icon and pads the text past it. Used for every filter box. */+export function SearchField() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <Input isSearch placeholder="Search pages…" />+ <Input isSearch inputSize="sm" placeholder="Filter countries" defaultValue="Ger" />+ </div>+ );+}++/** Static states: placeholder, filled, disabled, and `aria-invalid` (red border) with a help line. */+export function States() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <Input placeholder="Placeholder only" />+ <Input defaultValue="https://rybbit.com" />+ <Input disabled defaultValue="site_1f9c2a (read only)" />+ <div className="grid gap-1.5">+ <Input aria-invalid="true" defaultValue="not a domain" />+ <p className="text-xs text-red-400">Enter a valid domain, like tomato.gg</p>+ </div>+ </div>+ );+}++/** Two fields on one row plus a number input, the way a goal/threshold form lays out. */+export function FormRow() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <div className="grid grid-cols-2 gap-3">+ <div className="grid gap-1.5">+ <Label htmlFor="goal-name">Goal name</Label>+ <Input id="goal-name" defaultValue="Signup completed" />+ </div>+ <div className="grid gap-1.5">+ <Label htmlFor="goal-path">Path</Label>+ <Input id="goal-path" placeholder="/signup/done" />+ </div>+ </div>+ <div className="grid gap-1.5">+ <Label htmlFor="threshold">Alert when visitors exceed</Label>+ <Input id="threshold" type="number" defaultValue={500} className="w-32 tabular-nums" />+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/InputWithSuggestions.tsx b/.design-sync/previews/InputWithSuggestions.tsxnew file mode 100644index 000000000..87e85222e--- /dev/null+++ b/.design-sync/previews/InputWithSuggestions.tsx@@ -0,0 +1,48 @@+import * as React from "react";+import { InputWithSuggestions, Label } from "@rybbit/ui";++const pages = [+ { value: "/pricing", count: 6120 },+ { value: "/pricing/compare", count: 1840 },+ { value: "/docs/script", count: 4890 },+ { value: "/blog/session-replay", count: 2310 },+ { value: "/signup", count: 1975 },+];++/**+ * Canonical: the list opens on focus, so the preview focuses the input after mount. Suggestions+ * filter by substring of the typed value; the right column is the compact event count.+ */+export function PagePathOpen() {+ const [value, setValue] = React.useState("/pri");+ const input = React.useRef<HTMLInputElement>(null);+ React.useEffect(() => {+ const el = input.current;+ if (!el) return;+ el.focus();+ el.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));+ }, []);+ return (+ <div className="p-4 w-96">+ <Label className="mb-1.5 block">Page path</Label>+ <InputWithSuggestions+ ref={input}+ value={value}+ onValueChange={setValue}+ suggestions={pages}+ placeholder="/checkout"+ />+ </div>+ );+}++/** Closed states: empty with placeholder, filled, and disabled. */+export function ClosedStates() {+ return (+ <div className="p-4 w-96 flex flex-col gap-3">+ <InputWithSuggestions suggestions={pages} placeholder="Match a page path" />+ <InputWithSuggestions suggestions={pages} value="/docs/script" onValueChange={() => {}} />+ <InputWithSuggestions suggestions={pages} value="/signup" onValueChange={() => {}} disabled />+ </div>+ );+}diff --git a/.design-sync/previews/Label.tsx b/.design-sync/previews/Label.tsxnew file mode 100644index 000000000..6b218745c--- /dev/null+++ b/.design-sync/previews/Label.tsx@@ -0,0 +1,56 @@+import * as React from "react";+import { Checkbox, Input, Label, Switch } from "@rybbit/ui";++/** Label above an Input via `htmlFor`: 14px medium, tight leading. */+export function WithInput() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <Label htmlFor="site-name">Site name</Label>+ <Input id="site-name" defaultValue="rybbit.com" />+ <p className="text-xs text-neutral-400">Shown in the site switcher and weekly report emails.</p>+ </div>+ );+}++/** Inline label to the right of a Checkbox / Switch; clicking the text toggles the control. */+export function WithToggles() {+ return (+ <div className="grid w-[420px] gap-4 p-4">+ <div className="flex items-center gap-2">+ <Checkbox id="exclude-bots" defaultChecked />+ <Label htmlFor="exclude-bots">Exclude known bots</Label>+ </div>+ <div className="flex items-center gap-2">+ <Switch id="public" />+ <Label htmlFor="public">Public dashboard</Label>+ </div>+ </div>+ );+}++/** Label paired with a disabled `peer` control fades to 70% (peer-disabled). */+export function Disabled() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <div className="flex items-center gap-2">+ <Switch id="replay" disabled className="peer" />+ <Label htmlFor="replay">Session replay (requires Pro)</Label>+ </div>+ </div>+ );+}++/** Label with a required marker and a trailing hint, a common settings-form row. */+export function WithHint() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <div className="flex items-baseline justify-between">+ <Label htmlFor="api-key">+ API key <span className="text-red-400">*</span>+ </Label>+ <span className="text-xs text-neutral-400">Kept secret</span>+ </div>+ <Input id="api-key" type="password" defaultValue="rb_live_9f2c1d8ab4" />+ </div>+ );+}diff --git a/.design-sync/previews/MultiSelect.tsx b/.design-sync/previews/MultiSelect.tsxnew file mode 100644index 000000000..7271e7ed5--- /dev/null+++ b/.design-sync/previews/MultiSelect.tsx@@ -0,0 +1,51 @@+import * as React from "react";+import { Label, MultiSelect } from "@rybbit/ui";++const countries = [+ { value: "US", label: "United States" },+ { value: "DE", label: "Germany" },+ { value: "GB", label: "United Kingdom" },+ { value: "FR", label: "France" },+ { value: "JP", label: "Japan" },+ { value: "BR", label: "Brazil" },+ { value: "AQ", label: "Antarctica", disabled: true },+];++/**+ * Canonical: controlled value with three chips, list OPEN. MultiSelect has no `open` prop (the+ * popover is internal state), so the preview clicks the combobox trigger once after mount.+ */+export function CountriesOpen() {+ const [value, setValue] = React.useState(["US", "DE", "GB"]);+ const root = React.useRef<HTMLDivElement>(null);+ React.useEffect(() => {+ const btn = root.current?.querySelector<HTMLButtonElement>('button[role="combobox"]');+ btn?.click();+ }, []);+ return (+ <div ref={root} className="p-4 w-96">+ <Label className="mb-1.5 block">Countries</Label>+ <MultiSelect+ options={countries}+ value={value}+ onValueChange={setValue}+ placeholder="Filter by country"+ searchPlaceholder="Search countries"+ emptyText="No country matches."+ />+ </div>+ );+}++/** Closed trigger states: empty placeholder, chips wrapping to two rows, disabled. */+export function TriggerStates() {+ const [a, setA] = React.useState<string[]>([]);+ const [b, setB] = React.useState(["US", "DE", "GB", "FR", "JP"]);+ return (+ <div className="p-4 w-96 flex flex-col gap-3">+ <MultiSelect options={countries} value={a} onValueChange={setA} placeholder="Filter by country" />+ <MultiSelect options={countries} value={b} onValueChange={setB} />+ <MultiSelect options={countries} value={["US"]} disabled />+ </div>+ );+}diff --git a/.design-sync/previews/NavigationMenu.tsx b/.design-sync/previews/NavigationMenu.tsxnew file mode 100644index 000000000..5f6addd82--- /dev/null+++ b/.design-sync/previews/NavigationMenu.tsx@@ -0,0 +1,101 @@+import * as React from "react";+import {+ NavigationMenu,+ NavigationMenuContent,+ NavigationMenuItem,+ NavigationMenuLink,+ NavigationMenuList,+ NavigationMenuTrigger,+ navigationMenuTriggerStyle,+} from "@rybbit/ui";++const reports = [+ { title: "Overview", desc: "Visitors, pageviews, bounce rate and top pages at a glance." },+ { title: "Sessions", desc: "Every visit as a timeline, with replay when it is enabled." },+ { title: "Goals", desc: "Conversions on a path or a custom event." },+ { title: "Funnels", desc: "Drop-off between the steps you define." },+];++function ReportLink({ title, desc }: { title: string; desc: string }) {+ return (+ <NavigationMenuLink asChild>+ <a href="#" className="block rounded-md p-3 hover:bg-neutral-800">+ <div className="text-sm font-medium">{title}</div>+ <p className="mt-1 text-xs text-neutral-400">{desc}</p>+ </a>+ </NavigationMenuLink>+ );+}++/** Top nav with one trigger forced open via `value`; the content panel drops from the bar. */+export function TopNavOpen() {+ return (+ <div className="p-4" style={{ minHeight: 360 }}>+ <NavigationMenu value="reports">+ <NavigationMenuList>+ <NavigationMenuItem value="reports">+ <NavigationMenuTrigger>Reports</NavigationMenuTrigger>+ <NavigationMenuContent>+ <div className="grid w-[400px] gap-1 p-2">+ {reports.map((r) => (+ <ReportLink key={r.title} {...r} />+ ))}+ </div>+ </NavigationMenuContent>+ </NavigationMenuItem>+ <NavigationMenuItem value="settings">+ <NavigationMenuTrigger>Settings</NavigationMenuTrigger>+ <NavigationMenuContent>+ <div className="w-[300px] p-2">+ <ReportLink title="Site settings" desc="Domain, tracking, exclusions." />+ </div>+ </NavigationMenuContent>+ </NavigationMenuItem>+ <NavigationMenuItem>+ <NavigationMenuLink href="#" className={navigationMenuTriggerStyle()}>+ Docs+ </NavigationMenuLink>+ </NavigationMenuItem>+ </NavigationMenuList>+ </NavigationMenu>+ </div>+ );+}++/** The resting bar: two triggers closed and a plain link styled with navigationMenuTriggerStyle(). */+export function TopNavClosed() {+ return (+ <div className="p-4">+ <NavigationMenu>+ <NavigationMenuList>+ <NavigationMenuItem>+ <NavigationMenuTrigger>Reports</NavigationMenuTrigger>+ <NavigationMenuContent>+ <div className="w-[300px] p-2">+ <ReportLink title="Overview" desc="Visitors and pageviews at a glance." />+ </div>+ </NavigationMenuContent>+ </NavigationMenuItem>+ <NavigationMenuItem>+ <NavigationMenuTrigger>Settings</NavigationMenuTrigger>+ <NavigationMenuContent>+ <div className="w-[300px] p-2">+ <ReportLink title="Site settings" desc="Domain, tracking, exclusions." />+ </div>+ </NavigationMenuContent>+ </NavigationMenuItem>+ <NavigationMenuItem>+ <NavigationMenuLink href="#" className={navigationMenuTriggerStyle()}>+ Docs+ </NavigationMenuLink>+ </NavigationMenuItem>+ <NavigationMenuItem>+ <NavigationMenuLink href="#" className={navigationMenuTriggerStyle()}>+ Changelog+ </NavigationMenuLink>+ </NavigationMenuItem>+ </NavigationMenuList>+ </NavigationMenu>+ </div>+ );+}diff --git a/.design-sync/previews/Popover.tsx b/.design-sync/previews/Popover.tsxnew file mode 100644index 000000000..37d3d820d--- /dev/null+++ b/.design-sync/previews/Popover.tsx@@ -0,0 +1,124 @@+import * as React from "react";+import { Calendar as CalendarIcon, Filter } from "lucide-react";+import {+ Button,+ Checkbox,+ Input,+ Label,+ Popover,+ PopoverContent,+ PopoverTrigger,+ Separator,+} from "@rybbit/ui";++/** Canonical: a date-range popover anchored to its trigger, rendered open (align="start"). */+export function DateRange() {+ const presets = ["Today", "Last 7 days", "Last 30 days", "This month"];+ return (+ <div className="min-h-screen p-4">+ <Popover open>+ <PopoverTrigger asChild>+ <Button variant="outline" size="sm">+ <CalendarIcon />+ Last 7 days+ </Button>+ </PopoverTrigger>+ <PopoverContent align="start" className="w-64" onOpenAutoFocus={e => e.preventDefault()}>+ <div className="grid gap-1">+ {presets.map(p => (+ <button+ key={p}+ type="button"+ className={+ "rounded-md px-2 py-1.5 text-left text-sm " ++ (p === "Last 7 days" ? "bg-neutral-700 text-neutral-50" : "text-neutral-300 hover:bg-neutral-700/60")+ }+ >+ {p}+ </button>+ ))}+ </div>+ <Separator className="my-3 dark:bg-neutral-700" />+ <div className="grid grid-cols-2 gap-2">+ <div className="grid gap-1">+ <Label htmlFor="from" className="text-xs text-neutral-400">+ From+ </Label>+ <Input id="from" defaultValue="2026-09-06" className="h-8 text-xs" />+ </div>+ <div className="grid gap-1">+ <Label htmlFor="to" className="text-xs text-neutral-400">+ To+ </Label>+ <Input id="to" defaultValue="2026-09-13" className="h-8 text-xs" />+ </div>+ </div>+ </PopoverContent>+ </Popover>+ </div>+ );+}++/** Small filter form with checkboxes and a footer action. */+export function FilterForm() {+ const options = [+ { label: "Chrome", count: "6,240", checked: true },+ { label: "Safari", count: "2,118", checked: true },+ { label: "Firefox", count: "914", checked: false },+ { label: "Edge", count: "402", checked: false },+ ];+ return (+ <div className="min-h-screen p-4">+ <Popover open>+ <PopoverTrigger asChild>+ <Button variant="outline" size="sm">+ <Filter />+ Browser+ </Button>+ </PopoverTrigger>+ <PopoverContent align="start" className="w-72 p-3">+ <p className="mb-2 text-xs font-medium text-neutral-400">Browser is</p>+ <div className="grid gap-2">+ {options.map(o => (+ <label key={o.label} className="flex items-center gap-2 text-sm">+ <Checkbox defaultChecked={o.checked} />+ <span className="flex-1">{o.label}</span>+ <span className="text-xs text-neutral-400">{o.count}</span>+ </label>+ ))}+ </div>+ <div className="mt-3 flex justify-end gap-2">+ <Button variant="ghost" size="sm">+ Clear+ </Button>+ <Button variant="accent" size="sm">+ Apply+ </Button>+ </div>+ </PopoverContent>+ </Popover>+ </div>+ );+}++/** Plain informational popover (text only, default w-72) anchored to a ghost button. */+export function InfoText() {+ return (+ <div className="min-h-screen p-4">+ <Popover open>+ <PopoverTrigger asChild>+ <Button variant="ghost" size="sm">+ What counts as a bounce?+ </Button>+ </PopoverTrigger>+ <PopoverContent align="start">+ <p className="text-sm font-medium">Bounce rate</p>+ <p className="mt-1 text-sm text-neutral-400">+ The share of sessions with a single pageview and no custom events. Rybbit counts a session as bounced+ after 30 minutes of inactivity.+ </p>+ </PopoverContent>+ </Popover>+ </div>+ );+}diff --git a/.design-sync/previews/Progress.tsx b/.design-sync/previews/Progress.tsxnew file mode 100644index 000000000..870a7ffde--- /dev/null+++ b/.design-sync/previews/Progress.tsx@@ -0,0 +1,53 @@+import * as React from "react";+import { Progress } from "@rybbit/ui";++/** The value axis: empty, partial, and full. The bar is 8px tall, emerald fill on a neutral-800 track. */+export function Values() {+ return (+ <div className="flex w-full max-w-md flex-col gap-4 p-4">+ {[0, 25, 66, 100].map((v) => (+ <div key={v} className="flex items-center gap-3">+ <span className="w-10 text-right text-xs tabular-nums text-muted-foreground">{v}%</span>+ <Progress value={v} className="flex-1" />+ </div>+ ))}+ </div>+ );+}++/** A labeled usage meter, as on the billing page: label + figure above, the bar below. */+export function UsageBar() {+ return (+ <div className="w-full max-w-md p-4">+ <div className="flex flex-col gap-2 rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <div className="flex items-center justify-between text-sm">+ <span className="font-medium">Events this month</span>+ <span className="tabular-nums text-neutral-400">812K / 1M</span>+ </div>+ <Progress value={81} />+ <div className="text-xs text-muted-foreground">Resets in 9 days · Pro plan</div>+ </div>+ </div>+ );+}++/** Thinner bars for inline rows: pass a height class to shrink the track. */+export function InlineRows() {+ const rows = [+ { name: "United States", value: 48 },+ { name: "Germany", value: 21 },+ { name: "United Kingdom", value: 14 },+ { name: "Japan", value: 9 },+ ];+ return (+ <div className="flex w-full max-w-md flex-col gap-3 p-4 text-sm">+ {rows.map((r) => (+ <div key={r.name} className="flex items-center gap-3">+ <span className="w-32 truncate">{r.name}</span>+ <Progress value={r.value} className="h-1.5 flex-1" />+ <span className="w-10 text-right text-xs tabular-nums text-muted-foreground">{r.value}%</span>+ </div>+ ))}+ </div>+ );+}diff --git a/.design-sync/previews/RadioGroup.tsx b/.design-sync/previews/RadioGroup.tsxnew file mode 100644index 000000000..579a2b986--- /dev/null+++ b/.design-sync/previews/RadioGroup.tsx@@ -0,0 +1,73 @@+import * as React from "react";+import { Label, RadioGroup, RadioGroupItem } from "@rybbit/ui";++/** Canonical vertical group with one selected item (emerald ring, white dot). */+export function Default() {+ return (+ <div className="w-[420px] p-4">+ <p className="mb-3 text-sm font-medium">Data retention</p>+ <RadioGroup defaultValue="365">+ <div className="flex items-center gap-2">+ <RadioGroupItem value="90" id="r-90" />+ <Label htmlFor="r-90" className="font-normal">90 days</Label>+ </div>+ <div className="flex items-center gap-2">+ <RadioGroupItem value="365" id="r-365" />+ <Label htmlFor="r-365" className="font-normal">1 year</Label>+ </div>+ <div className="flex items-center gap-2">+ <RadioGroupItem value="forever" id="r-forever" />+ <Label htmlFor="r-forever" className="font-normal">Forever</Label>+ </div>+ </RadioGroup>+ </div>+ );+}++/** Horizontal layout via `className="flex gap-4"` on the group, for short enum choices. */+export function Horizontal() {+ return (+ <div className="w-[420px] p-4">+ <p className="mb-3 text-sm font-medium">Chart interval</p>+ <RadioGroup defaultValue="day" className="flex gap-4">+ {["hour", "day", "week", "month"].map(v => (+ <div key={v} className="flex items-center gap-2">+ <RadioGroupItem value={v} id={`int-${v}`} />+ <Label htmlFor={`int-${v}`} className="font-normal capitalize">{v}</Label>+ </div>+ ))}+ </RadioGroup>+ </div>+ );+}++/** Items with a description line and one disabled option. */+export function WithDescriptions() {+ return (+ <div className="w-[420px] p-4">+ <RadioGroup defaultValue="all">+ <div className="flex items-start gap-3">+ <RadioGroupItem value="all" id="v-all" className="mt-0.5" />+ <div className="grid gap-1">+ <Label htmlFor="v-all">All visitors</Label>+ <p className="text-xs text-neutral-400">Count every session, including returning visitors.</p>+ </div>+ </div>+ <div className="flex items-start gap-3">+ <RadioGroupItem value="new" id="v-new" className="mt-0.5" />+ <div className="grid gap-1">+ <Label htmlFor="v-new">New visitors only</Label>+ <p className="text-xs text-neutral-400">First session in the selected range.</p>+ </div>+ </div>+ <div className="flex items-start gap-3">+ <RadioGroupItem value="identified" id="v-id" disabled className="mt-0.5" />+ <div className="grid gap-1">+ <Label htmlFor="v-id" className="opacity-70">Identified users</Label>+ <p className="text-xs text-neutral-400">Requires `identify()` calls from your app.</p>+ </div>+ </div>+ </RadioGroup>+ </div>+ );+}diff --git a/.design-sync/previews/ResponsiveDialog.tsx b/.design-sync/previews/ResponsiveDialog.tsxnew file mode 100644index 000000000..da13c719e--- /dev/null+++ b/.design-sync/previews/ResponsiveDialog.tsx@@ -0,0 +1,85 @@+import * as React from "react";+import {+ Button,+ Input,+ Label,+ ResponsiveDialog,+ ResponsiveDialogClose,+ ResponsiveDialogContent,+ ResponsiveDialogDescription,+ ResponsiveDialogFooter,+ ResponsiveDialogHeader,+ ResponsiveDialogTitle,+} from "@rybbit/ui";++/** Canonical: at ≥640px this renders as a centered Dialog; below it becomes a bottom Drawer. Rendered open. */+export function InviteMember() {+ return (+ <ResponsiveDialog open>+ <ResponsiveDialogContent className="max-w-md p-6">+ <ResponsiveDialogHeader>+ <ResponsiveDialogTitle>Invite a teammate</ResponsiveDialogTitle>+ <ResponsiveDialogDescription>They will get access to every site in Tomato Labs.</ResponsiveDialogDescription>+ </ResponsiveDialogHeader>+ <div className="grid gap-3 py-2">+ <div className="grid gap-1.5">+ <Label htmlFor="invite-email">Email</Label>+ <Input id="invite-email" placeholder="[email protected]" defaultValue="[email protected]" />+ </div>+ </div>+ <ResponsiveDialogFooter>+ <ResponsiveDialogClose asChild>+ <Button variant="ghost">Cancel</Button>+ </ResponsiveDialogClose>+ <Button variant="accent">Send invite</Button>+ </ResponsiveDialogFooter>+ </ResponsiveDialogContent>+ </ResponsiveDialog>+ );+}++/** onlyDrawer forces the mobile presentation (bottom sheet with drag handle) regardless of width. */+export function MobileDrawerVariant() {+ return (+ <ResponsiveDialog open onlyDrawer>+ <ResponsiveDialogContent className="gap-4 px-4 pb-4">+ <ResponsiveDialogHeader>+ <ResponsiveDialogTitle>Invite a teammate</ResponsiveDialogTitle>+ <ResponsiveDialogDescription>They will get access to every site in Tomato Labs.</ResponsiveDialogDescription>+ </ResponsiveDialogHeader>+ <div className="grid gap-1.5">+ <Label htmlFor="invite-email-m">Email</Label>+ <Input id="invite-email-m" placeholder="[email protected]" />+ </div>+ <ResponsiveDialogFooter>+ <Button variant="accent">Send invite</Button>+ <ResponsiveDialogClose asChild>+ <Button variant="ghost">Cancel</Button>+ </ResponsiveDialogClose>+ </ResponsiveDialogFooter>+ </ResponsiveDialogContent>+ </ResponsiveDialog>+ );+}++/** alert mode: no close X, not dismissible by overlay/Escape; the user must pick an action. */+export function AlertMode() {+ return (+ <ResponsiveDialog open alert>+ <ResponsiveDialogContent className="max-w-md p-6">+ <ResponsiveDialogHeader>+ <ResponsiveDialogTitle>Regenerate API key?</ResponsiveDialogTitle>+ <ResponsiveDialogDescription>+ The current key for tomato.gg stops working immediately. Update any scripts that use it.+ </ResponsiveDialogDescription>+ </ResponsiveDialogHeader>+ <ResponsiveDialogFooter>+ <ResponsiveDialogClose asChild>+ <Button variant="outline">Cancel</Button>+ </ResponsiveDialogClose>+ <Button variant="destructive">Regenerate</Button>+ </ResponsiveDialogFooter>+ </ResponsiveDialogContent>+ </ResponsiveDialog>+ );+}diff --git a/.design-sync/previews/ScrollArea.tsx b/.design-sync/previews/ScrollArea.tsxnew file mode 100644index 000000000..cdec1ddc5--- /dev/null+++ b/.design-sync/previews/ScrollArea.tsx@@ -0,0 +1,86 @@+import * as React from "react";+import { Badge, ScrollArea, ScrollBar } from "@rybbit/ui";++const countries = [+ ["United States", 8412],+ ["Germany", 3120],+ ["United Kingdom", 2874],+ ["Japan", 1990],+ ["France", 1732],+ ["Canada", 1518],+ ["Brazil", 1204],+ ["India", 1188],+ ["Netherlands", 962],+ ["Australia", 901],+ ["Spain", 844],+ ["Sweden", 610],+ ["Poland", 577],+ ["South Korea", 542],+ ["Italy", 498],+] as const;++/** A fixed-height list that overflows. `type="always"` keeps the bar visible here; the app default reveals it on hover. */+export function CountryList() {+ return (+ <div className="w-full max-w-md p-4">+ <ScrollArea type="always" className="h-64 rounded-lg border border-neutral-800 bg-neutral-900">+ <div className="flex flex-col p-2 text-sm">+ {countries.map(([name, n]) => (+ <div key={name} className="flex items-center justify-between rounded-md px-2 py-1.5">+ <span>{name}</span>+ <span className="tabular-nums text-neutral-400">{n.toLocaleString()}</span>+ </div>+ ))}+ </div>+ </ScrollArea>+ </div>+ );+}++/** Edge fade: the built-in mask (30px, panel-colored) marks the overflow edges. `maskHeight={0}` disables it. */+export function WithoutMask() {+ return (+ <div className="w-full max-w-md p-4">+ <ScrollArea type="always" maskHeight={0} className="h-48 rounded-lg border border-neutral-800 bg-neutral-900">+ <div className="flex flex-col p-2 text-sm">+ {countries.slice(0, 10).map(([name, n]) => (+ <div key={name} className="flex items-center justify-between px-2 py-1.5">+ <span>{name}</span>+ <span className="tabular-nums text-neutral-400">{n.toLocaleString()}</span>+ </div>+ ))}+ </div>+ </ScrollArea>+ </div>+ );+}++/** Horizontal overflow: a row of session-event chips wider than the panel, with an explicit horizontal ScrollBar. */+export function HorizontalChips() {+ const events = [+ "pageview /",+ "pageview /pricing",+ "click #signup-cta",+ "pageview /signup",+ "form_submit signup",+ "pageview /onboarding",+ "custom add_site",+ "pageview /tomato.gg",+ "click #install-docs",+ "pageview /docs/script",+ ];+ return (+ <div className="w-full max-w-md p-4">+ <ScrollArea type="always" className="rounded-lg border border-neutral-800 bg-neutral-900">+ <div className="flex w-max items-center gap-2 p-3 pb-4">+ {events.map((e) => (+ <Badge key={e} variant="secondary" className="whitespace-nowrap font-mono">+ {e}+ </Badge>+ ))}+ </div>+ <ScrollBar orientation="horizontal" />+ </ScrollArea>+ </div>+ );+}diff --git a/.design-sync/previews/Select.tsx b/.design-sync/previews/Select.tsxnew file mode 100644index 000000000..713760c56--- /dev/null+++ b/.design-sync/previews/Select.tsx@@ -0,0 +1,102 @@+import * as React from "react";+import {+ Label,+ Select,+ SelectContent,+ SelectGroup,+ SelectItem,+ SelectLabel,+ SelectSeparator,+ SelectTrigger,+ SelectValue,+} from "@rybbit/ui";++/** Canonical single-value select, rendered OPEN so the list shows. A value is chosen (emerald check). */+export function TimeRangeOpen() {+ return (+ <div className="p-4 w-72">+ <Label className="mb-1.5 block">Time range</Label>+ <Select open defaultValue="7d">+ <SelectTrigger>+ <SelectValue placeholder="Pick a range" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="24h">Last 24 hours</SelectItem>+ <SelectItem value="7d">Last 7 days</SelectItem>+ <SelectItem value="30d">Last 30 days</SelectItem>+ <SelectItem value="90d">Last 90 days</SelectItem>+ <SelectSeparator />+ <SelectItem value="all">All time</SelectItem>+ </SelectContent>+ </Select>+ </div>+ );+}++/** Grouped items with SelectLabel headings, small size, rendered open. */+export function GroupedSmallOpen() {+ return (+ <div className="p-4 w-72">+ <Select open defaultValue="tomato.gg">+ <SelectTrigger size="sm">+ <SelectValue placeholder="Choose a site" />+ </SelectTrigger>+ <SelectContent size="sm">+ <SelectGroup>+ <SelectLabel size="sm">Acme</SelectLabel>+ <SelectItem size="sm" value="tomato.gg">tomato.gg</SelectItem>+ <SelectItem size="sm" value="rybbit.com">rybbit.com</SelectItem>+ </SelectGroup>+ <SelectSeparator />+ <SelectGroup>+ <SelectLabel size="sm">Personal</SelectLabel>+ <SelectItem size="sm" value="blog.example.dev">blog.example.dev</SelectItem>+ <SelectItem size="sm" value="staging" disabled>staging.rybbit.dev (no data)</SelectItem>+ </SelectGroup>+ </SelectContent>+ </Select>+ </div>+ );+}++/** Closed triggers: placeholder, filled, small, and disabled. */+export function TriggerStates() {+ return (+ <div className="p-4 w-72 flex flex-col gap-3">+ <Select>+ <SelectTrigger>+ <SelectValue placeholder="Select a goal" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="signup">Signup completed</SelectItem>+ </SelectContent>+ </Select>+ <Select defaultValue="chrome">+ <SelectTrigger>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="chrome">Chrome</SelectItem>+ <SelectItem value="safari">Safari</SelectItem>+ </SelectContent>+ </Select>+ <Select defaultValue="visitors">+ <SelectTrigger size="sm">+ <SelectValue />+ </SelectTrigger>+ <SelectContent size="sm">+ <SelectItem size="sm" value="visitors">Visitors</SelectItem>+ <SelectItem size="sm" value="pageviews">Pageviews</SelectItem>+ </SelectContent>+ </Select>+ <Select defaultValue="utc" disabled>+ <SelectTrigger>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="utc">UTC</SelectItem>+ </SelectContent>+ </Select>+ </div>+ );+}diff --git a/.design-sync/previews/Separator.tsx b/.design-sync/previews/Separator.tsxnew file mode 100644index 000000000..b6ec58718--- /dev/null+++ b/.design-sync/previews/Separator.tsx@@ -0,0 +1,50 @@+import * as React from "react";+import { Button, Separator } from "@rybbit/ui";+import { Download, Filter, RefreshCw } from "lucide-react";++/** Horizontal: a 1px neutral-800 hairline between two text blocks. */+export function Horizontal() {+ return (+ <div className="w-full max-w-md p-4">+ <div className="flex flex-col gap-1">+ <div className="text-sm font-medium">Tracking script</div>+ <div className="text-sm text-muted-foreground">Paste this snippet before the closing head tag on tomato.gg.</div>+ </div>+ <Separator className="my-4" />+ <div className="flex flex-col gap-1">+ <div className="text-sm font-medium">Data retention</div>+ <div className="text-sm text-muted-foreground">Events are kept for 24 months on the Pro plan.</div>+ </div>+ </div>+ );+}++/** Vertical: give it a height (or let a fixed-height flex row stretch it) to divide toolbar groups. */+export function VerticalToolbar() {+ return (+ <div className="p-4">+ <div className="inline-flex h-9 items-center gap-2 rounded-lg border border-neutral-800 bg-neutral-900 px-2">+ <Button variant="ghost" size="sm"><Filter /> Filter</Button>+ <Separator orientation="vertical" className="h-5" />+ <Button variant="ghost" size="sm"><RefreshCw /> Refresh</Button>+ <Separator orientation="vertical" className="h-5" />+ <Button variant="ghost" size="sm"><Download /> Export</Button>+ </div>+ </div>+ );+}++/** Inline metadata separated by short vertical rules. */+export function InlineMeta() {+ return (+ <div className="p-4">+ <div className="flex h-4 items-center gap-3 text-sm text-muted-foreground">+ <span>tomato.gg</span>+ <Separator orientation="vertical" />+ <span>Last 7 days</span>+ <Separator orientation="vertical" />+ <span className="tabular-nums">2.4M events</span>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/Sheet.tsx b/.design-sync/previews/Sheet.tsxnew file mode 100644index 000000000..4b7b21807--- /dev/null+++ b/.design-sync/previews/Sheet.tsx@@ -0,0 +1,113 @@+import * as React from "react";+import {+ Button,+ Input,+ Label,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Switch,+} from "@rybbit/ui";++/** Canonical side panel (side="right" is the default), rendered open. Opener is a Button inside SheetTrigger. */+export function SiteSettings() {+ return (+ <Sheet open>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>Site settings</SheetTitle>+ <SheetDescription>tomato.gg · created 14 Mar 2025</SheetDescription>+ </SheetHeader>+ <div className="grid gap-4 py-6">+ <div className="grid gap-1.5">+ <Label htmlFor="sheet-domain">Domain</Label>+ <Input id="sheet-domain" defaultValue="tomato.gg" />+ </div>+ <div className="grid gap-1.5">+ <Label htmlFor="sheet-name">Display name</Label>+ <Input id="sheet-name" defaultValue="Tomato" />+ </div>+ <div className="flex items-center justify-between rounded-lg border border-neutral-800 p-3">+ <div className="grid gap-0.5">+ <span className="text-sm font-medium">Public dashboard</span>+ <span className="text-xs text-neutral-400">Anyone with the link can view stats</span>+ </div>+ <Switch defaultChecked />+ </div>+ <div className="flex items-center justify-between rounded-lg border border-neutral-800 p-3">+ <div className="grid gap-0.5">+ <span className="text-sm font-medium">Session replay</span>+ <span className="text-xs text-neutral-400">Record 10% of sessions</span>+ </div>+ <Switch />+ </div>+ </div>+ <SheetFooter>+ <Button variant="ghost">Cancel</Button>+ <Button variant="accent">Save changes</Button>+ </SheetFooter>+ </SheetContent>+ </Sheet>+ );+}++/** side="left": a navigation-style panel listing the organization's sites. */+export function SiteSwitcherLeft() {+ const sites = [+ { name: "tomato.gg", visitors: "12.4k", active: true },+ { name: "rybbit.com", visitors: "8.1k", active: false },+ { name: "docs.rybbit.com", visitors: "2.3k", active: false },+ { name: "blog.tomato.gg", visitors: "640", active: false },+ ];+ return (+ <Sheet open>+ <SheetContent side="left">+ <SheetHeader>+ <SheetTitle>Tomato Labs</SheetTitle>+ <SheetDescription>4 sites · Pro plan</SheetDescription>+ </SheetHeader>+ <ul className="mt-6 grid gap-1">+ {sites.map(site => (+ <li+ key={site.name}+ className={+ "flex items-center justify-between rounded-lg px-3 py-2 text-sm " ++ (site.active ? "bg-neutral-800 text-neutral-50" : "text-neutral-300")+ }+ >+ <span>{site.name}</span>+ <span className="text-xs text-neutral-400">{site.visitors} / 24h</span>+ </li>+ ))}+ </ul>+ <SheetFooter className="mt-6">+ <Button variant="outline" className="w-full">+ Add a website+ </Button>+ </SheetFooter>+ </SheetContent>+ </Sheet>+ );+}++/** side="bottom" without the close X: a short action strip for the selected rows. */+export function BulkActionsBottom() {+ return (+ <Sheet open>+ <SheetContent side="bottom" showClose={false}>+ <SheetHeader>+ <SheetTitle>3 sessions selected</SheetTitle>+ <SheetDescription>Export the replays or exclude these visitors from future reports.</SheetDescription>+ </SheetHeader>+ <SheetFooter className="mt-4">+ <Button variant="ghost">Clear selection</Button>+ <Button variant="outline">Exclude visitors</Button>+ <Button variant="accent">Export replays</Button>+ </SheetFooter>+ </SheetContent>+ </Sheet>+ );+}diff --git a/.design-sync/previews/Skeleton.tsx b/.design-sync/previews/Skeleton.tsxnew file mode 100644index 000000000..8d5250ad4--- /dev/null+++ b/.design-sync/previews/Skeleton.tsx@@ -0,0 +1,66 @@+import * as React from "react";+import { Skeleton } from "@rybbit/ui";++/** The overview tiles while the query runs: label stays, figure and delta become blocks. */+export function StatCards() {+ return (+ <div className="flex w-full max-w-xl gap-3 p-4">+ {["Unique visitors", "Sessions", "Bounce rate"].map((label) => (+ <div key={label} className="flex flex-1 flex-col gap-2 rounded-lg border border-neutral-800 bg-neutral-900 px-3 py-2">+ <div className="text-xs font-medium text-muted-foreground">{label}</div>+ <div className="flex items-center justify-between">+ <Skeleton className="h-9 w-[60px] rounded-md" />+ <Skeleton className="h-5 w-[50px] rounded-md" />+ </div>+ </div>+ ))}+ </div>+ );+}++/** A loading list: one bar per row, name on the left and a short figure on the right. */+export function TableRows() {+ return (+ <div className="flex w-full max-w-md flex-col gap-2 rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <div className="flex items-center justify-between text-xs font-medium text-muted-foreground">+ <span>Page</span>+ <span>Visitors</span>+ </div>+ {[0, 1, 2, 3, 4, 5].map((i) => (+ <div key={i} className="flex items-center justify-between gap-4">+ <Skeleton className="h-4 flex-1" />+ <Skeleton className="h-4 w-12" />+ </div>+ ))}+ </div>+ );+}++/** Text placeholders: a title line and three body lines, the last one shorter. */+export function TextLines() {+ return (+ <div className="flex w-full max-w-md flex-col gap-3 p-4">+ <Skeleton className="h-5 w-40" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-64" />+ </div>+ );+}++/** Avatar + two lines, as in a session row or a member list. */+export function AvatarRow() {+ return (+ <div className="flex w-full max-w-md flex-col gap-3 p-4">+ {[0, 1, 2].map((i) => (+ <div key={i} className="flex items-center gap-3">+ <Skeleton className="h-8 w-8 rounded-full" />+ <div className="flex flex-1 flex-col gap-1.5">+ <Skeleton className="h-4 w-40" />+ <Skeleton className="h-3 w-24" />+ </div>+ </div>+ ))}+ </div>+ );+}diff --git a/.design-sync/previews/Slider.tsx b/.design-sync/previews/Slider.tsxnew file mode 100644index 000000000..70998c8da--- /dev/null+++ b/.design-sync/previews/Slider.tsx@@ -0,0 +1,48 @@+import * as React from "react";+import { Label, Slider } from "@rybbit/ui";++/** Canonical single-thumb slider with a label and the current value read out beside it. */+export function SampleRate() {+ return (+ <div className="p-4 w-96">+ <div className="flex items-center justify-between mb-3">+ <Label>Session replay sample rate</Label>+ <span className="text-sm tabular-nums text-neutral-400">40%</span>+ </div>+ <Slider defaultValue={[40]} max={100} step={5} />+ </div>+ );+}++/** Two thumbs make a range; the emerald fill spans between them. */+export function DurationRange() {+ return (+ <div className="p-4 w-96">+ <div className="flex items-center justify-between mb-3">+ <Label>Session duration</Label>+ <span className="text-sm tabular-nums text-neutral-400">30s – 5m</span>+ </div>+ <Slider defaultValue={[30, 300]} min={0} max={600} step={10} />+ </div>+ );+}++/** Edge values and disabled. */+export function States() {+ return (+ <div className="p-4 w-96 flex flex-col gap-6">+ <div>+ <Label className="mb-3 block">Empty (0)</Label>+ <Slider defaultValue={[0]} max={100} />+ </div>+ <div>+ <Label className="mb-3 block">Full (100)</Label>+ <Slider defaultValue={[100]} max={100} />+ </div>+ <div>+ <Label className="mb-3 block">Disabled</Label>+ <Slider defaultValue={[65]} max={100} disabled />+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/Switch.tsx b/.design-sync/previews/Switch.tsxnew file mode 100644index 000000000..cd7618c4d--- /dev/null+++ b/.design-sync/previews/Switch.tsx@@ -0,0 +1,64 @@+import * as React from "react";+import { Label, Switch } from "@rybbit/ui";++/** On (emerald track), off (neutral-800 track), and both disabled. */+export function States() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <div className="flex items-center gap-2">+ <Switch id="on" defaultChecked />+ <Label htmlFor="on">On</Label>+ </div>+ <div className="flex items-center gap-2">+ <Switch id="off" />+ <Label htmlFor="off">Off</Label>+ </div>+ <div className="flex items-center gap-2">+ <Switch id="dis-on" disabled defaultChecked />+ <Label htmlFor="dis-on" className="opacity-70">Disabled, on</Label>+ </div>+ <div className="flex items-center gap-2">+ <Switch id="dis-off" disabled />+ <Label htmlFor="dis-off" className="opacity-70">Disabled, off</Label>+ </div>+ </div>+ );+}++/** A settings list: label + description on the left, switch pinned right. The most common composition. */+export function SettingsList() {+ const rows = [+ { id: "replay", label: "Session replay", desc: "Record sessions for the last 7 days.", on: true },+ { id: "vitals", label: "Web vitals", desc: "Collect LCP, CLS and INP from real visitors.", on: true },+ { id: "bots", label: "Block bot traffic", desc: "Drop events that match known crawlers.", on: true },+ { id: "public", label: "Public dashboard", desc: "Anyone with the link can view tomato.gg stats.", on: false },+ ];+ return (+ <div className="w-[420px] p-4">+ <div className="divide-y divide-neutral-800 rounded-lg border border-neutral-800 bg-neutral-900">+ {rows.map(r => (+ <div key={r.id} className="flex items-center justify-between gap-4 px-4 py-3">+ <div className="grid gap-0.5">+ <Label htmlFor={r.id}>{r.label}</Label>+ <p className="text-xs text-neutral-400">{r.desc}</p>+ </div>+ <Switch id={r.id} defaultChecked={r.on} />+ </div>+ ))}+ </div>+ </div>+ );+}++/** Compact inline toggle in a toolbar, e.g. the "Live" mode toggle next to a date picker. */+export function Inline() {+ return (+ <div className="w-[420px] p-4">+ <div className="flex items-center gap-2 text-sm">+ <Switch id="live" defaultChecked />+ <Label htmlFor="live">Live</Label>+ <span className="text-neutral-400">· 128 visitors right now</span>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/Table.tsx b/.design-sync/previews/Table.tsxnew file mode 100644index 000000000..9f9161643--- /dev/null+++ b/.design-sync/previews/Table.tsx@@ -0,0 +1,93 @@+import * as React from "react";+import {+ Badge,+ Table,+ TableBody,+ TableCaption,+ TableCell,+ TableFooter,+ TableHead,+ TableHeader,+ TableRow,+ TableSortIndicator,+} from "@rybbit/ui";++const pages = [+ { path: "/", visitors: 18420, views: 26311, bounce: "41%", time: "1m 12s" },+ { path: "/pricing", visitors: 6120, views: 8034, bounce: "38%", time: "2m 04s" },+ { path: "/docs/script", visitors: 4890, views: 9912, bounce: "22%", time: "3m 40s" },+ { path: "/blog/session-replay", visitors: 2310, views: 2680, bounce: "57%", time: "0m 48s" },+ { path: "/signup", visitors: 1975, views: 2140, bounce: "19%", time: "1m 31s" },+];++/** The canonical analytics table: sortable numeric columns, right-aligned figures, hairline rows. */+export function TopPages() {+ return (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Page</TableHead>+ <TableHead className="text-right">+ <span className="inline-flex items-center justify-end gap-1">Visitors <TableSortIndicator sortDirection="desc" /></span>+ </TableHead>+ <TableHead className="text-right">+ <span className="inline-flex items-center justify-end gap-1">Views <TableSortIndicator /></span>+ </TableHead>+ <TableHead className="text-right">Bounce</TableHead>+ <TableHead className="text-right">Avg. time</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {pages.map((p) => (+ <TableRow key={p.path}>+ <TableCell className="font-medium">{p.path}</TableCell>+ <TableCell className="text-right tabular-nums">{p.visitors.toLocaleString()}</TableCell>+ <TableCell className="text-right tabular-nums">{p.views.toLocaleString()}</TableCell>+ <TableCell className="text-right tabular-nums">{p.bounce}</TableCell>+ <TableCell className="text-right tabular-nums">{p.time}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ );+}++/** Status column with badges, a footer total, and a caption. */+export function SitesWithStatus() {+ const sites = [+ { name: "tomato.gg", plan: "Pro", status: "Tracking", events: "2.4M" },+ { name: "rybbit.com", plan: "Pro", status: "Tracking", events: "812K" },+ { name: "staging.rybbit.dev", plan: "Free", status: "No data", events: "0" },+ ];+ return (+ <Table>+ <TableCaption>Sites in the Acme organization, last 30 days.</TableCaption>+ <TableHeader>+ <TableRow>+ <TableHead>Site</TableHead>+ <TableHead>Plan</TableHead>+ <TableHead>Status</TableHead>+ <TableHead className="text-right">Events</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {sites.map((s) => (+ <TableRow key={s.name}>+ <TableCell className="font-medium">{s.name}</TableCell>+ <TableCell>{s.plan}</TableCell>+ <TableCell>+ <Badge variant={s.status === "Tracking" ? "success" : "warning"}>{s.status}</Badge>+ </TableCell>+ <TableCell className="text-right tabular-nums">{s.events}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ <TableFooter>+ <TableRow>+ <TableCell colSpan={3}>Total</TableCell>+ <TableCell className="text-right tabular-nums">3.2M</TableCell>+ </TableRow>+ </TableFooter>+ </Table>+ );+}diff --git a/.design-sync/previews/Tabs.tsx b/.design-sync/previews/Tabs.tsxnew file mode 100644index 000000000..f9c4d7398--- /dev/null+++ b/.design-sync/previews/Tabs.tsx@@ -0,0 +1,82 @@+import * as React from "react";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rybbit/ui";++function Stat({ label, value, delta }: { label: string; value: string; delta?: string }) {+ return (+ <div className="rounded-lg border border-neutral-800 bg-neutral-900 p-3">+ <div className="text-xs text-neutral-400">{label}</div>+ <div className="mt-1 flex items-baseline gap-2">+ <span className="text-2xl font-semibold tabular-nums">{value}</span>+ {delta ? <span className="text-xs text-emerald-400 tabular-nums">{delta}</span> : null}+ </div>+ </div>+ );+}++/** Canonical segmented tabs: a filled TabsList with one active pill, content below. */+export function ReportTabs() {+ return (+ <div className="w-[500px] p-4">+ <Tabs defaultValue="overview">+ <TabsList>+ <TabsTrigger value="overview">Overview</TabsTrigger>+ <TabsTrigger value="sessions">Sessions</TabsTrigger>+ <TabsTrigger value="goals">Goals</TabsTrigger>+ <TabsTrigger value="funnels">Funnels</TabsTrigger>+ </TabsList>+ <TabsContent value="overview">+ <div className="grid grid-cols-2 gap-3">+ <Stat label="Visitors" value="18,420" delta="+12%" />+ <Stat label="Pageviews" value="26,311" delta="+8%" />+ </div>+ </TabsContent>+ <TabsContent value="sessions">Sessions</TabsContent>+ <TabsContent value="goals">Goals</TabsContent>+ <TabsContent value="funnels">Funnels</TabsContent>+ </Tabs>+ </div>+ );+}++/** A disabled trigger (feature not on this plan) and a non-first default value. */+export function WithDisabled() {+ return (+ <div className="w-[500px] p-4">+ <Tabs defaultValue="sessions">+ <TabsList>+ <TabsTrigger value="overview">Overview</TabsTrigger>+ <TabsTrigger value="sessions">Sessions</TabsTrigger>+ <TabsTrigger value="replay" disabled>+ Replay+ </TabsTrigger>+ </TabsList>+ <TabsContent value="sessions">+ <div className="grid grid-cols-2 gap-3">+ <Stat label="Sessions" value="21,904" delta="+5%" />+ <Stat label="Avg. duration" value="1m 42s" />+ </div>+ </TabsContent>+ </Tabs>+ </div>+ );+}++/** TabsList stretched to the container with equal-width triggers. */+export function FullWidth() {+ return (+ <div className="w-[400px] p-4">+ <Tabs defaultValue="desktop">+ <TabsList className="grid w-full grid-cols-2">+ <TabsTrigger value="desktop">Desktop</TabsTrigger>+ <TabsTrigger value="mobile">Mobile</TabsTrigger>+ </TabsList>+ <TabsContent value="desktop">+ <div className="grid grid-cols-2 gap-3">+ <Stat label="Share" value="64%" />+ <Stat label="Bounce rate" value="38%" />+ </div>+ </TabsContent>+ </Tabs>+ </div>+ );+}diff --git a/.design-sync/previews/Textarea.tsx b/.design-sync/previews/Textarea.tsxnew file mode 100644index 000000000..145ecfca4--- /dev/null+++ b/.design-sync/previews/Textarea.tsx@@ -0,0 +1,41 @@+import * as React from "react";+import { Label, Textarea } from "@rybbit/ui";++/** Labelled multi-line field, 60px min height, resizes vertically by default. */+export function Default() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <Label htmlFor="note">Annotation note</Label>+ <Textarea+ id="note"+ placeholder="What changed on this date?"+ defaultValue="Shipped the new pricing page and started the Product Hunt launch."+ />+ </div>+ );+}++/** Empty with placeholder, a taller `rows` variant, and disabled. */+export function States() {+ return (+ <div className="grid w-[420px] gap-3 p-4">+ <Textarea placeholder="Describe this segment…" />+ <Textarea rows={5} defaultValue={"path contains /docs\nAND country is Germany\nAND browser is Firefox"} className="font-mono text-xs" />+ <Textarea disabled defaultValue="Managed by your organization admin." />+ </div>+ );+}++/** Invalid state: `aria-invalid` for a11y plus `dark:border-red-400` (Textarea has no built-in invalid style and its `dark:border-neutral-800` beats a bare `border-red-400`), with a character count below. */+export function WithCount() {+ return (+ <div className="grid w-[420px] gap-1.5 p-4">+ <Label htmlFor="desc">Site description</Label>+ <Textarea id="desc" aria-invalid="true" className="dark:border-red-400" defaultValue="Tomato.gg is a World of Tanks statistics site with live player lookups, tank rankings, and a very long description that runs past the limit." />+ <div className="flex justify-between text-xs">+ <span className="text-red-400">Keep it under 120 characters</span>+ <span className="text-neutral-400 tabular-nums">142 / 120</span>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/TimelineSlider.tsx b/.design-sync/previews/TimelineSlider.tsxnew file mode 100644index 000000000..1a7b9b81b--- /dev/null+++ b/.design-sync/previews/TimelineSlider.tsx@@ -0,0 +1,62 @@+import * as React from "react";+import { Button, TimelineSlider } from "@rybbit/ui";+import { Pause, Play, SkipBack, SkipForward } from "lucide-react";++const DURATION = 180_000; // 3:00++function fmt(ms: number) {+ const t = Math.floor(ms / 1000);+ return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;+}++/** Canonical: the replay transport bar. The slider is the thin 2px rail between the elapsed and total time. */+export function Playback() {+ const position = 42_000;+ return (+ <div className="p-4 w-full max-w-xl">+ <div className="flex items-center gap-3 rounded-lg border border-neutral-800 bg-neutral-900 px-4 py-3">+ <Button size="smIcon" variant="ghost" aria-label="Back 10s"><SkipBack /></Button>+ <Button size="smIcon" variant="ghost" aria-label="Pause"><Pause /></Button>+ <Button size="smIcon" variant="ghost" aria-label="Forward 10s"><SkipForward /></Button>+ <span className="text-xs tabular-nums text-neutral-400">{fmt(position)}</span>+ <TimelineSlider className="flex-1" max={DURATION} step={100} value={[position]} />+ <span className="text-xs tabular-nums text-neutral-400">{fmt(DURATION)}</span>+ <span className="text-xs text-neutral-400">1×</span>+ </div>+ </div>+ );+}++/** The rail at 0%, 50% and 100%: the emerald range fills up to the thumb. */+export function Positions() {+ const rows = [+ { label: "Not started", value: 0 },+ { label: "Halfway", value: DURATION / 2 },+ { label: "Finished", value: DURATION },+ ];+ return (+ <div className="p-4 w-full max-w-xl flex flex-col gap-4">+ {rows.map((r) => (+ <div key={r.label} className="flex items-center gap-3">+ <span className="w-24 shrink-0 text-xs text-neutral-400">{r.label}</span>+ <TimelineSlider className="flex-1" max={DURATION} step={100} value={[r.value]} />+ <span className="w-10 shrink-0 text-right text-xs tabular-nums text-neutral-400">{fmt(r.value)}</span>+ </div>+ ))}+ </div>+ );+}++/** Disabled while the recording is still loading. Hover/drag scale effects can't be shown statically. */+export function Disabled() {+ return (+ <div className="p-4 w-full max-w-xl">+ <div className="flex items-center gap-3 rounded-lg border border-neutral-800 bg-neutral-900 px-4 py-3">+ <Button size="smIcon" variant="ghost" aria-label="Play" disabled><Play /></Button>+ <span className="text-xs tabular-nums text-neutral-400">0:00</span>+ <TimelineSlider className="flex-1" max={DURATION} step={100} value={[0]} disabled />+ <span className="text-xs tabular-nums text-neutral-400">Loading…</span>+ </div>+ </div>+ );+}diff --git a/.design-sync/previews/Toaster.tsx b/.design-sync/previews/Toaster.tsxnew file mode 100644index 000000000..3eae654fe--- /dev/null+++ b/.design-sync/previews/Toaster.tsx@@ -0,0 +1,52 @@+import * as React from "react";+import { Button, Toaster, toast } from "@rybbit/ui";++/** Fire once on mount (guards StrictMode double-invoke) so the toast is on screen at capture time. */+function useFireOnce(fire: () => void) {+ const fired = React.useRef(false);+ React.useEffect(() => {+ if (fired.current) return;+ fired.current = true;+ fire();+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);+}++/** A settings panel for context; the Toaster is mounted once, at the app root, and renders bottom-right. */+function Stage() {+ return (+ <div className="p-4">+ <div className="w-96 rounded-lg border border-neutral-800 bg-neutral-900 p-4">+ <div className="text-sm font-medium">Site settings</div>+ <div className="mt-1 text-sm text-neutral-400">tomato.gg · Pro plan · bot filtering on</div>+ <div className="mt-4 flex gap-2">+ <Button variant="outline" size="sm">Cancel</Button>+ <Button variant="accent" size="sm">Save changes</Button>+ </div>+ </div>+ <Toaster />+ </div>+ );+}++/** Canonical: `toast.success(message)` after a save. Emerald check, neutral-850 card, bottom-right. */+export function Success() {+ useFireOnce(() => toast.success("Settings saved for tomato.gg"));+ return <Stage />;+}++/** `toast.error(message)` for a failed request; the copy says what to do next. */+export function Failure() {+ useFireOnce(() => toast.error("Couldn't verify rybbit.com. Check the TXT record and try again."));+ return <Stage />;+}++/** Plain `toast(message)`, `toast.info(message)` and a success stacked newest-on-bottom. */+export function Stacked() {+ useFireOnce(() => {+ toast("CSV export started for the last 30 days");+ toast.info("2 sites have not sent an event this week");+ toast.success("Goal “Signup completed” created");+ });+ return <Stage />;+}diff --git a/.design-sync/previews/Tooltip.tsx b/.design-sync/previews/Tooltip.tsxnew file mode 100644index 000000000..257aa0f6f--- /dev/null+++ b/.design-sync/previews/Tooltip.tsx@@ -0,0 +1,65 @@+import * as React from "react";+import { Info, Settings } from "lucide-react";+import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@rybbit/ui";++/** Canonical: an icon button with a short label tooltip (side="top" is the default). Rendered open. */+export function IconLabel() {+ return (+ <div className="flex min-h-screen items-center justify-center p-4">+ <Tooltip open>+ <TooltipTrigger asChild>+ <Button variant="outline" size="icon" aria-label="Site settings">+ <Settings />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Site settings</TooltipContent>+ </Tooltip>+ </div>+ );+}++/** The four `side` placements, each open at once (top/bottom on one row, left/right on the next). */+export function Placements() {+ const Pair = ({ sides }: { sides: readonly ("top" | "right" | "bottom" | "left")[] }) => (+ <div className="flex items-center justify-center gap-10">+ {sides.map(side => (+ <Tooltip key={side} open>+ <TooltipTrigger asChild>+ <Button variant="outline" size="sm">+ {side}+ </Button>+ </TooltipTrigger>+ <TooltipContent side={side}>Tooltip on {side}</TooltipContent>+ </Tooltip>+ ))}+ </div>+ );+ return (+ <div className="flex min-h-screen flex-col items-center justify-center gap-10 p-4">+ <Pair sides={["top", "bottom"]} />+ <Pair sides={["left", "right"]} />+ </div>+ );+}++/** Multi-line explanatory content on an inline info icon (side="right", aligned to start). */+export function MetricExplainer() {+ return (+ <div className="flex min-h-screen items-center p-4 pl-8">+ <span className="flex items-center gap-1.5 text-sm text-neutral-400">+ Bounce rate+ <Tooltip open>+ <TooltipTrigger asChild>+ <button type="button" className="text-neutral-400" aria-label="What is bounce rate?">+ <Info className="h-3.5 w-3.5" />+ </button>+ </TooltipTrigger>+ <TooltipContent side="right" align="start" className="max-w-56">+ <p className="font-medium">Bounce rate</p>+ <p className="mt-1 text-neutral-400">Sessions with one pageview and no events. 42% this week, down 3 pts.</p>+ </TooltipContent>+ </Tooltip>+ </span>+ </div>+ );+}diff --git a/.gitignore b/.gitignoreindex 4af8aead9..b17c3bee3 100644--- a/.gitignore+++ b/.gitignore@@ -55,4 +55,12 @@ coverage/.github/-.impeccable/critique\ No newline at end of file+.impeccable/critique+# design-sync (claude.ai/design) machine state+.ds-sync/+ds-bundle/+.design-sync/.cache/+.design-sync/learnings/+.design-sync/node_modules+.design-sync/pkg/node_modules+.design-sync/pkg/dist/