UNPKG

fui-fancyui

Version:
37 lines (36 loc) 988 B
"use client"; import { jsx as i } from "react/jsx-runtime"; import { useSpring as f, animated as h } from "@react-spring/web"; import { useRef as g, useEffect as y } from "react"; import { WrapperUL as $, StyledUL as x } from "./FancyDropDownUL.style.js"; function b({ children: o, isOpen: t, themeType: n = "primary", layer: a = 1, ...l }) { const { width: s = "50%", alignHorizontal: p = "center", alignVertical: c = "top", borderRadius: m, ...u } = l, r = g(null), [d, e] = f(() => ({ height: "0px" }), []); return y(() => { r.current && e.start({ height: (t ? r == null ? void 0 : r.current.offsetHeight : 0) + "px" }); }, [e, r, t]), /* @__PURE__ */ i( $, { as: h.div, $width: s, $borderRadius: m, $alignHorizontal: p, $alignVertical: c, style: { ...d }, ...u, children: /* @__PURE__ */ i(x, { ref: r, $themeType: n, $layer: a, children: o }) } ); } export { b as default };