import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDropzone from 'react-dropzone';
import { translate } from '../../../utils';
import { Block } from '../Block';
import { Button } from '../Button'; // for full documentation visit https://react-dropzone.js.org/#dropzone

export var Dropzone =
/*#__PURE__*/
function (_Component) {
  _inheritsLoose(Dropzone, _Component);

  function Dropzone() {
    return _Component.apply(this, arguments) || this;
  }

  var _proto = Dropzone.prototype;

  _proto.renderContent = function renderContent() {
    var _this$props = this.props,
        children = _this$props.children,
        contentClassname = _this$props.contentClassname,
        dragText = _this$props.dragText,
        orText = _this$props.orText;

    if (children) {
      return React.createElement("div", {
        className: contentClassname
      }, children);
    }

    return React.createElement("div", {
      className: contentClassname
    }, React.createElement(Block, {
      condensed: true
    }, React.createElement("span", {
      className: "rc-dropzone-caption"
    }, translate(dragText))), React.createElement(Block, {
      condensed: true
    }, React.createElement("span", {
      className: "rc-dropzone-or"
    }, translate(orText))), React.createElement(Button, null, "Upload File"));
  };

  _proto.render = function render() {
    var _this$props2 = this.props,
        testAutomationId = _this$props2.testAutomationId,
        restProps = _objectWithoutPropertiesLoose(_this$props2, ["testAutomationId"]);

    return React.createElement(ReactDropzone, _extends({}, restProps, {
      className: "rc-dropzone",
      activeClassName: "rc-dropzone-active",
      acceptClassName: "rc-dropzone-accept",
      rejectClassName: "rc-dropzone-reject",
      disabledClassName: "rc-dropzone-disabled",
      "data-test-automation-id": testAutomationId
    }), this.renderContent());
  };

  return Dropzone;
}(Component);

_defineProperty(Dropzone, "propTypes", Object.assign({}, ReactDropzone.propTypes, {
  contentClassname: PropTypes.string,
  testAutomationId: PropTypes.string,
  dragText: PropTypes.string,
  orText: PropTypes.string
}));

_defineProperty(Dropzone, "defaultProps", {
  contentClassname: 'rc-dropzone-content',
  testAutomationId: 'dropzone',
  dragText: 'TRANSLATE:DRAG_FILES_HERE',
  orText: 'TRANSLATE:OR'
});