@centreon/ui 25.8.2 → 25.9.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.9.1",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
@@ -106,7 +106,6 @@
|
|
|
106
106
|
"storybook-dark-mode": "^4.0.2",
|
|
107
107
|
"storybook-react-rsbuild": "^1.0.1",
|
|
108
108
|
"style-dictionary": "^4.3.3",
|
|
109
|
-
"tailwind": "^4.0.0",
|
|
110
109
|
"tailwindcss": "^4.1.7",
|
|
111
110
|
"ts-node": "^10.9.2",
|
|
112
111
|
"use-resize-observer": "^9.1.0",
|
package/src/Module/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { StylesProvider, createGenerateClassName } from '@mui/styles';
|
|
|
5
5
|
|
|
6
6
|
import { QueryProvider, ThemeProvider } from '..';
|
|
7
7
|
import SnackbarProvider from '../Snackbar/SnackbarProvider';
|
|
8
|
+
import { ThemeOptions } from '@mui/material';
|
|
8
9
|
|
|
9
10
|
export interface ModuleProps {
|
|
10
11
|
children: React.ReactElement;
|
|
@@ -12,6 +13,10 @@ export interface ModuleProps {
|
|
|
12
13
|
queryClient?: QueryClient;
|
|
13
14
|
seedName: string;
|
|
14
15
|
store: ReturnType<typeof createStore>;
|
|
16
|
+
overrideTheme?: {
|
|
17
|
+
light: Partial<ThemeOptions>;
|
|
18
|
+
dark: Partial<ThemeOptions>;
|
|
19
|
+
};
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
const Module = ({
|
|
@@ -19,7 +24,8 @@ const Module = ({
|
|
|
19
24
|
seedName,
|
|
20
25
|
maxSnackbars = 3,
|
|
21
26
|
store,
|
|
22
|
-
queryClient
|
|
27
|
+
queryClient,
|
|
28
|
+
overrideTheme
|
|
23
29
|
}: ModuleProps): JSX.Element => {
|
|
24
30
|
const generateClassName = createGenerateClassName({
|
|
25
31
|
seed: seedName
|
|
@@ -29,7 +35,7 @@ const Module = ({
|
|
|
29
35
|
<QueryProvider queryClient={queryClient}>
|
|
30
36
|
<JotaiProvider store={store}>
|
|
31
37
|
<StylesProvider generateClassName={generateClassName}>
|
|
32
|
-
<ThemeProvider>
|
|
38
|
+
<ThemeProvider overrideTheme={overrideTheme}>
|
|
33
39
|
<SnackbarProvider maxSnackbars={maxSnackbars}>
|
|
34
40
|
{children}
|
|
35
41
|
</SnackbarProvider>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@layer base {
|
|
2
|
+
::-webkit-scrollbar {
|
|
3
|
+
height: var(--spacing-2);
|
|
4
|
+
width: var(--spacing-2);
|
|
5
|
+
background-color: transparent;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
::-webkit-scrollbar-thumb {
|
|
9
|
+
background-color: var(--color-text-disabled);
|
|
10
|
+
border-radius: var(--spacing-1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
::-webkit-scrollbar-thumb:hover {
|
|
14
|
+
background-color: var(--color-primary-main);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
* {
|
|
18
|
+
scrollbar-color: var(--color-text-disabled) var(--color-background-default);
|
|
19
|
+
scrollbar-width: thin;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
html {
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
text-rendering: optimizeLegibility;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
body {
|
|
31
|
+
background-color: var(--color-background-paper);
|
|
32
|
+
height: 100%;
|
|
33
|
+
padding: 0;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#root {
|
|
38
|
+
background-color: var(--color-background-paper) !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@variant dark {
|
|
42
|
+
::-webkit-scrollbar-thumb {
|
|
43
|
+
background-color: var(--color-divider);
|
|
44
|
+
}
|
|
45
|
+
* {
|
|
46
|
+
scrollbar-color: var(--color-divider) var(--color-background-default);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useAtomValue } from 'jotai';
|
|
2
|
-
import { equals } from 'ramda';
|
|
2
|
+
import { equals, mergeDeepRight } from 'ramda';
|
|
3
3
|
import { CSSInterpolation } from 'tss-react';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ButtonProps,
|
|
7
7
|
InputBaseProps,
|
|
8
8
|
ThemeProvider as MuiThemeProvider,
|
|
9
|
+
PaletteOptions,
|
|
9
10
|
StyledEngineProvider,
|
|
10
11
|
Theme,
|
|
11
12
|
createTheme
|
|
@@ -147,46 +148,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
147
148
|
},
|
|
148
149
|
MuiCssBaseline: {
|
|
149
150
|
styleOverrides: (theme) => `
|
|
150
|
-
::-webkit-scrollbar {
|
|
151
|
-
height: ${theme.spacing(1)};
|
|
152
|
-
width: ${theme.spacing(1)};
|
|
153
|
-
background-color: transparent;
|
|
154
|
-
}
|
|
155
|
-
::-webkit-scrollbar-thumb {
|
|
156
|
-
background-color: ${
|
|
157
|
-
equals(mode, 'dark')
|
|
158
|
-
? theme.palette.divider
|
|
159
|
-
: theme.palette.text.disabled
|
|
160
|
-
};
|
|
161
|
-
border-radius: ${theme.spacing(0.5)};
|
|
162
|
-
}
|
|
163
|
-
::-webkit-scrollbar-thumb:hover {
|
|
164
|
-
background-color: ${theme.palette.primary.main};
|
|
165
|
-
}
|
|
166
|
-
* {
|
|
167
|
-
scrollbar-color: ${
|
|
168
|
-
equals(mode, 'dark')
|
|
169
|
-
? theme.palette.divider
|
|
170
|
-
: theme.palette.text.disabled
|
|
171
|
-
} ${theme.palette.background.default};
|
|
172
|
-
scrollbar-width: thin;
|
|
173
|
-
}
|
|
174
|
-
html {
|
|
175
|
-
margin: 0;
|
|
176
|
-
padding: 0;
|
|
177
|
-
width: 100%;
|
|
178
|
-
height: 100%;
|
|
179
|
-
text-rendering: optimizeLegibility;
|
|
180
|
-
}
|
|
181
|
-
body {
|
|
182
|
-
background-color: ${theme.palette.background.paper};
|
|
183
|
-
height: 100%;
|
|
184
|
-
padding: 0;
|
|
185
|
-
width: 100%;
|
|
186
|
-
}
|
|
187
|
-
#root {
|
|
188
|
-
background-color: ${theme.palette.background.paper};
|
|
189
|
-
}
|
|
190
151
|
@font-face {
|
|
191
152
|
font-family: 'Roboto';
|
|
192
153
|
font-style: normal;
|
|
@@ -211,6 +172,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
211
172
|
font-weight: 700;
|
|
212
173
|
src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
|
|
213
174
|
}
|
|
175
|
+
body {
|
|
176
|
+
background-color: ${theme.palette.background.paper};
|
|
177
|
+
}
|
|
214
178
|
`
|
|
215
179
|
},
|
|
216
180
|
MuiInputBase: {
|
|
@@ -294,15 +258,23 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
|
|
|
294
258
|
|
|
295
259
|
interface Props {
|
|
296
260
|
children: ReactNode;
|
|
261
|
+
overrideTheme?: {
|
|
262
|
+
light: Partial<PaletteOptions>;
|
|
263
|
+
dark: Partial<PaletteOptions>;
|
|
264
|
+
};
|
|
297
265
|
}
|
|
298
266
|
|
|
299
|
-
const ThemeProvider = ({ children }: Props): JSX.Element => {
|
|
267
|
+
const ThemeProvider = ({ children, overrideTheme }: Props): JSX.Element => {
|
|
300
268
|
const { themeMode } = useAtomValue(userAtom);
|
|
301
269
|
|
|
302
|
-
const theme = useMemo(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
270
|
+
const theme = useMemo(() => {
|
|
271
|
+
const overrideThemeByMode = overrideTheme?.[themeMode || 'light'];
|
|
272
|
+
return createTheme(
|
|
273
|
+
mergeDeepRight(getTheme(themeMode || ThemeMode.light), {
|
|
274
|
+
palette: overrideThemeByMode || {}
|
|
275
|
+
})
|
|
276
|
+
);
|
|
277
|
+
}, [themeMode, overrideTheme]);
|
|
306
278
|
|
|
307
279
|
return (
|
|
308
280
|
<StyledEngineProvider injectFirst enableCssLayer>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
|
+
@import "./base.css"; /* Base styles: scrollbar, html, body, #root */
|
|
2
3
|
|
|
3
4
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
4
5
|
|
|
5
6
|
@theme {
|
|
7
|
+
/* Typography */
|
|
6
8
|
--font-body: Roboto, Arial, serif;
|
|
7
9
|
|
|
10
|
+
/* Spacing system */
|
|
8
11
|
--spacing: 4px;
|
|
9
12
|
|
|
10
13
|
--spacing-0: calc(var(--spacing) * 0);
|
|
@@ -19,6 +22,11 @@
|
|
|
19
22
|
--spacing-9: calc(var(--spacing) * 9);
|
|
20
23
|
--spacing-10: calc(var(--spacing) * 10);
|
|
21
24
|
|
|
25
|
+
/* =============
|
|
26
|
+
COLOR SYSTEM
|
|
27
|
+
============= */
|
|
28
|
+
|
|
29
|
+
/* Action colors */
|
|
22
30
|
--color-action-acknowledged: #745f35;
|
|
23
31
|
--color-action-acknowledged-background: #dfd2b9;
|
|
24
32
|
--color-action-in-flapping: #064a3f;
|
|
@@ -35,6 +43,8 @@
|
|
|
35
43
|
--color-action-in-downtime-background: #e5d8f3;
|
|
36
44
|
--color-action-selected: rgba(102, 102, 102, 0.3);
|
|
37
45
|
--color-action-selected-opacity: 0.3;
|
|
46
|
+
|
|
47
|
+
/* Background colors */
|
|
38
48
|
--color-background-default: #f4f4f4;
|
|
39
49
|
--color-background-listing-header: #666666;
|
|
40
50
|
--color-background-panel: #ededed;
|
|
@@ -42,13 +52,19 @@
|
|
|
42
52
|
--color-background-paper: #ffffff;
|
|
43
53
|
--color-background-tooltip: #434e58;
|
|
44
54
|
--color-background-widget: #f8f8f8;
|
|
55
|
+
|
|
56
|
+
/* Chip colors */
|
|
45
57
|
--color-chip-error: #ff6666;
|
|
46
58
|
--color-chip-info: #1588d1;
|
|
47
59
|
--color-chip-neutral: #6da4e4;
|
|
48
60
|
--color-chip-success: #88b922;
|
|
49
61
|
--color-chip-warning: #fd9b27;
|
|
62
|
+
|
|
63
|
+
/* Utility colors */
|
|
50
64
|
--color-divider: #e3e3e3;
|
|
51
65
|
--color-error-main: #ff4a4a;
|
|
66
|
+
|
|
67
|
+
/* Header colors */
|
|
52
68
|
--color-header-page-action-background-active: #1975d10f;
|
|
53
69
|
--color-header-page-action-background-default: #ffffff00;
|
|
54
70
|
--color-header-page-action-color-active: #1976d2;
|
|
@@ -74,13 +90,19 @@
|
|
|
74
90
|
--color-header-menu-item-color-active: #3e85d5;
|
|
75
91
|
--color-header-menu-item-color-default: #1b2127;
|
|
76
92
|
--color-header-menu-item-color-hover: #101418;
|
|
93
|
+
|
|
94
|
+
/* State colors */
|
|
77
95
|
--color-pending-main: #1ebeb3;
|
|
96
|
+
|
|
97
|
+
/* Primary & Secondary colors */
|
|
78
98
|
--color-primary-main: #2e68aa;
|
|
79
99
|
--color-primary-light: #cde7fc;
|
|
80
100
|
--color-primary-dark: #255891;
|
|
81
101
|
--color-secondary-main: #c772d6;
|
|
82
102
|
--color-secondary-light: #e5a5f0;
|
|
83
103
|
--color-secondary-dark: #ac28c1;
|
|
104
|
+
|
|
105
|
+
/* Status colors */
|
|
84
106
|
--color-status-background-error: #ff6666;
|
|
85
107
|
--color-status-background-none: --alpha(#2e68aa / 10%);
|
|
86
108
|
--color-status-background-pending: #1ebeb3;
|
|
@@ -88,12 +110,16 @@
|
|
|
88
110
|
--color-stauts-background-unknown: #e3e3e3;
|
|
89
111
|
--color-status-background-warning: #fd9b27;
|
|
90
112
|
--color-success-main: #88b922;
|
|
113
|
+
|
|
114
|
+
/* Text colors */
|
|
91
115
|
--color-text-disabled: #999999;
|
|
92
116
|
--color-text-primary: #000000;
|
|
93
117
|
--color-text-secondary: #666666;
|
|
94
118
|
--color-warning-main: #fd9b27;
|
|
95
119
|
--color-warning-light: #fcc481;
|
|
96
120
|
--color-warning-dark: #fc7e00;
|
|
121
|
+
|
|
122
|
+
/* Base colors */
|
|
97
123
|
--color-white: #ffffff;
|
|
98
124
|
--color-black: #000000;
|
|
99
125
|
}
|