{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bubble-wrap",
  "title": "Bubble Wrap",
  "author": "VenusUI",
  "description": "A sheet of bubble wrap to pop one by one, or a whole row with a drag.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/ui/bubble-wrap.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { RotateCcw } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface BubbleWrapProps extends React.ComponentProps<\"div\"> {\n  rows?: number\n  columns?: number\n  onPop?: (popped: number, total: number) => void\n}\n\n/**\n * A sheet of bubble wrap. Click bubbles to pop them, or press and drag across\n * the sheet to pop a row at once. Every bubble is a button, so it works from\n * the keyboard too.\n */\nfunction BubbleWrap({ rows = 5, columns = 8, onPop, className, ...props }: BubbleWrapProps) {\n  const total = rows * columns\n  const [popped, setPopped] = React.useState<Set<number>>(() => new Set())\n  const pressing = React.useRef(false)\n\n  const pop = (index: number) => {\n    setPopped((current) => {\n      if (current.has(index)) return current\n      const next = new Set(current).add(index)\n      onPop?.(next.size, total)\n      return next\n    })\n  }\n\n  return (\n    <div data-slot=\"bubble-wrap\" className={cn(\"w-full max-w-md\", className)} {...props}>\n      <div\n        role=\"group\"\n        aria-label=\"Bubble wrap\"\n        onPointerDown={() => (pressing.current = true)}\n        onPointerUp={() => (pressing.current = false)}\n        onPointerLeave={() => (pressing.current = false)}\n        className=\"grid touch-none gap-1.5 rounded-lg bg-[linear-gradient(135deg,rgb(186_230_253/0.45),rgb(224_242_254/0.25))] p-3 shadow-[0_10px_20px_-12px_rgb(0_0_0/0.35)] ring-1 ring-sky-200/70 dark:ring-sky-900/60\"\n        style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n      >\n        {Array.from({ length: total }, (_, i) => {\n          const done = popped.has(i)\n          return (\n            <button\n              key={i}\n              type=\"button\"\n              aria-label={`Bubble ${i + 1}`}\n              aria-pressed={done}\n              onPointerDown={() => pop(i)}\n              onPointerEnter={() => pressing.current && pop(i)}\n              onKeyDown={(event) => {\n                if (event.key === \"Enter\" || event.key === \" \") {\n                  event.preventDefault()\n                  pop(i)\n                }\n              }}\n              className={cn(\n                \"aspect-square rounded-full outline-none transition-all duration-150 focus-visible:ring-2 focus-visible:ring-sky-600 motion-reduce:transition-none\",\n                done\n                  ? \"scale-90 bg-sky-100/40 shadow-[inset_0_1px_2px_rgb(0_0_0/0.15)] dark:bg-sky-950/40\"\n                  : \"bg-[radial-gradient(circle_at_35%_30%,white,rgb(224_242_254/0.9)_35%,rgb(125_211_252/0.55))] shadow-[0_2px_4px_rgb(14_116_144/0.25),inset_0_-2px_4px_rgb(14_116_144/0.2)] hover:scale-105\"\n              )}\n            />\n          )\n        })}\n      </div>\n      <div className=\"mt-3 flex items-center justify-between text-sm\">\n        <span role=\"status\" className=\"text-muted-foreground tabular-nums\">\n          {popped.size === total ? \"Every bubble popped. Satisfying.\" : `${popped.size} of ${total} popped`}\n        </span>\n        <button type=\"button\" onClick={() => setPopped(new Set())} className=\"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-muted-foreground outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\">\n          <RotateCcw aria-hidden=\"true\" className=\"size-3.5\" />\n          New sheet\n        </button>\n      </div>\n    </div>\n  )\n}\n\nexport { BubbleWrap }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "interactive",
    "animations"
  ],
  "type": "registry:ui"
}