// axi0 Motion 0.2.0: Glint button. A glass button whose rim catches the light, with a highlight that glides toward the pointer and drifts round the edge at rest.
// Generated from src/glint-button/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 GlintButtonProps extends HTMLAttributes<HTMLElement> {
  /** Color of the light (empty: white on dark pages, orange on light ones) (default auto) */
  color?: string;
  /** How far from the button the pointer still pulls the light (default 160) */
  reach?: number;
  /** Let the light drift round the rim when no pointer is near (default true) */
  idle?: boolean;
  /** Give the button the frosted glass look (off: keep the page's own look, add only the light) (default true) */
  glass?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function GlintButton({ as = "div", color, reach, idle, glass, ...rest }: GlintButtonProps) {
  return createElement(as, { ...rest, "data-motion": "glint-button", "data-motion-color": s(color), "data-motion-reach": s(reach), "data-motion-idle": s(idle), "data-motion-glass": s(glass) });
}

export default GlintButton;
