"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const NotifyResize_1 = tslib_1.__importDefault(require("../NotifyResize"));
const Flex_1 = require("../Flex");
const SizedContainer = (props) => {
    const { onResize: onResizeFromProps, ...domProps } = props;
    const [size, onResize] = React.useState(null);
    const sizeFn = props.children;
    return (React.createElement(Flex_1.Box, { ...domProps, style: { flex: 1, ...domProps.style, position: 'relative' } },
        React.createElement(Flex_1.Box, { style: {
                position: 'absolute',
                left: 0,
                top: 0,
                width: '100%',
                height: '100%',
            }, "data-width": size ? size.width : null, "data-height": size ? size.height : null },
            React.createElement(NotifyResize_1.default, { onResize: (size) => {
                    onResize(size);
                    onResizeFromProps?.(size);
                } }),
            size ? sizeFn(size) : null)));
};
exports.default = SizedContainer;
