"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfirmDialog = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const Button_1 = require("../Button");
const Dialog_1 = require("../Dialog");
const DialogActions_1 = require("../DialogActions");
const DialogContent_1 = require("../DialogContent");
const DialogContentText_1 = require("../DialogContentText");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const ConfirmDialog = (props) => {
    const { isShowCancelButton, cancelButtonProps } = (0, useLogic_1.useLogic)(props);
    const { open, title, description, actions, onClose, size = 'sm', ...restProps } = props;
    const { text: confirmText, ...confirmButtonProps } = actions.confirm;
    const { text: cancelText, variant, onClick, ...restCancelProps } = actions.cancel || {};
    return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { size: size, title: title, open: open, onClose: onClose, ...restProps, children: [description && ((0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { children: typeof description === 'string' ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.DialogContentText, { children: description })) : (description) })), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [isShowCancelButton && ((0, jsx_runtime_1.jsx)(styles_1.CancelButton, { ...restCancelProps, ...cancelButtonProps, children: cancelText })), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: confirmText })] })] }));
};
exports.ConfirmDialog = ConfirmDialog;
