"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 Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolbarWidgetDefBase = void 0;
const React = require("react");
const core_react_1 = require("@itwin/core-react");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const Toolbar_1 = require("../toolbar/Toolbar");
const WidgetDef_1 = require("./WidgetDef");
/** A Toolbar Widget normally displayed in the top left & top right zones in the 9-Zone Layout system.
 * @deprecated in 3.0. UI 1.0 will be removed in AppUi 4.0.
 * @public
 */
class ToolbarWidgetDefBase extends WidgetDef_1.WidgetDef {
    constructor(def) {
        super(def);
        this._toolbarBaseName = "";
        // eslint-disable-next-line deprecation/deprecation
        this.horizontalDirection = (def.horizontalDirection !== undefined) ? def.horizontalDirection : appui_layout_react_1.Direction.Bottom;
        // eslint-disable-next-line deprecation/deprecation
        this.verticalDirection = (def.verticalDirection !== undefined) ? def.verticalDirection : appui_layout_react_1.Direction.Right;
        this.horizontalPanelAlignment = appui_layout_react_1.ToolbarPanelAlignment.Start; // eslint-disable-line deprecation/deprecation
        this.verticalPanelAlignment = appui_layout_react_1.ToolbarPanelAlignment.Start; // eslint-disable-line deprecation/deprecation
        this.horizontalItems = def.horizontalItems;
        this.verticalItems = def.verticalItems;
    }
    set widgetBaseName(baseName) {
        this._toolbarBaseName = baseName;
    }
    get widgetBaseName() {
        return this._toolbarBaseName;
    }
    renderHorizontalToolbar() {
        const toolbarItems = this.horizontalItems;
        if (toolbarItems && toolbarItems.items.length) {
            return (React.createElement(Toolbar_1.Toolbar, { toolbarId: `${this.widgetBaseName}-horizontal`, orientation: core_react_1.Orientation.Horizontal, expandsTo: this.horizontalDirection, panelAlignment: this.horizontalPanelAlignment, items: toolbarItems }));
        }
        return null;
    }
    renderVerticalToolbar() {
        const toolbarItems = this.verticalItems;
        if (toolbarItems && toolbarItems.items.length) {
            return (React.createElement(Toolbar_1.Toolbar, { toolbarId: `${this.widgetBaseName}-vertical`, orientation: core_react_1.Orientation.Vertical, expandsTo: this.verticalDirection, panelAlignment: this.verticalPanelAlignment, items: toolbarItems }));
        }
        return null;
    }
}
exports.ToolbarWidgetDefBase = ToolbarWidgetDefBase;
//# sourceMappingURL=ToolbarWidgetBase.js.map