Skip to content
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

[DataGrid] Fix theme scoping issues #10498

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import * as React from 'react';
import composeClasses from '@mui/utils/composeClasses';
import { styled } from '@mui/material/styles';
import {
getDataGridUtilityClass,
gridClasses,
GridColDef,
GridColumnHeaderParams,
GridColumnHeaderTitle,
} from '@mui/x-data-grid';
import type { GridBaseColDef } from '@mui/x-data-grid/internals';
import { styled, GridBaseColDef } from '@mui/x-data-grid/internals';
import { getAggregationFunctionLabel } from '../hooks/features/aggregation/gridAggregationUtils';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
Expand Down Expand Up @@ -40,11 +39,15 @@ const GridAggregationFunctionLabel = styled('div', {
overridesResolver: (_, styles) => styles.aggregationColumnHeaderLabel,
})<{ ownerState: OwnerState }>(({ theme }) => {
return {
// @ts-ignore `@mui/material` theme.typography does not exist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the @ts-ignore will be removed by my suggestion https://github.com/mui/mui-x/pull/10498/files#r1778208301

fontSize: theme.typography.caption.fontSize,
// @ts-ignore `@mui/material` theme.typography does not exist
lineHeight: theme.typography.caption.fontSize,
position: 'absolute',
bottom: 4,
// @ts-ignore `@mui/material` theme.typography does not exist
fontWeight: theme.typography.fontWeightMedium,
// @ts-ignore `@mui/material` theme.vars does not exist
Comment on lines +42 to +50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure how we should evolve these styles that rely on material theme. Maybe we should define a minimal default grid theme with the styles we need from material? And then we document which theme fields need to be re-defined for other design systems?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a good approach, I would even recommend introducing CSS vars for these tokens that reads from the theme if the value exists, or fallback to some default value. That way people don’t need to define theme, they can just add CSS vars instead.

Copy link
Member

@siriwatknp siriwatknp Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for creating DataGrid CSS variables. It can be a plain object for type safety, basically to remove accessing the JS theme. Then in the, GridRootStyles declare the values using theme values from Material UI:

// dataGridCssVars.ts
// the structure below is just an example.
export const vars = {
  typography: {
    caption: {
      fontSize: '--DataGrid-typography-caption-fontSize',}
  }
}

// GridAggregationHeader
fontSize: `var(${vars.typography.caption.fontSize}, 12px)`, // the fallback is optional

// GridRootStyles.ts
const gridStyle: CSSInterpolation = {
  [vars.typography.caption.fontSize]: t.typography.caption.fontSize,
  ...
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on adding those properties on the system theme object instead?

One issue I have with CSS variables is that it's going to be a lot of boilerplate to redefine all the theme variables we need. And once we have released publically a set of CSS variables, it gets harder to add new ones because it could be a breaking change if that new variable is not defined by users, whereas the theme object covers basically every theming/styling use-case.

If we go with CSS variables, I'm also unsure if/how to adapt patterns like these ones:

  • padding: theme.spacing(0.5)
  • [theme.breakpoints.up('sm')]: { ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And once we have released publically a set of CSS variables, it gets harder to add new ones because it could be a breaking change if that new variable is not defined by users

In the case of adding new variables, would we not provide a default in the Data Grid, and then users only need to define it if they wish to override the value? That should prevent breaking changes unless I'm misunderstanding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on adding those properties on the system theme object instead?

What does this mean in practice? We extend the system theme by adding the properties we need, and then each consumer is responsible for providing a compatible theme object, correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of adding new variables, would we not provide a default in the Data Grid, and then users only need to define it if they wish to override the value?

Yes in theory, in practice I feel like there could be cases where we can't find a good default.

What does this mean in practice? We extend the system theme by adding the properties we need, and then each consumer is responsible for providing a compatible theme object, correct?

Yes, that would be the idea. The theme object is more structured and already has typings and everything needed for theming.

If we go to CSS variables, we'd need to replace pretty much all of these cases with them (unless we only use CSS variables for the cases where the system theme object doesn't match the material theme, but mixing both paradigms sounds bad).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be the idea. The theme object is more structured and already has typings and everything needed for theming.

True, that is a valid approach and a practical one.

If we go to CSS variables, we'd need to replace pretty much all of these cases with them (unless we only use CSS variables for the cases where the system theme object doesn't match the material theme, but mixing both paradigms sounds bad).

Moving CSS will take more effort. I think it will involve a design engineer to come up with a minimal set of variables that will be used across the data grid in an efficient way (might include a redesign).

But I think it's a long term way because it does not involve JS theme anymore, it's just CSS and anyone can override theme (theming the data grid) with plain CSS.

color: (theme.vars || theme).palette.primary.dark,
textTransform: 'uppercase',
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import { getDataGridUtilityClass, GridRenderCellParams } from '@mui/x-data-grid';
import { styled, Theme } from '@mui/material/styles';
import { Theme } from '@mui/material/styles';
import { SxProps } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { getDataGridUtilityClass, GridRenderCellParams } from '@mui/x-data-grid';
import { styled } from '@mui/x-data-grid/internals';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { DataGridPremiumProcessedProps } from '../models/dataGridPremiumProps';

Expand All @@ -11,7 +12,9 @@ const GridFooterCellRoot = styled('div', {
slot: 'FooterCell',
overridesResolver: (_, styles) => styles.footerCell,
})<{ ownerState: OwnerState }>(({ theme }) => ({
// @ts-ignore `@mui/material` theme.typography does not exist
fontWeight: theme.typography.fontWeightMedium,
// @ts-ignore `@mui/material` theme.vars does not exist
color: (theme.vars || theme).palette.primary.dark,
}));

Expand Down Expand Up @@ -54,6 +57,7 @@ function GridFooterCell(props: GridFooterCellProps) {
const classes = useUtilityClasses(ownerState);

return (
// @ts-ignore `@mui/material` system styled() doesn't have a compatible sx prop
<GridFooterCellRoot ownerState={ownerState} className={classes.root} {...other}>
Comment on lines +60 to 61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using system styled() for GridFooterCellRoot means it's incompatible because we explicitly declare the type as sx?: MaterialTheme.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fixed by my suggestion in internals/styled:

createStyled<Theme>({ themeId: MATERIAL_THEME_ID });

{formattedValue}
</GridFooterCellRoot>
Expand Down
7 changes: 5 additions & 2 deletions packages/x-data-grid-pro/src/components/GridColumnHeaders.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
import { GridBaseColumnHeaders, UseGridColumnHeadersProps } from '@mui/x-data-grid/internals';
import {
styled,
GridBaseColumnHeaders,
UseGridColumnHeadersProps,
} from '@mui/x-data-grid/internals';
import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';

const Filler = styled('div')({
Expand Down
3 changes: 2 additions & 1 deletion packages/x-data-grid-pro/src/components/GridDetailPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import { styled } from '@mui/x-data-grid/internals';
import { GridRowId } from '@mui/x-data-grid';
import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
Expand All @@ -15,6 +15,7 @@ const DetailPanel = styled('div', {
})<{ ownerState: OwnerState }>(({ theme }) => ({
width:
'calc(var(--DataGrid-rowWidth) - var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
// @ts-ignore theme.vars
backgroundColor: (theme.vars || theme).palette.background.default,
overflow: 'auto',
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid/src/components/GridPagination.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import TablePagination, {
tablePaginationClasses,
TablePaginationProps,
LabelDisplayedRowsArgs,
} from '@mui/material/TablePagination';
import { styled } from '../utils/styled';
import { useGridSelector } from '../hooks/utils/useGridSelector';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
Expand Down
3 changes: 2 additions & 1 deletion packages/x-data-grid/src/components/GridRowCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled, SxProps, Theme } from '@mui/system';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../utils/styled';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { getDataGridUtilityClass } from '../constants/gridClasses';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid/src/components/GridScrollArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
unstable_composeClasses as composeClasses,
unstable_useEventCallback as useEventCallback,
} from '@mui/utils';
import { styled } from '@mui/system';
import { fastMemo } from '@mui/x-internals/fastMemo';
import { styled } from '../utils/styled';
import { DataGridProcessedProps } from '../models/props/DataGridProps';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { getDataGridUtilityClass, gridClasses } from '../constants';
Expand Down
4 changes: 2 additions & 2 deletions packages/x-data-grid/src/components/GridSelectedRowCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled, SxProps, Theme } from '@mui/system';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../utils/styled';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { getDataGridUtilityClass } from '../constants/gridClasses';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
Expand Down Expand Up @@ -54,7 +55,6 @@ const GridSelectedRowCount = React.forwardRef<HTMLDivElement, GridSelectedRowCou
const ownerState = useGridRootProps();
const classes = useUtilityClasses(ownerState);
const rowSelectedText = apiRef.current.getLocaleText('footerRowSelected')(selectedRowCount);

return (
<GridSelectedRowCountRoot
ref={ref}
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid/src/components/base/GridOverlays.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { styled } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import clsx from 'clsx';
import { styled } from '../../utils/styled';
import { useGridSelector } from '../../hooks/utils/useGridSelector';
import { gridDimensionsSelector } from '../../hooks/features/dimensions';
import { GridOverlayType } from '../../hooks/features/overlays/useGridOverlays';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
unstable_useEnhancedEffect as useEnhancedEffect,
} from '@mui/utils';
import InputBase, { InputBaseProps } from '@mui/material/InputBase';
import { styled } from '@mui/material/styles';
import { styled } from '../../utils/styled';
import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
unstable_composeClasses as composeClasses,
unstable_useEnhancedEffect as useEnhancedEffect,
} from '@mui/utils';
import { styled } from '@mui/material/styles';
import InputBase, { InputBaseProps } from '@mui/material/InputBase';
import { styled } from '../../utils/styled';
import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand All @@ -29,7 +29,8 @@ const GridEditInputCellRoot = styled(InputBase, {
slot: 'EditInputCell',
overridesResolver: (props, styles) => styles.editInputCell,
})<{ ownerState: OwnerState }>(({ theme }) => ({
...theme.typography.body2,
// @ts-ignore `@mui/material` theme.typography does not exist
...theme.typography?.body2,
padding: '1px 0',
'& input': {
padding: '0 16px',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled, SxProps, Theme } from '@mui/system';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../../utils/styled';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled } from '@mui/system';
import { styled } from '../../utils/styled';
import { isOverflown } from '../../utils/domUtils';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled } from '@mui/system';
import { styled } from '../../utils/styled';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import composeClasses from '@mui/utils/composeClasses';
import FormControlLabel from '@mui/material/FormControlLabel';
import { styled } from '@mui/material/styles';
import { styled } from '../../utils/styled';
import {
gridColumnDefinitionsSelector,
gridColumnVisibilityModelSelector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled, SxProps, Theme } from '@mui/system';
import { Theme, SxProps } from '@mui/system';
import { styled } from '../../utils/styled';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { Theme, SxProps, styled } from '@mui/system';
import { Theme, SxProps } from '@mui/system';
import { styled } from '../../utils/styled';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, SxProps, Theme } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../../utils/styled';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
3 changes: 2 additions & 1 deletion packages/x-data-grid/src/components/menu/GridMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import Grow, { GrowProps } from '@mui/material/Grow';
import Paper from '@mui/material/Paper';
import Popper, { PopperProps } from '@mui/material/Popper';
import { styled } from '@mui/material/styles';
import { styled } from '../../utils/styled';
import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down Expand Up @@ -48,6 +48,7 @@ const GridMenuRoot = styled(Popper, {
slot: 'Menu',
overridesResolver: (_, styles) => styles.menu,
})<{ ownerState: OwnerState }>(({ theme }) => ({
// @ts-ignore `@mui/material` theme.zIndex does not exist
zIndex: theme.zIndex.modal,
[`& .${gridClasses.menuList}`]: {
outline: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import clsx from 'clsx';
import PropTypes from 'prop-types';
import * as React from 'react';
import MenuList from '@mui/material/MenuList';
import { styled } from '@mui/material/styles';

import { styled } from '../../../utils/styled';
import { isHideMenuKey } from '../../../utils/keyboardUtils';
import { GridColumnMenuContainerProps } from './GridColumnMenuProps';
import { gridClasses } from '../../../constants/gridClasses';
Expand Down
4 changes: 3 additions & 1 deletion packages/x-data-grid/src/components/panel/GridPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled } from '@mui/material/styles';
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
import ClickAwayListener from '@mui/material/ClickAwayListener';
import Paper from '@mui/material/Paper';
import Popper from '@mui/material/Popper';
import { styled } from '../../utils/styled';
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down Expand Up @@ -38,6 +38,7 @@ const GridPanelRoot = styled(Popper, {
slot: 'Panel',
overridesResolver: (props, styles) => styles.panel,
})<{ ownerState: OwnerState }>(({ theme }) => ({
// @ts-ignore `@mui/material` theme.zIndex does not exist
zIndex: theme.zIndex.modal,
}));

Expand All @@ -46,6 +47,7 @@ const GridPaperRoot = styled(Paper, {
slot: 'Paper',
overridesResolver: (props, styles) => styles.paper,
})<{ ownerState: OwnerState }>(({ theme }) => ({
// @ts-ignore `@mui/material` theme.vars does not exist
backgroundColor: (theme.vars || theme).palette.background.paper,
minWidth: 300,
maxHeight: 450,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, SxProps, Theme } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../../utils/styled';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, SxProps, Theme } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../../utils/styled';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { styled, SxProps, Theme } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { SxProps, Theme } from '@mui/system';
import { styled } from '../../utils/styled';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down
22 changes: 14 additions & 8 deletions packages/x-data-grid/src/components/panel/GridPanelWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import FocusTrap, { TrapFocusProps } from '@mui/material/Unstable_TrapFocus';
import { styled, Theme } from '@mui/material/styles';
import { Theme } from '@mui/material/styles';
import { MUIStyledCommonProps } from '@mui/system';
import composeClasses from '@mui/utils/composeClasses';
import { styled } from '../../utils/styled';
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
import { getDataGridUtilityClass } from '../../constants/gridClasses';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
Expand Down Expand Up @@ -50,15 +51,20 @@ const GridPanelWrapper = React.forwardRef<HTMLDivElement, GridPanelWrapperProps>
const rootProps = useGridRootProps();
const classes = useUtilityClasses(rootProps);

const content = (
// @ts-ignore `@mui/material` incompatible sx prop on GridPanelWrapperRoot
<GridPanelWrapperRoot
ref={ref}
tabIndex={-1}
className={clsx(className, classes.root)}
ownerState={rootProps}
{...other}
/>
);

return (
<FocusTrap open disableEnforceFocus isEnabled={isEnabled} {...slotProps.TrapFocus}>
<GridPanelWrapperRoot
ref={ref}
tabIndex={-1}
className={clsx(className, classes.root)}
ownerState={rootProps}
{...other}
/>
{content}
</FocusTrap>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
unstable_capitalize as capitalize,
} from '@mui/utils';
import { SelectChangeEvent } from '@mui/material/Select';
import { styled } from '@mui/material/styles';
import clsx from 'clsx';
import { styled } from '../../../utils/styled';
import {
gridFilterableColumnDefinitionsSelector,
gridColumnLookupSelector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { TextFieldProps } from '@mui/material/TextField';
import { refType, unstable_useId as useId } from '@mui/utils';
import { styled } from '@mui/material/styles';
import { styled } from '../../../utils/styled';
import { GridFilterInputValueProps } from './GridFilterInputValueProps';
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';

Expand Down
Loading