// axi0 Motion 0.2.0: Wheel picker. A curved picker that spins with a drag, the scroll wheel or the arrow keys, tilting the options away from the chosen one; it drives the real select underneath.
// Generated from src/wheel-picker/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 WheelPickerProps extends HTMLAttributes<HTMLElement> {
  /** how many rows show (odd) (default 5) */
  rows?: number;
  /** how far each row tilts away (default 22) */
  tilt?: number;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function WheelPicker({ as = "div", rows, tilt, ...rest }: WheelPickerProps) {
  return createElement(as, { ...rest, "data-motion": "wheel-picker", "data-motion-rows": s(rows), "data-motion-tilt": s(tilt) });
}

export default WheelPicker;
