13
13
import type { ColorScheme , Router } from '@react-types/provider' ;
14
14
import { colorScheme , UnsafeStyles } from './style-utils' with { type : 'macro' } ;
15
15
import { createContext , JSX , ReactNode , useContext } from 'react' ;
16
+ import { generateDefaultColorSchemeStyles } from './page.macro' with { type : 'macro' } ;
16
17
import { I18nProvider , RouterProvider , useLocale } from 'react-aria-components' ;
17
18
import { mergeStyles } from '../style/runtime' ;
18
19
import { style } from '../style/spectrum-theme' with { type : 'macro' } ;
@@ -52,7 +53,7 @@ export const ColorSchemeContext = createContext<ColorScheme | 'light dark' | nul
52
53
export function Provider ( props : ProviderProps ) {
53
54
let result = < ProviderInner { ...props } /> ;
54
55
let parentColorScheme = useContext ( ColorSchemeContext ) ;
55
- let colorScheme = props . colorScheme || parentColorScheme || 'light dark' ;
56
+ let colorScheme = props . colorScheme || parentColorScheme ;
56
57
if ( colorScheme !== parentColorScheme ) {
57
58
result = < ColorSchemeContext . Provider value = { colorScheme } > { result } </ ColorSchemeContext . Provider > ;
58
59
}
@@ -68,6 +69,8 @@ export function Provider(props: ProviderProps) {
68
69
return result ;
69
70
}
70
71
72
+ generateDefaultColorSchemeStyles ( ) ;
73
+
71
74
let providerStyles = style ( {
72
75
...colorScheme ( ) ,
73
76
'--s2-container-bg' : {
@@ -80,7 +83,14 @@ let providerStyles = style({
80
83
}
81
84
}
82
85
} ,
83
- backgroundColor : '--s2-container-bg'
86
+ backgroundColor : {
87
+ // Don't set a background unless one is requested.
88
+ background : {
89
+ base : '--s2-container-bg' ,
90
+ 'layer-1' : '--s2-container-bg' ,
91
+ 'layer-2' : '--s2-container-bg'
92
+ }
93
+ }
84
94
} ) ;
85
95
86
96
function ProviderInner ( props : ProviderProps ) {
0 commit comments