"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.ActionButton = void 0;
const React = require("react");
const itwinui_react_1 = require("@itwin/itwinui-react");
const MoreButton_1 = require("./MoreButton");
const Button_1 = require("../../layout/widget/Button");
/** @internal */
function ActionButton(props) {
    const dropdownContext = React.useContext(MoreButton_1.WidgetActionDropdownContext);
    if (dropdownContext !== undefined) {
        return (React.createElement(itwinui_react_1.MenuItem, { icon: props.icon, onClick: () => {
                props.onClick?.();
                dropdownContext.onClose();
            }, ...props.menuProps }, props.label));
    }
    return (React.createElement(Button_1.TabBarButton, { onClick: props.onClick, label: props.label, ...props.buttonProps }, props.icon));
}
exports.ActionButton = ActionButton;
//# sourceMappingURL=Button.js.map