{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"blur-reveal","type":"registry:ui","title":"BlurReveal","description":"Scroll-triggered reveal that unblurs and slides each direct child into place as the container enters the viewport, staggering up to 10 children via CSS nth-child delays and respecting reduced motion","author":"fancy-ui <https://fancy-ui.rama.app>","categories":["text"],"registryDependencies":["https://fancy-ui.rama.app/r/utils.json"],"files":[{"path":"react/src/components/blur-reveal/BlurReveal.tsx","content":"\"use client\";\n\nimport { useEffect, useRef, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { cn } from \"../../utils\";\nimport \"./blur-reveal.css\";\n\n/** Props for BlurReveal */\nexport interface BlurRevealProps {\n\t/** Animation duration in seconds */\n\tduration?: number;\n\t/** Stagger delay between children in seconds */\n\tdelay?: number;\n\t/** Initial blur amount (CSS value) */\n\tblur?: string;\n\t/** Initial vertical offset in pixels */\n\tyOffset?: number;\n\t/** Additional CSS classes for the container */\n\tclassName?: string;\n\t/** Reveal style: \"blur\" softens in with blur/translate, \"hard\" snaps opacity with no easing */\n\tmode?: \"blur\" | \"hard\";\n\t/** Content to reveal */\n\tchildren?: ReactNode;\n}\n\nexport function BlurReveal({\n\tduration = 1,\n\tdelay = 0.2,\n\tblur = \"20px\",\n\tyOffset = 20,\n\tclassName,\n\tmode = \"blur\",\n\tchildren,\n}: BlurRevealProps) {\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\tconst [isInView, setIsInView] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst container = containerRef.current;\n\t\tif (!container) return;\n\n\t\tconst observer = new IntersectionObserver(\n\t\t\t(entries) => {\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tsetIsInView(true);\n\t\t\t\t\t\tobserver.disconnect();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ threshold: 0.1 }\n\t\t);\n\n\t\tobserver.observe(container);\n\n\t\treturn () => observer.disconnect();\n\t}, []);\n\n\tconst style = {\n\t\t\"--blur-reveal-duration\": `${duration}s`,\n\t\t\"--blur-reveal-delay\": `${delay}s`,\n\t\t\"--blur-reveal-blur\": blur,\n\t\t\"--blur-reveal-y\": `${yOffset}px`,\n\t} as CSSProperties;\n\n\treturn (\n\t\t<div ref={containerRef} className={cn(className)} style={style}>\n\t\t\t{children ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\"blur-reveal-wrapper\", isInView && \"is-visible\", mode === \"hard\" && \"mode-hard\")}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n","type":"registry:ui","target":"@ui/fancy/components/blur-reveal/BlurReveal.tsx"},{"path":"react/src/components/blur-reveal/blur-reveal.css","content":".blur-reveal-wrapper > * {\n\topacity: 0;\n\tfilter: blur(var(--blur-reveal-blur, 20px));\n\ttransform: translateY(var(--blur-reveal-y, 20px));\n\ttransition:\n\t\topacity var(--blur-reveal-duration, 1s) ease-in-out,\n\t\tfilter var(--blur-reveal-duration, 1s) ease-in-out,\n\t\ttransform var(--blur-reveal-duration, 1s) ease-in-out;\n}\n\n.blur-reveal-wrapper.is-visible > * {\n\topacity: 1;\n\tfilter: blur(0px);\n\ttransform: translateY(0);\n}\n\n/* Stagger delays for direct children */\n.blur-reveal-wrapper.is-visible > :nth-child(1) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 0);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(2) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 1);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(3) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 2);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(4) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 3);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(5) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 4);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(6) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 5);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(7) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 6);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(8) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 7);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(9) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 8);\n}\n.blur-reveal-wrapper.is-visible > :nth-child(10) {\n\ttransition-delay: calc(var(--blur-reveal-delay, 0.2s) * 9);\n}\n\n/* Hard mode: no blur/translate softening, opacity snaps in via a stepped timing function */\n.blur-reveal-wrapper.mode-hard > * {\n\topacity: 0;\n\tfilter: none;\n\ttransform: none;\n\ttransition: opacity var(--blur-reveal-duration, 1s) steps(2, jump-none);\n}\n\n.blur-reveal-wrapper.mode-hard.is-visible > * {\n\topacity: 1;\n}\n\n/* Respect reduced motion */\n@media (prefers-reduced-motion: reduce) {\n\t.blur-reveal-wrapper > * {\n\t\ttransition-duration: 0.1s !important;\n\t\ttransition-delay: 0s !important;\n\t}\n}\n","type":"registry:ui","target":"@ui/fancy/components/blur-reveal/blur-reveal.css"},{"path":"react/src/components/blur-reveal/index.ts","content":"\"use client\";\n\nexport { BlurReveal } from \"./BlurReveal\";\nexport type { BlurRevealProps } from \"./BlurReveal\";\n","type":"registry:ui","target":"@ui/fancy/components/blur-reveal/index.ts"}],"meta":{"license":"MIT","package":"fancy-ui-react","version":"0.7.0","source":"https://fancy-ui.rama.app/docs/components/blur-reveal?framework=react"}}