Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "input",
"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/remocn-ui", "@remocn/caret"],
"files": [
{
"path": "registry/remocn-ui/input/index.tsx",
"content": "\"use client\";\n\nimport { Caret } from \"@/components/remocn/caret\";\nimport {\n mixOklch,\n type RemocnTheme,\n revealedText,\n useRemocnTheme,\n} from \"@/lib/remocn-ui\";\n\nexport type InputState =\n | \"idle\"\n | \"hover\"\n | \"active\"\n | \"typing\"\n | \"blur\"\n | \"invalid\";\n\ntype InputSize = \"sm\" | \"default\" | \"lg\";\n\nexport interface InputProps {\n state?: InputState;\n style?: InputStyle;\n placeholder?: string;\n value?: string;\n size?: InputSize;\n theme?: Partial<RemocnTheme>;\n primary?: string;\n fullWidth?: boolean;\n className?: string;\n}\n\nconst FIELD_WIDTH = 320;\n\nconst SIZE_STYLES: Record<\n InputSize,\n { height: number; padding: number; fontSize: number }\n> = {\n sm: { height: 36, padding: 12, fontSize: 13 },\n default: { height: 40, padding: 14, fontSize: 15 },\n lg: { height: 48, padding: 16, fontSize: 17 },\n};\n\nexport interface InputStyle {\n borderColor: string;\n ringColor: string;\n ringWidth: number;\n background: string;\n caretOpacity: number;\n valueReveal: number;\n placeholderOpacity: number;\n}\n\nexport interface InputStyleContext {\n idleBorder: string;\n hoverBorder: string;\n activeBorder: string;\n invalidBorder: string;\n ring: string;\n invalidRing: string;\n background: string;\n hoverBackground: string;\n foreground: string;\n mutedForeground: string;\n}\n\nexport function inputStyleContext(theme: RemocnTheme): InputStyleContext {\n return {\n idleBorder: theme.input,\n hoverBorder: mixOklch(theme.input, theme.foreground, 0.18),\n activeBorder: theme.ring,\n invalidBorder: theme.destructive,\n ring: mixOklch(theme.background, theme.ring, 0.5),\n invalidRing: mixOklch(theme.background, theme.destructive, 0.4),\n background: theme.background,\n hoverBackground: mixOklch(theme.background, theme.muted, 0.4),\n foreground: theme.foreground,\n mutedForeground: theme.mutedForeground,\n };\n}\n\nexport function inputStyle(\n state: InputState,\n ctx: InputStyleContext,\n): InputStyle {\n switch (state) {\n case \"hover\":\n return {\n borderColor: ctx.hoverBorder,\n ringColor: ctx.ring,\n ringWidth: 0,\n background: ctx.hoverBackground,\n caretOpacity: 0,\n valueReveal: 0,\n placeholderOpacity: 1,\n };\n case \"active\":\n return {\n borderColor: ctx.activeBorder,\n ringColor: ctx.ring,\n ringWidth: 3,\n background: ctx.background,\n caretOpacity: 1,\n valueReveal: 0,\n placeholderOpacity: 1,\n };\n case \"typing\":\n return {\n borderColor: ctx.activeBorder,\n ringColor: ctx.ring,\n ringWidth: 3,\n background: ctx.background,\n caretOpacity: 1,\n valueReveal: 1,\n placeholderOpacity: 0,\n };\n case \"blur\":\n return {\n borderColor: ctx.idleBorder,\n ringColor: ctx.ring,\n ringWidth: 0,\n background: ctx.background,\n caretOpacity: 0,\n valueReveal: 1,\n placeholderOpacity: 0,\n };\n case \"invalid\":\n return {\n borderColor: ctx.invalidBorder,\n ringColor: ctx.invalidRing,\n ringWidth: 3,\n background: ctx.background,\n caretOpacity: 0,\n valueReveal: 1,\n placeholderOpacity: 0,\n };\n default:\n return {\n borderColor: ctx.idleBorder,\n ringColor: ctx.ring,\n ringWidth: 0,\n background: ctx.background,\n caretOpacity: 0,\n valueReveal: 0,\n placeholderOpacity: 1,\n };\n }\n}\n\nexport function Input({\n state = \"idle\",\n style,\n placeholder = \"[email protected]\",\n value = \"[email protected]\",\n size = \"default\",\n theme: themeOverride,\n primary,\n fullWidth = false,\n className,\n}: InputProps) {\n const theme = useRemocnTheme(\n { ...themeOverride, ...(primary ? { primary } : {}) },\n \"light\",\n );\n\n const sizeStyle = SIZE_STYLES[size];\n const ctx = inputStyleContext(theme);\n const v = style ?? inputStyle(state, ctx);\n const revealed = revealedText(\n value,\n Math.round(value.length * v.valueReveal),\n );\n\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"transparent\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n display: \"flex\",\n alignItems: \"center\",\n width: fullWidth ? \"100%\" : FIELD_WIDTH,\n height: sizeStyle.height,\n padding: `0 ${sizeStyle.padding}px`,\n fontSize: sizeStyle.fontSize,\n letterSpacing: \"-0.01em\",\n background: v.background,\n border: `1px solid ${v.borderColor}`,\n borderRadius: theme.radius,\n boxShadow: `0 0 0 ${v.ringWidth}px ${v.ringColor}`,\n }}\n >\n {}\n <span\n style={{\n position: \"absolute\",\n left: sizeStyle.padding,\n color: ctx.mutedForeground,\n opacity: v.valueReveal > 0 ? 0 : v.placeholderOpacity,\n pointerEvents: \"none\",\n whiteSpace: \"nowrap\",\n }}\n >\n {placeholder}\n </span>\n {}\n <div style={{ display: \"flex\", alignItems: \"center\", minWidth: 0 }}>\n <span style={{ whiteSpace: \"nowrap\", color: ctx.foreground }}>\n {revealed}\n </span>\n <Caret\n color={ctx.foreground}\n height={Math.round(sizeStyle.fontSize * 1.1)}\n radius={1}\n opacity={v.caretOpacity}\n marginLeft={revealed.length > 0 ? 4 : 0}\n />\n </div>\n </div>\n </div>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/input.tsx"
},
{
"path": "registry/remocn-ui/input/use-input-transition.ts",
"content": "\"use client\";\n\nimport {\n type InputState,\n type InputStyle,\n inputStyle,\n inputStyleContext,\n} from \"@/components/remocn/input\";\nimport {\n easings,\n mixOklch,\n type RemocnTheme,\n type Step,\n useRemocnTheme,\n useStateTransition,\n} from \"@/lib/remocn-ui\";\n\nexport const DEFAULT_DURATION = 8;\n\nexport function tweenInputStyle(\n a: InputStyle,\n b: InputStyle,\n t: number,\n): InputStyle {\n return {\n ringWidth: a.ringWidth + (b.ringWidth - a.ringWidth) * t,\n caretOpacity: a.caretOpacity + (b.caretOpacity - a.caretOpacity) * t,\n valueReveal: a.valueReveal + (b.valueReveal - a.valueReveal) * t,\n placeholderOpacity:\n a.placeholderOpacity + (b.placeholderOpacity - a.placeholderOpacity) * t,\n borderColor: mixOklch(a.borderColor, b.borderColor, t),\n ringColor: mixOklch(a.ringColor, b.ringColor, t),\n background: mixOklch(a.background, b.background, t),\n };\n}\n\nexport interface InputTransitionOptions {\n theme?: Partial<RemocnTheme>;\n mode?: \"light\" | \"dark\";\n primary?: string;\n speed?: number;\n defaultDuration?: number;\n}\n\nexport function useInputTransition(\n steps: Step<InputState>[],\n opts: InputTransitionOptions = {},\n): InputStyle {\n const {\n theme: themeOverride,\n mode,\n primary,\n speed = 1,\n defaultDuration = DEFAULT_DURATION,\n } = opts;\n const theme = useRemocnTheme(\n { ...themeOverride, ...(primary ? { primary } : {}) },\n mode,\n );\n const ctx = inputStyleContext(theme);\n const { from, to, progress } = useStateTransition(\n steps,\n \"idle\",\n speed,\n defaultDuration,\n );\n const t = easings.out(progress);\n return tweenInputStyle(inputStyle(from, ctx), inputStyle(to, ctx), t);\n}\n",
"type": "registry:component",
"target": "components/remocn/use-input-transition.ts"
}
],
"type": "registry:component"
}