// axi0 Motion 0.2.0: Swell. Letters under the pointer swell wide, bold and tall while the far ones draw in, so the line keeps its width; at rest a slow wave runs through them.
// Generated from src/swell/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 SwellProps extends HTMLAttributes<HTMLElement> {
  /** Reach around the pointer, in letter heights (default 2.4) */
  reach?: number;
  /** How much wider the near letters get (the far ones give the room back) (default 1.3) */
  width?: number;
  /** Height under the pointer (default 1.18) */
  rise?: number;
  /** Extra weight under the pointer (default 300) */
  bold?: number;
  /** Color under the pointer (default "#f6a04d") */
  color?: string;
  /** A slow wave when the pointer rests (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 Swell({ as = "div", reach, width, rise, bold, color, idle, ...rest }: SwellProps) {
  return createElement(as, { ...rest, "data-motion": "swell", "data-motion-reach": s(reach), "data-motion-width": s(width), "data-motion-rise": s(rise), "data-motion-bold": s(bold), "data-motion-color": s(color), "data-motion-idle": s(idle) });
}

export default Swell;
