// axi0 Motion 0.2.0: Jelly dots. A springy dot grid the pointer drags through like jelly, with click shockwaves.
// Generated from src/jelly-dots/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 JellyDotsProps extends HTMLAttributes<HTMLElement> {
  /** pixels between dots (default 26) */
  gap?: number;
  /** dot radius in pixels (default 2) */
  size?: number;
  /** the dots near the pointer and the moving ones (default "#f6a04d") */
  active?: string;
  /** the pointer's reach in pixels (default 120) */
  reach?: number;
  /** a click sends a shockwave (default true) */
  shock?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function JellyDots({ as = "div", gap, size, active, reach, shock, ...rest }: JellyDotsProps) {
  return createElement(as, { ...rest, "data-motion": "jelly-dots", "data-motion-gap": s(gap), "data-motion-size": s(size), "data-motion-active": s(active), "data-motion-reach": s(reach), "data-motion-shock": s(shock) });
}

export default JellyDots;
