'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = CompoundInput;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _CustomCompoundInput = require('./CustomCompoundInput');

var _CustomCompoundInput2 = _interopRequireDefault(_CustomCompoundInput);

var _TabularCompoundInput = require('./TabularCompoundInput');

var _TabularCompoundInput2 = _interopRequireDefault(_TabularCompoundInput);

var _labelable = require('../enhancers/labelable');

var _labelable2 = _interopRequireDefault(_labelable);

var _repeatable = require('../enhancers/repeatable');

var _repeatable2 = _interopRequireDefault(_repeatable);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var CustomCompoundInput = (0, _repeatable2.default)((0, _labelable2.default)(_CustomCompoundInput2.default));
var TabularCompoundInput = (0, _labelable2.default)(_TabularCompoundInput2.default);

var propTypes = _extends({}, TabularCompoundInput.propTypes, {
  tabular: _react.PropTypes.bool
});

function CompoundInput(props) {
  var tabular = props.tabular,
      remainingProps = _objectWithoutProperties(props, ['tabular']);

  var BaseComponent = tabular ? TabularCompoundInput : CustomCompoundInput;

  return _react2.default.createElement(BaseComponent, remainingProps);
}

CompoundInput.propTypes = propTypes;