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": "alert-dialog",
"title": "UI Alert Dialog",
"description": "A modal alert dialog whose opened/closed state is a pure function of the timeline; the backdrop dim and popup zoom are keyframed presets. Self-contained — pair it with the Button as a trigger (see the example).",
"dependencies": ["remotion"],
"registryDependencies": ["@remocn/remocn-ui"],
"files": [
{
"path": "registry/remocn-ui/alert-dialog/index.tsx",
"content": "\"use client\";\n\nimport { type RemocnTheme, useRemocnTheme } from \"@/lib/remocn-ui\";\n\nexport type AlertDialogState = \"closed\" | \"opened\";\n\nexport interface AlertDialogProps {\n state?: AlertDialogState;\n style?: AlertDialogStyle;\n title?: string;\n description?: string;\n actionLabel?: string;\n cancelLabel?: string;\n theme?: Partial<RemocnTheme>;\n className?: string;\n}\n\nconst POPUP_WIDTH = 400;\nconst MAX_OVERLAY_ALPHA = 0.5;\n\nexport interface AlertDialogStyle {\n overlayOpacity: number;\n popupOpacity: number;\n popupScale: number;\n popupTranslateY: number;\n}\n\nexport interface AlertDialogStyleContext {\n popoverBg: string;\n popoverFg: string;\n mutedFg: string;\n border: string;\n radius: number;\n actionBg: string;\n actionFg: string;\n cancelFg: string;\n}\n\nexport function alertDialogStyleContext(\n theme: RemocnTheme,\n): AlertDialogStyleContext {\n return {\n popoverBg: theme.popover,\n popoverFg: theme.popoverForeground,\n mutedFg: theme.mutedForeground,\n border: theme.border,\n radius: theme.radius,\n actionBg: theme.destructive,\n actionFg: theme.destructiveForeground,\n cancelFg: theme.foreground,\n };\n}\n\nexport function alertDialogStyle(\n state: AlertDialogState,\n _ctx: AlertDialogStyleContext,\n): AlertDialogStyle {\n switch (state) {\n case \"opened\":\n return {\n overlayOpacity: 1,\n popupOpacity: 1,\n popupScale: 1,\n popupTranslateY: 0,\n };\n default:\n return {\n overlayOpacity: 0,\n popupOpacity: 0,\n popupScale: 0.95,\n popupTranslateY: 8,\n };\n }\n}\n\nexport function AlertDialog({\n state = \"closed\",\n style,\n title = \"Delete account?\",\n description = \"This action cannot be undone. This will permanently remove your data from our servers.\",\n actionLabel = \"Delete\",\n cancelLabel = \"Cancel\",\n theme: themeOverride,\n className,\n}: AlertDialogProps) {\n const theme = useRemocnTheme(themeOverride, \"light\");\n\n const ctx = alertDialogStyleContext(theme);\n const v = style ?? alertDialogStyle(state, ctx);\n\n const buttonBase: React.CSSProperties = {\n height: 40,\n padding: \"0 20px\",\n fontSize: 15,\n fontWeight: 500,\n letterSpacing: \"-0.01em\",\n borderRadius: ctx.radius,\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n };\n\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n }}\n >\n {}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: `rgba(0, 0, 0, ${MAX_OVERLAY_ALPHA * v.overlayOpacity})`,\n }}\n />\n <div\n className={className}\n style={{\n position: \"relative\",\n width: POPUP_WIDTH,\n transform: `translateY(${v.popupTranslateY}px) scale(${v.popupScale})`,\n opacity: v.popupOpacity,\n background: ctx.popoverBg,\n color: ctx.popoverFg,\n border: `1px solid ${ctx.border}`,\n borderRadius: ctx.radius + 6,\n padding: 24,\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n boxShadow: \"0 24px 48px -12px rgba(0,0,0,0.25)\",\n }}\n >\n <div\n style={{ fontSize: 18, fontWeight: 500, letterSpacing: \"-0.01em\" }}\n >\n {title}\n </div>\n <div style={{ fontSize: 14, lineHeight: 1.5, color: ctx.mutedFg }}>\n {description}\n </div>\n <div\n style={{\n display: \"flex\",\n justifyContent: \"flex-end\",\n gap: 8,\n marginTop: 16,\n }}\n >\n {}\n <button\n type=\"button\"\n style={{\n ...buttonBase,\n background: \"transparent\",\n color: ctx.cancelFg,\n border: `1px solid ${ctx.border}`,\n }}\n >\n {cancelLabel}\n </button>\n {}\n <button\n type=\"button\"\n style={{\n ...buttonBase,\n background: ctx.actionBg,\n color: ctx.actionFg,\n border: \"1px solid transparent\",\n }}\n >\n {actionLabel}\n </button>\n </div>\n </div>\n </div>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/alert-dialog.tsx"
},
{
"path": "registry/remocn-ui/alert-dialog/use-alert-dialog-transition.ts",
"content": "\"use client\";\n\nimport {\n type AlertDialogState,\n type AlertDialogStyle,\n alertDialogStyle,\n alertDialogStyleContext,\n} from \"@/components/remocn/alert-dialog\";\nimport {\n easings,\n type RemocnTheme,\n type Step,\n useRemocnTheme,\n useStateTransition,\n} from \"@/lib/remocn-ui\";\n\nexport const DEFAULT_DURATION = 12;\n\nexport function tweenAlertDialogStyle(\n a: AlertDialogStyle,\n b: AlertDialogStyle,\n t: number,\n): AlertDialogStyle {\n return {\n overlayOpacity:\n a.overlayOpacity + (b.overlayOpacity - a.overlayOpacity) * t,\n popupOpacity: a.popupOpacity + (b.popupOpacity - a.popupOpacity) * t,\n popupScale: a.popupScale + (b.popupScale - a.popupScale) * t,\n popupTranslateY:\n a.popupTranslateY + (b.popupTranslateY - a.popupTranslateY) * t,\n };\n}\n\nexport interface AlertDialogTransitionOptions {\n theme?: Partial<RemocnTheme>;\n mode?: \"light\" | \"dark\";\n speed?: number;\n defaultDuration?: number;\n}\n\nexport function useAlertDialogTransition(\n steps: Step<AlertDialogState>[],\n opts: AlertDialogTransitionOptions = {},\n): AlertDialogStyle {\n const {\n theme: themeOverride,\n mode,\n speed = 1,\n defaultDuration = DEFAULT_DURATION,\n } = opts;\n const theme = useRemocnTheme(themeOverride, mode);\n const ctx = alertDialogStyleContext(theme);\n const { from, to, progress } = useStateTransition(\n steps,\n \"closed\",\n speed,\n defaultDuration,\n );\n const t = easings.out(progress);\n return tweenAlertDialogStyle(\n alertDialogStyle(from, ctx),\n alertDialogStyle(to, ctx),\n t,\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/use-alert-dialog-transition.ts"
}
],
"type": "registry:component"
}