"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 Toolbar
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolbarContext = exports.Toolbar = void 0;
const React = require("react");
const ToolbarItem_1 = require("../../toolbar/ToolbarItem");
const ToolGroup_1 = require("./ToolGroup");
/** @internal */
function Toolbar({ items, expandsTo = "bottom", panelAlignment = "start", }) {
    const [popoverOpen, setPopoverOpen] = React.useState(false);
    return (React.createElement(exports.ToolbarContext.Provider, { value: {
            expandsTo,
            panelAlignment,
            popoverOpen,
            setPopoverOpen,
        } },
        React.createElement(ToolGroup_1.ToolGroup, null, items.map((item) => {
            if ((0, ToolbarItem_1.isToolbarActionItem)(item)) {
                return React.createElement(ToolGroup_1.ToolGroup.ActionItem, { key: item.id, item: item });
            }
            if ((0, ToolbarItem_1.isToolbarGroupItem)(item)) {
                return React.createElement(ToolGroup_1.ToolGroup.GroupItem, { key: item.id, item: item });
            }
            if ((0, ToolbarItem_1.isToolbarCustomItem)(item)) {
                return React.createElement(ToolGroup_1.ToolGroup.CustomItem, { key: item.id, item: item });
            }
            return null;
        }))));
}
exports.Toolbar = Toolbar;
/** @internal */
exports.ToolbarContext = React.createContext(undefined);
exports.ToolbarContext.displayName = "uifw:ToolbarContext";
//# sourceMappingURL=Toolbar.js.map