{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"reveal","type":"registry:ui","title":"Reveal","description":"Scroll reveal wrapper with fade, rise, blur and scale presets plus a RevealGroup for staggered children.","dependencies":["motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/reveal/reveal.tsx","type":"registry:ui","target":"components/facade/reveal.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport type { Variants } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type RevealPreset = \"fade\" | \"rise\" | \"blur\" | \"scale\";\n\nconst presets: Record<RevealPreset, Variants> = {\n  fade: {\n    hidden: { opacity: 0 },\n    visible: { opacity: 1 },\n  },\n  rise: {\n    hidden: { opacity: 0, y: 24 },\n    visible: { opacity: 1, y: 0 },\n  },\n  blur: {\n    hidden: { opacity: 0, y: 12, filter: \"blur(10px)\" },\n    visible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n  },\n  scale: {\n    hidden: { opacity: 0, scale: 0.96, y: 8 },\n    visible: { opacity: 1, scale: 1, y: 0 },\n  },\n};\n\nconst reduced: Variants = {\n  hidden: { opacity: 0 },\n  visible: { opacity: 1 },\n};\n\nconst ease = [0.16, 1, 0.3, 1] as const;\n\ninterface RevealContextValue {\n  preset: RevealPreset;\n  duration: number;\n}\n\nconst RevealGroupContext = React.createContext<RevealContextValue | null>(null);\n\nexport interface RevealProps {\n  children?: React.ReactNode;\n  /** Animation preset. Inherits from a parent RevealGroup, otherwise \"rise\". */\n  preset?: RevealPreset;\n  /** Delay in seconds (standalone use only). Defaults to 0. */\n  delay?: number;\n  /** Duration in seconds. Defaults to 0.7. */\n  duration?: number;\n  /** Animate only the first time it enters view. Defaults to true. */\n  once?: boolean;\n  /** Fraction of the element that must be visible. Defaults to 0.25. */\n  amount?: number;\n  className?: string;\n}\n\n/**\n * Animates its children into view. Inside a RevealGroup it becomes a\n * staggered child and follows the group's timing.\n */\nexport function Reveal({\n  children,\n  preset,\n  delay = 0,\n  duration,\n  once = true,\n  amount = 0.25,\n  className,\n}: RevealProps) {\n  const reduce = useReducedMotion();\n  const group = React.useContext(RevealGroupContext);\n  const p = preset ?? group?.preset ?? \"rise\";\n  const d = duration ?? group?.duration ?? 0.7;\n  const variants = reduce ? reduced : presets[p];\n\n  if (group) {\n    return (\n      <motion.div variants={variants} transition={{ duration: d, ease }} className={className}>\n        {children}\n      </motion.div>\n    );\n  }\n\n  return (\n    <motion.div\n      variants={variants}\n      initial=\"hidden\"\n      whileInView=\"visible\"\n      viewport={{ once, amount }}\n      transition={{ duration: d, delay, ease }}\n      className={className}\n    >\n      {children}\n    </motion.div>\n  );\n}\n\nexport interface RevealGroupProps {\n  children?: React.ReactNode;\n  /** Preset for every Reveal inside. Defaults to \"rise\". */\n  preset?: RevealPreset;\n  /** Seconds between each child. Defaults to 0.08. */\n  stagger?: number;\n  /** Delay before the first child. Defaults to 0. */\n  delay?: number;\n  /** Duration for each child. Defaults to 0.7. */\n  duration?: number;\n  once?: boolean;\n  amount?: number;\n  /**\n   * Wrap every direct child in a Reveal automatically. Defaults to true.\n   * Set false when you place Reveal elements yourself (for nested layouts).\n   */\n  wrapChildren?: boolean;\n  /** Class applied to the auto-created child wrappers. */\n  itemClassName?: string;\n  className?: string;\n}\n\nexport function RevealGroup({\n  children,\n  preset = \"rise\",\n  stagger = 0.08,\n  delay = 0,\n  duration = 0.7,\n  once = true,\n  amount = 0.2,\n  wrapChildren = true,\n  itemClassName,\n  className,\n}: RevealGroupProps) {\n  const reduce = useReducedMotion();\n  const ctx = React.useMemo(() => ({ preset, duration }), [preset, duration]);\n\n  return (\n    <RevealGroupContext.Provider value={ctx}>\n      <motion.div\n        initial=\"hidden\"\n        whileInView=\"visible\"\n        viewport={{ once, amount }}\n        variants={{\n          hidden: {},\n          visible: { transition: { staggerChildren: reduce ? 0 : stagger, delayChildren: delay } },\n        }}\n        className={cn(className)}\n      >\n        {wrapChildren\n          ? React.Children.map(children, (child) =>\n              child === null || child === undefined || typeof child === \"boolean\" ? null : (\n                <Reveal className={itemClassName}>{child}</Reveal>\n              ),\n            )\n          : children}\n      </motion.div>\n    </RevealGroupContext.Provider>\n  );\n}\n\nexport default Reveal;\n"}],"categories":["layout"],"meta":{"tier":"free","demo":"import { Bath, BedDouble } from \"lucide-react\";\nimport { Reveal, RevealGroup } from \"./reveal\";\n\nconst listings = [\n  { street: \"1847 Alder Lane\", city: \"Portland, OR\", price: \"$689,000\", beds: 3, baths: 2 },\n  { street: \"92 Larkspur Court\", city: \"Lake Oswego, OR\", price: \"$1,140,000\", beds: 4, baths: 3 },\n  { street: \"530 NW Everett St, 4B\", city: \"Portland, OR\", price: \"$449,500\", beds: 2, baths: 2 },\n];\n\n/* Simple house silhouette used as the photo placeholder. */\nfunction HouseArt({ seed }: { seed: number }) {\n  const roof = 26 + seed * 6;\n  return (\n    <svg viewBox=\"0 0 320 140\" className=\"size-full text-foreground\" preserveAspectRatio=\"xMidYMax slice\" aria-hidden>\n      <rect width=\"320\" height=\"140\" fill=\"currentColor\" fillOpacity=\"0.05\" />\n      <path d={`M60 ${140 - 60} L160 ${roof} L260 ${140 - 60} V140 H60 Z`} fill=\"currentColor\" fillOpacity=\"0.1\" />\n      <rect x=\"96\" y={140 - 46} width=\"22\" height=\"46\" rx=\"2\" fill=\"currentColor\" fillOpacity=\"0.22\" />\n      <rect x={140 + seed * 14} y={140 - 56} width=\"40\" height=\"26\" rx=\"2\" fill=\"currentColor\" fillOpacity=\"0.1\" />\n      <line x1=\"0\" y1=\"140\" x2=\"320\" y2=\"140\" stroke=\"currentColor\" strokeOpacity=\"0.15\" />\n    </svg>\n  );\n}\n\nexport default function Demo() {\n  return (\n    <section className=\"w-full max-w-4xl\">\n      <Reveal preset=\"blur\">\n        <p className=\"text-xs font-medium uppercase tracking-wider text-muted-foreground\">New this week</p>\n        <h3 className=\"mt-2 font-display text-[28px] font-semibold leading-[1.1] tracking-[-0.03em] text-foreground sm:text-[34px]\">\n          Fresh listings in the Portland area\n        </h3>\n      </Reveal>\n      <RevealGroup preset=\"scale\" stagger={0.1} delay={0.15} className=\"mt-8 grid gap-4 sm:grid-cols-3\">\n        {listings.map((l, i) => (\n          <article key={l.street} className=\"h-full overflow-hidden rounded-[24px] bg-muted text-foreground\">\n            <div className=\"h-32\">\n              <HouseArt seed={i} />\n            </div>\n            <div className=\"p-5\">\n              <p className=\"font-display text-lg font-semibold tracking-[-0.02em]\">{l.price}</p>\n              <p className=\"mt-0.5 text-sm\">{l.street}</p>\n              <p className=\"mt-0.5 text-[13px] text-muted-foreground\">{l.city}</p>\n              <div className=\"mt-4 flex gap-4 text-[13px] text-muted-foreground\">\n                <span className=\"inline-flex items-center gap-1.5\">\n                  <BedDouble className=\"size-3.5\" aria-hidden />\n                  {l.beds} beds\n                </span>\n                <span className=\"inline-flex items-center gap-1.5\">\n                  <Bath className=\"size-3.5\" aria-hidden />\n                  {l.baths} baths\n                </span>\n              </div>\n            </div>\n          </article>\n        ))}\n      </RevealGroup>\n    </section>\n  );\n}\n"}}