// axi0 Motion 0.2.0: Orbit border. A twinkling star runs the exact outline of any button, pill or card, trailing light and stardust, and speeds up under the pointer.
// Generated from src/orbit-border/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 OrbitBorderProps extends HTMLAttributes<HTMLElement> {
  /** Color of the star and its trail (default "#f6a04d") */
  color?: string;
  /** Seconds for one lap (default 5) */
  speed?: number;
  /** Trail length, as a share of the outline (default 0.32) */
  trail?: number;
  /** How many stars share the outline (default 1) */
  stars?: number;
  /** Shed sparkling dust as it goes (default true) */
  dust?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function OrbitBorder({ as = "div", color, speed, trail, stars, dust, ...rest }: OrbitBorderProps) {
  return createElement(as, { ...rest, "data-motion": "orbit-border", "data-motion-color": s(color), "data-motion-speed": s(speed), "data-motion-trail": s(trail), "data-motion-stars": s(stars), "data-motion-dust": s(dust) });
}

export default OrbitBorder;
