@webpros/mui-theme 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -1,48 +1,33 @@
1
- # WebPros MUI Theme
1
+ # About
2
2
 
3
3
  MUI theme based on MUI V6 and Material Design V3.
4
4
 
5
- - [WebPros Dashboard Designs](https://www.figma.com/design/RPLeGa2LdhKElQQ0xIXtSh/WebPros-dashboard)
6
- - [Material UI V3 Components](https://www.figma.com/design/RPLeGa2LdhKElQQ0xIXtSh/WebPros-dashboard?node-id=55879-3580&p=f&t=ZtD7nKr7T1SgHTdl-0)
5
+ - [Repository - webpros-dashboard/webpros-mui-theme](https://github.com/webpros-dashboard/webpros-mui-theme)
6
+ - [Designs - Figma](https://www.figma.com/design/RPLeGa2LdhKElQQ0xIXtSh/WebPros-dashboard?node-id=55879-3580&p=f&t=ZtD7nKr7T1SgHTdl-0)
7
7
 
8
8
  # Installation
9
9
 
10
- Install the package in your project with:
10
+ Ensure your `package.json` includes `peerDependecies` of the current package.
11
11
 
12
- ```shell
13
- yarn add @webpros/webpros-material-library
14
- ```
12
+ Install the package in your project with:
15
13
 
16
- Ensure your `package.json` includes
17
-
18
- ```json
19
- {
20
- "dependencies": {
21
- // Other deps
22
- "@material/material-color-utilities": "^0.3.0",
23
- "@mui/material": "^6.4.0",
24
- "@mui/utils": "^6.4.0",
25
- "@mui/x-data-grid": "^7.29.0",
26
- "@mui/x-date-pickers": "^7.29.0",
27
- "@phosphor-icons/react": "^2.1.0"
28
- // Other deps
29
- }
30
- }
14
+ ```bash
15
+ yarn add @webpros/mui-theme
31
16
  ```
32
17
 
33
18
  # Usage
34
19
 
35
- 1. Add the type import at the top of your main application file or theme setup file. This import is required for MUI TypeScript augmentation to work correctly:
20
+ 1. **Add the type import at the top of your main application file or theme setup file. This import is required for MUI TypeScript augmentation to work correctly:**
36
21
 
37
22
  ```typescript
38
23
  // global.d.ts
39
- import type _ from '@webpros/webpros-material-library';
24
+ import type _ from '@webpros/@webpros/mui-theme';
40
25
  ```
41
26
 
42
- 2. Create new wrapper-component for the theme provider
27
+ 2. **Create new wrapper-component for the theme provider**
43
28
 
44
29
  ```tsx
45
- import { getMuiLocaleByCode, WebProsMuiThemeProvider } from '@webpros/webpros-material-library';
30
+ import { getMuiLocaleByCode, WebProsMuiThemeProvider } from '@webpros/mui-theme';
46
31
  import { StyledEngineProvider } from '@mui/material/styles';
47
32
  import { Localization } from '@mui/material/locale';
48
33
  import { ReactNode, useMemo } from 'react';
@@ -78,7 +63,7 @@ export const WebprosThemeProvider = ({ children }: WebprosThemeProviderProps) =>
78
63
  };
79
64
  ```
80
65
 
81
- 3. Wrap your application with `WebprosThemeProvider`
66
+ 3. **Wrap your application with `WebprosThemeProvider`**
82
67
 
83
68
  ```tsx
84
69
  const App = () => (
@@ -91,13 +76,5 @@ const App = () => (
91
76
  4. **Use imports from `@mui/material` for components**
92
77
 
93
78
  ```tsx
94
- import { Box } from '@mui/material'; // NOT import { Box } from '@webpros/webpros-material-library';
79
+ import { Box } from '@mui/material'; // NOT import { Box } from '@webpros/mui-theme';
95
80
  ```
96
-
97
- # Releases
98
-
99
- The release cycle will be available soon
100
-
101
- # Contributing
102
-
103
- The contributing guide will be available soon
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@webpros/mui-theme",
3
+ "description": "MUI v6 theme for WebPros products",
4
+ "version": "0.1.6",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webpros-dashboard/webpros-mui-theme.git"
9
+ },
10
+ "keywords": [
11
+ "react",
12
+ "mui",
13
+ "theme",
14
+ "theming",
15
+ "ui"
16
+ ],
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/src/index.js",
22
+ "types": "./dist/src/index.d.ts"
23
+ }
24
+ },
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "private": false,
31
+ "engines": {
32
+ "node": "^22.x",
33
+ "npm": "please-use-yarn",
34
+ "yarn": "^1.22.0"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
38
+ "storybook:dev": "storybook dev -p 6006",
39
+ "storybook:build": "storybook build",
40
+ "test": "npm run prettier:test && npm run lint && npm run typecheck",
41
+ "lint": "npm run eslint",
42
+ "eslint": "eslint",
43
+ "prettier:test": "prettier --check \"**/*.{ts,tsx}\"",
44
+ "prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
45
+ "typecheck": "tsc --noEmit"
46
+ },
47
+ "peerDependencies": {
48
+ "@emotion/react": "^11.14.0",
49
+ "@emotion/styled": "^11.14.1",
50
+ "@fontsource/roboto": "^5.2.6",
51
+ "@material/material-color-utilities": "^0.3.0",
52
+ "@mui/material": "^6.4.0",
53
+ "@mui/utils": "^6.4.0",
54
+ "@mui/x-data-grid": "^7.29.0",
55
+ "@mui/x-date-pickers": "^7.29.0",
56
+ "@phosphor-icons/react": "^2.1.0",
57
+ "usehooks-ts": "^3.1.1"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public",
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
63
+ "devDependencies": {
64
+ "@emotion/react": "^11.14.0",
65
+ "@emotion/styled": "^11.14.1",
66
+ "@eslint/js": "^9.38.0",
67
+ "@fontsource/roboto": "^5.2.6",
68
+ "@material/material-color-utilities": "^0.3.0",
69
+ "@mui/material": "^6.4.0",
70
+ "@mui/utils": "^6.4.0",
71
+ "@mui/x-data-grid": "^7.29.0",
72
+ "@mui/x-date-pickers": "^7.29.0",
73
+ "@phosphor-icons/react": "^2.1.0",
74
+ "@storybook/addon-a11y": "^9.1.16",
75
+ "@storybook/addon-docs": "^9.1.16",
76
+ "@storybook/addon-onboarding": "^9.1.16",
77
+ "@storybook/addon-themes": "^9.1.16",
78
+ "@storybook/builder-vite": "^9.1.16",
79
+ "@storybook/react-vite": "^9.1.16",
80
+ "@stylistic/eslint-plugin": "^5.5.0",
81
+ "@types/node": "^24.8.1",
82
+ "@types/react": "^19.2.2",
83
+ "@types/react-dom": "^19.2.2",
84
+ "@vitejs/plugin-react": "^5.0.4",
85
+ "eslint": "^9.38.0",
86
+ "eslint-config-prettier": "^10.1.8",
87
+ "eslint-plugin-prettier": "^5.5.4",
88
+ "eslint-plugin-react": "^7.37.5",
89
+ "eslint-plugin-react-hooks": "^7.0.0",
90
+ "eslint-plugin-storybook": "^9.1.16",
91
+ "globals": "^16.4.0",
92
+ "prettier": "^3.6.2",
93
+ "react": "^18.3.1",
94
+ "react-dom": "^18.3.1",
95
+ "storybook": "^9.1.16",
96
+ "tsc-alias": "^1.8.16",
97
+ "typescript": "~5.9.3",
98
+ "typescript-eslint": "^8.46.1",
99
+ "vite": "^7.1.10",
100
+ "vite-plugin-dts": "^4.5.4",
101
+ "usehooks-ts": "^3.1.1"
102
+ },
103
+ "browserslist": [
104
+ "last 2 versions",
105
+ ">1%",
106
+ "not dead",
107
+ "not op_mini all"
108
+ ],
109
+ "eslintConfig": {
110
+ "extends": [
111
+ "plugin:storybook/recommended"
112
+ ]
113
+ }
114
+ }
@@ -16,8 +16,8 @@ declare module '@mui/material/Button' {
16
16
  }
17
17
  interface M3Button {
18
18
  MuiButton: {
19
- defaultProps?: ComponentsProps['MuiButton'];
20
- styleOverrides?: ComponentsOverrides<Theme>['MuiButton'];
19
+ defaultProps?: ComponentsProps['MuiButtonBase'];
20
+ styleOverrides?: ComponentsOverrides<Theme>['MuiButtonBase'];
21
21
  variants?: ComponentsVariants['MuiButton'];
22
22
  };
23
23
  }
@@ -0,0 +1,34 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const underlineTypographySxProps: (theme: Theme, open?: boolean, color?: string | null) => {
3
+ textDecoration?: string | undefined;
4
+ textUnderlineOffset?: string | undefined;
5
+ textDecorationColor?: string | null | undefined;
6
+ textDecorationThickness?: number | undefined;
7
+ cursor: string;
8
+ '&:hover': {
9
+ textDecoration: string;
10
+ textUnderlineOffset: string;
11
+ textDecorationColor: string | null;
12
+ textDecorationThickness: number;
13
+ };
14
+ };
15
+ export declare const underlineBorderSxProps: (theme: Theme, open?: boolean, color?: string | null) => {
16
+ '&::after'?: {
17
+ bottom: number;
18
+ position: string;
19
+ content: string;
20
+ borderBottom: number;
21
+ borderColor: string | null;
22
+ width: string;
23
+ } | undefined;
24
+ cursor: string;
25
+ position: string;
26
+ '&:hover::after': {
27
+ bottom: number;
28
+ position: string;
29
+ content: string;
30
+ borderBottom: number;
31
+ borderColor: string | null;
32
+ width: string;
33
+ };
34
+ };
@@ -0,0 +1,33 @@
1
+ // Copyright 2025 WebPros International GmbH. All rights reserved.
2
+ export const underlineTypographySxProps = (theme, open = false,
3
+ // If color is null - undeline's color will be the same as the text color
4
+ color = theme.palette.supportive.main) => (Object.assign({ cursor: 'pointer', '&:hover': {
5
+ textDecoration: 'underline',
6
+ textUnderlineOffset: theme.spacing(0.5),
7
+ textDecorationColor: color,
8
+ textDecorationThickness: 1,
9
+ } }, (open && {
10
+ textDecoration: 'underline',
11
+ textUnderlineOffset: theme.spacing(0.5),
12
+ textDecorationColor: color,
13
+ textDecorationThickness: 1,
14
+ })));
15
+ export const underlineBorderSxProps = (theme, open = false,
16
+ // If color is null - undeline's color will be the same as the text color
17
+ color = theme.palette.supportive.main) => (Object.assign({ cursor: 'pointer', position: 'relative', '&:hover::after': {
18
+ bottom: 0,
19
+ position: 'absolute',
20
+ content: "''",
21
+ borderBottom: 1,
22
+ borderColor: color,
23
+ width: '100%',
24
+ } }, (open && {
25
+ '&::after': {
26
+ bottom: 0,
27
+ position: 'absolute',
28
+ content: "''",
29
+ borderBottom: 1,
30
+ borderColor: color,
31
+ width: '100%',
32
+ },
33
+ })));
@@ -0,0 +1,2 @@
1
+ export declare const packageVersion: string;
2
+ export declare const peerDependencies: string;
@@ -0,0 +1,9 @@
1
+ // Copyright 2025 WebPros International GmbH. All rights reserved.
2
+ import { version, peerDependencies as pkgPeerDependencies } from '../../package.json';
3
+ export const packageVersion = version;
4
+ const formattedPeerDependencies = JSON.stringify(pkgPeerDependencies, null, 2);
5
+ const left = '```json';
6
+ const right = '```';
7
+ export const peerDependencies = `${left}
8
+ ${formattedPeerDependencies}
9
+ ${right}`;
@@ -1,20 +1,14 @@
1
1
  // Copyright 2025 WebPros International GmbH. All rights reserved.
2
- import { useState } from 'react';
3
2
  import { useMediaQuery } from '@mui/material';
3
+ import { useLocalStorage } from 'usehooks-ts';
4
4
  export const THEME_MODE_KEY = 'ThemeModeKey';
5
+ // TODO get rid of this hook, as the theme shouldn't have any knowledge of the mode
5
6
  export const useThemeMode = () => {
6
7
  const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
7
- const [themeMode, setThemeMode] = useState(() => {
8
- const saved = localStorage.getItem(THEME_MODE_KEY);
9
- if (saved) {
10
- return JSON.parse(saved);
11
- }
12
- return prefersDarkMode ? 'dark' : 'light';
13
- });
8
+ const [value, setValue] = useLocalStorage(THEME_MODE_KEY, prefersDarkMode ? 'dark' : 'light');
14
9
  const toggleTheme = () => {
15
- const value = themeMode === 'light' ? 'dark' : 'light';
16
- setThemeMode(value);
17
- localStorage.setItem(THEME_MODE_KEY, JSON.stringify(value));
10
+ const newValue = value === 'light' ? 'dark' : 'light';
11
+ setValue(newValue);
18
12
  };
19
- return [themeMode, toggleTheme, setThemeMode];
13
+ return [value, toggleTheme, setValue];
20
14
  };
@@ -2,4 +2,5 @@ export { default as WebProsMuiThemeProvider } from './providers/WebProsMuiThemeP
2
2
  export { useThemeModeContext } from './providers/ThemeModeProvider';
3
3
  export * from './utils';
4
4
  export * from './tokens';
5
+ export * from './constants';
5
6
  export * from './components';
package/dist/src/index.js CHANGED
@@ -3,5 +3,6 @@ export { default as WebProsMuiThemeProvider } from './providers/WebProsMuiThemeP
3
3
  export { useThemeModeContext } from './providers/ThemeModeProvider';
4
4
  export * from './utils';
5
5
  export * from './tokens';
6
+ export * from './constants';
6
7
  // Only used for exporting types.
7
8
  export * from './components';
@@ -6,8 +6,9 @@ export type ThemeModeContextType = {
6
6
  };
7
7
  export type ThemeModeProviderProps = {
8
8
  children?: React.ReactNode;
9
+ mode?: ThemeMode;
9
10
  };
10
11
  export declare const ThemeModeContext: import("react").Context<ThemeModeContextType>;
11
- declare const ThemeModeProvider: ({ children }: ThemeModeProviderProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const ThemeModeProvider: ({ children, mode }: ThemeModeProviderProps) => import("react/jsx-runtime").JSX.Element;
12
13
  export default ThemeModeProvider;
13
14
  export declare const useThemeModeContext: () => ThemeModeContextType;
@@ -7,9 +7,9 @@ export const ThemeModeContext = createContext({
7
7
  toggleTheme: () => { },
8
8
  setThemeMode: () => { },
9
9
  });
10
- const ThemeModeProvider = ({ children }) => {
10
+ const ThemeModeProvider = ({ children, mode }) => {
11
11
  const [themeMode, toggleTheme, setThemeMode] = useThemeMode();
12
- const value = useMemo(() => ({ themeMode, toggleTheme, setThemeMode }), [themeMode, toggleTheme, setThemeMode]);
12
+ const value = useMemo(() => ({ themeMode: mode || themeMode, toggleTheme, setThemeMode }), [mode, themeMode, toggleTheme, setThemeMode]);
13
13
  return _jsx(ThemeModeContext.Provider, { value: value, children: children });
14
14
  };
15
15
  export default ThemeModeProvider;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import ThemeModeProvider from './ThemeModeProvider';
3
3
  import WebProsTheme from './WebProsTheme';
4
- const WebProsMuiThemeProvider = ({ children, localization, themeMode }) => (_jsx(ThemeModeProvider, { children: _jsx(WebProsTheme, { mode: themeMode, localization: localization, children: children }) }));
4
+ const WebProsMuiThemeProvider = ({ children, localization, themeMode }) => (_jsx(ThemeModeProvider, { mode: themeMode, children: _jsx(WebProsTheme, { mode: themeMode, localization: localization, children: children }) }));
5
5
  export default WebProsMuiThemeProvider;
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@webpros/mui-theme",
3
3
  "description": "MUI v6 theme for WebPros products",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webpros-dashboard/webpros-mui-theme.git"
9
+ },
6
10
  "keywords": [
7
11
  "react",
8
12
  "mui",
@@ -41,30 +45,26 @@
41
45
  "typecheck": "tsc --noEmit"
42
46
  },
43
47
  "peerDependencies": {
48
+ "@emotion/react": "^11.14.0",
49
+ "@emotion/styled": "^11.14.1",
50
+ "@fontsource/roboto": "^5.2.6",
44
51
  "@material/material-color-utilities": "^0.3.0",
45
52
  "@mui/material": "^6.4.0",
46
53
  "@mui/utils": "^6.4.0",
47
54
  "@mui/x-data-grid": "^7.29.0",
48
55
  "@mui/x-date-pickers": "^7.29.0",
49
56
  "@phosphor-icons/react": "^2.1.0",
50
- "@fontsource/roboto": "^5.2.6",
51
- "@emotion/react": "^11.14.0",
52
- "@emotion/styled": "^11.14.1"
57
+ "usehooks-ts": "^3.1.1"
53
58
  },
54
59
  "publishConfig": {
55
60
  "access": "public",
56
61
  "registry": "https://registry.npmjs.org/"
57
62
  },
58
63
  "devDependencies": {
59
- "@stylistic/eslint-plugin": "^5.5.0",
60
- "eslint-config-prettier": "^10.1.8",
61
- "eslint-plugin-prettier": "^5.5.4",
62
- "eslint-plugin-react": "^7.37.5",
63
- "eslint-plugin-react-hooks": "^7.0.0",
64
64
  "@emotion/react": "^11.14.0",
65
65
  "@emotion/styled": "^11.14.1",
66
- "@fontsource/roboto": "^5.2.6",
67
66
  "@eslint/js": "^9.38.0",
67
+ "@fontsource/roboto": "^5.2.6",
68
68
  "@material/material-color-utilities": "^0.3.0",
69
69
  "@mui/material": "^6.4.0",
70
70
  "@mui/utils": "^6.4.0",
@@ -77,11 +77,16 @@
77
77
  "@storybook/addon-themes": "^9.1.16",
78
78
  "@storybook/builder-vite": "^9.1.16",
79
79
  "@storybook/react-vite": "^9.1.16",
80
+ "@stylistic/eslint-plugin": "^5.5.0",
80
81
  "@types/node": "^24.8.1",
81
82
  "@types/react": "^19.2.2",
82
83
  "@types/react-dom": "^19.2.2",
83
84
  "@vitejs/plugin-react": "^5.0.4",
84
85
  "eslint": "^9.38.0",
86
+ "eslint-config-prettier": "^10.1.8",
87
+ "eslint-plugin-prettier": "^5.5.4",
88
+ "eslint-plugin-react": "^7.37.5",
89
+ "eslint-plugin-react-hooks": "^7.0.0",
85
90
  "eslint-plugin-storybook": "^9.1.16",
86
91
  "globals": "^16.4.0",
87
92
  "prettier": "^3.6.2",
@@ -92,7 +97,8 @@
92
97
  "typescript": "~5.9.3",
93
98
  "typescript-eslint": "^8.46.1",
94
99
  "vite": "^7.1.10",
95
- "vite-plugin-dts": "^4.5.4"
100
+ "vite-plugin-dts": "^4.5.4",
101
+ "usehooks-ts": "^3.1.1"
96
102
  },
97
103
  "browserslist": [
98
104
  "last 2 versions",