// axi0 Motion 0.2.0: Pop select. A select chip whose list pops open from its corner while the highlight glides from row to row; it drives the real select underneath.
// Generated from src/pop-select/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 PopSelectProps extends HTMLAttributes<HTMLElement> {
  /** where the list opens (auto: below, or above when there is more room there) (default "auto") */
  placement?: "auto" | "below" | "above";
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function PopSelect({ as = "div", placement, ...rest }: PopSelectProps) {
  return createElement(as, { ...rest, "data-motion": "pop-select", "data-motion-placement": s(placement) });
}

export default PopSelect;
