Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: refactor input cursor. added input blur state
dev_wandry27bc2ff15476
diff --git a/content/docs/ui/components/input.mdx b/content/docs/ui/components/input.mdxindex 6e2d3c4d..0d951a8e 100644--- a/content/docs/ui/components/input.mdx+++ b/content/docs/ui/components/input.mdx@@ -5,7 +5,7 @@ description: An input field whose visual state is a pure function of the timelin<UiComponentPreview 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.+A state atom whose appearance (idle, hover, active, typing, blur, 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@@ -25,10 +25,11 @@ type InputState =| "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+ | "blur" // filled but unfocused: value fully shown + static, no ring, no caret, resting border| "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.+`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. `blur` is the filled-but-unfocused resting state — the value stays fully shown and static (a `typing → blur` transition never un-types the value), but the focus ring and caret are gone and the border relaxes to its idle tone. `invalid` uses the destructive color tokens for both border and ring.## Snap usage (simple path)@@ -92,7 +93,7 @@ The `duration` field on each step overrides the file's `DEFAULT_DURATION` for throws={[{name: "state",- type: "\"idle\" | \"hover\" | \"active\" | \"typing\" | \"invalid\"",+ type: "\"idle\" | \"hover\" | \"active\" | \"typing\" | \"blur\" | \"invalid\"",default: "\"idle\"",description: "Current visual state (snap path). State changes snap — no automatic cross-fade.",},@@ -111,13 +112,7 @@ The `duration` field on each step overrides the file's `DEFAULT_DURATION` for thname: "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.",+ description: "The typed value revealed in the typing/invalid states. Reveals character-by-character (typewriter); the caret sits a fixed 4px after the last visible glyph.",},{name: "size",diff --git a/registry/remocn-ui/ai-prompt-flow/index.tsx b/registry/remocn-ui/ai-prompt-flow/index.tsxindex 2039dacb..ac69ee3f 100644--- a/registry/remocn-ui/ai-prompt-flow/index.tsx+++ b/registry/remocn-ui/ai-prompt-flow/index.tsx@@ -142,7 +142,6 @@ export function AiPromptFlow({<Inputplaceholder="Ask anything…"value={prompt}- valueWidth={186}style={inputStyle}mode={mode}theme={theme}diff --git a/registry/remocn-ui/checkout-flow/index.tsx b/registry/remocn-ui/checkout-flow/index.tsxindex 9971b77c..b8ca435a 100644--- a/registry/remocn-ui/checkout-flow/index.tsx+++ b/registry/remocn-ui/checkout-flow/index.tsx@@ -198,7 +198,6 @@ export function CheckoutFlow({style={cardStyle}placeholder={cardPlaceholder}value={cardPlaceholder}- valueWidth={208}mode={mode}theme={theme}/>diff --git a/registry/remocn-ui/input/__tests__/README.md b/registry/remocn-ui/input/__tests__/README.mdindex 121d4df8..5326d515 100644--- a/registry/remocn-ui/input/__tests__/README.md+++ b/registry/remocn-ui/input/__tests__/README.md@@ -43,11 +43,11 @@ 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`).+- **`InputState` union** — asserts the six states+ `["idle","hover","active","typing","blur","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"`+ `select` control exists with exactly those six options, default `"typing"`(so the preview showcases the caret + revealed value), and that every optionis a member of the `InputState` union.- **`inputConfig.snippet`** — REAL pure string builder (high value).@@ -71,6 +71,7 @@ or framework dep is added to `package.json`.| hover | 0 | 0 | 0 | 1 || active | 3 | 1 | 0 | 1 || typing | 3 | 1 | 1 | 0 |+ | blur | 0 | 0 | 1 | 0 || invalid | 3 | 0 | 1 | 0 |- **`tweenInputStyle`** — exported pure `(a, b, t) => InputStyle`. Asserts:diff --git a/registry/remocn-ui/input/__tests__/input.test.ts b/registry/remocn-ui/input/__tests__/input.test.tsindex ca5ca6a1..a87979bf 100644--- a/registry/remocn-ui/input/__tests__/input.test.ts+++ b/registry/remocn-ui/input/__tests__/input.test.ts@@ -50,6 +50,7 @@ const VALID_STATES: readonly InputState[] = ["hover","active","typing",+ "blur","invalid",];@@ -71,7 +72,7 @@ const snippet = (values: SnippetValues): string =>// ===========================================================================describe("InputState union", () => {- it("contains exactly the five documented states", () => {+ it("contains exactly the six 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;@@ -81,16 +82,17 @@ describe("InputState union", () => {"hover","active","typing",+ "blur","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+ // Belt-and-suspenders: the fixture array must have exactly 6 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);+ expect(VALID_STATES).toHaveLength(6);for (const s of VALID_STATES) {expect(control.options).toContain(s);}@@ -106,7 +108,7 @@ describe("inputConfig.controls.state", () => {expect(inputConfig.controls.state.type).toBe("select");});- it("has exactly the five InputState options in order", () => {+ it("has exactly the six 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([@@ -114,6 +116,7 @@ describe("inputConfig.controls.state", () => {"hover","active","typing",+ "blur","invalid",]);});@@ -155,6 +158,10 @@ describe("inputConfig.snippet: state prop emission", () => {expect(snippet({ state: "typing" })).toContain('state="typing"');});+ it("emits state=\"blur\" for the blur option", () => {+ expect(snippet({ state: "blur" })).toContain('state="blur"');+ });+it("emits state=\"invalid\" for the invalid option", () => {expect(snippet({ state: "invalid" })).toContain('state="invalid"');});@@ -413,6 +420,41 @@ describe("inputStyle: typing state", () => {});});+describe("inputStyle: blur state", () => {+ const s = inputStyle("blur", ctx);++ it("ringWidth is 0 (no focus ring — field is unfocused)", () => {+ expect(s.ringWidth).toBe(0);+ });++ it("caretOpacity is 0 (caret hidden when blurred)", () => {+ expect(s.caretOpacity).toBe(0);+ });++ it("valueReveal is 1 (value stays fully shown — no un-typing)", () => {+ expect(s.valueReveal).toBe(1);+ });++ it("placeholderOpacity is 0 (placeholder stays hidden — value is shown)", () => {+ 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);diff --git a/registry/remocn-ui/input/config.ts b/registry/remocn-ui/input/config.tsindex c9dc8e26..a759348f 100644--- a/registry/remocn-ui/input/config.ts+++ b/registry/remocn-ui/input/config.ts@@ -21,7 +21,7 @@ export const inputConfig: ComponentConfig = {type: "select",// Default to `typing` so the preview shows the caret + revealed value.default: "typing",- options: ["idle", "hover", "active", "typing", "invalid"],+ options: ["idle", "hover", "active", "typing", "blur", "invalid"],label: "State",},mode: {diff --git a/registry/remocn-ui/input/index.tsx b/registry/remocn-ui/input/index.tsxindex 7e457388..1a2e73cd 100644--- a/registry/remocn-ui/input/index.tsx+++ b/registry/remocn-ui/input/index.tsx@@ -2,7 +2,13 @@import { mixOklch, type RemocnTheme, useRemocnTheme } from "@/lib/remocn-ui";-export type InputState = "idle" | "hover" | "active" | "typing" | "invalid";+export type InputState =+ | "idle"+ | "hover"+ | "active"+ | "typing"+ | "blur"+ | "invalid";type InputSize = "sm" | "default" | "lg";@@ -18,12 +24,6 @@ export interface InputProps {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`. */@@ -62,7 +62,7 @@ export interface InputStyle {background: string;/** Caret bar opacity 0→1. */caretOpacity: number;- /** Value reveal 0→1; multiplies `valueWidth` to clip the text + place the caret. */+ /** Value reveal 0→1; the fraction of the value shown as a substring (typewriter). */valueReveal: number;/** Placeholder opacity 0→1 (fades out as the value reveals). */placeholderOpacity: number;@@ -144,6 +144,19 @@ export function inputStyle(valueReveal: 1,placeholderOpacity: 0,};+ case "blur":+ // Filled but unfocused: the value stays fully shown (valueReveal 1, so a+ // typing→blur transition never un-types), but the focus ring and caret are+ // gone and the border relaxes to its resting tone.+ return {+ borderColor: ctx.idleBorder,+ ringColor: ctx.ring,+ ringWidth: 0,+ background: ctx.background,+ caretOpacity: 0,+ valueReveal: 1,+ placeholderOpacity: 0,+ };case "invalid":return {borderColor: ctx.invalidBorder,@@ -172,7 +185,6 @@ export function Input({style,placeholder = "[email protected]",value = "[email protected]",- valueWidth = 168,size = "default",theme: themeOverride,primary,@@ -187,6 +199,10 @@ export function Input({const sizeStyle = SIZE_STYLES[size];const ctx = inputStyleContext(theme);const v = style ?? inputStyle(state, ctx);+ // Typewriter substring — reveal `valueReveal` of the value character-by-+ // character. The value box is content-sized, so the caret sits a fixed 4px+ // after the last visible glyph (no authored width, no floating caret).+ const revealed = value.slice(0, Math.round(value.length * v.valueReveal));return (<div@@ -235,24 +251,14 @@ export function Input({>{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. */}+ {/* Value + caret. The value is a content-sized substring (typewriter),+ so the caret sits a fixed 4px after the last visible glyph — never+ floating in authored whitespace. With no value revealed (the `active`+ focus state) the caret rests at the field's start. The caret is shown+ only by `caretOpacity` (on in `active`/`typing`, off otherwise). */}<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 style={{ whiteSpace: "nowrap", color: ctx.foreground }}>+ {revealed}</span><spanstyle={{@@ -262,6 +268,7 @@ export function Input({borderRadius: 1,background: ctx.foreground,opacity: v.caretOpacity,+ marginLeft: revealed.length > 0 ? 4 : 0,}}/></div>diff --git a/registry/remocn-ui/onboarding-stepper-flow/index.tsx b/registry/remocn-ui/onboarding-stepper-flow/index.tsxindex 91779648..b4cf0bf3 100644--- a/registry/remocn-ui/onboarding-stepper-flow/index.tsx+++ b/registry/remocn-ui/onboarding-stepper-flow/index.tsx@@ -138,7 +138,6 @@ export function OnboardingStepperFlow({style={nameStyle}placeholder={name}value={name}- valueWidth={150}mode={mode}theme={theme}/>diff --git a/registry/remocn-ui/signup-flow/index.tsx b/registry/remocn-ui/signup-flow/index.tsxindex bf1c16e4..73261fbf 100644--- a/registry/remocn-ui/signup-flow/index.tsx+++ b/registry/remocn-ui/signup-flow/index.tsx@@ -40,43 +40,29 @@ export interface SignupFlowProps {theme?: Partial<RemocnTheme>;}-// ── Stage + card geometry (1280×720). The card surface is theme.background so-// the Input/Button atoms (which paint their own inset:0 theme.background fill)-// blend into it in BOTH light and dark; the stage sits on theme.muted so the-// card lifts off the page via tone + border + shadow. Card content flows in a-// padded column; the cursor targets each control's vertical center, derived-// from the fixed field metrics below (label 18 + gap 6 + control 40, group-// gap 16) so the click visually lands on the field. The focus itself is-// frame-driven (each click `at` == the field's `active` `at`), not position--// driven, so the animation stays exact regardless of pixel rounding.const STAGE_W = 1280;const CARD_W = 376;const CARD_TOP = 48;const CARD_LEFT = (STAGE_W - CARD_W) / 2; // 452const CENTER_X = STAGE_W / 2; // 640 — the centered content column-// Cursor tip targets — each control's vertical center (see metrics above).-const NAME_Y = 196;-const EMAIL_Y = 276;-const PASS_Y = 378;-const CONFIRM_Y = 480;-const CREATE_Y = 544;+// Cursor tip targets — each control's vertical center, derived from the flow:+// card top 48 + pad 28 → content y 76. Header = title(28) + gap4 + desc(40, the+// description wraps to 2 lines in the 320px column) = 72 → ends 148. gap24 →+// FieldGroup at 172 (Field = label 18 + gap6 + control 40; group gap 16):+// Name control 196–236 → center 216+// Email control 276–316 → center 296 (+ desc 16)+// Pass control 378–418 → center 398 (+ desc 16)+// Confirm control 480–520 → center 500+// gap24 → action Field at 544: Create control 544–584 → center 564.+// (The click only needs to land on the field; focus is frame-driven, so a few+// px of font drift is harmless.)+const NAME_Y = 216;+const EMAIL_Y = 296;+const PASS_Y = 398;+const CONFIRM_Y = 500;+const CREATE_Y = 564;-/**- * Cursor-driven signup card: the pointer fills each labeled field top-to-bottom- * (Full Name → Email → Password → Confirm), then clicks "Create account"- * (hover → press → loading → success) and a success toast slides in. A pure- * orchestrator — every animated channel comes from a composed primitive's own- * transition hook (`useCursorPath` / `use*Transition`); the block holds no- * state, effects, or frame reads of its own. The card chrome and form layout- * are composed from the static `Field` family (FieldGroup / Field / FieldLabel- * / FieldControl / FieldDescription).- *- * Frame-sync: each cursor-click `at` equals the field's `active` `at`- * (18, 52, 96, 134) and the button `hover` `at` (176); the button `success`- * `at` equals the toast enter `at` (234). Type windows never overlap the next- * field's click.- */export function SignupFlow({title = "Create an account",description = "Enter your information below to create your account",@@ -84,8 +70,6 @@ export function SignupFlow({email = "[email protected]",password = "••••••••",createLabel = "Create account",- googleLabel = "Sign up with Google",- signinText = "Already have an account?",toastTitle = "Account created",mode = "light",theme,@@ -106,10 +90,15 @@ export function SignupFlow({// Each field focuses on its click, then reveals its typed value. Each field's// own hook holds the filled visual afterward.+ // Each field focuses on its click, types its value, then BLURS (state `blur`)+ // the moment the cursor clicks the next field/button — so only the focused+ // field ever shows the ring + caret. `blur` keeps the value fully shown and+ // static (no un-typing); the previously-typed fields stay filled.const nameStyle = useInputTransition([{ at: 18, state: "active", duration: 6 },{ at: 20, state: "typing", duration: 20 },+ { at: 52, state: "blur", duration: 8 },],opts,);@@ -117,6 +106,7 @@ export function SignupFlow({[{ at: 52, state: "active", duration: 6 },{ at: 54, state: "typing", duration: 28 },+ { at: 96, state: "blur", duration: 8 },],opts,);@@ -124,6 +114,7 @@ export function SignupFlow({[{ at: 96, state: "active", duration: 6 },{ at: 98, state: "typing", duration: 22 },+ { at: 134, state: "blur", duration: 8 },],opts,);@@ -131,6 +122,7 @@ export function SignupFlow({[{ at: 134, state: "active", duration: 6 },{ at: 136, state: "typing", duration: 22 },+ { at: 176, state: "blur", duration: 8 },],opts,);@@ -175,7 +167,7 @@ export function SignupFlow({left: CARD_LEFT,top: CARD_TOP,width: CARD_W,- height: 620,+ height: 580,boxSizing: "border-box",padding: 28,display: "flex",@@ -222,7 +214,6 @@ export function SignupFlow({<Inputplaceholder={fullName}value={fullName}- valueWidth={72}style={nameStyle}mode={mode}theme={theme}@@ -238,7 +229,6 @@ export function SignupFlow({<Inputplaceholder={email}value={email}- valueWidth={108}style={emailStyle}mode={mode}theme={theme}@@ -257,7 +247,6 @@ export function SignupFlow({<Inputplaceholder={password}value={password}- valueWidth={70}style={passStyle}mode={mode}theme={theme}@@ -276,7 +265,6 @@ export function SignupFlow({<Inputplaceholder={password}value={password}- valueWidth={70}style={confirmStyle}mode={mode}theme={theme}@@ -295,28 +283,6 @@ export function SignupFlow({theme={theme}/></FieldControl>- <FieldControl>- <Button- label={googleLabel}- variant="outline"- state="idle"- mode={mode}- theme={theme}- />- </FieldControl>- <FieldDescription align="center" mode={mode} theme={theme}>- {signinText}{" "}- <span- style={{- color: resolved.foreground,- fontWeight: 500,- textDecoration: "underline",- textUnderlineOffset: 2,- }}- >- Sign in- </span>- </FieldDescription></Field></div>