Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: added drawer, sheet

dev_wandry1e453363b287
diff --git a/components/docs/examples/drawer-example.tsx b/components/docs/examples/drawer-example.tsx
new file mode 100644
index 00000000..59f9f863
--- /dev/null
+++ b/components/docs/examples/drawer-example.tsx
@@ -0,0 +1,49 @@
+"use client";
+
+import { Button } from "@/registry/remocn-ui/button";
+import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";
+import { Drawer } from "@/registry/remocn-ui/drawer";
+import { useDrawerTransition } from "@/registry/remocn-ui/drawer/use-drawer-transition";
+
+export const DrawerExampleScene = () => {
+ // The trigger Button: idle → hover → press, the press lands just before the
+ // drawer opens (the "click" that triggers it).
+ const trigger = useButtonTransition([
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]);
+ // The drawer slides up right after the press, then closes near the end.
+ const drawer = useDrawerTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return (
+ <>
+ <Button label="Edit profile" style={trigger} />
+ <Drawer style={drawer} />
+ </>
+ );
+};
+
+export const drawerExampleCode = `import { Drawer } from "@/components/remocn/drawer";
+import { useDrawerTransition } from "@/components/remocn/use-drawer-transition";
+import { Button } from "@/components/remocn/button";
+import { useButtonTransition } from "@/components/remocn/use-button-transition";
+
+export const Scene = () => {
+ const trigger = useButtonTransition([
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]);
+ const drawer = useDrawerTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+
+ return (
+ <>
+ <Button label="Edit profile" style={trigger} />
+ <Drawer style={drawer} />
+ </>
+ );
+};`;
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsx
index 97b578b1..32bbb841 100644
--- a/components/docs/examples/index.tsx
+++ b/components/docs/examples/index.tsx
@@ -9,6 +9,8 @@ import {
alertDialogExampleCode,
} from "./alert-dialog-example";
import { DialogExampleScene, dialogExampleCode } from "./dialog-example";
+import { SheetExampleScene, sheetExampleCode } from "./sheet-example";
+import { DrawerExampleScene, drawerExampleCode } from "./drawer-example";
import { ButtonExampleScene, buttonExampleCode } from "./button-example";
import {
CheckboxExampleScene,
@@ -68,6 +70,24 @@ export const examples: Record<string, ExampleEntry> = {
width: W,
height: H,
},
+ "sheet-example": {
+ Component: SheetExampleScene,
+ code: sheetExampleCode,
+ // Sheet closes at 92 + dur 12 = 104; a short settle then loop.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ },
+ "drawer-example": {
+ Component: DrawerExampleScene,
+ code: drawerExampleCode,
+ // Drawer closes at 92 + dur 12 = 104; a short settle then loop.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ },
"checkbox-example": {
Component: CheckboxExampleScene,
code: checkboxExampleCode,
diff --git a/components/docs/examples/sheet-example.tsx b/components/docs/examples/sheet-example.tsx
new file mode 100644
index 00000000..14ba84a1
--- /dev/null
+++ b/components/docs/examples/sheet-example.tsx
@@ -0,0 +1,49 @@
+"use client";
+
+import { Button } from "@/registry/remocn-ui/button";
+import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";
+import { Sheet } from "@/registry/remocn-ui/sheet";
+import { useSheetTransition } from "@/registry/remocn-ui/sheet/use-sheet-transition";
+
+export const SheetExampleScene = () => {
+ // The trigger Button: idle → hover → press, the press lands just before the
+ // sheet opens (the "click" that triggers it).
+ const trigger = useButtonTransition([
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]);
+ // The sheet slides in right after the press, then closes near the end.
+ const sheet = useSheetTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return (
+ <>
+ <Button label="Edit profile" style={trigger} />
+ <Sheet style={sheet} />
+ </>
+ );
+};
+
+export const sheetExampleCode = `import { Sheet } from "@/components/remocn/sheet";
+import { useSheetTransition } from "@/components/remocn/use-sheet-transition";
+import { Button } from "@/components/remocn/button";
+import { useButtonTransition } from "@/components/remocn/use-button-transition";
+
+export const Scene = () => {
+ const trigger = useButtonTransition([
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ]);
+ const sheet = useSheetTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+
+ return (
+ <>
+ <Button label="Edit profile" style={trigger} />
+ <Sheet style={sheet} />
+ </>
+ );
+};`;
diff --git a/content/docs/ui/components/drawer.mdx b/content/docs/ui/components/drawer.mdx
new file mode 100644
index 00000000..98989ddf
--- /dev/null
+++ b/content/docs/ui/components/drawer.mdx
@@ -0,0 +1,144 @@
+---
+title: Drawer
+description: A bottom panel whose opened/closed state is a pure function of the timeline
+---
+
+<ComponentPreview name="drawer" />
+
+A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: Drawer is a modal layer meant to compose over another scene, so it does not paint an opaque background. The panel is anchored to the bottom edge and slides up into view: it has rounded top corners, a drag-handle pill at the top, and no close (X) button — the handle stands in for the dismiss affordance.
+
+## Installation
+
+<InstallBlock name="drawer" />
+
+<Note>
+Installing `drawer` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. If you want to pair Drawer with the Button as its trigger in the canonical lifecycle example, install `button` separately.
+</Note>
+
+## States
+
+`DrawerState` is:
+
+```ts
+type DrawerState =
+ | "opened" // backdrop dims to 50% black, panel slides up from the bottom edge and fades in
+ | "closed" // panel hidden off-screen below the bottom edge, backdrop clear (overlay opacity 0, panel opacity 0)
+```
+
+`opened` reveals the backdrop dim (scales up to `MAX_OVERLAY_ALPHA = 0.5`) and slides the panel up from off-screen — its `panelTranslateY` animates from `DRAWER_HEIGHT` (= `320`, fully below the bottom edge) to `0` (resting) while fading in. `closed` hides the backdrop and parks the panel below the bottom edge.
+
+## Snap usage
+
+Pass `state` directly — the component snaps instantly to that visual. Useful for static previews or when you drive state from your own logic:
+
+```tsx
+import { Drawer } from "@/components/remocn/drawer";
+
+export const Scene = () => <Drawer state="opened" />;
+```
+
+To drive state from the timeline, use `useCurrentState`:
+
+```tsx
+import { useCurrentState } from "@/lib/remocn-ui";
+import { Drawer } from "@/components/remocn/drawer";
+
+export const Scene = () => {
+ const state = useCurrentState(
+ [
+ { at: 32, state: "opened" },
+ { at: 92, state: "closed" },
+ ],
+ "closed",
+ );
+
+ return <Drawer title="Edit profile" state={state} />;
+};
+```
+
+Each `at` is a **Sequence-local authored frame**. State persists between steps: `opened` at frame 32 keeps the drawer visible until `closed` fires at frame 92. See [Concepts](/docs/ui/concepts) for the full `useCurrentState` API.
+
+## Smooth transitions
+
+State changes via `state` snap with no cross-fade. For animated transitions, use `useDrawerTransition` from the copied `use-drawer-transition.ts` file. It reads the frame, interpolates between state presets, and returns a resolved `DrawerStyle` — pass it to the `style` prop:
+
+```tsx
+import { Drawer } from "@/components/remocn/drawer";
+import { useDrawerTransition } from "@/components/remocn/use-drawer-transition";
+
+export const Scene = () => {
+ const style = useDrawerTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return <Drawer title="Edit profile" style={style} />;
+};
+```
+
+The `duration` field on each step overrides the file's `DEFAULT_DURATION` (= `12`) for that specific transition. To globally tune timing and easing, edit `use-drawer-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).
+
+`style` takes precedence over `state` when both are provided.
+
+## Full lifecycle
+
+The live example composes **Button as the trigger**: a primary Button animates through `hover` → `press` states (the "click"), and the drawer slides up right after the press lands, then closes near the end. Copy the code to drop it into your own composition.
+
+<LiveExample name="drawer-example" />
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "state",
+ type: "\"opened\" | \"closed\"",
+ default: "\"closed\"",
+ description: "Current visual state (snap path). State changes snap — no automatic cross-fade.",
+ },
+ {
+ name: "style",
+ type: "DrawerStyle",
+ description: "Resolved animated visual (smooth path). Pass an interpolated DrawerStyle from useDrawerTransition. Takes precedence over state when provided.",
+ },
+ {
+ name: "title",
+ type: "string",
+ default: "\"Edit profile\"",
+ description: "Headline of the drawer panel.",
+ },
+ {
+ name: "description",
+ type: "string",
+ default: "\"Make changes to your profile here. Click save when you're done.\"",
+ description: "Body copy displayed under the title.",
+ },
+ {
+ name: "actionLabel",
+ type: "string",
+ default: "\"Save changes\"",
+ description: "Label of the confirming (primary) action button.",
+ },
+ {
+ name: "cancelLabel",
+ type: "string",
+ default: "\"Cancel\"",
+ description: "Label of the dismissing action button.",
+ },
+ {
+ name: "theme",
+ type: "Partial<RemocnTheme>",
+ description: "Per-component theme override. Merges with the active RemocnUIProvider theme and the mode defaults. Must be concrete oklch/hex/rgb values — not CSS custom properties.",
+ },
+ {
+ name: "mode",
+ type: "\"light\" | \"dark\"",
+ default: "\"light\"",
+ description: "Sets the base palette. Overrides the mode on RemocnUIProvider when both are present.",
+ },
+ {
+ name: "className",
+ type: "string",
+ description: "Optional className applied to the panel element.",
+ },
+ ]}
+/>
diff --git a/content/docs/ui/components/meta.json b/content/docs/ui/components/meta.json
index 4271a7d6..5d101c9c 100644
--- a/content/docs/ui/components/meta.json
+++ b/content/docs/ui/components/meta.json
@@ -1,5 +1,5 @@
{
"title": "Components",
"collapsible": false,
- "pages": ["accordion", "alert-dialog", "button", "checkbox", "dialog", "dropdown-menu", "input", "radio", "select", "spinner", "switch"]
+ "pages": ["accordion", "alert-dialog", "button", "checkbox", "dialog", "drawer", "sheet", "dropdown-menu", "input", "radio", "select", "spinner", "switch"]
}
diff --git a/content/docs/ui/components/sheet.mdx b/content/docs/ui/components/sheet.mdx
new file mode 100644
index 00000000..69288cd1
--- /dev/null
+++ b/content/docs/ui/components/sheet.mdx
@@ -0,0 +1,144 @@
+---
+title: Sheet
+description: A side panel whose opened/closed state is a pure function of the timeline
+---
+
+<ComponentPreview name="sheet" />
+
+A state atom whose appearance (closed, opened) is a pure function of the `state` prop. Pass a state directly or drive it from the Remotion timeline via `useCurrentState`. The component reads no frame — only the state value you give it. The wrapper is transparent by design: Sheet is a modal layer meant to compose over another scene, so it does not paint an opaque background. Unlike Dialog (a centered popup that zooms in), Sheet is a right-edge side panel: a full-height flush panel anchored to the right that slides in horizontally, with a close (X) button in its top-right corner.
+
+## Installation
+
+<InstallBlock name="sheet" />
+
+<Note>
+Installing `sheet` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies` (`["remocn-ui"]`). You do not need to install it separately. If you want to pair Sheet with the Button as its trigger in the canonical lifecycle example, install `button` separately.
+</Note>
+
+## States
+
+`SheetState` is:
+
+```ts
+type SheetState =
+ | "opened" // backdrop dims to 50% black, panel slides in from the right (translateX 400 → 0) and fades in
+ | "closed" // panel parked off-screen to the right, backdrop clear (overlay opacity 0, panel opacity 0, translateX 400)
+```
+
+`opened` reveals the backdrop dim (scales up to `MAX_OVERLAY_ALPHA = 0.5`) and slides the full-height panel in from the right edge — its `translateX` animates from `SHEET_WIDTH` (400 px, fully off-screen) to `0` (resting against the right edge) while it fades in. `closed` hides the backdrop and parks the panel off-screen.
+
+## Snap usage
+
+Pass `state` directly — the component snaps instantly to that visual. Useful for static previews or when you drive state from your own logic:
+
+```tsx
+import { Sheet } from "@/components/remocn/sheet";
+
+export const Scene = () => <Sheet state="opened" />;
+```
+
+To drive state from the timeline, use `useCurrentState`:
+
+```tsx
+import { useCurrentState } from "@/lib/remocn-ui";
+import { Sheet } from "@/components/remocn/sheet";
+
+export const Scene = () => {
+ const state = useCurrentState(
+ [
+ { at: 32, state: "opened" },
+ { at: 92, state: "closed" },
+ ],
+ "closed",
+ );
+
+ return <Sheet title="Edit profile" state={state} />;
+};
+```
+
+Each `at` is a **Sequence-local authored frame**. State persists between steps: `opened` at frame 32 keeps the sheet visible until `closed` fires at frame 92. See [Concepts](/docs/ui/concepts) for the full `useCurrentState` API.
+
+## Smooth transitions
+
+State changes via `state` snap with no cross-fade. For animated transitions, use `useSheetTransition` from the copied `use-sheet-transition.ts` file. It reads the frame, interpolates between state presets, and returns a resolved `SheetStyle` — pass it to the `style` prop:
+
+```tsx
+import { Sheet } from "@/components/remocn/sheet";
+import { useSheetTransition } from "@/components/remocn/use-sheet-transition";
+
+export const Scene = () => {
+ const style = useSheetTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return <Sheet title="Edit profile" style={style} />;
+};
+```
+
+The `duration` field on each step overrides the file's `DEFAULT_DURATION` (= `12`) for that specific transition. To globally tune timing and easing, edit `use-sheet-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).
+
+`style` takes precedence over `state` when both are provided.
+
+## Full lifecycle
+
+The live example composes **Button as the trigger**: a primary Button animates through `hover` → `press` states (the "click"), and the sheet slides in right after the press lands, then closes near the end. Copy the code to drop it into your own composition.
+
+<LiveExample name="sheet-example" />
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "state",
+ type: "\"opened\" | \"closed\"",
+ default: "\"closed\"",
+ description: "Current visual state (snap path). State changes snap — no automatic cross-fade.",
+ },
+ {
+ name: "style",
+ type: "SheetStyle",
+ description: "Resolved animated visual (smooth path). Pass an interpolated SheetStyle from useSheetTransition. Takes precedence over state when provided.",
+ },
+ {
+ name: "title",
+ type: "string",
+ default: "\"Edit profile\"",
+ description: "Headline of the sheet panel.",
+ },
+ {
+ name: "description",
+ type: "string",
+ default: "\"Make changes to your profile here. Click save when you're done.\"",
+ description: "Body copy displayed under the title.",
+ },
+ {
+ name: "actionLabel",
+ type: "string",
+ default: "\"Save changes\"",
+ description: "Label of the confirming (primary) action button.",
+ },
+ {
+ name: "cancelLabel",
+ type: "string",
+ default: "\"Cancel\"",
+ description: "Label of the dismissing action button.",
+ },
+ {
+ name: "theme",
+ type: "Partial<RemocnTheme>",
+ description: "Per-component theme override. Merges with the active RemocnUIProvider theme and the mode defaults. Must be concrete oklch/hex/rgb values — not CSS custom properties.",
+ },
+ {
+ name: "mode",
+ type: "\"light\" | \"dark\"",
+ default: "\"light\"",
+ description: "Sets the base palette. Overrides the mode on RemocnUIProvider when both are present.",
+ },
+ {
+ name: "className",
+ type: "string",
+ description: "Optional className applied to the panel element.",
+ },
+ ]}
+/>
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index fee20b8d..7cdea199 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -111,6 +111,10 @@ import { AlertDialog } from "@/registry/remocn-ui/alert-dialog";
import { alertDialogConfig } from "@/registry/remocn-ui/alert-dialog/config";
import { Dialog } from "@/registry/remocn-ui/dialog";
import { dialogConfig } from "@/registry/remocn-ui/dialog/config";
+import { Drawer } from "@/registry/remocn-ui/drawer";
+import { drawerConfig } from "@/registry/remocn-ui/drawer/config";
+import { Sheet } from "@/registry/remocn-ui/sheet";
+import { sheetConfig } from "@/registry/remocn-ui/sheet/config";
import { Button } from "@/registry/remocn-ui/button";
import { buttonConfig } from "@/registry/remocn-ui/button/config";
import { Checkbox } from "@/registry/remocn-ui/checkbox";
@@ -308,6 +312,8 @@ const registry: Record<string, RegistryEntry> = {
"accordion": { Component: Accordion, config: accordionConfig },
"alert-dialog": { Component: AlertDialog, config: alertDialogConfig },
"dialog": { Component: Dialog, config: dialogConfig },
+ "sheet": { Component: Sheet, config: sheetConfig },
+ "drawer": { Component: Drawer, config: drawerConfig },
"checkbox": { Component: Checkbox, config: checkboxConfig },
"input": { Component: Input, config: inputConfig },
"radio": { Component: Radio, config: radioConfig },
diff --git a/registry/remocn-ui/drawer/__tests__/README.md b/registry/remocn-ui/drawer/__tests__/README.md
new file mode 100644
index 00000000..96b9647f
--- /dev/null
+++ b/registry/remocn-ui/drawer/__tests__/README.md
@@ -0,0 +1,130 @@
+# `drawer` — verification tests
+
+Pure / deterministic verification for the `drawer` component
+(`registry/remocn-ui/drawer/`). The RENDER path needs `useRemocnTheme()`
+and the Remotion render tree and cannot run headless, so the render is NOT
+exercised here. This suite covers the pieces that ARE pure: `DrawerState`
+union membership, `drawerConfig.controls` wiring, `drawerConfig.snippet`
+codegen, `drawerStyle` presets, `tweenDrawerStyle` interpolation, and
+`DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+Drawer ships two complementary paths:
+
+**Snap path** (`state?: DrawerState` prop):
+`Drawer` is a frame-free pure renderer. The `state` prop drives all visuals.
+Each state maps to a complete resting visual via the exported pure function
+`drawerStyle(state, ctx) => DrawerStyle`. State changes snap instantly —
+no tweening inside the component.
+
+**Smooth path** (`style?: DrawerStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`DrawerStyle` to the `style` prop. The caller — typically
+`useDrawerTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenDrawerStyle(from, to, t)`. The `Drawer` component itself remains
+frame-free; it simply renders whatever `DrawerStyle` it receives.
+
+This design keeps `Drawer` pure-testable (no Remotion render context needed)
+while still supporting smooth open/close transitions for production use.
+
+## How to run
+
+> **The user (not the agent) runs verification.** Do not run this command
+> automatically — always wait for the user to run it.
+
+The repo uses **Bun**, which has a built-in test runner — runs TypeScript
+natively, no test-framework dep.
+
+```bash
+bun install
+bun test registry/remocn-ui/drawer/__tests__
+```
+
+`drawer.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test
+script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`DrawerState` union** — asserts the two states `["opened", "closed"]`
+ are the complete set (via the real `controls.state.options` list from
+ `config.ts`).
+- **`drawerConfig.controls.state`** — the customizer control wiring. Asserts
+ a `select` control exists with exactly those two options in order, default
+ `"opened"` (so the preview showcases the panel), and that every option is a
+ member of the `DrawerState` union.
+- **`drawerConfig.snippet`** — REAL pure string builder (high value).
+ Asserts: always emits `state="<state>"` for every option; NEVER emits `steps`;
+ includes `import { Drawer }` from `@/components/remocn/drawer`;
+ omits default-equal props (`title="Edit profile"`, the default description
+ `"Make changes to your profile here. Click save when you're done."`,
+ `actionLabel="Save changes"`, `cancelLabel="Cancel"`, `mode="light"`); EMITS
+ non-default `title`/`description`/`actionLabel`/`cancelLabel`/`mode`;
+ structural round-trip (starts with import, contains `<Drawer`, ends `/>`).
+ Note: `action=` is not checked for absence because `actionLabel=` is a
+ legitimate emitted prop — only `steps` is asserted absent.
+- **`drawerStyleContext`** — exported pure `(theme) => DrawerStyleContext`
+ (takes only `theme`, no variant — unlike accordion). Built from
+ `drawerStyleContext(defaultLightTheme)`. Asserts each field
+ (`popoverBg`, `popoverFg`, `mutedFg`, `border`, `actionBg`, `actionFg`,
+ `cancelFg`) is a non-empty string, and `radius` is a number.
+- **`drawerStyle` presets** — exported pure `(state, ctx) => DrawerStyle`.
+ All three fields (`overlayOpacity`, `panelOpacity`, `panelTranslateY`) are
+ numeric. Asserts per-state invariants: closed → `{ 0, 0, 320 }`
+ (panel off-screen below the bottom edge); opened → `{ 1, 1, 0 }`
+ (panel slid up to its resting position).
+- **`tweenDrawerStyle`** — exported pure `(a, b, t) => DrawerStyle`.
+ All three fields are pure numeric lerps (no color fields). Asserts: at t=0 all
+ fields equal `a`; at t=1 all equal `b`; at t=0.5 each field is the exact
+ midpoint (`overlayOpacity` 0.5, `panelOpacity` 0.5, `panelTranslateY` 160).
+ Both directions (closed→opened and opened→closed) are verified.
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to 12.
+
+**Drawer render** is a pure `(style | state) => visual` observable only via
+Remotion render, not unit-tested here.
+
+## Import strategy
+
+`drawer.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `DrawerState`, `drawerStyle`,
+ `drawerStyleContext`
+- `../use-drawer-transition` — relative, for `tweenDrawerStyle`,
+ `DEFAULT_DURATION`
+- `../config` — relative, for `drawerConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-drawer-transition.ts` pulls the `remotion`
+module (and React), but neither `drawerStyle`, `drawerStyleContext`,
+nor `tweenDrawerStyle` call `useCurrentFrame()` at import time or at call
+time — they are pure value functions. `bun test` resolves tsconfig `paths`, so
+the alias works without additional config.
+
+## Determinism grep checklist (run manually; must print NOTHING)
+
+Drawer is a state atom and must be frame-free. The component's `index.tsx`
+must contain **none** of the following:
+
+```bash
+grep -nE "useState|useEffect|useCurrentFrame|onClick|onChange|addEventListener|Date\.now|Math\.random|requestAnimationFrame" \
+ registry/remocn-ui/drawer/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-drawer-transition.ts` is the CALLER hook that intentionally reads
+`useCurrentFrame()` (via `useStateTransition`). It is not a render component;
+the smooth-path design isolates all frame-reading to the hook, keeping
+`Drawer` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/drawer/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/drawer/__tests__/drawer.test.ts b/registry/remocn-ui/drawer/__tests__/drawer.test.ts
new file mode 100644
index 00000000..551a67ee
--- /dev/null
+++ b/registry/remocn-ui/drawer/__tests__/drawer.test.ts
@@ -0,0 +1,448 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `drawer`.
+ *
+ * Scope:
+ * - registry/remocn-ui/drawer/index.tsx — DrawerState union membership,
+ * drawerStyle presets, drawerStyleContext
+ * - registry/remocn-ui/drawer/config.ts — drawerConfig.controls wiring
+ * + drawerConfig.snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/drawer/use-drawer-transition.ts
+ * — tweenDrawerStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<Drawer>` reads `useRemocnTheme()` internally — that hook is pure at
+ * call-time in test context, but the JSX render tree is not exercised here.
+ * The pure-testable surface is: the style presets + tween + customizer wiring
+ * + snippet codegen.
+ *
+ * Runner: Bun's built-in test runner (TypeScript-native, no framework dep).
+ * bun test registry/remocn-ui/drawer/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `DrawerState` from `@/registry/remocn-ui/drawer`
+ * and the pieces under test never CALL a Remotion runtime API at import time —
+ * `drawerConfig` is a plain object; `.snippet` is a pure string builder;
+ * `drawerStyle` and `tweenDrawerStyle` are pure value functions.
+ * We import via RELATIVE paths (matching the existing test suite pattern),
+ * annotating each import with the source it corresponds to.
+ * --------------------------------------------------------------------------
+ */
+
+import { describe, expect, it } from "bun:test";
+import {
+ type DrawerState,
+ drawerStyle,
+ drawerStyleContext,
+} from "../index";
+import { tweenDrawerStyle, DEFAULT_DURATION } from "../use-drawer-transition";
+import { drawerConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The DrawerState union, enumerated as a runtime list for membership checks.
+ * Must stay in sync with `export type DrawerState` in index.tsx.
+ */
+const VALID_STATES: readonly DrawerState[] = ["opened", "closed"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ title?: string;
+ description?: string;
+ actionLabel?: string;
+ cancelLabel?: string;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ drawerConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared DrawerStyleContext built from the default light theme.
+ * `drawerStyleContext` takes only `(theme)` — no variant arg, unlike accordion.
+ */
+const ctx = drawerStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. DrawerState union membership
+// ===========================================================================
+
+describe("DrawerState union", () => {
+ it("contains exactly the two documented states", () => {
+ // We can't enumerate a TS type at runtime, but we can assert the REAL
+ // controls.state options match and that all known states are members.
+ const control = drawerConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["opened", "closed"]);
+ });
+
+ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {
+ // Belt-and-suspenders: the fixture array must have exactly 2 entries and
+ // match the options list from the real config.
+ const control = drawerConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(VALID_STATES).toHaveLength(2);
+ for (const s of VALID_STATES) {
+ expect(control.options).toContain(s);
+ }
+ });
+});
+
+// ===========================================================================
+// 2. drawerConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("drawerConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(drawerConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the two DrawerState options in order", () => {
+ const control = drawerConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["opened", "closed"]);
+ });
+
+ it("defaults to 'opened' so the preview showcases the panel", () => {
+ const control = drawerConfig.controls.state;
+ expect(control.default).toBe("opened");
+ });
+
+ it("every option is a member of the DrawerState union", () => {
+ const control = drawerConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ for (const option of control.options) {
+ expect(VALID_STATES).toContain(option as DrawerState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. drawerConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// It NEVER emits `steps`.
+// Note on `action`: the snippet emits `actionLabel=` (a legitimate prop) but
+// must never emit a bare `action=` attribute. We assert `steps` is absent and
+// add a targeted check that `action=` only ever appears as `actionLabel=`.
+// ===========================================================================
+
+describe("drawerConfig.snippet: state prop emission", () => {
+ it("emits state=\"opened\" for the opened option", () => {
+ expect(snippet({ state: "opened" })).toContain('state="opened"');
+ });
+
+ it("emits state=\"closed\" for the closed option", () => {
+ expect(snippet({ state: "closed" })).toContain('state="closed"');
+ });
+
+ it("emits the correct state for every control option", () => {
+ const control = drawerConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ for (const state of control.options) {
+ const out = snippet({ state });
+ expect(out).toContain(`state="${state}"`);
+ }
+ });
+});
+
+describe("drawerConfig.snippet: NEVER emits steps", () => {
+ // `action=` is intentionally NOT checked here because `actionLabel=` is a
+ // legitimate emitted prop and would cause a false positive on a naive
+ // `.toContain("action")` check. Assert `steps` absence only.
+ it("never emits `steps` in any state", () => {
+ for (const state of VALID_STATES) {
+ expect(snippet({ state })).not.toContain("steps");
+ }
+ });
+});
+
+describe("drawerConfig.snippet: import line", () => {
+ it("includes `import { Drawer }` from the correct path", () => {
+ const out = snippet({ state: "opened" });
+ expect(out).toContain('import { Drawer }');
+ expect(out).toContain('from "@/components/remocn/drawer"');
+ });
+});
+
+describe("drawerConfig.snippet: default props are omitted", () => {
+ // Defaults: title="Edit profile",
+ // description="Make changes to your profile here. Click save when you're done.",
+ // actionLabel="Save changes", cancelLabel="Cancel", mode="light"
+ const allDefaults = snippet({
+ state: "opened",
+ title: "Edit profile",
+ description: "Make changes to your profile here. Click save when you're done.",
+ actionLabel: "Save changes",
+ cancelLabel: "Cancel",
+ mode: "light",
+ });
+
+ it("omits title when it equals the default 'Edit profile'", () => {
+ expect(allDefaults).not.toContain("title=");
+ });
+
+ it("omits description when it equals the default text", () => {
+ expect(allDefaults).not.toContain("description=");
+ });
+
+ it("omits actionLabel when it equals the default 'Save changes'", () => {
+ expect(allDefaults).not.toContain("actionLabel=");
+ });
+
+ it("omits cancelLabel when it equals the default 'Cancel'", () => {
+ expect(allDefaults).not.toContain("cancelLabel=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("drawerConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default title", () => {
+ expect(snippet({ state: "opened", title: "Edit workspace settings" }))
+ .toContain('title="Edit workspace settings"');
+ });
+
+ it("emits a non-default description", () => {
+ expect(snippet({ state: "opened", description: "Update your workspace name and settings." }))
+ .toContain('description="Update your workspace name and settings."');
+ });
+
+ it("emits a non-default actionLabel", () => {
+ expect(snippet({ state: "opened", actionLabel: "Confirm" }))
+ .toContain('actionLabel="Confirm"');
+ });
+
+ it("emits a non-default cancelLabel", () => {
+ expect(snippet({ state: "opened", cancelLabel: "Go back" }))
+ .toContain('cancelLabel="Go back"');
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "opened", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("drawerConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "opened" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { Drawer }')).toBe(true);
+ });
+
+ it("contains a <Drawer JSX opening", () => {
+ expect(out).toContain("<Drawer");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. drawerStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument (unlike accordion).
+// Build ctx from the default light theme and assert each field is populated.
+// `radius` is a number (px); all other fields are non-empty strings.
+// ===========================================================================
+
+describe("drawerStyleContext: field types from defaultLightTheme", () => {
+ it("popoverBg is a non-empty string", () => {
+ expect(typeof ctx.popoverBg).toBe("string");
+ expect(ctx.popoverBg.length).toBeGreaterThan(0);
+ });
+
+ it("popoverFg is a non-empty string", () => {
+ expect(typeof ctx.popoverFg).toBe("string");
+ expect(ctx.popoverFg.length).toBeGreaterThan(0);
+ });
+
+ it("mutedFg is a non-empty string", () => {
+ expect(typeof ctx.mutedFg).toBe("string");
+ expect(ctx.mutedFg.length).toBeGreaterThan(0);
+ });
+
+ it("border is a non-empty string", () => {
+ expect(typeof ctx.border).toBe("string");
+ expect(ctx.border.length).toBeGreaterThan(0);
+ });
+
+ it("radius is a number", () => {
+ expect(typeof ctx.radius).toBe("number");
+ });
+
+ it("actionBg is a non-empty string", () => {
+ expect(typeof ctx.actionBg).toBe("string");
+ expect(ctx.actionBg.length).toBeGreaterThan(0);
+ });
+
+ it("actionFg is a non-empty string", () => {
+ expect(typeof ctx.actionFg).toBe("string");
+ expect(ctx.actionFg.length).toBeGreaterThan(0);
+ });
+
+ it("cancelFg is a non-empty string", () => {
+ expect(typeof ctx.cancelFg).toBe("string");
+ expect(ctx.cancelFg.length).toBeGreaterThan(0);
+ });
+});
+
+// ===========================================================================
+// 5. drawerStyle presets — pure (state, ctx) => DrawerStyle
+// drawerStyleContext and drawerStyle are exported and frame-free.
+// Build one ctx from the default light theme, then assert the numeric
+// invariants for every state.
+// ===========================================================================
+
+describe("drawerStyle: closed state", () => {
+ const s = drawerStyle("closed", ctx);
+
+ it("overlayOpacity is 0 (overlay fully hidden)", () => {
+ expect(s.overlayOpacity).toBe(0);
+ });
+
+ it("panelOpacity is 0 (panel fully hidden)", () => {
+ expect(s.panelOpacity).toBe(0);
+ });
+
+ it("panelTranslateY is 320 (panel off-screen below the bottom edge)", () => {
+ expect(s.panelTranslateY).toBe(320);
+ });
+});
+
+describe("drawerStyle: opened state", () => {
+ const s = drawerStyle("opened", ctx);
+
+ it("overlayOpacity is 1 (overlay fully revealed)", () => {
+ expect(s.overlayOpacity).toBe(1);
+ });
+
+ it("panelOpacity is 1 (panel fully visible)", () => {
+ expect(s.panelOpacity).toBe(1);
+ });
+
+ it("panelTranslateY is 0 (panel at its resting position)", () => {
+ expect(s.panelTranslateY).toBe(0);
+ });
+});
+
+describe("drawerStyle: closed/opened invariant", () => {
+ it("closed: overlayOpacity 0, panelOpacity 0, panelTranslateY 320", () => {
+ const s = drawerStyle("closed", ctx);
+ expect(s.overlayOpacity).toBe(0);
+ expect(s.panelOpacity).toBe(0);
+ expect(s.panelTranslateY).toBe(320);
+ });
+
+ it("opened: overlayOpacity 1, panelOpacity 1, panelTranslateY 0", () => {
+ const s = drawerStyle("opened", ctx);
+ expect(s.overlayOpacity).toBe(1);
+ expect(s.panelOpacity).toBe(1);
+ expect(s.panelTranslateY).toBe(0);
+ });
+});
+
+// ===========================================================================
+// 6. tweenDrawerStyle — pure linear interpolation between two DrawerStyles.
+// All three fields are pure numeric lerps (no color fields, unlike accordion).
+// Concrete expectations: closed → opened for midpoint math.
+// ===========================================================================
+
+describe("tweenDrawerStyle: t=0 returns values equal to `a`", () => {
+ const a = drawerStyle("closed", ctx);
+ const b = drawerStyle("opened", ctx);
+ const r = tweenDrawerStyle(a, b, 0);
+
+ it("overlayOpacity equals a.overlayOpacity at t=0", () => {
+ expect(r.overlayOpacity).toBeCloseTo(a.overlayOpacity, 10);
+ });
+
+ it("panelOpacity equals a.panelOpacity at t=0", () => {
+ expect(r.panelOpacity).toBeCloseTo(a.panelOpacity, 10);
+ });
+
+ it("panelTranslateY equals a.panelTranslateY at t=0", () => {
+ expect(r.panelTranslateY).toBeCloseTo(a.panelTranslateY, 10);
+ });
+});
+
+describe("tweenDrawerStyle: t=1 returns values equal to `b`", () => {
+ const a = drawerStyle("closed", ctx);
+ const b = drawerStyle("opened", ctx);
+ const r = tweenDrawerStyle(a, b, 1);
+
+ it("overlayOpacity equals b.overlayOpacity at t=1", () => {
+ expect(r.overlayOpacity).toBeCloseTo(b.overlayOpacity, 10);
+ });
+
+ it("panelOpacity equals b.panelOpacity at t=1", () => {
+ expect(r.panelOpacity).toBeCloseTo(b.panelOpacity, 10);
+ });
+
+ it("panelTranslateY equals b.panelTranslateY at t=1", () => {
+ expect(r.panelTranslateY).toBeCloseTo(b.panelTranslateY, 10);
+ });
+});
+
+describe("tweenDrawerStyle: t=0.5 midpoint numeric lerp (closed → opened)", () => {
+ // closed: overlayOpacity=0, panelOpacity=0, panelTranslateY=320
+ // opened: overlayOpacity=1, panelOpacity=1, panelTranslateY=0
+ const a = drawerStyle("closed", ctx);
+ const b = drawerStyle("opened", ctx);
+ const r = tweenDrawerStyle(a, b, 0.5);
+
+ it("overlayOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.overlayOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelTranslateY midpoint: 320 → 0 gives 160", () => {
+ expect(r.panelTranslateY).toBeCloseTo(160, 10);
+ });
+});
+
+describe("tweenDrawerStyle: t=0.5 midpoint numeric lerp (opened → closed)", () => {
+ // opened: overlayOpacity=1, panelOpacity=1, panelTranslateY=0
+ // closed: overlayOpacity=0, panelOpacity=0, panelTranslateY=320
+ const a = drawerStyle("opened", ctx);
+ const b = drawerStyle("closed", ctx);
+ const r = tweenDrawerStyle(a, b, 0.5);
+
+ it("overlayOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.overlayOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelTranslateY midpoint: 0 → 320 gives 160", () => {
+ expect(r.panelTranslateY).toBeCloseTo(160, 10);
+ });
+});
+
+// ===========================================================================
+// 7. DEFAULT_DURATION — sanity check the exported constant
+// ===========================================================================
+
+describe("DEFAULT_DURATION", () => {
+ it("is a positive number", () => {
+ expect(typeof DEFAULT_DURATION).toBe("number");
+ expect(DEFAULT_DURATION).toBeGreaterThan(0);
+ });
+
+ it("equals 12 (the authored value)", () => {
+ expect(DEFAULT_DURATION).toBe(12);
+ });
+});
diff --git a/registry/remocn-ui/drawer/config.ts b/registry/remocn-ui/drawer/config.ts
new file mode 100644
index 00000000..7d4dd55e
--- /dev/null
+++ b/registry/remocn-ui/drawer/config.ts
@@ -0,0 +1,67 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { DrawerState } from "@/registry/remocn-ui/drawer";
+
+const DEFAULT_DESCRIPTION =
+ "Make changes to your profile here. Click save when you're done.";
+
+export const drawerConfig: ComponentConfig = {
+ componentName: "Drawer",
+ importPath: "@/components/remocn/drawer",
+ controls: {
+ title: { type: "text", default: "Edit profile", label: "Title" },
+ description: {
+ type: "text",
+ default: DEFAULT_DESCRIPTION,
+ label: "Description",
+ },
+ actionLabel: {
+ type: "text",
+ default: "Save changes",
+ label: "Action Label",
+ },
+ cancelLabel: { type: "text", default: "Cancel", label: "Cancel Label" },
+ state: {
+ type: "select",
+ // Default to `opened` so the preview shows the panel.
+ default: "opened",
+ options: ["opened", "closed"],
+ label: "State",
+ },
+ mode: {
+ type: "select",
+ default: "light",
+ options: ["light", "dark"],
+ label: "Mode",
+ },
+ },
+ durationInFrames: 120,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ snippet: (values) => {
+ const state = (values.state as DrawerState) ?? "opened";
+ const title = values.title as string | undefined;
+ const description = values.description as string | undefined;
+ const actionLabel = values.actionLabel as string | undefined;
+ const cancelLabel = values.cancelLabel as string | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (title !== undefined && title !== "Edit profile")
+ props.push(` title="${title}"`);
+ if (description !== undefined && description !== DEFAULT_DESCRIPTION)
+ props.push(` description="${description}"`);
+ if (actionLabel !== undefined && actionLabel !== "Save changes")
+ props.push(` actionLabel="${actionLabel}"`);
+ if (cancelLabel !== undefined && cancelLabel !== "Cancel")
+ props.push(` cancelLabel="${cancelLabel}"`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { Drawer } from "@/components/remocn/drawer";
+
+<Drawer
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/drawer/index.tsx b/registry/remocn-ui/drawer/index.tsx
new file mode 100644
index 00000000..7b1e57f1
--- /dev/null
+++ b/registry/remocn-ui/drawer/index.tsx
@@ -0,0 +1,249 @@
+"use client";
+
+import { type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+
+export type DrawerState = "opened" | "closed";
+
+export interface DrawerProps {
+ /** Current visual state (snap path). State changes snap (no enter-tweens). */
+ state?: DrawerState;
+ /**
+ * Resolved animated visual (smooth path). When provided, takes precedence over
+ * `state` — feed it an interpolated `DrawerStyle` from `useDrawerTransition`.
+ */
+ style?: DrawerStyle;
+ /** Headline of the drawer. */
+ title?: string;
+ /** Body copy under the title. */
+ description?: string;
+ /** Label of the confirming (primary) action. */
+ actionLabel?: string;
+ /** Label of the dismissing action. */
+ cancelLabel?: string;
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ className?: string;
+}
+
+/** Drawer panel height (px) — also the off-screen-bottom translate distance. */
+const DRAWER_HEIGHT = 320;
+/** Backdrop dim at full reveal — the overlay opacity scales up to this alpha. */
+const MAX_OVERLAY_ALPHA = 0.5;
+
+// ===========================================================================
+// Drawer visual — the COMPLETE animated look for a moment in time. A `state` is
+// a named preset of this visual (`drawerStyle`); the smooth path feeds an
+// interpolated `DrawerStyle` straight through. The component is a pure renderer
+// of whichever `DrawerStyle` it receives.
+// ===========================================================================
+
+export interface DrawerStyle {
+ /** Backdrop dim reveal 0→1 (scales `MAX_OVERLAY_ALPHA`). */
+ overlayOpacity: number;
+ /** Panel fade 0→1. */
+ panelOpacity: number;
+ /** Panel slide (px): `DRAWER_HEIGHT` = off-screen bottom → 0 = resting. */
+ panelTranslateY: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface DrawerStyleContext {
+ popoverBg: string;
+ popoverFg: string;
+ mutedFg: string;
+ border: string;
+ radius: number;
+ actionBg: string;
+ actionFg: string;
+ cancelFg: string;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `drawerStyle(state, ctx)` preset.
+ */
+export function drawerStyleContext(theme: RemocnTheme): DrawerStyleContext {
+ return {
+ popoverBg: theme.popover,
+ popoverFg: theme.popoverForeground,
+ mutedFg: theme.mutedForeground,
+ border: theme.border,
+ radius: theme.radius,
+ // The action is the PRIMARY (affirmative) action — not destructive.
+ actionBg: theme.primary,
+ actionFg: theme.primaryForeground,
+ cancelFg: theme.foreground,
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => DrawerStyle`
+ * map. To change how a state looks, edit one entry.
+ */
+export function drawerStyle(
+ state: DrawerState,
+ _ctx: DrawerStyleContext,
+): DrawerStyle {
+ switch (state) {
+ case "opened":
+ return {
+ overlayOpacity: 1,
+ panelOpacity: 1,
+ panelTranslateY: 0,
+ };
+ default:
+ return {
+ overlayOpacity: 0,
+ panelOpacity: 0,
+ panelTranslateY: DRAWER_HEIGHT,
+ };
+ }
+}
+
+export function Drawer({
+ state = "closed",
+ style,
+ title = "Edit profile",
+ description = "Make changes to your profile here. Click save when you're done.",
+ actionLabel = "Save changes",
+ cancelLabel = "Cancel",
+ theme: themeOverride,
+ mode,
+ className,
+}: DrawerProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+
+ const ctx = drawerStyleContext(theme);
+ const v = style ?? drawerStyle(state, ctx);
+
+ // Shared base for the two footer buttons. These are plain inline `<button>`s,
+ // not the remocn `Button` component — that renders a full-frame scene wrapper
+ // (absolute inset) and so can't nest inline here; the sizing mirrors its
+ // `default` size.
+ const buttonBase: React.CSSProperties = {
+ height: 40,
+ padding: "0 20px",
+ fontSize: 15,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ borderRadius: ctx.radius,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ cursor: "pointer",
+ };
+
+ return (
+ // The wrapper is TRANSPARENT — unlike button/accordion (which paint an
+ // opaque `theme.background`), this atom is a modal layer meant to compose
+ // OVER another scene, so it must not blanket the frame with a background.
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ {/* Backdrop dim — fades in as the drawer opens. */}
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: `rgba(0, 0, 0, ${MAX_OVERLAY_ALPHA * v.overlayOpacity})`,
+ }}
+ />
+ {/* The panel — anchored to the bottom edge, full width, slides up. */}
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ left: 0,
+ right: 0,
+ bottom: 0,
+ height: DRAWER_HEIGHT,
+ transform: `translateY(${v.panelTranslateY}px)`,
+ opacity: v.panelOpacity,
+ background: ctx.popoverBg,
+ color: ctx.popoverFg,
+ borderTop: `1px solid ${ctx.border}`,
+ borderTopLeftRadius: ctx.radius + 6,
+ borderTopRightRadius: ctx.radius + 6,
+ padding: 24,
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ gap: 8,
+ boxShadow: "0 -24px 48px -12px rgba(0,0,0,0.25)",
+ }}
+ >
+ {/* Drag-handle pill — static chrome at the top, not animated. */}
+ <div
+ style={{
+ width: 40,
+ height: 5,
+ borderRadius: 999,
+ background: ctx.border,
+ marginBottom: 8,
+ }}
+ />
+ {/* Centered content column with a max width. */}
+ <div
+ style={{
+ width: "100%",
+ maxWidth: 440,
+ display: "flex",
+ flexDirection: "column",
+ gap: 8,
+ }}
+ >
+ <div
+ style={{
+ fontSize: 18,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ }}
+ >
+ {title}
+ </div>
+ <div style={{ fontSize: 14, lineHeight: 1.5, color: ctx.mutedFg }}>
+ {description}
+ </div>
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "flex-end",
+ gap: 8,
+ marginTop: 16,
+ }}
+ >
+ {/* Cancel — outline variant. */}
+ <button
+ type="button"
+ style={{
+ ...buttonBase,
+ background: "transparent",
+ color: ctx.cancelFg,
+ border: `1px solid ${ctx.border}`,
+ }}
+ >
+ {cancelLabel}
+ </button>
+ {/* Action — primary variant. */}
+ <button
+ type="button"
+ style={{
+ ...buttonBase,
+ background: ctx.actionBg,
+ color: ctx.actionFg,
+ border: "1px solid transparent",
+ }}
+ >
+ {actionLabel}
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/drawer/use-drawer-transition.ts b/registry/remocn-ui/drawer/use-drawer-transition.ts
new file mode 100644
index 00000000..f14f96c9
--- /dev/null
+++ b/registry/remocn-ui/drawer/use-drawer-transition.ts
@@ -0,0 +1,67 @@
+"use client";
+
+import {
+ easings,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ drawerStyle,
+ drawerStyleContext,
+ type DrawerState,
+ type DrawerStyle,
+} from "@/components/remocn/drawer";
+// ^ install path; resolves in-repo via the @/components/remocn/* tsconfig alias.
+
+/** Default transition length (frames) when a step omits `duration`. Tune to taste. */
+export const DEFAULT_DURATION = 12;
+
+/** Blend two drawer visuals: all three fields are pure numeric lerps. */
+export function tweenDrawerStyle(
+ a: DrawerStyle,
+ b: DrawerStyle,
+ t: number,
+): DrawerStyle {
+ return {
+ overlayOpacity: a.overlayOpacity + (b.overlayOpacity - a.overlayOpacity) * t,
+ panelOpacity: a.panelOpacity + (b.panelOpacity - a.panelOpacity) * t,
+ panelTranslateY:
+ a.panelTranslateY + (b.panelTranslateY - a.panelTranslateY) * t,
+ };
+}
+
+export interface DrawerTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) DrawerStyle. The CALLER invokes this;
+ * it reads the frame, the `<Drawer>` component does not. Feed the result to
+ * `<Drawer style={...} />` for smooth open/close transitions.
+ */
+export function useDrawerTransition(
+ steps: Step<DrawerState>[],
+ opts: DrawerTransitionOptions = {},
+): DrawerStyle {
+ const {
+ theme: themeOverride,
+ mode,
+ speed = 1,
+ defaultDuration = DEFAULT_DURATION,
+ } = opts;
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = drawerStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "closed",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenDrawerStyle(drawerStyle(from, ctx), drawerStyle(to, ctx), t);
+}
diff --git a/registry/remocn-ui/registry.json b/registry/remocn-ui/registry.json
index ed539828..92f09fbf 100644
--- a/registry/remocn-ui/registry.json
+++ b/registry/remocn-ui/registry.json
@@ -137,6 +137,46 @@
}
]
},
+ {
+ "name": "sheet",
+ "type": "registry:component",
+ "title": "UI Sheet",
+ "description": "A side panel whose opened/closed state is a pure function of the timeline; the backdrop dim and right-edge slide-in are keyframed presets, with a close button and a primary action. Self-contained — pair it with the Button as a trigger (see the example).",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui"],
+ "files": [
+ {
+ "path": "sheet/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/sheet.tsx"
+ },
+ {
+ "path": "sheet/use-sheet-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-sheet-transition.ts"
+ }
+ ]
+ },
+ {
+ "name": "drawer",
+ "type": "registry:component",
+ "title": "UI Drawer",
+ "description": "A bottom panel whose opened/closed state is a pure function of the timeline; the backdrop dim and bottom-edge slide-up are keyframed presets, with a drag handle and a primary action. Self-contained — pair it with the Button as a trigger (see the example).",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui"],
+ "files": [
+ {
+ "path": "drawer/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/drawer.tsx"
+ },
+ {
+ "path": "drawer/use-drawer-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-drawer-transition.ts"
+ }
+ ]
+ },
{
"name": "checkbox",
"type": "registry:component",
diff --git a/registry/remocn-ui/sheet/__tests__/README.md b/registry/remocn-ui/sheet/__tests__/README.md
new file mode 100644
index 00000000..1565bcfa
--- /dev/null
+++ b/registry/remocn-ui/sheet/__tests__/README.md
@@ -0,0 +1,129 @@
+# `sheet` — verification tests
+
+Pure / deterministic verification for the `sheet` component
+(`registry/remocn-ui/sheet/`). The RENDER path needs `useRemocnTheme()`
+and the Remotion render tree and cannot run headless, so the render is NOT
+exercised here. This suite covers the pieces that ARE pure: `SheetState`
+union membership, `sheetConfig.controls` wiring, `sheetConfig.snippet`
+codegen, `sheetStyle` presets, `tweenSheetStyle` interpolation, and
+`DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+Sheet ships two complementary paths:
+
+**Snap path** (`state?: SheetState` prop):
+`Sheet` is a frame-free pure renderer. The `state` prop drives all visuals.
+Each state maps to a complete resting visual via the exported pure function
+`sheetStyle(state, ctx) => SheetStyle`. State changes snap instantly —
+no tweening inside the component.
+
+**Smooth path** (`style?: SheetStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`SheetStyle` to the `style` prop. The caller — typically
+`useSheetTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenSheetStyle(from, to, t)`. The `Sheet` component itself remains
+frame-free; it simply renders whatever `SheetStyle` it receives.
+
+This design keeps `Sheet` pure-testable (no Remotion render context needed)
+while still supporting smooth open/close transitions for production use.
+
+## How to run
+
+> **The user (not the agent) runs verification.** Do not run this command
+> automatically — always wait for the user to run it.
+
+The repo uses **Bun**, which has a built-in test runner — runs TypeScript
+natively, no test-framework dep.
+
+```bash
+bun install
+bun test registry/remocn-ui/sheet/__tests__
+```
+
+`sheet.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test
+script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`SheetState` union** — asserts the two states `["opened", "closed"]`
+ are the complete set (via the real `controls.state.options` list from
+ `config.ts`).
+- **`sheetConfig.controls.state`** — the customizer control wiring. Asserts
+ a `select` control exists with exactly those two options in order, default
+ `"opened"` (so the preview showcases the panel), and that every option is a
+ member of the `SheetState` union.
+- **`sheetConfig.snippet`** — REAL pure string builder (high value).
+ Asserts: always emits `state="<state>"` for every option; NEVER emits `steps`;
+ includes `import { Sheet }` from `@/components/remocn/sheet`;
+ omits default-equal props (`title="Edit profile"`, the default description
+ `"Make changes to your profile here. Click save when you're done."`,
+ `actionLabel="Save changes"`, `cancelLabel="Cancel"`, `mode="light"`); EMITS
+ non-default `title`/`description`/`actionLabel`/`cancelLabel`/`mode`;
+ structural round-trip (starts with import, contains `<Sheet`, ends `/>`).
+ Note: `action=` is not checked for absence because `actionLabel=` is a
+ legitimate emitted prop — only `steps` is asserted absent.
+- **`sheetStyleContext`** — exported pure `(theme) => SheetStyleContext`
+ (takes only `theme`, no variant — unlike accordion). Built from
+ `sheetStyleContext(defaultLightTheme)`. Asserts each field
+ (`popoverBg`, `popoverFg`, `mutedFg`, `border`, `actionBg`, `actionFg`,
+ `cancelFg`) is a non-empty string, and `radius` is a number.
+- **`sheetStyle` presets** — exported pure `(state, ctx) => SheetStyle`.
+ All three fields (`overlayOpacity`, `panelOpacity`, `panelTranslateX`)
+ are numeric. Asserts per-state invariants: closed →
+ `{ 0, 0, 400 }`; opened → `{ 1, 1, 0 }`.
+- **`tweenSheetStyle`** — exported pure `(a, b, t) => SheetStyle`.
+ All three fields are pure numeric lerps (no color fields). Asserts: at t=0 all
+ fields equal `a`; at t=1 all equal `b`; at t=0.5 each field is the exact
+ midpoint (`overlayOpacity` 0.5, `panelOpacity` 0.5, `panelTranslateX` 200).
+ Both directions (closed→opened and opened→closed) are verified.
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to 12.
+
+**Sheet render** is a pure `(style | state) => visual` observable only via
+Remotion render, not unit-tested here.
+
+## Import strategy
+
+`sheet.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `SheetState`, `sheetStyle`,
+ `sheetStyleContext`
+- `../use-sheet-transition` — relative, for `tweenSheetStyle`,
+ `DEFAULT_DURATION`
+- `../config` — relative, for `sheetConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-sheet-transition.ts` pulls the `remotion`
+module (and React), but neither `sheetStyle`, `sheetStyleContext`,
+nor `tweenSheetStyle` call `useCurrentFrame()` at import time or at call
+time — they are pure value functions. `bun test` resolves tsconfig `paths`, so
+the alias works without additional config.
+
+## Determinism grep checklist (run manually; must print NOTHING)
+
+Sheet is a state atom and must be frame-free. The component's `index.tsx`
+must contain **none** of the following:
+
+```bash
+grep -nE "useState|useEffect|useCurrentFrame|onClick|onChange|addEventListener|Date\.now|Math\.random|requestAnimationFrame" \
+ registry/remocn-ui/sheet/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-sheet-transition.ts` is the CALLER hook that intentionally reads
+`useCurrentFrame()` (via `useStateTransition`). It is not a render component;
+the smooth-path design isolates all frame-reading to the hook, keeping
+`Sheet` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/sheet/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/sheet/__tests__/sheet.test.ts b/registry/remocn-ui/sheet/__tests__/sheet.test.ts
new file mode 100644
index 00000000..bbec6656
--- /dev/null
+++ b/registry/remocn-ui/sheet/__tests__/sheet.test.ts
@@ -0,0 +1,448 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `sheet`.
+ *
+ * Scope:
+ * - registry/remocn-ui/sheet/index.tsx — SheetState union membership,
+ * sheetStyle presets, sheetStyleContext
+ * - registry/remocn-ui/sheet/config.ts — sheetConfig.controls wiring
+ * + sheetConfig.snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/sheet/use-sheet-transition.ts
+ * — tweenSheetStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<Sheet>` reads `useRemocnTheme()` internally — that hook is pure at
+ * call-time in test context, but the JSX render tree is not exercised here.
+ * The pure-testable surface is: the style presets + tween + customizer wiring
+ * + snippet codegen.
+ *
+ * Runner: Bun's built-in test runner (TypeScript-native, no framework dep).
+ * bun test registry/remocn-ui/sheet/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `SheetState` from `@/registry/remocn-ui/sheet`
+ * and the pieces under test never CALL a Remotion runtime API at import time —
+ * `sheetConfig` is a plain object; `.snippet` is a pure string builder;
+ * `sheetStyle` and `tweenSheetStyle` are pure value functions.
+ * We import via RELATIVE paths (matching the existing test suite pattern),
+ * annotating each import with the source it corresponds to.
+ * --------------------------------------------------------------------------
+ */
+
+import { describe, expect, it } from "bun:test";
+import {
+ type SheetState,
+ sheetStyle,
+ sheetStyleContext,
+} from "../index";
+import { tweenSheetStyle, DEFAULT_DURATION } from "../use-sheet-transition";
+import { sheetConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The SheetState union, enumerated as a runtime list for membership checks.
+ * Must stay in sync with `export type SheetState` in index.tsx.
+ */
+const VALID_STATES: readonly SheetState[] = ["opened", "closed"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ title?: string;
+ description?: string;
+ actionLabel?: string;
+ cancelLabel?: string;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ sheetConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared SheetStyleContext built from the default light theme.
+ * `sheetStyleContext` takes only `(theme)` — no variant arg, unlike accordion.
+ */
+const ctx = sheetStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. SheetState union membership
+// ===========================================================================
+
+describe("SheetState union", () => {
+ it("contains exactly the two documented states", () => {
+ // We can't enumerate a TS type at runtime, but we can assert the REAL
+ // controls.state options match and that all known states are members.
+ const control = sheetConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["opened", "closed"]);
+ });
+
+ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {
+ // Belt-and-suspenders: the fixture array must have exactly 2 entries and
+ // match the options list from the real config.
+ const control = sheetConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(VALID_STATES).toHaveLength(2);
+ for (const s of VALID_STATES) {
+ expect(control.options).toContain(s);
+ }
+ });
+});
+
+// ===========================================================================
+// 2. sheetConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("sheetConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(sheetConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the two SheetState options in order", () => {
+ const control = sheetConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["opened", "closed"]);
+ });
+
+ it("defaults to 'opened' so the preview showcases the panel", () => {
+ const control = sheetConfig.controls.state;
+ expect(control.default).toBe("opened");
+ });
+
+ it("every option is a member of the SheetState union", () => {
+ const control = sheetConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ for (const option of control.options) {
+ expect(VALID_STATES).toContain(option as SheetState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. sheetConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// It NEVER emits `steps`.
+// Note on `action`: the snippet emits `actionLabel=` (a legitimate prop) but
+// must never emit a bare `action=` attribute. We assert `steps` is absent and
+// add a targeted check that `action=` only ever appears as `actionLabel=`.
+// ===========================================================================
+
+describe("sheetConfig.snippet: state prop emission", () => {
+ it("emits state=\"opened\" for the opened option", () => {
+ expect(snippet({ state: "opened" })).toContain('state="opened"');
+ });
+
+ it("emits state=\"closed\" for the closed option", () => {
+ expect(snippet({ state: "closed" })).toContain('state="closed"');
+ });
+
+ it("emits the correct state for every control option", () => {
+ const control = sheetConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ for (const state of control.options) {
+ const out = snippet({ state });
+ expect(out).toContain(`state="${state}"`);
+ }
+ });
+});
+
+describe("sheetConfig.snippet: NEVER emits steps", () => {
+ // `action=` is intentionally NOT checked here because `actionLabel=` is a
+ // legitimate emitted prop and would cause a false positive on a naive
+ // `.toContain("action")` check. Assert `steps` absence only.
+ it("never emits `steps` in any state", () => {
+ for (const state of VALID_STATES) {
+ expect(snippet({ state })).not.toContain("steps");
+ }
+ });
+});
+
+describe("sheetConfig.snippet: import line", () => {
+ it("includes `import { Sheet }` from the correct path", () => {
+ const out = snippet({ state: "opened" });
+ expect(out).toContain('import { Sheet }');
+ expect(out).toContain('from "@/components/remocn/sheet"');
+ });
+});
+
+describe("sheetConfig.snippet: default props are omitted", () => {
+ // Defaults: title="Edit profile",
+ // description="Make changes to your profile here. Click save when you're done.",
+ // actionLabel="Save changes", cancelLabel="Cancel", mode="light"
+ const allDefaults = snippet({
+ state: "opened",
+ title: "Edit profile",
+ description: "Make changes to your profile here. Click save when you're done.",
+ actionLabel: "Save changes",
+ cancelLabel: "Cancel",
+ mode: "light",
+ });
+
+ it("omits title when it equals the default 'Edit profile'", () => {
+ expect(allDefaults).not.toContain("title=");
+ });
+
+ it("omits description when it equals the default text", () => {
+ expect(allDefaults).not.toContain("description=");
+ });
+
+ it("omits actionLabel when it equals the default 'Save changes'", () => {
+ expect(allDefaults).not.toContain("actionLabel=");
+ });
+
+ it("omits cancelLabel when it equals the default 'Cancel'", () => {
+ expect(allDefaults).not.toContain("cancelLabel=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("sheetConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default title", () => {
+ expect(snippet({ state: "opened", title: "Edit workspace settings" }))
+ .toContain('title="Edit workspace settings"');
+ });
+
+ it("emits a non-default description", () => {
+ expect(snippet({ state: "opened", description: "Update your workspace name and settings." }))
+ .toContain('description="Update your workspace name and settings."');
+ });
+
+ it("emits a non-default actionLabel", () => {
+ expect(snippet({ state: "opened", actionLabel: "Confirm" }))
+ .toContain('actionLabel="Confirm"');
+ });
+
+ it("emits a non-default cancelLabel", () => {
+ expect(snippet({ state: "opened", cancelLabel: "Go back" }))
+ .toContain('cancelLabel="Go back"');
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "opened", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("sheetConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "opened" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { Sheet }')).toBe(true);
+ });
+
+ it("contains a <Sheet JSX opening", () => {
+ expect(out).toContain("<Sheet");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. sheetStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument (unlike accordion).
+// Build ctx from the default light theme and assert each field is populated.
+// `radius` is a number (px); all other fields are non-empty strings.
+// ===========================================================================
+
+describe("sheetStyleContext: field types from defaultLightTheme", () => {
+ it("popoverBg is a non-empty string", () => {
+ expect(typeof ctx.popoverBg).toBe("string");
+ expect(ctx.popoverBg.length).toBeGreaterThan(0);
+ });
+
+ it("popoverFg is a non-empty string", () => {
+ expect(typeof ctx.popoverFg).toBe("string");
+ expect(ctx.popoverFg.length).toBeGreaterThan(0);
+ });
+
+ it("mutedFg is a non-empty string", () => {
+ expect(typeof ctx.mutedFg).toBe("string");
+ expect(ctx.mutedFg.length).toBeGreaterThan(0);
+ });
+
+ it("border is a non-empty string", () => {
+ expect(typeof ctx.border).toBe("string");
+ expect(ctx.border.length).toBeGreaterThan(0);
+ });
+
+ it("radius is a number", () => {
+ expect(typeof ctx.radius).toBe("number");
+ });
+
+ it("actionBg is a non-empty string", () => {
+ expect(typeof ctx.actionBg).toBe("string");
+ expect(ctx.actionBg.length).toBeGreaterThan(0);
+ });
+
+ it("actionFg is a non-empty string", () => {
+ expect(typeof ctx.actionFg).toBe("string");
+ expect(ctx.actionFg.length).toBeGreaterThan(0);
+ });
+
+ it("cancelFg is a non-empty string", () => {
+ expect(typeof ctx.cancelFg).toBe("string");
+ expect(ctx.cancelFg.length).toBeGreaterThan(0);
+ });
+});
+
+// ===========================================================================
+// 5. sheetStyle presets — pure (state, ctx) => SheetStyle
+// sheetStyleContext and sheetStyle are exported and frame-free.
+// Build one ctx from the default light theme, then assert the numeric
+// invariants for every state.
+// ===========================================================================
+
+describe("sheetStyle: closed state", () => {
+ const s = sheetStyle("closed", ctx);
+
+ it("overlayOpacity is 0 (overlay fully hidden)", () => {
+ expect(s.overlayOpacity).toBe(0);
+ });
+
+ it("panelOpacity is 0 (panel fully hidden)", () => {
+ expect(s.panelOpacity).toBe(0);
+ });
+
+ it("panelTranslateX is 400 (panel parked off-screen to the right)", () => {
+ expect(s.panelTranslateX).toBe(400);
+ });
+});
+
+describe("sheetStyle: opened state", () => {
+ const s = sheetStyle("opened", ctx);
+
+ it("overlayOpacity is 1 (overlay fully revealed)", () => {
+ expect(s.overlayOpacity).toBe(1);
+ });
+
+ it("panelOpacity is 1 (panel fully visible)", () => {
+ expect(s.panelOpacity).toBe(1);
+ });
+
+ it("panelTranslateX is 0 (panel at resting position)", () => {
+ expect(s.panelTranslateX).toBe(0);
+ });
+});
+
+describe("sheetStyle: closed/opened invariant", () => {
+ it("closed: overlayOpacity 0, panelOpacity 0, panelTranslateX 400", () => {
+ const s = sheetStyle("closed", ctx);
+ expect(s.overlayOpacity).toBe(0);
+ expect(s.panelOpacity).toBe(0);
+ expect(s.panelTranslateX).toBe(400);
+ });
+
+ it("opened: overlayOpacity 1, panelOpacity 1, panelTranslateX 0", () => {
+ const s = sheetStyle("opened", ctx);
+ expect(s.overlayOpacity).toBe(1);
+ expect(s.panelOpacity).toBe(1);
+ expect(s.panelTranslateX).toBe(0);
+ });
+});
+
+// ===========================================================================
+// 6. tweenSheetStyle — pure linear interpolation between two SheetStyles.
+// All three fields are pure numeric lerps (no color fields, unlike accordion).
+// Concrete expectations: closed → opened for midpoint math.
+// ===========================================================================
+
+describe("tweenSheetStyle: t=0 returns values equal to `a`", () => {
+ const a = sheetStyle("closed", ctx);
+ const b = sheetStyle("opened", ctx);
+ const r = tweenSheetStyle(a, b, 0);
+
+ it("overlayOpacity equals a.overlayOpacity at t=0", () => {
+ expect(r.overlayOpacity).toBeCloseTo(a.overlayOpacity, 10);
+ });
+
+ it("panelOpacity equals a.panelOpacity at t=0", () => {
+ expect(r.panelOpacity).toBeCloseTo(a.panelOpacity, 10);
+ });
+
+ it("panelTranslateX equals a.panelTranslateX at t=0", () => {
+ expect(r.panelTranslateX).toBeCloseTo(a.panelTranslateX, 10);
+ });
+});
+
+describe("tweenSheetStyle: t=1 returns values equal to `b`", () => {
+ const a = sheetStyle("closed", ctx);
+ const b = sheetStyle("opened", ctx);
+ const r = tweenSheetStyle(a, b, 1);
+
+ it("overlayOpacity equals b.overlayOpacity at t=1", () => {
+ expect(r.overlayOpacity).toBeCloseTo(b.overlayOpacity, 10);
+ });
+
+ it("panelOpacity equals b.panelOpacity at t=1", () => {
+ expect(r.panelOpacity).toBeCloseTo(b.panelOpacity, 10);
+ });
+
+ it("panelTranslateX equals b.panelTranslateX at t=1", () => {
+ expect(r.panelTranslateX).toBeCloseTo(b.panelTranslateX, 10);
+ });
+});
+
+describe("tweenSheetStyle: t=0.5 midpoint numeric lerp (closed → opened)", () => {
+ // closed: overlayOpacity=0, panelOpacity=0, panelTranslateX=400
+ // opened: overlayOpacity=1, panelOpacity=1, panelTranslateX=0
+ const a = sheetStyle("closed", ctx);
+ const b = sheetStyle("opened", ctx);
+ const r = tweenSheetStyle(a, b, 0.5);
+
+ it("overlayOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.overlayOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelTranslateX midpoint: 400 → 0 gives 200", () => {
+ expect(r.panelTranslateX).toBeCloseTo(200, 10);
+ });
+});
+
+describe("tweenSheetStyle: t=0.5 midpoint numeric lerp (opened → closed)", () => {
+ // opened: overlayOpacity=1, panelOpacity=1, panelTranslateX=0
+ // closed: overlayOpacity=0, panelOpacity=0, panelTranslateX=400
+ const a = sheetStyle("opened", ctx);
+ const b = sheetStyle("closed", ctx);
+ const r = tweenSheetStyle(a, b, 0.5);
+
+ it("overlayOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.overlayOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelTranslateX midpoint: 0 → 400 gives 200", () => {
+ expect(r.panelTranslateX).toBeCloseTo(200, 10);
+ });
+});
+
+// ===========================================================================
+// 7. DEFAULT_DURATION — sanity check the exported constant
+// ===========================================================================
+
+describe("DEFAULT_DURATION", () => {
+ it("is a positive number", () => {
+ expect(typeof DEFAULT_DURATION).toBe("number");
+ expect(DEFAULT_DURATION).toBeGreaterThan(0);
+ });
+
+ it("equals 12 (the authored value)", () => {
+ expect(DEFAULT_DURATION).toBe(12);
+ });
+});
diff --git a/registry/remocn-ui/sheet/config.ts b/registry/remocn-ui/sheet/config.ts
new file mode 100644
index 00000000..6514d4cc
--- /dev/null
+++ b/registry/remocn-ui/sheet/config.ts
@@ -0,0 +1,67 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { SheetState } from "@/registry/remocn-ui/sheet";
+
+const DEFAULT_DESCRIPTION =
+ "Make changes to your profile here. Click save when you're done.";
+
+export const sheetConfig: ComponentConfig = {
+ componentName: "Sheet",
+ importPath: "@/components/remocn/sheet",
+ controls: {
+ title: { type: "text", default: "Edit profile", label: "Title" },
+ description: {
+ type: "text",
+ default: DEFAULT_DESCRIPTION,
+ label: "Description",
+ },
+ actionLabel: {
+ type: "text",
+ default: "Save changes",
+ label: "Action Label",
+ },
+ cancelLabel: { type: "text", default: "Cancel", label: "Cancel Label" },
+ state: {
+ type: "select",
+ // Default to `opened` so the preview shows the panel.
+ default: "opened",
+ options: ["opened", "closed"],
+ label: "State",
+ },
+ mode: {
+ type: "select",
+ default: "light",
+ options: ["light", "dark"],
+ label: "Mode",
+ },
+ },
+ durationInFrames: 120,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ snippet: (values) => {
+ const state = (values.state as SheetState) ?? "opened";
+ const title = values.title as string | undefined;
+ const description = values.description as string | undefined;
+ const actionLabel = values.actionLabel as string | undefined;
+ const cancelLabel = values.cancelLabel as string | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (title !== undefined && title !== "Edit profile")
+ props.push(` title="${title}"`);
+ if (description !== undefined && description !== DEFAULT_DESCRIPTION)
+ props.push(` description="${description}"`);
+ if (actionLabel !== undefined && actionLabel !== "Save changes")
+ props.push(` actionLabel="${actionLabel}"`);
+ if (cancelLabel !== undefined && cancelLabel !== "Cancel")
+ props.push(` cancelLabel="${cancelLabel}"`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { Sheet } from "@/components/remocn/sheet";
+
+<Sheet
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/sheet/index.tsx b/registry/remocn-ui/sheet/index.tsx
new file mode 100644
index 00000000..d8fd9d05
--- /dev/null
+++ b/registry/remocn-ui/sheet/index.tsx
@@ -0,0 +1,254 @@
+"use client";
+
+import { type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+
+export type SheetState = "opened" | "closed";
+
+export interface SheetProps {
+ /** Current visual state (snap path). State changes snap (no enter-tweens). */
+ state?: SheetState;
+ /**
+ * Resolved animated visual (smooth path). When provided, takes precedence over
+ * `state` — feed it an interpolated `SheetStyle` from `useSheetTransition`.
+ */
+ style?: SheetStyle;
+ /** Headline of the sheet. */
+ title?: string;
+ /** Body copy under the title. */
+ description?: string;
+ /** Label of the confirming (primary) action. */
+ actionLabel?: string;
+ /** Label of the dismissing action. */
+ cancelLabel?: string;
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ className?: string;
+}
+
+/** Side panel width (px). */
+const SHEET_WIDTH = 400;
+/** Backdrop dim at full reveal — the overlay opacity scales up to this alpha. */
+const MAX_OVERLAY_ALPHA = 0.5;
+
+// ===========================================================================
+// Sheet visual — the COMPLETE animated look for a moment in time. A `state` is
+// a named preset of this visual (`sheetStyle`); the smooth path feeds an
+// interpolated `SheetStyle` straight through. The component is a pure renderer
+// of whichever `SheetStyle` it receives.
+// ===========================================================================
+
+export interface SheetStyle {
+ /** Backdrop dim reveal 0→1 (scales `MAX_OVERLAY_ALPHA`). */
+ overlayOpacity: number;
+ /** Panel fade 0→1. */
+ panelOpacity: number;
+ /** Panel slide in px: SHEET_WIDTH = off-screen-right → 0 = resting. */
+ panelTranslateX: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface SheetStyleContext {
+ popoverBg: string;
+ popoverFg: string;
+ mutedFg: string;
+ border: string;
+ radius: number;
+ actionBg: string;
+ actionFg: string;
+ cancelFg: string;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `sheetStyle(state, ctx)` preset.
+ */
+export function sheetStyleContext(theme: RemocnTheme): SheetStyleContext {
+ return {
+ popoverBg: theme.popover,
+ popoverFg: theme.popoverForeground,
+ mutedFg: theme.mutedForeground,
+ border: theme.border,
+ radius: theme.radius,
+ // The action is the PRIMARY (affirmative) action — not destructive.
+ actionBg: theme.primary,
+ actionFg: theme.primaryForeground,
+ cancelFg: theme.foreground,
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => SheetStyle`
+ * map. To change how a state looks, edit one entry.
+ */
+export function sheetStyle(
+ state: SheetState,
+ _ctx: SheetStyleContext,
+): SheetStyle {
+ switch (state) {
+ case "opened":
+ return {
+ overlayOpacity: 1,
+ panelOpacity: 1,
+ panelTranslateX: 0,
+ };
+ default:
+ return {
+ overlayOpacity: 0,
+ panelOpacity: 0,
+ panelTranslateX: SHEET_WIDTH,
+ };
+ }
+}
+
+export function Sheet({
+ state = "closed",
+ style,
+ title = "Edit profile",
+ description = "Make changes to your profile here. Click save when you're done.",
+ actionLabel = "Save changes",
+ cancelLabel = "Cancel",
+ theme: themeOverride,
+ mode,
+ className,
+}: SheetProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+
+ const ctx = sheetStyleContext(theme);
+ const v = style ?? sheetStyle(state, ctx);
+
+ // Shared base for the two footer buttons. These are plain inline `<button>`s,
+ // not the remocn `Button` component — that renders a full-frame scene wrapper
+ // (absolute inset) and so can't nest inline here; the sizing mirrors its
+ // `default` size.
+ const buttonBase: React.CSSProperties = {
+ height: 40,
+ padding: "0 20px",
+ fontSize: 15,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ borderRadius: ctx.radius,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ cursor: "pointer",
+ };
+
+ return (
+ // The wrapper is TRANSPARENT — unlike button/accordion (which paint an
+ // opaque `theme.background`), this atom is a modal layer meant to compose
+ // OVER another scene, so it must not blanket the frame with a background.
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ {/* Backdrop dim — fades in as the sheet opens. */}
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: `rgba(0, 0, 0, ${MAX_OVERLAY_ALPHA * v.overlayOpacity})`,
+ }}
+ />
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ top: 0,
+ right: 0,
+ height: "100%",
+ width: SHEET_WIDTH,
+ transform: `translateX(${v.panelTranslateX}px)`,
+ opacity: v.panelOpacity,
+ background: ctx.popoverBg,
+ color: ctx.popoverFg,
+ borderLeft: `1px solid ${ctx.border}`,
+ padding: 24,
+ display: "flex",
+ flexDirection: "column",
+ gap: 8,
+ boxShadow: "-24px 0 48px -12px rgba(0,0,0,0.25)",
+ }}
+ >
+ {/* Close (X) — static chrome in the top-right corner, not animated. */}
+ <button
+ type="button"
+ style={{
+ position: "absolute",
+ top: 16,
+ right: 16,
+ width: 28,
+ height: 28,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ background: "transparent",
+ border: "none",
+ borderRadius: ctx.radius,
+ color: ctx.mutedFg,
+ cursor: "pointer",
+ }}
+ >
+ <svg width={16} height={16} viewBox="0 0 24 24" fill="none">
+ <path
+ d="M18 6 6 18 M6 6 18 18"
+ stroke={ctx.mutedFg}
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </button>
+ <div
+ style={{
+ fontSize: 18,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ paddingRight: 28,
+ }}
+ >
+ {title}
+ </div>
+ <div style={{ fontSize: 14, lineHeight: 1.5, color: ctx.mutedFg }}>
+ {description}
+ </div>
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "flex-end",
+ gap: 8,
+ marginTop: "auto",
+ }}
+ >
+ {/* Cancel — outline variant. */}
+ <button
+ type="button"
+ style={{
+ ...buttonBase,
+ background: "transparent",
+ color: ctx.cancelFg,
+ border: `1px solid ${ctx.border}`,
+ }}
+ >
+ {cancelLabel}
+ </button>
+ {/* Action — primary variant. */}
+ <button
+ type="button"
+ style={{
+ ...buttonBase,
+ background: ctx.actionBg,
+ color: ctx.actionFg,
+ border: "1px solid transparent",
+ }}
+ >
+ {actionLabel}
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/sheet/use-sheet-transition.ts b/registry/remocn-ui/sheet/use-sheet-transition.ts
new file mode 100644
index 00000000..fe0f18d8
--- /dev/null
+++ b/registry/remocn-ui/sheet/use-sheet-transition.ts
@@ -0,0 +1,67 @@
+"use client";
+
+import {
+ easings,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ sheetStyle,
+ sheetStyleContext,
+ type SheetState,
+ type SheetStyle,
+} from "@/components/remocn/sheet";
+// ^ install path; resolves in-repo via the @/components/remocn/* tsconfig alias.
+
+/** Default transition length (frames) when a step omits `duration`. Tune to taste. */
+export const DEFAULT_DURATION = 12;
+
+/** Blend two sheet visuals: all three fields are pure numeric lerps. */
+export function tweenSheetStyle(
+ a: SheetStyle,
+ b: SheetStyle,
+ t: number,
+): SheetStyle {
+ return {
+ overlayOpacity: a.overlayOpacity + (b.overlayOpacity - a.overlayOpacity) * t,
+ panelOpacity: a.panelOpacity + (b.panelOpacity - a.panelOpacity) * t,
+ panelTranslateX:
+ a.panelTranslateX + (b.panelTranslateX - a.panelTranslateX) * t,
+ };
+}
+
+export interface SheetTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) SheetStyle. The CALLER invokes this;
+ * it reads the frame, the `<Sheet>` component does not. Feed the result to
+ * `<Sheet style={...} />` for smooth open/close transitions.
+ */
+export function useSheetTransition(
+ steps: Step<SheetState>[],
+ opts: SheetTransitionOptions = {},
+): SheetStyle {
+ const {
+ theme: themeOverride,
+ mode,
+ speed = 1,
+ defaultDuration = DEFAULT_DURATION,
+ } = opts;
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = sheetStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "closed",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenSheetStyle(sheetStyle(from, ctx), sheetStyle(to, ctx), t);
+}