2022-05-07 14:31:54 +08:00
|
|
|
import type * as React from 'react';
|
|
|
|
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
2022-06-22 14:57:09 +08:00
|
|
|
import type { AbstractCheckboxGroupProps } from '../checkbox/Group';
|
2022-05-08 17:01:54 +08:00
|
|
|
import type { DisabledType } from '../config-provider/DisabledContext';
|
2022-05-07 14:31:54 +08:00
|
|
|
import type { SizeType } from '../config-provider/SizeContext';
|
2017-11-21 15:12:03 +08:00
|
|
|
|
2023-09-12 11:40:53 +08:00
|
|
|
export type { CheckboxRef as RadioRef } from 'rc-checkbox';
|
2018-07-23 10:01:42 +08:00
|
|
|
export type RadioGroupButtonStyle = 'outline' | 'solid';
|
2020-06-11 13:21:54 +08:00
|
|
|
export type RadioGroupOptionType = 'default' | 'button';
|
2018-07-23 10:01:42 +08:00
|
|
|
|
2017-11-21 15:12:03 +08:00
|
|
|
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
|
|
|
defaultValue?: any;
|
|
|
|
value?: any;
|
2018-03-08 20:34:40 +08:00
|
|
|
onChange?: (e: RadioChangeEvent) => void;
|
2020-01-03 13:38:16 +08:00
|
|
|
size?: SizeType;
|
2022-04-29 20:48:10 +08:00
|
|
|
disabled?: DisabledType;
|
2017-11-21 15:12:03 +08:00
|
|
|
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
|
|
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
|
|
name?: string;
|
2017-11-24 15:36:59 +08:00
|
|
|
children?: React.ReactNode;
|
2017-12-01 11:50:07 +08:00
|
|
|
id?: string;
|
2020-06-11 13:21:54 +08:00
|
|
|
optionType?: RadioGroupOptionType;
|
2018-07-23 10:01:42 +08:00
|
|
|
buttonStyle?: RadioGroupButtonStyle;
|
2022-06-14 14:00:33 +08:00
|
|
|
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
|
|
|
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
2017-11-21 15:12:03 +08:00
|
|
|
}
|
|
|
|
|
2020-02-26 16:09:22 +08:00
|
|
|
export interface RadioGroupContextProps {
|
|
|
|
onChange: (e: RadioChangeEvent) => void;
|
|
|
|
value: any;
|
|
|
|
disabled?: boolean;
|
|
|
|
name?: string;
|
2022-04-08 15:23:52 +08:00
|
|
|
/**
|
|
|
|
* Control the appearance for Radio to display as button or not
|
|
|
|
*
|
|
|
|
* @default 'default'
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
optionType?: RadioGroupOptionType;
|
2017-11-21 15:12:03 +08:00
|
|
|
}
|
|
|
|
|
2022-04-14 19:14:54 +08:00
|
|
|
export interface RadioProps extends AbstractCheckboxProps<RadioChangeEvent> {
|
|
|
|
/**
|
|
|
|
* Control the appearance for Radio to display as button or not
|
|
|
|
*
|
|
|
|
* @default 'default'
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
optionType?: RadioGroupOptionType;
|
|
|
|
}
|
2018-03-08 20:34:40 +08:00
|
|
|
|
|
|
|
export interface RadioChangeEventTarget extends RadioProps {
|
|
|
|
checked: boolean;
|
|
|
|
}
|
|
|
|
|
2018-03-08 21:42:22 +08:00
|
|
|
export interface RadioChangeEvent {
|
|
|
|
target: RadioChangeEventTarget;
|
|
|
|
stopPropagation: () => void;
|
|
|
|
preventDefault: () => void;
|
2018-07-24 14:49:23 +08:00
|
|
|
nativeEvent: MouseEvent;
|
2018-03-08 21:42:22 +08:00
|
|
|
}
|
2022-04-08 15:23:52 +08:00
|
|
|
|
|
|
|
export type RadioOptionTypeContextProps = RadioGroupOptionType;
|