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

[discussion] Preparing v6 #30660

Closed
2 tasks done
oliviertassinari opened this issue Jan 16, 2022 · 47 comments
Closed
2 tasks done

[discussion] Preparing v6 #30660

oliviertassinari opened this issue Jan 16, 2022 · 47 comments
Assignees
Labels
breaking change discussion package: material-ui Specific to @mui/material umbrella For grouping multiple issues to provide a holistic view v6.x

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 16, 2022

Edited by @DiegoAndai: Moved accepted ideas/issues into either the v6 milestone, the v7 milestone, or this list of brainstorm ideas

This is an umbrella issue that centralizes and lists all the potential improvements that we can consider in MUI Core v6. The potential improvements being listed here require breaking changes. We do not intend to ship v6 in 2022. We plan, as much as possible, to release the next major features in minor versions without breaking changes.

Big features

Other changes

For a detailed list of changes, please visit the Material UI: v6 milestone. If you're looking for a particular change, you can also search issues filtering by that milestone.

Promotions

@MitchTalmadge
Copy link

MitchTalmadge commented May 20, 2022

What change does this fall under?

// TODO v6: Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.

I'm curious for the reason behind removing PopperProps

Edit: It looks like it was added in f98d52b so I believe the reason must be that componentsProps will consume both PopperProps and TransitionProps.

@jeromeSH26
Copy link

jeromeSH26 commented Jan 1, 2023

Hi everyone, not sure this is the best place to post my request, but it seems to me that V6 of MUI should also bring some "standardization" in a way to manipulate the styles. Let me give you an example. Do not hesitate to move my comment elsewhere

