"use strict";

exports.__esModule = true;
exports.default = void 0;
var _isUndefined2 = _interopRequireDefault(require("lodash/fp/isUndefined"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _inputFileDraggable = _interopRequireDefault(require("../../atom/input-file-draggable"));
var _inputTextWithTitle = _interopRequireDefault(require("../../atom/input-text-with-title"));
var _selectMultiple = _interopRequireDefault(require("../select-multiple"));
var _checkboxWithTitle = _interopRequireDefault(require("../../atom/checkbox-with-title"));
var _title = _interopRequireDefault(require("../../atom/title"));
var _dragAndDropWrapper = _interopRequireDefault(require("../drag-and-drop-wrapper"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const CHILD = {
  'input-text': _inputTextWithTitle.default,
  'drag-and-drop-wrapper': _dragAndDropWrapper.default,
  'image-upload': _inputFileDraggable.default,
  'select-multiple': _selectMultiple.default
};
const TitleAndCheckBoxWrapper = props => {
  const {
    checkboxWithTitle,
    child,
    sectionTitle
  } = props;
  const Child = CHILD[child.childType];
  return /*#__PURE__*/_react.default.createElement("div", null, checkboxWithTitle ? /*#__PURE__*/_react.default.createElement(_checkboxWithTitle.default, checkboxWithTitle) : null, sectionTitle ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.sectionTitle
  }, /*#__PURE__*/_react.default.createElement(_title.default, _extends({}, sectionTitle, {
    type: 'form-group'
  }))) : null, /*#__PURE__*/_react.default.createElement("div", {
    className: checkboxWithTitle || sectionTitle && (0, _isUndefined2.default)(sectionTitle.removeMargin) ? _style.default.child : null
  }, /*#__PURE__*/_react.default.createElement(Child, child)));
};
TitleAndCheckBoxWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
  checkboxWithTitle: _propTypes.default.shape(_checkboxWithTitle.default.propTypes),
  sectionTitle: _propTypes.default.shape({
    ..._title.default.propTypes,
    removeMargin: _propTypes.default.bool
  }),
  child: _propTypes.default.oneOfType([_propTypes.default.shape({
    ..._inputTextWithTitle.default.propTypes,
    childType: _propTypes.default.oneOf(['input-text'])
  }), _propTypes.default.shape({
    ..._dragAndDropWrapper.default.propTypes,
    childType: _propTypes.default.oneOf(['drag-and-drop-wrapper'])
  }), _propTypes.default.shape({
    ..._inputFileDraggable.default.propTypes,
    childType: _propTypes.default.oneOf(['image-upload'])
  }), _propTypes.default.shape({
    ..._selectMultiple.default.propTypes,
    childType: _propTypes.default.oneOf(['select-multiple'])
  })])
} : {};
var _default = exports.default = TitleAndCheckBoxWrapper;
//# sourceMappingURL=index.js.map