import type { AriaAttributes } from "react"; import React from "react"; import type { EntityListAriaAttributes, EntityListItemProps } from "../EntityList/types"; import type { SlotProps } from "../../shared/slotProps"; import type { NodeID, TreeNode, CheckboxState } from "./types"; export type TreeNodeWithUIState = TreeNode & { isExpanded: boolean; checkedState: CheckboxState; }; type PartialEntityListItemProps = Pick; type NodeClick = (node: Omit) => void; export type EntityTreeSlotProps = SlotProps<{ toggle: { "aria-label-expand"?: string; "aria-label-collapse"?: string; }; }>; export type EntityTreeProps = { /** * TreeNode * @param id - **Unique** identifier for the node * @param label - Node label * @param description - Optional node description * @param children - Node children, TreeNode[] */ data: TreeNode[]; /** Current selected node ids. If provided, the EntityTree becomes a selectable variant */ selectedIds?: NodeID[]; /** Callback function to handle selection change * @param ids - Updated selected node ids */ onSelectionChange?: (ids: NodeID[]) => void; /** * Callback function to handle individual node selection toggle. * Fires synchronously when user clicks to toggle selection, * BEFORE onSelectionChange is called, allowing you to capture * the clicked node and its new state. * @param nodeId - ID of the clicked node * @param isSelected - New selection state AFTER the toggle */ onSelectionToggle?: (nodeId: NodeID, isSelected: boolean) => void; /** Expanded node ids */ expandedIds?: NodeID[]; /** Callback function to handle node expand/collapse * @param ids - Updated expanded node ids */ onToggle?: (ids: NodeID[]) => void; /** Callback function fires only on not selectable Tree */ onNodeClick?: NodeClick; /** Active node id that should be highlighted */ activeId?: NodeID; /** If provided, the filter function is used to filter the tree. */ filterFn?: (node: TreeNode) => boolean; /** Callback function to handle tree change * @param data - Updated tree data */ onTreeChange?: (data: TreeNodeWithUIState[]) => void; /** Show items count or not */ showItemsCount?: boolean; /** Text of button that's in footer and appears once count of expanded nodes more then "chunkSize" */ showMoreButtonLabel: string; /** How many expanded nodes we render at once. The tree slows down a page if the size 1000+ */ chunkSize?: number; /** If provided, the function is used to render an element in the trail of a node. */ renderRightContent?: (props: TreeNode & Parameters[0]) => React.ReactNode; "data-e2e-test-id"?: string; /** @deprecated Use aria-* props directly instead */ ariaAttributes?: EntityListAriaAttributes; /** Props forwarded to internal sub-components */ slotProps?: EntityTreeSlotProps; } & PartialEntityListItemProps & AriaAttributes; export declare const BaseEntityTree: ({ ariaAttributes: deprecatedAriaAttributes, slotProps, data, selectedIds, onSelectionChange, onSelectionToggle, onNodeClick, expandedIds, onToggle, activeId, chunkSize, filterFn, onTreeChange, hideBorder, size, showItemsCount, showMoreButtonLabel, renderRightContent, "data-e2e-test-id": dataE2eTestId, ...ariaAttributes }: EntityTreeProps) => React.ReactElement; export {};