Skip to content

Commit

Permalink
[TreeView] Make useTreeItem2 stable
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Sep 5, 2024
1 parent 2e38064 commit d84f99b
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
import VideoCameraBackIcon from '@mui/icons-material/VideoCameraBack';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import { treeItemClasses } from '@mui/x-tree-view/TreeItem';
import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Checkbox,
TreeItem2Content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
import VideoCameraBackIcon from '@mui/icons-material/VideoCameraBack';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import { treeItemClasses } from '@mui/x-tree-view/TreeItem';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Checkbox,
TreeItem2Content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Box from '@mui/material/Box';
import Avatar from '@mui/material/Avatar';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';

import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import Box from '@mui/material/Box';
import Avatar from '@mui/material/Avatar';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import { TreeViewBaseItem } from '@mui/x-tree-view/models';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconButton from '@mui/material/IconButton';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import { TreeItem2, TreeItem2Label } from '@mui/x-tree-view/TreeItem2';
import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2Utils } from '@mui/x-tree-view/hooks';

const StyledLabelInput = styled('input')(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import {
UseTreeItem2LabelInputSlotOwnProps,
UseTreeItem2LabelSlotOwnProps,
unstable_useTreeItem2 as useTreeItem2,
useTreeItem2,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2Utils } from '@mui/x-tree-view/hooks';
import { TreeViewBaseItem } from '@mui/x-tree-view/models';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
import VideoCameraBackIcon from '@mui/icons-material/VideoCameraBack';
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro';
import { treeItemClasses } from '@mui/x-tree-view/TreeItem';
import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Checkbox,
TreeItem2Content,
Expand Down
5 changes: 1 addition & 4 deletions docs/data/tree-view/rich-tree-view/ordering/FileExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
import VideoCameraBackIcon from '@mui/icons-material/VideoCameraBack';
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro';
import { treeItemClasses } from '@mui/x-tree-view/TreeItem';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Checkbox,
TreeItem2Content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Box from '@mui/material/Box';
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro';

import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import Box from '@mui/material/Box';
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro';
import { TreeViewBaseItem } from '@mui/x-tree-view/models';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
TreeItem2Root,
TreeItem2GroupTransition,
} from '@mui/x-tree-view/TreeItem2';
import { unstable_useTreeItem2 as useTreeItem } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { TreeItem2Provider } from '@mui/x-tree-view/TreeItem2Provider';
import { TreeItem2Icon } from '@mui/x-tree-view/TreeItem2Icon';

Expand Down Expand Up @@ -83,7 +83,7 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(props, ref) {
getLabelProps,
getGroupTransitionProps,
status,
} = useTreeItem({ id, itemId, children, label, disabled, rootRef: ref });
} = useTreeItem2({ id, itemId, children, label, disabled, rootRef: ref });

const style = {
'--tree-view-color': theme.palette.mode !== 'dark' ? color : colorForDarkMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import {
TreeItem2Root,
TreeItem2GroupTransition,
} from '@mui/x-tree-view/TreeItem2';
import {
unstable_useTreeItem2 as useTreeItem,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import { TreeItem2Provider } from '@mui/x-tree-view/TreeItem2Provider';
import { TreeItem2Icon } from '@mui/x-tree-view/TreeItem2Icon';

Expand Down Expand Up @@ -107,7 +104,7 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
getLabelProps,
getGroupTransitionProps,
status,
} = useTreeItem({ id, itemId, children, label, disabled, rootRef: ref });
} = useTreeItem2({ id, itemId, children, label, disabled, rootRef: ref });

const style = {
'--tree-view-color': theme.palette.mode !== 'dark' ? color : colorForDarkMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Avatar from '@mui/material/Avatar';
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Avatar from '@mui/material/Avatar';
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem2, UseTreeItem2Parameters } from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
Expand Down
2 changes: 1 addition & 1 deletion packages/x-tree-view/src/TreeItem2/TreeItem2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import composeClasses from '@mui/utils/composeClasses';
import { styled, createUseThemeProps } from '../internals/zero-styled';
import { TreeItem2Props, TreeItem2OwnerState } from './TreeItem2.types';
import {
unstable_useTreeItem2 as useTreeItem2,
useTreeItem2,
UseTreeItem2ContentSlotOwnProps,
UseTreeItem2LabelSlotOwnProps,
UseTreeItem2Status,
Expand Down
7 changes: 6 additions & 1 deletion packages/x-tree-view/src/useTreeItem2/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export { useTreeItem2 as unstable_useTreeItem2 } from './useTreeItem2';
import { useTreeItem2 as useTreeItem2Export } from './useTreeItem2';

export const useTreeItem2 = useTreeItem2Export;
// eslint-disable-next-line @typescript-eslint/naming-convention
export const unstable_useTreeItem2 = useTreeItem2Export;

export type {
UseTreeItem2Parameters,
UseTreeItem2ReturnValue,
Expand Down
1 change: 1 addition & 0 deletions scripts/x-tree-view-pro.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
{ "name": "TreeViewSlots", "kind": "Interface" },
{ "name": "unstable_resetCleanupTracking", "kind": "Variable" },
{ "name": "unstable_useTreeItem2", "kind": "Variable" },
{ "name": "useTreeItem2", "kind": "Variable" },
{ "name": "UseTreeItem2ContentSlotOwnProps", "kind": "Interface" },
{ "name": "UseTreeItem2DragAndDropOverlaySlotOwnProps", "kind": "Interface" },
{ "name": "UseTreeItem2GroupTransitionSlotOwnProps", "kind": "Interface" },
Expand Down
1 change: 1 addition & 0 deletions scripts/x-tree-view.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
{ "name": "TreeViewSlots", "kind": "Interface" },
{ "name": "unstable_resetCleanupTracking", "kind": "Variable" },
{ "name": "unstable_useTreeItem2", "kind": "Variable" },
{ "name": "useTreeItem2", "kind": "Variable" },
{ "name": "UseTreeItem2ContentSlotOwnProps", "kind": "Interface" },
{ "name": "UseTreeItem2DragAndDropOverlaySlotOwnProps", "kind": "Interface" },
{ "name": "UseTreeItem2GroupTransitionSlotOwnProps", "kind": "Interface" },
Expand Down

0 comments on commit d84f99b

Please sign in to comment.