import * as React from 'react'; import { TreeViewItemId, TreeViewCancellableEventHandler } from "../models/index.js"; import { TreeViewPublicAPI, TreeViewAnyStore } from "../internals/models/index.js"; export interface UseTreeItemParameters { /** * The id attribute of the item. If not provided, it will be generated. */ id?: string; /** * If `true`, the item is disabled. * @default false */ disabled?: boolean; /** * If `true`, the item cannot be selected. * @default false */ disableSelection?: boolean; /** * The id of the item. * Must be unique. */ itemId: TreeViewItemId; /** * The label of the item. */ label?: React.ReactNode; rootRef?: React.Ref; /** * The content of the component. */ children?: React.ReactNode; } export interface UseTreeItemContextProviderProps { itemId: string; id: string | undefined; } export interface UseTreeItemRootSlotPropsFromUseTreeItem { role: 'treeitem'; tabIndex: 0 | -1; id: string; 'aria-expanded': React.AriaAttributes['aria-expanded']; 'aria-disabled': React.AriaAttributes['aria-disabled']; onFocus: TreeViewCancellableEventHandler>; onBlur: TreeViewCancellableEventHandler>; onKeyDown: TreeViewCancellableEventHandler>; ref: React.RefCallback; style: React.CSSProperties; } export interface UseTreeItemRootSlotOwnProps extends UseTreeItemRootSlotPropsFromUseTreeItem {} export type UseTreeItemRootSlotProps = ExternalProps & UseTreeItemRootSlotOwnProps; export interface UseTreeItemContentSlotPropsFromUseTreeItem { onClick: TreeViewCancellableEventHandler; onMouseDown: TreeViewCancellableEventHandler; ref: React.RefCallback | null; 'data-expanded'?: ''; 'data-selected'?: ''; 'data-focused'?: ''; 'data-disabled'?: ''; 'data-editing'?: ''; 'data-editable'?: ''; } export interface UseTreeItemContentSlotOwnProps extends UseTreeItemContentSlotPropsFromUseTreeItem {} export type UseTreeItemContentSlotProps = ExternalProps & UseTreeItemContentSlotOwnProps; export interface UseTreeItemIconContainerSlotOwnProps { onClick: TreeViewCancellableEventHandler; } export type UseTreeItemIconContainerSlotProps = ExternalProps & UseTreeItemIconContainerSlotOwnProps; export interface UseTreeItemLabelSlotOwnProps { children: React.ReactNode; onDoubleClick: TreeViewCancellableEventHandler; } export type UseTreeItemLabelSlotProps = ExternalProps & UseTreeItemLabelSlotOwnProps; export interface UseTreeItemLabelInputSlotOwnProps {} export type UseTreeItemLabelInputSlotProps = ExternalProps & UseTreeItemLabelInputSlotOwnProps; export interface UseTreeItemCheckboxSlotOwnProps { ref: React.RefObject; 'aria-hidden': true; } export type UseTreeItemCheckboxSlotProps = ExternalProps & UseTreeItemCheckboxSlotOwnProps; export type UseTreeItemErrorContainerSlotProps = ExternalProps & {}; export type UseTreeItemLoadingContainerSlotProps = ExternalProps & { size: string; thickness: number; }; export interface UseTreeItemGroupTransitionSlotOwnProps { unmountOnExit: boolean; in: boolean; component: 'ul'; role: 'group'; children: React.ReactNode; } export type UseTreeItemGroupTransitionSlotProps = ExternalProps & UseTreeItemGroupTransitionSlotOwnProps; export interface UseTreeItemDragAndDropOverlaySlotOwnProps {} export type UseTreeItemDragAndDropOverlaySlotProps = ExternalProps & UseTreeItemDragAndDropOverlaySlotOwnProps; export interface UseTreeItemStatus { expandable: boolean; expanded: boolean; focused: boolean; selected: boolean; disabled: boolean; editing: boolean; editable: boolean; loading: boolean; error: boolean; } export interface UseTreeItemReturnValue { /** * Resolver for the context provider's props. * @returns {UseTreeItemContextProviderProps} Props that should be spread on the context provider slot. */ getContextProviderProps: () => UseTreeItemContextProviderProps; /** * Resolver for the root slot's props. * @param {ExternalProps} externalProps Additional props for the root slot. * @returns {UseTreeItemRootSlotProps} Props that should be spread on the root slot. */ getRootProps: = {}>(externalProps?: ExternalProps) => UseTreeItemRootSlotProps; /** * Resolver for the content slot's props. * @param {ExternalProps} externalProps Additional props for the content slot. * @returns {UseTreeItemContentSlotProps} Props that should be spread on the content slot. */ getContentProps: = {}>(externalProps?: ExternalProps) => UseTreeItemContentSlotProps; /** * Resolver for the label slot's props. * @param {ExternalProps} externalProps Additional props for the label slot. * @returns {UseTreeItemLabelSlotProps} Props that should be spread on the label slot. */ getLabelProps: = {}>(externalProps?: ExternalProps) => UseTreeItemLabelSlotProps; /** * Resolver for the labelInput slot's props. * @param {ExternalProps} externalProps Additional props for the labelInput slot. * @returns {UseTreeItemLabelInputSlotProps} Props that should be spread on the labelInput slot. */ getLabelInputProps: = {}>(externalProps?: ExternalProps) => UseTreeItemLabelInputSlotProps; /** * Resolver for the checkbox slot's props. * @param {ExternalProps} externalProps Additional props for the checkbox slot. * @returns {UseTreeItemCheckboxSlotProps} Props that should be spread on the checkbox slot. */ getCheckboxProps: = {}>(externalProps?: ExternalProps) => UseTreeItemCheckboxSlotProps; /** * Resolver for the iconContainer slot's props. * @param {ExternalProps} externalProps Additional props for the iconContainer slot. * @returns {UseTreeItemIconContainerSlotProps} Props that should be spread on the iconContainer slot. */ getIconContainerProps: = {}>(externalProps?: ExternalProps) => UseTreeItemIconContainerSlotProps; /** * Resolver for the GroupTransition slot's props. * @param {ExternalProps} externalProps Additional props for the GroupTransition slot. * @returns {UseTreeItemGroupTransitionSlotProps} Props that should be spread on the GroupTransition slot. */ getGroupTransitionProps: = {}>(externalProps?: ExternalProps) => UseTreeItemGroupTransitionSlotProps; /** * Resolver for the DragAndDropOverlay slot's props. * Warning: This slot is only useful when using the `` component. * @param {ExternalProps} externalProps Additional props for the DragAndDropOverlay slot. * @returns {UseTreeItemDragAndDropOverlaySlotProps} Props that should be spread on the DragAndDropOverlay slot. */ getDragAndDropOverlayProps: = {}>(externalProps?: ExternalProps) => UseTreeItemDragAndDropOverlaySlotProps; /** * Resolver for the ErrorIcon slot's props. * Warning: This slot is only useful when using the `` component when lazy loading is enabled. * @param {ExternalProps} externalProps Additional props for the ErrorIcon slot. * @returns {UseTreeItemErrorContainerSlotProps} Props that should be spread on the ErrorIcon slot. */ getErrorContainerProps: = {}>(externalProps?: ExternalProps) => UseTreeItemErrorContainerSlotProps; /** * Resolver for the LoadingIcon slot's props. * Warning: This slot is only useful when using the `` component when lazy loading is enabled. * @param {ExternalProps} externalProps Additional props for the LoadingIcon slot. * @returns {UseTreeItemLoadingContainerSlotProps} Props that should be spread on the LoadingIcon slot. */ getLoadingContainerProps: = {}>(externalProps?: ExternalProps) => UseTreeItemLoadingContainerSlotProps; /** * A ref to the component's root DOM element. */ rootRef: React.RefCallback | null; /** * Current status of the item. */ status: UseTreeItemStatus; /** * The object the allows Tree View manipulation. */ publicAPI: TreeViewPublicAPI; }