mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.11k stars 1.27k forks source link

[charts] Remove dependency on Material UI #12219

Open oliviertassinari opened 7 months ago

oliviertassinari commented 7 months ago

Summary

This charts library has a dependency on Material UI and Emotion https://unpkg.com/browse/@mui/x-charts@7.0.0-beta.4/package.json

  "peerDependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/material": "^5.15.0",
    "react": "^17.0.0 || ^18.0.0",
    "react-dom": "^17.0.0 || ^18.0.0"
  },

which discredit it as a viable alternative to Recharts if you are not already in the MUI ecosystem.

Examples

Once we fix https://github.com/mui/material-ui/issues/40594 we should able to only have a dependency on MUI System/Pigment CSS, which is equivalent to https://github.com/adazzle/react-data-grid/pull/3407.

This issue is potentially a duplicate of #11123. But not necessarily, we could see this one as the extension of https://github.com/mui/material-ui/issues/40594 in MUI X.

Motivation

See:

SCR-20240227-bbzr

https://ably.com/blog/top-react-chart-libraries#mui-x-charts.

This library seamlessly integrates with other MUI components and best suits those already invested in the MUI ecosystem.

It sounds about right. No engineers in their right mind should add MUI X Charts as a dependency unless they already use Emotion.

Search keywords: Material UI dependency

FabianKoder commented 5 months ago

This would be really nice for Joy UI users, since they are basically in the MUI ecosystem but cannot use MUI X anyways. This would unlock the charts part at least, which is a great step towards decoupling everything from Material UI.

oliviertassinari commented 5 months ago

This would be really nice for Joy UI users, since they are basically in the MUI ecosystem but cannot use MUI X anyways._

@Fabb111 Yes, moving to a Pigment CSS dependency, where all the theming logic would move.

We might even:

FabianKoder commented 5 months ago

This would be really nice for Joy UI users, since they are basically in the MUI ecosystem but cannot use MUI X anyways._

@Fabb111 Yes, moving to a Pigment CSS dependency, where all the theming logic would move.

We might even:

  • Kill Material UI
  • Kill Joy UI
  • Rewrite with a new foundation, on Pigment CSS and Base UI, have a Joy Design theme by default, have a Material Design theme to opt-in. Have MUI X an extension of that new foundation.

Sounds great. And especially the second option sounds like the perfect long term goal since it would improve the overall adaptability. But I guess this issues goal is a more short- to midterm "quick fix", right? Just for my personal knowledge, do you have a rough timeline for this? Since it's probably not straight forward I expect it would take longer for this to arrive, right?

oliviertassinari commented 5 months ago

For sure, we will do this by step. The team working on the charts's main concern is growing the charts in the React ecosystem, so to fit well with other UI libraries, Shadcn, Mantine, etc. and of course, with the other MUI open source projects.