Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added input component
dev_wandryf0dab3b0086c
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsxindex 461a8733..57de7025 100644--- a/components/docs/examples/index.tsx+++ b/components/docs/examples/index.tsx@@ -15,6 +15,7 @@ import {} from "./checkbox-example";import { RadioExampleScene, radioExampleCode } from "./radio-example";import { SwitchExampleScene, switchExampleCode } from "./switch-example";+import { InputExampleScene, inputExampleCode } from "./input-example";export interface ExampleEntry {Component: ComponentType;@@ -76,4 +77,12 @@ export const examples: Record<string, ExampleEntry> = {width: W,height: H,},+ "input-example": {+ Component: InputExampleScene,+ code: inputExampleCode,+ durationInFrames: 120,+ fps: FPS,+ width: W,+ height: H,+ },};diff --git a/components/docs/examples/input-example.tsx b/components/docs/examples/input-example.tsxnew file mode 100644index 00000000..f86b0124--- /dev/null+++ b/components/docs/examples/input-example.tsx@@ -0,0 +1,40 @@+"use client";++import { Input } from "@/registry/remocn-ui/input";+import { useInputTransition } from "@/registry/remocn-ui/input/use-input-transition";++export const InputExampleScene = () => {+ const style = useInputTransition([+ { at: 10, state: "hover", duration: 8 },+ { at: 24, state: "active", duration: 10 },+ { at: 40, state: "typing", duration: 22 },+ { at: 78, state: "invalid", duration: 12 },+ ]);+ return (+ <Input+ placeholder="[email protected]"+ value="[email protected]"+ style={style}+ />+ );+};++export const inputExampleCode = `import { Input } from "@/components/remocn/input";+import { useInputTransition } from "@/components/remocn/use-input-transition";++export const Scene = () => {+ const style = useInputTransition([+ { at: 10, state: "hover", duration: 8 },+ { at: 24, state: "active", duration: 10 },+ { at: 40, state: "typing", duration: 22 },+ { at: 78, state: "invalid", duration: 12 },+ ]);++ return (+ <Input+ placeholder="[email protected]"+ value="[email protected]"+ style={style}+ />+ );+};`;diff --git a/content/docs/ui/components/input.mdx b/content/docs/ui/components/input.mdxnew file mode 100644index 00000000..6904cc1b--- /dev/null+++ b/content/docs/ui/components/input.mdx@@ -0,0 +1,156 @@+---+title: Input+description: An input field whose visual state is a pure function of the timeline+---++<ComponentPreview name="input" />++A state atom whose appearance (idle, hover, active, typing, invalid) 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.++## Installation++<InstallBlock name="input" />++<Note>+Installing `input` automatically installs the shared `remocn-ui` core (`lib/remocn-ui/`) via `registryDependencies`. You do not need to install it separately.+</Note>++## States++`InputState` is:++```ts+type InputState =+ | "idle" // resting, theme border, no ring, placeholder shown, no caret+ | "hover" // border darkens slightly, subtle muted bg wash, no ring+ | "active" // focused, focus ring appears, border = ring, caret visible, placeholder still shown+ | "typing" // focused, value text reveals (typewriter), caret at end, placeholder faded out+ | "invalid" // destructive border + destructive ring, value shown, no caret+```++`hover` subtly lifts the visual weight with a darkened border and a wash of the muted background. `active` shows the focus ring and caret but the field is still empty (placeholder visible). `typing` animates the value text reveal and fades out the placeholder. `invalid` uses the destructive color tokens for both border and ring.++## Snap usage (simple path)++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 { Input } from "@/components/remocn/input";++export const Scene = () => <Input state="typing" />;+```++To drive state from the timeline, use `useCurrentState`:++```tsx+import { useCurrentState } from "@/lib/remocn-ui";+import { Input } from "@/components/remocn/input";++export const Scene = () => {+ const state = useCurrentState(+ [+ { at: 10, state: "hover" },+ { at: 24, state: "active" },+ { at: 40, state: "typing" },+ { at: 78, state: "invalid" },+ ],+ "idle",+ );++ return <Input state={state} />;+};+```++Each `at` is a **Sequence-local authored frame**. State persists between steps: `hover` at frame 10 keeps the input lifted until `active` fires at frame 24. See [Concepts](/docs/ui/concepts) for the full `useCurrentState` API.++## Smooth transitions (opt-in)++State changes via `state` snap with no cross-fade. For animated transitions, use `useInputTransition` from the copied `use-input-transition.ts` file. It reads the frame, interpolates between state presets, and returns a resolved `InputStyle` — pass it to the `style` prop:++```tsx+import { Input } from "@/components/remocn/input";+import { useInputTransition } from "@/components/remocn/use-input-transition";++export const Scene = () => {+ const style = useInputTransition([+ { at: 10, state: "hover", duration: 8 },+ { at: 24, state: "active", duration: 10 },+ { at: 40, state: "typing", duration: 22 },+ { at: 78, state: "invalid", duration: 12 },+ ]);+ return <Input style={style} />;+};+```++The `duration` field on each step overrides the file's `DEFAULT_DURATION` for that specific transition. To globally tune timing and easing, edit `use-input-transition.ts` directly in your project — that file is yours (shadcn "own your code" philosophy).++`style` takes precedence over `state` when both are provided.++## Full lifecycle++A complete idle → hover → active → typing → invalid run using the smooth transition path. Copy the code to drop it into your own composition.++<LiveExample name="input-example" />++## Props++<PropsTable+ rows={[+ {+ name: "state",+ type: "\"idle\" | \"hover\" | \"active\" | \"typing\" | \"invalid\"",+ default: "\"idle\"",+ description: "Current visual state (snap path). State changes snap — no automatic cross-fade.",+ },+ {+ name: "style",+ type: "InputStyle",+ description: "Resolved animated visual (smooth path). Pass an interpolated InputStyle from useInputTransition. Takes precedence over state when provided.",+ },+ {+ name: "placeholder",+ type: "string",+ default: "\"[email protected]\"",+ description: "Placeholder text shown while the field is empty (idle/hover/active).",+ },+ {+ name: "value",+ type: "string",+ default: "\"[email protected]\"",+ description: "The typed value revealed in the typing/invalid states.",+ },+ {+ name: "valueWidth",+ type: "number",+ default: "168",+ description: "Authored natural width (px) of the value text; the value clips to valueWidth × valueReveal since Remotion's headless render can't measure text.",+ },+ {+ name: "size",+ type: "\"sm\" | \"default\" | \"lg\"",+ default: "\"default\"",+ description: "Field height and padding preset. sm=36px, default=40px, lg=48px.",+ },+ {+ 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: "primary",+ type: "string",+ description: "Convenience override for the primary theme token. Merged into theme — saves a theme object for single-token changes.",+ },+ {+ name: "className",+ type: "string",+ description: "Optional className passed to the input wrapper element.",+ },+ ]}+/>diff --git a/content/docs/ui/components/meta.json b/content/docs/ui/components/meta.jsonindex edd423aa..f77b6cfd 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", "radio", "spinner", "switch"]+ "pages": ["accordion", "alert-dialog", "button", "checkbox", "input", "radio", "spinner", "switch"]}diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 3b699632..5f87b3a4 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -113,6 +113,8 @@ import { Button } from "@/registry/remocn-ui/button";import { buttonConfig } from "@/registry/remocn-ui/button/config";import { Checkbox } from "@/registry/remocn-ui/checkbox";import { checkboxConfig } from "@/registry/remocn-ui/checkbox/config";+import { Input } from "@/registry/remocn-ui/input";+import { inputConfig } from "@/registry/remocn-ui/input/config";import { Radio } from "@/registry/remocn-ui/radio";import { radioConfig } from "@/registry/remocn-ui/radio/config";import { Spinner } from "@/registry/remocn-ui/spinner";@@ -296,6 +298,7 @@ const registry: Record<string, RegistryEntry> = {"accordion": { Component: Accordion, config: accordionConfig },"alert-dialog": { Component: AlertDialog, config: alertDialogConfig },"checkbox": { Component: Checkbox, config: checkboxConfig },+ "input": { Component: Input, config: inputConfig },"radio": { Component: Radio, config: radioConfig },"switch": { Component: Switch, config: switchConfig },"spinner": { Component: Spinner, config: spinnerConfig },diff --git a/registry/remocn-ui/input/__tests__/README.md b/registry/remocn-ui/input/__tests__/README.mdnew file mode 100644index 00000000..121d4df8--- /dev/null+++ b/registry/remocn-ui/input/__tests__/README.md@@ -0,0 +1,125 @@+# `input` — verification tests++Pure / deterministic verification for the `input` component+(`registry/remocn-ui/input/`). The RENDER path needs Remotion's+`useCurrentFrame()` and cannot run headless, so the render is NOT exercised+here. This suite covers the pieces that ARE pure: `InputState` union+membership, `inputConfig.controls.state` wiring, `inputConfig.snippet`+codegen, `inputStyle` presets, and `tweenInputStyle` interpolation.++## Animation model — pure snap + opt-in smooth path++Input ships two complementary paths:++**Snap path** (`state?: InputState` prop):+`Input` 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+`inputStyle(state, ctx) => InputStyle`. State changes snap instantly — no+tweening inside the component.++**Smooth path** (`style?: InputStyle` prop):+Callers opt in to smooth transitions by passing a pre-interpolated `InputStyle`+to the `style` prop. The caller — typically `useInputTransition` — reads+`useCurrentFrame()` and calls `useStateTransition` from `core/timeline.ts` to+compute `{ from, to, progress }`, then blends the two presets via+`tweenInputStyle(from, to, t)`. The `Input` component itself remains+frame-free; it simply renders whatever `InputStyle` it receives.++This design keeps `Input` pure-testable (no Remotion render context needed)+while still supporting smooth enter-transitions for production use.++## How to run++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/input/__tests__+```++`input.test.ts` imports `bun:test` (not `vitest`/`jest`), so no test script+or framework dep is added to `package.json`.++## What is covered++- **`InputState` union** — asserts the five states+ `["idle","hover","active","typing","invalid"]` are the complete set (via the+ real `controls.state.options` list from `config.ts`).+- **`inputConfig.controls.state`** — the customizer control wiring. Asserts a+ `select` control exists with exactly those five options, default `"typing"`+ (so the preview showcases the caret + revealed value), and that every option+ is a member of the `InputState` union.+- **`inputConfig.snippet`** — REAL pure string builder (high value).+ Asserts: emits `state="<state>"` as a bare JSX prop for every option; NEVER+ emits `steps` or `action`; includes `import { Input }` from+ `@/components/remocn/input`; omits default-equal props+ (`[email protected]`, `[email protected]`, `size=default`,+ `mode=light`, `primary=#171717`); EMITS non-default+ `placeholder`/`value`/`size`/`mode`/`primary`; structural round-trip (starts+ with import, contains `<Input`, ends `/>`).+- **`inputStyle` presets** — exported pure `(state, ctx) => InputStyle` map.+ An `InputStyleContext` is built from `inputStyleContext(defaultLightTheme)` —+ the same call the component makes internally. Asserts per-state+ numeric/opacity invariants (`ringWidth`, `caretOpacity`, `valueReveal`,+ `placeholderOpacity`) and that `borderColor`/`ringColor`/`background` are+ always non-empty strings. Key invariants:++ | state | ringWidth | caretOpacity | valueReveal | placeholderOpacity |+ |---------|-----------|--------------|-------------|--------------------|+ | idle | 0 | 0 | 0 | 1 |+ | hover | 0 | 0 | 0 | 1 |+ | active | 3 | 1 | 0 | 1 |+ | typing | 3 | 1 | 1 | 0 |+ | invalid | 3 | 0 | 1 | 0 |++- **`tweenInputStyle`** — exported pure `(a, b, t) => InputStyle`. Asserts:+ at t=0 all numeric fields equal `a`; at t=1 all equal `b`; at t=0.5 each+ numeric field is the exact midpoint (e.g. `ringWidth` 0→3 gives 1.5,+ `valueReveal` 0→1 gives 0.5, `placeholderOpacity` 1→0 gives 0.5). Color+ fields at all t are non-empty strings (the oklch mix value is not hardcoded).+ Three pair transitions are exercised: idle→active, active→typing,+ typing→invalid.++**Input render** is a pure `(style | state) => visual` observable only via+Remotion render, not unit-tested here.++## Import strategy++`input.test.ts` imports via a mix of **relative paths** and the+**`@/lib/remocn-ui` tsconfig alias**:++- `../index` — relative, for `InputState`, `inputStyle`, `inputStyleContext`+- `../use-input-transition` — relative, for `tweenInputStyle`+- `../config` — relative, for `inputConfig`+- `@/lib/remocn-ui` — alias (resolves to `registry/remocn-ui/core/index.ts`),+ for `defaultLightTheme`++Importing `index.tsx` and `use-input-transition.ts` pulls the `remotion`+module (and React), but neither `inputStyle`, `inputStyleContext`, nor+`tweenInputStyle` 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)++Input is frame-free. The component must contain **none** of the following:++```bash+grep -nE "useCurrentFrame|useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \+ registry/remocn-ui/input/index.tsx+```++Expected: no output. Any match is a determinism violation.++`use-input-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+`Input` pure.++Tier-wide sweep:++```bash+grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \+ registry/remocn-ui/input/index.tsx registry/remocn-ui/core/*.ts+```diff --git a/registry/remocn-ui/input/__tests__/input.test.ts b/registry/remocn-ui/input/__tests__/input.test.tsnew file mode 100644index 00000000..ca5ca6a1--- /dev/null+++ b/registry/remocn-ui/input/__tests__/input.test.ts@@ -0,0 +1,642 @@+/**+ * Verification tests for the PURE / DETERMINISTIC parts of `input`.+ *+ * Scope:+ * - registry/remocn-ui/input/index.tsx — InputState union membership,+ * inputStyleContext, inputStyle presets+ * - registry/remocn-ui/input/config.ts — inputConfig.controls.state+ * wiring + inputConfig.snippet output (the state → JSX codegen)+ * - registry/remocn-ui/input/use-input-transition.ts — tweenInputStyle lerp+ *+ * The render path (index.tsx) is a PURE-STATE model: `(state) => visual`.+ * Every visual is the complete resting look for that state — state changes+ * snap (no tweening). `useInputTransition` reads `useCurrentFrame()` via+ * `useStateTransition`; it cannot run outside a Remotion render tree.+ * So Input render is NOT exercised here. The pure-testable surface is the+ * customizer wiring + snippet codegen + style presets + tween (below).+ *+ * Runner: Bun's built-in test runner (TypeScript-native, no framework dep).+ * bun test registry/remocn-ui/input/__tests__+ *+ * --------------------------------------------------------------------------+ * IMPORT STRATEGY+ * --------------------------------------------------------------------------+ * `config.ts` imports `InputState` from `@/registry/remocn-ui/input` and+ * the pieces under test never CALL a Remotion runtime API at import time —+ * `inputConfig` is a plain object; `.snippet` is a pure string builder;+ * `inputStyle`/`inputStyleContext` are pure value functions; `tweenInputStyle`+ * is a pure lerp function.+ * 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 InputState, inputStyle, inputStyleContext } from "../index";+import { tweenInputStyle } from "../use-input-transition";+import { inputConfig } from "../config";+import { defaultLightTheme } from "@/lib/remocn-ui";++// ===========================================================================+// Shared fixtures+// ===========================================================================++/**+ * The InputState union, enumerated as a runtime list for membership checks.+ * Must stay in sync with `export type InputState` in index.tsx.+ */+const VALID_STATES: readonly InputState[] = [+ "idle",+ "hover",+ "active",+ "typing",+ "invalid",+];++/** Minimal shape mirroring the customizer's value bag passed to snippet(). */+type SnippetValues = {+ state?: string;+ placeholder?: string;+ value?: string;+ size?: string;+ mode?: string;+ primary?: string;+};++const snippet = (values: SnippetValues): string =>+ inputConfig.snippet(values as Record<string, unknown>);++// ===========================================================================+// 1. InputState union membership+// ===========================================================================++describe("InputState union", () => {+ it("contains exactly the five documented states", () => {+ // We can't enumerate a TS type at runtime, but we can assert the REAL+ // controls.state options match and that all known states are members.+ const control = inputConfig.controls.state;+ if (control.type !== "select") throw new Error("state control must be a select");+ expect(control.options).toEqual([+ "idle",+ "hover",+ "active",+ "typing",+ "invalid",+ ]);+ });++ it("every VALID_STATES entry is assignable (no typos in the fixture)", () => {+ // Belt-and-suspenders: the fixture array must have exactly 5 entries and+ // match the options list from the real config.+ const control = inputConfig.controls.state;+ if (control.type !== "select") throw new Error("state control must be a select");+ expect(VALID_STATES).toHaveLength(5);+ for (const s of VALID_STATES) {+ expect(control.options).toContain(s);+ }+ });+});++// ===========================================================================+// 2. inputConfig.controls.state — customizer control wiring+// ===========================================================================++describe("inputConfig.controls.state", () => {+ it("is a select control", () => {+ expect(inputConfig.controls.state.type).toBe("select");+ });++ it("has exactly the five InputState options in order", () => {+ const control = inputConfig.controls.state;+ if (control.type !== "select") throw new Error("state control must be a select");+ expect(control.options).toEqual([+ "idle",+ "hover",+ "active",+ "typing",+ "invalid",+ ]);+ });++ it("defaults to 'typing' so the preview shows the caret + revealed value", () => {+ const control = inputConfig.controls.state;+ expect(control.default).toBe("typing");+ });++ it("every option is a member of the InputState union", () => {+ const control = inputConfig.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 InputState);+ }+ });+});++// ===========================================================================+// 3. inputConfig.snippet — pure string builder+// State model: snippet emits `state="<state>"` as a bare JSX prop.+// It NEVER emits `steps` or `action`.+// ===========================================================================++describe("inputConfig.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=\"active\" for the active option", () => {+ expect(snippet({ state: "active" })).toContain('state="active"');+ });++ it("emits state=\"typing\" for the typing option", () => {+ expect(snippet({ state: "typing" })).toContain('state="typing"');+ });++ it("emits state=\"invalid\" for the invalid option", () => {+ expect(snippet({ state: "invalid" })).toContain('state="invalid"');+ });++ it("emits the correct state for every control option", () => {+ const control = inputConfig.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("inputConfig.snippet: NEVER emits steps or action", () => {+ it("never emits `steps` in any state", () => {+ for (const state of VALID_STATES) {+ expect(snippet({ state })).not.toContain("steps");+ }+ });++ it("never emits `action` in any state", () => {+ for (const state of VALID_STATES) {+ expect(snippet({ state })).not.toContain("action");+ }+ });+});++describe("inputConfig.snippet: import line", () => {+ it("includes `import { Input }` from the correct path", () => {+ const out = snippet({ state: "typing" });+ expect(out).toContain('import { Input }');+ expect(out).toContain('from "@/components/remocn/input"');+ });+});++describe("inputConfig.snippet: default props are omitted", () => {+ // Defaults: [email protected], [email protected],+ // size=default, mode=light, primary=#171717+ const allDefaults = snippet({+ state: "typing",+ placeholder: "[email protected]",+ value: "[email protected]",+ size: "default",+ mode: "light",+ primary: "#171717",+ });++ it("omits placeholder when it equals the default '[email protected]'", () => {+ expect(allDefaults).not.toContain("placeholder=");+ });++ it("omits value when it equals the default '[email protected]'", () => {+ expect(allDefaults).not.toContain("value=");+ });++ it("omits size when it equals the default 'default'", () => {+ expect(allDefaults).not.toContain("size=");+ });++ it("omits mode when it equals the default 'light'", () => {+ expect(allDefaults).not.toContain("mode=");+ });++ it("omits primary when it equals the default '#171717'", () => {+ expect(allDefaults).not.toContain("primary=");+ });+});++describe("inputConfig.snippet: non-default props are emitted", () => {+ it("emits a non-default placeholder", () => {+ expect(snippet({ state: "idle", placeholder: "[email protected]" })).toContain('placeholder="[email protected]"');+ });++ it("emits a non-default value", () => {+ expect(snippet({ state: "typing", value: "[email protected]" })).toContain('value="[email protected]"');+ });++ it("emits a non-default size", () => {+ expect(snippet({ state: "typing", size: "lg" })).toContain('size="lg"');+ });++ it("emits a non-default mode", () => {+ expect(snippet({ state: "typing", mode: "dark" })).toContain('mode="dark"');+ });++ it("emits a non-default primary color", () => {+ expect(snippet({ state: "typing", primary: "#6366f1" })).toContain('primary="#6366f1"');+ });+});++describe("inputConfig.snippet: structural round-trip", () => {+ const out = snippet({ state: "typing" });++ it("starts with the import line", () => {+ expect(out.startsWith('import { Input }')).toBe(true);+ });++ it("contains a <Input JSX opening", () => {+ expect(out).toContain("<Input");+ });++ it("ends with a self-closing />", () => {+ expect(out.trimEnd().endsWith("/>")).toBe(true);+ });+});++// ===========================================================================+// 4. inputStyle presets — pure (state, ctx) => InputStyle+// inputStyleContext and inputStyle are exported and frame-free.+// Build one ctx from the default light theme, then assert the+// numeric/opacity invariants for every state.+// borderColor/ringColor/background are derived strings — asserted non-empty+// only (exact values are implementation details of mixOklch).+// ===========================================================================++const ctx = inputStyleContext(defaultLightTheme);++describe("inputStyle: idle state", () => {+ const s = inputStyle("idle", ctx);++ it("ringWidth is 0 (no focus ring)", () => {+ expect(s.ringWidth).toBe(0);+ });++ it("caretOpacity is 0 (caret hidden)", () => {+ expect(s.caretOpacity).toBe(0);+ });++ it("valueReveal is 0 (value not shown)", () => {+ expect(s.valueReveal).toBe(0);+ });++ it("placeholderOpacity is 1 (placeholder fully visible)", () => {+ expect(s.placeholderOpacity).toBe(1);+ });++ it("borderColor is a non-empty string", () => {+ expect(typeof s.borderColor).toBe("string");+ expect(s.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string", () => {+ expect(typeof s.ringColor).toBe("string");+ expect(s.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string", () => {+ expect(typeof s.background).toBe("string");+ expect(s.background.length).toBeGreaterThan(0);+ });+});++describe("inputStyle: hover state", () => {+ const s = inputStyle("hover", ctx);++ it("ringWidth is 0 (no focus ring on hover)", () => {+ expect(s.ringWidth).toBe(0);+ });++ it("caretOpacity is 0 (caret hidden)", () => {+ expect(s.caretOpacity).toBe(0);+ });++ it("valueReveal is 0 (value not shown)", () => {+ expect(s.valueReveal).toBe(0);+ });++ it("placeholderOpacity is 1 (placeholder fully visible)", () => {+ expect(s.placeholderOpacity).toBe(1);+ });++ it("borderColor is a non-empty string", () => {+ expect(typeof s.borderColor).toBe("string");+ expect(s.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string", () => {+ expect(typeof s.ringColor).toBe("string");+ expect(s.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string", () => {+ expect(typeof s.background).toBe("string");+ expect(s.background.length).toBeGreaterThan(0);+ });+});++describe("inputStyle: active state", () => {+ const s = inputStyle("active", ctx);++ it("ringWidth is 3 (focus ring visible)", () => {+ expect(s.ringWidth).toBe(3);+ });++ it("caretOpacity is 1 (caret visible)", () => {+ expect(s.caretOpacity).toBe(1);+ });++ it("valueReveal is 0 (value not yet revealed)", () => {+ expect(s.valueReveal).toBe(0);+ });++ it("placeholderOpacity is 1 (placeholder still visible)", () => {+ expect(s.placeholderOpacity).toBe(1);+ });++ it("borderColor is a non-empty string", () => {+ expect(typeof s.borderColor).toBe("string");+ expect(s.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string", () => {+ expect(typeof s.ringColor).toBe("string");+ expect(s.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string", () => {+ expect(typeof s.background).toBe("string");+ expect(s.background.length).toBeGreaterThan(0);+ });+});++describe("inputStyle: typing state", () => {+ const s = inputStyle("typing", ctx);++ it("ringWidth is 3 (focus ring visible)", () => {+ expect(s.ringWidth).toBe(3);+ });++ it("caretOpacity is 1 (caret visible while typing)", () => {+ expect(s.caretOpacity).toBe(1);+ });++ it("valueReveal is 1 (value fully revealed)", () => {+ expect(s.valueReveal).toBe(1);+ });++ it("placeholderOpacity is 0 (placeholder hidden by value)", () => {+ expect(s.placeholderOpacity).toBe(0);+ });++ it("borderColor is a non-empty string", () => {+ expect(typeof s.borderColor).toBe("string");+ expect(s.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string", () => {+ expect(typeof s.ringColor).toBe("string");+ expect(s.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string", () => {+ expect(typeof s.background).toBe("string");+ expect(s.background.length).toBeGreaterThan(0);+ });+});++describe("inputStyle: invalid state", () => {+ const s = inputStyle("invalid", ctx);++ it("ringWidth is 3 (error ring visible)", () => {+ expect(s.ringWidth).toBe(3);+ });++ it("caretOpacity is 0 (caret hidden after invalid submit)", () => {+ expect(s.caretOpacity).toBe(0);+ });++ it("valueReveal is 1 (value stays revealed)", () => {+ expect(s.valueReveal).toBe(1);+ });++ it("placeholderOpacity is 0 (placeholder still hidden)", () => {+ expect(s.placeholderOpacity).toBe(0);+ });++ it("borderColor is a non-empty string", () => {+ expect(typeof s.borderColor).toBe("string");+ expect(s.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string", () => {+ expect(typeof s.ringColor).toBe("string");+ expect(s.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string", () => {+ expect(typeof s.background).toBe("string");+ expect(s.background.length).toBeGreaterThan(0);+ });+});++describe("inputStyle: string-field invariant — borderColor/ringColor/background are non-empty for every state", () => {+ it("all three color fields are non-empty strings in every state", () => {+ for (const state of VALID_STATES) {+ const s = inputStyle(state, ctx);+ expect(s.borderColor.length).toBeGreaterThan(0);+ expect(s.ringColor.length).toBeGreaterThan(0);+ expect(s.background.length).toBeGreaterThan(0);+ }+ });+});++// ===========================================================================+// 5. tweenInputStyle — pure linear interpolation between two InputStyles.+// Numbers lerp linearly; colors are oklch strings at all t.+// Concrete pair checks below cover the seven fields.+// ===========================================================================++describe("tweenInputStyle: t=0 returns values equal to `a`", () => {+ const a = inputStyle("idle", ctx);+ const b = inputStyle("active", ctx);+ const r = tweenInputStyle(a, b, 0);++ it("ringWidth equals a.ringWidth at t=0", () => {+ expect(r.ringWidth).toBeCloseTo(a.ringWidth, 10);+ });++ it("caretOpacity equals a.caretOpacity at t=0", () => {+ expect(r.caretOpacity).toBeCloseTo(a.caretOpacity, 10);+ });++ it("valueReveal equals a.valueReveal at t=0", () => {+ expect(r.valueReveal).toBeCloseTo(a.valueReveal, 10);+ });++ it("placeholderOpacity equals a.placeholderOpacity at t=0", () => {+ expect(r.placeholderOpacity).toBeCloseTo(a.placeholderOpacity, 10);+ });++ it("borderColor is a non-empty string at t=0", () => {+ expect(typeof r.borderColor).toBe("string");+ expect(r.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string at t=0", () => {+ expect(typeof r.ringColor).toBe("string");+ expect(r.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string at t=0", () => {+ expect(typeof r.background).toBe("string");+ expect(r.background.length).toBeGreaterThan(0);+ });+});++describe("tweenInputStyle: t=1 returns values equal to `b`", () => {+ const a = inputStyle("idle", ctx);+ const b = inputStyle("active", ctx);+ const r = tweenInputStyle(a, b, 1);++ it("ringWidth equals b.ringWidth at t=1", () => {+ expect(r.ringWidth).toBeCloseTo(b.ringWidth, 10);+ });++ it("caretOpacity equals b.caretOpacity at t=1", () => {+ expect(r.caretOpacity).toBeCloseTo(b.caretOpacity, 10);+ });++ it("valueReveal equals b.valueReveal at t=1", () => {+ expect(r.valueReveal).toBeCloseTo(b.valueReveal, 10);+ });++ it("placeholderOpacity equals b.placeholderOpacity at t=1", () => {+ expect(r.placeholderOpacity).toBeCloseTo(b.placeholderOpacity, 10);+ });++ it("borderColor is a non-empty string at t=1", () => {+ expect(typeof r.borderColor).toBe("string");+ expect(r.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string at t=1", () => {+ expect(typeof r.ringColor).toBe("string");+ expect(r.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string at t=1", () => {+ expect(typeof r.background).toBe("string");+ expect(r.background.length).toBeGreaterThan(0);+ });+});++describe("tweenInputStyle: t=0.5 midpoint numeric lerp (idle → active)", () => {+ // idle: ringWidth=0, caretOpacity=0, valueReveal=0, placeholderOpacity=1+ // active: ringWidth=3, caretOpacity=1, valueReveal=0, placeholderOpacity=1+ const a = inputStyle("idle", ctx);+ const b = inputStyle("active", ctx);+ const r = tweenInputStyle(a, b, 0.5);++ it("ringWidth midpoint: 0 → 3 gives 1.5", () => {+ expect(r.ringWidth).toBeCloseTo(1.5, 10);+ });++ it("caretOpacity midpoint: 0 → 1 gives 0.5", () => {+ expect(r.caretOpacity).toBeCloseTo(0.5, 10);+ });++ it("valueReveal midpoint: 0 → 0 gives 0 (both same)", () => {+ expect(r.valueReveal).toBeCloseTo(0, 10);+ });++ it("placeholderOpacity midpoint: 1 → 1 gives 1 (both same)", () => {+ expect(r.placeholderOpacity).toBeCloseTo(1, 10);+ });++ it("borderColor is a non-empty string at t=0.5", () => {+ expect(typeof r.borderColor).toBe("string");+ expect(r.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string at t=0.5", () => {+ expect(typeof r.ringColor).toBe("string");+ expect(r.ringColor.length).toBeGreaterThan(0);+ });++ it("background is a non-empty string at t=0.5", () => {+ expect(typeof r.background).toBe("string");+ expect(r.background.length).toBeGreaterThan(0);+ });+});++describe("tweenInputStyle: t=0.5 midpoint numeric lerp (active → typing)", () => {+ // active: ringWidth=3, caretOpacity=1, valueReveal=0, placeholderOpacity=1+ // typing: ringWidth=3, caretOpacity=1, valueReveal=1, placeholderOpacity=0+ const a = inputStyle("active", ctx);+ const b = inputStyle("typing", ctx);+ const r = tweenInputStyle(a, b, 0.5);++ it("ringWidth midpoint: 3 → 3 gives 3 (both same)", () => {+ expect(r.ringWidth).toBeCloseTo(3, 10);+ });++ it("caretOpacity midpoint: 1 → 1 gives 1 (both same)", () => {+ expect(r.caretOpacity).toBeCloseTo(1, 10);+ });++ it("valueReveal midpoint: 0 → 1 gives 0.5", () => {+ expect(r.valueReveal).toBeCloseTo(0.5, 10);+ });++ it("placeholderOpacity midpoint: 1 → 0 gives 0.5", () => {+ expect(r.placeholderOpacity).toBeCloseTo(0.5, 10);+ });++ it("background is a non-empty string at t=0.5", () => {+ expect(typeof r.background).toBe("string");+ expect(r.background.length).toBeGreaterThan(0);+ });+});++describe("tweenInputStyle: t=0.5 midpoint numeric lerp (typing → invalid)", () => {+ // typing: ringWidth=3, caretOpacity=1, valueReveal=1, placeholderOpacity=0+ // invalid: ringWidth=3, caretOpacity=0, valueReveal=1, placeholderOpacity=0+ const a = inputStyle("typing", ctx);+ const b = inputStyle("invalid", ctx);+ const r = tweenInputStyle(a, b, 0.5);++ it("ringWidth midpoint: 3 → 3 gives 3 (both same)", () => {+ expect(r.ringWidth).toBeCloseTo(3, 10);+ });++ it("caretOpacity midpoint: 1 → 0 gives 0.5", () => {+ expect(r.caretOpacity).toBeCloseTo(0.5, 10);+ });++ it("valueReveal midpoint: 1 → 1 gives 1 (both same)", () => {+ expect(r.valueReveal).toBeCloseTo(1, 10);+ });++ it("placeholderOpacity midpoint: 0 → 0 gives 0 (both same)", () => {+ expect(r.placeholderOpacity).toBeCloseTo(0, 10);+ });++ it("borderColor is a non-empty string at t=0.5", () => {+ expect(typeof r.borderColor).toBe("string");+ expect(r.borderColor.length).toBeGreaterThan(0);+ });++ it("ringColor is a non-empty string at t=0.5", () => {+ expect(typeof r.ringColor).toBe("string");+ expect(r.ringColor.length).toBeGreaterThan(0);+ });+});diff --git a/registry/remocn-ui/input/config.ts b/registry/remocn-ui/input/config.tsnew file mode 100644index 00000000..c9dc8e26--- /dev/null+++ b/registry/remocn-ui/input/config.ts@@ -0,0 +1,65 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";+import type { InputState } from "@/registry/remocn-ui/input";++export const inputConfig: ComponentConfig = {+ componentName: "Input",+ importPath: "@/components/remocn/input",+ controls: {+ placeholder: {+ type: "text",+ default: "[email protected]",+ label: "Placeholder",+ },+ value: { type: "text", default: "[email protected]", label: "Value" },+ size: {+ type: "select",+ default: "default",+ options: ["sm", "default", "lg"],+ label: "Size",+ },+ state: {+ type: "select",+ // Default to `typing` so the preview shows the caret + revealed value.+ default: "typing",+ options: ["idle", "hover", "active", "typing", "invalid"],+ label: "State",+ },+ mode: {+ type: "select",+ default: "light",+ options: ["light", "dark"],+ label: "Mode",+ },+ primary: { type: "color", default: "#171717", label: "Primary" },+ },+ durationInFrames: 120,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ snippet: (values) => {+ const state = (values.state as InputState) ?? "typing";+ const placeholder = values.placeholder as string | undefined;+ const value = values.value as string | undefined;+ const size = values.size as string | undefined;+ const mode = values.mode as string | undefined;+ const primary = values.primary as string | undefined;++ const props: string[] = [` state="${state}"`];+ if (placeholder !== undefined && placeholder !== "[email protected]")+ props.push(` placeholder="${placeholder}"`);+ if (value !== undefined && value !== "[email protected]")+ props.push(` value="${value}"`);+ if (size !== undefined && size !== "default")+ props.push(` size="${size}"`);+ if (mode !== undefined && mode !== "light")+ props.push(` mode="${mode}"`);+ if (primary !== undefined && primary !== "#171717")+ props.push(` primary="${primary}"`);++ return `import { Input } from "@/components/remocn/input";++<Input+${props.join("\n")}+/>`;+ },+};diff --git a/registry/remocn-ui/input/index.tsx b/registry/remocn-ui/input/index.tsxnew file mode 100644index 00000000..7e457388--- /dev/null+++ b/registry/remocn-ui/input/index.tsx@@ -0,0 +1,271 @@+"use client";++import { mixOklch, type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";++export type InputState = "idle" | "hover" | "active" | "typing" | "invalid";++type InputSize = "sm" | "default" | "lg";++export interface InputProps {+ /** Current visual state (snap path). State changes snap (no enter-tweens). */+ state?: InputState;+ /**+ * Resolved animated visual (smooth path). When provided, takes precedence over+ * `state` — feed it an interpolated `InputStyle` from `useInputTransition`.+ */+ style?: InputStyle;+ /** Placeholder text shown while the field is empty (idle/hover/active). */+ placeholder?: string;+ /** The "typed" value revealed in the typing/invalid states. */+ value?: string;+ /**+ * Natural width (px) of the value text at full reveal. Remotion's headless+ * render can't measure text, so the resting width is authored, not measured —+ * the value clips to `valueWidth * valueReveal` and the caret sits at its end.+ */+ valueWidth?: number;+ size?: InputSize;+ theme?: Partial<RemocnTheme>;+ /** Convenience override for the `primary` theme token — merged into `theme`. */+ primary?: string;+ mode?: "light" | "dark";+ className?: string;+}++/** Field width (px) of the rendered input. */+const FIELD_WIDTH = 320;++const SIZE_STYLES: Record<+ InputSize,+ { height: number; padding: number; fontSize: number }+> = {+ sm: { height: 36, padding: 12, fontSize: 13 },+ default: { height: 40, padding: 14, fontSize: 15 },+ lg: { height: 48, padding: 16, fontSize: 17 },+};++// ===========================================================================+// Input visual — the COMPLETE animated look for a moment in time. A `state` is+// a named preset of this visual (`inputStyle`); the smooth path feeds an+// interpolated `InputStyle` straight through. The component is a pure renderer+// of whichever `InputStyle` it receives.+// ===========================================================================++export interface InputStyle {+ /** Animated border color (a concrete color, never "transparent"). */+ borderColor: string;+ /** Animated focus-ring color (concrete; softened toward the page bg). */+ ringColor: string;+ /** Focus-ring spread in px (box-shadow). 0 = no ring. */+ ringWidth: number;+ /** Animated field background (a concrete color, never "transparent"). */+ background: string;+ /** Caret bar opacity 0→1. */+ caretOpacity: number;+ /** Value reveal 0→1; multiplies `valueWidth` to clip the text + place the caret. */+ valueReveal: number;+ /** Placeholder opacity 0→1 (fades out as the value reveals). */+ placeholderOpacity: number;+}++/** Concrete colors for the active theme, resolved once per render. */+export interface InputStyleContext {+ idleBorder: string;+ hoverBorder: string;+ activeBorder: string;+ invalidBorder: string;+ /** Resting focus ring (shadcn `ring/50` — ring mixed halfway to the bg). */+ ring: string;+ invalidRing: string;+ background: string;+ /** Subtle hover wash over the page background. */+ hoverBackground: string;+ foreground: string;+ mutedForeground: string;+}++/**+ * Derive the concrete colors for a theme. Pure — call it once and reuse the+ * result for every `inputStyle(state, ctx)` preset.+ */+export function inputStyleContext(theme: RemocnTheme): InputStyleContext {+ return {+ idleBorder: theme.input,+ hoverBorder: mixOklch(theme.input, theme.foreground, 0.18),+ activeBorder: theme.ring,+ invalidBorder: theme.destructive,+ // shadcn focus ring is `ring/50` — soften toward the page background so the+ // mix has a concrete endpoint (never pass "transparent" to mixOklch).+ ring: mixOklch(theme.background, theme.ring, 0.5),+ invalidRing: mixOklch(theme.background, theme.destructive, 0.4),+ background: theme.background,+ hoverBackground: mixOklch(theme.background, theme.muted, 0.4),+ foreground: theme.foreground,+ mutedForeground: theme.mutedForeground,+ };+}++/**+ * The COMPLETE resting visual for a state — a pure `(state, ctx) => InputStyle`+ * map. To change how a state looks, edit one entry.+ */+export function inputStyle(+ state: InputState,+ ctx: InputStyleContext,+): InputStyle {+ switch (state) {+ case "hover":+ return {+ borderColor: ctx.hoverBorder,+ ringColor: ctx.ring,+ ringWidth: 0,+ background: ctx.hoverBackground,+ caretOpacity: 0,+ valueReveal: 0,+ placeholderOpacity: 1,+ };+ case "active":+ return {+ borderColor: ctx.activeBorder,+ ringColor: ctx.ring,+ ringWidth: 3,+ background: ctx.background,+ caretOpacity: 1,+ valueReveal: 0,+ placeholderOpacity: 1,+ };+ case "typing":+ return {+ borderColor: ctx.activeBorder,+ ringColor: ctx.ring,+ ringWidth: 3,+ background: ctx.background,+ caretOpacity: 1,+ valueReveal: 1,+ placeholderOpacity: 0,+ };+ case "invalid":+ return {+ borderColor: ctx.invalidBorder,+ ringColor: ctx.invalidRing,+ ringWidth: 3,+ background: ctx.background,+ caretOpacity: 0,+ valueReveal: 1,+ placeholderOpacity: 0,+ };+ default:+ return {+ borderColor: ctx.idleBorder,+ ringColor: ctx.ring,+ ringWidth: 0,+ background: ctx.background,+ caretOpacity: 0,+ valueReveal: 0,+ placeholderOpacity: 1,+ };+ }+}++export function Input({+ state = "idle",+ style,+ placeholder = "[email protected]",+ value = "[email protected]",+ valueWidth = 168,+ size = "default",+ theme: themeOverride,+ primary,+ mode,+ className,+}: InputProps) {+ const theme = useRemocnTheme(+ { ...themeOverride, ...(primary ? { primary } : {}) },+ mode,+ );++ const sizeStyle = SIZE_STYLES[size];+ const ctx = inputStyleContext(theme);+ const v = style ?? inputStyle(state, ctx);++ return (+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ background: theme.background,+ fontFamily:+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",+ }}+ >+ <div+ className={className}+ style={{+ position: "relative",+ display: "flex",+ alignItems: "center",+ width: FIELD_WIDTH,+ height: sizeStyle.height,+ padding: `0 ${sizeStyle.padding}px`,+ fontSize: sizeStyle.fontSize,+ letterSpacing: "-0.01em",+ background: v.background,+ border: `1px solid ${v.borderColor}`,+ borderRadius: theme.radius,+ // Focus ring — an outset box-shadow that grows from 0 (no ring) to a+ // 3px spread when focused/invalid. Not clipped by overflow.+ boxShadow: `0 0 0 ${v.ringWidth}px ${v.ringColor}`,+ }}+ >+ {/* Placeholder — absolute layer. It vanishes the INSTANT the value+ starts revealing (typing begins), rather than cross-fading, so the+ field never shows placeholder + typed text at once. */}+ <span+ style={{+ position: "absolute",+ left: sizeStyle.padding,+ color: ctx.mutedForeground,+ opacity: v.valueReveal > 0 ? 0 : v.placeholderOpacity,+ pointerEvents: "none",+ whiteSpace: "nowrap",+ }}+ >+ {placeholder}+ </span>+ {/* Value + caret. The value clips to `valueWidth * valueReveal` — an+ authored width (headless render can't measure text) — so the caret+ sits flush against the end of the revealed text, typewriter-style.+ With no value revealed (the `active` focus state) the value box is+ 0-wide, so the caret rests flush at the field's start. The caret is+ shown only by `caretOpacity` (on in `active`/`typing`, off+ otherwise) — never floating away from where the value would be. */}+ <div style={{ display: "flex", alignItems: "center", minWidth: 0 }}>+ <span+ style={{+ display: "inline-block",+ width: valueWidth * v.valueReveal,+ overflow: "hidden",+ whiteSpace: "nowrap",+ color: ctx.foreground,+ }}+ >+ {value}+ </span>+ <span+ style={{+ flexShrink: 0,+ width: 2,+ height: Math.round(sizeStyle.fontSize * 1.1),+ borderRadius: 1,+ background: ctx.foreground,+ opacity: v.caretOpacity,+ }}+ />+ </div>+ </div>+ </div>+ );+}diff --git a/registry/remocn-ui/input/use-input-transition.ts b/registry/remocn-ui/input/use-input-transition.tsnew file mode 100644index 00000000..fac9f8d0--- /dev/null+++ b/registry/remocn-ui/input/use-input-transition.ts@@ -0,0 +1,77 @@+"use client";++import {+ easings,+ mixOklch,+ type RemocnTheme,+ type Step,+ useRemocnTheme,+ useStateTransition,+} from "@/lib/remocn-ui";+import {+ inputStyle,+ inputStyleContext,+ type InputState,+ type InputStyle,+} from "@/components/remocn/input";+// ^ 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 input visuals: numbers lerp, colors via oklch mix. Covers EVERY field. */+export function tweenInputStyle(+ a: InputStyle,+ b: InputStyle,+ t: number,+): InputStyle {+ return {+ ringWidth: a.ringWidth + (b.ringWidth - a.ringWidth) * t,+ caretOpacity: a.caretOpacity + (b.caretOpacity - a.caretOpacity) * t,+ valueReveal: a.valueReveal + (b.valueReveal - a.valueReveal) * t,+ placeholderOpacity:+ a.placeholderOpacity + (b.placeholderOpacity - a.placeholderOpacity) * t,+ borderColor: mixOklch(a.borderColor, b.borderColor, t),+ ringColor: mixOklch(a.ringColor, b.ringColor, t),+ background: mixOklch(a.background, b.background, t),+ };+}++export interface InputTransitionOptions {+ theme?: Partial<RemocnTheme>;+ mode?: "light" | "dark";+ primary?: string;+ speed?: number;+ defaultDuration?: number;+}++/**+ * Timeline → resolved (eased, tweened) InputStyle. The CALLER invokes this; it+ * reads the frame, the `<Input>` component does not. Feed the result to+ * `<Input style={...} />` for smooth transitions.+ */+export function useInputTransition(+ steps: Step<InputState>[],+ opts: InputTransitionOptions = {},+): InputStyle {+ const {+ theme: themeOverride,+ mode,+ primary,+ speed = 1,+ defaultDuration = DEFAULT_DURATION,+ } = opts;+ const theme = useRemocnTheme(+ { ...themeOverride, ...(primary ? { primary } : {}) },+ mode,+ );+ const ctx = inputStyleContext(theme);+ const { from, to, progress } = useStateTransition(+ steps,+ "idle",+ speed,+ defaultDuration,+ );+ const t = easings.out(progress);+ return tweenInputStyle(inputStyle(from, ctx), inputStyle(to, ctx), t);+}diff --git a/registry/remocn-ui/registry.json b/registry/remocn-ui/registry.jsonindex 313019d8..889b887f 100644--- a/registry/remocn-ui/registry.json+++ b/registry/remocn-ui/registry.json@@ -176,6 +176,26 @@"target": "components/remocn/use-switch-transition.ts"}]+ },+ {+ "name": "input",+ "type": "registry:component",+ "title": "UI Input",+ "description": "A text input whose idle/hover/active/typing/invalid state is a pure function of the timeline; the focus ring, border, caret, and value reveal are keyframed presets.",+ "dependencies": ["remotion"],+ "registryDependencies": ["remocn-ui"],+ "files": [+ {+ "path": "input/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/input.tsx"+ },+ {+ "path": "input/use-input-transition.ts",+ "type": "registry:component",+ "target": "components/remocn/use-input-transition.ts"+ }+ ]}]}