"use strict";

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

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

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

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

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

var _context = require("../config-provider/context");

var _context2 = _interopRequireDefault(require("./context"));

// @ts-nocheck
var RadioButton = function RadioButton(props, ref) {
  var radioGroupContext = React.useContext(_context2.default);

  var _React$useContext = React.useContext(_context.ConfigContext),
      getPrefixClassName = _React$useContext.getPrefixClassName;

  React.useEffect(function () {
    if (radioGroupContext === null || radioGroupContext === void 0 ? void 0 : radioGroupContext.updateRadioType) {
      radioGroupContext === null || radioGroupContext === void 0 ? void 0 : radioGroupContext.updateRadioType('button');
    }
  }, []);
  return /*#__PURE__*/React.createElement(_radio.default, Object.assign({}, props, {
    checked: radioGroupContext ? props.value === radioGroupContext.value : props.checked,
    disabled: radioGroupContext ? props.disabled || radioGroupContext.disabled : props.disabled,
    prefixCls: getPrefixClassName('radio-button', props.prefixCls),
    type: "radio",
    ref: ref
  }));
};

var _default = /*#__PURE__*/React.forwardRef(RadioButton);

exports.default = _default;