'use strict';

import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import PropTypes from 'prop-types';
import { FormGroup } from './FormGroup';
import { RadioControl } from './RadioControl';
export var Radio =
/*#__PURE__*/
function (_FormGroup) {
  _inheritsLoose(Radio, _FormGroup);

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

  var _proto = Radio.prototype;

  _proto.controlLabelFallback = function controlLabelFallback() {
    return false;
  };

  _proto.renderInput = function renderInput(hasError) {
    var _this$props = this.props,
        label = _this$props.label,
        children = _this$props.children,
        hiddenLabel = _this$props.hiddenLabel,
        removeName = _this$props.removeName,
        props = _objectWithoutPropertiesLoose(_this$props, ["label", "children", "hiddenLabel", "removeName"]);

    var ariaDescProps = this.getAriaDescProps(hasError);
    return React.createElement(RadioControl, _extends({}, this.getSafeProps(props), {
      ref: "control",
      hiddenLabel: hiddenLabel,
      removeName: removeName
    }, ariaDescProps, {
      hasFormGroupContainer: true
    }), children || label);
  };

  return Radio;
}(FormGroup);

_defineProperty(Radio, "propTypes", Object.assign({}, FormGroup.propTypes, {
  hiddenLabel: PropTypes.bool,
  removeName: PropTypes.bool
}));

_defineProperty(Radio, "defaultProps", Object.assign({}, FormGroup.defaultProps, {
  testAutomationId: 'radio',
  hiddenLabel: false,
  removeName: false
}));