22import React , { useMemo } from "react" ;
33import type { ReactNode } from "react" ;
44import { breakpointValues , breakpointValuesUnit } from "./lib/generatedFromCss/breakpoints" ;
5- import type { Theme as MuiTheme } from "@mui/material/styles" ;
5+ import type { Theme as MuiTheme , ThemeOptions } from "@mui/material/styles" ;
66import { createTheme , ThemeProvider as MuiThemeProvider } from "@mui/material/styles" ;
77import { getColors } from "./lib/colors" ;
88import { useIsDark } from "./lib/darkMode" ;
@@ -15,12 +15,16 @@ import defaultMuiShadows from "@mui/material/styles/shadows";
1515import type { Shadows } from "@mui/material/styles" ;
1616import { id } from "tsafe/id" ;
1717
18- function createMuiDsfrTheme ( params : { isDark : boolean } ) : MuiTheme {
18+ export interface MuiDsfrThemeParams {
19+ isDark : boolean ;
20+ }
21+
22+ export function getMuiDsfrThemeOptions ( params : MuiDsfrThemeParams ) : ThemeOptions {
1923 const { isDark } = params ;
2024
2125 const { options, decisions } = getColors ( isDark ) ;
2226
23- const muiTheme = createTheme ( {
27+ return {
2428 "shape" : {
2529 "borderRadius" : 0
2630 } ,
@@ -229,7 +233,13 @@ function createMuiDsfrTheme(params: { isDark: boolean }): MuiTheme {
229233 return nonTypedMuiComponents as any as { } ;
230234 } ) ( )
231235 }
232- } ) ;
236+ } ;
237+ }
238+
239+ export function createMuiDsfrTheme ( params : MuiDsfrThemeParams , ...args : object [ ] ) : MuiTheme {
240+ const options = getMuiDsfrThemeOptions ( params ) ;
241+
242+ const muiTheme = createTheme ( options , ...args ) ;
233243
234244 return muiTheme ;
235245}
0 commit comments