'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; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

require('react-dates/initialize');

var _reactDates = require('react-dates');

var _Icon = require('../Icon');

var _Icon2 = _interopRequireDefault(_Icon);

var _DateRangePickerWrapper = require('./styles/DateRangePickerWrapper');

var _DateRangePickerWrapper2 = _interopRequireDefault(_DateRangePickerWrapper);

var _DateRangePickerLineSeparator = require('./styles/DateRangePickerLineSeparator');

var _DateRangePickerLineSeparator2 = _interopRequireDefault(_DateRangePickerLineSeparator);

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 DateRangePicker = function DateRangePicker(_ref) {
  var Wrapper = _ref.Wrapper,
      LineSeparator = _ref.LineSeparator,
      props = _objectWithoutProperties(_ref, ['Wrapper', 'LineSeparator']);

  return _react2.default.createElement(
    Wrapper,
    null,
    _react2.default.createElement(_reactDates.DateRangePicker, _extends({}, props, {
      navPrev: _react2.default.createElement(_Icon2.default, { name: 'back', size: '12px' }),
      navNext: _react2.default.createElement(_Icon2.default, { name: 'forward', size: '12px' }),
      weekDayFormat: 'dd',
      displayFormat: 'MMM DD YYYY',
      customArrowIcon: _react2.default.createElement(LineSeparator, null),
      daySize: 37,
      horizontalMargin: 0
    }))
  );
};

DateRangePicker.propTypes = _extends({}, _reactDates.DateRangePickerShape, {
  startDateId: _propTypes2.default.string,
  endDateId: _propTypes2.default.string,
  /**
   * A component to wrap and control styles of the underlying react-dates DatePicker
   */
  Wrapper: _propTypes2.default.func,
  /**
   * A component that renders the separator line between the two inputs
   */
  LineSeparator: _propTypes2.default.func
});

DateRangePicker.defaultProps = {
  Wrapper: _DateRangePickerWrapper2.default,
  LineSeparator: _DateRangePickerLineSeparator2.default
};

exports.default = DateRangePicker;