import "./TreeNodeRenderer.css"; import { ComponentPropsWithoutRef, ReactElement, RefAttributes } from "react"; import { TreeNode } from "@itwin/itwinui-react"; import { PresentationHierarchyNode } from "../TreeNode.js"; import { HierarchyLevelDetails, UseTreeResult } from "../UseTree.js"; import { RenderedTreeNode } from "./TreeRenderer.js"; /** @public */ type TreeNodeProps = ComponentPropsWithoutRef; /** @public */ export interface TreeNodeActionDefinition { label: string; icon: ReactElement; onClick: () => void; } /** @public */ interface TreeNodeRendererOwnProps { /** Node that is rendered. */ node: RenderedTreeNode; /** Action to perform when the filter button is clicked for this node. */ onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void; /** Returns an icon for a given node. */ getIcon?: (node: PresentationHierarchyNode) => ReactElement | undefined; /** Returns a label for a given node. */ getLabel?: (node: PresentationHierarchyNode) => ReactElement | undefined; /** Returns sublabel for a given node. */ getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined; /** Action to perform when the node is clicked. */ onNodeClick?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.MouseEvent) => void; /** Action to perform when a key is pressed when the node is hovered on. */ onNodeKeyDown?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.KeyboardEvent) => void; /** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */ reloadTree?: (options: { parentNodeId: string | undefined; state: "reset"; }) => void; /** CSS class name for the action buttons. */ actionButtonsClassName?: string; /** Tree node size. Should match the size passed to `TreeRenderer` component. */ size?: "default" | "small"; /** * Configures filter buttons visibility. * * Options: * - `show-on-hover` - show filter buttons when hovering over node, or the node is in focus. * - `hide` - hide filter buttons, but will show them if the filter is applied. * * Default value: `show-on-hover` */ filterButtonsVisibility?: "show-on-hover" | "hide"; /** * Additional actions that should be rendered for specific hierarchy node. */ getActions?: (node: PresentationHierarchyNode) => TreeNodeActionDefinition[]; } /** @public */ type TreeNodeRendererProps = Pick & Partial> & Omit & TreeNodeRendererOwnProps; /** * A component that renders `RenderedTreeNode` using the `TreeNode` component from `@itwin/itwinui-react`. * * @see `TreeRenderer` * @see https://itwinui.bentley.com/docs/tree * @public */ export declare const TreeNodeRenderer: React.ForwardRefExoticComponent>; export {}; //# sourceMappingURL=TreeNodeRenderer.d.ts.map