"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 Frontstage
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.NestedFrontstageAppButton = void 0;
const React = require("react");
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
const useTranslation_1 = require("../hooks/useTranslation");
const UiFramework_1 = require("../UiFramework");
const BackstageAppButton_1 = require("../widgets/BackstageAppButton");
/** App button used in a nested frontstage. By default closes the top-most nested frontstage.
 * @public
 */
function NestedFrontstageAppButton({ icon, label, onClick, }) {
    const { translate } = (0, useTranslation_1.useTranslation)();
    label = label ?? translate("commands.backToPreviousFrontstage");
    icon = icon ?? React.createElement(itwinui_icons_react_1.SvgProgressBackwardCircular, null);
    return (React.createElement(BackstageAppButton_1.BackstageAppButton, { label: label, icon: icon, execute: () => {
            if (onClick) {
                onClick();
                return;
            }
            void UiFramework_1.UiFramework.frontstages.closeNestedFrontstage();
        } }));
}
exports.NestedFrontstageAppButton = NestedFrontstageAppButton;
//# sourceMappingURL=NestedFrontstageAppButton.js.map