// axi0 Motion 0.2.0: Spotlight card. A soft light follows the pointer across a card.
// Generated from src/spotlight/meta.json by motion-pack: a thin wrapper. The loader (motion.js) must be on the page once;
// it starts the effect on the element this renders. Options left out keep the effect's own defaults.
import { createElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";

export interface SpotlightProps extends HTMLAttributes<HTMLElement> {
  /** any CSS color, best with some transparency; auto is a soft orange glow (default auto) */
  color?: string;
  /** the light's radius in pixels (default 280) */
  size?: number;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));

export function Spotlight({ as = "div", color, size, ...rest }: SpotlightProps) {
  return createElement(as, { ...rest, "data-motion": "spotlight", "data-motion-color": s(color), "data-motion-size": s(size) });
}

export default Spotlight;