I spent a couple of hours to find how to style the "a.active" in the theme (I'm using the Link of MUI and NavLink of react-router for your reference)

I came up with this solution for the "MuiLink" component in the createTheme:

     styleOverrides: {
        root: () => {
          return {
            borderColor: themePalette.SECONDARY_COLOR,
            "&:hover": { //<--- :hover is also working. the & is not mandatory
              borderColor: themePalette.SECONDARY_COLOR,
              color: "white",
            },
            "&.active": { // <--- .active is not working... Need the & 
              background: themePalette.THIRD_COLOR,
              color: themePalette.SECONDARY_COLOR,
              fontWeight: "bold",
            },
          };
        },
      },

That might be obvious for you BUT here is the trick:
for hover, the & at the beginning of "&:hover" can be omitted, ":hover" is also applying the style correctly.
however for the .active, the & is mandatory, ".active" doesn't apply the style, whereas "&.active" works as expected

I'm not very familiar with pure CSS, maybe in a CSS file this is also working this way, but for TS or JS, a standardization might be really powerful.

Anyway, your library is so great. Thks for your job and happy new year.

@o-alexandrov
Copy link

o-alexandrov commented Jan 13, 2023

It would be great to know your thoughts and to know whether you consider:

  1. to attempt to make MUI framework agnostic or at least a layer that would be agnostic

    • Idk and don't have a clear proposal on how to achieve this
    • maybe, the way Material Web currently builds with lit (and lit having generators to create react/vue/etc. components) could prompt to similar approaches
      • at best, there would be no performance degradation between the current react components and generated ones
  2. use of CSS Modules w/ variables for the styles, instead of emotion (and/or other CSS-in-JS). This point could be a plan B for the point 1 or initial work in this direction

@BrendanMayHRB

This comment was marked as resolved.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jan 30, 2023

It would be great to know your thoughts and to know whether you consider:

@o-alexandrov I have added a new section for big feature ideas for v6.

  1. Considering https://twitter.com/olivtassinari/status/1619858999943516160, if we ever do this, I think that it will be by wrapping the React components into a light runtime, e.g. Preact. (I don't think that it would make sense to use web components inside or even expose them, I think that web component was invented to solve a problem that existed 10 years ago but doesn't really exist anymore).
  2. It's part of the list :)

@o-alexandrov
Copy link

o-alexandrov commented Feb 20, 2023

How about simplifying MUI's codebase on how you do animation by adopting framer-motion, Transitions in particular?

  • Chakra UI uses framer-motion for Collapse component for example
  • Material Design 3 would need effort on the changed/new animation. Using framer-motion should simplify the task
  • MUI has animation-related performance issues that would be resolved [SwipeableDrawer] Very bad v5 performance on iPhone #31009
  • framer-motion is also very popular, so for those who use it, you'd decrease the bundle size if you make a switch in your codebase
    • for those who don't, it'd be great if there was interoperability between animation libraries similar to how you did with styled API

@chrisweb
Copy link
Contributor

chrisweb commented Feb 20, 2023

@o-alexandrov I saw few days ago that the Chakra UI team noted in their 3.0 roadmap that they want to remove the framer motion dependency:

Remove dependency on framer-motion: We'll redesign the components to fit any motion library or native css animation.

their roadmap post is here: chakra-ui/chakra-ui#7180

so maybe doing that would actually be the best solution, allow framer motion or any other motion library to replace (mui) motion, similar to how it is done for date libraries and probably similar to the idea of removing the dependency on emotion to allow other css-in-js libraries as alternatives (see style engine discussion #34826 that emerged after the nextjs / server components discussion started: #34896)

@KasimAhmic
Copy link

KasimAhmic commented Mar 1, 2023

With regard to static CSS extraction, would/could this cover use cases where theme configs are loaded dynamically at runtime?

For example, I have an app that has a different color scheme based on the customer that it's deployed for and the theme config is fetched on page load and applied to the app. Would it be possible to fetch the theme configs at build time? Or maybe export the theme config variables as global CSS variables that can then be overridden at runtime?

@nameer
Copy link

nameer commented Mar 20, 2024

Hey @nameer, thanks for reaching out!

Your suggestion seems to align with #29345, which we're doing for v7. Would you be willing to open an issue so we can add it to that milestone? That way, we can track the progress.

Created #41579

@JoseVSeb
Copy link

Is the compatibility of pigment-css with MUI-X planned for the initial release of v6?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 14, 2024

Is the compatibility of pigment-css with MUI-X planned for the initial release of v6?

@JoseVSeb This isn't really in our target. MUI X has about 20% of the use relative to Material UI. It's also almost has much work as in Material UI to support. So it makes more sense for us to first prove that the model works with Material UI before expending.

  • Pigment CSS and Emotion by design must be able to cohabite in the same page to allow progressive migrations, so it's incremental value as more components are migrated.
  • We have two official release slots in the year to ship breaking changes that syncs all projects together (Pigment CSS, Base UI, Material UI, MUI X), September and March: https://mui-org.notion.site/React-releases-7490ef9581b4447ebdbf86b13164272d. If Material UI gets shipped out of shedule, it means that it should be designed in a way makes it possible for downstream, e.g. MUI X to not release a breaking change while supporting the latest version of Material UI. So here too, you should be able to see incremental value.

@Studio384
Copy link
Contributor

Studio384 commented Jul 22, 2024

Will it be possible to use Material UI v6 in combination with MUI X at all (with or without MUI being on Pigment while MUI X still uses emotion) when it launches? From looking at the MUI X repository there doesn't seem to be any effort right now to support MUI v6. MUI X is currently a blocking issue for testing out the v6 release. We used to follow along with alphas and betas in a test branch to not have all breaking changes come in at once, but that hasn't been possible with v6 in combination with MUI X.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 22, 2024

But that hasn't been possible with Material UI v6 in combination with MUI X

@Studio384 What issue did you face?

Will it be possible to use Material UI v6 in combination with MUI X when it launches?

I don't know. The interdependency rules we have between projects https://mui-org.notion.site/Introduction-5933bc8bccf544c7aca78d0033ded787 won't really answer your question. We say "Upstream (Material UI) and Downstream (MUI X) are responsible for Downstream adoption of upstream" and "In the short-term, Downstream (MUI X) decides when they adopt the upstream changes (Material UI) but it can't take more than one major cycle".

@Studio384
Copy link
Contributor

@Studio384 What issue did you face?

MUI X v7 currently requires MUI v5 and only v5. So from what I get here, you're saying it might take until MUI v7 before MUI X supports MUI v6?

@endaquigley
Copy link

Is MUI v6 with Pigment CSS compatible with Remix?

It's not listed as a supported framework even though Remix is just a Vite plugin these days:
https://next.mui.com/material-ui/migration/migrating-to-pigment-css

I can only seem to get Pigment CSS working when SSR is disabled:
https://stackblitz.com/edit/remix-run-remix-aroqz5

@DanailH
Copy link
Member

DanailH commented Jul 30, 2024

Hi, @Studio384 I'm confirming that MUI X v7 will support Material UI v6 once there is a stable release.

@gaetansnl
Copy link

gaetansnl commented Aug 4, 2024

hello @oliviertassinari , just tried the beta and followed the upgrade guide on a new nextjs project. Seems pigment is working but all material ui components are still using emotion. I also built material-ui repo and looked at the demo app, it works and mui uses pigment. So I'm probably missing something. Is there a way to completely remove emotion and prevent it from being loaded unintentionally?

@JoseVSeb
Copy link

JoseVSeb commented Aug 4, 2024

Seems pigment is working but all material ui components are still using emotion.

I have been facing this as well. pigment works fine. but it's not being used for mui components. they still rely on emotion at runtime. an example would be nice.

@rossipedia
Copy link

rossipedia commented Aug 6, 2024

This is what I had to do to get things working with @mui/material and Pigment and vite:

  • remove ThemeProvider or CssVarsProvider
  • add @mui/material to transformLibraries in the vite plugin config:
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    pigment({
      theme: extendTheme(...),
      transformLibraries: ['@mui/material'],
    }),
    react(),
  ],
});

