-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[system] Support callback value in styleOverrides
slot
#30524
Merged
Merged
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
14c0324
pass ownerState as props to styleOverrides callback
siriwatknp 9eba2cf
add callback types to styleOverrides
siriwatknp b02f6cb
add styleOverrides callback type support for lab
siriwatknp 13838ea
add styleOverrides callback docs
siriwatknp 27e330f
add deprecation
siriwatknp 1fab8ca
fix useThemeProps type
siriwatknp d83b76f
fix browser test
siriwatknp 6d626e8
shut off auto exporting
siriwatknp 943e3cb
add additional unknown props to ease customization
siriwatknp 08bee1b
add more tests
siriwatknp 43956fe
fix typo
siriwatknp 1925f48
Merge branch 'master' of https://github.com/mui-org/material-ui into …
siriwatknp 19cb837
Merge branch 'master' of https://github.com/mui-org/material-ui into …
siriwatknp de46f74
use ownerState
siriwatknp 052dcf2
remove unnecessary comment
siriwatknp 925abcf
Apply suggestions from code review
siriwatknp 296327b
add module augmentation test
siriwatknp 14502fa
add comments
siriwatknp dafe8d7
fix lint
siriwatknp 8d7fc2e
Merge branch 'master' of https://github.com/mui-org/material-ui into …
siriwatknp d8bf232
support styleOverridesCallback for Joy
siriwatknp 03db4af
add sx support test
siriwatknp b018e67
add using with sx docs
siriwatknp b85903e
call if styleOverrides is a function in nested class
siriwatknp 90701bb
yarn docs formatted
siriwatknp 373e566
remove non-slot from Joy components
siriwatknp 5b1721a
remove test variant from Joy component tests
siriwatknp cf9227a
Revert "call if styleOverrides is a function in nested class"
siriwatknp 4791add
make nested class works with callback
siriwatknp 2122360
Update docs/src/pages/customization/theme-components/theme-components.md
siriwatknp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
docs/src/pages/customization/theme-components/GlobalThemeOverrideCallback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||
import Box from '@mui/material/Box'; | ||
import Slider, { sliderClasses } from '@mui/material/Slider'; | ||
|
||
const finalTheme = createTheme({ | ||
components: { | ||
MuiSlider: { | ||
styleOverrides: { | ||
valueLabel: ({ orientation, theme }) => ({ | ||
...(orientation === 'vertical' && { | ||
backgroundColor: 'transparent', | ||
color: theme.palette.grey[500], | ||
fontWeight: 700, | ||
padding: 0, | ||
left: '2rem', | ||
}), | ||
[`&.${sliderClasses.valueLabelOpen}`]: { | ||
transform: 'none', | ||
top: 'initial', | ||
}, | ||
}), | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
function valuetext(value) { | ||
return `${value}°C`; | ||
} | ||
|
||
export default function GlobalThemeOverride() { | ||
return ( | ||
<ThemeProvider theme={finalTheme}> | ||
<Box sx={{ height: 180, display: 'inline-block' }}> | ||
<Slider | ||
getAriaLabel={() => 'Temperature'} | ||
orientation="vertical" | ||
getAriaValueText={valuetext} | ||
defaultValue={[25, 50]} | ||
marks={[ | ||
{ value: 0 }, | ||
{ value: 25 }, | ||
{ value: 50 }, | ||
{ value: 75 }, | ||
{ value: 100 }, | ||
]} | ||
valueLabelFormat={valuetext} | ||
valueLabelDisplay="on" | ||
/> | ||
</Box> | ||
</ThemeProvider> | ||
); | ||
} |
54 changes: 54 additions & 0 deletions
54
docs/src/pages/customization/theme-components/GlobalThemeOverrideCallback.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||
import Box from '@mui/material/Box'; | ||
import Slider, { sliderClasses } from '@mui/material/Slider'; | ||
|
||
const finalTheme = createTheme({ | ||
components: { | ||
MuiSlider: { | ||
styleOverrides: { | ||
valueLabel: ({ orientation, theme }) => ({ | ||
...(orientation === 'vertical' && { | ||
backgroundColor: 'transparent', | ||
color: theme.palette.grey[500], | ||
fontWeight: 700, | ||
padding: 0, | ||
left: '2rem', | ||
}), | ||
[`&.${sliderClasses.valueLabelOpen}`]: { | ||
transform: 'none', | ||
top: 'initial', | ||
}, | ||
}), | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
function valuetext(value: number) { | ||
return `${value}°C`; | ||
} | ||
|
||
export default function GlobalThemeOverride() { | ||
return ( | ||
<ThemeProvider theme={finalTheme}> | ||
<Box sx={{ height: 180, display: 'inline-block' }}> | ||
<Slider | ||
getAriaLabel={() => 'Temperature'} | ||
orientation="vertical" | ||
getAriaValueText={valuetext} | ||
defaultValue={[25, 50]} | ||
marks={[ | ||
{ value: 0 }, | ||
{ value: 25 }, | ||
{ value: 50 }, | ||
{ value: 75 }, | ||
{ value: 100 }, | ||
]} | ||
valueLabelFormat={valuetext} | ||
valueLabelDisplay="on" | ||
/> | ||
</Box> | ||
</ThemeProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
Default props
up