"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FilePicker = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactDropzone = require("react-dropzone");
require("../styles/filepicker.css");
var FilePicker = function FilePicker(_ref) {
  var fileMessage = _ref.fileMessage,
    dragMessage = _ref.dragMessage,
    setFiles = _ref.setFiles,
    isFullWidth = _ref.isFullWidth;
  var fullWidth = isFullWidth && 'full-width';
  var onDrop = (0, _react.useCallback)(function (acceptedFiles) {
    // Do something with the files

    setFiles(acceptedFiles);
  }, []);
  var _useDropzone = (0, _reactDropzone.useDropzone)({
      onDrop: onDrop
    }),
    getRootProps = _useDropzone.getRootProps,
    getInputProps = _useDropzone.getInputProps,
    isDragActive = _useDropzone.isDragActive;
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
    className: ["filepicker", fullWidth].join(' ')
  }, getRootProps()), /*#__PURE__*/_react.default.createElement("input", getInputProps()), isDragActive ? /*#__PURE__*/_react.default.createElement("h5", null, dragMessage ? dragMessage : 'Drop the files here ...') : /*#__PURE__*/_react.default.createElement("h5", null, fileMessage ? fileMessage : 'Drop files or click to upload'));
};
exports.FilePicker = FilePicker;