ink-tree-select
Version:
Directory tree select component for ink
55 lines (48 loc) • 1.95 kB
TypeScript
import React from 'react';
import { ForegroundColorName } from 'chalk';
type Tree = {
name: string;
fullPath: string;
branches: Tree[];
dir?: boolean;
};
type Color = ForegroundColorName;
type VirtualTreeSelectProps = {
tree: Tree;
options?: VirtualTreeSelectOptions;
onChange?: (activePath: string) => void;
onSelect?: (selectedPath: string) => void;
};
type TreeSelectProps = {
root: string;
options?: TreeSelectOptions;
onChange?: (activePath: string) => void;
onSelect?: (selectedPath: string) => void;
};
type MultiVirtualTreeSelectProps = {
tree: Tree;
options?: VirtualTreeSelectOptions;
onChange?: (activePath: string, selectedPaths: string[]) => void;
onSelect?: (selectedPaths: string[]) => void;
};
type MultiTreeSelectProps = {
root: string;
options?: TreeSelectOptions;
onChange?: (activePath: string, selectedPaths: string[]) => void;
onSelect?: (selectedPaths: string[]) => void;
};
type VirtualTreeSelectOptions = Partial<{
previewColor: Color;
indicatorColor: Color;
}>;
type TreeSelectOptions = Partial<{
ignore: string[];
rootAlias: string;
previewColor: Color;
indicatorColor: Color;
}>;
declare const TreeSelect: ({ root, onChange, onSelect, options }: TreeSelectProps) => React.JSX.Element;
declare const VirtualTreeSelect: ({ tree, onChange, onSelect, options, }: VirtualTreeSelectProps) => React.JSX.Element;
declare const MultiTreeSelect: ({ root, onChange, onSelect, options }: MultiTreeSelectProps) => React.JSX.Element;
declare const MultiVirtualTreeSelect: ({ tree, onChange, onSelect, options, }: MultiVirtualTreeSelectProps) => React.JSX.Element;
export { MultiTreeSelect, type MultiTreeSelectProps, MultiVirtualTreeSelect, type MultiVirtualTreeSelectProps, type Tree, TreeSelect, type TreeSelectOptions, type TreeSelectProps, VirtualTreeSelect, type VirtualTreeSelectOptions, type VirtualTreeSelectProps };