|
|
@ -7,7 +7,7 @@ import RadioGroupContext from './context'; |
|
|
|
import { composeRef } from '../_util/ref'; |
|
|
|
import devWarning from '../_util/devWarning'; |
|
|
|
|
|
|
|
const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (props, ref) => { |
|
|
|
const InternalRadio: React.ForwardRefRenderFunction<HTMLElement, RadioProps> = (props, ref) => { |
|
|
|
const context = React.useContext(RadioGroupContext); |
|
|
|
const { getPrefixCls, direction } = React.useContext(ConfigContext); |
|
|
|
const innerRef = React.useRef<HTMLElement>(); |
|
|
@ -37,8 +37,8 @@ const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (prop |
|
|
|
radioProps.disabled = props.disabled || context.disabled; |
|
|
|
} |
|
|
|
const wrapperClassString = classNames( |
|
|
|
`${prefixCls}-wrapper`, |
|
|
|
{ |
|
|
|
[`${prefixCls}-wrapper`]: true, |
|
|
|
[`${prefixCls}-wrapper-checked`]: radioProps.checked, |
|
|
|
[`${prefixCls}-wrapper-disabled`]: radioProps.disabled, |
|
|
|
[`${prefixCls}-wrapper-rtl`]: direction === 'rtl', |
|
|
@ -54,13 +54,14 @@ const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (prop |
|
|
|
onMouseEnter={props.onMouseEnter} |
|
|
|
onMouseLeave={props.onMouseLeave} |
|
|
|
> |
|
|
|
<RcCheckbox {...radioProps} prefixCls={prefixCls} ref={mergedRef as any} /> |
|
|
|
<RcCheckbox {...radioProps} prefixCls={prefixCls} ref={mergedRef} /> |
|
|
|
{children !== undefined ? <span>{children}</span> : null} |
|
|
|
</label> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
const Radio = React.forwardRef<unknown, RadioProps>(InternalRadio); |
|
|
|
|
|
|
|
Radio.displayName = 'Radio'; |
|
|
|
|
|
|
|
Radio.defaultProps = { |
|
|
|