UNPKG

@vtex/styleguide

Version:

> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))

39 lines (38 loc) 1.45 kB
import PropTypes from 'prop-types'; import { ROOT_KEY } from './constants'; import { useCheckboxesInput, Tree } from './types'; export default function useCheckboxTree<T>({ items, onToggle, nodesKey, checked, comparator, isDisabled, }: useCheckboxesInput<T>): { checkedItems: unknown[]; isChecked: (item: Tree<T>) => any; allChecked: any; allDisabled: boolean; someChecked: boolean; isPartiallyChecked: (item: Tree<T>) => boolean; itemTree: { [x: string]: string | T[]; [ROOT_KEY]: string; }; toggle: (item: Tree<T>) => void; toggleAll: () => void; check: (item: Tree<T>) => void; checkAll: () => void; uncheck: (item: Tree<T>) => void; uncheckAll: () => void; isDisabled: (item: Tree<T>) => boolean; disabledItems: T[]; setChecked: (checked: T[]) => void; lastToggledItem: any; }; export declare const checkboxesPropTypes: { checkboxes: PropTypes.Requireable<PropTypes.InferProps<{ checkedItems: PropTypes.Requireable<PropTypes.InferProps<{ id: PropTypes.Requireable<string>; }>[]>; itemTree: PropTypes.Requireable<PropTypes.InferProps<{ id: PropTypes.Requireable<string>; }>>; toggle: PropTypes.Requireable<(...args: any[]) => any>; isChecked: PropTypes.Requireable<(...args: any[]) => any>; isPartiallyChecked: PropTypes.Requireable<(...args: any[]) => any>; }>>; };