UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

47 lines 1.4 kB
import * as React from 'react'; import { EMPTY_OBJECT } from '@base-ui/utils/empty'; import { TreeViewContext } from "./TreeViewContext.js"; import { TreeViewStyleContext } from "./TreeViewStyleContext.js"; import { useTreeViewBuildContext } from "./useTreeViewBuildContext.js"; import { jsx as _jsx } from "react/jsx-runtime"; /** * Sets up the contexts for the underlying Tree Item components. * * @ignore - do not document. */ export function TreeViewProvider(props) { const { store, apiRef, rootRef, classes = EMPTY_OBJECT, slots = EMPTY_OBJECT, slotProps = EMPTY_OBJECT, children } = props; const contextValue = useTreeViewBuildContext({ store, apiRef, rootRef }); const styleContextValue = React.useMemo(() => ({ classes, slots: { collapseIcon: slots.collapseIcon, expandIcon: slots.expandIcon, endIcon: slots.endIcon }, slotProps: { collapseIcon: slotProps.collapseIcon, expandIcon: slotProps.expandIcon, endIcon: slotProps.endIcon } }), [classes, slots.collapseIcon, slots.expandIcon, slots.endIcon, slotProps.collapseIcon, slotProps.expandIcon, slotProps.endIcon]); return /*#__PURE__*/_jsx(TreeViewContext.Provider, { value: contextValue, children: /*#__PURE__*/_jsx(TreeViewStyleContext.Provider, { value: styleContextValue, children: children }) }); }