"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfirmAction = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const Button_1 = require("../Button");
const Popover_1 = require("../Popover");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const ConfirmAction = (props) => {
    const { actionComponentProps, popoverProps, cancelButtonProps, confirmButtonProps, } = (0, useLogic_1.useLogic)(props);
    const { text, confirmButtonProps: externalConfirmButtonProps, popoverProps: externalPopoverProps, actionComponent, } = props;
    const { text: confirmButtonText = 'Подтвердить' } = externalConfirmButtonProps || {};
    const { anchorOrigin = constants_1.DEFAULT_ANCHOR_ORIGIN, transformOrigin = constants_1.DEFAULT_TRANSFORM_ORIGIN, } = externalPopoverProps || {};
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [actionComponent(actionComponentProps), (0, jsx_runtime_1.jsx)(Popover_1.Popover, { anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, ...popoverProps, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [text && (0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { children: text }), (0, jsx_runtime_1.jsxs)(styles_1.Actions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: confirmButtonText })] })] }) })] }));
};
exports.ConfirmAction = ConfirmAction;
