Skip to content

[code-infra] Update X to 8 and remove esmExternals option #45617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,12 @@ export default function ChartUserByCountry() {
innerRadius: 75,
outerRadius: 100,
paddingAngle: 0,
highlightScope: { faded: 'global', highlighted: 'item' },
highlightScope: { fade: 'global', highlight: 'item' },
},
]}
height={260}
width={260}
slotProps={{
legend: { hidden: true },
}}
hideLegend
>
<PieCenterLabel primaryText="98.5K" secondaryText="Total" />
</PieChart>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import CardContent from '@mui/material/CardContent';
import Collapse from '@mui/material/Collapse';
import Typography from '@mui/material/Typography';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import { unstable_useTreeItem2 as useTreeItem2 } from '@mui/x-tree-view/useTreeItem2';
import { useTreeItem as useTreeItem2 } from '@mui/x-tree-view/useTreeItem';
import {
TreeItem2Content,
TreeItem2IconContainer,
TreeItem2Label,
TreeItem2Root,
} from '@mui/x-tree-view/TreeItem2';
import { TreeItem2Icon } from '@mui/x-tree-view/TreeItem2Icon';
import { TreeItem2Provider } from '@mui/x-tree-view/TreeItem2Provider';
TreeItemContent,
TreeItemIconContainer,
TreeItemLabel,
TreeItemRoot,
} from '@mui/x-tree-view/TreeItem';
import { TreeItemIcon } from '@mui/x-tree-view/TreeItemIcon';
import { TreeItemProvider } from '@mui/x-tree-view/TreeItemProvider';

import { useTheme } from '@mui/material/styles';

