-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
[bug] invalid typings for createTheme
#170
Comments
Thank you everyone for your great progress on PigmentCSS. |
@o-alexandrov can you provide a link to a live example? e.g. Codesandbox |
@aarongarciah please refer to the attached GitHub repo at the top of the description |
@o-alexandrov I saw it, but the link text says "Link to live example", but that's not the case. Whenever possible, we ask for a live example, as stated in the steps when opening a bug report: Is there a reason why you can't provide a live example? |
@siriwatknp pinging you in case you can have a look. |
Vite has deps optimization that does not work with Pigment CSS This is the vite config that work so far: import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { pigment } from '@pigment-css/vite-plugin'
import { extendTheme, stringifyTheme } from '@mui/material/styles'
const theme = extendTheme();
// @ts-expect-error ignore
theme.toRuntimeSource = stringifyTheme;
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
include: [
"prop-types",
"react-is",
"hoist-non-react-statics",
"react",
"react-dom",
'@emotion/react',
'@emotion/styled',
],
exclude: ["@mui/material"],
},
plugins: [
react(),
pigment({
theme,
transformLibraries: ["@pigment-css/react", "@mui/material"],
}),
],
}) Note: this is a workaround to get the app working, need mui/material-ui#169 to be released. |
@siriwatknp @aarongarciah Updated the repro. Related issue #180 There are issues:
|
True, I just reproduced it.
This is not a bug. const themeRaw = extendTheme({
components: {
MuiFab: {
styleOverrides: {
- extended: {
- borderRadius: 12,
- },
root: {
background: `red !important`,
+ variants:[{
+ props: { variant: 'extended' },
+ style: { borderRadius: 12 }
+ }]
},
},
},
},
});
True, I just reproduced it. @siriwatknp can you have a look? |
@aarongarciah
|
I'm beginning to get this exact error: |
How do I exclude libraries which make building stuck until you make this production ready? |
@aarongarciah I have a custom theme with lots of overrides for both variants and slots in many createTheme({
components: {
MuiPaper: {
styleOverrides: {
elevation: ({ theme }) => ({
boxShadow: "0px 9px 16px rgb(176 176 176 / 18%), 0px 2px 2px rgb(176 176 176 / 32%)",
}),
}
}
}
}) At first glance, it seems impossible to distinguish variant overrides from slot overrides, so it will be very time-consuming to figure out one-by-one which override to migrate to the Is there a way to handle this better? Are there any plans to make |
extendTheme
doesn't work w/ pigment
createTheme
@aarongarciah @siriwatknp I created a new repro example based on your vite example app. The current issue here is based on typings, so I cleaned up the description:
@marvinruder apologies for closing the issue. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @o-alexandrov How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Thanks @o-alexandrov! We'll continue in the new issue. |
Steps to reproduce
Link to live example
Steps:
npm ci
src/theme.ts
extended
prop and doesn't enforce you to migrate to the new way of declaring variants. (see screenshot).Current behavior
extendTheme
doesn't change the styles of themui.Fab
Expected behavior
extendTheme
affectsmui.Fab
Context
Your environment
npx @mui/envinfo
Search keywords: pigment, extendTheme
Search keywords:
The text was updated successfully, but these errors were encountered: