@centreon/ui 23.10.24 → 23.10.25-MON-19506-dashboard-menu-component.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.
Files changed (76) hide show
  1. package/package.json +12 -2
  2. package/src/Dashboard/DashboardLayout.stories.tsx +3 -5
  3. package/src/Dashboard/Layout.tsx +4 -4
  4. package/src/Dashboard/utils.ts +28 -28
  5. package/src/ThemeProvider/index.tsx +6 -5
  6. package/src/ThemeProvider/palettes.ts +389 -208
  7. package/src/base/tokens/README.md +3 -0
  8. package/src/base/tokens/source/$metadata.json +5 -0
  9. package/src/base/tokens/source/base.json +142 -0
  10. package/src/base/tokens/themes/base.tokens.d.ts +38 -0
  11. package/src/base/tokens/themes/base.tokens.json +695 -0
  12. package/src/base/tokens/themes/base.tokens.ts +38 -0
  13. package/src/base/tokens/themes/ui-dark.tokens.d.ts +38 -0
  14. package/src/base/tokens/themes/ui-dark.tokens.json +695 -0
  15. package/src/base/tokens/themes/ui-dark.tokens.ts +38 -0
  16. package/src/base/tokens/themes/ui-light.tokens.d.ts +38 -0
  17. package/src/base/tokens/themes/ui-light.tokens.json +695 -0
  18. package/src/base/tokens/themes/ui-light.tokens.ts +38 -0
  19. package/src/components/Button/Button.styles.ts +16 -3
  20. package/src/components/Button/Button.tsx +6 -3
  21. package/src/components/Header/Header.styles.ts +0 -27
  22. package/src/components/Header/PageHeader/PageHeader.stories.tsx +88 -0
  23. package/src/components/Header/PageHeader/PageHeader.styles.ts +99 -0
  24. package/src/components/Header/PageHeader/PageHeader.tsx +15 -0
  25. package/src/components/Header/PageHeader/PageHeaderActions.tsx +17 -0
  26. package/src/components/Header/PageHeader/PageHeaderMain.tsx +15 -0
  27. package/src/components/Header/PageHeader/PageHeaderMenu.tsx +15 -0
  28. package/src/components/Header/PageHeader/PageHeaderTitle.tsx +44 -0
  29. package/src/components/Header/PageHeader/index.ts +12 -0
  30. package/src/components/Header/index.ts +1 -1
  31. package/src/components/Layout/AreaIndicator.styles.ts +33 -0
  32. package/src/components/Layout/AreaIndicator.tsx +35 -0
  33. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +81 -0
  34. package/src/components/Layout/PageLayout/PageLayout.styles.ts +30 -0
  35. package/src/components/Layout/PageLayout/PageLayout.tsx +21 -0
  36. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +15 -0
  37. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +24 -0
  38. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +15 -0
  39. package/src/components/Layout/PageLayout/index.ts +10 -0
  40. package/src/components/Layout/index.ts +1 -0
  41. package/src/components/Menu/Button/MenuButton.stories.tsx +16 -0
  42. package/src/components/Menu/Button/MenuButton.styles.ts +27 -0
  43. package/src/components/Menu/Button/MenuButton.tsx +59 -0
  44. package/src/components/Menu/Button/index.ts +1 -0
  45. package/src/components/Menu/Menu.stories.tsx +71 -0
  46. package/src/components/Menu/Menu.styles.ts +70 -0
  47. package/src/components/Menu/Menu.tsx +25 -0
  48. package/src/components/Menu/MenuDivider.tsx +17 -0
  49. package/src/components/Menu/MenuItem.tsx +39 -0
  50. package/src/components/Menu/MenuItems.tsx +35 -0
  51. package/src/components/Menu/index.ts +12 -0
  52. package/src/components/Menu/useMenu.tsx +79 -0
  53. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +71 -0
  54. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +5 -0
  55. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +115 -0
  56. package/src/components/Tooltip/TextOverflowTooltip/index.tsx +1 -0
  57. package/src/components/Tooltip/Tooltip.stories.tsx +41 -0
  58. package/src/components/Tooltip/Tooltip.styles.ts +5 -0
  59. package/src/components/Tooltip/Tooltip.tsx +46 -0
  60. package/src/components/Tooltip/index.ts +1 -0
  61. package/src/components/index.ts +3 -0
  62. package/src/index.ts +0 -2
  63. package/src/screens/dashboard/DashboardsDetail.stories.tsx +93 -0
  64. package/src/screens/dashboard/DashboardsOverview.stories.tsx +110 -102
  65. package/src/styles/tokens/themes/_ui-dark.tokens.json +695 -0
  66. package/src/styles/tokens/themes/_ui-light.tokens.json +695 -0
  67. package/src/utils/useResizeObserver.ts +6 -0
  68. package/test/setupTests.js +3 -0
  69. package/src/components/Header/Header.stories.tsx +0 -27
  70. package/src/components/Header/Header.tsx +0 -23
  71. package/src/layout/TiledListingPage/TiledListingActions.tsx +0 -15
  72. package/src/layout/TiledListingPage/TiledListingContent.tsx +0 -21
  73. package/src/layout/TiledListingPage/TiledListingList.tsx +0 -11
  74. package/src/layout/TiledListingPage/TiledListingPage.styles.ts +0 -16
  75. package/src/layout/TiledListingPage/TiledListingPage.tsx +0 -15
  76. package/src/layout/TiledListingPage/index.ts +0 -4
