"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileUploadDialog = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const uikit_1 = require("@gravity-ui/uikit");
const cn_1 = require("../../../utils/cn.js");
const FileDropZone_1 = require("../../molecules/FileDropZone/index.js");
const FileItem_1 = require("../../molecules/FileItem/index.js");
const i18n_1 = require("./i18n/index.js");
require("./FileUploadDialog.css");
const b = (0, cn_1.block)('file-upload-dialog');
/**
 * FileUploadDialog presents a drag-and-drop zone and a list of queued files.
 * It is a pure UI component — upload logic is wired externally via `useFileUploadStore`.
 */
const FileUploadDialog = ({ open, onClose, accept, multiple = true, onAdd, files, onApply, onCancel, title = (0, i18n_1.i18n)('title'), dropZoneLabel, dropZoneHint, applyButtonText = (0, i18n_1.i18n)('apply-button'), cancelButtonText = (0, i18n_1.i18n)('cancel-button'), disabled, }) => {
    return ((0, jsx_runtime_1.jsxs)(uikit_1.Dialog, { open: open, onClose: onClose, className: b(), children: [(0, jsx_runtime_1.jsx)(uikit_1.Dialog.Header, { caption: title }), (0, jsx_runtime_1.jsxs)(uikit_1.Dialog.Body, { className: b('body'), children: [(0, jsx_runtime_1.jsx)(FileDropZone_1.FileDropZone, { accept: accept, multiple: multiple, onAdd: onAdd, label: dropZoneLabel, hint: dropZoneHint, disabled: disabled, className: b('drop-zone') }), files.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: b('file-list'), children: files.map((fileProps) => {
                            var _a;
                            return ((0, jsx_runtime_1.jsx)(FileItem_1.FileItem, Object.assign({}, fileProps), (_a = fileProps.id) !== null && _a !== void 0 ? _a : fileProps.name));
                        }) }))] }), (0, jsx_runtime_1.jsx)(uikit_1.Dialog.Footer, { onClickButtonApply: onApply !== null && onApply !== void 0 ? onApply : onClose, onClickButtonCancel: onCancel !== null && onCancel !== void 0 ? onCancel : onClose, textButtonApply: applyButtonText, textButtonCancel: cancelButtonText, propsButtonApply: {
                    disabled: disabled || files.length === 0 || files.some((f) => f.status === 'loading'),
                } })] }));
};
exports.FileUploadDialog = FileUploadDialog;
//# sourceMappingURL=FileUploadDialog.js.map
