// axi0 Motion 0.2.0: Tick slider. A range slider drawn as a row of fine bars with no thumb; dragging fast raises a wake of taller bars around the handle that settles behind it.
// Generated from src/tick-slider/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 TickSliderProps extends HTMLAttributes<HTMLElement> {
  /** how many bars make the track (default 44) */
  bars?: number;
  /** how tall the wake grows with speed (0: none) (default 1) */
  wake?: number;
  /** text after the shown value, such as % (default auto) */
  unit?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function TickSlider({ as = "div", bars, wake, unit, ...rest }: TickSliderProps) {
  return createElement(as, { ...rest, "data-motion": "tick-slider", "data-motion-bars": s(bars), "data-motion-wake": s(wake), "data-motion-unit": s(unit) });
}

export default TickSlider;
