2017-11-21 15:12:03 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
import { AbstractCheckboxGroupProps } from '../checkbox/Group';
|
2018-03-08 21:42:22 +08:00
|
|
|
import { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
2020-01-03 13:38:16 +08:00
|
|
|
import { SizeType } from '../config-provider/SizeContext';
|
2017-11-21 15:12:03 +08:00
|
|
|
|
2018-07-23 10:01:42 +08:00
|
|
|
export type RadioGroupButtonStyle = 'outline' | 'solid';
|
|
|
|
|
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;
|
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;
|
2018-07-23 10:01:42 +08:00
|
|
|
buttonStyle?: RadioGroupButtonStyle;
|
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;
|
2017-11-21 15:12:03 +08:00
|
|
|
}
|
|
|
|
|
2018-03-08 20:34:40 +08:00
|
|
|
export type RadioProps = AbstractCheckboxProps<RadioChangeEvent>;
|
|
|
|
|
|
|
|
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
|
|
|
}
|