UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

53 lines (52 loc) • 1.9 kB
import React from 'react'; import type { HTMLAriaDataAttributes } from '../_util/aria-data-attrs'; import type { GenerateSemantic } from '../_util/hooks/useMergeSemantic/semanticType'; import type { CheckboxChangeEvent } from './Checkbox'; import GroupContext from './GroupContext'; export interface CheckboxOptionType<T = any> { label: React.ReactNode; value: T; style?: React.CSSProperties; className?: string; disabled?: boolean; title?: string; id?: string; onChange?: (e: CheckboxChangeEvent) => void; required?: boolean; } export interface AbstractCheckboxGroupProps<T = any> extends HTMLAriaDataAttributes { prefixCls?: string; className?: string; rootClassName?: string; options?: (CheckboxOptionType<T> | string | number)[]; disabled?: boolean; style?: React.CSSProperties; } export type CheckboxGroupSemanticType = { classNames?: { root?: string; item?: string; itemIcon?: string; itemLabel?: string; }; styles?: { root?: React.CSSProperties; item?: React.CSSProperties; itemIcon?: React.CSSProperties; itemLabel?: React.CSSProperties; }; }; export type CheckboxGroupSemanticAllType<T = any> = GenerateSemantic<CheckboxGroupSemanticType, CheckboxGroupProps<T>>; export interface CheckboxGroupProps<T = any> extends AbstractCheckboxGroupProps<T> { name?: string; defaultValue?: T[]; value?: T[]; onChange?: (checkedValue: T[]) => void; children?: React.ReactNode; classNames?: CheckboxGroupSemanticAllType<T>['classNamesAndFn']; styles?: CheckboxGroupSemanticAllType<T>['stylesAndFn']; } export type { CheckboxGroupContext } from './GroupContext'; export { GroupContext }; declare const _default: <T = any>(props: CheckboxGroupProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement; export default _default;