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