"use strict";

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

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

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

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

var _radio = _interopRequireDefault(require("./radio"));

var _RadioContext = _interopRequireDefault(require("./RadioContext"));

var RadioButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
  var _useContext = (0, _react.useContext)(_RadioContext["default"]),
      radioGroup = _useContext.radioGroup,
      getPrefixCls = _useContext.getPrefixCls;

  var radioProps = (0, _objectSpread2["default"])({}, props);

  if (radioGroup) {
    radioProps.checked = props.value === radioGroup.value;
    radioProps.disabled = props.disabled || radioGroup.disabled;
  }

  return /*#__PURE__*/_react["default"].createElement(_radio["default"], (0, _extends2["default"])({
    prefixCls: getPrefixCls('radio-button')
  }, radioProps, {
    ref: ref
  }));
});
RadioButton.displayName = 'RadioButton';

var _default = /*#__PURE__*/(0, _react.memo)(RadioButton);

exports["default"] = _default;
//# sourceMappingURL=radioButton.js.map
