import React from "react"; import Foundation, { HandledProps } from "@microsoft/fast-components-foundation-react"; import { TreeViewItemClassNameContract } from "@microsoft/fast-components-class-name-contracts-base"; import { TreeViewContextValue } from "../tree-view/tree-view"; import { TreeViewItemHandledProps, TreeViewItemProps, TreeViewItemUnhandledProps } from "./tree-view-item.props"; export interface TreeViewItemState { /** * Track whether the item is focusable */ focusable: boolean; /** * The expanded state of the tree */ expanded: boolean; } declare class TreeViewItem extends Foundation { static displayName: string; static defaultProps: Partial; static contextType: React.Context; protected handledProps: HandledProps; private rootElement; private expandCollapseButton; constructor(props: TreeViewItemProps); componentDidMount(): void; componentDidUpdate(prevProps: TreeViewItemProps): void; componentWillUnmount(): void; render(): React.ReactNode; protected generateClassNames(): string; private renderItem; private adjustNestedTreeItemCount; /** * Handles the focus event of the root element */ private handleFocus; /** * Handles the blur event on the root element */ private handleBlur; /** * handles the keydown event of the tree view item */ private handleKeyDown; /** * Determines if the item has sub-items and should be collapse/expandable */ private hasChildNodes; /** * Determines if the item has sub-items which are selected */ private hasSelectedChild; /** * Handles when the left arrow is pressed */ private handleArrowLeft; /** * Handles when the space bar is pressed */ private handleSpaceBar; /** * Handles when the right arrow is pressed */ private handleArrowRight; private focusNextNode; /** * Returns an array of all tree item nodes that are * currently visible (not hidden under a collapsed node) */ private getVisibleNodes; /** * Get the root element of the tree. This will always be the * closest element with [role='tree'] */ private getTreeRoot; private wrapChildOnSelected; private wrapChildOnExpandedChange; private renderChildNodes; private renderExpandCollapseButton; /** * Sets the expanded state of the component if necessary and * notifies listeners of the state change. */ private setExpanded; /** * Click handler for expand/collapse button */ private handleExpandCollapseButtonClick; /** * Call the onSelected callback if it exists */ private handleSelected; /** * Handles the click event of the tree view item, except for the expand/collapse button */ private handleContentContainerClick; } export default TreeViewItem; export * from "./tree-view-item.props"; export { TreeViewItemClassNameContract };