"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormWizardFooter = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const FormPageFooterContainer_1 = require("../../FormPageFooterContainer");
const FormPageLayout_1 = require("../../FormPageLayout");
const styles_1 = require("./styles");
const FormWizardFooter = (props) => {
    const { isDisabled, isFirstStep, isLastStep, prevButtonText, submitButtonText, secondaryActions, onPrevStep, submitButtonProps, } = props;
    const { isActive, isShowMoreButton, handleToggle } = (0, FormPageLayout_1.useFormFooter)({
        secondaryActions,
    });
    const isShowSecondaryActions = !isFirstStep || (isLastStep && Boolean(secondaryActions));
    const renderNextIcon = () => (isLastStep ? null : (0, jsx_runtime_1.jsx)(styles_1.StyledNextIcon, {}));
    return ((0, jsx_runtime_1.jsxs)(FormPageFooterContainer_1.FormPageFooterContainer, { children: [(0, jsx_runtime_1.jsxs)(FormPageLayout_1.ActionsWrapper, { "$isShowMoreButton": isShowMoreButton && isLastStep, children: [(0, jsx_runtime_1.jsx)(FormPageLayout_1.StyledFormSubmitButton, { size: "large", disabled: isDisabled, endIcon: renderNextIcon(), "$isShowSecondaryActions": isShowSecondaryActions, ...submitButtonProps, children: submitButtonText }), secondaryActions && isLastStep && ((0, jsx_runtime_1.jsx)(FormPageLayout_1.SecondaryActions, { isDisabled: isDisabled, actions: secondaryActions, isActive: isActive })), !isFirstStep && ((0, jsx_runtime_1.jsx)(styles_1.PrevButton, { disabled: isDisabled, variant: "outlined", size: "large", color: "grey", startIcon: (0, jsx_runtime_1.jsx)(styles_1.StyledPreviousIcon, {}), onClick: onPrevStep, children: prevButtonText }))] }), isShowMoreButton && isLastStep && ((0, jsx_runtime_1.jsxs)(FormPageLayout_1.ShowMoreButton, { disabled: isDisabled, variant: "text", onClick: handleToggle, "$isActive": isActive, children: [isActive ? 'Скрыть' : 'Показать', " \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F"] }))] }));
};
exports.FormWizardFooter = FormWizardFooter;
