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';
|
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;
|
2017-11-21 15:12:03 +08:00
|
|
|
size?: 'large' | 'default' | 'small';
|
|
|
|
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-06-28 14:59:19 +08:00
|
|
|
buttonStyle?: 'outline' | 'solid';
|
2017-11-21 15:12:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RadioGroupState {
|
|
|
|
value: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RadioGroupContext {
|
|
|
|
radioGroup: {
|
|
|
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
|
|
value: any;
|
|
|
|
disabled: boolean;
|
|
|
|
name: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
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-05-07 12:32:26 +08:00
|
|
|
nativeEvent: Event;
|
2018-03-08 21:42:22 +08:00
|
|
|
}
|