{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "grip",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "grip.tsx",
      "content": "\"use client\";\n\nimport type { Variants } from \"motion/react\";\nimport { motion, useAnimation } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface GripIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface GripProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst CIRCLES = [\n  { cx: 19, cy: 5 },\n  { cx: 19, cy: 12 },\n  { cx: 12, cy: 5 },\n  { cx: 19, cy: 19 },\n  { cx: 12, cy: 12 },\n  { cx: 5, cy: 5 },\n  { cx: 12, cy: 19 },\n  { cx: 5, cy: 12 },\n  { cx: 5, cy: 19 },\n];\n\nconst VARIANTS: Variants = {\n  normal: {\n    opacity: 1,\n    transition: { duration: 0.25 },\n  },\n  animate: (index: number) => ({\n    opacity: [1, 0.3, 0.3, 1],\n    transition: {\n      delay: index * 0.07,\n      duration: 1.1,\n      times: [0, 0.2, 0.8, 1],\n    },\n  }),\n};\n\nconst GripIcon = forwardRef<GripIconHandle, GripProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlledRef = useRef(false);\n    const isAnimatingRef = useRef(false);\n\n    const startAnimation = useCallback(async () => {\n      if (isAnimatingRef.current) return;\n      isAnimatingRef.current = true;\n      await controls.start(\"animate\");\n      await controls.start(\"normal\");\n      isAnimatingRef.current = false;\n    }, [controls]);\n\n    const stopAnimation = useCallback(async () => {\n      if (!isAnimatingRef.current) return;\n      await controls.start(\"normal\");\n      isAnimatingRef.current = false;\n    }, [controls]);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          startAnimation();\n        }\n      },\n      [startAnimation, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          stopAnimation();\n        }\n      },\n      [stopAnimation, onMouseLeave]\n    );\n\n    return (\n      <div\n        className={cn(\"inline-flex items-center justify-center\", className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          fill=\"none\"\n          height={size}\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth=\"2\"\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          {CIRCLES.map((circle, index) => (\n            <motion.circle\n              animate={controls}\n              custom={index}\n              cx={circle.cx}\n              cy={circle.cy}\n              initial=\"normal\"\n              key={`${circle.cx}-${circle.cy}`}\n              r=\"1\"\n              variants={VARIANTS}\n            />\n          ))}\n        </svg>\n      </div>\n    );\n  }\n);\n\nGripIcon.displayName = \"GripIcon\";\n\nexport { GripIcon };\n",
      "type": "registry:ui"
    }
  ]
}
