2023-06-25 12:18:34 +08:00
|
|
|
import React from 'react';
|
2023-12-22 17:07:34 +08:00
|
|
|
import type { CheckboxOptionType, CheckboxValueType } from './Group';
|
2023-06-25 12:18:34 +08:00
|
|
|
|
2023-12-22 17:07:34 +08:00
|
|
|
export interface CheckboxGroupContext<T extends CheckboxValueType = CheckboxValueType> {
|
2023-06-25 12:18:34 +08:00
|
|
|
name?: string;
|
|
|
|
toggleOption?: (option: CheckboxOptionType) => void;
|
|
|
|
value?: any;
|
|
|
|
disabled?: boolean;
|
2023-12-22 17:07:34 +08:00
|
|
|
registerValue: (val: T) => void;
|
|
|
|
cancelValue: (val: T) => void;
|
2023-06-25 12:18:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const GroupContext = React.createContext<CheckboxGroupContext | null>(null);
|
|
|
|
|
|
|
|
export default GroupContext;
|