@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
53 lines • 3.72 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 UniqueIdentifier } from '@dnd-kit/core';
import type React from 'react';
import { type HtmlAttributes } from '../_common/types';
import { type FlattenedTreeItem, type ItemChangedReason, type TreeItem, type TreeItemComponent } from './tree-view-types';
export interface TreeViewProps<T extends Record<string, unknown>, E extends HTMLElement> extends React.HTMLAttributes<HTMLOListElement> {
/** The items to be displayed in the tree view */
items: TreeItem<T>[];
/** A function that is called when the items in the tree view change */
onItemsChanged: (newItems: TreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void;
/** The component to use for the tree items, if not provided the default component will be used */
TreeItemComponent?: TreeItemComponent<T, E>;
/** HTML attributes */
htmlAttributes?: HtmlAttributes<'ol'>;
}
export declare const TreeView: (<T extends Record<string, unknown>, E extends HTMLElement>({ items, TreeItemComponent, onItemsChanged, htmlAttributes, }: TreeViewProps<T, E>) => import("react/jsx-runtime").JSX.Element) & {
SortableTreeViewItem: <T extends Record<string, unknown>, E extends HTMLElement>({ id, depth, isLast, TreeItemComponent, parent, shouldDisableSorting, sortableProps, keepGhostInPlace, item, onCollapse, trails, onItemsChanged, items, tabIndex, onFocus, ...restProps }: import("./TreeViewItem").TreeItemProps<T> & {
id: UniqueIdentifier;
TreeItemComponent: TreeItemComponent<T, E>;
shouldDisableSorting?: boolean;
sortableProps?: Omit<import("@dnd-kit/sortable").UseSortableArguments, "id">;
keepGhostInPlace?: boolean;
trails: ("none" | "straight" | "straight-curved" | "curved")[];
onItemsChanged: (newItems: FlattenedTreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void;
items: FlattenedTreeItem<T>[];
tabIndex?: number;
onFocus?: () => void;
}) => import("react/jsx-runtime").JSX.Element;
TreeItemWrapper: <T extends Record<string, unknown>>({ depth, shouldDisableInteraction, shouldDisableSorting, isGhost, isIndicator, onCollapse, item, setNodeRef, setActivatorNodeRef, dragHandleProps, style, className, trails, children, indentationWidth, tabIndex, onFocus, ref, ...restProps }: React.PropsWithChildren<import("./tree-view-types").TreeItemComponentProps<T>>) => import("react/jsx-runtime").JSX.Element;
TreeViewTextItem: <T extends import("./tree-view-types").TextItemData>({ depth, shouldDisableInteraction, shouldDisableSorting, isGhost, indentationWidth, isIndicator, isCollapsed, onCollapse, item, parent, isOver, isOverParent, setNodeRef, setActivatorNodeRef, dragHandleProps, style, trails, onItemsChanged, items, tabIndex, ref, ...restProps }: import("./tree-view-types").TreeItemComponentProps<T> & {
ref?: React.Ref<HTMLElement>;
}) => import("react/jsx-runtime").JSX.Element;
};
//# sourceMappingURL=TreeView.d.ts.map