import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Button } from '../Button';
import { Popover } from '../Popover';
import { DEFAULT_ANCHOR_ORIGIN, DEFAULT_TRANSFORM_ORIGIN } from './constants';
import { Actions, StyledTypography, Wrapper } from './styles';
import { useLogic } from './useLogic';
export const ConfirmAction = (props) => {
    const { actionComponentProps, popoverProps, cancelButtonProps, confirmButtonProps, } = useLogic(props);
    const { text, confirmButtonProps: externalConfirmButtonProps, popoverProps: externalPopoverProps, actionComponent, } = props;
    const { text: confirmButtonText = 'Подтвердить' } = externalConfirmButtonProps || {};
    const { anchorOrigin = DEFAULT_ANCHOR_ORIGIN, transformOrigin = DEFAULT_TRANSFORM_ORIGIN, } = externalPopoverProps || {};
    return (_jsxs(_Fragment, { children: [actionComponent(actionComponentProps), _jsx(Popover, { anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, ...popoverProps, children: _jsxs(Wrapper, { children: [text && _jsx(StyledTypography, { children: text }), _jsxs(Actions, { children: [_jsx(Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), _jsx(Button, { ...confirmButtonProps, children: confirmButtonText })] })] }) })] }));
};
