2023-06-25 12:18:34 +08:00
|
|
|
import React from 'react';
|
2024-04-01 15:49:45 +08:00
|
|
|
|
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;
|
2024-04-01 15:49:45 +08:00
|
|
|
toggleOption?: (option: CheckboxOptionType<T>) => void;
|
2023-06-25 12:18:34 +08:00
|
|
|
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;
|