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

[zero] Use theme.applyStyles in the demo app #40787

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/zero-runtime-next-app/src/augment.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { experimental_extendTheme } from '@mui/material/styles';
import type { Theme } from '@mui/material/styles';
import type {} from '@mui/material/themeCssVarsAugmentation';
import '@mui/zero-runtime/theme';

declare module '@mui/zero-runtime/theme' {
export interface ThemeArgs {
theme: ReturnType<typeof experimental_extendTheme> & {
applyDarkStyles<T>(obj: T): Record<string, T>;
theme: Omit<Theme, 'applyStyles'> & {
applyStyles: (
colorScheme: 'light' | 'dark',
styles: Record<string, any>,
) => Record<string, any>;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const SliderTrack = styled('span', {
},
style: {
'--slider-track-color': lightPrimaryColor,
...theme.applyDarkStyles({
...theme.applyStyles('dark', {
'--slider-track-color': darkPrimaryColor,
}),
},
Expand All @@ -242,7 +242,7 @@ const SliderTrack = styled('span', {
},
style: {
'--slider-track-color': lightSecondaryColor,
...theme.applyDarkStyles({
...theme.applyStyles('dark', {
'--slider-track-color': darkSecondaryColor,
}),
},
Expand Down Expand Up @@ -686,7 +686,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr

const ownerState: SliderOwnerState = {
...props,
// @ts-expect-error @TODO - Figure out how to support rtl/ltr with themes
isRtl,
max,
min,
Expand Down Expand Up @@ -761,7 +760,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
},
ownerState: {
...ownerState,
// @ts-expect-error
...rootSlotProps?.ownerState,
},
className: [classes.root, className],
Expand All @@ -785,7 +783,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
},
ownerState: {
...ownerState,
// @ts-expect-error
...trackSlotProps?.ownerState,
},
className: classes.track,
Expand All @@ -797,7 +794,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
externalSlotProps: thumbSlotProps,
ownerState: {
...ownerState,
// @ts-expect-error
...thumbSlotProps?.ownerState,
},
className: classes.thumb,
Expand All @@ -808,7 +804,6 @@ const Slider = React.forwardRef<HTMLSpanElement, SliderProps>(function Slider(pr
externalSlotProps: valueLabelSlotProps,
ownerState: {
...ownerState,
// @ts-expect-error
...valueLabelSlotProps?.ownerState,
},
className: classes.valueLabel,
Expand Down
Loading