import * as React from 'react'; import { EventHandlers } from '@mui/utils/types'; import { TreeViewItemId } from "../../models/index.js"; import type { UseTreeItemContentSlotOwnProps, UseTreeItemDragAndDropOverlaySlotOwnProps, UseTreeItemLabelInputSlotOwnProps, UseTreeItemRootSlotOwnProps, UseTreeItemCheckboxSlotOwnProps, UseTreeItemLabelSlotOwnProps } from "../../useTreeItem/index.js"; import type { UseTreeItemInteractions } from "../../hooks/useTreeItemUtils/useTreeItemUtils.js"; import type { TreeItemProps } from "../../TreeItem/TreeItem.types.js"; import { TreeViewAnyStore } from "./treeView.js"; import { TreeViewStoreInContext } from "../TreeViewProvider/index.js"; export interface TreeViewItemPluginSlotPropsEnhancerParams { rootRefObject: React.RefObject; contentRefObject: React.RefObject; externalEventHandlers: EventHandlers; interactions: UseTreeItemInteractions; } type TreeViewItemPluginSlotPropsEnhancer = (params: TreeViewItemPluginSlotPropsEnhancerParams) => Partial; export interface TreeViewItemPluginSlotPropsEnhancers { root?: TreeViewItemPluginSlotPropsEnhancer; content?: TreeViewItemPluginSlotPropsEnhancer; dragAndDropOverlay?: TreeViewItemPluginSlotPropsEnhancer; labelInput?: TreeViewItemPluginSlotPropsEnhancer; label?: TreeViewItemPluginSlotPropsEnhancer; checkbox?: TreeViewItemPluginSlotPropsEnhancer; } export interface TreeViewItemPluginResponse { /** * Root of the `content` slot enriched by the plugin. */ contentRef?: React.RefCallback | null; /** * Ref of the `root` slot enriched by the plugin */ rootRef?: React.RefCallback | null; /** * Callback to enhance the slot props of the Tree Item. * * Not all slots are enabled by default, * if a new plugin needs to pass to an un-configured slot, * it just needs to be added to `TreeViewItemPluginSlotPropsEnhancers` */ propsEnhancers?: TreeViewItemPluginSlotPropsEnhancers; } export interface TreeViewItemPluginOptions extends Omit { props: TreeItemProps; } export type TreeViewItemPlugin = (options: TreeViewItemPluginOptions) => void | TreeViewItemPluginResponse; export type TreeItemWrapper = (params: { itemId: TreeViewItemId; children: React.ReactNode; store: TreeViewStoreInContext; idAttribute: string; }) => React.ReactNode; export {};