"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.ActionItem = void 0;
const React = require("react");
const OverflowButton_1 = require("./OverflowButton");
const Item_1 = require("./Item");
const GroupItem_1 = require("./GroupItem");
/** @internal */
exports.ActionItem = React.forwardRef(function ActionItem({ item }, ref) {
    const overflowContext = React.useContext(OverflowButton_1.ToolGroupOverflowContext);
    if (overflowContext) {
        return React.createElement(GroupItem_1.GroupMenuItem, { item: item, onClose: overflowContext.onClose });
    }
    return (React.createElement(Item_1.Item, { ref: ref, item: item, onClick: () => {
            item.execute();
        } }));
});
//# sourceMappingURL=ActionItem.js.map