import { jsx as _jsx } from "react/jsx-runtime";
import { useRef } from 'react';
import { useTranslation } from 'react-i18next';
import AppModal from '../AppModal';
import AppDropzoneBody from './AppDropzoneBody';
export default function AppDropzone({ folder, onClose, onSuccess, onError, accept, messages, onDrop, keepName, title, alternativeButton, disableConfirm = false, }) {
    const { t } = useTranslation('upload');
    const bodyRef = useRef(null);
    const handleConfirm = () => {
        bodyRef.current?.upload();
    };
    return (_jsx(AppModal, { title: title || t('modal.title', { defaultValue: 'Upload a file' }), className: "modal-upload", close: onClose, confirm: handleConfirm, disableConfirm: disableConfirm, alternativeButton: alternativeButton, children: _jsx(AppDropzoneBody, { ref: bodyRef, folder: folder, onSuccess: onSuccess, onError: onError, accept: accept, messages: messages, onDrop: onDrop, keepName: keepName, showConfirmButton: false }) }));
}
