@vtex/styleguide
Version:
> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))
25 lines (24 loc) • 782 B
TypeScript
import { ROOT_KEY } from './constants';
import useCheckboxTree from '.';
export declare type ChildKey<T> = {
[key: string]: Array<T>;
};
export declare type comparatorCurry<T> = (item: T) => (candidate: T) => boolean;
export declare type Checkboxes<T> = ReturnType<typeof useCheckboxTree>;
export declare type Tree<T> = {
[x: string]: string | T[];
[ROOT_KEY]: string;
} | T;
export declare type toggleCallback<T> = {
checkedItems: Array<unknown>;
disabledItems: Array<T>;
item: T | Tree<T>;
};
export declare type useCheckboxesInput<T> = {
items: Array<T>;
onToggle?: (callback: toggleCallback<T>) => void;
nodesKey?: string;
checked?: Array<T>;
comparator?: comparatorCurry<Tree<T>>;
isDisabled?: (item: T | Tree<T>) => boolean;
};