// @ts-nocheck
import * as React from 'react';
import Radio from './radio';
import { ConfigContext } from '../config-provider/context';
import RadioGroupContext from './context';

var RadioButton = function RadioButton(props, ref) {
  var radioGroupContext = React.useContext(RadioGroupContext);

  var _React$useContext = React.useContext(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, 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
  }));
};

export default /*#__PURE__*/React.forwardRef(RadioButton);