'use strict';

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

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

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

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

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 _SelectControl = require("./SelectControl");

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

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

  var _proto = Select.prototype;

  _proto.renderInput = function renderInput(hasError) {
    var _this$props = this.props,
        children = _this$props.children,
        readOnly = _this$props.readOnly,
        props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["children", "readOnly"]);
    var readOnlyProp = readOnly === undefined ? {} : {
      readOnly: readOnly
    };
    var ariaDescProps = this.getAriaDescProps(hasError);
    return _react.default.createElement(_SelectControl.SelectControl, (0, _extends2.default)({}, this.getSafeProps(props), {
      ref: "control"
    }, ariaDescProps, {
      hasFormGroupContainer: true
    }, readOnlyProp), children);
  };

  return Select;
}(_FormGroup2.FormGroup);

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