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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CSS theme variables in DataGrid and DatePickers #6702

Closed
2 tasks done
siriwatknp opened this issue Nov 1, 2022 · 0 comments 路 Fixed by #6784
Closed
2 tasks done

Support CSS theme variables in DataGrid and DatePickers #6702

siriwatknp opened this issue Nov 1, 2022 · 0 comments 路 Fixed by #6784
Labels
component: data grid This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability

Comments

@siriwatknp
Copy link
Member

siriwatknp commented Nov 1, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 馃挕

Migrating the https://mui.com/x/ to use CSS theme variables (mui/material-ui#34922) is blocked by the MUI X components (data grid and date pickers) because they are not yet supporting the feature.

Examples 馃寛

diff --git a/packages/grid/x-data-grid/src/components/containers/GridOverlay.tsx b/packages/grid/x-data-grid/src/components/containers/GridOverlay.tsx
index 77146b23..2735cd2b 100644
--- a/packages/grid/x-data-grid/src/components/containers/GridOverlay.tsx
+++ b/packages/grid/x-data-grid/src/components/containers/GridOverlay.tsx
@@ -39,7 +39,9 @@ const GridOverlayRoot = styled('div', {
   alignSelf: 'center',
   alignItems: 'center',
   justifyContent: 'center',
-  backgroundColor: alpha(theme.palette.background.default, theme.palette.action.disabledOpacity),
+  backgroundColor: theme.vars
+    ? `rgba(${theme.vars.palette.background.defaultChannel} / ${theme.vars.palette.action.disabledOpacity})`
+    : alpha(theme.palette.background.default, theme.palette.action.disabledOpacity),
 }));
 
 const GridOverlay = React.forwardRef<HTMLDivElement, GridOverlayProps>(function GridOverlay(

Motivation 馃敠

@mui/material has landed an experimental API for supporting CSS theme variables which is a new feature without breaking changes.

There are some part of the code in MUI X (data grid and date pickers) that uses theme.palette.* so the updates can be done the same as mui/material-ui#32049.

Order ID 馃挸 (optional)

No response

@siriwatknp siriwatknp added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 1, 2022
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Nov 1, 2022
@flaviendelangle flaviendelangle added component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability labels Nov 2, 2022
@flaviendelangle flaviendelangle removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 2, 2022
@cherniavskii cherniavskii self-assigned this Nov 3, 2022
@cherniavskii cherniavskii removed their assignment Nov 10, 2022
alexfauquette added a commit that referenced this issue Nov 24, 2022
Co-authored-by: Siriwat K <siriwatkunaporn@gmail.com>
Fix #6702
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants