@linagora/twake-mui 5.1.0 → 5.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.
@@ -0,0 +1,231 @@
1
+ import { Button, Stack, Chip } from '@mui/material';
2
+ import React from 'react';
3
+ import { TwakeMuiThemeProvider } from '../components/ThemeProvider';
4
+ import { makePalette } from '../lib/makePalette';
5
+ const customPalette = {
6
+ Primary: {
7
+ '50': '#FFF9F6',
8
+ '100': '#FFF5F0',
9
+ '200': '#FFF1E3',
10
+ '300': '#FFD8BF',
11
+ '400': '#FFAE7B',
12
+ '500': '#FF8D46',
13
+ '600': '#F67E35',
14
+ '700': '#F66F35',
15
+ '800': '#E55B31',
16
+ '900': '#7A411E',
17
+ ContrastText: '#fff'
18
+ },
19
+ Secondary: {
20
+ '50': '#E5FFFF',
21
+ '100': '#B3FFFF',
22
+ '200': '#80FFFF',
23
+ '300': '#4DFFFF',
24
+ '400': '#1AFFFF',
25
+ '500': '#00FFFF',
26
+ '600': '#00CCCC',
27
+ '700': '#009999',
28
+ '800': '#006666',
29
+ '900': '#003333',
30
+ ContrastText: '#000'
31
+ },
32
+ Error: {
33
+ '50': '#FFE5E5',
34
+ '100': '#FFB3B3',
35
+ '200': '#FF8080',
36
+ '300': '#FF4D4D',
37
+ '400': '#FF1A1A',
38
+ '500': '#FF0000',
39
+ '600': '#CC0000',
40
+ '700': '#990000',
41
+ '800': '#660000',
42
+ '900': '#330000',
43
+ ContrastText: '#fff'
44
+ },
45
+ Warning: {
46
+ '50': '#FFFFE5',
47
+ '100': '#FFFFB3',
48
+ '200': '#FFFF80',
49
+ '300': '#FFFF4D',
50
+ '400': '#FFFF1A',
51
+ '500': '#FFFF00',
52
+ '600': '#CCCC00',
53
+ '700': '#999900',
54
+ '800': '#666600',
55
+ '900': '#333300',
56
+ ContrastText: '#000'
57
+ },
58
+ Success: {
59
+ '50': '#E5FFE5',
60
+ '100': '#B3FFB3',
61
+ '200': '#80FF80',
62
+ '300': '#4DFF4D',
63
+ '400': '#1AFF1A',
64
+ '500': '#00FF00',
65
+ '600': '#00CC00',
66
+ '700': '#009900',
67
+ '800': '#006600',
68
+ '900': '#003300',
69
+ ContrastText: '#000'
70
+ },
71
+ Info: {
72
+ '50': '#F0E5FF',
73
+ '100': '#D1B3FF',
74
+ '200': '#B380FF',
75
+ '300': '#944DFF',
76
+ '400': '#751AFF',
77
+ '500': '#6600FF',
78
+ '600': '#5200CC',
79
+ '700': '#3D0099',
80
+ '800': '#290066',
81
+ '900': '#140033'
82
+ },
83
+ Grey: {
84
+ '50': '#F2F2F2',
85
+ '100': '#00FF00',
86
+ '200': '#CCCCCC',
87
+ '300': '#B3B3B3',
88
+ '400': '#808080',
89
+ '500': '#808080',
90
+ '600': '#666666',
91
+ '700': '#4D4D4D',
92
+ '800': '#00FF00',
93
+ '900': '#FF00FF',
94
+ A100: '#FFFFFF',
95
+ A200: '#F0F0F0',
96
+ A400: '#00FF00',
97
+ A700: '#262626',
98
+ A900: '#0D0D0D'
99
+ },
100
+ Common: {
101
+ black: '#FF0000',
102
+ white: '#0000ff'
103
+ }
104
+ };
105
+ const BASE_PALETTE = makePalette('light', customPalette);
106
+ function ColorSwatch({ label, color }) {
107
+ return (React.createElement(Stack, { direction: "row", spacing: 1 },
108
+ React.createElement("div", { style: {
109
+ width: 24,
110
+ height: 24,
111
+ borderRadius: 4,
112
+ backgroundColor: color,
113
+ border: '1px solid rgba(0,0,0,0.1)'
114
+ } }),
115
+ React.createElement("code", { style: { fontSize: 12, color: '#666' } }, label),
116
+ React.createElement("code", { style: { fontSize: 12 } }, color)));
117
+ }
118
+ function ThemePlaygroundContent() {
119
+ const primaryMain = BASE_PALETTE.primary.main;
120
+ const secondaryMain = BASE_PALETTE.secondary
121
+ .main;
122
+ const textPrimary = BASE_PALETTE.text.primary;
123
+ const textSecondary = BASE_PALETTE.text.secondary;
124
+ const backgroundDefault = BASE_PALETTE.background.default;
125
+ const backgroundPaper = BASE_PALETTE.background.paper;
126
+ return (React.createElement(TwakeMuiThemeProvider, { themeOptions: { palette: BASE_PALETTE } },
127
+ React.createElement(Stack, { spacing: 4, sx: { p: 3, minWidth: 640 } },
128
+ React.createElement("section", null,
129
+ React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Palette Colors"),
130
+ React.createElement(Stack, { spacing: 1 },
131
+ React.createElement(ColorSwatch, { label: "primary.main", color: primaryMain }),
132
+ React.createElement(ColorSwatch, { label: "secondary.main", color: secondaryMain }),
133
+ React.createElement(ColorSwatch, { label: "text.primary", color: textPrimary }),
134
+ React.createElement(ColorSwatch, { label: "text.secondary", color: textSecondary }),
135
+ React.createElement(ColorSwatch, { label: "background.default", color: backgroundDefault }),
136
+ React.createElement(ColorSwatch, { label: "background.paper", color: backgroundPaper }))),
137
+ React.createElement("section", null,
138
+ React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Buttons"),
139
+ React.createElement(Stack, { spacing: 2 },
140
+ React.createElement(Stack, { direction: "row", spacing: 2 },
141
+ React.createElement(Button, { variant: "contained", color: "primary" }, "Contained primary"),
142
+ React.createElement(Button, { variant: "outlined", color: "primary" }, "Outlined primary"),
143
+ React.createElement(Button, { variant: "text", color: "primary" }, "Text primary")),
144
+ React.createElement(Stack, { direction: "row", spacing: 2 },
145
+ React.createElement(Button, { variant: "contained", color: "secondary" }, "Contained secondary"),
146
+ React.createElement(Button, { variant: "outlined", color: "secondary" }, "Outlined secondary"),
147
+ React.createElement(Button, { variant: "text", color: "secondary" }, "Text secondary")),
148
+ React.createElement(Stack, { direction: "row", spacing: 2 },
149
+ React.createElement(Button, { variant: "contained", disabled: true }, "Disabled")))),
150
+ React.createElement("section", null,
151
+ React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Chips"),
152
+ React.createElement(Stack, { direction: "row", spacing: 2 },
153
+ React.createElement(Chip, { label: "Primary filled", color: "primary" }),
154
+ React.createElement(Chip, { label: "Primary outlined", color: "primary", variant: "outlined" }),
155
+ React.createElement(Chip, { label: "Secondary filled", color: "secondary" }),
156
+ React.createElement(Chip, { label: "Secondary outlined", color: "secondary", variant: "outlined" }))),
157
+ React.createElement("section", null,
158
+ React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Typography"),
159
+ React.createElement(Stack, { spacing: 0.5 },
160
+ React.createElement("span", { style: {
161
+ color: textPrimary,
162
+ fontSize: 15
163
+ } }, "text.primary \u2014 The quick brown fox"),
164
+ React.createElement("span", { style: {
165
+ color: textSecondary,
166
+ fontSize: 13
167
+ } }, "text.secondary \u2014 The quick brown fox"))),
168
+ React.createElement("section", null,
169
+ React.createElement("h3", { style: { marginTop: 0, marginBottom: 12 } }, "Backgrounds"),
170
+ React.createElement(Stack, { direction: "row", spacing: 2 },
171
+ React.createElement(Stack, { sx: {
172
+ width: 120,
173
+ height: 64,
174
+ borderRadius: 1,
175
+ border: '1px solid',
176
+ borderColor: 'divider',
177
+ bgcolor: 'background.default',
178
+ alignItems: 'center',
179
+ justifyContent: 'center'
180
+ } },
181
+ React.createElement("code", { style: { fontSize: 10 } }, "default")),
182
+ React.createElement(Stack, { sx: {
183
+ width: 120,
184
+ height: 64,
185
+ borderRadius: 1,
186
+ border: '1px solid',
187
+ borderColor: 'divider',
188
+ bgcolor: 'background.paper',
189
+ alignItems: 'center',
190
+ justifyContent: 'center'
191
+ } },
192
+ React.createElement("code", { style: { fontSize: 10 } }, "paper")))))));
193
+ }
194
+ const meta = {
195
+ title: 'ThemePlayground',
196
+ component: ThemePlaygroundContent,
197
+ parameters: { layout: 'centered' },
198
+ tags: ['autodocs']
199
+ };
200
+ export default meta;
201
+ export const Docs = {
202
+ parameters: {
203
+ docs: {
204
+ source: {
205
+ code: `import { makePalette } from '@linagora/twake-mui'
206
+ import type { PaletteJson } from '@linagora/twake-mui'
207
+
208
+ const customPalette: PaletteJson = {
209
+ Primary: {
210
+ '500': '#FF00AA',
211
+ ContrastText: '#fff'
212
+ },
213
+ Secondary: {
214
+ '500': '#00FFFF',
215
+ ContrastText: '#000'
216
+ },
217
+ // ...Error, Warning, Success, Info, Grey, Common
218
+ }
219
+
220
+ // Generate a full MUI palette from your design tokens
221
+ const basePalette = makePalette('light', customPalette)
222
+
223
+ <TwakeMuiThemeProvider
224
+ themeOptions={{palette: basePalette}}
225
+ >
226
+ <YourApp />
227
+ </TwakeMuiThemeProvider>`
228
+ }
229
+ }
230
+ }
231
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-mui",
3
3
  "type": "module",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "description": "MUI v9 theme system for Twake applications",
6
6
  "author": "Twake",
7
7
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- import { Theme, ThemeOptions } from '@mui/material/styles';
2
- export declare const makeDarkOverrides: (theme: Theme) => NonNullable<ThemeOptions["components"]>;
@@ -1,9 +0,0 @@
1
- import { merge } from 'lodash';
2
- import { makeLightOverrides } from './makeLightOverrides';
3
- export const makeDarkOverrides = (theme) => {
4
- const makeOverridesForDarkTheme = (
5
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
- theme) => ({});
7
- const DarkOverrides = merge(makeLightOverrides(theme), makeOverridesForDarkTheme(theme));
8
- return DarkOverrides;
9
- };
@@ -1,2 +0,0 @@
1
- import { Theme, ThemeOptions } from '@mui/material/styles';
2
- export declare const makeLightOverrides: (theme: Theme) => NonNullable<ThemeOptions["components"]>;