After that the MUI components would start picking up the Theme customizations using Pigment.

Sorry, I don't use NextJS so I don't know what the same approach there would look like.

@JoseVSeb
Copy link

JoseVSeb commented Aug 6, 2024

transformLibraries: ['@mui/material'],

That's what I was missing. Thanks.

@DiegoAndai
Copy link
Member

Thanks, @gaetansnl, @rossipedia, and @JoseVSeb, for pointing out this issue; this was indeed missing in the guide. We're adding it: #43217

@xml
Copy link

xml commented Aug 13, 2024

Thanks all for this amazing project. Possible I'm doing something wrong, but when I add that transformLibraries config to a new project, with Vite 5.4 and MUI beta 5, the server drowns in hundreds of errors, such as:

[vite] Pre-transform error: /node_modules/@mui/material/StepConnector/StepConnector.js: Cannot read properties of undefined (reading 'palette')

I removed the ThemeProvider first. I have not customized a theme, so that's not present.

If any additional information would be helpful, I'm happy to provide.

@sdriffill-tm
Copy link

I'm having issues using MUI v6 Beta w/ Pigment CSS in a Remix project. I'm getting error:

[vite] Error when evaluating SSR module /app/root.tsx: failed to import "@mui/material"
|- /home/projects/github-ctaqne-71kwv1/node_modules/@mui/material/index.js:9
import * as colors from './colors';
^^^^^^

SyntaxError: Cannot use import statement outside a module

I've taken a popular template kiliman/remix-vite-mui and followed all steps in the migration path to replace emotion with pigment, including using the updated instructions for the next beta release

Here's my upgraded version of the template - hopefully something I've just done wrong, and if so any pointers on how to fix would be greatly appreciated!

@endaquigley
Copy link

I'm having issues using MUI v6 Beta w/ Pigment CSS in a Remix project. I'm getting error:

[vite] Error when evaluating SSR module /app/root.tsx: failed to import "@mui/material"
|- /home/projects/github-ctaqne-71kwv1/node_modules/@mui/material/index.js:9
import * as colors from './colors';
^^^^^^

SyntaxError: Cannot use import statement outside a module

I've taken a popular template kiliman/remix-vite-mui and followed all steps in the migration path to replace emotion with pigment, including using the updated instructions for the next beta release

Here's my upgraded version of the template - hopefully something I've just done wrong, and if so any pointers on how to fix would be greatly appreciated!

Same error with my Remix app. I wasn't sure if it was a Remix or Vite issue at the time.

@rossipedia
Copy link

rossipedia commented Aug 19, 2024

@sdriffill-tm @endaquigley I dunno if you can call this a full fledged "starter", but here's a Remix repo I set up where I got MUI6 and Pigment working:

https://github.com/rossipedia/remix-mui-6

Maybe it can help get y'all unstuck 👍

@endaquigley
Copy link

@rossipedia thanks for your help. I noticed that your components aren't rendering as expected either:

Screenshot 2024-08-19 at 14 56 10

I'm guessing that's related to this comment #30660 (comment)

@DiegoAndai
Copy link
Member

Hey @xml, @sdriffill-tm, and @endaquigley! Thanks for the reports. May I ask you to create separate issues for these? This way, it will be easier to track, debug, and respond to 😊

@rossipedia
Copy link

rossipedia commented Aug 20, 2024

@endaquigley wow you're right. it was working perfectly with beta 2 🤔. It also works as expected in Production, it's just npm run dev that's not working right. Hmmm....

@DiegoAndai
Copy link
Member

Material UI v6 is stable! 🚀

Thanks, everyone, for contributing to the discussion. Hopefully, you can try the new major and provide feedback. If you have any issues or suggestions, please create separate issues to track those 😊.

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@DiegoAndai DiegoAndai unpinned this issue Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change discussion package: material-ui Specific to @mui/material umbrella For grouping multiple issues to provide a holistic view v6.x
Projects
Status: Done
Development

No branches or pull requests