File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ const RootStyles = () =>
37
37
} ,
38
38
} )
39
39
40
- interface ThemeProviderProps extends Pick < CoreThemeProviderProps , 'theme' > {
40
+ export interface ThemeProviderProps
41
+ extends Pick < CoreThemeProviderProps , 'theme' > {
41
42
children ?: React . ReactNode
42
43
}
43
44
Original file line number Diff line number Diff line change 4
4
type ThemeUIStyleObject ,
5
5
} from '@theme-ui/core'
6
6
import React from 'react'
7
+ import BaseThemeProvider , {
8
+ type ThemeProviderProps ,
9
+ } from '@theme-ui/theme-provider'
7
10
export {
8
11
__ThemeUIContext ,
9
12
merge ,
@@ -28,10 +31,21 @@ export type {
28
31
StylePropertyValue ,
29
32
} from '@theme-ui/core'
30
33
export { useColorMode , InitializeColorMode } from '@theme-ui/color-modes'
31
- export { ThemeProvider } from '@theme-ui/theme-provider'
32
34
export * from '@theme-ui/components'
33
35
export { css , get } from '@theme-ui/css'
34
36
37
+ /** @deprecated This export has been renamed ThemeUIProvider */
38
+ export function ThemeProvider (
39
+ props : ThemeProviderProps
40
+ ) : typeof BaseThemeProvider {
41
+ console . warn (
42
+ '[theme-ui] The export <ThemeProvider> is deprecated; it’s now called ThemeUIProvider to reduce confusion. Please update your imports.'
43
+ )
44
+ return React . createElement ( BaseThemeProvider , props )
45
+ }
46
+
47
+ export { BaseThemeProvider as ThemeUIProvider }
48
+
35
49
export const BaseStyles = (
36
50
props : Record < string , unknown > & { sx ?: ThemeUIStyleObject }
37
51
) : JSX . Element =>
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ import mockConsole from 'jest-mock-console'
8
8
import { fireEvent , render , renderJSON } from '@theme-ui/test-utils'
9
9
10
10
import {
11
- ThemeProvider ,
11
+ ThemeProvider as DeprecatedThemeProvider ,
12
+ ThemeUIProvider as ThemeProvider ,
12
13
jsx ,
13
14
BaseStyles ,
14
15
Theme ,
@@ -50,6 +51,17 @@ test('warns when multiple versions of emotion are installed', () => {
50
51
restore ( )
51
52
} )
52
53
54
+ test ( 'warns deprecated ThemeProvider' , ( ) => {
55
+ const restore = mockConsole ( )
56
+ render (
57
+ < DeprecatedThemeProvider >
58
+ < div />
59
+ </ DeprecatedThemeProvider >
60
+ )
61
+ expect ( console . warn ) . toHaveBeenCalled ( )
62
+ restore ( )
63
+ } )
64
+
53
65
test ( 'functional themes receive outer theme' , ( ) => {
54
66
const outer : Theme = {
55
67
config : {
You can’t perform that action at this time.
0 commit comments