From bf891feebee5473be8ee2795878950f186dd75d7 Mon Sep 17 00:00:00 2001 From: Diego Andai Date: Fri, 29 Dec 2023 10:47:23 -0300 Subject: [PATCH] [material-next][theme] Move ref palette out of color schemes (#40341) --- docs/pages/experiments/md3/buttons.tsx | 13 ++----------- .../mui-material-next/src/styles/Theme.types.ts | 4 +--- .../mui-material-next/src/styles/extendTheme.ts | 4 ++-- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/docs/pages/experiments/md3/buttons.tsx b/docs/pages/experiments/md3/buttons.tsx index 8128c2de82628e..2ccfc177c59306 100644 --- a/docs/pages/experiments/md3/buttons.tsx +++ b/docs/pages/experiments/md3/buttons.tsx @@ -201,17 +201,8 @@ function DemoComponents() { // custom MD3 theme const cssVarsTheme = extendTheme({ - colorSchemes: { - light: { - ref: { - palette: customPalette, - }, - }, - dark: { - ref: { - palette: customPalette, - }, - }, + ref: { + palette: customPalette, }, }); diff --git a/packages/mui-material-next/src/styles/Theme.types.ts b/packages/mui-material-next/src/styles/Theme.types.ts index 50b9e6ff480c90..f79e033251b433 100644 --- a/packages/mui-material-next/src/styles/Theme.types.ts +++ b/packages/mui-material-next/src/styles/Theme.types.ts @@ -239,6 +239,7 @@ export interface Motion { export interface MD3CssVarsThemeOptions extends Omit { ref?: { typeface?: Partial; + palette?: Partial; }; sys?: { typescale?: Partial; @@ -250,9 +251,6 @@ export interface MD3CssVarsThemeOptions extends Omit; - }; sys?: { color?: Partial; elevation?: string[]; diff --git a/packages/mui-material-next/src/styles/extendTheme.ts b/packages/mui-material-next/src/styles/extendTheme.ts index 861ba9150d1d56..790ce6a791c4a4 100644 --- a/packages/mui-material-next/src/styles/extendTheme.ts +++ b/packages/mui-material-next/src/styles/extendTheme.ts @@ -90,7 +90,7 @@ export default function extendTheme(options: CssVarsThemeOptions = {}, ...args: ref: { ...input.ref, typeface, - palette: deepmerge(md3CommonPalette, colorSchemesInput.light?.ref?.palette), + palette: deepmerge(md3CommonPalette, input.ref?.palette), }, sys: { ...input.sys, @@ -121,7 +121,7 @@ export default function extendTheme(options: CssVarsThemeOptions = {}, ...args: ref: { ...input.ref, typeface, - palette: deepmerge(md3CommonPalette, colorSchemesInput.dark?.ref?.palette), + palette: deepmerge(md3CommonPalette, input.ref?.palette), }, sys: { ...input.sys,