"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module WidgetPanels
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardLayout = void 0;
require("./StandardLayout.scss");
const classnames_1 = require("classnames");
const React = require("react");
const LayoutStore_1 = require("./base/LayoutStore");
const useContentAlwaysMaxSize_1 = require("../preview/content-always-max-size/useContentAlwaysMaxSize");
const useMaximizedWidget_1 = require("../preview/enable-maximized-widget/useMaximizedWidget");
const useHorizontalPanelAlignment_1 = require("../preview/horizontal-panel-alignment/useHorizontalPanelAlignment");
const usePanelsAutoCollapse_1 = require("./widget-panels/usePanelsAutoCollapse");
/** Component that displays widgets in a standard layout.
 * @internal
 */
function StandardLayout(props) {
    const pinned = usePinnedPanels();
    const appContentRef = (0, usePanelsAutoCollapse_1.usePanelsAutoCollapse)();
    const className = (0, classnames_1.default)("nz-standardLayout", pinned, props.className);
    const contentAlwaysMaxSize = (0, useContentAlwaysMaxSize_1.useContentAlwaysMaxSize)();
    return (React.createElement("div", { className: className, style: props.style },
        React.createElement("div", { className: (0, classnames_1.default)("nz-appContent", contentAlwaysMaxSize), ref: appContentRef }, props.children),
        React.createElement("div", { className: "nz-centerContent" }, props.centerContent),
        React.createElement(Panel, { side: "left" }, props.leftPanel),
        React.createElement(Panel, { side: "right" }, props.rightPanel),
        React.createElement(Panel, { side: "top" }, props.topPanel),
        React.createElement(Panel, { side: "bottom" }, props.bottomPanel),
        React.createElement("div", { className: "nz-toolSettings" }, props.toolSettings),
        React.createElement("div", { className: "nz-statusBar" }, props.statusBar)));
}
exports.StandardLayout = StandardLayout;
function Panel({ children, side }) {
    const maximizedWidget = (0, useMaximizedWidget_1.useMaximizedPanelLayout)(side);
    const horizontalAlignment = (0, useHorizontalPanelAlignment_1.useHorizontalPanelAlignment)(side);
    const className = (0, classnames_1.default)(`nz-standardLayout_${side}Panel`, maximizedWidget, horizontalAlignment.classNames);
    return (React.createElement("div", { className: className, ...horizontalAlignment.attributes }, children));
}
function usePinnedPanels() {
    const leftPinned = (0, LayoutStore_1.useLayout)((state) => state.panels.left.pinned);
    const rightPinned = (0, LayoutStore_1.useLayout)((state) => state.panels.right.pinned);
    const topPinned = (0, LayoutStore_1.useLayout)((state) => state.panels.top.pinned);
    const bottomPinned = (0, LayoutStore_1.useLayout)((state) => state.panels.bottom.pinned);
    return {
        "nz-pinned-left": leftPinned,
        "nz-pinned-right": rightPinned,
        "nz-pinned-top": topPinned,
        "nz-pinned-bottom": bottomPinned,
    };
}
//# sourceMappingURL=StandardLayout.js.map