@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
26 lines (25 loc) • 1.26 kB
TypeScript
import type { CascaderOption } from './Cascader';
export interface UseCascaderInput {
data: CascaderOption[];
value: string[] | null | undefined;
defaultValue: string[] | null | undefined;
onChange: ((value: string[] | null, options: CascaderOption[]) => void) | undefined;
changeOnSelect: boolean | undefined;
allowDeselect: boolean | undefined;
expandTrigger: 'click' | 'hover' | undefined;
onLeafSelect?: () => void;
}
export declare function useCascader({ data, value, defaultValue, onChange, changeOnSelect, allowDeselect, expandTrigger, onLeafSelect, }: UseCascaderInput): {
value: string[] | null;
setValue: (value: string[] | null, ...payload: any[]) => void;
selectPath: (path: string[]) => void;
activePath: string[];
setActivePath: import("react").Dispatch<import("react").SetStateAction<string[]>>;
resetActivePath: () => void;
keyboardNav: boolean;
setKeyboardNav: import("react").Dispatch<import("react").SetStateAction<boolean>>;
handleOptionClick: (level: number, option: CascaderOption) => void;
handleOptionMouseEnter: (level: number, option: CascaderOption) => void;
handleColumnsKeyDown: (event: React.KeyboardEvent) => boolean;
pathOptions: CascaderOption[];
};