// axi0 Motion 0.2.0: Dock. A row of icons that swell toward the pointer and part to make room, with labels that rise above them, launch bounces and badges.
// Generated from src/dock/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 DockProps extends HTMLAttributes<HTMLElement> {
  /** how big the icon under the pointer grows (default 1.7) */
  magnify?: number;
  /** how far from the pointer icons still grow (default 150) */
  reach?: number;
  /** the icons' resting size (default 54) */
  size?: number;
  /** pressed toggle buttons bounce and keep a dot below them (default true) */
  launch?: boolean;
  /** the toolbar's name when the element has no aria-label (default "Dock") */
  label?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function Dock({ as = "div", magnify, reach, size, launch, label, ...rest }: DockProps) {
  return createElement(as, { ...rest, "data-motion": "dock", "data-motion-magnify": s(magnify), "data-motion-reach": s(reach), "data-motion-size": s(size), "data-motion-launch": s(launch), "data-motion-label": s(label) });
}

export default Dock;
