// axi0 Motion 0.2.0: Wire text. The letter under the pointer turns into a dashed vector outline with handles and its size, like a selection in a drawing app; the letters it leaves stay outlined a moment.
// Generated from src/wire-text/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 WireTextProps extends HTMLAttributes<HTMLElement> {
  /** Selection color (default "#f6a04d") */
  color?: string;
  /** Reach around the letters (default 1) */
  reach?: number;
  /** How long a left letter stays outlined (default 900) */
  trail?: number;
  /** Show the letter's size (default true) */
  label?: boolean;
  /** Step through the letters when nobody points (default true) */
  idle?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function WireText({ as = "div", color, reach, trail, label, idle, ...rest }: WireTextProps) {
  return createElement(as, { ...rest, "data-motion": "wire-text", "data-motion-color": s(color), "data-motion-reach": s(reach), "data-motion-trail": s(trail), "data-motion-label": s(label), "data-motion-idle": s(idle) });
}

export default WireText;
