"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.Toolbar = void 0;
const React = require("react");
const components_react_1 = require("@itwin/components-react");
const toUIAToolbarItem_1 = require("./toUIAToolbarItem");
const SyncUiEventDispatcher_1 = require("../syncui/SyncUiEventDispatcher");
const PreviewFeatures_1 = require("../preview/PreviewFeatures");
/** Component that displays toolbar items.
 * @beta
 */
function Toolbar(props) {
    const previewFeatures = (0, PreviewFeatures_1.usePreviewFeatures)();
    if (previewFeatures.newToolbars) {
        return React.createElement(NewToolbar, { ...props });
    }
    return React.createElement(OriginalToolbar, { ...props });
}
exports.Toolbar = Toolbar;
function NewToolbar(_props) {
    return React.createElement(React.Fragment, null, "WIP");
}
function OriginalToolbar(props) {
    const { items, ...other } = props;
    const uiaItems = React.useMemo(() => {
        return items.map((item) => (0, toUIAToolbarItem_1.toUIAToolbarItem)(item));
    }, [items]);
    return (React.createElement(components_react_1.InternalToolbarComponent // eslint-disable-line deprecation/deprecation
    , { items: uiaItems, syncUiEvent: SyncUiEventDispatcher_1.SyncUiEventDispatcher.onSyncUiEvent, ...other }));
}
//# sourceMappingURL=Toolbar.js.map