import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { UiIcon } from "../../@ui/UiIcon/UiIcon.js";
import { Dialog } from "../../Dialog/Dialog.js";
import { useIdPrefixed } from "../../utils/useId.js";
import { UploadItemStatus } from "../types.js";
import { b, e } from "./uploadStatusDialogBem.js";
/**
 * @internal
 */
export function UploadStatusDialog({ isOpen, title, fileName, status, onClose }) {
    const titleId = useIdPrefixed("gd-upload-status-dialog-title");
    if (!isOpen) {
        return null;
    }
    return (_jsx(Dialog, { displayCloseButton: !!onClose, className: b(), onCancel: onClose, onClose: onClose, accessibilityConfig: {
            titleElementId: titleId,
            isModal: true,
        }, children: _jsxs("div", { className: e("content"), "aria-live": "polite", children: [
                _jsxs("div", { className: e("hero-image"), children: [
                        _jsx(UiIcon, { type: "file", size: 48, color: "complementary-6" }), status === UploadItemStatus.Uploading || status === UploadItemStatus.Idle ? (_jsx("div", { className: e("status-icon", {
                                spinning: status === UploadItemStatus.Uploading,
                            }), children: _jsx(UiIcon, { type: "sync", size: 25, color: "primary", backgroundShape: "circle", backgroundColor: "complementary-0", backgroundSize: 30, accessibilityConfig: { ariaHidden: true } }) })) : null, status === UploadItemStatus.Success ? (_jsx("div", { className: e("status-icon"), children: _jsx(UiIcon, { type: "check", size: 20, color: "success", backgroundShape: "circle", backgroundColor: "complementary-0", backgroundSize: 30, accessibilityConfig: { ariaHidden: true } }) })) : null, status === UploadItemStatus.Error ? (_jsx("div", { className: e("status-icon"), children: _jsx(UiIcon, { type: "cross", size: 25, color: "error", backgroundShape: "circle", backgroundColor: "complementary-0", backgroundSize: 30, accessibilityConfig: { ariaHidden: true } }) })) : null] }), _jsxs("h3", { id: titleId, children: [title, fileName ? (_jsxs(_Fragment, { children: [
                                _jsx("br", {}),
                                "\"", fileName, "\""] })) : null] })
            ] }) }));
}
