import React, { useState, useRef, useEffect } from 'react'; var SlideToggle = function SlideToggle(_a) { var children = _a.children, _b = _a.state, state = _b === void 0 ? false : _b, _c = _a.duration, duration = _c === void 0 ? 0.5 : _c; var _d = useState(), contentDefault = _d[0], setContentDefault = _d[1]; var _e = useState(0), contentH = _e[0], setContentH = _e[1]; var contentRef = useRef(null); useEffect(function () { var current = contentRef.current; if (current !== null) { setContentDefault(current.offsetHeight); setContentH(current.offsetHeight); } state ? setContentH(contentDefault) : setContentH(0); }, [contentDefault, state]); return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", { className: "rst-container", style: { height: contentH, transition: "all " + duration + "s" } }, /*#__PURE__*/React.createElement("div", { className: "rst-content", ref: contentRef }, children)), /*#__PURE__*/React.createElement("style", { jsx: "true" }, "\n .rst-container{\n height: 0;\n overflow: hidden;\n }\n ")); }; export { SlideToggle }; //# sourceMappingURL=SlideToggle.tsx.map