'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 { ToggleControl } from './ToggleControl';
export var Toggle =
/*#__PURE__*/
function (_FormGroup) {
  _inheritsLoose(Toggle, _FormGroup);

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

  var _proto = Toggle.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(ToggleControl, _extends({}, this.getSafeProps(props), {
      ref: "control"
    }, ariaDescProps, {
      hasFormGroupContainer: true
    }), children || label);
  };

  return Toggle;
}(FormGroup);

_defineProperty(Toggle, "propTypes", Object.assign({}, FormGroup.propTypes));

_defineProperty(Toggle, "defaultProps", Object.assign({}, FormGroup.defaultProps, {
  testAutomationId: 'toggle'
}));