import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2019-2026 GoodData Corporation
import cx from "classnames";
import { isEmpty } from "lodash-es";
import { Typography } from "@gooddata/sdk-ui-kit";
import { getLayoutConfiguration } from "../../../_staging/dashboard/flexibleLayout/layoutConfiguration.js";
import { useDashboardSelector } from "../../../model/react/DashboardStoreProvider.js";
import { selectEnableSnapshotExportAccessibility, selectIsExport, } from "../../../model/store/config/configSelectors.js";
import { useDashboardComponentsContext } from "../../dashboardContexts/DashboardComponentsContext.js";
import { DashboardLayoutSectionHeaderDescription } from "./DashboardLayoutSectionHeaderDescription.js";
export function DashboardLayoutViewSectionHeader({ section, exportData, onLoadingChanged, onError, }) {
    const { sections } = getLayoutConfiguration(section.layout().raw());
    const { LoadingComponent } = useDashboardComponentsContext();
    const isExport = useDashboardSelector(selectIsExport);
    const isSnapshotAccessibilityEnabled = useDashboardSelector(selectEnableSnapshotExportAccessibility);
    const useAccessibilityExportClasses = isSnapshotAccessibilityEnabled && isExport;
    const title = section.title();
    const description = section.description();
    if (!sections.areHeadersEnabled || (isEmpty(title) && isEmpty(description))) {
        return null;
    }
    const isNestedLayout = section.layout().path() !== undefined;
    return (_jsx("div", { className: cx("gd-fluid-layout-row-header s-fluid-layout-row-header", {
            "gd-row-header-export": useAccessibilityExportClasses,
        }), ...exportData?.info, children: _jsx("div", { className: "gd-fluid-layout-row-header-container", children: _jsxs("div", { className: "gd-row-header-view", children: [title ? (_jsx("div", { className: cx("gd-row-header-title-wrapper", {
                            "gd-row-header-title-wrapper-export": useAccessibilityExportClasses,
                        }), ...exportData?.title, children: _jsx("span", { className: "title", children: _jsx(Typography, { tagName: isNestedLayout ? "h3" : "h2", className: "s-fluid-layout-row-title", children: title }) }) })) : null, description ? (_jsx(DashboardLayoutSectionHeaderDescription, { description: description, exportData: exportData?.description, LoadingComponent: LoadingComponent, onLoadingChanged: onLoadingChanged, onError: onError })) : null] }) }) }));
}
//# sourceMappingURL=DashboardLayoutViewSectionHeaderRenderer.js.map