/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
import "./HeaderLayout.scss";
import * as React from "react";
import { DropdownButton, MenuItem, Text, ToggleSwitch, } from "@itwin/itwinui-react";
import { HeaderTopBar } from "./HeaderTopBar.js";
/**
 * A layout component for the header, including optional search, icons, buttons, title, and a menu.
 * @internal
 */
export function HeaderLayout(props) {
    const buttons = props.buttons || [];
    const icons = props.icons || [];
    const leftItems = [
        props.toggle ? React.createElement(ToggleSwitch, { key: "toggle", ...props.toggle }) : undefined,
        props.menu ? (React.createElement(DropdownButton, { key: "menu", className: "nz-menu", menuItems: props.menu.items.map((i) => (React.createElement(MenuItem, { key: i.label, onClick: i.onClick }, i.label))) }, props.menu.title)) : undefined,
        buttons.length > 0 ? (React.createElement("div", { key: "buttons", className: "nz-buttons" }, buttons)) : undefined,
    ].filter((item) => !!item);
    const topBarLeftItems = props.title
        ? [
            React.createElement(Text, { key: "title", className: "nz-title" }, props.title),
        ]
        : leftItems.slice(0, 1);
    const remainingLeftItems = props.title ? leftItems : leftItems.slice(1);
    return (React.createElement("div", { className: "nz-widget-widgetContentLayout-header-headerLayout" },
        (props.onSearch || topBarLeftItems.length > 0 || icons.length > 0) && (React.createElement(HeaderTopBar, { primaryContent: topBarLeftItems, onSearch: props.onSearch, icons: icons, iconSize: props.iconSize })),
        remainingLeftItems.map((item) => (React.createElement("div", { className: "nz-remainingItems", key: item.key }, item)))));
}
//# sourceMappingURL=HeaderLayout.js.map