"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dialog = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const BottomDrawer_1 = require("../BottomDrawer");
const DialogTitle_1 = require("../DialogTitle");
const classNames_1 = require("../utils/classNames");
const cva_1 = require("../utils/cva");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const dialogCva = (0, cva_1.cva)(constants_1.dialogClassnames.root, {
    variants: {
        withoutTitle: {
            true: constants_1.dialogClassnames.withoutTitle,
        },
    },
});
const Dialog = ({ children, title, disableBackdropClick, onClose, size = 'md', headerContent, className, classes, ...props }) => {
    const { handleClose, isMobile, dialogClasses } = (0, useLogic_1.useLogic)({
        onClose,
        disableBackdropClick,
        classes,
    });
    if (isMobile) {
        return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { onClose: handleClose, title: title, headerContent: headerContent, ...props, children: children }));
    }
    return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDialog, { "$size": size, onClose: handleClose, className: (0, classNames_1.classNames)(dialogCva({ withoutTitle: !title }), className), classes: dialogClasses, ...props, children: [title && ((0, jsx_runtime_1.jsx)(DialogTitle_1.DialogTitle, { onClose: onClose, headerContent: headerContent, children: title })), children] }));
};
exports.Dialog = Dialog;
