UNPKG

@clubmed/trident-ui

Version:

Shared ClubMed React UI components

37 lines (36 loc) 896 B
"use client"; import { jsx as s } from "react/jsx-runtime"; import { c as u } from "../chunks/clsx.js"; import { useRef as l, useState as m, useLayoutEffect as d } from "react"; import h from "./hooks/useResizeObserver.js"; const H = ({ className: i, children: o, innerClassName: n, isExpanded: t = !1, min: a = 0, ...f }) => { const e = l(null), [c, r] = m(0); return h({ ref: e, onResize: () => { e.current && r(e.current?.offsetHeight); } }), d(() => { e.current && r(e.current.offsetHeight); }, [e]), /* @__PURE__ */ s( "div", { ...f, className: u("overflow-hidden transition-all duration-500", i), "data-expanded": t, style: { height: t ? c : a }, children: /* @__PURE__ */ s("div", { className: n, ref: e, children: o }) } ); }; export { H as ElasticHeight }; //# sourceMappingURL=ElasticHeight.js.map