import * as React from 'react'; import { CreateSlotsAndSlotProps, SlotCommonProps, SlotProps } from '../../../types/slot'; import { OverrideProps } from '@mui/types'; import { TypographyProps } from '../../../Typography'; import { CollapseProps } from '../../../Collapse'; export type TreeItemSlot = 'root' | 'label' | 'content' | 'icon' | 'endIcon' | 'collapseIcon' | 'expandIcon' | 'iconContainer' | 'groupTransition'; export interface TreeItemSlots { /** * The component that renders the root. * @default 'li' */ root?: React.ElementType; /** * The component that renders the item label. */ label?: React.ElementType; /** * The component that renders the item content. */ content?: React.ElementType; /** * The component that renders the children of the item. */ groupTransition?: React.ElementType; /** * The component that renders the icon. */ iconContainer?: React.ElementType; /** * The icon used to collapse the item. */ collapseIcon?: React.ElementType; /** * The icon used to expand the item. */ expandIcon?: React.ElementType; /** * The icon displayed next to an end item. */ endIcon?: React.ElementType; /** * The icon to display next to the Tree Item's label. */ icon?: React.ElementType; } export type TreeItemSlotsAndSlotProps = CreateSlotsAndSlotProps; label: SlotProps<'span', TypographyProps, TreeItemOwnerState>; content: SlotProps<'div', object, TreeItemOwnerState>; groupTransition: SlotProps<'div', CollapseProps, TreeItemOwnerState>; iconContainer: SlotProps<'span', object, TreeItemOwnerState>; collapseIcon: SlotProps<'span', object, TreeItemOwnerState>; expandIcon: SlotProps<'span', object, TreeItemOwnerState>; endIcon: SlotProps<'span', object, TreeItemOwnerState>; icon: SlotProps<'span', object, TreeItemOwnerState>; }>; export interface TreeItemTypeMap

{ props: P & Omit, 'onFocus'> & { /** * The id attribute of the item. If not provided, it will be generated. */ id?: string; /** * The id of the item. * Must be unique. */ itemId: string; /** * The label of the item. */ label?: React.ReactNode; /** * The decorator displayed before the label. */ startDecorator?: React.ReactNode; /** * The decorator displayed after the label. */ endDecorator?: React.ReactNode; /** * If `true`, the item is disabled. * @default false */ disabled?: boolean; /** * The number of children for the item. * If the children count is not available for some reason, but there are some children, set as -1. * @default 0 */ childrenCount?: number; } & TreeItemSlotsAndSlotProps; defaultComponent: D; } export type TreeItemProps = OverrideProps, D>; export interface TreeItemOwnerState extends TreeItemProps { expandable?: boolean; expanded?: boolean; focused?: boolean; selected?: boolean; disabled?: boolean; density?: 'standard' | 'compact' | 'comfortable'; }