{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-cursor-spotlight",
  "title": "CursorSpotlight",
  "description": "Glow radial que segue o cursor do ponteiro, com fallback estático em prefers-reduced-motion.",
  "dependencies": [
    "class-variance-authority"
  ],
  "registryDependencies": [
    "@lema-ds/tokens"
  ],
  "files": [
    {
      "path": "components/ds/ds-cursor-spotlight.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n// ── Types ──\n\nexport type CursorSpotlightTone = \"primary\" | \"violet\" | \"sky\"\n\nexport interface CursorSpotlightProps\n  extends\n    React.HTMLAttributes<HTMLDivElement>,\n    VariantProps<typeof cursorSpotlightVariants> {\n  /** Diameter of the glow, in pixels. */\n  size?: number\n}\n\n// ── Variants ──\n\nexport const cursorSpotlightVariants = cva(\"relative overflow-hidden\", {\n  variants: {\n    tone: {\n      primary: \"[--spotlight-color:var(--primary)]\",\n      violet: \"[--spotlight-color:var(--highlight-violet)]\",\n      sky: \"[--spotlight-color:var(--highlight-sky)]\",\n    },\n  },\n  defaultVariants: { tone: \"primary\" },\n})\n\n// ── Component ──\n\n/**\n * Wraps content with a radial glow that follows the pointer — the\n * interactive counterpart to `BackgroundGlow`'s static `spotlight`/`beam`\n * variants. Position updates write directly to CSS custom properties on the\n * glow layer (no re-render per pointermove). Falls back to a faint static\n * glow under `prefers-reduced-motion`.\n */\nexport const CursorSpotlight = React.forwardRef<\n  HTMLDivElement,\n  CursorSpotlightProps\n>(({ tone = \"primary\", size = 500, className, children, ...props }, ref) => {\n  const innerRef = React.useRef<HTMLDivElement>(null)\n  const glowRef = React.useRef<HTMLDivElement>(null)\n  const reducedMotionRef = React.useRef(false)\n\n  React.useEffect(() => {\n    reducedMotionRef.current = window.matchMedia(\n      \"(prefers-reduced-motion: reduce)\"\n    ).matches\n  }, [])\n\n  const setRefs = React.useCallback(\n    (node: HTMLDivElement | null) => {\n      innerRef.current = node\n      if (typeof ref === \"function\") ref(node)\n      else if (ref)\n        (ref as React.RefObject<HTMLDivElement | null>).current = node\n    },\n    [ref]\n  )\n\n  const handlePointerMove = React.useCallback(\n    (event: React.PointerEvent<HTMLDivElement>) => {\n      if (reducedMotionRef.current) return\n      const node = innerRef.current\n      const glow = glowRef.current\n      if (!node || !glow) return\n      const rect = node.getBoundingClientRect()\n      glow.style.setProperty(\"--x\", `${event.clientX - rect.left}px`)\n      glow.style.setProperty(\"--y\", `${event.clientY - rect.top}px`)\n      glow.style.opacity = \"1\"\n    },\n    []\n  )\n\n  const handlePointerLeave = React.useCallback(() => {\n    if (glowRef.current) glowRef.current.style.opacity = \"0\"\n  }, [])\n\n  return (\n    <div\n      ref={setRefs}\n      onPointerMove={handlePointerMove}\n      onPointerLeave={handlePointerLeave}\n      className={cn(cursorSpotlightVariants({ tone }), className)}\n      data-slot=\"cursor-spotlight\"\n      {...props}\n    >\n      <div\n        ref={glowRef}\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute inset-0 -z-10 opacity-0 transition-opacity duration-300 motion-reduce:opacity-20\"\n        style={{\n          background:\n            \"radial-gradient(\" +\n            size +\n            \"px circle at var(--x, 50%) var(--y, 50%), color-mix(in oklch, var(--spotlight-color) 15%, transparent), transparent 70%)\",\n        }}\n      />\n      {children}\n    </div>\n  )\n})\nCursorSpotlight.displayName = \"CursorSpotlight\"\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
