import React from "react";
const ChartContainer = (props) => {
    const divRef = React.useRef(null);
    React.useEffect(() => {
        if (!props.onWidthChange) {
            return;
        }
        if (!divRef.current) {
            return;
        }
        const resizeObserver = new ResizeObserver(() => {
            if (divRef.current && props.onWidthChange) {
                props.onWidthChange(divRef.current.offsetWidth);
            }
        });
        resizeObserver.observe(divRef.current);
        return () => {
            return resizeObserver.disconnect();
        }; // clean up
    }, []);
    return (React.createElement("div", { ref: divRef, className: "w-full" }, props.children));
};
export default ChartContainer;
//# sourceMappingURL=ChartContainer.js.map