Skip to content

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

feat: added select, dropdown

dev_wandry84093577f836
diff --git a/components/docs/examples/dropdown-menu-example.tsx b/components/docs/examples/dropdown-menu-example.tsx
new file mode 100644
index 00000000..e76f03d9
--- /dev/null
+++ b/components/docs/examples/dropdown-menu-example.tsx
@@ -0,0 +1,79 @@
+"use client";
+
+import { DropdownMenu } from "@/registry/remocn-ui/dropdown-menu";
+import { useDropdownMenuTransition } from "@/registry/remocn-ui/dropdown-menu/use-dropdown-menu-transition";
+import { useDropdownMenuItemTransition } from "@/registry/remocn-ui/dropdown-menu-item/use-dropdown-menu-item-transition";
+import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";
+import { useCurrentState } from "@/lib/remocn-ui";
+
+export const DropdownMenuExampleScene = () => {
+ // The trigger: idle → hover → press, the press lands just before the menu
+ // opens (the "click" that triggers it).
+ const triggerStyle = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { variant: "outline" },
+ );
+ // The menu opens just after the "click", then closes near the end.
+ const menu = useDropdownMenuTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]);
+ // One row walks hover → press while the panel is open (no persistent
+ // selection — a menu commits the action and dismisses).
+ const rowState = useCurrentState(
+ [
+ { at: 52, state: "hover" },
+ { at: 70, state: "press" },
+ { at: 82, state: "idle" },
+ ],
+ "idle",
+ );
+ const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+ return (
+ <DropdownMenu
+ style={menu}
+ triggerStyle={triggerStyle}
+ itemStyles={[undefined, row, undefined, undefined]}
+ />
+ );
+};
+
+export const dropdownMenuExampleCode = `import { DropdownMenu } from "@/components/remocn/dropdown-menu";
+import { useDropdownMenuTransition } from "@/components/remocn/use-dropdown-menu-transition";
+import { useDropdownMenuItemTransition } from "@/components/remocn/use-dropdown-menu-item-transition";
+import { useButtonTransition } from "@/components/remocn/use-button-transition";
+import { useCurrentState } from "@/lib/remocn-ui";
+
+export const Scene = () => {
+ const triggerStyle = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { variant: "outline" },
+ );
+ const menu = useDropdownMenuTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]);
+ const rowState = useCurrentState(
+ [
+ { at: 52, state: "hover" },
+ { at: 70, state: "press" },
+ { at: 82, state: "idle" },
+ ],
+ "idle",
+ );
+ const row = useDropdownMenuItemTransition([{ at: 0, state: rowState }]);
+
+ return (
+ <DropdownMenu
+ style={menu}
+ triggerStyle={triggerStyle}
+ itemStyles={[undefined, row, undefined, undefined]}
+ />
+ );
+};`;
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsx
index 57de7025..bb76eecb 100644
--- a/components/docs/examples/index.tsx
+++ b/components/docs/examples/index.tsx
@@ -16,6 +16,11 @@ import {
import { RadioExampleScene, radioExampleCode } from "./radio-example";
import { SwitchExampleScene, switchExampleCode } from "./switch-example";
import { InputExampleScene, inputExampleCode } from "./input-example";
+import { SelectExampleScene, selectExampleCode } from "./select-example";
+import {
+ DropdownMenuExampleScene,
+ dropdownMenuExampleCode,
+} from "./dropdown-menu-example";
export interface ExampleEntry {
Component: ComponentType;
@@ -85,4 +90,22 @@ export const examples: Record<string, ExampleEntry> = {
width: W,
height: H,
},
+ "select-example": {
+ Component: SelectExampleScene,
+ code: selectExampleCode,
+ // Panel closes at 96 + dur 12 = 108; a short settle then loop.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ },
+ "dropdown-menu-example": {
+ Component: DropdownMenuExampleScene,
+ code: dropdownMenuExampleCode,
+ // Panel closes at 96 + dur 12 = 108; a short settle then loop.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ },
};
diff --git a/components/docs/examples/select-example.tsx b/components/docs/examples/select-example.tsx
new file mode 100644
index 00000000..8a19b89d
--- /dev/null
+++ b/components/docs/examples/select-example.tsx
@@ -0,0 +1,70 @@
+"use client";
+
+import { useButtonTransition } from "@/registry/remocn-ui/button/use-button-transition";
+import { Select } from "@/registry/remocn-ui/select";
+import { useSelectTransition } from "@/registry/remocn-ui/select/use-select-transition";
+import { useSelectItemTransition } from "@/registry/remocn-ui/select-item/use-select-item-transition";
+
+export const SelectExampleScene = () => {
+ // The trigger: idle → hover → press, the press lands just before the panel
+ // opens (the "click" that triggers it). Fed to the Select via `triggerStyle`.
+ const triggerStyle = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { variant: "outline" },
+ );
+ // The panel reveals right after the press, then collapses near the end.
+ const panel = useSelectTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]);
+ // One row (index 1) is highlighted, pressed, then committed as selected.
+ const row = useSelectItemTransition([
+ { at: 52, state: "hover" },
+ { at: 64, state: "press" },
+ { at: 72, state: "selected", duration: 10 },
+ ]);
+ return (
+ <Select
+ style={panel}
+ label="Select a fruit"
+ triggerStyle={triggerStyle}
+ itemStyles={[undefined, row, undefined, undefined]}
+ />
+ );
+};
+
+export const selectExampleCode = `import { useButtonTransition } from "@/components/remocn/use-button-transition";
+import { Select } from "@/components/remocn/select";
+import { useSelectTransition } from "@/components/remocn/use-select-transition";
+import { useSelectItemTransition } from "@/components/remocn/use-select-item-transition";
+
+export const Scene = () => {
+ const triggerStyle = useButtonTransition(
+ [
+ { at: 14, state: "hover" },
+ { at: 26, state: "press" },
+ ],
+ { variant: "outline" },
+ );
+ const panel = useSelectTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 96, state: "closed", duration: 12 },
+ ]);
+ const row = useSelectItemTransition([
+ { at: 52, state: "hover" },
+ { at: 64, state: "press" },
+ { at: 72, state: "selected", duration: 10 },
+ ]);
+
+ return (
+ <Select
+ style={panel}
+ label="Select a fruit"
+ triggerStyle={triggerStyle}
+ itemStyles={[undefined, row, undefined, undefined]}
+ />
+ );
+};`;
diff --git a/content/docs/ui/components/dropdown-menu.mdx b/content/docs/ui/components/dropdown-menu.mdx
new file mode 100644
index 00000000..0987c4f5
--- /dev/null
+++ b/content/docs/ui/components/dropdown-menu.mdx
@@ -0,0 +1,181 @@
+---
+title: DropdownMenu
+description: A dropdown menu container with opened/closed states and action rows
+---
+
+<ComponentPreview name="dropdown-menu" />
+
+A state atom representing a complete dropdown menu: a trigger button and a panel of actionable items. Its appearance (opened, closed) 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 panel reveals below the trigger with opacity, scale, and vertical translation animations.
+
+## Installation
+
+<InstallBlock name="dropdown-menu" />
+
+<Note>
+Installing `dropdown-menu` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`), the `button` primitive, and the `dropdown-menu-item` atom via `registryDependencies` (`["remocn-ui", "button", "dropdown-menu-item"]`). You do not need to install them separately. The trigger reuses the Button `outline` variant, and the panel renders a column of DropdownMenuItem rows.
+</Note>
+
+## States
+
+`DropdownMenuState` is:
+
+```ts
+type DropdownMenuState =
+ | "opened" // panel visible, opacity 1, scale 1, translateY 0, chevron rotated 180°
+ | "closed" // panel hidden, opacity 0, scale 0.96, translateY -4px, chevron at 0°
+```
+
+`opened` reveals the panel with the trigger chevron pointing up (rotated 180°). `closed` hides the panel and returns the chevron to its downward point.
+
+## 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 { DropdownMenu } from "@/components/remocn/dropdown-menu";
+
+export const Scene = () => (
+ <DropdownMenu
+ state="opened"
+ label="More"
+ items={["Profile", "Settings", "Log out"]}
+ />
+);
+```
+
+To drive state from the timeline, use `useCurrentState`:
+
+```tsx
+import { useCurrentState } from "@/lib/remocn-ui";
+import { DropdownMenu } from "@/components/remocn/dropdown-menu";
+
+export const Scene = () => {
+ const state = useCurrentState(
+ [
+ { at: 32, state: "opened" },
+ { at: 92, state: "closed" },
+ ],
+ "closed",
+ );
+
+ return <DropdownMenu state={state} />;
+};
+```
+
+Each `at` is a **Sequence-local authored frame**. State persists between steps: `opened` at frame 32 keeps the panel 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 `useDropdownMenuTransition` from the copied `use-dropdown-menu-transition.ts` file. It reads the frame, interpolates between state presets, and returns a resolved `DropdownMenuStyle` — pass it to the `style` prop:
+
+```tsx
+import { DropdownMenu } from "@/components/remocn/dropdown-menu";
+import { useDropdownMenuTransition } from "@/components/remocn/use-dropdown-menu-transition";
+
+export const Scene = () => {
+ const style = useDropdownMenuTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return <DropdownMenu 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-dropdown-menu-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).
+
+`style` takes precedence over `state` when both are provided.
+
+## Items
+
+The panel renders a column of **DropdownMenuItem** rows — one per action. Each row has three states reflecting the user's interaction with that item:
+
+`DropdownMenuItemState` is:
+
+```ts
+type DropdownMenuItemState =
+ | "idle" // neutral popover background, popover-foreground label
+ | "hover" // accent background, popover-foreground label
+ | "press" // darker accent background, popover-foreground label, scale 0.98
+```
+
+`idle` shows the default popover background. `hover` brightens to accent. `press` darkens and shrinks to 0.98 scale. Unlike SelectItem, DropdownMenuItem has no `selected` state — menu items are stateless after interaction.
+
+Preview a single DropdownMenuItem:
+
+<ComponentPreview name="dropdown-menu-item" />
+
+When you install `dropdown-menu`, the `dropdown-menu-item` atom is automatically pulled in via `registryDependencies` — no separate install needed. The `DropdownMenu` container derives each row's state from the `highlightedIndex` and `pressedIndex` props, or you can override a row's visual with `itemStyles`.
+
+## Full lifecycle
+
+The live example composes **Button as the trigger**: a Button animates through `hover` → `press` states (the "click"), the dropdown panel opens right after the press lands, and rows animate through hover → press as the user picks an action. Copy the code to drop it into your own composition.
+
+<LiveExample name="dropdown-menu-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: "DropdownMenuStyle",
+ description: "Resolved animated visual (smooth path). Pass an interpolated DropdownMenuStyle from useDropdownMenuTransition. Takes precedence over state when provided.",
+ },
+ {
+ name: "label",
+ type: "string",
+ default: "\"Options\"",
+ description: "Trigger button text.",
+ },
+ {
+ name: "triggerStyle",
+ type: "ButtonStyle",
+ description: "Resolved Button visual for the trigger (smooth path). Drive it with useButtonTransition for a hover/press click animation. Defaults to the resting Button outline look.",
+ },
+ {
+ name: "items",
+ type: "string[]",
+ default: "[\"Profile\", \"Billing\", \"Settings\", \"Log out\"]",
+ description: "Array of action labels rendered in the panel.",
+ },
+ {
+ name: "highlightedIndex",
+ type: "number",
+ default: "-1",
+ description: "Index of the row under the pointer or currently highlighted (hover state). -1 for none.",
+ },
+ {
+ name: "pressedIndex",
+ type: "number",
+ default: "-1",
+ description: "Index of the row being pressed (press state). -1 for none.",
+ },
+ {
+ name: "itemStyles",
+ type: "(DropdownMenuItemStyle | undefined)[]",
+ description: "Per-item resolved visual override (smooth path). When an entry is present it wins over the index→state derivation. Used by the live example to animate a single row.",
+ },
+ {
+ 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 wrapper element.",
+ },
+ ]}
+/>
diff --git a/content/docs/ui/components/meta.json b/content/docs/ui/components/meta.json
index f77b6cfd..9e9ac2a2 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", "input", "radio", "spinner", "switch"]
+ "pages": ["accordion", "alert-dialog", "button", "checkbox", "dropdown-menu", "input", "radio", "select", "spinner", "switch"]
}
diff --git a/content/docs/ui/components/select.mdx b/content/docs/ui/components/select.mdx
new file mode 100644
index 00000000..44a60fd9
--- /dev/null
+++ b/content/docs/ui/components/select.mdx
@@ -0,0 +1,189 @@
+---
+title: Select
+description: A dropdown select container with opened/closed states and item panel
+---
+
+<ComponentPreview name="select" />
+
+A state atom representing a complete select dropdown: a trigger button and a panel of selectable items. Its appearance (opened, closed) 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 panel reveals below the trigger with opacity, scale, and vertical translation animations.
+
+## Installation
+
+<InstallBlock name="select" />
+
+<Note>
+Installing `select` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`), the `button` primitive, and the `select-item` atom via `registryDependencies` (`["remocn-ui", "button", "select-item"]`). You do not need to install them separately. The trigger reuses the Button `outline` variant, and the panel renders a column of SelectItem rows.
+</Note>
+
+## States
+
+`SelectState` is:
+
+```ts
+type SelectState =
+ | "opened" // panel visible, opacity 1, scale 1, translateY 0, chevron rotated 180°
+ | "closed" // panel hidden, opacity 0, scale 0.96, translateY -4px, chevron at 0°
+```
+
+`opened` reveals the panel with the trigger chevron pointing up (rotated 180°). `closed` hides the panel and returns the chevron to its downward point.
+
+## 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 { Select } from "@/components/remocn/select";
+
+export const Scene = () => (
+ <Select
+ state="opened"
+ label="Choose a fruit"
+ items={["Apple", "Banana", "Orange"]}
+ selectedIndex={1}
+ />
+);
+```
+
+To drive state from the timeline, use `useCurrentState`:
+
+```tsx
+import { useCurrentState } from "@/lib/remocn-ui";
+import { Select } from "@/components/remocn/select";
+
+export const Scene = () => {
+ const state = useCurrentState(
+ [
+ { at: 32, state: "opened" },
+ { at: 92, state: "closed" },
+ ],
+ "closed",
+ );
+
+ return <Select state={state} />;
+};
+```
+
+Each `at` is a **Sequence-local authored frame**. State persists between steps: `opened` at frame 32 keeps the panel 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 `useSelectTransition` from the copied `use-select-transition.ts` file. It reads the frame, interpolates between state presets, and returns a resolved `SelectStyle` — pass it to the `style` prop:
+
+```tsx
+import { Select } from "@/components/remocn/select";
+import { useSelectTransition } from "@/components/remocn/use-select-transition";
+
+export const Scene = () => {
+ const style = useSelectTransition([
+ { at: 32, state: "opened", duration: 16 },
+ { at: 92, state: "closed", duration: 12 },
+ ]);
+ return <Select 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-select-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).
+
+`style` takes precedence over `state` when both are provided.
+
+## Items
+
+The panel renders a column of **SelectItem** rows — one per option. Each row has four states reflecting the user's interaction with that item:
+
+`SelectItemState` is:
+
+```ts
+type SelectItemState =
+ | "idle" // neutral background, label foreground, check hidden
+ | "hover" // accent background, label foreground, check hidden
+ | "press" // darker accent background, label foreground, check hidden, scale 0.98
+ | "selected" // accent background, accent-foreground label, check icon visible (opacity 1)
+```
+
+`idle` shows the default popover background. `hover` brightens to accent. `press` darkens further and shrinks to 0.98 scale. `selected` locks the accent background, switches the label to accent-foreground, and reveals the check icon at full opacity.
+
+Preview a single SelectItem:
+
+<ComponentPreview name="select-item" />
+
+When you install `select`, the `select-item` atom is automatically pulled in via `registryDependencies` — no separate install needed. The `Select` container derives each row's state from the `selectedIndex`, `highlightedIndex`, and `pressedIndex` props, or you can override a row's visual with `itemStyles`.
+
+## Full lifecycle
+
+The live example composes **Button as the trigger**: a Button animates through `hover` → `press` states (the "click"), the select panel opens right after the press lands, and rows animate through hover → press → selected as the user picks an option. Copy the code to drop it into your own composition.
+
+<LiveExample name="select-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: "SelectStyle",
+ description: "Resolved animated visual (smooth path). Pass an interpolated SelectStyle from useSelectTransition. Takes precedence over state when provided.",
+ },
+ {
+ name: "label",
+ type: "string",
+ default: "\"Select a fruit\"",
+ description: "Trigger button text.",
+ },
+ {
+ name: "triggerStyle",
+ type: "ButtonStyle",
+ description: "Resolved Button visual for the trigger (smooth path). Drive it with useButtonTransition for a hover/press click animation. Defaults to the resting Button outline look.",
+ },
+ {
+ name: "items",
+ type: "string[]",
+ default: "[\"Apple\", \"Banana\", \"Orange\", \"Grape\"]",
+ description: "Array of option labels rendered in the panel.",
+ },
+ {
+ name: "selectedIndex",
+ type: "number",
+ default: "-1",
+ description: "Index of the persisted selection (shows check icon and accent color). -1 for no selection.",
+ },
+ {
+ name: "highlightedIndex",
+ type: "number",
+ default: "-1",
+ description: "Index of the row under the pointer or currently highlighted (hover state). -1 for none.",
+ },
+ {
+ name: "pressedIndex",
+ type: "number",
+ default: "-1",
+ description: "Index of the row being pressed (press state). -1 for none.",
+ },
+ {
+ name: "itemStyles",
+ type: "(SelectItemStyle | undefined)[]",
+ description: "Per-item resolved visual override (smooth path). When an entry is present it wins over the index→state derivation. Used by the live example to animate a single row.",
+ },
+ {
+ 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 wrapper element.",
+ },
+ ]}
+/>
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 5f87b3a4..f49f7cb5 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -121,6 +121,14 @@ import { Spinner } from "@/registry/remocn-ui/spinner";
import { spinnerConfig } from "@/registry/remocn-ui/spinner/config";
import { Switch } from "@/registry/remocn-ui/switch";
import { switchConfig } from "@/registry/remocn-ui/switch/config";
+import { Select } from "@/registry/remocn-ui/select";
+import { selectConfig } from "@/registry/remocn-ui/select/config";
+import { SelectItem } from "@/registry/remocn-ui/select-item";
+import { selectItemConfig } from "@/registry/remocn-ui/select-item/config";
+import { DropdownMenu } from "@/registry/remocn-ui/dropdown-menu";
+import { dropdownMenuConfig } from "@/registry/remocn-ui/dropdown-menu/config";
+import { DropdownMenuItem } from "@/registry/remocn-ui/dropdown-menu-item";
+import { dropdownMenuItemConfig } from "@/registry/remocn-ui/dropdown-menu-item/config";
import { ZoomThroughTransition } from "@/registry/remocn/zoom-through-transition";
import { zoomThroughTransitionConfig } from "@/registry/remocn/zoom-through-transition/config";
@@ -301,6 +309,13 @@ const registry: Record<string, RegistryEntry> = {
"input": { Component: Input, config: inputConfig },
"radio": { Component: Radio, config: radioConfig },
"switch": { Component: Switch, config: switchConfig },
+ "select": { Component: Select, config: selectConfig },
+ "select-item": { Component: SelectItem, config: selectItemConfig },
+ "dropdown-menu": { Component: DropdownMenu, config: dropdownMenuConfig },
+ "dropdown-menu-item": {
+ Component: DropdownMenuItem,
+ config: dropdownMenuItemConfig,
+ },
"spinner": { Component: Spinner, config: spinnerConfig },
};
diff --git a/registry/remocn-ui/dropdown-menu-item/__tests__/README.md b/registry/remocn-ui/dropdown-menu-item/__tests__/README.md
new file mode 100644
index 00000000..c71b2518
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu-item/__tests__/README.md
@@ -0,0 +1,131 @@
+# `dropdown-menu-item` — verification tests
+
+Pure / deterministic verification for the `dropdown-menu-item` component
+(`registry/remocn-ui/dropdown-menu-item/`). 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:
+`DropdownMenuItemState` union membership, `dropdownMenuItemConfig.controls`
+wiring, `dropdownMenuItemConfig.snippet` codegen, `dropdownMenuItemStyle`
+presets, `tweenDropdownMenuItemStyle` interpolation, and `DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+DropdownMenuItem ships two complementary paths:
+
+**Snap path** (`state?: DropdownMenuItemState` prop):
+`DropdownMenuItem` 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 `dropdownMenuItemStyle(state, ctx) => DropdownMenuItemStyle`. State
+changes snap instantly — no tweening inside the component.
+
+**Smooth path** (`style?: DropdownMenuItemStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`DropdownMenuItemStyle` to the `style` prop. The caller — typically
+`useDropdownMenuItemTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenDropdownMenuItemStyle(from, to, t)`. The component itself remains
+frame-free; it simply renders whatever `DropdownMenuItemStyle` it receives.
+
+This design keeps `DropdownMenuItem` pure-testable (no Remotion render context
+needed) while still supporting smooth 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/dropdown-menu-item/__tests__
+```
+
+`dropdown-menu-item.test.ts` imports `bun:test` (not `vitest`/`jest`), so no
+test script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`DropdownMenuItemState` union** — asserts the three states
+ `["idle", "hover", "press"]` are the complete set (via the real
+ `controls.state.options` list from `config.ts`). Note: NO `selected` state —
+ dropdown menus do not persist selection.
+- **`dropdownMenuItemConfig.controls.state`** — the customizer control wiring.
+ Asserts a `select` control exists with exactly those three options in order,
+ default `"hover"` (so the preview shows the highlighted row), and that every
+ option is a member of the `DropdownMenuItemState` union.
+- **`dropdownMenuItemConfig.snippet`** — REAL pure string builder (high value).
+ Asserts: always emits `state="<state>"` for every option; includes
+ `import { DropdownMenuItem }` from `@/components/remocn/dropdown-menu-item`;
+ omits default-equal props (`label="Profile"`, `mode="light"`); EMITS
+ non-default `label`/`mode`; structural round-trip (starts with import, contains
+ `<DropdownMenuItem`, ends `/>`).
+- **`dropdownMenuItemStyleContext`** — exported pure
+ `(theme) => DropdownMenuItemStyleContext` (takes only `theme`, no variant).
+ Built from `dropdownMenuItemStyleContext(defaultLightTheme)`. Asserts each
+ field is a non-empty string. Also asserts token mapping:
+ `idleBg = theme.popover`, `hoverBg = theme.accent`,
+ `idleFg = theme.popoverForeground`.
+- **`dropdownMenuItemStyle` presets** — exported pure
+ `(state, ctx) => DropdownMenuItemStyle`. No check icon, no `selected` state.
+ Asserts per-state invariants:
+ - `idle` → `{ background: idleBg, labelColor: idleFg, scale: 1 }`
+ - `hover` → `{ background: hoverBg, labelColor: idleFg, scale: 1 }`
+ - `press` → `{ background: pressBg, labelColor: idleFg, scale: 0.98 }`
+- **`tweenDropdownMenuItemStyle`** — exported pure `(a, b, t) =>
+ DropdownMenuItemStyle`. `scale` lerps numerically; `background` and
+ `labelColor` go through `mixOklch` (tested as non-empty strings). Asserts: at
+ t=0 `scale` equals `a.scale`; at t=1 it equals `b.scale`; at t=0.5 the exact
+ midpoint. Two transitions: idle→press (scale 1→0.98 gives 0.99) and
+ hover→idle (scale 1→1 gives 1).
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to `8` (item default, shorter than the container's `12`).
+
+**DropdownMenuItem render** is a pure `(style | state) => visual` observable
+only via Remotion render, not unit-tested here.
+
+## Import strategy
+
+`dropdown-menu-item.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `DropdownMenuItemState`, `dropdownMenuItemStyle`,
+ `dropdownMenuItemStyleContext`
+- `../use-dropdown-menu-item-transition` — relative, for
+ `tweenDropdownMenuItemStyle`, `DEFAULT_DURATION`
+- `../config` — relative, for `dropdownMenuItemConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-dropdown-menu-item-transition.ts` pulls the
+`remotion` module (and React), but neither `dropdownMenuItemStyle`,
+`dropdownMenuItemStyleContext`, nor `tweenDropdownMenuItemStyle` 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)
+
+DropdownMenuItem 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/dropdown-menu-item/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-dropdown-menu-item-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 `DropdownMenuItem` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/dropdown-menu-item/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/dropdown-menu-item/__tests__/dropdown-menu-item.test.ts b/registry/remocn-ui/dropdown-menu-item/__tests__/dropdown-menu-item.test.ts
new file mode 100644
index 00000000..22247402
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu-item/__tests__/dropdown-menu-item.test.ts
@@ -0,0 +1,394 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `dropdown-menu-item`.
+ *
+ * Scope:
+ * - registry/remocn-ui/dropdown-menu-item/index.tsx — DropdownMenuItemState
+ * union membership, dropdownMenuItemStyle presets, dropdownMenuItemStyleContext
+ * - registry/remocn-ui/dropdown-menu-item/config.ts — dropdownMenuItemConfig
+ * .controls wiring + .snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/dropdown-menu-item/use-dropdown-menu-item-transition.ts
+ * — tweenDropdownMenuItemStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<DropdownMenuItem>` 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/dropdown-menu-item/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `DropdownMenuItemState` from
+ * `@/registry/remocn-ui/dropdown-menu-item` and the pieces under test never
+ * CALL a Remotion runtime API at import time — `dropdownMenuItemConfig` is a
+ * plain object; `.snippet` is a pure string builder; `dropdownMenuItemStyle`
+ * and `tweenDropdownMenuItemStyle` 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 DropdownMenuItemState,
+ dropdownMenuItemStyle,
+ dropdownMenuItemStyleContext,
+} from "../index";
+import { tweenDropdownMenuItemStyle, DEFAULT_DURATION } from "../use-dropdown-menu-item-transition";
+import { dropdownMenuItemConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The DropdownMenuItemState union, enumerated as a runtime list for membership
+ * checks. Must stay in sync with `export type DropdownMenuItemState` in index.tsx.
+ */
+const VALID_STATES: readonly DropdownMenuItemState[] = ["idle", "hover", "press"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ label?: string;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ dropdownMenuItemConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared DropdownMenuItemStyleContext built from the default light theme.
+ * `dropdownMenuItemStyleContext` takes only `(theme)` — no variant arg.
+ */
+const ctx = dropdownMenuItemStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. DropdownMenuItemState union membership
+// ===========================================================================
+
+describe("DropdownMenuItemState union", () => {
+ it("contains exactly the three documented states", () => {
+ const control = dropdownMenuItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["idle", "hover", "press"]);
+ });
+
+ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {
+ const control = dropdownMenuItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(VALID_STATES).toHaveLength(3);
+ for (const s of VALID_STATES) {
+ expect(control.options).toContain(s);
+ }
+ });
+});
+
+// ===========================================================================
+// 2. dropdownMenuItemConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("dropdownMenuItemConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(dropdownMenuItemConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the three DropdownMenuItemState options in order", () => {
+ const control = dropdownMenuItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["idle", "hover", "press"]);
+ });
+
+ it("defaults to 'hover' so the preview shows the highlighted row", () => {
+ const control = dropdownMenuItemConfig.controls.state;
+ expect(control.default).toBe("hover");
+ });
+
+ it("every option is a member of the DropdownMenuItemState union", () => {
+ const control = dropdownMenuItemConfig.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 DropdownMenuItemState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. dropdownMenuItemConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// ===========================================================================
+
+describe("dropdownMenuItemConfig.snippet: state prop emission", () => {
+ it("emits state=\"idle\" for the idle option", () => {
+ expect(snippet({ state: "idle" })).toContain('state="idle"');
+ });
+
+ it("emits state=\"hover\" for the hover option", () => {
+ expect(snippet({ state: "hover" })).toContain('state="hover"');
+ });
+
+ it("emits state=\"press\" for the press option", () => {
+ expect(snippet({ state: "press" })).toContain('state="press"');
+ });
+
+ it("emits the correct state for every control option", () => {
+ const control = dropdownMenuItemConfig.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("dropdownMenuItemConfig.snippet: import line", () => {
+ it("includes `import { DropdownMenuItem }` from the correct path", () => {
+ const out = snippet({ state: "hover" });
+ expect(out).toContain('import { DropdownMenuItem }');
+ expect(out).toContain('from "@/components/remocn/dropdown-menu-item"');
+ });
+});
+
+describe("dropdownMenuItemConfig.snippet: default props are omitted", () => {
+ // Defaults: label="Profile", mode="light"
+ const allDefaults = snippet({
+ state: "hover",
+ label: "Profile",
+ mode: "light",
+ });
+
+ it("omits label when it equals the default 'Profile'", () => {
+ expect(allDefaults).not.toContain("label=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("dropdownMenuItemConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default label", () => {
+ expect(snippet({ state: "hover", label: "Settings" }))
+ .toContain('label="Settings"');
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "hover", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("dropdownMenuItemConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "hover" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { DropdownMenuItem }')).toBe(true);
+ });
+
+ it("contains a <DropdownMenuItem JSX opening", () => {
+ expect(out).toContain("<DropdownMenuItem");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. dropdownMenuItemStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument.
+// Build ctx from the default light theme and assert each field is populated.
+// ===========================================================================
+
+describe("dropdownMenuItemStyleContext: field types from defaultLightTheme", () => {
+ it("idleBg is a non-empty string", () => {
+ expect(typeof ctx.idleBg).toBe("string");
+ expect(ctx.idleBg.length).toBeGreaterThan(0);
+ });
+
+ it("hoverBg is a non-empty string", () => {
+ expect(typeof ctx.hoverBg).toBe("string");
+ expect(ctx.hoverBg.length).toBeGreaterThan(0);
+ });
+
+ it("pressBg is a non-empty string", () => {
+ expect(typeof ctx.pressBg).toBe("string");
+ expect(ctx.pressBg.length).toBeGreaterThan(0);
+ });
+
+ it("idleFg is a non-empty string", () => {
+ expect(typeof ctx.idleFg).toBe("string");
+ expect(ctx.idleFg.length).toBeGreaterThan(0);
+ });
+});
+
+describe("dropdownMenuItemStyleContext: maps theme tokens correctly", () => {
+ it("idleBg equals theme.popover", () => {
+ expect(ctx.idleBg).toBe(defaultLightTheme.popover);
+ });
+
+ it("hoverBg equals theme.accent", () => {
+ expect(ctx.hoverBg).toBe(defaultLightTheme.accent);
+ });
+
+ it("idleFg equals theme.popoverForeground", () => {
+ expect(ctx.idleFg).toBe(defaultLightTheme.popoverForeground);
+ });
+});
+
+// ===========================================================================
+// 5. dropdownMenuItemStyle presets — pure (state, ctx) => DropdownMenuItemStyle
+// No check icon, no `selected` state (3 states only).
+// Build one ctx from the default light theme, then assert the numeric invariants.
+// ===========================================================================
+
+describe("dropdownMenuItemStyle: idle state", () => {
+ const s = dropdownMenuItemStyle("idle", ctx);
+
+ it("background is ctx.idleBg", () => {
+ expect(s.background).toBe(ctx.idleBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("scale is 1 (full size)", () => {
+ expect(s.scale).toBe(1);
+ });
+});
+
+describe("dropdownMenuItemStyle: hover state", () => {
+ const s = dropdownMenuItemStyle("hover", ctx);
+
+ it("background is ctx.hoverBg", () => {
+ expect(s.background).toBe(ctx.hoverBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("scale is 1 (full size)", () => {
+ expect(s.scale).toBe(1);
+ });
+});
+
+describe("dropdownMenuItemStyle: press state", () => {
+ const s = dropdownMenuItemStyle("press", ctx);
+
+ it("background is ctx.pressBg", () => {
+ expect(s.background).toBe(ctx.pressBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("scale is 0.98 (slightly shrunk)", () => {
+ expect(s.scale).toBe(0.98);
+ });
+});
+
+describe("dropdownMenuItemStyle: scale invariant summary", () => {
+ it("idle: scale=1", () => {
+ expect(dropdownMenuItemStyle("idle", ctx).scale).toBe(1);
+ });
+
+ it("hover: scale=1", () => {
+ expect(dropdownMenuItemStyle("hover", ctx).scale).toBe(1);
+ });
+
+ it("press: scale=0.98", () => {
+ expect(dropdownMenuItemStyle("press", ctx).scale).toBe(0.98);
+ });
+});
+
+// ===========================================================================
+// 6. tweenDropdownMenuItemStyle — pure interpolation between two
+// DropdownMenuItemStyles. Numeric fields lerp; color fields via mixOklch.
+// Concrete expectations: idle → press for scale midpoint math.
+// ===========================================================================
+
+describe("tweenDropdownMenuItemStyle: t=0 returns values equal to `a`", () => {
+ const a = dropdownMenuItemStyle("idle", ctx);
+ const b = dropdownMenuItemStyle("press", ctx);
+ const r = tweenDropdownMenuItemStyle(a, b, 0);
+
+ it("scale equals a.scale at t=0", () => {
+ expect(r.scale).toBeCloseTo(a.scale, 10);
+ });
+
+ it("background is a non-empty string at t=0", () => {
+ expect(typeof r.background).toBe("string");
+ expect(r.background.length).toBeGreaterThan(0);
+ });
+
+ it("labelColor is a non-empty string at t=0", () => {
+ expect(typeof r.labelColor).toBe("string");
+ expect(r.labelColor.length).toBeGreaterThan(0);
+ });
+});
+
+describe("tweenDropdownMenuItemStyle: t=1 returns values equal to `b`", () => {
+ const a = dropdownMenuItemStyle("idle", ctx);
+ const b = dropdownMenuItemStyle("press", ctx);
+ const r = tweenDropdownMenuItemStyle(a, b, 1);
+
+ it("scale equals b.scale at t=1", () => {
+ expect(r.scale).toBeCloseTo(b.scale, 10);
+ });
+
+ it("background is a non-empty string at t=1", () => {
+ expect(typeof r.background).toBe("string");
+ expect(r.background.length).toBeGreaterThan(0);
+ });
+
+ it("labelColor is a non-empty string at t=1", () => {
+ expect(typeof r.labelColor).toBe("string");
+ expect(r.labelColor.length).toBeGreaterThan(0);
+ });
+});
+
+describe("tweenDropdownMenuItemStyle: t=0.5 midpoint numeric lerp (idle → press)", () => {
+ // idle: scale=1
+ // press: scale=0.98
+ const a = dropdownMenuItemStyle("idle", ctx);
+ const b = dropdownMenuItemStyle("press", ctx);
+ const r = tweenDropdownMenuItemStyle(a, b, 0.5);
+
+ it("scale midpoint: 1 → 0.98 gives 0.99", () => {
+ expect(r.scale).toBeCloseTo(0.99, 10);
+ });
+});
+
+describe("tweenDropdownMenuItemStyle: t=0.5 midpoint numeric lerp (hover → idle)", () => {
+ // hover: scale=1
+ // idle: scale=1
+ const a = dropdownMenuItemStyle("hover", ctx);
+ const b = dropdownMenuItemStyle("idle", ctx);
+ const r = tweenDropdownMenuItemStyle(a, b, 0.5);
+
+ it("scale midpoint: 1 → 1 gives 1", () => {
+ expect(r.scale).toBeCloseTo(1, 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 8 (item default — shorter than container's 12)", () => {
+ expect(DEFAULT_DURATION).toBe(8);
+ });
+});
diff --git a/registry/remocn-ui/dropdown-menu-item/config.ts b/registry/remocn-ui/dropdown-menu-item/config.ts
new file mode 100644
index 00000000..3f96caa4
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu-item/config.ts
@@ -0,0 +1,44 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { DropdownMenuItemState } from "@/registry/remocn-ui/dropdown-menu-item";
+
+export const dropdownMenuItemConfig: ComponentConfig = {
+ componentName: "DropdownMenuItem",
+ importPath: "@/components/remocn/dropdown-menu-item",
+ controls: {
+ label: { type: "text", default: "Profile", label: "Label" },
+ state: {
+ type: "select",
+ // Default to `hover` so the preview shows the highlighted row.
+ default: "hover",
+ options: ["idle", "hover", "press"],
+ 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 DropdownMenuItemState) ?? "hover";
+ const label = values.label as string | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (label !== undefined && label !== "Profile")
+ props.push(` label="${label}"`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { DropdownMenuItem } from "@/components/remocn/dropdown-menu-item";
+
+<DropdownMenuItem
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/dropdown-menu-item/index.tsx b/registry/remocn-ui/dropdown-menu-item/index.tsx
new file mode 100644
index 00000000..221cc405
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu-item/index.tsx
@@ -0,0 +1,162 @@
+"use client";
+
+import { mixOklch, type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+
+export type DropdownMenuItemState = "idle" | "hover" | "press";
+
+// ===========================================================================
+// Dropdown-menu-item visual — the COMPLETE animated look for a moment in time.
+// A `state` is a named preset of this visual (`dropdownMenuItemStyle`); the
+// smooth path feeds an interpolated `DropdownMenuItemStyle` straight through.
+// The component is a pure renderer of whichever style it receives.
+// ===========================================================================
+
+export interface DropdownMenuItemStyle {
+ /** Animated row background. */
+ background: string;
+ /** Animated label color. */
+ labelColor: string;
+ /** Row scale: 1 default, 0.98 on press. */
+ scale: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface DropdownMenuItemStyleContext {
+ idleBg: string;
+ hoverBg: string;
+ pressBg: string;
+ idleFg: string;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `dropdownMenuItemStyle(state, ctx)` preset.
+ */
+export function dropdownMenuItemStyleContext(
+ theme: RemocnTheme,
+): DropdownMenuItemStyleContext {
+ return {
+ idleBg: theme.popover,
+ hoverBg: theme.accent,
+ pressBg: mixOklch(theme.accent, theme.foreground, 0.08),
+ idleFg: theme.popoverForeground,
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure
+ * `(state, ctx) => DropdownMenuItemStyle` map. To change how a state looks,
+ * edit one entry.
+ */
+export function dropdownMenuItemStyle(
+ state: DropdownMenuItemState,
+ ctx: DropdownMenuItemStyleContext,
+): DropdownMenuItemStyle {
+ switch (state) {
+ case "hover":
+ return { background: ctx.hoverBg, labelColor: ctx.idleFg, scale: 1 };
+ case "press":
+ return { background: ctx.pressBg, labelColor: ctx.idleFg, scale: 0.98 };
+ default:
+ return { background: ctx.idleBg, labelColor: ctx.idleFg, scale: 1 };
+ }
+}
+
+/** Default row width (px) — matches the dropdown-menu panel. */
+const ROW_WIDTH = 240;
+
+export interface DropdownMenuItemRowProps {
+ /** Resolved animated visual (smooth path); takes precedence over `state`. */
+ style?: DropdownMenuItemStyle;
+ /** Current visual state (snap path). */
+ state?: DropdownMenuItemState;
+ label?: string;
+ /** Row width in px. */
+ width?: number;
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+}
+
+/**
+ * INLINE option row — no full-frame wrapper. Renders one menu row: padding
+ * `8px 12px`, `borderRadius: theme.radius - 2`, label left. This is the shared
+ * visual that `DropdownMenu` reuses for its panel rows.
+ */
+export function DropdownMenuItemRow({
+ style,
+ state = "idle",
+ label = "Profile",
+ width = ROW_WIDTH,
+ theme: themeOverride,
+ mode,
+}: DropdownMenuItemRowProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = dropdownMenuItemStyleContext(theme);
+ const v = style ?? dropdownMenuItemStyle(state, ctx);
+
+ return (
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ width,
+ padding: "8px 12px",
+ borderRadius: theme.radius - 2,
+ background: v.background,
+ color: v.labelColor,
+ transform: `scale(${v.scale})`,
+ fontSize: 14,
+ letterSpacing: "-0.01em",
+ boxSizing: "border-box",
+ }}
+ >
+ <span>{label}</span>
+ </div>
+ );
+}
+
+export interface DropdownMenuItemProps extends DropdownMenuItemRowProps {
+ className?: string;
+}
+
+/**
+ * The standalone registered atom — resolves theme/ctx/style then wraps
+ * `<DropdownMenuItemRow>` in the standard full-frame centering wrapper. This is
+ * what the registry registers and the customizer mounts.
+ */
+export function DropdownMenuItem({
+ style,
+ state = "idle",
+ label = "Profile",
+ width = ROW_WIDTH,
+ theme: themeOverride,
+ mode,
+ className,
+}: DropdownMenuItemProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ background: theme.background,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ <DropdownMenuItemRow
+ style={style}
+ state={state}
+ label={label}
+ width={width}
+ theme={themeOverride}
+ mode={mode}
+ />
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/dropdown-menu-item/use-dropdown-menu-item-transition.ts b/registry/remocn-ui/dropdown-menu-item/use-dropdown-menu-item-transition.ts
new file mode 100644
index 00000000..65706d3f
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu-item/use-dropdown-menu-item-transition.ts
@@ -0,0 +1,76 @@
+"use client";
+
+import {
+ easings,
+ mixOklch,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ dropdownMenuItemStyle,
+ dropdownMenuItemStyleContext,
+ type DropdownMenuItemState,
+ type DropdownMenuItemStyle,
+} from "@/components/remocn/dropdown-menu-item";
+// ^ 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 = 8;
+
+/** Blend two row visuals: numbers lerp, colors via oklch mix. */
+export function tweenDropdownMenuItemStyle(
+ a: DropdownMenuItemStyle,
+ b: DropdownMenuItemStyle,
+ t: number,
+): DropdownMenuItemStyle {
+ return {
+ scale: a.scale + (b.scale - a.scale) * t,
+ background: mixOklch(a.background, b.background, t),
+ labelColor: mixOklch(a.labelColor, b.labelColor, t),
+ };
+}
+
+export interface DropdownMenuItemTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ primary?: string;
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) DropdownMenuItemStyle. The CALLER invokes
+ * this; it reads the frame, the row component does not. Feed the result to
+ * `<DropdownMenuItemRow style={...} />` (or the panel rows) for smooth transitions.
+ */
+export function useDropdownMenuItemTransition(
+ steps: Step<DropdownMenuItemState>[],
+ opts: DropdownMenuItemTransitionOptions = {},
+): DropdownMenuItemStyle {
+ const {
+ theme: themeOverride,
+ mode,
+ primary,
+ speed = 1,
+ defaultDuration = DEFAULT_DURATION,
+ } = opts;
+ const theme = useRemocnTheme(
+ { ...themeOverride, ...(primary ? { primary } : {}) },
+ mode,
+ );
+ const ctx = dropdownMenuItemStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "idle",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenDropdownMenuItemStyle(
+ dropdownMenuItemStyle(from, ctx),
+ dropdownMenuItemStyle(to, ctx),
+ t,
+ );
+}
diff --git a/registry/remocn-ui/dropdown-menu/__tests__/README.md b/registry/remocn-ui/dropdown-menu/__tests__/README.md
new file mode 100644
index 00000000..8a1f91cb
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu/__tests__/README.md
@@ -0,0 +1,131 @@
+# `dropdown-menu` — verification tests
+
+Pure / deterministic verification for the `dropdown-menu` component
+(`registry/remocn-ui/dropdown-menu/`). 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: `DropdownMenuState`
+union membership, `dropdownMenuConfig.controls` wiring,
+`dropdownMenuConfig.snippet` codegen, `dropdownMenuStyle` presets,
+`tweenDropdownMenuStyle` interpolation, and `DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+DropdownMenu ships two complementary paths:
+
+**Snap path** (`state?: DropdownMenuState` prop):
+`DropdownMenu` 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 `dropdownMenuStyle(state, ctx) => DropdownMenuStyle`. State changes
+snap instantly — no tweening inside the component.
+
+**Smooth path** (`style?: DropdownMenuStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`DropdownMenuStyle` to the `style` prop. The caller — typically
+`useDropdownMenuTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenDropdownMenuStyle(from, to, t)`. The `DropdownMenu` component itself
+remains frame-free; it simply renders whatever `DropdownMenuStyle` it receives.
+
+This design keeps `DropdownMenu` 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/dropdown-menu/__tests__
+```
+
+`dropdown-menu.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test
+script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`DropdownMenuState` union** — asserts the two states `["opened", "closed"]`
+ are the complete set (via the real `controls.state.options` list from
+ `config.ts`).
+- **`dropdownMenuConfig.controls.state`** — the customizer control wiring.
+ Asserts a `select` control exists with exactly those two options in order,
+ default `"opened"` (so the preview shows the panel), and that every option is
+ a member of the `DropdownMenuState` union.
+- **`dropdownMenuConfig.snippet`** — REAL pure string builder (high value).
+ Asserts: always emits `state="<state>"` for every option; includes
+ `import { DropdownMenu }` from `@/components/remocn/dropdown-menu`; omits
+ default-equal props (`label="Options"`, `highlightedIndex=-1`, `mode="light"`);
+ EMITS non-default `label`/`highlightedIndex`/`mode` (note: `highlightedIndex=0`
+ IS emitted because the snippet's omit condition is `!== -1`); structural
+ round-trip (starts with import, contains `<DropdownMenu`, ends `/>`).
+- **`dropdownMenuStyleContext`** — exported pure
+ `(theme) => DropdownMenuStyleContext` (takes only `theme`, no variant). Built
+ from `dropdownMenuStyleContext(defaultLightTheme)`. Asserts each leaf field is
+ a non-empty string and `radius` is a number. Also asserts token mapping:
+ `panelBg = theme.popover`, `panelBorder = theme.border`,
+ `triggerFg = theme.foreground`, `mutedFg = theme.mutedForeground`,
+ `radius = theme.radius`. `triggerCtx` and `itemCtx` are asserted as non-null
+ objects (their internals are covered by the button/dropdown-menu-item suites).
+- **`dropdownMenuStyle` presets** — exported pure
+ `(state, ctx) => DropdownMenuStyle`. All four fields are numeric. Asserts
+ per-state invariants:
+ - `closed` → `{ panelOpacity:0, panelScale:0.96, panelTranslateY:-4, chevronRotation:0 }`
+ - `opened` → `{ panelOpacity:1, panelScale:1, panelTranslateY:0, chevronRotation:180 }`
+- **`tweenDropdownMenuStyle`** — exported pure `(a, b, t) => DropdownMenuStyle`.
+ All four 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. Both directions (closed→opened and opened→closed) are verified.
+ Midpoints: `panelOpacity` 0.5, `panelScale` 0.98, `panelTranslateY` -2,
+ `chevronRotation` 90.
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to `12` (container default, longer than item's `8`).
+
+**DropdownMenu render** is a pure `(style | state) => visual` observable only
+via Remotion render, not unit-tested here.
+
+## Import strategy
+
+`dropdown-menu.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `DropdownMenuState`, `dropdownMenuStyle`,
+ `dropdownMenuStyleContext`
+- `../use-dropdown-menu-transition` — relative, for `tweenDropdownMenuStyle`,
+ `DEFAULT_DURATION`
+- `../config` — relative, for `dropdownMenuConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-dropdown-menu-transition.ts` pulls the `remotion`
+module (and React), but neither `dropdownMenuStyle`, `dropdownMenuStyleContext`,
+nor `tweenDropdownMenuStyle` 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)
+
+DropdownMenu 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/dropdown-menu/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-dropdown-menu-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
+`DropdownMenu` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/dropdown-menu/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/dropdown-menu/__tests__/dropdown-menu.test.ts b/registry/remocn-ui/dropdown-menu/__tests__/dropdown-menu.test.ts
new file mode 100644
index 00000000..73a470bc
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu/__tests__/dropdown-menu.test.ts
@@ -0,0 +1,450 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `dropdown-menu`.
+ *
+ * Scope:
+ * - registry/remocn-ui/dropdown-menu/index.tsx — DropdownMenuState union
+ * membership, dropdownMenuStyle presets, dropdownMenuStyleContext
+ * - registry/remocn-ui/dropdown-menu/config.ts — dropdownMenuConfig.controls
+ * wiring + .snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/dropdown-menu/use-dropdown-menu-transition.ts
+ * — tweenDropdownMenuStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<DropdownMenu>` 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/dropdown-menu/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `DropdownMenuState` from `@/registry/remocn-ui/dropdown-menu`
+ * and the pieces under test never CALL a Remotion runtime API at import time —
+ * `dropdownMenuConfig` is a plain object; `.snippet` is a pure string builder;
+ * `dropdownMenuStyle` and `tweenDropdownMenuStyle` 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 DropdownMenuState,
+ dropdownMenuStyle,
+ dropdownMenuStyleContext,
+} from "../index";
+import { tweenDropdownMenuStyle, DEFAULT_DURATION } from "../use-dropdown-menu-transition";
+import { dropdownMenuConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The DropdownMenuState union, enumerated as a runtime list for membership checks.
+ * Must stay in sync with `export type DropdownMenuState` in index.tsx.
+ */
+const VALID_STATES: readonly DropdownMenuState[] = ["opened", "closed"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ label?: string;
+ highlightedIndex?: number;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ dropdownMenuConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared DropdownMenuStyleContext built from the default light theme.
+ * `dropdownMenuStyleContext` takes only `(theme)` — no variant arg.
+ */
+const ctx = dropdownMenuStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. DropdownMenuState union membership
+// ===========================================================================
+
+describe("DropdownMenuState union", () => {
+ it("contains exactly the two documented states", () => {
+ const control = dropdownMenuConfig.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)", () => {
+ const control = dropdownMenuConfig.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. dropdownMenuConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("dropdownMenuConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(dropdownMenuConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the two DropdownMenuState options in order", () => {
+ const control = dropdownMenuConfig.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 shows the panel", () => {
+ const control = dropdownMenuConfig.controls.state;
+ expect(control.default).toBe("opened");
+ });
+
+ it("every option is a member of the DropdownMenuState union", () => {
+ const control = dropdownMenuConfig.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 DropdownMenuState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. dropdownMenuConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// ===========================================================================
+
+describe("dropdownMenuConfig.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 = dropdownMenuConfig.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("dropdownMenuConfig.snippet: import line", () => {
+ it("includes `import { DropdownMenu }` from the correct path", () => {
+ const out = snippet({ state: "opened" });
+ expect(out).toContain('import { DropdownMenu }');
+ expect(out).toContain('from "@/components/remocn/dropdown-menu"');
+ });
+});
+
+describe("dropdownMenuConfig.snippet: default props are omitted", () => {
+ // Defaults: label="Options", highlightedIndex=-1, mode="light"
+ // Note: config default for highlightedIndex is 0, but the omit condition is !== -1,
+ // so highlightedIndex=0 IS emitted. We test the -1 case here (the condition boundary).
+ const allDefaults = snippet({
+ state: "opened",
+ label: "Options",
+ highlightedIndex: -1,
+ mode: "light",
+ });
+
+ it("omits label when it equals the default 'Options'", () => {
+ expect(allDefaults).not.toContain("label=");
+ });
+
+ it("omits highlightedIndex when it equals -1", () => {
+ expect(allDefaults).not.toContain("highlightedIndex=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("dropdownMenuConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default label", () => {
+ expect(snippet({ state: "opened", label: "Account" }))
+ .toContain('label="Account"');
+ });
+
+ it("emits a non-default highlightedIndex (0 is non-default, condition is !== -1)", () => {
+ expect(snippet({ state: "opened", highlightedIndex: 0 }))
+ .toContain("highlightedIndex={0}");
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "opened", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("dropdownMenuConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "opened" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { DropdownMenu }')).toBe(true);
+ });
+
+ it("contains a <DropdownMenu JSX opening", () => {
+ expect(out).toContain("<DropdownMenu");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. dropdownMenuStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument.
+// Build ctx from the default light theme and assert each field is populated.
+// `radius` is a number; all other non-nested fields are non-empty strings.
+// ===========================================================================
+
+describe("dropdownMenuStyleContext: field types from defaultLightTheme", () => {
+ it("panelBg is a non-empty string", () => {
+ expect(typeof ctx.panelBg).toBe("string");
+ expect(ctx.panelBg.length).toBeGreaterThan(0);
+ });
+
+ it("panelBorder is a non-empty string", () => {
+ expect(typeof ctx.panelBorder).toBe("string");
+ expect(ctx.panelBorder.length).toBeGreaterThan(0);
+ });
+
+ it("triggerFg is a non-empty string", () => {
+ expect(typeof ctx.triggerFg).toBe("string");
+ expect(ctx.triggerFg.length).toBeGreaterThan(0);
+ });
+
+ it("mutedFg is a non-empty string", () => {
+ expect(typeof ctx.mutedFg).toBe("string");
+ expect(ctx.mutedFg.length).toBeGreaterThan(0);
+ });
+
+ it("radius is a number", () => {
+ expect(typeof ctx.radius).toBe("number");
+ });
+
+ it("triggerCtx is a non-null object (ButtonStyleContext)", () => {
+ expect(typeof ctx.triggerCtx).toBe("object");
+ expect(ctx.triggerCtx).not.toBeNull();
+ });
+
+ it("itemCtx is a non-null object (DropdownMenuItemStyleContext)", () => {
+ expect(typeof ctx.itemCtx).toBe("object");
+ expect(ctx.itemCtx).not.toBeNull();
+ });
+});
+
+describe("dropdownMenuStyleContext: maps theme tokens correctly", () => {
+ it("panelBg equals theme.popover", () => {
+ expect(ctx.panelBg).toBe(defaultLightTheme.popover);
+ });
+
+ it("panelBorder equals theme.border", () => {
+ expect(ctx.panelBorder).toBe(defaultLightTheme.border);
+ });
+
+ it("triggerFg equals theme.foreground", () => {
+ expect(ctx.triggerFg).toBe(defaultLightTheme.foreground);
+ });
+
+ it("mutedFg equals theme.mutedForeground", () => {
+ expect(ctx.mutedFg).toBe(defaultLightTheme.mutedForeground);
+ });
+
+ it("radius equals theme.radius", () => {
+ expect(ctx.radius).toBe(defaultLightTheme.radius);
+ });
+});
+
+// ===========================================================================
+// 5. dropdownMenuStyle presets — pure (state, ctx) => DropdownMenuStyle
+// All four fields are numeric. Assert per-state invariants:
+// opened → { panelOpacity:1, panelScale:1, panelTranslateY:0, chevronRotation:180 }
+// closed → { panelOpacity:0, panelScale:0.96, panelTranslateY:-4, chevronRotation:0 }
+// ===========================================================================
+
+describe("dropdownMenuStyle: opened state", () => {
+ const s = dropdownMenuStyle("opened", ctx);
+
+ it("panelOpacity is 1 (panel fully visible)", () => {
+ expect(s.panelOpacity).toBe(1);
+ });
+
+ it("panelScale is 1 (panel at full size)", () => {
+ expect(s.panelScale).toBe(1);
+ });
+
+ it("panelTranslateY is 0 (panel at natural position)", () => {
+ expect(s.panelTranslateY).toBe(0);
+ });
+
+ it("chevronRotation is 180 (chevron flipped)", () => {
+ expect(s.chevronRotation).toBe(180);
+ });
+});
+
+describe("dropdownMenuStyle: closed state", () => {
+ const s = dropdownMenuStyle("closed", ctx);
+
+ it("panelOpacity is 0 (panel fully hidden)", () => {
+ expect(s.panelOpacity).toBe(0);
+ });
+
+ it("panelScale is 0.96 (panel slightly shrunk)", () => {
+ expect(s.panelScale).toBe(0.96);
+ });
+
+ it("panelTranslateY is -4 (panel lifted -4px)", () => {
+ expect(s.panelTranslateY).toBe(-4);
+ });
+
+ it("chevronRotation is 0 (chevron pointing down)", () => {
+ expect(s.chevronRotation).toBe(0);
+ });
+});
+
+describe("dropdownMenuStyle: closed/opened invariant", () => {
+ it("closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0", () => {
+ const s = dropdownMenuStyle("closed", ctx);
+ expect(s.panelOpacity).toBe(0);
+ expect(s.panelScale).toBe(0.96);
+ expect(s.panelTranslateY).toBe(-4);
+ expect(s.chevronRotation).toBe(0);
+ });
+
+ it("opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180", () => {
+ const s = dropdownMenuStyle("opened", ctx);
+ expect(s.panelOpacity).toBe(1);
+ expect(s.panelScale).toBe(1);
+ expect(s.panelTranslateY).toBe(0);
+ expect(s.chevronRotation).toBe(180);
+ });
+});
+
+// ===========================================================================
+// 6. tweenDropdownMenuStyle — pure linear interpolation between two
+// DropdownMenuStyles. All four fields are pure numeric lerps.
+// Concrete expectations: closed → opened for midpoint math.
+// ===========================================================================
+
+describe("tweenDropdownMenuStyle: t=0 returns values equal to `a`", () => {
+ const a = dropdownMenuStyle("closed", ctx);
+ const b = dropdownMenuStyle("opened", ctx);
+ const r = tweenDropdownMenuStyle(a, b, 0);
+
+ it("panelOpacity equals a.panelOpacity at t=0", () => {
+ expect(r.panelOpacity).toBeCloseTo(a.panelOpacity, 10);
+ });
+
+ it("panelScale equals a.panelScale at t=0", () => {
+ expect(r.panelScale).toBeCloseTo(a.panelScale, 10);
+ });
+
+ it("panelTranslateY equals a.panelTranslateY at t=0", () => {
+ expect(r.panelTranslateY).toBeCloseTo(a.panelTranslateY, 10);
+ });
+
+ it("chevronRotation equals a.chevronRotation at t=0", () => {
+ expect(r.chevronRotation).toBeCloseTo(a.chevronRotation, 10);
+ });
+});
+
+describe("tweenDropdownMenuStyle: t=1 returns values equal to `b`", () => {
+ const a = dropdownMenuStyle("closed", ctx);
+ const b = dropdownMenuStyle("opened", ctx);
+ const r = tweenDropdownMenuStyle(a, b, 1);
+
+ it("panelOpacity equals b.panelOpacity at t=1", () => {
+ expect(r.panelOpacity).toBeCloseTo(b.panelOpacity, 10);
+ });
+
+ it("panelScale equals b.panelScale at t=1", () => {
+ expect(r.panelScale).toBeCloseTo(b.panelScale, 10);
+ });
+
+ it("panelTranslateY equals b.panelTranslateY at t=1", () => {
+ expect(r.panelTranslateY).toBeCloseTo(b.panelTranslateY, 10);
+ });
+
+ it("chevronRotation equals b.chevronRotation at t=1", () => {
+ expect(r.chevronRotation).toBeCloseTo(b.chevronRotation, 10);
+ });
+});
+
+describe("tweenDropdownMenuStyle: t=0.5 midpoint numeric lerp (closed → opened)", () => {
+ // closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0
+ // opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180
+ const a = dropdownMenuStyle("closed", ctx);
+ const b = dropdownMenuStyle("opened", ctx);
+ const r = tweenDropdownMenuStyle(a, b, 0.5);
+
+ it("panelOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelScale midpoint: 0.96 → 1 gives 0.98", () => {
+ expect(r.panelScale).toBeCloseTo(0.98, 10);
+ });
+
+ it("panelTranslateY midpoint: -4 → 0 gives -2", () => {
+ expect(r.panelTranslateY).toBeCloseTo(-2, 10);
+ });
+
+ it("chevronRotation midpoint: 0 → 180 gives 90", () => {
+ expect(r.chevronRotation).toBeCloseTo(90, 10);
+ });
+});
+
+describe("tweenDropdownMenuStyle: t=0.5 midpoint numeric lerp (opened → closed)", () => {
+ // opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180
+ // closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0
+ const a = dropdownMenuStyle("opened", ctx);
+ const b = dropdownMenuStyle("closed", ctx);
+ const r = tweenDropdownMenuStyle(a, b, 0.5);
+
+ it("panelOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelScale midpoint: 1 → 0.96 gives 0.98", () => {
+ expect(r.panelScale).toBeCloseTo(0.98, 10);
+ });
+
+ it("panelTranslateY midpoint: 0 → -4 gives -2", () => {
+ expect(r.panelTranslateY).toBeCloseTo(-2, 10);
+ });
+
+ it("chevronRotation midpoint: 180 → 0 gives 90", () => {
+ expect(r.chevronRotation).toBeCloseTo(90, 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 (container default — longer than item's 8)", () => {
+ expect(DEFAULT_DURATION).toBe(12);
+ });
+});
diff --git a/registry/remocn-ui/dropdown-menu/config.ts b/registry/remocn-ui/dropdown-menu/config.ts
new file mode 100644
index 00000000..c085fdf8
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu/config.ts
@@ -0,0 +1,52 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { DropdownMenuState } from "@/registry/remocn-ui/dropdown-menu";
+
+export const dropdownMenuConfig: ComponentConfig = {
+ componentName: "DropdownMenu",
+ importPath: "@/components/remocn/dropdown-menu",
+ controls: {
+ label: { type: "text", default: "Options", label: "Label" },
+ state: {
+ type: "select",
+ // Default to `opened` so the preview shows the panel.
+ default: "opened",
+ options: ["opened", "closed"],
+ label: "State",
+ },
+ highlightedIndex: {
+ type: "number",
+ default: 0,
+ label: "Highlighted Index",
+ },
+ 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 DropdownMenuState) ?? "opened";
+ const label = values.label as string | undefined;
+ const highlightedIndex = values.highlightedIndex as number | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (label !== undefined && label !== "Options")
+ props.push(` label="${label}"`);
+ if (highlightedIndex !== undefined && highlightedIndex !== -1)
+ props.push(` highlightedIndex={${highlightedIndex}}`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { DropdownMenu } from "@/components/remocn/dropdown-menu";
+
+<DropdownMenu
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/dropdown-menu/index.tsx b/registry/remocn-ui/dropdown-menu/index.tsx
new file mode 100644
index 00000000..f5896f8f
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu/index.tsx
@@ -0,0 +1,262 @@
+"use client";
+
+import {
+ buttonStyle,
+ buttonStyleContext,
+ type ButtonStyle,
+ type ButtonStyleContext,
+} from "@/components/remocn/button";
+import {
+ DropdownMenuItemRow,
+ dropdownMenuItemStyle,
+ dropdownMenuItemStyleContext,
+ type DropdownMenuItemStyle,
+ type DropdownMenuItemStyleContext,
+} from "@/components/remocn/dropdown-menu-item";
+import { type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+
+export type DropdownMenuState = "opened" | "closed";
+
+// ===========================================================================
+// Dropdown-menu visual — the COMPLETE animated look for a moment in time. A
+// `state` is a named preset of this visual (`dropdownMenuStyle`); the smooth
+// path feeds an interpolated `DropdownMenuStyle` straight through. The
+// component is a pure renderer of whichever style it receives.
+// ===========================================================================
+
+export interface DropdownMenuStyle {
+ /** Panel fade 0 (closed) → 1 (opened). */
+ panelOpacity: number;
+ /** Panel zoom 0.96 (closed) → 1 (opened). */
+ panelScale: number;
+ /** Panel lift -4 (closed) → 0 (opened) px. */
+ panelTranslateY: number;
+ /** Trigger chevron rotation: 0 (closed) → 180 (opened) deg. */
+ chevronRotation: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface DropdownMenuStyleContext {
+ /** Trigger reuses the Button `outline` variant look. */
+ triggerCtx: ButtonStyleContext;
+ panelBg: string;
+ panelBorder: string;
+ triggerFg: string;
+ mutedFg: string;
+ radius: number;
+ /** Row presets for the panel items. */
+ itemCtx: DropdownMenuItemStyleContext;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `dropdownMenuStyle(state, ctx)` preset.
+ */
+export function dropdownMenuStyleContext(
+ theme: RemocnTheme,
+): DropdownMenuStyleContext {
+ return {
+ triggerCtx: buttonStyleContext("outline", theme),
+ panelBg: theme.popover,
+ panelBorder: theme.border,
+ triggerFg: theme.foreground,
+ mutedFg: theme.mutedForeground,
+ radius: theme.radius,
+ itemCtx: dropdownMenuItemStyleContext(theme),
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure
+ * `(state, ctx) => DropdownMenuStyle` map. To change how a state looks, edit
+ * one entry.
+ */
+export function dropdownMenuStyle(
+ state: DropdownMenuState,
+ _ctx: DropdownMenuStyleContext,
+): DropdownMenuStyle {
+ switch (state) {
+ case "opened":
+ return {
+ panelOpacity: 1,
+ panelScale: 1,
+ panelTranslateY: 0,
+ chevronRotation: 180,
+ };
+ default:
+ return {
+ panelOpacity: 0,
+ panelScale: 0.96,
+ panelTranslateY: -4,
+ chevronRotation: 0,
+ };
+ }
+}
+
+/** Trigger + panel width (px). */
+const WIDTH = 240;
+
+export interface DropdownMenuProps {
+ /** Current visual state (snap path). State changes snap (no enter-tweens). */
+ state?: DropdownMenuState;
+ /**
+ * Resolved animated visual (smooth path). When provided, takes precedence
+ * over `state` — feed it an interpolated `DropdownMenuStyle` from
+ * `useDropdownMenuTransition`.
+ */
+ style?: DropdownMenuStyle;
+ /** Trigger label. */
+ label?: string;
+ /** Menu rows. */
+ items?: string[];
+ /** Row currently highlighted (hover); `-1` for none. */
+ highlightedIndex?: number;
+ /** Row currently pressed; `-1` for none. */
+ pressedIndex?: number;
+ /**
+ * Smooth per-row override. When an entry is present it wins over the
+ * index→state derivation, letting the example tween a single row.
+ */
+ itemStyles?: (DropdownMenuItemStyle | undefined)[];
+ /**
+ * Resolved Button visual for the trigger (smooth path). Drive it with
+ * `useButtonTransition` for a hover/press "click". Defaults to the resting
+ * Button `outline` look.
+ */
+ triggerStyle?: ButtonStyle;
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ className?: string;
+}
+
+export function DropdownMenu({
+ state = "closed",
+ style,
+ label = "Options",
+ items = ["Profile", "Billing", "Settings", "Log out"],
+ highlightedIndex = -1,
+ pressedIndex = -1,
+ itemStyles,
+ triggerStyle,
+ theme: themeOverride,
+ mode,
+ className,
+}: DropdownMenuProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+
+ const ctx = dropdownMenuStyleContext(theme);
+ const v = style ?? dropdownMenuStyle(state, ctx);
+
+ // The trigger reuses the Button `outline` look: its resting visual provides
+ // the background + transform; the foreground/border come from the theme.
+ // A driven `triggerStyle` (from `useButtonTransition`) overrides the resting
+ // look so the trigger can animate a hover/press "click".
+ const trigger = triggerStyle ?? buttonStyle("idle", ctx.triggerCtx);
+
+ return (
+ <div
+ className={className}
+ style={{
+ // Opaque — a menu is a self-contained widget (like Button/Accordion),
+ // not a modal overlay.
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "flex-start",
+ justifyContent: "center",
+ paddingTop: 220,
+ background: theme.background,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ <div style={{ position: "relative", width: WIDTH }}>
+ {/* Trigger — the Button `outline` visual, inline-nestable. */}
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 12,
+ width: WIDTH,
+ height: 40,
+ padding: "0 16px",
+ fontSize: 15,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ color: ctx.triggerFg,
+ background: trigger.background,
+ border: `1px solid ${ctx.panelBorder}`,
+ borderRadius: ctx.radius,
+ transform: `translateY(${trigger.translateY}px) scale(${trigger.scale})`,
+ boxSizing: "border-box",
+ }}
+ >
+ <span>{label}</span>
+ <svg
+ width={16}
+ height={16}
+ viewBox="0 0 24 24"
+ fill="none"
+ style={{
+ flexShrink: 0,
+ transform: `rotate(${v.chevronRotation}deg)`,
+ }}
+ >
+ <path
+ d="M6 9l6 6 6-6"
+ stroke={ctx.mutedFg}
+ strokeWidth="2.2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ {/* Panel — sits below the trigger; opacity/scale/translateY animate the
+ reveal, transformOrigin top so it grows downward. */}
+ <div
+ style={{
+ position: "absolute",
+ top: 48,
+ left: 0,
+ width: WIDTH,
+ opacity: v.panelOpacity,
+ transform: `translateY(${v.panelTranslateY}px) scale(${v.panelScale})`,
+ transformOrigin: "top",
+ background: ctx.panelBg,
+ border: `1px solid ${ctx.panelBorder}`,
+ borderRadius: ctx.radius + 2,
+ padding: 4,
+ display: "flex",
+ flexDirection: "column",
+ gap: 2,
+ boxShadow: "0 12px 32px -8px rgba(0,0,0,0.18)",
+ boxSizing: "border-box",
+ }}
+ >
+ {items.map((item, i) => {
+ const override = itemStyles?.[i];
+ const rowState =
+ i === pressedIndex
+ ? "press"
+ : i === highlightedIndex
+ ? "hover"
+ : "idle";
+ const rowStyle =
+ override ?? dropdownMenuItemStyle(rowState, ctx.itemCtx);
+ return (
+ <DropdownMenuItemRow
+ key={item}
+ style={rowStyle}
+ label={item}
+ width={WIDTH - 8}
+ theme={themeOverride}
+ mode={mode}
+ />
+ );
+ })}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/dropdown-menu/use-dropdown-menu-transition.ts b/registry/remocn-ui/dropdown-menu/use-dropdown-menu-transition.ts
new file mode 100644
index 00000000..a8c7db5a
--- /dev/null
+++ b/registry/remocn-ui/dropdown-menu/use-dropdown-menu-transition.ts
@@ -0,0 +1,78 @@
+"use client";
+
+import {
+ easings,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ dropdownMenuStyle,
+ dropdownMenuStyleContext,
+ type DropdownMenuState,
+ type DropdownMenuStyle,
+} from "@/components/remocn/dropdown-menu";
+// ^ 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 menu visuals: all fields are numbers, so lerp each. */
+export function tweenDropdownMenuStyle(
+ a: DropdownMenuStyle,
+ b: DropdownMenuStyle,
+ t: number,
+): DropdownMenuStyle {
+ return {
+ panelOpacity: a.panelOpacity + (b.panelOpacity - a.panelOpacity) * t,
+ panelScale: a.panelScale + (b.panelScale - a.panelScale) * t,
+ panelTranslateY:
+ a.panelTranslateY + (b.panelTranslateY - a.panelTranslateY) * t,
+ chevronRotation:
+ a.chevronRotation + (b.chevronRotation - a.chevronRotation) * t,
+ };
+}
+
+export interface DropdownMenuTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ primary?: string;
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) DropdownMenuStyle. The CALLER invokes
+ * this; it reads the frame, the `<DropdownMenu>` component does not. Feed the
+ * result to `<DropdownMenu style={...} />` for smooth transitions.
+ */
+export function useDropdownMenuTransition(
+ steps: Step<DropdownMenuState>[],
+ opts: DropdownMenuTransitionOptions = {},
+): DropdownMenuStyle {
+ const {
+ theme: themeOverride,
+ mode,
+ primary,
+ speed = 1,
+ defaultDuration = DEFAULT_DURATION,
+ } = opts;
+ const theme = useRemocnTheme(
+ { ...themeOverride, ...(primary ? { primary } : {}) },
+ mode,
+ );
+ const ctx = dropdownMenuStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "closed",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenDropdownMenuStyle(
+ dropdownMenuStyle(from, ctx),
+ dropdownMenuStyle(to, ctx),
+ t,
+ );
+}
diff --git a/registry/remocn-ui/registry.json b/registry/remocn-ui/registry.json
index 889b887f..05237b68 100644
--- a/registry/remocn-ui/registry.json
+++ b/registry/remocn-ui/registry.json
@@ -196,6 +196,86 @@
"target": "components/remocn/use-input-transition.ts"
}
]
+ },
+ {
+ "name": "select-item",
+ "type": "registry:component",
+ "title": "UI Select Item",
+ "description": "A select option row whose idle/hover/press/selected state is a pure function of the timeline; the row background, label color, and check icon are keyframed presets. Composed inside the Select panel.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui"],
+ "files": [
+ {
+ "path": "select-item/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/select-item.tsx"
+ },
+ {
+ "path": "select-item/use-select-item-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-select-item-transition.ts"
+ }
+ ]
+ },
+ {
+ "name": "select",
+ "type": "registry:component",
+ "title": "UI Select",
+ "description": "A select whose opened/closed state is a pure function of the timeline; the trigger reuses the Button primitive and the reveal panel composes SelectItem rows. The panel fade, scale, lift, and chevron are keyframed presets.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui", "button", "select-item"],
+ "files": [
+ {
+ "path": "select/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/select.tsx"
+ },
+ {
+ "path": "select/use-select-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-select-transition.ts"
+ }
+ ]
+ },
+ {
+ "name": "dropdown-menu-item",
+ "type": "registry:component",
+ "title": "UI Dropdown Menu Item",
+ "description": "A dropdown menu action row whose idle/hover/press state is a pure function of the timeline; the row background and label color are keyframed presets. Composed inside the DropdownMenu panel.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui"],
+ "files": [
+ {
+ "path": "dropdown-menu-item/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/dropdown-menu-item.tsx"
+ },
+ {
+ "path": "dropdown-menu-item/use-dropdown-menu-item-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-dropdown-menu-item-transition.ts"
+ }
+ ]
+ },
+ {
+ "name": "dropdown-menu",
+ "type": "registry:component",
+ "title": "UI Dropdown Menu",
+ "description": "A dropdown menu whose opened/closed state is a pure function of the timeline; the trigger reuses the Button primitive and the reveal panel composes DropdownMenuItem rows. The panel fade, scale, lift, and chevron are keyframed presets.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["remocn-ui", "button", "dropdown-menu-item"],
+ "files": [
+ {
+ "path": "dropdown-menu/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/dropdown-menu.tsx"
+ },
+ {
+ "path": "dropdown-menu/use-dropdown-menu-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-dropdown-menu-transition.ts"
+ }
+ ]
}
]
}
diff --git a/registry/remocn-ui/select-item/__tests__/README.md b/registry/remocn-ui/select-item/__tests__/README.md
new file mode 100644
index 00000000..0904be2a
--- /dev/null
+++ b/registry/remocn-ui/select-item/__tests__/README.md
@@ -0,0 +1,130 @@
+# `select-item` — verification tests
+
+Pure / deterministic verification for the `select-item` component
+(`registry/remocn-ui/select-item/`). 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: `SelectItemState`
+union membership, `selectItemConfig.controls` wiring, `selectItemConfig.snippet`
+codegen, `selectItemStyle` presets, `tweenSelectItemStyle` interpolation, and
+`DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+SelectItem ships two complementary paths:
+
+**Snap path** (`state?: SelectItemState` prop):
+`SelectItem` 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
+`selectItemStyle(state, ctx) => SelectItemStyle`. State changes snap instantly —
+no tweening inside the component.
+
+**Smooth path** (`style?: SelectItemStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`SelectItemStyle` to the `style` prop. The caller — typically
+`useSelectItemTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenSelectItemStyle(from, to, t)`. The `SelectItem` component itself remains
+frame-free; it simply renders whatever `SelectItemStyle` it receives.
+
+This design keeps `SelectItem` pure-testable (no Remotion render context needed)
+while still supporting smooth 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/select-item/__tests__
+```
+
+`select-item.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test
+script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`SelectItemState` union** — asserts the four states `["idle", "hover",
+ "press", "selected"]` are the complete set (via the real
+ `controls.state.options` list from `config.ts`).
+- **`selectItemConfig.controls.state`** — the customizer control wiring. Asserts
+ a `select` control exists with exactly those four options in order, default
+ `"selected"` (so the preview shows the check icon + accent), and that every
+ option is a member of the `SelectItemState` union.
+- **`selectItemConfig.snippet`** — REAL pure string builder (high value).
+ Asserts: always emits `state="<state>"` for every option; includes
+ `import { SelectItem }` from `@/components/remocn/select-item`; omits
+ default-equal props (`label="Banana"`, `mode="light"`); EMITS non-default
+ `label`/`mode`; structural round-trip (starts with import, contains
+ `<SelectItem`, ends `/>`).
+- **`selectItemStyleContext`** — exported pure `(theme) => SelectItemStyleContext`
+ (takes only `theme`, no variant). Built from
+ `selectItemStyleContext(defaultLightTheme)`. Asserts each field is a non-empty
+ string. Also asserts token mapping: `idleBg = theme.popover`,
+ `hoverBg = theme.accent`, `selectedBg = theme.accent`,
+ `idleFg = theme.popoverForeground`, `selectedFg = theme.accentForeground`,
+ `check = theme.primary`.
+- **`selectItemStyle` presets** — exported pure `(state, ctx) => SelectItemStyle`.
+ Asserts per-state invariants:
+ - `idle` → `{ background: idleBg, labelColor: idleFg, checkOpacity: 0, scale: 1 }`
+ - `hover` → `{ background: hoverBg, labelColor: idleFg, checkOpacity: 0, scale: 1 }`
+ - `press` → `{ background: pressBg, labelColor: idleFg, checkOpacity: 0, scale: 0.98 }`
+ - `selected` → `{ background: selectedBg, labelColor: selectedFg, checkOpacity: 1, scale: 1 }`
+- **`tweenSelectItemStyle`** — exported pure `(a, b, t) => SelectItemStyle`.
+ Numeric fields (`checkOpacity`, `scale`) lerp; color fields (`background`,
+ `labelColor`) go through `mixOklch` (tested as non-empty strings). Asserts: at
+ t=0 numeric fields equal `a`; at t=1 they equal `b`; at t=0.5 each numeric
+ field is the exact midpoint. Two transitions exercised: idle→selected
+ (checkOpacity 0→1 gives 0.5) and idle→press (scale 1→0.98 gives 0.99).
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to `8` (item default, shorter than the container's `12`).
+
+**SelectItem render** is a pure `(style | state) => visual` observable only via
+Remotion render, not unit-tested here.
+
+## Import strategy
+
+`select-item.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `SelectItemState`, `selectItemStyle`,
+ `selectItemStyleContext`
+- `../use-select-item-transition` — relative, for `tweenSelectItemStyle`,
+ `DEFAULT_DURATION`
+- `../config` — relative, for `selectItemConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-select-item-transition.ts` pulls the `remotion`
+module (and React), but neither `selectItemStyle`, `selectItemStyleContext`, nor
+`tweenSelectItemStyle` 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)
+
+SelectItem 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/select-item/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-select-item-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
+`SelectItem` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/select-item/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/select-item/__tests__/select-item.test.ts b/registry/remocn-ui/select-item/__tests__/select-item.test.ts
new file mode 100644
index 00000000..05e7edd6
--- /dev/null
+++ b/registry/remocn-ui/select-item/__tests__/select-item.test.ts
@@ -0,0 +1,484 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `select-item`.
+ *
+ * Scope:
+ * - registry/remocn-ui/select-item/index.tsx — SelectItemState union membership,
+ * selectItemStyle presets, selectItemStyleContext
+ * - registry/remocn-ui/select-item/config.ts — selectItemConfig.controls wiring
+ * + selectItemConfig.snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/select-item/use-select-item-transition.ts
+ * — tweenSelectItemStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<SelectItem>` 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/select-item/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `SelectItemState` from `@/registry/remocn-ui/select-item`
+ * and the pieces under test never CALL a Remotion runtime API at import time —
+ * `selectItemConfig` is a plain object; `.snippet` is a pure string builder;
+ * `selectItemStyle` and `tweenSelectItemStyle` 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 SelectItemState,
+ selectItemStyle,
+ selectItemStyleContext,
+} from "../index";
+import { tweenSelectItemStyle, DEFAULT_DURATION } from "../use-select-item-transition";
+import { selectItemConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The SelectItemState union, enumerated as a runtime list for membership checks.
+ * Must stay in sync with `export type SelectItemState` in index.tsx.
+ */
+const VALID_STATES: readonly SelectItemState[] = ["idle", "hover", "press", "selected"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ label?: string;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ selectItemConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared SelectItemStyleContext built from the default light theme.
+ * `selectItemStyleContext` takes only `(theme)` — no variant arg.
+ */
+const ctx = selectItemStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. SelectItemState union membership
+// ===========================================================================
+
+describe("SelectItemState union", () => {
+ it("contains exactly the four documented states", () => {
+ const control = selectItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["idle", "hover", "press", "selected"]);
+ });
+
+ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {
+ const control = selectItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(VALID_STATES).toHaveLength(4);
+ for (const s of VALID_STATES) {
+ expect(control.options).toContain(s);
+ }
+ });
+});
+
+// ===========================================================================
+// 2. selectItemConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("selectItemConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(selectItemConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the four SelectItemState options in order", () => {
+ const control = selectItemConfig.controls.state;
+ if (control.type !== "select") throw new Error("state control must be a select");
+ expect(control.options).toEqual(["idle", "hover", "press", "selected"]);
+ });
+
+ it("defaults to 'selected' so the preview shows the check icon + accent", () => {
+ const control = selectItemConfig.controls.state;
+ expect(control.default).toBe("selected");
+ });
+
+ it("every option is a member of the SelectItemState union", () => {
+ const control = selectItemConfig.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 SelectItemState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. selectItemConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// ===========================================================================
+
+describe("selectItemConfig.snippet: state prop emission", () => {
+ it("emits state=\"idle\" for the idle option", () => {
+ expect(snippet({ state: "idle" })).toContain('state="idle"');
+ });
+
+ it("emits state=\"hover\" for the hover option", () => {
+ expect(snippet({ state: "hover" })).toContain('state="hover"');
+ });
+
+ it("emits state=\"press\" for the press option", () => {
+ expect(snippet({ state: "press" })).toContain('state="press"');
+ });
+
+ it("emits state=\"selected\" for the selected option", () => {
+ expect(snippet({ state: "selected" })).toContain('state="selected"');
+ });
+
+ it("emits the correct state for every control option", () => {
+ const control = selectItemConfig.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("selectItemConfig.snippet: import line", () => {
+ it("includes `import { SelectItem }` from the correct path", () => {
+ const out = snippet({ state: "selected" });
+ expect(out).toContain('import { SelectItem }');
+ expect(out).toContain('from "@/components/remocn/select-item"');
+ });
+});
+
+describe("selectItemConfig.snippet: default props are omitted", () => {
+ // Defaults: label="Banana", mode="light"
+ const allDefaults = snippet({
+ state: "selected",
+ label: "Banana",
+ mode: "light",
+ });
+
+ it("omits label when it equals the default 'Banana'", () => {
+ expect(allDefaults).not.toContain("label=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("selectItemConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default label", () => {
+ expect(snippet({ state: "selected", label: "Mango" }))
+ .toContain('label="Mango"');
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "selected", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("selectItemConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "selected" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { SelectItem }')).toBe(true);
+ });
+
+ it("contains a <SelectItem JSX opening", () => {
+ expect(out).toContain("<SelectItem");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. selectItemStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument.
+// Build ctx from the default light theme and assert each field is populated.
+// ===========================================================================
+
+describe("selectItemStyleContext: field types from defaultLightTheme", () => {
+ it("idleBg is a non-empty string", () => {
+ expect(typeof ctx.idleBg).toBe("string");
+ expect(ctx.idleBg.length).toBeGreaterThan(0);
+ });
+
+ it("hoverBg is a non-empty string", () => {
+ expect(typeof ctx.hoverBg).toBe("string");
+ expect(ctx.hoverBg.length).toBeGreaterThan(0);
+ });
+
+ it("pressBg is a non-empty string", () => {
+ expect(typeof ctx.pressBg).toBe("string");
+ expect(ctx.pressBg.length).toBeGreaterThan(0);
+ });
+
+ it("selectedBg is a non-empty string", () => {
+ expect(typeof ctx.selectedBg).toBe("string");
+ expect(ctx.selectedBg.length).toBeGreaterThan(0);
+ });
+
+ it("idleFg is a non-empty string", () => {
+ expect(typeof ctx.idleFg).toBe("string");
+ expect(ctx.idleFg.length).toBeGreaterThan(0);
+ });
+
+ it("selectedFg is a non-empty string", () => {
+ expect(typeof ctx.selectedFg).toBe("string");
+ expect(ctx.selectedFg.length).toBeGreaterThan(0);
+ });
+
+ it("check is a non-empty string", () => {
+ expect(typeof ctx.check).toBe("string");
+ expect(ctx.check.length).toBeGreaterThan(0);
+ });
+});
+
+describe("selectItemStyleContext: maps theme tokens correctly", () => {
+ it("idleBg equals theme.popover", () => {
+ expect(ctx.idleBg).toBe(defaultLightTheme.popover);
+ });
+
+ it("hoverBg equals theme.accent", () => {
+ expect(ctx.hoverBg).toBe(defaultLightTheme.accent);
+ });
+
+ it("selectedBg equals theme.accent", () => {
+ expect(ctx.selectedBg).toBe(defaultLightTheme.accent);
+ });
+
+ it("idleFg equals theme.popoverForeground", () => {
+ expect(ctx.idleFg).toBe(defaultLightTheme.popoverForeground);
+ });
+
+ it("selectedFg equals theme.accentForeground", () => {
+ expect(ctx.selectedFg).toBe(defaultLightTheme.accentForeground);
+ });
+
+ it("check equals theme.primary", () => {
+ expect(ctx.check).toBe(defaultLightTheme.primary);
+ });
+});
+
+// ===========================================================================
+// 5. selectItemStyle presets — pure (state, ctx) => SelectItemStyle
+// Build one ctx from the default light theme, then assert the numeric
+// invariants for every state.
+// ===========================================================================
+
+describe("selectItemStyle: idle state", () => {
+ const s = selectItemStyle("idle", ctx);
+
+ it("background is ctx.idleBg", () => {
+ expect(s.background).toBe(ctx.idleBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("checkOpacity is 0 (no check icon)", () => {
+ expect(s.checkOpacity).toBe(0);
+ });
+
+ it("scale is 1 (full size)", () => {
+ expect(s.scale).toBe(1);
+ });
+});
+
+describe("selectItemStyle: hover state", () => {
+ const s = selectItemStyle("hover", ctx);
+
+ it("background is ctx.hoverBg", () => {
+ expect(s.background).toBe(ctx.hoverBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("checkOpacity is 0 (no check icon)", () => {
+ expect(s.checkOpacity).toBe(0);
+ });
+
+ it("scale is 1 (full size)", () => {
+ expect(s.scale).toBe(1);
+ });
+});
+
+describe("selectItemStyle: press state", () => {
+ const s = selectItemStyle("press", ctx);
+
+ it("background is ctx.pressBg", () => {
+ expect(s.background).toBe(ctx.pressBg);
+ });
+
+ it("labelColor is ctx.idleFg", () => {
+ expect(s.labelColor).toBe(ctx.idleFg);
+ });
+
+ it("checkOpacity is 0 (no check icon)", () => {
+ expect(s.checkOpacity).toBe(0);
+ });
+
+ it("scale is 0.98 (slightly shrunk)", () => {
+ expect(s.scale).toBe(0.98);
+ });
+});
+
+describe("selectItemStyle: selected state", () => {
+ const s = selectItemStyle("selected", ctx);
+
+ it("background is ctx.selectedBg", () => {
+ expect(s.background).toBe(ctx.selectedBg);
+ });
+
+ it("labelColor is ctx.selectedFg", () => {
+ expect(s.labelColor).toBe(ctx.selectedFg);
+ });
+
+ it("checkOpacity is 1 (check icon fully visible)", () => {
+ expect(s.checkOpacity).toBe(1);
+ });
+
+ it("scale is 1 (full size)", () => {
+ expect(s.scale).toBe(1);
+ });
+});
+
+describe("selectItemStyle: state invariant summary", () => {
+ it("idle: checkOpacity=0, scale=1", () => {
+ const s = selectItemStyle("idle", ctx);
+ expect(s.checkOpacity).toBe(0);
+ expect(s.scale).toBe(1);
+ });
+
+ it("hover: checkOpacity=0, scale=1", () => {
+ const s = selectItemStyle("hover", ctx);
+ expect(s.checkOpacity).toBe(0);
+ expect(s.scale).toBe(1);
+ });
+
+ it("press: checkOpacity=0, scale=0.98", () => {
+ const s = selectItemStyle("press", ctx);
+ expect(s.checkOpacity).toBe(0);
+ expect(s.scale).toBe(0.98);
+ });
+
+ it("selected: checkOpacity=1, scale=1", () => {
+ const s = selectItemStyle("selected", ctx);
+ expect(s.checkOpacity).toBe(1);
+ expect(s.scale).toBe(1);
+ });
+});
+
+// ===========================================================================
+// 6. tweenSelectItemStyle — pure linear interpolation between two SelectItemStyles.
+// Numeric fields lerp; color fields go through mixOklch (tested as non-empty strings).
+// Concrete expectations: idle → selected for numeric midpoint math.
+// ===========================================================================
+
+describe("tweenSelectItemStyle: t=0 returns values equal to `a`", () => {
+ const a = selectItemStyle("idle", ctx);
+ const b = selectItemStyle("selected", ctx);
+ const r = tweenSelectItemStyle(a, b, 0);
+
+ it("checkOpacity equals a.checkOpacity at t=0", () => {
+ expect(r.checkOpacity).toBeCloseTo(a.checkOpacity, 10);
+ });
+
+ it("scale equals a.scale at t=0", () => {
+ expect(r.scale).toBeCloseTo(a.scale, 10);
+ });
+
+ it("background is a non-empty string at t=0", () => {
+ expect(typeof r.background).toBe("string");
+ expect(r.background.length).toBeGreaterThan(0);
+ });
+
+ it("labelColor is a non-empty string at t=0", () => {
+ expect(typeof r.labelColor).toBe("string");
+ expect(r.labelColor.length).toBeGreaterThan(0);
+ });
+});
+
+describe("tweenSelectItemStyle: t=1 returns values equal to `b`", () => {
+ const a = selectItemStyle("idle", ctx);
+ const b = selectItemStyle("selected", ctx);
+ const r = tweenSelectItemStyle(a, b, 1);
+
+ it("checkOpacity equals b.checkOpacity at t=1", () => {
+ expect(r.checkOpacity).toBeCloseTo(b.checkOpacity, 10);
+ });
+
+ it("scale equals b.scale at t=1", () => {
+ expect(r.scale).toBeCloseTo(b.scale, 10);
+ });
+
+ it("background is a non-empty string at t=1", () => {
+ expect(typeof r.background).toBe("string");
+ expect(r.background.length).toBeGreaterThan(0);
+ });
+
+ it("labelColor is a non-empty string at t=1", () => {
+ expect(typeof r.labelColor).toBe("string");
+ expect(r.labelColor.length).toBeGreaterThan(0);
+ });
+});
+
+describe("tweenSelectItemStyle: t=0.5 midpoint numeric lerp (idle → selected)", () => {
+ // idle: checkOpacity=0, scale=1
+ // selected: checkOpacity=1, scale=1
+ const a = selectItemStyle("idle", ctx);
+ const b = selectItemStyle("selected", ctx);
+ const r = tweenSelectItemStyle(a, b, 0.5);
+
+ it("checkOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.checkOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("scale midpoint: 1 → 1 gives 1", () => {
+ expect(r.scale).toBeCloseTo(1, 10);
+ });
+});
+
+describe("tweenSelectItemStyle: t=0.5 midpoint numeric lerp (idle → press)", () => {
+ // idle: scale=1
+ // press: scale=0.98
+ const a = selectItemStyle("idle", ctx);
+ const b = selectItemStyle("press", ctx);
+ const r = tweenSelectItemStyle(a, b, 0.5);
+
+ it("scale midpoint: 1 → 0.98 gives 0.99", () => {
+ expect(r.scale).toBeCloseTo(0.99, 10);
+ });
+
+ it("checkOpacity midpoint: 0 → 0 gives 0", () => {
+ expect(r.checkOpacity).toBeCloseTo(0, 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 8 (item default — shorter than container's 12)", () => {
+ expect(DEFAULT_DURATION).toBe(8);
+ });
+});
diff --git a/registry/remocn-ui/select-item/config.ts b/registry/remocn-ui/select-item/config.ts
new file mode 100644
index 00000000..e05df26d
--- /dev/null
+++ b/registry/remocn-ui/select-item/config.ts
@@ -0,0 +1,44 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { SelectItemState } from "@/registry/remocn-ui/select-item";
+
+export const selectItemConfig: ComponentConfig = {
+ componentName: "SelectItem",
+ importPath: "@/components/remocn/select-item",
+ controls: {
+ label: { type: "text", default: "Banana", label: "Label" },
+ state: {
+ type: "select",
+ // Default to `selected` so the preview shows the check icon + accent.
+ default: "selected",
+ options: ["idle", "hover", "press", "selected"],
+ 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 SelectItemState) ?? "selected";
+ const label = values.label as string | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (label !== undefined && label !== "Banana")
+ props.push(` label="${label}"`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { SelectItem } from "@/components/remocn/select-item";
+
+<SelectItem
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/select-item/index.tsx b/registry/remocn-ui/select-item/index.tsx
new file mode 100644
index 00000000..1555ae32
--- /dev/null
+++ b/registry/remocn-ui/select-item/index.tsx
@@ -0,0 +1,227 @@
+"use client";
+
+import { mixOklch, type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+
+export type SelectItemState = "idle" | "hover" | "press" | "selected";
+
+export interface SelectItemProps {
+ /** Current visual state (snap path). State changes snap (no enter-tweens). */
+ state?: SelectItemState;
+ /**
+ * Resolved animated visual (smooth path). When provided, takes precedence over
+ * `state` — feed it an interpolated `SelectItemStyle` from `useSelectItemTransition`.
+ */
+ style?: SelectItemStyle;
+ /** Option text. */
+ label?: string;
+ /** Row width (px). Matches the panel width when composed in `Select`. */
+ width?: number;
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ className?: string;
+}
+
+/** Standalone row width (px) when the atom is mounted on its own. */
+const ROW_WIDTH = 260;
+
+// ===========================================================================
+// Select-item visual — the COMPLETE animated look for a moment in time. A
+// `state` is a named preset of this visual (`selectItemStyle`); the smooth path
+// feeds an interpolated `SelectItemStyle` straight through. The component is a
+// pure renderer of whichever `SelectItemStyle` it receives.
+// ===========================================================================
+
+export interface SelectItemStyle {
+ /** Animated row background (a concrete color, never "transparent"). */
+ background: string;
+ /** Animated label color. */
+ labelColor: string;
+ /** Check-icon opacity: 0 unless `selected` → 1. */
+ checkOpacity: number;
+ /** Row zoom: 1 default, 0.98 on press. */
+ scale: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface SelectItemStyleContext {
+ idleBg: string;
+ hoverBg: string;
+ pressBg: string;
+ selectedBg: string;
+ idleFg: string;
+ selectedFg: string;
+ check: string;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `selectItemStyle(state, ctx)` preset.
+ */
+export function selectItemStyleContext(
+ theme: RemocnTheme,
+): SelectItemStyleContext {
+ return {
+ idleBg: theme.popover,
+ hoverBg: theme.accent,
+ pressBg: mixOklch(theme.accent, theme.foreground, 0.08),
+ selectedBg: theme.accent,
+ idleFg: theme.popoverForeground,
+ selectedFg: theme.accentForeground,
+ check: theme.primary,
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => SelectItemStyle`
+ * map. To change how a state looks, edit one entry.
+ */
+export function selectItemStyle(
+ state: SelectItemState,
+ ctx: SelectItemStyleContext,
+): SelectItemStyle {
+ switch (state) {
+ case "hover":
+ return {
+ background: ctx.hoverBg,
+ labelColor: ctx.idleFg,
+ checkOpacity: 0,
+ scale: 1,
+ };
+ case "press":
+ return {
+ background: ctx.pressBg,
+ labelColor: ctx.idleFg,
+ checkOpacity: 0,
+ scale: 0.98,
+ };
+ case "selected":
+ return {
+ background: ctx.selectedBg,
+ labelColor: ctx.selectedFg,
+ checkOpacity: 1,
+ scale: 1,
+ };
+ default:
+ return {
+ background: ctx.idleBg,
+ labelColor: ctx.idleFg,
+ checkOpacity: 0,
+ scale: 1,
+ };
+ }
+}
+
+/** Props for the inline row — the shared visual that `Select` reuses. */
+export interface SelectItemRowProps {
+ /** Resolved animated visual (smooth path); wins over `state` when present. */
+ style?: SelectItemStyle;
+ /** Current visual state (snap path) when no `style` is supplied. */
+ state?: SelectItemState;
+ /** Pre-derived ctx (the container passes its shared one to avoid re-resolving). */
+ ctx: SelectItemStyleContext;
+ label: string;
+ width: number;
+ /** Row corner radius (px). */
+ radius: number;
+ /** Check-icon color. */
+ check: string;
+}
+
+/**
+ * INLINE option row — no full-frame wrapper. One row of a select panel: label
+ * left, check icon right (opacity from style). The `Select` container renders a
+ * column of these; the standalone `SelectItem` wraps one in a centering frame.
+ */
+export function SelectItemRow({
+ style,
+ state = "idle",
+ ctx,
+ label,
+ width,
+ radius,
+ check,
+}: SelectItemRowProps) {
+ const v = style ?? selectItemStyle(state, ctx);
+ return (
+ <div
+ className={undefined}
+ style={{
+ width,
+ boxSizing: "border-box",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 12,
+ padding: "8px 12px",
+ borderRadius: radius,
+ transform: `scale(${v.scale})`,
+ background: v.background,
+ color: v.labelColor,
+ fontSize: 14,
+ letterSpacing: "-0.01em",
+ }}
+ >
+ <span>{label}</span>
+ <svg
+ width={16}
+ height={16}
+ viewBox="0 0 24 24"
+ fill="none"
+ style={{ flexShrink: 0, opacity: v.checkOpacity }}
+ >
+ <path
+ d="M5 12.5l4.5 4.5L19 7"
+ stroke={check}
+ strokeWidth="2.4"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ );
+}
+
+/**
+ * Standalone option-row atom — resolves theme/ctx/style then wraps a single
+ * `<SelectItemRow>` in the standard full-frame centering wrapper. THIS is what
+ * the registry registers and the customizer mounts. The `Select` container does
+ * NOT use this — it reuses `SelectItemRow` directly inside its panel.
+ */
+export function SelectItem({
+ state = "idle",
+ style,
+ label = "Banana",
+ width = ROW_WIDTH,
+ theme: themeOverride,
+ mode,
+ className,
+}: SelectItemProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = selectItemStyleContext(theme);
+
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ background: theme.background,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ <SelectItemRow
+ style={style}
+ state={state}
+ ctx={ctx}
+ label={label}
+ width={width}
+ radius={theme.radius - 2}
+ check={ctx.check}
+ />
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/select-item/use-select-item-transition.ts b/registry/remocn-ui/select-item/use-select-item-transition.ts
new file mode 100644
index 00000000..3be365a9
--- /dev/null
+++ b/registry/remocn-ui/select-item/use-select-item-transition.ts
@@ -0,0 +1,68 @@
+"use client";
+
+import {
+ easings,
+ mixOklch,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ selectItemStyle,
+ selectItemStyleContext,
+ type SelectItemState,
+ type SelectItemStyle,
+} from "@/components/remocn/select-item";
+// ^ 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 = 8;
+
+/** Blend two select-item visuals: numbers lerp, colors via oklch mix. */
+export function tweenSelectItemStyle(
+ a: SelectItemStyle,
+ b: SelectItemStyle,
+ t: number,
+): SelectItemStyle {
+ return {
+ background: mixOklch(a.background, b.background, t),
+ labelColor: mixOklch(a.labelColor, b.labelColor, t),
+ checkOpacity: a.checkOpacity + (b.checkOpacity - a.checkOpacity) * t,
+ scale: a.scale + (b.scale - a.scale) * t,
+ };
+}
+
+export interface SelectItemTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) SelectItemStyle. The CALLER invokes this;
+ * it reads the frame, the `<SelectItem>` component does not. Feed the result to
+ * `<SelectItem style={...} />` (or a `SelectItemRow`) for smooth transitions.
+ */
+export function useSelectItemTransition(
+ steps: Step<SelectItemState>[],
+ opts: SelectItemTransitionOptions = {},
+): SelectItemStyle {
+ const { theme: themeOverride, mode, speed = 1, defaultDuration = DEFAULT_DURATION } =
+ opts;
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = selectItemStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "idle",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenSelectItemStyle(
+ selectItemStyle(from, ctx),
+ selectItemStyle(to, ctx),
+ t,
+ );
+}
diff --git a/registry/remocn-ui/select/__tests__/README.md b/registry/remocn-ui/select/__tests__/README.md
new file mode 100644
index 00000000..0d61d39e
--- /dev/null
+++ b/registry/remocn-ui/select/__tests__/README.md
@@ -0,0 +1,127 @@
+# `select` — verification tests
+
+Pure / deterministic verification for the `select` component
+(`registry/remocn-ui/select/`). 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: `SelectState`
+union membership, `selectConfig.controls` wiring, `selectConfig.snippet`
+codegen, `selectStyle` presets, `tweenSelectStyle` interpolation, and
+`DEFAULT_DURATION`.
+
+## Animation model — pure snap + opt-in smooth path
+
+Select ships two complementary paths:
+
+**Snap path** (`state?: SelectState` prop):
+`Select` 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
+`selectStyle(state, ctx) => SelectStyle`. State changes snap instantly —
+no tweening inside the component.
+
+**Smooth path** (`style?: SelectStyle` prop):
+Callers opt in to smooth transitions by passing a pre-interpolated
+`SelectStyle` to the `style` prop. The caller — typically
+`useSelectTransition` — reads `useCurrentFrame()` and calls
+`useStateTransition` from `core/timeline.ts` to compute
+`{ from, to, progress }`, then blends the two presets via
+`tweenSelectStyle(from, to, t)`. The `Select` component itself remains
+frame-free; it simply renders whatever `SelectStyle` it receives.
+
+This design keeps `Select` 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/select/__tests__
+```
+
+`select.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test
+script or framework dep is added to `package.json`.
+
+## What is covered
+
+- **`SelectState` union** — asserts the two states `["opened", "closed"]` are
+ the complete set (via the real `controls.state.options` list from `config.ts`).
+- **`selectConfig.controls.state`** — the customizer control wiring. Asserts a
+ `select` control exists with exactly those two options in order, default
+ `"opened"` (so the preview shows the revealed panel), and that every option is
+ a member of the `SelectState` union.
+- **`selectConfig.snippet`** — REAL pure string builder (high value). Asserts:
+ always emits `state="<state>"` for every option; includes `import { Select }`
+ from `@/components/remocn/select`; omits default-equal props
+ (`label="Select a fruit"`, `selectedIndex=-1`, `highlightedIndex=-1`,
+ `mode="light"`); EMITS non-default `label`/`selectedIndex`/`highlightedIndex`
+ /`mode`; structural round-trip (starts with import, contains `<Select`, ends
+ `/>`).
+- **`selectStyleContext`** — exported pure `(theme) => SelectStyleContext`
+ (takes only `theme`, no variant). Built from
+ `selectStyleContext(defaultLightTheme)`. Asserts each leaf field is a non-empty
+ string and `radius` is a number. Also asserts token mapping:
+ `panelBg = theme.popover`, `panelBorder = theme.border`,
+ `triggerFg = theme.foreground`, `mutedFg = theme.mutedForeground`,
+ `radius = theme.radius`. `triggerCtx` and `itemCtx` are asserted as non-null
+ objects (their internals are covered by the button/select-item suites).
+- **`selectStyle` presets** — exported pure `(state, ctx) => SelectStyle`.
+ All four fields are numeric. Asserts per-state invariants:
+ - `closed` → `{ panelOpacity:0, panelScale:0.96, panelTranslateY:-4, chevronRotation:0 }`
+ - `opened` → `{ panelOpacity:1, panelScale:1, panelTranslateY:0, chevronRotation:180 }`
+- **`tweenSelectStyle`** — exported pure `(a, b, t) => SelectStyle`. All four
+ 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.
+ Both directions (closed→opened and opened→closed) are verified. Midpoints:
+ `panelOpacity` 0.5, `panelScale` 0.98, `panelTranslateY` -2,
+ `chevronRotation` 90.
+- **`DEFAULT_DURATION`** — sanity-checks the exported constant is a positive
+ number equal to `12` (container default, longer than item's `8`).
+
+**Select render** is a pure `(style | state) => visual` observable only via
+Remotion render, not unit-tested here.
+
+## Import strategy
+
+`select.test.ts` imports via a mix of **relative paths** and the
+**`@/lib/remocn-ui` tsconfig alias**:
+
+- `../index` — relative, for `SelectState`, `selectStyle`, `selectStyleContext`
+- `../use-select-transition` — relative, for `tweenSelectStyle`, `DEFAULT_DURATION`
+- `../config` — relative, for `selectConfig`
+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),
+ for `defaultLightTheme`
+
+Importing `index.tsx` and `use-select-transition.ts` pulls the `remotion` module
+(and React), but neither `selectStyle`, `selectStyleContext`, nor
+`tweenSelectStyle` 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)
+
+Select 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/select/index.tsx
+```
+
+Expected: no output. Any match is a determinism violation.
+
+`use-select-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
+`Select` pure.
+
+Tier-wide sweep:
+
+```bash
+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
+ registry/remocn-ui/select/index.tsx registry/remocn-ui/core/*.ts
+```
diff --git a/registry/remocn-ui/select/__tests__/select.test.ts b/registry/remocn-ui/select/__tests__/select.test.ts
new file mode 100644
index 00000000..013aa155
--- /dev/null
+++ b/registry/remocn-ui/select/__tests__/select.test.ts
@@ -0,0 +1,459 @@
+/**
+ * Verification tests for the PURE / DETERMINISTIC parts of `select`.
+ *
+ * Scope:
+ * - registry/remocn-ui/select/index.tsx — SelectState union membership,
+ * selectStyle presets, selectStyleContext
+ * - registry/remocn-ui/select/config.ts — selectConfig.controls wiring
+ * + selectConfig.snippet output (the state → JSX codegen)
+ * - registry/remocn-ui/select/use-select-transition.ts
+ * — tweenSelectStyle interpolation, DEFAULT_DURATION
+ *
+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.
+ * `<Select>` 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/select/__tests__
+ *
+ * --------------------------------------------------------------------------
+ * IMPORT STRATEGY
+ * --------------------------------------------------------------------------
+ * `config.ts` imports `SelectState` from `@/registry/remocn-ui/select` and the
+ * pieces under test never CALL a Remotion runtime API at import time —
+ * `selectConfig` is a plain object; `.snippet` is a pure string builder;
+ * `selectStyle` and `tweenSelectStyle` 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 SelectState,
+ selectStyle,
+ selectStyleContext,
+} from "../index";
+import { tweenSelectStyle, DEFAULT_DURATION } from "../use-select-transition";
+import { selectConfig } from "../config";
+import { defaultLightTheme } from "@/lib/remocn-ui";
+
+// ===========================================================================
+// Shared fixtures
+// ===========================================================================
+
+/**
+ * The SelectState union, enumerated as a runtime list for membership checks.
+ * Must stay in sync with `export type SelectState` in index.tsx.
+ */
+const VALID_STATES: readonly SelectState[] = ["opened", "closed"];
+
+/** Minimal shape mirroring the customizer's value bag passed to snippet(). */
+type SnippetValues = {
+ state?: string;
+ label?: string;
+ selectedIndex?: number;
+ highlightedIndex?: number;
+ mode?: string;
+};
+
+const snippet = (values: SnippetValues): string =>
+ selectConfig.snippet(values as Record<string, unknown>);
+
+/**
+ * A shared SelectStyleContext built from the default light theme.
+ * `selectStyleContext` takes only `(theme)` — no variant arg.
+ */
+const ctx = selectStyleContext(defaultLightTheme);
+
+// ===========================================================================
+// 1. SelectState union membership
+// ===========================================================================
+
+describe("SelectState union", () => {
+ it("contains exactly the two documented states", () => {
+ const control = selectConfig.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)", () => {
+ const control = selectConfig.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. selectConfig.controls.state — customizer control wiring
+// ===========================================================================
+
+describe("selectConfig.controls.state", () => {
+ it("is a select control", () => {
+ expect(selectConfig.controls.state.type).toBe("select");
+ });
+
+ it("has exactly the two SelectState options in order", () => {
+ const control = selectConfig.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 shows the revealed panel", () => {
+ const control = selectConfig.controls.state;
+ expect(control.default).toBe("opened");
+ });
+
+ it("every option is a member of the SelectState union", () => {
+ const control = selectConfig.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 SelectState);
+ }
+ });
+});
+
+// ===========================================================================
+// 3. selectConfig.snippet — pure string builder
+// State model: snippet ALWAYS emits `state="<state>"` as a bare JSX prop.
+// ===========================================================================
+
+describe("selectConfig.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 = selectConfig.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("selectConfig.snippet: import line", () => {
+ it("includes `import { Select }` from the correct path", () => {
+ const out = snippet({ state: "opened" });
+ expect(out).toContain('import { Select }');
+ expect(out).toContain('from "@/components/remocn/select"');
+ });
+});
+
+describe("selectConfig.snippet: default props are omitted", () => {
+ // Defaults: label="Select a fruit", selectedIndex=-1, highlightedIndex=-1, mode="light"
+ const allDefaults = snippet({
+ state: "opened",
+ label: "Select a fruit",
+ selectedIndex: -1,
+ highlightedIndex: -1,
+ mode: "light",
+ });
+
+ it("omits label when it equals the default 'Select a fruit'", () => {
+ expect(allDefaults).not.toContain("label=");
+ });
+
+ it("omits selectedIndex when it equals the default -1", () => {
+ expect(allDefaults).not.toContain("selectedIndex=");
+ });
+
+ it("omits highlightedIndex when it equals the default -1", () => {
+ expect(allDefaults).not.toContain("highlightedIndex=");
+ });
+
+ it("omits mode when it equals the default 'light'", () => {
+ expect(allDefaults).not.toContain("mode=");
+ });
+});
+
+describe("selectConfig.snippet: non-default props are emitted", () => {
+ it("emits a non-default label", () => {
+ expect(snippet({ state: "opened", label: "Choose a color" }))
+ .toContain('label="Choose a color"');
+ });
+
+ it("emits a non-default selectedIndex", () => {
+ expect(snippet({ state: "opened", selectedIndex: 2 }))
+ .toContain("selectedIndex={2}");
+ });
+
+ it("emits a non-default highlightedIndex", () => {
+ expect(snippet({ state: "opened", highlightedIndex: 1 }))
+ .toContain("highlightedIndex={1}");
+ });
+
+ it("emits a non-default mode", () => {
+ expect(snippet({ state: "opened", mode: "dark" }))
+ .toContain('mode="dark"');
+ });
+});
+
+describe("selectConfig.snippet: structural round-trip", () => {
+ const out = snippet({ state: "opened" });
+
+ it("starts with the import line", () => {
+ expect(out.startsWith('import { Select }')).toBe(true);
+ });
+
+ it("contains a <Select JSX opening", () => {
+ expect(out).toContain("<Select");
+ });
+
+ it("ends with a self-closing />", () => {
+ expect(out.trimEnd().endsWith("/>")).toBe(true);
+ });
+});
+
+// ===========================================================================
+// 4. selectStyleContext — derives concrete colors from the theme.
+// Signature is `(theme)` — NO variant argument.
+// Build ctx from the default light theme and assert each field is populated.
+// `radius` is a number; all other non-nested fields are non-empty strings.
+// ===========================================================================
+
+describe("selectStyleContext: field types from defaultLightTheme", () => {
+ it("panelBg is a non-empty string", () => {
+ expect(typeof ctx.panelBg).toBe("string");
+ expect(ctx.panelBg.length).toBeGreaterThan(0);
+ });
+
+ it("panelBorder is a non-empty string", () => {
+ expect(typeof ctx.panelBorder).toBe("string");
+ expect(ctx.panelBorder.length).toBeGreaterThan(0);
+ });
+
+ it("triggerFg is a non-empty string", () => {
+ expect(typeof ctx.triggerFg).toBe("string");
+ expect(ctx.triggerFg.length).toBeGreaterThan(0);
+ });
+
+ it("mutedFg is a non-empty string", () => {
+ expect(typeof ctx.mutedFg).toBe("string");
+ expect(ctx.mutedFg.length).toBeGreaterThan(0);
+ });
+
+ it("radius is a number", () => {
+ expect(typeof ctx.radius).toBe("number");
+ });
+
+ it("triggerCtx is a non-null object (ButtonStyleContext)", () => {
+ expect(typeof ctx.triggerCtx).toBe("object");
+ expect(ctx.triggerCtx).not.toBeNull();
+ });
+
+ it("itemCtx is a non-null object (SelectItemStyleContext)", () => {
+ expect(typeof ctx.itemCtx).toBe("object");
+ expect(ctx.itemCtx).not.toBeNull();
+ });
+});
+
+describe("selectStyleContext: maps theme tokens correctly", () => {
+ it("panelBg equals theme.popover", () => {
+ expect(ctx.panelBg).toBe(defaultLightTheme.popover);
+ });
+
+ it("panelBorder equals theme.border", () => {
+ expect(ctx.panelBorder).toBe(defaultLightTheme.border);
+ });
+
+ it("triggerFg equals theme.foreground", () => {
+ expect(ctx.triggerFg).toBe(defaultLightTheme.foreground);
+ });
+
+ it("mutedFg equals theme.mutedForeground", () => {
+ expect(ctx.mutedFg).toBe(defaultLightTheme.mutedForeground);
+ });
+
+ it("radius equals theme.radius", () => {
+ expect(ctx.radius).toBe(defaultLightTheme.radius);
+ });
+});
+
+// ===========================================================================
+// 5. selectStyle presets — pure (state, ctx) => SelectStyle
+// All four fields are numeric. Assert per-state invariants:
+// opened → { panelOpacity:1, panelScale:1, panelTranslateY:0, chevronRotation:180 }
+// closed → { panelOpacity:0, panelScale:0.96, panelTranslateY:-4, chevronRotation:0 }
+// ===========================================================================
+
+describe("selectStyle: opened state", () => {
+ const s = selectStyle("opened", ctx);
+
+ it("panelOpacity is 1 (panel fully visible)", () => {
+ expect(s.panelOpacity).toBe(1);
+ });
+
+ it("panelScale is 1 (panel at full size)", () => {
+ expect(s.panelScale).toBe(1);
+ });
+
+ it("panelTranslateY is 0 (panel at natural position)", () => {
+ expect(s.panelTranslateY).toBe(0);
+ });
+
+ it("chevronRotation is 180 (chevron flipped)", () => {
+ expect(s.chevronRotation).toBe(180);
+ });
+});
+
+describe("selectStyle: closed state", () => {
+ const s = selectStyle("closed", ctx);
+
+ it("panelOpacity is 0 (panel fully hidden)", () => {
+ expect(s.panelOpacity).toBe(0);
+ });
+
+ it("panelScale is 0.96 (panel slightly shrunk)", () => {
+ expect(s.panelScale).toBe(0.96);
+ });
+
+ it("panelTranslateY is -4 (panel lifted -4px)", () => {
+ expect(s.panelTranslateY).toBe(-4);
+ });
+
+ it("chevronRotation is 0 (chevron pointing down)", () => {
+ expect(s.chevronRotation).toBe(0);
+ });
+});
+
+describe("selectStyle: closed/opened invariant", () => {
+ it("closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0", () => {
+ const s = selectStyle("closed", ctx);
+ expect(s.panelOpacity).toBe(0);
+ expect(s.panelScale).toBe(0.96);
+ expect(s.panelTranslateY).toBe(-4);
+ expect(s.chevronRotation).toBe(0);
+ });
+
+ it("opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180", () => {
+ const s = selectStyle("opened", ctx);
+ expect(s.panelOpacity).toBe(1);
+ expect(s.panelScale).toBe(1);
+ expect(s.panelTranslateY).toBe(0);
+ expect(s.chevronRotation).toBe(180);
+ });
+});
+
+// ===========================================================================
+// 6. tweenSelectStyle — pure linear interpolation between two SelectStyles.
+// All four fields are pure numeric lerps (no color fields).
+// Concrete expectations: closed → opened for midpoint math.
+// ===========================================================================
+
+describe("tweenSelectStyle: t=0 returns values equal to `a`", () => {
+ const a = selectStyle("closed", ctx);
+ const b = selectStyle("opened", ctx);
+ const r = tweenSelectStyle(a, b, 0);
+
+ it("panelOpacity equals a.panelOpacity at t=0", () => {
+ expect(r.panelOpacity).toBeCloseTo(a.panelOpacity, 10);
+ });
+
+ it("panelScale equals a.panelScale at t=0", () => {
+ expect(r.panelScale).toBeCloseTo(a.panelScale, 10);
+ });
+
+ it("panelTranslateY equals a.panelTranslateY at t=0", () => {
+ expect(r.panelTranslateY).toBeCloseTo(a.panelTranslateY, 10);
+ });
+
+ it("chevronRotation equals a.chevronRotation at t=0", () => {
+ expect(r.chevronRotation).toBeCloseTo(a.chevronRotation, 10);
+ });
+});
+
+describe("tweenSelectStyle: t=1 returns values equal to `b`", () => {
+ const a = selectStyle("closed", ctx);
+ const b = selectStyle("opened", ctx);
+ const r = tweenSelectStyle(a, b, 1);
+
+ it("panelOpacity equals b.panelOpacity at t=1", () => {
+ expect(r.panelOpacity).toBeCloseTo(b.panelOpacity, 10);
+ });
+
+ it("panelScale equals b.panelScale at t=1", () => {
+ expect(r.panelScale).toBeCloseTo(b.panelScale, 10);
+ });
+
+ it("panelTranslateY equals b.panelTranslateY at t=1", () => {
+ expect(r.panelTranslateY).toBeCloseTo(b.panelTranslateY, 10);
+ });
+
+ it("chevronRotation equals b.chevronRotation at t=1", () => {
+ expect(r.chevronRotation).toBeCloseTo(b.chevronRotation, 10);
+ });
+});
+
+describe("tweenSelectStyle: t=0.5 midpoint numeric lerp (closed → opened)", () => {
+ // closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0
+ // opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180
+ const a = selectStyle("closed", ctx);
+ const b = selectStyle("opened", ctx);
+ const r = tweenSelectStyle(a, b, 0.5);
+
+ it("panelOpacity midpoint: 0 → 1 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelScale midpoint: 0.96 → 1 gives 0.98", () => {
+ expect(r.panelScale).toBeCloseTo(0.98, 10);
+ });
+
+ it("panelTranslateY midpoint: -4 → 0 gives -2", () => {
+ expect(r.panelTranslateY).toBeCloseTo(-2, 10);
+ });
+
+ it("chevronRotation midpoint: 0 → 180 gives 90", () => {
+ expect(r.chevronRotation).toBeCloseTo(90, 10);
+ });
+});
+
+describe("tweenSelectStyle: t=0.5 midpoint numeric lerp (opened → closed)", () => {
+ // opened: panelOpacity=1, panelScale=1, panelTranslateY=0, chevronRotation=180
+ // closed: panelOpacity=0, panelScale=0.96, panelTranslateY=-4, chevronRotation=0
+ const a = selectStyle("opened", ctx);
+ const b = selectStyle("closed", ctx);
+ const r = tweenSelectStyle(a, b, 0.5);
+
+ it("panelOpacity midpoint: 1 → 0 gives 0.5", () => {
+ expect(r.panelOpacity).toBeCloseTo(0.5, 10);
+ });
+
+ it("panelScale midpoint: 1 → 0.96 gives 0.98", () => {
+ expect(r.panelScale).toBeCloseTo(0.98, 10);
+ });
+
+ it("panelTranslateY midpoint: 0 → -4 gives -2", () => {
+ expect(r.panelTranslateY).toBeCloseTo(-2, 10);
+ });
+
+ it("chevronRotation midpoint: 180 → 0 gives 90", () => {
+ expect(r.chevronRotation).toBeCloseTo(90, 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 (container default — longer than item's 8)", () => {
+ expect(DEFAULT_DURATION).toBe(12);
+ });
+});
diff --git a/registry/remocn-ui/select/config.ts b/registry/remocn-ui/select/config.ts
new file mode 100644
index 00000000..1f6777d2
--- /dev/null
+++ b/registry/remocn-ui/select/config.ts
@@ -0,0 +1,66 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import type { SelectState } from "@/registry/remocn-ui/select";
+
+export const selectConfig: ComponentConfig = {
+ componentName: "Select",
+ importPath: "@/components/remocn/select",
+ controls: {
+ label: { type: "text", default: "Select a fruit", label: "Label" },
+ state: {
+ type: "select",
+ // Default to `opened` so the preview shows the revealed panel.
+ default: "opened",
+ options: ["opened", "closed"],
+ label: "State",
+ },
+ selectedIndex: {
+ type: "number",
+ default: 1,
+ min: -1,
+ max: 3,
+ step: 1,
+ label: "Selected Index",
+ },
+ highlightedIndex: {
+ type: "number",
+ default: -1,
+ min: -1,
+ max: 3,
+ step: 1,
+ label: "Highlighted Index",
+ },
+ 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 SelectState) ?? "opened";
+ const label = values.label as string | undefined;
+ const selectedIndex = values.selectedIndex as number | undefined;
+ const highlightedIndex = values.highlightedIndex as number | undefined;
+ const mode = values.mode as string | undefined;
+
+ const props: string[] = [` state="${state}"`];
+ if (label !== undefined && label !== "Select a fruit")
+ props.push(` label="${label}"`);
+ if (selectedIndex !== undefined && selectedIndex !== -1)
+ props.push(` selectedIndex={${selectedIndex}}`);
+ if (highlightedIndex !== undefined && highlightedIndex !== -1)
+ props.push(` highlightedIndex={${highlightedIndex}}`);
+ if (mode !== undefined && mode !== "light")
+ props.push(` mode="${mode}"`);
+
+ return `import { Select } from "@/components/remocn/select";
+
+<Select
+${props.join("\n")}
+/>`;
+ },
+};
diff --git a/registry/remocn-ui/select/index.tsx b/registry/remocn-ui/select/index.tsx
new file mode 100644
index 00000000..5ba8e368
--- /dev/null
+++ b/registry/remocn-ui/select/index.tsx
@@ -0,0 +1,271 @@
+"use client";
+
+import { type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";
+import {
+ buttonStyle,
+ buttonStyleContext,
+ type ButtonStyle,
+ type ButtonStyleContext,
+} from "@/components/remocn/button";
+import {
+ SelectItemRow,
+ selectItemStyle,
+ selectItemStyleContext,
+ type SelectItemState,
+ type SelectItemStyle,
+ type SelectItemStyleContext,
+} from "@/components/remocn/select-item";
+
+export type SelectState = "opened" | "closed";
+
+export interface SelectProps {
+ /** Current visual state (snap path). State changes snap (no enter-tweens). */
+ state?: SelectState;
+ /**
+ * Resolved animated visual (smooth path). When provided, takes precedence over
+ * `state` — feed it an interpolated `SelectStyle` from `useSelectTransition`.
+ */
+ style?: SelectStyle;
+ /** Trigger text (the always-visible row). */
+ label?: string;
+ /**
+ * Resolved Button visual for the trigger (smooth path). Drive it with
+ * `useButtonTransition` for a hover/press "click". Defaults to the resting
+ * Button `outline` look.
+ */
+ triggerStyle?: ButtonStyle;
+ /** Option labels rendered in the panel. */
+ items?: string[];
+ /** Index of the persisted selection (check icon + accent). `-1` for none. */
+ selectedIndex?: number;
+ /** Index of the row under the pointer (hover wash). `-1` for none. */
+ highlightedIndex?: number;
+ /** Index of the row being pressed (press wash + shrink). `-1` for none. */
+ pressedIndex?: number;
+ /**
+ * Per-item resolved visual override (smooth path). When an entry is present it
+ * wins over the index→state derivation — used by the live example to tween a
+ * single row through hover → press → selected.
+ */
+ itemStyles?: (SelectItemStyle | undefined)[];
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ className?: string;
+}
+
+/** Trigger width = panel width (px). */
+const WIDTH = 260;
+
+// ===========================================================================
+// Select visual — the COMPLETE animated look for a moment in time. A `state` is
+// a named preset of this visual (`selectStyle`); the smooth path feeds an
+// interpolated `SelectStyle` straight through. The component is a pure renderer
+// of whichever `SelectStyle` it receives. Per-row visuals are derived from the
+// index props (or `itemStyles`), independent of this container reveal.
+// ===========================================================================
+
+export interface SelectStyle {
+ /** Panel fade 0 (closed) → 1 (opened). */
+ panelOpacity: number;
+ /** Panel zoom 0.96 (closed) → 1 (opened). */
+ panelScale: number;
+ /** Panel lift -4 (closed) → 0 (opened) px. */
+ panelTranslateY: number;
+ /** Trigger chevron rotation 0 (closed) → 180 (opened) degrees. */
+ chevronRotation: number;
+}
+
+/** Concrete colors for the active theme, resolved once per render. */
+export interface SelectStyleContext {
+ /** Button `outline` presets — reused so the trigger IS the Button look. */
+ triggerCtx: ButtonStyleContext;
+ panelBg: string;
+ panelBorder: string;
+ triggerFg: string;
+ mutedFg: string;
+ radius: number;
+ itemCtx: SelectItemStyleContext;
+}
+
+/**
+ * Derive the concrete colors for a theme. Pure — call it once and reuse the
+ * result for every `selectStyle(state, ctx)` preset.
+ */
+export function selectStyleContext(theme: RemocnTheme): SelectStyleContext {
+ return {
+ triggerCtx: buttonStyleContext("outline", theme),
+ panelBg: theme.popover,
+ panelBorder: theme.border,
+ triggerFg: theme.foreground,
+ mutedFg: theme.mutedForeground,
+ radius: theme.radius,
+ itemCtx: selectItemStyleContext(theme),
+ };
+}
+
+/**
+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => SelectStyle`
+ * map. To change how a state looks, edit one entry.
+ */
+export function selectStyle(
+ state: SelectState,
+ _ctx: SelectStyleContext,
+): SelectStyle {
+ switch (state) {
+ case "opened":
+ return {
+ panelOpacity: 1,
+ panelScale: 1,
+ panelTranslateY: 0,
+ chevronRotation: 180,
+ };
+ default:
+ return {
+ panelOpacity: 0,
+ panelScale: 0.96,
+ panelTranslateY: -4,
+ chevronRotation: 0,
+ };
+ }
+}
+
+/** Resolve one row's state from the index props (used when no itemStyle override). */
+function rowState(
+ i: number,
+ selectedIndex: number,
+ highlightedIndex: number,
+ pressedIndex: number,
+): SelectItemState {
+ if (i === pressedIndex) return "press";
+ if (i === selectedIndex) return "selected";
+ if (i === highlightedIndex) return "hover";
+ return "idle";
+}
+
+export function Select({
+ state = "closed",
+ style,
+ label = "Select a fruit",
+ triggerStyle,
+ items = ["Apple", "Banana", "Orange", "Grape"],
+ selectedIndex = -1,
+ highlightedIndex = -1,
+ pressedIndex = -1,
+ itemStyles,
+ theme: themeOverride,
+ mode,
+ className,
+}: SelectProps) {
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = selectStyleContext(theme);
+ const v = style ?? selectStyle(state, ctx);
+
+ // The trigger reuses the Button `outline` visual. Defaults to the resting
+ // `idle` look; the caller can pass a tweened `triggerStyle` (from
+ // `useButtonTransition`) so the trigger shows the hover/press "click".
+ const trigger: ButtonStyle = triggerStyle ?? buttonStyle("idle", ctx.triggerCtx);
+ const itemRadius = theme.radius - 2;
+
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ // OPAQUE wrapper — a select is a self-contained widget, not a modal layer.
+ background: theme.background,
+ fontFamily:
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
+ }}
+ >
+ <div style={{ position: "relative", width: WIDTH }}>
+ {/* Trigger — the Button `outline` look, rendered inline. */}
+ <div
+ style={{
+ width: WIDTH,
+ boxSizing: "border-box",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 8,
+ height: 40,
+ padding: "0 16px",
+ fontSize: 15,
+ fontWeight: 500,
+ letterSpacing: "-0.01em",
+ color: ctx.triggerFg,
+ transform: `translateY(${trigger.translateY}px) scale(${trigger.scale})`,
+ background: trigger.background,
+ border: `1px solid ${ctx.panelBorder}`,
+ borderRadius: ctx.radius,
+ }}
+ >
+ <span>{label}</span>
+ <svg
+ width={16}
+ height={16}
+ viewBox="0 0 24 24"
+ fill="none"
+ style={{
+ flexShrink: 0,
+ transform: `rotate(${v.chevronRotation}deg)`,
+ }}
+ >
+ <path
+ d="M6 9l6 6 6-6"
+ stroke={ctx.mutedFg}
+ strokeWidth="2.2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ {/* Panel — opacity/scale/translateY animate the reveal below the trigger. */}
+ <div
+ style={{
+ position: "absolute",
+ top: "calc(100% + 6px)",
+ left: 0,
+ width: WIDTH,
+ boxSizing: "border-box",
+ transformOrigin: "top",
+ transform: `translateY(${v.panelTranslateY}px) scale(${v.panelScale})`,
+ opacity: v.panelOpacity,
+ background: ctx.panelBg,
+ border: `1px solid ${ctx.panelBorder}`,
+ borderRadius: ctx.radius,
+ padding: 4,
+ display: "flex",
+ flexDirection: "column",
+ gap: 2,
+ boxShadow: "0 16px 32px -12px rgba(0,0,0,0.25)",
+ }}
+ >
+ {items.map((item, i) => {
+ const override = itemStyles?.[i];
+ return (
+ <SelectItemRow
+ key={item}
+ style={
+ override ??
+ selectItemStyle(
+ rowState(i, selectedIndex, highlightedIndex, pressedIndex),
+ ctx.itemCtx,
+ )
+ }
+ ctx={ctx.itemCtx}
+ label={item}
+ width={WIDTH - 8}
+ radius={itemRadius}
+ check={ctx.itemCtx.check}
+ />
+ );
+ })}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn-ui/select/use-select-transition.ts b/registry/remocn-ui/select/use-select-transition.ts
new file mode 100644
index 00000000..875c6514
--- /dev/null
+++ b/registry/remocn-ui/select/use-select-transition.ts
@@ -0,0 +1,65 @@
+"use client";
+
+import {
+ easings,
+ type RemocnTheme,
+ type Step,
+ useRemocnTheme,
+ useStateTransition,
+} from "@/lib/remocn-ui";
+import {
+ selectStyle,
+ selectStyleContext,
+ type SelectState,
+ type SelectStyle,
+} from "@/components/remocn/select";
+// ^ 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 select visuals: all fields are numbers, so a straight lerp. */
+export function tweenSelectStyle(
+ a: SelectStyle,
+ b: SelectStyle,
+ t: number,
+): SelectStyle {
+ return {
+ panelOpacity: a.panelOpacity + (b.panelOpacity - a.panelOpacity) * t,
+ panelScale: a.panelScale + (b.panelScale - a.panelScale) * t,
+ panelTranslateY:
+ a.panelTranslateY + (b.panelTranslateY - a.panelTranslateY) * t,
+ chevronRotation:
+ a.chevronRotation + (b.chevronRotation - a.chevronRotation) * t,
+ };
+}
+
+export interface SelectTransitionOptions {
+ theme?: Partial<RemocnTheme>;
+ mode?: "light" | "dark";
+ speed?: number;
+ defaultDuration?: number;
+}
+
+/**
+ * Timeline → resolved (eased, tweened) SelectStyle. The CALLER invokes this; it
+ * reads the frame, the `<Select>` component does not. Feed the result to
+ * `<Select style={...} />` for a smooth open/close.
+ */
+export function useSelectTransition(
+ steps: Step<SelectState>[],
+ opts: SelectTransitionOptions = {},
+): SelectStyle {
+ const { theme: themeOverride, mode, speed = 1, defaultDuration = DEFAULT_DURATION } =
+ opts;
+ const theme = useRemocnTheme(themeOverride, mode);
+ const ctx = selectStyleContext(theme);
+ const { from, to, progress } = useStateTransition(
+ steps,
+ "closed",
+ speed,
+ defaultDuration,
+ );
+ const t = easings.out(progress);
+ return tweenSelectStyle(selectStyle(from, ctx), selectStyle(to, ctx), t);
+}