'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 { FormGroup } from './FormGroup';
import PropTypes from 'prop-types';
import { CheckboxControl } from './CheckboxControl';
export var Checkbox =
/*#__PURE__*/
function (_FormGroup) {
  _inheritsLoose(Checkbox, _FormGroup);

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

  var _proto = Checkbox.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,
        props = _objectWithoutPropertiesLoose(_this$props, ["label", "children"]);

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

  return Checkbox;
}(FormGroup);

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

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