"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageHeader = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const classNames_1 = require("../utils/classNames");
const cva_1 = require("../utils/cva");
const constants_1 = require("./constants");
const HeaderContent_1 = require("./HeaderContent");
const MobilePageActions_1 = require("./MobilePageActions");
const styles_1 = require("./styles");
const Title_1 = require("./Title");
const useLogic_1 = require("./useLogic");
const mobilePageHeaderCva = (0, cva_1.cva)(constants_1.pageHeaderClassnames.pageHeaderMobileTitle, {
    variants: {
        hasTitle: {
            true: constants_1.pageHeaderClassnames.hasTitle,
        },
        hasBackButton: {
            true: constants_1.pageHeaderClassnames.hasBackButton,
        },
    },
});
const rootCva = (0, cva_1.cva)(constants_1.pageHeaderClassnames.root, {
    variants: {
        hasActions: {
            true: constants_1.pageHeaderClassnames.hasActions,
        },
    },
});
const PageHeader = (props) => {
    const { title, description, subheader, breadcrumbs, actions, backButton, className, filters, } = props;
    const { isLoading, mobileTitleActions, isShowMobileActions } = (0, useLogic_1.useLogic)(props);
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(styles_1.MobileTitleWrapper, { className: mobilePageHeaderCva({
                    hasTitle: Boolean(title) || isLoading,
                    hasBackButton: Boolean(backButton),
                }), children: [(0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading }), mobileTitleActions && mobileTitleActions] }), (0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: (0, classNames_1.classNames)(rootCva({ hasActions: Boolean(actions) }), className), children: (0, jsx_runtime_1.jsx)(HeaderContent_1.HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && ((0, jsx_runtime_1.jsx)(MobilePageActions_1.MobilePageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
};
exports.PageHeader = PageHeader;
