"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.SingleDatePicker = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _lodash = _interopRequireDefault(require("lodash"));

require("react-dates/initialize");

var _FormGroup2 = require("../FormGroup");

var _SingleDatePickerInputControl = require("../DateTimePicker/SingleDatePickerInputControl");

var SingleDatePicker =
/*#__PURE__*/
function (_FormGroup) {
  (0, _inheritsLoose2.default)(SingleDatePicker, _FormGroup);

  function SingleDatePicker() {
    return _FormGroup.apply(this, arguments) || this;
  }

  var _proto = SingleDatePicker.prototype;

  _proto.filterGroupProps = function filterGroupProps(props) {
    return _lodash.default.omit(props, ['inputProps', 'hasMomentFormat', 'hasDateFormat', 'locale', 'timeFormat', 'isValidDate']);
  };

  _proto.renderInput = function renderInput(hasError) {
    return _react.default.createElement(_SingleDatePickerInputControl.SingleDatePickerInputControl, (0, _extends2.default)({}, this.getSafeProps(this.props), {
      ref: "control",
      hasFormGroupContainer: true
    }, this.getAriaDescProps(hasError)));
  };

  return SingleDatePicker;
}(_FormGroup2.FormGroup);

exports.SingleDatePicker = SingleDatePicker;
(0, _defineProperty2.default)(SingleDatePicker, "propTypes", Object.assign({}, _FormGroup2.FormGroup.propTypes));
(0, _defineProperty2.default)(SingleDatePicker, "defaultProps", Object.assign({}, _FormGroup2.FormGroup.defaultProps, {
  testAutomationId: 'datePicker'
}));