UNPKG

@clubmed/trident-ui

Version:

Shared ClubMed React UI components

43 lines (42 loc) 946 B
import { jsx as s } from "react/jsx-runtime"; import { useResize as l, useSpring as h, animated as p } from "@react-spring/web"; import { c as d } from "../chunks/index.js"; import { useRef as u, useEffect as g } from "react"; const r = (t) => t, R = ({ children: t, id: n, className: a, role: c, containerClassName: m }) => { const i = u(null), { height: e } = l({ container: i }), [f, o] = h(() => ({ from: { height: e.to(r) }, immediate: !0 })); return g(() => { o.start({ to: { height: e.to(r) }, config: { tension: 170, friction: 26 } }); }, [o, e]), /* @__PURE__ */ s( p.div, { role: c, className: d("overflow-hidden", m), style: { ...f }, id: n, children: /* @__PURE__ */ s("div", { className: a, ref: i, children: t }) } ); }; export { R as ElasticHeight }; //# sourceMappingURL=ElasticHeight.js.map