UNPKG

@ray-js/components

Version:

Ray basic components

42 lines (41 loc) 1.25 kB
import { BaseProps } from '../types'; import { CheckboxProps } from '../Checkbox/props'; import { GenericEvent } from '@ray-js/adapter'; export type CheckboxGroupOption = CheckboxProps & { label: string; }; export interface ICheckboxGroupWithOptions { options: CheckboxGroupOption[]; children?: undefined; } export interface ICheckboxGroupWithChildren { options?: undefined; children: React.ReactNode | React.ReactNode[] | string; } export type CheckboxGroupProps = (ICheckboxGroupWithOptions & BaseCheckboxGroupProps) | (ICheckboxGroupWithChildren & BaseCheckboxGroupProps); export interface BaseCheckboxGroupProps extends Omit<BaseProps, 'children'> { /** * @description.en name * @description.zh 姓名 * @default undefined */ name?: string; /** * @description.en disabled * @description.zh 是否禁用 * @default null */ disabled?: boolean; /** * @description.en Triggered when the selected item is changed * @description.zh 选中项发生改变时触发 change 事件 * @default null */ onChange?: (event: GenericEvent<{ value: any; } & { type: string; value: string[]; origin: any; }>) => void; }