Skip to content

[pickers] Pass the generics to the components in the theme augmentation #5199

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

Conversation

toruticas
Copy link
Contributor

@toruticas toruticas commented Jun 14, 2022

This pull request drills the base theme by using the generic of ComponentsOverrides.

Motivation:
When overriding global themes, I want to use the override values of the palette, but once the type definition of date picker components doesn't pass by the base theme, the theme will always be considered unknown.

const theme = createTheme({
  palette: {
    primary: {
      main: purple[500]
    }
  },
  components: {
    MuiCalendarPicker: {
      styleOverrides: {
        root: ({ theme }) => ({
          backgroundColor: theme.palette.primary.main
          //               /\ (parameter) theme: unknown
        })
      }
    }
  }
});

I've also created an example of this issue with code sandbox: https://codesandbox.io/s/elated-violet-1u5qvc?file=/src/App.tsx

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…ntation
Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Make total sense
Thanks for your contribution !

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…y-of-base-theme-to-the-components-theme-augmentation
@cherniavskii
Copy link
Member

Should we do the same for the data grid?

export interface DataGridComponents {

@flaviendelangle
Copy link
Member

@cherniavskii yeah probably

@toruticas
Copy link
Contributor Author

I'm unfamiliar with the data grid component, but I'll work on it this weekend. Should I create a new PR or add to this one?

Btw guys, what should I do to merge this PR?

@flaviendelangle
Copy link
Member

@toruticas the CI seems to have a problem, could you rebase on the master branch to see if the CI is passing ?
But yes as soon as the CI is green let's merge it
And do the DataGrid on another one

toruticas and others added 2 commits July 4, 2022 17:34

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…se-theme-to-the-components-theme-augmentation

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
to trigger the CI
@mui-bot
Copy link

mui-bot commented Jul 5, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 278 500.5 308.1 360.92 83.218
Sort 100k rows ms 495.4 970.2 775.4 721.8 171.333
Select 100k rows ms 115.9 199.9 182.9 167.34 31.431
Deselect 100k rows ms 111.5 217.7 163.8 164.56 36.33

Generated by 🚫 dangerJS against 3add5cf

@flaviendelangle flaviendelangle merged commit d6adde4 into mui:master Jul 5, 2022
@flaviendelangle flaviendelangle changed the title [date picker] add pass by of base theme to the components theme augme… [date picker] Pass the generics to the components in the theme augmentation Jul 5, 2022
@flaviendelangle flaviendelangle changed the title [date picker] Pass the generics to the components in the theme augmentation [pickers] Pass the generics to the components in the theme augmentation Jul 5, 2022
cherniavskii pushed a commit to cherniavskii/mui-x that referenced this pull request Jul 6, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
joserodolfofreitas pushed a commit to joserodolfofreitas/mui-x that referenced this pull request Jul 15, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
alexfauquette pushed a commit to alexfauquette/mui-x that referenced this pull request Aug 26, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants