{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"file-pocket","type":"registry:ui","title":"File Pocket","description":"A folder that springs open on hover or click, fanning out the paper cards tucked inside.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/file-pocket.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface FilePocketProps {\n  /** Folder color (any CSS color). */\n  color?: string;\n  /** Folder width in px. */\n  size?: number;\n  /** Up to three paper cards revealed when open. */\n  items?: ReactNode[];\n  /** Text under the folder. */\n  label?: string;\n  /** Open while hovered, not only on click. */\n  openOnHover?: boolean;\n  className?: string;\n}\n\nconst SPRING = \"cubic-bezier(.34,1.45,.5,1)\";\n\n// Where each paper lands when the folder opens: [x %, y %, rotation deg].\nconst FAN = [\n  [-46, -26, -13],\n  [0, -40, 0],\n  [46, -26, 13],\n] as const;\n\nfunction Lines() {\n  return (\n    <div className=\"flex h-full flex-col gap-[9%] p-[14%]\">\n      <span className=\"h-[7%] w-3/5 rounded-full bg-black/25\" />\n      <span className=\"h-[5%] w-full rounded-full bg-black/10\" />\n      <span className=\"h-[5%] w-4/5 rounded-full bg-black/10\" />\n      <span className=\"h-[5%] w-full rounded-full bg-black/10\" />\n    </div>\n  );\n}\n\nexport function FilePocket({\n  color = \"#5b8cff\",\n  size = 180,\n  items = [<Lines key={0} />, <Lines key={1} />, <Lines key={2} />],\n  label,\n  openOnHover = true,\n  className,\n}: FilePocketProps) {\n  const [pinned, setPinned] = useState(false);\n  const [hover, setHover] = useState(false);\n  const open = pinned || (openOnHover && hover);\n  const papers = items.slice(0, 3);\n  const back = `color-mix(in oklab, ${color} 72%, black)`;\n\n  return (\n    <div className={cn(\"inline-flex flex-col items-center gap-4\", className)}>\n      <button\n        type=\"button\"\n        aria-expanded={open}\n        aria-label={label ? `${label} folder` : \"Folder\"}\n        onClick={() => setPinned((p) => !p)}\n        onKeyDown={(e) => e.key === \"Escape\" && setPinned(false)}\n        onPointerEnter={() => setHover(true)}\n        onPointerLeave={() => setHover(false)}\n        className=\"relative rounded-2xl outline-none ring-ring ring-offset-4 ring-offset-background transition-transform duration-300 focus-visible:ring-2 active:scale-[.97]\"\n        style={{ width: size, height: size * 0.78, perspective: size * 4 }}\n      >\n        {/* back panel with tab */}\n        <span className=\"absolute inset-0 rounded-[10%] rounded-tl-none\" style={{ background: back }} />\n        <span\n          className=\"absolute bottom-full left-0 h-[14%] w-[42%] rounded-t-[30%]\"\n          style={{ background: back, clipPath: \"polygon(0 0, 78% 0, 100% 100%, 0 100%)\" }}\n        />\n        {papers.map((node, i) => {\n          const [x, y, r] = FAN[papers.length === 1 ? 1 : papers.length === 2 ? i * 2 : i];\n          return (\n            <span\n              key={i}\n              aria-hidden={!open}\n              className=\"absolute left-[18%] top-[8%] h-[80%] w-[64%] overflow-hidden rounded-[8%] bg-white shadow-[0_10px_30px_-8px_rgba(0,0,0,.45)]\"\n              style={{\n                transform: open\n                  ? `translate(${x}%, ${y}%) rotate(${r}deg)`\n                  : `translate(0, ${6 - i * 4}%) rotate(${(i - 1) * 2}deg)`,\n                transition: `transform .6s ${SPRING} ${open ? i * 0.05 : (2 - i) * 0.03}s`,\n                zIndex: i === 1 ? 2 : 1,\n              }}\n            >\n              {node}\n            </span>\n          );\n        })}\n        {/* front panel: hinges toward the viewer */}\n        <span\n          className=\"absolute inset-x-0 bottom-0 z-10 h-[86%] rounded-[10%]\"\n          style={{\n            background: `linear-gradient(180deg, color-mix(in oklab, ${color} 88%, white), ${color} 40%, color-mix(in oklab, ${color} 88%, black))`,\n            boxShadow: \"inset 0 1px 0 rgba(255,255,255,.35), 0 -6px 18px -8px rgba(0,0,0,.35)\",\n            transformOrigin: \"50% 100%\",\n            transform: open ? \"rotateX(-34deg) scaleY(.94)\" : \"none\",\n            transition: `transform .55s ${SPRING}`,\n          }}\n        >\n          <span className=\"absolute inset-x-[12%] bottom-[14%] h-[3%] rounded-full bg-white/25\" />\n        </span>\n      </button>\n      {label && <span className=\"text-sm font-medium text-foreground\">{label}</span>}\n    </div>\n  );\n}\n"}]}