1 | import * as React from 'react';
|
2 | import { CheckboxChangeEvent } from './Checkbox';
|
3 | import { ConfigConsumerProps } from '../config-provider';
|
4 | export declare type CheckboxValueType = string | number | boolean;
|
5 | export interface CheckboxOptionType {
|
6 | label: React.ReactNode;
|
7 | value: CheckboxValueType;
|
8 | style?: React.CSSProperties;
|
9 | disabled?: boolean;
|
10 | onChange?: (e: CheckboxChangeEvent) => void;
|
11 | }
|
12 | export interface AbstractCheckboxGroupProps {
|
13 | prefixCls?: string;
|
14 | className?: string;
|
15 | options?: Array<CheckboxOptionType | string>;
|
16 | disabled?: boolean;
|
17 | style?: React.CSSProperties;
|
18 | }
|
19 | export interface CheckboxGroupProps extends AbstractCheckboxGroupProps {
|
20 | name?: string;
|
21 | defaultValue?: Array<CheckboxValueType>;
|
22 | value?: Array<CheckboxValueType>;
|
23 | onChange?: (checkedValue: Array<CheckboxValueType>) => void;
|
24 | }
|
25 | export interface CheckboxGroupState {
|
26 | value: CheckboxValueType[];
|
27 | registeredValues: CheckboxValueType[];
|
28 | }
|
29 | export interface CheckboxGroupContext {
|
30 | toggleOption?: (option: CheckboxOptionType) => void;
|
31 | value?: any;
|
32 | disabled?: boolean;
|
33 | }
|
34 | export declare const GroupContext: React.Context<CheckboxGroupContext | null>;
|
35 | declare class CheckboxGroup extends React.PureComponent<CheckboxGroupProps, CheckboxGroupState> {
|
36 | static defaultProps: {
|
37 | options: never[];
|
38 | };
|
39 | static getDerivedStateFromProps(nextProps: CheckboxGroupProps): {
|
40 | value: CheckboxValueType[];
|
41 | } | null;
|
42 | constructor(props: CheckboxGroupProps);
|
43 | getOptions(): CheckboxOptionType[];
|
44 | cancelValue: (value: string) => void;
|
45 | registerValue: (value: string) => void;
|
46 | toggleOption: (option: CheckboxOptionType) => void;
|
47 | renderGroup: ({ getPrefixCls, direction }: ConfigConsumerProps) => JSX.Element;
|
48 | render(): JSX.Element;
|
49 | }
|
50 | export default CheckboxGroup;
|