'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _InputDate = require('../InputDate');

var _InputDate2 = _interopRequireDefault(_InputDate);

require('./style.css');

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var DateRange = function (_React$Component) {
  _inherits(DateRange, _React$Component);

  function DateRange(props) {
    _classCallCheck(this, DateRange);

    var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));

    _this.state = {};
    return _this;
  }

  DateRange.prototype.render = function render() {
    return _react2.default.createElement(
      'div',
      { className: 'ma__date-range' },
      _react2.default.createElement(
        'fieldset',
        null,
        _react2.default.createElement(
          'legend',
          { className: 'ma__date-range__label' },
          this.props.label
        ),
        _react2.default.createElement(
          'div',
          { className: 'ma__date-range__start js-filter-by-date-range__start' },
          _react2.default.createElement(_InputDate2.default, this.props.startDate)
        ),
        _react2.default.createElement(
          'div',
          { className: 'ma__date-range__divider' },
          'to'
        ),
        _react2.default.createElement(
          'div',
          { className: 'ma__date-range__end js-filter-by-date-range__end' },
          _react2.default.createElement(_InputDate2.default, this.props.endDate)
        )
      )
    );
  };

  return DateRange;
}(_react2.default.Component);

DateRange.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The text label of the date range input */
  label: _propTypes2.default.string.isRequired,
  /** The start date of your filter query, @forms/InputDate */
  startDate: _propTypes2.default.shape(_InputDate2.default.props).isRequired,
  /** The end date of your filter query, @forms/InputDate */
  endDate: _propTypes2.default.shape(_InputDate2.default.props).isRequired
} : {};

exports.default = DateRange;
module.exports = exports['default'];