UNPKG

@sky-mavis/tanto-widget

Version:
30 lines (26 loc) 574 B
'use strict'; var jsxRuntime = require('@emotion/react/jsx-runtime'); var useResizeObserver = require('use-resize-observer'); const SmoothHeight = ({ children, ...rest }) => { const { height, ref } = useResizeObserver(); return jsxRuntime.jsx("div", { style: { boxSizing: 'border-box', overflow: 'hidden', transition: 'height 0.2s', height: height ? `${height}px` : 'auto' }, ...rest, children: jsxRuntime.jsx("div", { ref: ref, children: children }) }); }; exports.SmoothHeight = SmoothHeight;