import { Button, InlineLoading, InlineNotification, Stack } from "@carbon/react";
import React from "react";
export const OnboardingPage = ({ isDoingAsyncWork, heading, headingLabel, primaryButtonText, primaryButtonDisabled = false, secondaryButtonText = "Cancel", tertiaryButtonText, loadingText, error = { title: "", description: "" }, danger = false, onSecondary, onPrimary, onTertiary, children, }) => {
    return (React.createElement(Stack, null,
        React.createElement(Stack, null,
            React.createElement("h1", null, heading),
            React.createElement("p", null, headingLabel)),
        React.createElement("div", { style: { minHeight: "520px" } },
            React.createElement(Stack, { gap: 6 },
                children,
                error.title ? (React.createElement(InlineNotification, { kind: "error", title: error.title, subtitle: error.description, hideCloseButton: true })) : (""))),
        (() => {
            if (tertiaryButtonText && onTertiary !== undefined) {
                return (React.createElement(Stack, { orientation: "horizontal" },
                    React.createElement(Button, { kind: "ghost", disabled: isDoingAsyncWork, onClick: () => onTertiary() }, tertiaryButtonText),
                    React.createElement(Button, { style: {
                            paddingRight: "1rem",
                            marginLeft: "auto",
                            marginRight: "0px",
                        }, kind: danger ? "danger" : "primary", disabled: primaryButtonDisabled || isDoingAsyncWork, onClick: () => {
                            if (onPrimary) {
                                onPrimary();
                            }
                        } }, isDoingAsyncWork ? (React.createElement(InlineLoading, { description: loadingText })) : (primaryButtonText))));
            }
            else {
                return (React.createElement(Stack, { orientation: "horizontal" },
                    (() => {
                        let button = React.createElement(React.Fragment, null);
                        if (secondaryButtonText && onSecondary) {
                            button = (React.createElement(Button, { kind: "secondary", disabled: isDoingAsyncWork, onClick: () => onSecondary?.(), style: { marginLeft: "0px" } }, secondaryButtonText));
                        }
                        return button;
                    })(),
                    React.createElement(Button, { style: { marginLeft: "auto", marginRight: "0px" }, kind: danger ? "danger" : "primary", disabled: primaryButtonDisabled || isDoingAsyncWork, onClick: () => {
                            if (onPrimary) {
                                onPrimary();
                            }
                        } }, isDoingAsyncWork ? (React.createElement(InlineLoading, { description: loadingText })) : (primaryButtonText))));
            }
        })()));
};
