@flanksource/clicky-ui
Version:
Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.
43 lines • 1.84 kB
TypeScript
import { ReactNode } from 'react';
export type TreeRowContext<T> = {
node: T;
depth: number;
open: boolean;
selected: boolean;
hasChildren: boolean;
toggle: () => void;
};
export type TreeNodeProps<T> = {
node: T;
depth?: number;
expandAll?: boolean | null;
forcedOpenKeys?: Set<string | number> | null;
selected?: T | null;
defaultOpen?: (node: T, depth: number) => boolean;
getChildren: (node: T) => T[] | undefined;
getKey: (node: T) => string | number;
onSelect?: (node: T) => void;
renderRow: (ctx: TreeRowContext<T>) => ReactNode;
rowClass?: (node: T, selected: boolean) => string;
indentPx?: number;
basePaddingPx?: number;
/**
* Marks a node as a **secondary child** of its parent. Secondary
* children keep the full tree structure (they render, they can be
* opened manually) but opt out of the bulk behaviours a caller
* typically wants when they click the toolbar:
*
* - Tree-wide filter: their text is skipped during match detection
* so typing in the search box never surfaces a row because one
* of its secondary children happened to match.
* - Expand all: secondary nodes stay at their default-open state
* instead of being forced open, preventing 28k field rows from
* flooding the viewport when an operator hits the button on a
* schema with hundreds of tables.
*
* Default: every node is primary (returns false).
*/
isSecondary?: (node: T) => boolean;
};
export declare function TreeNode<T>({ node, depth, expandAll, forcedOpenKeys, selected, defaultOpen, getChildren, getKey, onSelect, renderRow, rowClass, indentPx, basePaddingPx, isSecondary, }: TreeNodeProps<T>): import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=TreeNode.d.ts.map