"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

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

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

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _forms = require("@rebass/forms");

var _Label = _interopRequireDefault(require("../Label"));

var Radio = (0, _react.forwardRef)(function (_ref, ref) {
  var label = _ref.label,
      disabled = _ref.disabled,
      readOnly = _ref.readOnly,
      name = _ref.name,
      value = _ref.value,
      onChange = _ref.onChange,
      checked = _ref.checked,
      rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["label", "disabled", "readOnly", "name", "value", "onChange", "checked"]);
  return (
    /*#__PURE__*/
    _react.default.createElement(_Label.default, (0, _extends2.default)({
      ref: ref,
      color: "inherit",
      alignItems: "center"
    }, rest),
    /*#__PURE__*/
    _react.default.createElement(_forms.Radio, {
      name: name,
      value: value,
      disabled: disabled,
      checked: checked,
      readOnly: readOnly,
      onChange: onChange
    }), label)
  );
});
Radio.displayName = 'Radio';
Radio.propTypes = {
  checked: _propTypes.default.bool,

  /** Disabled state */
  disabled: _propTypes.default.bool,

  /** Label for Radio  */
  label: _propTypes.default.node,
  name: _propTypes.default.string,

  /** Called when `onChange` event is triggered. */
  onChange: _propTypes.default.func,

  /** Read-only state */
  readOnly: _propTypes.default.bool,

  /** Current value of the radio. */
  value: _propTypes.default.any
};
var _default = Radio;
exports.default = _default;