@@ -1,208 +1,389 @@
1
- import { equals } from 'ramda';
2
-
3
- import { alpha, PaletteOptions } from '@mui/material';
4
-
5
- import { ThemeMode } from '@centreon/ui-context';
6
-
7
- declare module '@mui/material/styles/createPalette' {
8
- interface TypeAction {
9
- acknowledged: string;
10
- acknowledgedBackground: string;
11
- inDowntime: string;
12
- inDowntimeBackground: string;
13
- }
14
- }
15
-
16
- declare module '@mui/material/styles' {
17
- interface Palette {
18
- background: {
19
- default: string;
20
- listingHeader: string;
21
- panelGroups: string;
22
- paper: string;
23
- };
24
- pending: {
25
- contrastText: string;
26
- main: string;
27
- };
28
- statusBackground: StatusBackground;
29
- }
30
- interface StatusBackground {
31
- error: string;
32
- none: string;
33
- pending: string;
34
- success: string;
35
- unknown: string;
36
- warning: string;
37
- }
38
- interface PaletteOptions {
39
- pending: {
40
- contrastText: string;
41
- main: string;
42
- };
43
- statusBackground: StatusBackground;
44
- }
45
-
46
- interface TypeBackground {
47
- listingHeader: string;
48
- panel: string;
49
- panelGroups: string;
50
- }
51
- }
52
-
53
- declare module '@mui/material/Button' {
54
- interface ButtonPropsColorOverrides {
55
- pending: true;
56
- }
57
- }
58
-
59
- declare module '@mui/material/Badge' {
60
- interface BadgePropsColorOverrides {
61
- pending: true;
62
- }
63
- }
64
-
65
- export const lightPalette: PaletteOptions = {
66
- action: {
67
- acknowledged: '#67532C',
68
- acknowledgedBackground: '#F5F1E9',
69
- activatedOpacity: 0.12,
70
- active: '#666666',
71
- disabled: '#999999',
72
- disabledBackground: 'rgba(0, 0, 0, 0.12)',
73
- focus: 'rgba(0, 0, 0, 0.12)',
74
- focusOpacity: 0.12,
75
- hover: 'rgba(0, 0, 0, 0.06)',
76
- hoverOpacity: 0.06,
77
- inDowntime: '#4B2352',
78
- inDowntimeBackground: '#F0E9F8',
79
- selected: 'rgba(102, 102, 102, 0.3)',
80
- selectedOpacity: 0.3
81
- },
82
- background: {
83
- default: '#F4F4F4',
84
- listingHeader: '#666666',
85
- panel: '#EDEDED',
86
- panelGroups: '#F5F5F5',
87
- paper: '#FFFFFF'
88
- },
89
- divider: '#E3E3E3',
90
- error: {
91
- contrastText: '#000',
92
- main: '#FF4A4A'
93
- },
94
- info: {
95
- contrastText: '#000',
96
- main: '#1588D1'
97
- },
98
- mode: ThemeMode.light,
99
- pending: {
100
- contrastText: '#000',
101
- main: '#1EBEB3'
102
- },
103
- primary: {
104
- contrastText: '#fff',
105
- dark: '#255891',
106
- light: '#cde7fc',
107
- main: '#2E68AA'
108
- },
109
- secondary: {
110
- contrastText: '#fff',
111
- main: '#C772D6'
112
- },
113
- statusBackground: {
114
- error: '#FF6666',
115
- none: alpha('#2E68AA', 0.1),
116
- pending: '#1EBEB3',
117
- success: '#88B922',
118
- unknown: '#E3E3E3',
119
- warning: '#FD9B27'
120
- },
121
- success: {
122
- contrastText: '#000',
123
- main: '#88B922'
124
- },
125
- text: {
126
- disabled: '#999999',
127
- primary: '#000000',
128
- secondary: '#666666'
129
- },
130
- warning: {
131
- contrastText: '#000',
132
- main: '#FD9B27'
133
- }
134
- };
135
-
136
- export const darkPalette: PaletteOptions = {
137
- action: {
138
- acknowledged: '#67532C',
139
- acknowledgedBackground: '#67532C',
140
- activatedOpacity: 0.3,
141
- active: '#B5B5B5',
142
- disabled: '#999999',
143
- disabledBackground: '#555555',
144
- focus: 'rgba(255, 255, 255, 0.30)',
145
- focusOpacity: 0.3,
146
- hover: 'rgba(255, 255, 255, 0.16)',
147
- hoverOpacity: 0.16,
148
- inDowntime: '#4B2352',
149
- inDowntimeBackground: '#4B2352',
150
- selected: 'rgba(255, 255, 255, 0.5)',
151
- selectedOpacity: 0.5
152
- },
153
- background: {
154
- default: '#4a4a4a',
155
- listingHeader: '#666666',
156
- panel: '#4a4a4a',
157
- panelGroups: '#252525',
158
- paper: '#212121'
159
- },
160
- divider: '#666666',
161
- error: {
162
- contrastText: '#fff',
163
- main: '#D60101'
164
- },
165
- info: {
166
- contrastText: '#fff',
167
- main: '#1CA9F4'
168
- },
169
- mode: ThemeMode.dark,
170
- pending: {
171
- contrastText: '#fff',
172
- main: '#118077'
173
- },
174
- primary: {
175
- contrastText: '#000',
176
- dark: '#4974A5',
177
- light: '#8bbff9',
178
- main: '#6eaff8'
179
- },
180
- secondary: {
181
- contrastText: '#fff',
182
- main: '#7C1FA2'
183
- },
184
- statusBackground: {
185
- error: '#D60101',
186
- none: alpha('#2E68AA', 0.1),
187
- pending: '#118077',
188
- success: '#5F8118',
189
- unknown: '#666666',
190
- warning: '#C55400'
191
- },
192
- success: {
193
- contrastText: '#fff',
194
- main: '#5F8118'
195
- },
196
- text: {
197
- disabled: '#666666',
198
- primary: '#FFFFFF',
199
- secondary: '#CCCCCC'
200
- },
201
- warning: {
202
- contrastText: '#fff',
203
- main: '#C55400'
204
- }
205
- };
206
-
207
- export const getPalette = (mode: ThemeMode): PaletteOptions =>
208
- equals(mode, ThemeMode.dark) ? darkPalette : lightPalette;
1
+ import { equals } from 'ramda';
2
+
3
+ import { alpha, PaletteOptions } from '@mui/material';
4
+
5
+ import { ThemeMode } from '@centreon/ui-context';
6
+
7
+ import * as BaseTokens from '../base/tokens/themes/base.tokens';
8
+
9
+ declare module '@mui/material/styles/createPalette' {
10
+ interface TypeAction {
11
+ acknowledged: string;
12
+ acknowledgedBackground: string;
13
+ inDowntime: string;
14
+ inDowntimeBackground: string;
15
+ }
16
+ }
17
+
18
+ declare module '@mui/material/styles' {
19
+ interface Palette {
20
+ background: {
21
+ default: string;
22
+ listingHeader: string;
23
+ panelGroups: string;
24
+ paper: string;
25
+ };
26
+ header: TypeHeader;
27
+ layout: TypeLayout;
28
+ menu: TypeMenu;
29
+ pending: {
30
+ contrastText: string;
31
+ main: string;
32
+ };
33
+ statusBackground: StatusBackground;
34
+ }
35
+ interface StatusBackground {
36
+ error: string;
37
+ none: string;
38
+ pending: string;
39
+ success: string;
40
+ unknown: string;
41
+ warning: string;
42
+ }
43
+ interface PaletteOptions {
44
+ header: TypeHeader;
45
+ layout: TypeLayout;
46
+ menu: TypeMenu;
47
+ pending: {
48
+ contrastText: string;
49
+ main: string;
50
+ };
51
+ statusBackground: StatusBackground;
52
+ }
53
+
54
+ interface TypeBackground {
55
+ listingHeader: string;
56
+ panel: string;
57
+ panelGroups: string;
58
+ }
59
+
60
+ interface TypeLayout {
61
+ body: {
62
+ background: string;
63
+ };
64
+ header: {
65
+ background: string;
66
+ border: string;
67
+ };
68
+ }
69
+
70
+ interface TypeHeader {
71
+ page: {
72
+ action: {
73
+ background: {
74
+ active: string;
75
+ default: string;
76
+ };
77
+ color: {
78
+ active: string;
79
+ default: string;
80
+ };
81
+ };
82
+ border: string;
83
+ description: string;
84
+ title: string;
85
+ };
86
+ }
87
+
88
+ interface TypeMenu {
89
+ background: string;
90
+ button: {
91
+ background: {
92
+ active: string;
93
+ default: string;
94
+ hover: string;
95
+ };
96
+ color: {
97
+ active: string;
98
+ default: string;
99
+ hover: string;
100
+ };
101
+ };
102
+ divider: {
103
+ border: string;
104
+ };
105
+ item: {
106
+ background: {
107
+ active: string;
108
+ default: string;
109
+ hover: string;
110
+ };
111
+ color: {
112
+ active: string;
113
+ default: string;
114
+ hover: string;
115
+ };
116
+ };
117
+ }
118
+ }
119
+
120
+ declare module '@mui/material/Button' {
121
+ interface ButtonPropsColorOverrides {
122
+ pending: true;
123
+ }
124
+ }
125
+
126
+ declare module '@mui/material/Badge' {
127
+ interface BadgePropsColorOverrides {
128
+ pending: true;
129
+ }
130
+ }
131
+
132
+ export const lightPalette: PaletteOptions = {
133
+ action: {
134
+ acknowledged: '#67532C',
135
+ acknowledgedBackground: '#F5F1E9',
136
+ activatedOpacity: 0.12,
137
+ active: '#666666',
138
+ disabled: '#999999',
139
+ disabledBackground: 'rgba(0, 0, 0, 0.12)',
140
+ focus: 'rgba(0, 0, 0, 0.12)',
141
+ focusOpacity: 0.12,
142
+ hover: 'rgba(0, 0, 0, 0.06)',
143
+ hoverOpacity: 0.06,
144
+ inDowntime: '#4B2352',
145
+ inDowntimeBackground: '#F0E9F8',
146
+ selected: 'rgba(102, 102, 102, 0.3)',
147
+ selectedOpacity: 0.3
148
+ },
149
+ background: {
150
+ default: '#F4F4F4',
151
+ listingHeader: '#666666',
152
+ panel: '#EDEDED',
153
+ panelGroups: '#F5F5F5',
154
+ paper: '#FFFFFF'
155
+ },
156
+ divider: '#E3E3E3',
157
+ error: {
158
+ contrastText: '#000',
159
+ main: '#FF4A4A'
160
+ },
161
+ header: {
162
+ page: {
163
+ action: {
164
+ background: {
165
+ active: '#1975D10F',
166
+ default: '#FFFFFF00'
167
+ },
168
+ color: {
169
+ active: '#1976D2',
170
+ default: '#696969'
171
+ }
172
+ },
173
+ border: '#4A4A4A',
174
+ description: '#4A4A4A',
175
+ title: '#000000'
176
+ }
177
+ },
178
+ info: {
179
+ contrastText: '#000',
180
+ main: '#1588D1'
181
+ },
182
+ layout: {
183
+ body: {
184
+ background: '#F6F6F6'
185
+ },
186
+ header: {
187
+ background: '#FFFFFF',
188
+ border: '#E3E3E3'
189
+ }
190
+ },
191
+ menu: {
192
+ background: '#FFFFFF',
193
+ button: {
194
+ background: {
195
+ active: BaseTokens.colorBlue50,
196
+ default: 'transparent',
197
+ hover: BaseTokens.colorGrey50
198
+ },
199
+ color: {
200
+ active: BaseTokens.colorBlue400,
201
+ default: BaseTokens.colorGrey400,
202
+ hover: BaseTokens.colorGrey500
203
+ }
204
+ },
205
+ divider: {
206
+ border: BaseTokens.colorGrey200
207
+ },
208
+ item: {
209
+ background: {
210
+ active: BaseTokens.colorBlue50,
211
+ default: 'transparent',
212
+ hover: BaseTokens.colorGrey50
213
+ },
214
+ color: {
215
+ active: BaseTokens.colorBlue400,
216
+ default: BaseTokens.colorGrey900,
217
+ hover: BaseTokens.colorGrey950
218
+ }
219
+ }
220
+ },
221
+ mode: ThemeMode.light,
222
+ pending: {
223
+ contrastText: '#000',
224
+ main: '#1EBEB3'
225
+ },
226
+ primary: {
227
+ contrastText: '#fff',
228
+ dark: '#255891',
229
+ light: '#cde7fc',
230
+ main: '#2E68AA'
231
+ },
232
+ secondary: {
233
+ contrastText: '#fff',
234
+ dark: '#ac28c1',
235
+ light: '#e5a5f0',
236
+ main: '#C772D6'
237
+ },
238
+ statusBackground: {
239
+ error: '#FF6666',
240
+ none: alpha('#2E68AA', 0.1),
241
+ pending: '#1EBEB3',
242
+ success: '#88B922',
243
+ unknown: '#E3E3E3',
244
+ warning: '#FD9B27'
245
+ },
246
+ success: {
247
+ contrastText: '#000',
248
+ main: '#88B922'
249
+ },
250
+ text: {
251
+ disabled: '#999999',
252
+ primary: '#000000',
253
+ secondary: '#666666'
254
+ },
255
+ warning: {
256
+ contrastText: '#000',
257
+ main: '#FD9B27'
258
+ }
259
+ };
260
+
261
+ export const darkPalette: PaletteOptions = {
262
+ action: {
263
+ acknowledged: '#67532C',
264
+ acknowledgedBackground: '#67532C',
265
+ activatedOpacity: 0.3,
266
+ active: '#B5B5B5',
267
+ disabled: '#999999',
268
+ disabledBackground: '#555555',
269
+ focus: 'rgba(255, 255, 255, 0.30)',
270
+ focusOpacity: 0.3,
271
+ hover: 'rgba(255, 255, 255, 0.16)',
272
+ hoverOpacity: 0.16,
273
+ inDowntime: '#4B2352',
274
+ inDowntimeBackground: '#4B2352',
275
+ selected: 'rgba(255, 255, 255, 0.5)',
276
+ selectedOpacity: 0.5
277
+ },
278
+ background: {
279
+ default: '#4a4a4a',
280
+ listingHeader: '#666666',
281
+ panel: '#4a4a4a',
282
+ panelGroups: '#252525',
283
+ paper: '#212121'
284
+ },
285
+ divider: '#666666',
286
+ error: {
287
+ contrastText: '#fff',
288
+ main: '#D60101'
289
+ },
290
+ header: {
291
+ page: {
292
+ action: {
293
+ background: {
294
+ active: '#1975D10F',
295
+ default: '#FFFFFF00'
296
+ },
297
+ color: {
298
+ active: '#1976D2',
299
+ default: '#696969'
300
+ }
301
+ },
302
+ border: '#bdbdbd',
303
+ description: '#bdbdbd',
304
+ title: '#fff'
305
+ }
306
+ },
307
+ info: {
308
+ contrastText: '#fff',
309
+ main: '#1CA9F4'
310
+ },
311
+ layout: {
312
+ body: {
313
+ background: '#F6F6F6'
314
+ },
315
+ header: {
316
+ background: '#FFFFFF',
317
+ border: '#E3E3E3'
318
+ }
319
+ },
320
+ menu: {
321
+ background: BaseTokens.colorGrey950,
322
+ button: {
323
+ background: {
324
+ active: BaseTokens.colorBlue950,
325
+ default: 'transparent',
326
+ hover: BaseTokens.colorGrey950
327
+ },
328
+ color: {
329
+ active: BaseTokens.colorBlue600,
330
+ default: BaseTokens.colorGrey600,
331
+ hover: BaseTokens.colorGrey500
332
+ }
333
+ },
334
+ divider: {
335
+ border: BaseTokens.colorGrey800
336
+ },
337
+ item: {
338
+ background: {
339
+ active: BaseTokens.colorBlue950,
340
+ default: 'transparent',
341
+ hover: BaseTokens.colorGrey950
342
+ },
343
+ color: {
344
+ active: BaseTokens.colorBlue400,
345
+ default: BaseTokens.colorGrey50,
346
+ hover: '#fff'
347
+ }
348
+ }
349
+ },
350
+ mode: ThemeMode.dark,
351
+ pending: {
352
+ contrastText: '#fff',
353
+ main: '#118077'
354
+ },
355
+ primary: {
356
+ contrastText: '#000',
357
+ dark: '#4974A5',
358
+ light: '#8bbff9',
359
+ main: '#6eaff8'
360
+ },
361
+ secondary: {
362
+ contrastText: '#fff',
363
+ main: '#7C1FA2'
364
+ },
365
+ statusBackground: {
366
+ error: '#D60101',
367
+ none: alpha('#2E68AA', 0.1),
368
+ pending: '#118077',
369
+ success: '#5F8118',
370
+ unknown: '#666666',
371
+ warning: '#C55400'
372
+ },
373
+ success: {
374
+ contrastText: '#fff',
375
+ main: '#5F8118'
376
+ },
377
+ text: {
378
+ disabled: '#666666',
379
+ primary: '#FFFFFF',
380
+ secondary: '#CCCCCC'
381
+ },
382
+ warning: {
383
+ contrastText: '#fff',
384
+ main: '#C55400'
385
+ }
386
+ };
387
+
388
+ export const getPalette = (mode: ThemeMode): PaletteOptions =>
389
+ equals(mode, ThemeMode.dark) ? darkPalette : lightPalette;
@@ -0,0 +1,3 @@
1
+ `// TODO`
2
+
3
+ - [ ] integrate design tokens with MUI ThemeProvider
@@ -0,0 +1,5 @@
1
+ {
2
+ "tokenSetOrder": [
3
+ "base"
4
+ ]
5
+ }