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.
- package/dist/index.js +10092 -6744
- package/dist/theme/common/themeCommon.d.ts +629 -7
- package/dist/theme/dark/darkColour.d.ts +144 -0
- package/dist/theme/dark/darkTheme.d.ts +3 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/light/lightColour.d.ts +29 -11
- package/dist/theme/original/defaultTheme.d.ts +29 -49
- package/dist/theme/original/originalColourNewStructure.d.ts +29 -11
- package/dist/theme/useTheme.d.ts +59 -98
- package/lib/components/Button/style/buttonPrimarySubtleStyle.ts +3 -3
- package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +4 -4
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +93 -93
- package/lib/components/Calendar/subcomponents/Day.tsx +45 -35
- package/lib/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/lib/components/Snackbar/Snackbar.tsx +4 -4
- package/lib/components/Snackbar/__tests__/__snapshots__/Snackbar.test.tsx.snap +4 -4
- package/lib/components/Toggle/Toggle.tsx +4 -4
- package/lib/theme/__tests__/useTheme.test.tsx +28 -0
- package/lib/theme/common/themeCommon.ts +162 -142
- package/lib/theme/dark/darkColour.ts +260 -0
- package/lib/theme/dark/darkTheme.ts +38 -0
- package/lib/theme/index.ts +1 -0
- package/lib/theme/light/lightColour.ts +76 -17
- package/lib/theme/light/lightTheme.ts +2 -2
- package/lib/theme/original/defaultTheme.ts +2 -2
- package/lib/theme/original/originalColourNewStructure.ts +34 -20
- package/lib/theme/useTheme.tsx +22 -9
- package/package.json +2 -2
package/lib/theme/useTheme.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
|
|
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.
|
|
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
|
|
46
|
+
"design-system-foundations-public": "0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^19.0.0",
|