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