import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useRef } from 'react';
import classNames from 'classnames';
import './FileDropzone.scss';
import Button from '../Button';
import Typography from '../Typography';
import RadioGroup from '../RadioGroup';
import RadioFilePreview from './RadioFilePreview';
const Dropzone = ({ icon, primaryLabel, secondaryLabel, buttonLabel, getRootProps, getInputProps, isDragActive = false, height = 188, isWebServiceFileDropZone = false, selectedRadioOption, radioOptions, handleOptionChange, selectedFile, setSelectedFile, handleRemoveFile, isDisable, setShowDrawer, setFileContent, }) => {
    const isWebServiceFile = selectedFile?.name && isWebServiceFileDropZone;
    const inputRef = useRef(null);
    const handleOnClick = (e) => {
        if (!isDisable && inputRef.current) {
            inputRef.current.click();
            e.currentTarget.blur();
        }
    };
    return (_jsx("div", { ...getRootProps(), className: classNames('ff-file-dropzone', {
            'ff-file-dropzone--active': isDragActive,
            'ff-file-dropzone--webservice-file': isWebServiceFile,
            'ff-file-dropzone--webservice-container': isWebServiceFileDropZone,
            'ff-disable-file-dropzone-wrapper': isDisable,
        }), style: { height: height }, children: isWebServiceFile ? (_jsx(RadioFilePreview, { selectedFile: selectedFile.name, onFileRemoveClick: handleRemoveFile, onFileReplaceClick: setSelectedFile, setSelectedFile: setSelectedFile, selectedRadioOption: selectedRadioOption, setShowDrawer: setShowDrawer, setFileContent: setFileContent })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "ff-file-dropzone-content__icon", children: icon }), _jsxs("div", { className: "ff-file-dropzone-content__labels", children: [_jsx(Typography, { as: "p", fontWeight: "semi-bold", lineHeight: "18px", textAlign: "center", color: 'var(--text-color)', children: primaryLabel }), _jsx(Typography, { as: "p", lineHeight: "18px", textAlign: "center", color: 'var(--text-color)', children: secondaryLabel }), isWebServiceFileDropZone ? (_jsxs("div", { className: "ff-radio-group-wrapper", children: [_jsxs(Typography, { fontWeight: "semi-bold", children: [' ', "Choose file from", ' '] }), _jsx(RadioGroup, { name: "radio_btn_file_dropzone", options: radioOptions ?? [
                                        { label: 'Default Label', value: 'default_value' },
                                    ], selectedValue: selectedRadioOption?.value, onChange: handleOptionChange })] })) : (_jsx(Button, { variant: "primary", label: buttonLabel, className: "choose-file-btn", disabled: isDisable, onClick: handleOnClick, children: _jsx("input", { ref: inputRef, ...(isDisable
                                    ? { style: { cursor: 'not-allowed' }, disabled: true }
                                    : getInputProps()), title: "", "aria-label": "", style: { display: 'none' } }) }))] })] })) }));
};
export default Dropzone;
//# sourceMappingURL=Dropzone.js.map