import { Optional } from '@synnaxlabs/x';
import { FC, ReactElement } from 'react';
import { Haul } from '../haul';
import { List } from '../list';
import { UseSelectMultipleProps } from '../list/useSelect';
import { state } from '../state';
import { FlattenedNode, Node } from './core';
import { RenderProp } from '../util/renderProp';
export declare const HAUL_TYPE = "tree-item";
export interface HandleExpandProps {
    current: string[];
    action: "expand" | "contract";
    clicked: string;
}
export interface UseProps {
    onExpand?: (props: HandleExpandProps) => void;
    selected?: string[];
    onSelectedChange?: state.Set<string[]>;
    initialExpanded?: string[];
    nodes: Node[];
    sort?: boolean;
}
export interface UseReturn {
    selected: string[];
    expanded: string[];
    onSelect: UseSelectMultipleProps<string, FlattenedNode>["onChange"];
    expand: (key: string) => void;
    contract: (key: string) => void;
    clearExpanded: () => void;
    nodes: FlattenedNode[];
}
export declare const use: (props: UseProps) => UseReturn;
export interface ItemProps extends List.ItemProps<string, FlattenedNode> {
    key?: string;
    onDrop?: (key: string, props: Haul.OnDropProps) => Haul.Item[];
    onSuccessfulDrop?: (key: string, props: Haul.OnSuccessfulDropProps) => void;
    onRename?: (key: string, name: string) => void;
    onDoubleClick?: (key: string, e: React.MouseEvent) => void;
    loading: boolean;
    useMargin?: boolean;
}
type TreePropsInheritedFromItem = Pick<ItemProps, "onDrop" | "onRename" | "onSuccessfulDrop" | "onDoubleClick" | "useMargin">;
type TreePropsInheritedFromList = Omit<List.VirtualCoreProps<string, FlattenedNode>, "onDrop" | "onSelect" | "children" | "onDoubleClick" | "itemHeight"> & {
    itemHeight?: number;
};
export interface TreeProps extends TreePropsInheritedFromItem, TreePropsInheritedFromList, Optional<UseReturn, "selected" | "expand" | "contract">, Pick<List.ListProps, "emptyContent"> {
    nodes: FlattenedNode[];
    children?: RenderProp<ItemProps>;
    virtual?: boolean;
    showRules?: boolean;
    loading?: string | null | false;
}
export type Item = FC<ItemProps>;
export declare const DefaultItem: import('react').MemoExoticComponent<({ entry, selected, onSelect, onDrop, onRename, onSuccessfulDrop, onDoubleClick, loading, useMargin, translate, }: ItemProps) => ReactElement>;
export declare const Tree: ({ nodes, selected, onSelect, onDrop, onRename, onSuccessfulDrop, onDoubleClick, className, children, itemHeight, useMargin, showRules, virtual, clearExpanded: ___, expand: __, contract: _, emptyContent, loading, ...props }: TreeProps) => ReactElement;
export declare const startRenaming: (key: string, onChange?: (value: string, renamed: boolean) => void) => void;
export declare const asyncRename: (key: string) => Promise<[string, boolean]>;
export {};
//# sourceMappingURL=Tree.d.ts.map