UNPKG

1.55 kBTypeScriptView Raw
1import type * as React from 'react';
2import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
3import type { AbstractCheckboxGroupProps } from '../checkbox/Group';
4import type { DisabledType } from '../config-provider/DisabledContext';
5import type { SizeType } from '../config-provider/SizeContext';
6export type RadioGroupButtonStyle = 'outline' | 'solid';
7export type RadioGroupOptionType = 'default' | 'button';
8export interface RadioGroupProps extends AbstractCheckboxGroupProps {
9 defaultValue?: any;
10 value?: any;
11 onChange?: (e: RadioChangeEvent) => void;
12 size?: SizeType;
13 disabled?: DisabledType;
14 onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
15 onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
16 name?: string;
17 children?: React.ReactNode;
18 id?: string;
19 optionType?: RadioGroupOptionType;
20 buttonStyle?: RadioGroupButtonStyle;
21 onFocus?: React.FocusEventHandler<HTMLDivElement>;
22 onBlur?: React.FocusEventHandler<HTMLDivElement>;
23}
24export interface RadioGroupContextProps {
25 onChange: (e: RadioChangeEvent) => void;
26 value: any;
27 disabled?: boolean;
28 name?: string;
29}
30export interface RadioProps extends AbstractCheckboxProps<RadioChangeEvent> {
31}
32export interface RadioChangeEventTarget extends RadioProps {
33 checked: boolean;
34}
35export interface RadioChangeEvent {
36 target: RadioChangeEventTarget;
37 stopPropagation: () => void;
38 preventDefault: () => void;
39 nativeEvent: MouseEvent;
40}
41export type RadioOptionTypeContextProps = RadioGroupOptionType;