import { Component, ReactNode, ChangeEvent, HTMLAttributes } from 'react';
import { GenericCheckboxProps } from './generic-checkbox';
export type CheckboxOptionValue = string | number | boolean;
export interface GenericCheckboxOption {
value: CheckboxOptionValue;
label: ReactNode;
disabled?: boolean;
}
/**
* @deprecated use `CheckboxOptionValue[]` instead
*/
export type GenericCheckboxGroupValue = CheckboxOptionValue[];
export type GenericCheckboxGroupOptions = Array;
type GenericCheckboxGroupCheckHandler = (option: GenericCheckboxOption, value: CheckboxOptionValue[], currentValue: CheckboxOptionValue[]) => void;
type PropsFromDivAttributes = Pick, 'onFocus' | 'onBlur'>;
export interface GenericCheckboxGroupProps extends PropsFromDivAttributes {
/**
* 自定义 class
*/
className?: string;
/**
* 自定义 class
* default: normal
*/
type?: GenericCheckboxProps['type'];
/**
* 自定义 class
* use config context `baseSize` as default
*/
size?: GenericCheckboxProps['size'];
/**
* 选择模式
*/
mode?: 'checkbox' | 'radio';
/**
* 控制选中值
*/
value?: CheckboxOptionValue[];
/**
* 默认选中值
*/
defaultValue?: CheckboxOptionValue[];
/**
* 是否整组禁用
*/
disabled?: boolean;
/**
* 选项布局
*/
layout?: 'horizontal' | 'vertical';
/**
* 选项列表
*/
options?: GenericCheckboxGroupOptions;
/**
* 点选 option 的回调
*/
onCheck?: GenericCheckboxGroupCheckHandler;
/**
* 反选 option 的回调
*/
onUncheck?: GenericCheckboxGroupCheckHandler;
/**
* 值变化回调
*/
onChange?: ((nextValue: string[]) => void) | ((nextValue: number[]) => void);
}
interface GenericCheckboxGroupState {
value: CheckboxOptionValue[];
}
/**
* @docgen-skip
*/
export declare class GenericCheckboxGroup extends Component {
static displayName: string;
static defaultProps: {
className: string;
type: string;
mode: string;
layout: string;
defaultValue: never[];
options: never[];
};
static getDerivedStateFromProps(nextProps: GenericCheckboxGroupProps): Partial | null;
state: GenericCheckboxGroupState;
constructor(props: GenericCheckboxGroupProps);
get className(): string;
get normalizedOptions(): GenericCheckboxOption[];
get value(): CheckboxOptionValue[];
get isRadio(): boolean;
check(option: GenericCheckboxOption): CheckboxOptionValue[];
uncheck(option: GenericCheckboxOption): CheckboxOptionValue[];
checkboxChangeHandler: (e: ChangeEvent, checked: boolean, option: GenericCheckboxOption) => void;
renderOptions(): import("react/jsx-runtime").JSX.Element[] | null;
render(): import("react/jsx-runtime").JSX.Element;
}
export {};