'use strict';

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

exports.__esModule = true;
exports.Autosuggest = 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 _FormGroup2 = require("./FormGroup");

var _AutosuggestControl = require("./AutosuggestControl");

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

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

  var _proto = Autosuggest.prototype;

  _proto.getInputDOMNode = function getInputDOMNode() {
    return this.refs.control.refs.autoSuggest.input;
  };

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

  return Autosuggest;
}(_FormGroup2.FormGroup);

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