UNPKG

1.31 kBTypeScriptView Raw
1import * as React from 'react';
2import type { CheckboxChangeEvent } from './Checkbox';
3import GroupContext from './GroupContext';
4export type CheckboxValueType = string | number | boolean;
5export interface CheckboxOptionType<T extends CheckboxValueType = CheckboxValueType> {
6 label: React.ReactNode;
7 value: T;
8 style?: React.CSSProperties;
9 disabled?: boolean;
10 title?: string;
11 id?: string;
12 onChange?: (e: CheckboxChangeEvent) => void;
13 required?: boolean;
14}
15export interface AbstractCheckboxGroupProps<T extends CheckboxValueType = CheckboxValueType> {
16 prefixCls?: string;
17 className?: string;
18 rootClassName?: string;
19 options?: (CheckboxOptionType<T> | string | number)[];
20 disabled?: boolean;
21 style?: React.CSSProperties;
22}
23export interface CheckboxGroupProps<T extends CheckboxValueType = CheckboxValueType> extends AbstractCheckboxGroupProps<T> {
24 name?: string;
25 defaultValue?: T[];
26 value?: T[];
27 onChange?: (checkedValue: T[]) => void;
28 children?: React.ReactNode;
29}
30export type { CheckboxGroupContext } from './GroupContext';
31export { GroupContext };
32declare const _default: <T extends CheckboxValueType = CheckboxValueType>(props: CheckboxGroupProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement;
33export default _default;