import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { isValidElement } from 'react';
import { PageAside } from '../../components/PageAside';
import { PageContextProvider } from '../../components/PageContext';
import { PageLayoutContainer } from '../../components/PageLayoutContainer';
import { classNames } from '../../components/utils/classNames';
import { FormMobileActions } from './FormMobileActions';
import { DesktopAlertWrapper, MobileAlertWrapper, StyledPageContent, StyledPageHeader, } from './styles';
import { useLogic } from './useLogic';
/**
 * Компонент не предназначен для экспорта из пакета. Используется внутри FormPageLayout и FormWizardPageLayout
 */
export const FormPageLayoutBase = (props) => {
    const { pageContentProps, headerProps, renderChildrenProps, headerActions } = useLogic(props);
    const { className, aside, children, alert, contentClassname, header } = props;
    return (_jsxs(PageContextProvider, { hasAside: Boolean(aside), mobileTitleActions: _jsx(FormMobileActions, { actions: headerActions }), children: [alert && _jsx(DesktopAlertWrapper, { children: alert }), _jsxs(PageLayoutContainer, { className: className, children: [alert && _jsx(MobileAlertWrapper, { children: alert }), isValidElement(header) ? (header) : (_jsx(StyledPageHeader, { ...headerProps })), _jsx(StyledPageContent, { className: classNames(contentClassname), isFormPaddingDisable: true, ...pageContentProps, children: children(renderChildrenProps) }), aside && !isValidElement(aside) && (_jsx(PageAside, { ...aside })), isValidElement(aside) && aside] })] }));
};
