uikit-react-public 0.32.4 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,13 @@ import { Global, css } from '@emotion/react';
3
3
  import { ThemeType } from './original/defaultTheme';
4
4
  import theme from './original/defaultTheme';
5
5
  import lightTheme from './light/lightTheme';
6
+ import darkTheme from './dark/darkTheme';
6
7
  import { uikitFontUrls } from './fonts';
7
8
 
8
9
  export const themes = {
9
10
  default: theme as ThemeType,
10
11
  light: lightTheme as ThemeType,
11
- // dark: darkTheme as ThemeType, // does not exist yet
12
+ dark: darkTheme as ThemeType,
12
13
  } as const;
13
14
 
14
15
  export type ThemeName = keyof typeof themes;
@@ -91,18 +92,30 @@ const fontFaces = css`
91
92
  }
92
93
  `;
93
94
 
95
+ const globalThemeStyles = (activeTheme: ThemeType) => css`
96
+ html,
97
+ body,
98
+ #root {
99
+ background-color: ${activeTheme.colour.bg.brand};
100
+ color: ${activeTheme.colour.text.default};
101
+ }
102
+ `;
103
+
94
104
  export const ThemeContextProvider: React.FC<{
95
105
  children: ReactNode;
96
106
  theme?: ThemeType | ThemeName;
97
107
  initialTheme?: ThemeType;
98
- }> = ({ children, theme, initialTheme }) => (
99
- <ThemeContext.Provider
100
- value={useThemeState(initialTheme ?? resolveTheme(theme))}
101
- >
102
- <Global styles={fontFaces} />
103
- {children}
104
- </ThemeContext.Provider>
105
- );
108
+ }> = ({ children, theme, initialTheme }) => {
109
+ const themeState = useThemeState(initialTheme ?? resolveTheme(theme));
110
+ const [activeTheme] = themeState;
111
+
112
+ return (
113
+ <ThemeContext.Provider value={themeState}>
114
+ <Global styles={[fontFaces, globalThemeStyles(activeTheme)]} />
115
+ {children}
116
+ </ThemeContext.Provider>
117
+ );
118
+ };
106
119
 
107
120
  const useTheme = () => {
108
121
  const value = useContext(ThemeContext);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit-react-public",
3
3
  "private": false,
4
4
  "license": "UNLICENSED",
5
- "version": "0.32.4",
5
+ "version": "0.36.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "@emotion/css": "^11.13.5",
44
44
  "@emotion/react": "^11.14.0",
45
45
  "@floating-ui/react-dom": "^2.1.2",
46
- "design-system-foundations-public": "0.0.40"
46
+ "design-system-foundations-public": "0.1.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.0.0",