import React, { useState, useCallback } from 'react';
import ReactResizeDetector from 'react-resize-detector';
var EmptyStub = function () { return React.createElement("div", { style: { display: 'none' } }); };
export var HideOnShrink = function (_a) {
    var widthToHide = _a.widthToHide, children = _a.children;
    var _b = useState(widthToHide), width = _b[0], setWidth = _b[1];
    var handleResize = useCallback(function (width) { return setWidth(width); }, []);
    return (React.createElement(React.Fragment, null,
        React.createElement(ReactResizeDetector, { handleHeight: false, onResize: handleResize }),
        width > widthToHide ? children : React.createElement(EmptyStub, null)));
};
