// axi0 Motion 0.2.0: Card pile. A pile of cards you drag, flick or click through; a thrown card flies off and tucks back in at the bottom of the pile.
// Generated from src/card-pile/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 CardPileProps extends HTMLAttributes<HTMLElement> {
  /** How far the cards under the top one turn, in degrees (default 7) */
  tilt?: number;
  /** How far each card below peeks out (default 5) */
  spread?: number;
  /** How far a drag must go to throw the card (default 90) */
  distance?: number;
  /** The pile's name for screen readers (when it has no aria-label) (default "Card pile") */
  label?: string;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function CardPile({ as = "div", tilt, spread, distance, label, ...rest }: CardPileProps) {
  return createElement(as, { ...rest, "data-motion": "card-pile", "data-motion-tilt": s(tilt), "data-motion-spread": s(spread), "data-motion-distance": s(distance), "data-motion-label": s(label) });
}

export default CardPile;
