{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"file-lift","type":"registry:ui","title":"File Lift","description":"A folder whose flap tips open on hover or focus so its files float up and fan out, then settle back in; click pins it open.","dependencies":["motion"],"registryDependencies":[],"files":[{"path":"registry/ui/file-lift.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { useState } from \"react\";\nimport { MotionConfig, motion } from \"motion/react\";\n\nexport interface FileLiftProps {\n  /** Folder name, shown under the icon. */\n  label?: string;\n  /** File names that float out (the first four are drawn). */\n  files?: string[];\n  /** Folder color. */\n  color?: string;\n  /** Controlled pinned-open state. */\n  open?: boolean;\n  /** Initial pinned state when uncontrolled. */\n  defaultOpen?: boolean;\n  /** Called when a click or Enter pins / unpins the folder open. */\n  onOpenChange?: (open: boolean) => void;\n  className?: string;\n}\n\nconst float = { type: \"spring\", stiffness: 260, damping: 15, mass: 0.9 } as const;\nconst tints = [\"#f472b6\", \"#34d399\", \"#fbbf24\", \"#60a5fa\"];\n\nexport function FileLift({\n  label = \"Design\",\n  files = [\"brief.pdf\", \"moodboard.png\", \"logo.svg\", \"notes.md\"],\n  color = \"#60a5fa\",\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  className,\n}: FileLiftProps) {\n  const [inner, setInner] = useState(defaultOpen);\n  const [peek, setPeek] = useState(false);\n  const pinned = open ?? inner;\n  const out = pinned || peek;\n  const shown = files.slice(0, 4);\n  const mid = (shown.length - 1) / 2;\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <button\n        type=\"button\"\n        aria-expanded={pinned}\n        aria-label={`${label} folder, ${files.length} ${files.length === 1 ? \"file\" : \"files\"}`}\n        onClick={() => {\n          setInner(!pinned);\n          onOpenChange?.(!pinned);\n        }}\n        onPointerEnter={(e) => e.pointerType === \"mouse\" && setPeek(true)}\n        onPointerLeave={() => setPeek(false)}\n        onFocus={(e) => e.currentTarget.matches(\":focus-visible\") && setPeek(true)}\n        onBlur={() => setPeek(false)}\n        className={`group grid select-none justify-items-center gap-3 rounded-2xl px-6 pb-4 pt-24 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/60 ${className ?? \"\"}`}\n      >\n        <motion.span\n          aria-hidden\n          className=\"relative block h-32 w-44 [perspective:600px]\"\n          initial={false}\n          animate={{ scaleY: out ? [1, 0.93, 1.03, 1] : [1, 1.03, 0.98, 1], scaleX: out ? [1, 1.05, 0.98, 1] : [1, 0.98, 1.01, 1] }}\n          transition={{ duration: 0.45, ease: \"easeOut\" }}\n          style={{ transformOrigin: \"50% 100%\" }}\n        >\n          {/* back panel + tab */}\n          <span\n            className=\"absolute left-0 top-0 h-6 w-16 rounded-t-lg\"\n            style={{ background: `color-mix(in oklab, ${color} 62%, black)` }}\n          />\n          <span\n            className=\"absolute inset-x-0 bottom-0 top-4 rounded-xl rounded-tl-none\"\n            style={{ background: `color-mix(in oklab, ${color} 62%, black)` }}\n          />\n\n          {shown.map((name, i) => {\n            const k = i - mid;\n            return (\n              <motion.span\n                key={name + i}\n                className=\"absolute bottom-4 left-1/2 -ml-11 flex h-28 w-22 flex-col gap-1.5 rounded-lg border border-black/10 bg-[#fafaf9] p-2.5 text-left shadow-[0_8px_20px_-8px_rgb(0_0_0/.6)]\"\n                initial={false}\n                animate={\n                  out\n                    ? { x: k * 46, y: -78 - (mid - Math.abs(k)) * 12, rotate: k * 11, scale: 1 }\n                    : { x: k * 7, y: 0, rotate: k * 3, scale: 0.96 }\n                }\n                transition={{ ...float, delay: out ? 0.05 + i * 0.05 : (shown.length - 1 - i) * 0.03 }}\n              >\n                <span className=\"h-5 w-5 rounded\" style={{ background: tints[i % tints.length] }} />\n                <span className=\"h-1 w-full rounded-full bg-black/10\" />\n                <span className=\"h-1 w-3/4 rounded-full bg-black/10\" />\n                <span className=\"mt-auto truncate text-[10px] font-medium text-zinc-500\">{name}</span>\n              </motion.span>\n            );\n          })}\n\n          {/* front flap tips forward so the files can climb out */}\n          <motion.span\n            className=\"absolute inset-x-0 bottom-0 h-24 rounded-xl\"\n            initial={false}\n            animate={{ rotateX: out ? -34 : 0 }}\n            transition={{ type: \"spring\", stiffness: 300, damping: 16 }}\n            style={{\n              transformOrigin: \"50% 100%\",\n              background: `linear-gradient(180deg, color-mix(in oklab, ${color} 92%, white), ${color})`,\n              boxShadow: `inset 0 1px 0 rgb(255 255 255/.45), 0 -6px 18px -10px rgb(0 0 0/.5)`,\n            }}\n          >\n            <span className=\"absolute bottom-3 left-4 h-1.5 w-10 rounded-full bg-white/40\" />\n          </motion.span>\n\n          <motion.span\n            className=\"absolute -right-2 -top-1 z-10 grid h-7 min-w-7 place-items-center rounded-full border-2 border-background px-1.5 text-xs font-bold tabular-nums text-white\"\n            initial={false}\n            animate={{ scale: out ? 1.15 : 1, y: out ? -4 : 0, rotate: out ? 8 : 0 }}\n            transition={{ type: \"spring\", stiffness: 600, damping: 12 }}\n            style={{ background: `color-mix(in oklab, ${color} 55%, black)` }}\n          >\n            {files.length}\n          </motion.span>\n        </motion.span>\n\n        <span aria-hidden className=\"grid text-center leading-tight\">\n          <span className=\"text-sm font-semibold text-foreground\">{label}</span>\n          <span className=\"text-xs text-muted-foreground\">\n            {files.length} {files.length === 1 ? \"file\" : \"files\"}\n            {pinned ? \" · open\" : \"\"}\n          </span>\n        </span>\n      </button>\n    </MotionConfig>\n  );\n}\n"}]}