@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
79 lines • 4.39 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { type CommonProps, type TooltipObjectProps } from '../../_common/types';
import { Menu } from '../../menu';
type SelectionMode = 'single' | 'multiple';
type RootProps = {
/** The aria-label for the tree. Required for accessibility, unless using ariaLabelledby. Pass null to omit. */
ariaLabel: string | null;
/** The aria-labelledby for the tree. Pass a string of space-separated IDs of elements that label the tree. */
ariaLabelledby?: string;
/** The children of the tree. Should be TreeView.Item components or TreeView.SkeletonItem components only. */
children?: React.ReactNode;
/** Selection mode for the tree. Defaults to "single". */
selectionMode?: SelectionMode;
};
type ItemProps = {
/** Nested TreeView.Item or TreeView.SkeletonItem elements rendered as sub-items in a collapsible group. */
children?: React.ReactNode;
/** The label content displayed in the item row. */
title?: React.ReactNode;
/** Default expansion for uncontrolled items */
defaultExpanded?: boolean;
/** Whether the item has children. Decides if the item should render a chevron for expansion. Needed for lazy loading. */
hasChildren?: boolean;
/** Whether the item is disabled */
isDisabled?: boolean;
/** Whether the item is expanded. Makes the item controlled. */
isExpanded?: boolean;
/** Whether the item is in an indeterminate state. Only meaningful in multi-select mode for parent nodes. */
isIndeterminate?: boolean;
/** Whether the item is loading. Applies aria-busy="true" to the item. */
isLoading?: boolean;
/** Whether the item is selected */
isSelected?: boolean;
/** Leading visual for the item. */
leadingVisual?: React.ReactNode;
/** Trailing content for the item. Shown after the children but before the action menu. */
trailingContent?: React.ReactNode;
/** ReactNode containing Menu.Item elements to render in an action menu. When provided, an action button is rendered. */
actionMenuItems?: React.ReactNode;
/** Props forwarded to the Menu sub-components (anchorRef, onClose). */
actionMenuProps?: React.ComponentProps<typeof Menu>;
/** Content rendered inside the tooltip. When provided, the item is wrapped in a Tooltip. */
tooltipContent?: React.ReactNode;
/** Props forwarded to the Tooltip sub-components (root, trigger, content). */
tooltipProps?: TooltipObjectProps;
/** Callback called when the item is expanded/collapsed. */
onExpandedChange?: (isExpanded: boolean) => void;
/** Callback called when the item is selected/deselected. */
onSelectedChange?: (isSelected: boolean) => void;
};
type SkeletonItemProps = {
/** The number of rows to render. */
rows?: number;
};
declare const TreeView: (({ children, selectionMode, ariaLabel, ariaLabelledby, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", RootProps>) => import("react/jsx-runtime").JSX.Element) & {
Item: ({ actionMenuItems, children, defaultExpanded, hasChildren: hasChildrenProp, isDisabled, isExpanded: isExpandedProp, isIndeterminate, isLoading, isSelected, leadingVisual, title, tooltipContent, tooltipProps, trailingContent, onExpandedChange, onSelectedChange, actionMenuProps, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", ItemProps>) => import("react/jsx-runtime").JSX.Element;
SkeletonItem: ({ rows, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", SkeletonItemProps>) => import("react/jsx-runtime").JSX.Element;
};
export { TreeView };
//# sourceMappingURL=TreeView.d.ts.map