import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "../../components/ui/dialog";
import { forwardRef, useImperativeHandle, useState } from "react";
export const GenericDialog = forwardRef((_, ref) => {
    const [content, setContent] = useState(null);
    const [title, setTitle] = useState("");
    const [width, setWidth] = useState("50vw");
    const [height, setHeight] = useState("50vh");
    const [visible, setVisible] = useState(false);
    const show = (props) => {
        setTitle(props.title);
        setContent(props.content);
        if (props.width)
            setWidth(props.width);
        if (props.height)
            setHeight(props.height);
        setVisible(true);
    };
    useImperativeHandle(ref, () => ({
        show,
        hide: () => setVisible(false),
    }));
    return (_jsx(Dialog, { open: visible, onOpenChange: (open) => !open && setVisible(false), children: _jsxs(DialogContent, { className: "max-w-none", style: { width, height }, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: title }) }), _jsx("div", { className: "flex-1 overflow-auto p-8 pt-4", children: content })] }) }));
});
//# sourceMappingURL=GenericDialog.js.map