{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "curved-wall",
  "title": "Curved Image Wall",
  "description": "Screens on a 3D ring you can drag and fling. It drifts while idle, steps with the arrow keys, pauses off screen and stays still under reduced motion.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "src/registry/easeout/curved-wall.tsx",
      "content": "\"use client\"\n\n// Curved image wall by Easeout (easeoutstudio.com). Free to use, MIT.\n// Install: npx shadcn@latest add @easeout/curved-wall\n// One file. React + motion/react + Tailwind CSS. Drag (or swipe) to spin; it keeps momentum, then drifts.\n// Arrow keys step one card at a time. Pauses while hovered, off screen or in a hidden tab, and stays still\n// for people who prefer reduced motion. The soft edges are a mask, so it looks right on any background.\nimport { animate, motion, useMotionValue, useReducedMotion, useTransform } from \"motion/react\"\nimport { useEffect, useRef, useState } from \"react\"\n\ntype Props = {\n  images: { src: string; alt: string }[]\n  cardWidth?: number // px, the largest a card gets; it shrinks to fit narrow containers\n  speed?: number // degrees per second while idle\n  label?: string // what the wall shows, for screen readers\n}\n\nconst EASE = [0.16, 1, 0.3, 1] as const\n\nexport function CurvedWall({ images, cardWidth = 420, speed = 6, label = \"Image wall\" }: Props) {\n  const box = useRef<HTMLDivElement>(null)\n  const [width, setWidth] = useState(cardWidth)\n  const n = images.length\n  const step = 360 / n\n  const radius = Math.round(width / (2 * Math.tan(Math.PI / n)))\n  const angle = useMotionValue(0)\n  const transform = useTransform(angle, (a) => `translateZ(${-radius}px) rotateY(${a}deg)`)\n  const reduce = useReducedMotion()\n  const busy = useRef(false) // dragging or animating: the drift waits\n  const paused = useRef(false) // hovered, off screen or tab hidden\n\n  // cards fit the container: never wider than ~58% of it\n  useEffect(() => {\n    const el = box.current\n    if (!el) return\n    const ro = new ResizeObserver(([e]) => setWidth(Math.min(cardWidth, Math.round(e.contentRect.width * 0.58))))\n    ro.observe(el)\n    return () => ro.disconnect()\n  }, [cardWidth])\n\n  // idle drift, only while visible\n  useEffect(() => {\n    if (reduce) return\n    const el = box.current\n    let visible = true\n    const io = new IntersectionObserver(([e]) => (visible = e.isIntersecting))\n    if (el) io.observe(el)\n    let raf = 0\n    let last = performance.now()\n    const tick = (now: number) => {\n      const dt = Math.min(64, now - last) / 1000\n      last = now\n      if (visible && !busy.current && !paused.current && document.visibilityState === \"visible\") angle.set(angle.get() - dt * speed)\n      raf = requestAnimationFrame(tick)\n    }\n    raf = requestAnimationFrame(tick)\n    return () => {\n      cancelAnimationFrame(raf)\n      io.disconnect()\n    }\n  }, [angle, speed, reduce])\n\n  // ease to the nearest card face (keyboard), then hand back to the drift\n  const go = (dir: number) => {\n    busy.current = true\n    const target = Math.round(angle.get() / step) * step + dir * step\n    animate(angle, target, reduce ? { duration: 0 } : { type: \"spring\", stiffness: 140, damping: 22 }).then(() => (busy.current = false))\n  }\n\n  return (\n    <div\n      ref={box}\n      role=\"group\"\n      aria-roledescription=\"carousel\"\n      aria-label={`${label}. Drag or use the arrow keys to spin.`}\n      tabIndex={0}\n      onKeyDown={(e) => {\n        if (e.key !== \"ArrowLeft\" && e.key !== \"ArrowRight\") return\n        e.preventDefault()\n        go(e.key === \"ArrowLeft\" ? 1 : -1)\n      }}\n      onPointerEnter={(e) => e.pointerType === \"mouse\" && (paused.current = true)}\n      onPointerLeave={() => (paused.current = false)}\n      className=\"relative w-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-2\"\n      style={{ height: `min(60vh, ${Math.round(width * 1.15)}px)` }}\n    >\n      {/* the stage: perspective for the 3D ring, and a mask for the soft edges (so the focus ring above stays crisp) */}\n      <div\n        className=\"absolute inset-0 cursor-grab touch-pan-y select-none overflow-hidden rounded-[inherit] active:cursor-grabbing\"\n        style={{\n          perspective: 1600,\n          maskImage: \"linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent)\",\n          WebkitMaskImage: \"linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent)\",\n        }}\n      >\n        <motion.div\n          className=\"absolute inset-0\"\n          onPanStart={() => {\n            busy.current = true\n            angle.stop()\n          }}\n          onPan={(_, info) => angle.set(angle.get() + info.delta.x * 0.18)}\n          onPanEnd={(_, info) => {\n            // fling with momentum (capped), then hand back to the idle drift\n            const fling = reduce ? 0 : Math.max(-120, Math.min(120, info.velocity.x * 0.04))\n            animate(angle, angle.get() + fling, { duration: reduce ? 0 : 1.2, ease: EASE }).then(() => (busy.current = false))\n          }}\n        >\n          <motion.div className=\"absolute left-1/2 top-1/2\" style={{ transformStyle: \"preserve-3d\", transform, width: 0, height: 0 }}>\n            {images.map((img, i) => (\n              <figure\n                key={`${img.src}-${i}`}\n                className=\"absolute m-0 overflow-hidden rounded-2xl bg-neutral-900 shadow-[0_30px_60px_-30px_rgba(0,0,0,.55)] ring-1 ring-white/10\"\n                style={{\n                  width,\n                  height: width * 0.625,\n                  left: -width / 2,\n                  top: (-width * 0.625) / 2,\n                  transform: `rotateY(${i * step}deg) translateZ(${radius}px)`,\n                  backfaceVisibility: \"hidden\",\n                }}\n              >\n                {/* eslint-disable-next-line @next/next/no-img-element -- copy-paste friendly: a plain img works in any React app */}\n                <img src={img.src} alt={img.alt} draggable={false} loading=\"lazy\" decoding=\"async\" className=\"h-full w-full object-cover object-top\" />\n              </figure>\n            ))}\n          </motion.div>\n        </motion.div>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "docs": "Import it with `import { CurvedWall } from \"@/components/curved-wall\"`. Live demo, props and a usage example: https://www.easeoutstudio.com/lab/curved-wall",
  "type": "registry:component"
}