import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useUploadLoading } from "../../../../hooks/useUploadLoading.js";
import { AddFileButton } from "./AddFileButton.js";
import { FileNameWithIcon } from "./FileNameWithIcon.js";
export const FileBlockWrapper = (props) => {
    const showLoader = useUploadLoading(props.block.id);
    return (_jsx("div", { className: "bn-file-block-content-wrapper", onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, style: props.style, children: showLoader ? (
        // Show loader while a file is being uploaded.
        _jsx("div", { className: "bn-file-loading-preview", children: "Loading..." })) : props.block.props.url === "" ? (
        // Show the add file button if the file has not been uploaded yet.
        _jsx(AddFileButton, { ...props })) : (
        // Show the file preview, or the file name and icon.
        _jsxs(_Fragment, { children: [props.block.props.showPreview === false || !props.children ? (
                // Show file name and icon.
                _jsx(FileNameWithIcon, { ...props })) : (
                // Show preview.
                props.children), props.block.props.caption && (
                // Show the caption if there is one.
                _jsx("p", { className: "bn-file-caption", children: props.block.props.caption }))] })) }));
};
//# sourceMappingURL=FileBlockWrapper.js.map