/*---------------------------------------------------------------------------------------------
* 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
 */
import * as React from "react";
import { Orientation } from "@itwin/core-react";
import { Direction, ToolbarPanelAlignment } from "@itwin/appui-layout-react";
import { Toolbar } from "../toolbar/Toolbar";
import { WidgetDef } from "./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
 */
export class ToolbarWidgetDefBase extends WidgetDef {
    constructor(def) {
        super(def);
        this._toolbarBaseName = "";
        // eslint-disable-next-line deprecation/deprecation
        this.horizontalDirection = (def.horizontalDirection !== undefined) ? def.horizontalDirection : Direction.Bottom;
        // eslint-disable-next-line deprecation/deprecation
        this.verticalDirection = (def.verticalDirection !== undefined) ? def.verticalDirection : Direction.Right;
        this.horizontalPanelAlignment = ToolbarPanelAlignment.Start; // eslint-disable-line deprecation/deprecation
        this.verticalPanelAlignment = 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, { toolbarId: `${this.widgetBaseName}-horizontal`, orientation: 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, { toolbarId: `${this.widgetBaseName}-vertical`, orientation: Orientation.Vertical, expandsTo: this.verticalDirection, panelAlignment: this.verticalPanelAlignment, items: toolbarItems }));
        }
        return null;
    }
}
//# sourceMappingURL=ToolbarWidgetBase.js.map