import _isUndefined from "lodash/fp/isUndefined";
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import PropTypes from 'prop-types';
import InputFileDraggable from '../../atom/input-file-draggable';
import InputTextWithTitle from '../../atom/input-text-with-title';
import SelectMultiple from '../select-multiple';
import CheckboxWithTitle from '../../atom/checkbox-with-title';
import Title from '../../atom/title';
import DragAndDropWrapper from '../drag-and-drop-wrapper';
import style from './style.css';
const CHILD = {
  'input-text': InputTextWithTitle,
  'drag-and-drop-wrapper': DragAndDropWrapper,
  'image-upload': InputFileDraggable,
  'select-multiple': SelectMultiple
};
const TitleAndCheckBoxWrapper = props => {
  const {
    checkboxWithTitle,
    child,
    sectionTitle
  } = props;
  const Child = CHILD[child.childType];
  return /*#__PURE__*/React.createElement("div", null, checkboxWithTitle ? /*#__PURE__*/React.createElement(CheckboxWithTitle, checkboxWithTitle) : null, sectionTitle ? /*#__PURE__*/React.createElement("div", {
    className: style.sectionTitle
  }, /*#__PURE__*/React.createElement(Title, _extends({}, sectionTitle, {
    type: 'form-group'
  }))) : null, /*#__PURE__*/React.createElement("div", {
    className: checkboxWithTitle || sectionTitle && _isUndefined(sectionTitle.removeMargin) ? style.child : null
  }, /*#__PURE__*/React.createElement(Child, child)));
};
TitleAndCheckBoxWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
  checkboxWithTitle: PropTypes.shape(CheckboxWithTitle.propTypes),
  sectionTitle: PropTypes.shape({
    ...Title.propTypes,
    removeMargin: PropTypes.bool
  }),
  child: PropTypes.oneOfType([PropTypes.shape({
    ...InputTextWithTitle.propTypes,
    childType: PropTypes.oneOf(['input-text'])
  }), PropTypes.shape({
    ...DragAndDropWrapper.propTypes,
    childType: PropTypes.oneOf(['drag-and-drop-wrapper'])
  }), PropTypes.shape({
    ...InputFileDraggable.propTypes,
    childType: PropTypes.oneOf(['image-upload'])
  }), PropTypes.shape({
    ...SelectMultiple.propTypes,
    childType: PropTypes.oneOf(['select-multiple'])
  })])
} : {};
export default TitleAndCheckBoxWrapper;
//# sourceMappingURL=index.js.map