import { AbstractCheckboxProps, CheckboxProps as AntCheckboxProps } from 'antd/lib/checkbox/Checkbox'; import { ReactNode } from 'react'; export type BaseCheckboxProps = { description?: ReactNode; errorText?: string; hasError?: boolean; withoutPadding?: boolean; }; export type CheckboxTristateChangeEventTarget = CheckboxTristateProps & { checked: boolean | undefined; onChange?: (e: CheckboxTristateChangeEvent) => void; }; export type CheckboxTristateChangeEvent = { target: CheckboxTristateChangeEventTarget; stopPropagation: () => void; preventDefault: () => void; nativeEvent: MouseEvent; }; type OnChangeBaseProps = { tristate?: never | false | undefined; onChange?: AntCheckboxProps['onChange']; }; type OnChangeTristateProps = { tristate: true; onChange?: AbstractCheckboxProps['onChange']; }; export type CheckboxBaseProps = Omit & BaseCheckboxProps & OnChangeBaseProps; export type CheckboxTristateProps = Omit & BaseCheckboxProps & OnChangeTristateProps; export type CheckboxProps = CheckboxBaseProps | CheckboxTristateProps; export {};