@webpros/mui-theme 0.1.1
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 +103 -0
- package/package.json +104 -0
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# WebPros MUI Theme
|
|
2
|
+
|
|
3
|
+
MUI theme based on MUI V6 and Material Design V3.
|
|
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)
|
|
7
|
+
|
|
8
|
+
# Installation
|
|
9
|
+
|
|
10
|
+
Install the package in your project with:
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
yarn add @webpros/webpros-material-library
|
|
14
|
+
```
|
|
15
|
+
|
|
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
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
# Usage
|
|
34
|
+
|
|
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:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// global.d.ts
|
|
39
|
+
import type _ from '@webpros/webpros-material-library';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. Create new wrapper-component for the theme provider
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { getMuiLocaleByCode, WebProsMuiThemeProvider } from '@webpros/webpros-material-library';
|
|
46
|
+
import { StyledEngineProvider } from '@mui/material/styles';
|
|
47
|
+
import { Localization } from '@mui/material/locale';
|
|
48
|
+
import { ReactNode, useMemo } from 'react';
|
|
49
|
+
import { useLocale } from 'your-locale-code-provider';
|
|
50
|
+
|
|
51
|
+
const YourLocalesToMuiLocales: Record<string, Localization> = {
|
|
52
|
+
en: getMuiLocaleByCode('enUS'),
|
|
53
|
+
ru: getMuiLocaleByCode('ruRU'),
|
|
54
|
+
de: getMuiLocaleByCode('deDE'),
|
|
55
|
+
es: getMuiLocaleByCode('esES'),
|
|
56
|
+
fr: getMuiLocaleByCode('frFR'),
|
|
57
|
+
it: getMuiLocaleByCode('itIT'),
|
|
58
|
+
ja: getMuiLocaleByCode('jaJP'),
|
|
59
|
+
pt: getMuiLocaleByCode('ptPT'),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const getMUILocalization = (locale: string) => YourLocalesToMuiLocales[locale];
|
|
63
|
+
|
|
64
|
+
type WebprosThemeProviderProps = {
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const WebprosThemeProvider = ({ children }: WebprosThemeProviderProps) => {
|
|
69
|
+
const [locale] = useLocale();
|
|
70
|
+
|
|
71
|
+
const localization = useMemo(() => getMUILocalization(locale), [locale]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<StyledEngineProvider>
|
|
75
|
+
<WebProsMuiThemeProvider localization={localization}>{children}</WebProsMuiThemeProvider>
|
|
76
|
+
</StyledEngineProvider>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Wrap your application with `WebprosThemeProvider`
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
const App = () => (
|
|
85
|
+
// Other code
|
|
86
|
+
<WebprosThemeProvider>// children goes here</WebprosThemeProvider>
|
|
87
|
+
// Other code
|
|
88
|
+
);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
4. **Use imports from `@mui/material` for components**
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { Box } from '@mui/material'; // NOT import { Box } from '@webpros/webpros-material-library';
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
# Releases
|
|
98
|
+
|
|
99
|
+
The release cycle will be available soon
|
|
100
|
+
|
|
101
|
+
# Contributing
|
|
102
|
+
|
|
103
|
+
The contributing guide will be available soon
|
package/package.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webpros/mui-theme",
|
|
3
|
+
"description": "MUI v6 theme for WebPros products",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"mui",
|
|
9
|
+
"theme",
|
|
10
|
+
"theming",
|
|
11
|
+
"ui"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/src/webpros-material-library.js",
|
|
18
|
+
"types": "./dist/src/webpros-material-library.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"private": false,
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": "^22.x",
|
|
29
|
+
"npm": "please-use-yarn",
|
|
30
|
+
"yarn": "^1.22.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
34
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
35
|
+
"storybook:build": "storybook build",
|
|
36
|
+
"test": "npm run prettier:test && npm run lint && npm run typecheck",
|
|
37
|
+
"lint": "npm run eslint",
|
|
38
|
+
"eslint": "eslint",
|
|
39
|
+
"prettier:test": "prettier --check \"**/*.{ts,tsx}\"",
|
|
40
|
+
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@material/material-color-utilities": "^0.3.0",
|
|
45
|
+
"@mui/material": "^6.4.0",
|
|
46
|
+
"@mui/utils": "^6.4.0",
|
|
47
|
+
"@mui/x-data-grid": "^7.29.0",
|
|
48
|
+
"@mui/x-date-pickers": "^7.29.0",
|
|
49
|
+
"@phosphor-icons/react": "^2.1.0"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@eslint/js": "^9.38.0",
|
|
57
|
+
"@material/material-color-utilities": "^0.3.0",
|
|
58
|
+
"@mui/material": "^6.4.0",
|
|
59
|
+
"@mui/utils": "^6.4.0",
|
|
60
|
+
"@mui/x-data-grid": "^7.29.0",
|
|
61
|
+
"@mui/x-date-pickers": "^7.29.0",
|
|
62
|
+
"@phosphor-icons/react": "^2.1.0",
|
|
63
|
+
"@storybook/addon-docs": "^9.1.13",
|
|
64
|
+
"@storybook/addon-onboarding": "^9.1.13",
|
|
65
|
+
"@storybook/addon-themes": "^9.1.13",
|
|
66
|
+
"@storybook/builder-vite": "^9.1.13",
|
|
67
|
+
"@storybook/react-vite": "^9.1.13",
|
|
68
|
+
"@storybook/react-webpack5": "^9.1.13",
|
|
69
|
+
"@types/node": "^24.8.1",
|
|
70
|
+
"@types/react": "^19.2.2",
|
|
71
|
+
"@types/react-dom": "^19.2.2",
|
|
72
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
73
|
+
"eslint": "^9.38.0",
|
|
74
|
+
"eslint-plugin-storybook": "^9.1.13",
|
|
75
|
+
"globals": "^16.4.0",
|
|
76
|
+
"prettier": "^3.6.2",
|
|
77
|
+
"react": "^18.3.1",
|
|
78
|
+
"react-dom": "^18.3.1",
|
|
79
|
+
"storybook": "^9.1.13",
|
|
80
|
+
"tsc-alias": "^1.8.16",
|
|
81
|
+
"typescript": "~5.9.3",
|
|
82
|
+
"typescript-eslint": "^8.46.1",
|
|
83
|
+
"vite": "^7.1.10",
|
|
84
|
+
"vite-plugin-dts": "^4.5.4"
|
|
85
|
+
},
|
|
86
|
+
"browserslist": [
|
|
87
|
+
"last 2 versions",
|
|
88
|
+
">1%",
|
|
89
|
+
"not dead",
|
|
90
|
+
"not op_mini all"
|
|
91
|
+
],
|
|
92
|
+
"eslintConfig": {
|
|
93
|
+
"extends": [
|
|
94
|
+
"plugin:storybook/recommended"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
99
|
+
"eslint-config-prettier": "^10.1.8",
|
|
100
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
101
|
+
"eslint-plugin-react": "^7.37.5",
|
|
102
|
+
"eslint-plugin-react-hooks": "^7.0.0"
|
|
103
|
+
}
|
|
104
|
+
}
|