Expand Down Expand Up @@ -106,7 +106,7 @@ function CustomLabel({ color, expandable, children, ...other }) {

const iconColor = color ? colors[color] : null;
return (
<TreeItem2Label {...other} sx={{ display: 'flex', alignItems: 'center' }}>
<TreeItemLabel {...other} sx={{ display: 'flex', alignItems: 'center' }}>
{iconColor && <DotIcon color={iconColor} />}
<Typography
className="labelText"
Expand All @@ -115,7 +115,7 @@ function CustomLabel({ color, expandable, children, ...other }) {
>
{children}
</Typography>
</TreeItem2Label>
</TreeItemLabel>
);
}

Expand All @@ -141,9 +141,9 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(props, ref) {
const item = publicAPI.getItem(itemId);
const color = item?.color;
return (
<TreeItem2Provider itemId={itemId}>
<TreeItem2Root {...getRootProps(other)}>
<TreeItem2Content
<TreeItemProvider itemId={itemId}>
<TreeItemRoot {...getRootProps(other)}>
<TreeItemContent
{...getContentProps({
className: clsx('content', {
expanded: status.expanded,
Expand All @@ -154,20 +154,20 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(props, ref) {
})}
>
{status.expandable && (
<TreeItem2IconContainer {...getIconContainerProps()}>
<TreeItem2Icon status={status} />
</TreeItem2IconContainer>
<TreeItemIconContainer {...getIconContainerProps()}>
<TreeItemIcon status={status} />
</TreeItemIconContainer>
)}

<CustomLabel {...getLabelProps({ color })} />
</TreeItem2Content>
</TreeItemContent>
{children && (
<TransitionComponent
{...getGroupTransitionProps({ className: 'groupTransition' })}
/>
)}
</TreeItem2Root>
</TreeItem2Provider>
</TreeItemRoot>
</TreeItemProvider>
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import Collapse from '@mui/material/Collapse';
import Typography from '@mui/material/Typography';
import { RichTreeView } from '@mui/x-tree-view/RichTreeView';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
useTreeItem as useTreeItem2,
UseTreeItemParameters,
} from '@mui/x-tree-view/useTreeItem';
import {
TreeItem2Content,
TreeItem2IconContainer,
TreeItem2Label,
TreeItem2Root,
} from '@mui/x-tree-view/TreeItem2';
import { TreeItem2Icon } from '@mui/x-tree-view/TreeItem2Icon';
import { TreeItem2Provider } from '@mui/x-tree-view/TreeItem2Provider';
TreeItemContent,
TreeItemIconContainer,
TreeItemLabel,
TreeItemRoot,
} from '@mui/x-tree-view/TreeItem';
import { TreeItemIcon } from '@mui/x-tree-view/TreeItemIcon';
import { TreeItemProvider } from '@mui/x-tree-view/TreeItemProvider';
import { TreeViewBaseItem } from '@mui/x-tree-view/models';
import { useTheme } from '@mui/material/styles';

Expand Down Expand Up @@ -111,7 +111,7 @@ function CustomLabel({ color, expandable, children, ...other }: CustomLabelProps

const iconColor = color ? colors[color] : null;
return (
<TreeItem2Label {...other} sx={{ display: 'flex', alignItems: 'center' }}>
<TreeItemLabel {...other} sx={{ display: 'flex', alignItems: 'center' }}>
{iconColor && <DotIcon color={iconColor} />}
<Typography
className="labelText"
Expand All @@ -120,12 +120,12 @@ function CustomLabel({ color, expandable, children, ...other }: CustomLabelProps
>
{children}
</Typography>
</TreeItem2Label>
</TreeItemLabel>
);
}

interface CustomTreeItemProps
extends Omit<UseTreeItem2Parameters, 'rootRef'>,
extends Omit<UseTreeItemParameters, 'rootRef'>,
Omit<React.HTMLAttributes<HTMLLIElement>, 'onFocus'> {}

const CustomTreeItem = React.forwardRef(function CustomTreeItem(
Expand All @@ -147,9 +147,9 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
const item = publicAPI.getItem(itemId);
const color = item?.color;
return (
<TreeItem2Provider itemId={itemId}>
<TreeItem2Root {...getRootProps(other)}>
<TreeItem2Content
<TreeItemProvider itemId={itemId}>
<TreeItemRoot {...getRootProps(other)}>
<TreeItemContent
{...getContentProps({
className: clsx('content', {
expanded: status.expanded,
Expand All @@ -160,20 +160,20 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
})}
>
{status.expandable && (
<TreeItem2IconContainer {...getIconContainerProps()}>
<TreeItem2Icon status={status} />
</TreeItem2IconContainer>
<TreeItemIconContainer {...getIconContainerProps()}>
<TreeItemIcon status={status} />
</TreeItemIconContainer>
)}

<CustomLabel {...getLabelProps({ color })} />
</TreeItem2Content>
</TreeItemContent>
{children && (
<TransitionComponent
{...getGroupTransitionProps({ className: 'groupTransition' })}
/>
)}
</TreeItem2Root>
</TreeItem2Provider>
</TreeItemRoot>
</TreeItemProvider>
);
});

Expand Down
1 change: 0 additions & 1 deletion docs/nextConfigDocsInfra.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function withDocsInfra(nextConfig) {
},
experimental: {
scrollRestoration: true,
esmExternals: false,
workerThreads: false,
cpus: 3,
...nextConfig.experimental,
Expand Down
18 changes: 9 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
"@mui/system": "workspace:*",
"@mui/types": "workspace:^",
"@mui/utils": "workspace:*",
"@mui/x-charts": "7.27.1",
"@mui/x-data-grid": "7.27.3",
"@mui/x-data-grid-generator": "7.27.3",
"@mui/x-data-grid-premium": "7.27.3",
"@mui/x-data-grid-pro": "7.27.3",
"@mui/x-date-pickers": "7.27.3",
"@mui/x-date-pickers-pro": "7.27.3",
"@mui/x-license": "7.26.0",
"@mui/x-tree-view": "7.26.0",
"@mui/x-charts": "^8.0.0-beta || ^8.0.0",
"@mui/x-data-grid": "^8.0.0-beta || ^8.0.0",
"@mui/x-data-grid-generator": "^8.0.0-beta || ^8.0.0",
"@mui/x-data-grid-premium": "^8.0.0-beta || ^8.0.0",
"@mui/x-data-grid-pro": "^8.0.0-beta || ^8.0.0",
"@mui/x-date-pickers": "^8.0.0-beta || ^8.0.0",
"@mui/x-date-pickers-pro": "^8.0.0-beta || ^8.0.0",
"@mui/x-license": "^8.0.0-beta || ^8.0.0",
"@mui/x-tree-view": "^8.0.0-beta || ^8.0.0",
"@popperjs/core": "^2.11.8",
"@react-spring/web": "^9.7.5",
"@toolpad/core": "^0.12.1",
Expand Down
42 changes: 19 additions & 23 deletions docs/src/components/productX/XTreeViewDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ 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 { useTreeItem as useTreeItem2, UseTreeItemParameters } from '@mui/x-tree-view/useTreeItem';
import {
unstable_useTreeItem2 as useTreeItem2,
UseTreeItem2Parameters,
} from '@mui/x-tree-view/useTreeItem2';
import {
TreeItem2Content,
TreeItem2IconContainer,
TreeItem2Label,
TreeItem2Root,
} from '@mui/x-tree-view/TreeItem2';
import { TreeItem2Icon } from '@mui/x-tree-view/TreeItem2Icon';
import { TreeItem2Provider } from '@mui/x-tree-view/TreeItem2Provider';
TreeItemContent,
TreeItemIconContainer,
TreeItemLabel,
TreeItemRoot,
} from '@mui/x-tree-view/TreeItem';
import { TreeItemIcon } from '@mui/x-tree-view/TreeItemIcon';
import { TreeItemProvider } from '@mui/x-tree-view/TreeItemProvider';
import { TreeViewBaseItem } from '@mui/x-tree-view/models';

type FileType = 'image' | 'pdf' | 'video' | 'folder';
Expand Down Expand Up @@ -92,7 +89,7 @@ declare module 'react' {
}
}

const StyledTreeItemRoot = styled(TreeItem2Root)(({ theme }) => ({
const StyledTreeItemRoot = styled(TreeItemRoot)(({ theme }) => ({
color: theme.palette.grey[800],
position: 'relative',
[`& .${treeItemClasses.groupTransition}`]: {
Expand All @@ -101,8 +98,8 @@ const StyledTreeItemRoot = styled(TreeItem2Root)(({ theme }) => ({
...theme.applyStyles('dark', {
color: theme.palette.grey[400],
}),
})) as unknown as typeof TreeItem2Root;
const CustomTreeItemContent = styled(TreeItem2Content)(({ theme }) => ({
})) as unknown as typeof TreeItemRoot;
const CustomTreeItemContent = styled(TreeItemContent)(({ theme }) => ({
borderRadius: theme.spacing(0.5),
marginBottom: theme.spacing(0.2),
marginTop: theme.spacing(0.2),
Expand Down Expand Up @@ -144,7 +141,7 @@ interface CustomLabelProps {

function CustomLabel({ icon: Icon, expandable, children, ...other }: CustomLabelProps) {
return (
<TreeItem2Label {...other} sx={{ display: 'flex', alignItems: 'center' }}>
<TreeItemLabel {...other} sx={{ display: 'flex', alignItems: 'center' }}>
{Icon && (
<Box
component={Icon}
Expand All @@ -156,7 +153,6 @@ function CustomLabel({ icon: Icon, expandable, children, ...other }: CustomLabel
})}
/>
)}

<Typography
sx={(theme) => ({
fontWeight: expandable
Expand All @@ -168,7 +164,7 @@ function CustomLabel({ icon: Icon, expandable, children, ...other }: CustomLabel
>
{children}
</Typography>
</TreeItem2Label>
</TreeItemLabel>
);
}

Expand All @@ -195,7 +191,7 @@ const getIconFromFileType = (fileType: FileType) => {
};

interface CustomTreeItemProps
extends Omit<UseTreeItem2Parameters, 'rootRef'>,
extends Omit<UseTreeItemParameters, 'rootRef'>,
Omit<React.HTMLAttributes<HTMLLIElement>, 'onFocus'> {}

const CustomTreeItem = React.forwardRef(function CustomTreeItem(
Expand Down Expand Up @@ -228,7 +224,7 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
}

return (
<TreeItem2Provider itemId={itemId}>
<TreeItemProvider itemId={itemId}>
<StyledTreeItemRoot {...getRootProps(other)}>
<CustomTreeItemContent
{...getContentProps({
Expand All @@ -241,16 +237,16 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
})}
>
{expandable && (
<TreeItem2IconContainer {...getIconContainerProps()}>
<TreeItem2Icon status={status} />
</TreeItem2IconContainer>
<TreeItemIconContainer {...getIconContainerProps()}>
<TreeItemIcon status={status} />
</TreeItemIconContainer>
)}

<CustomLabel {...getLabelProps({ icon, expandable })} />
</CustomTreeItemContent>
{children && <TransitionComponent {...getGroupTransitionProps()} />}
</StyledTreeItemRoot>
</TreeItem2Provider>
</TreeItemProvider>
);
});

Expand Down
Loading