/*---------------------------------------------------------------------------------------------
 * 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 "./BackstageAppButton.scss";
import * as React from "react";
import { Icon as CoreIcon } from "@itwin/core-react";
import { SvgHome } from "@itwin/itwinui-icons-react";
import { UiFramework } from "../UiFramework.js";
import { useTranslation } from "../hooks/useTranslation.js";
import { Surface } from "../toolbar/new-toolbars/Surface.js";
import { IconButton } from "@itwin/itwinui-react";
/** Component shown in the top-left corner of the content manipulation area. It is usually used to toggle the display of a backstage or navigate between frontstages.
 * @public
 */
export function BackstageAppButton({ 
// eslint-disable-next-line @typescript-eslint/no-deprecated
icon: iconSpec, iconNode, label, execute, }) {
    const { translate } = useTranslation();
    label = label ?? translate("buttons.openBackstageMenu");
    const handleClick = React.useCallback(() => {
        if (execute) {
            execute();
            return;
        }
        UiFramework.backstage.toggle();
    }, [execute]);
    const iconSpecElement = iconSpec ? (
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    React.createElement(CoreIcon, { iconSpec: iconSpec })) : undefined;
    const icon = iconNode ?? iconSpecElement ?? React.createElement(SvgHome, null);
    return (React.createElement(Surface, { orientation: "horizontal" },
        React.createElement(IconButton, { className: "uifw-widget-backstageAppButton", styleType: "borderless", onClick: handleClick, iconProps: { className: "uifw-widget-backstageAppButton_icon" }, label: label, labelProps: {
                placement: "right",
                className: "uifw-widget-backstageAppButton_label",
            } },
            icon,
            React.createElement("div", { className: "uifw-widget-backstageAppButton_bars" },
                React.createElement("div", { className: "uifw-bar" }),
                React.createElement("div", { className: "uifw-bar" }),
                React.createElement("div", { className: "uifw-bar" })))));
}
//# sourceMappingURL=BackstageAppButton.js.map