@centreon/ui 25.8.1 → 25.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.8.1",
3
+ "version": "25.9.0",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -259,4 +259,4 @@ export const mixedStackedMinMax: Story = {
259
259
  max: 20
260
260
  },
261
261
  render: Template
262
- };
262
+ };
@@ -73,7 +73,7 @@ const BarChart = ({
73
73
  max,
74
74
  boundariesUnit
75
75
  }: BarChartProps): JSX.Element => {
76
- const { adjustedData } = useChartData({ data, end, start });
76
+ const { adjustedData } = useChartData({ data, end, start, min, max });
77
77
  const { ref, width, height: responsiveHeight } = useResizeObserver();
78
78
 
79
79
  if (loading && !adjustedData) {
@@ -116,4 +116,4 @@ const BarChart = ({
116
116
  );
117
117
  };
118
118
 
119
- export default BarChart;
119
+ export default BarChart;
@@ -180,7 +180,7 @@ describe('Line chart', () => {
180
180
  cy.contains('06/18/2023').should('be.visible');
181
181
 
182
182
  cy.contains('0.4 s').should('be.visible');
183
- cy.contains('75.64%').should('be.visible');
183
+ cy.contains('75.64%').should('be.visible');
184
184
 
185
185
  cy.makeSnapshot();
186
186
  });
@@ -451,7 +451,7 @@ describe('Line chart', () => {
451
451
 
452
452
  cy.contains(':00 AM').should('be.visible');
453
453
 
454
- cy.get('text[transform="rotate(-35, -2, 198.7929601526369)"]').should(
454
+ cy.get('text[transform="rotate(-35, -2, 274.47726401277305)"]').should(
455
455
  'be.visible'
456
456
  );
457
457
 
@@ -533,7 +533,7 @@ describe('Line chart', () => {
533
533
  checkGraphWidth();
534
534
  cy.contains(':00 AM').should('be.visible');
535
535
  cy.get('circle[cx="250.83333333333334"]').should('be.visible');
536
- cy.get('circle[cy="246.2421135204699"]').should('be.visible');
536
+ cy.get('circle[cy="251.79089393069725"]').should('be.visible');
537
537
 
538
538
  cy.makeSnapshot();
539
539
  });
@@ -746,11 +746,9 @@ describe('Lines and bars', () => {
746
746
 
747
747
  checkGraphWidth();
748
748
 
749
- cy.get(
750
- 'path[d="M7.501377410468319,278.09035407759154 h56.51239669421488 h1v1 v95.90964592240846 a1,1 0 0 1 -1,1 h-56.51239669421488 a1,1 0 0 1 -1,-1 v-95.90964592240846 v-1h1z'
751
- );
752
- cy.get(
753
- 'path[d="M24.05509641873278,225.7604521029811 h23.404958677685954 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,17.553719008264462 v17.222463958081512 v17.553719008264462h-17.553719008264462 h-23.404958677685954 h-17.553719008264462v-17.553719008264462 v-17.222463958081512 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,-17.553719008264462z"]'
749
+ cy.get('path[d="M7.501377410468319,350.5553648585503 h56.51239669421488 h1v1 v23.44463514144968 a1,1 0 0 1 -1,1 h-56.51239669421488 a1,1 0 0 1 -1,-1 v-23.44463514144968 v-1h1z"]'
750
+ ).should('be.visible');
751
+ cy.get('path[d="M24.05509641873278,201.58170928199803 h23.404958677685954 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,17.553719008264462 v113.86621756002336 v17.553719008264462h-17.553719008264462 h-23.404958677685954 h-17.553719008264462v-17.553719008264462 v-113.86621756002336 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,-17.553719008264462z"]'
754
752
  ).should('be.visible');
755
753
 
756
754
  cy.makeSnapshot();
@@ -394,4 +394,4 @@ const Chart = ({
394
394
  );
395
395
  };
396
396
 
397
- export default Chart;
397
+ export default Chart;
@@ -193,4 +193,4 @@ export interface GraphTooltipData {
193
193
  unit: string;
194
194
  value: number;
195
195
  }>;
196
- }
196
+ }
@@ -766,4 +766,4 @@ export {
766
766
  formatMetricValueWithUnit,
767
767
  getYScaleUnit,
768
768
  getYScalePerUnit
769
- };
769
+ };
@@ -4,6 +4,7 @@ import { makeStyles } from 'tss-react/mui';
4
4
  import {
5
5
  Divider,
6
6
  FormControl,
7
+ FormControlProps,
7
8
  FormHelperText,
8
9
  InputLabel,
9
10
  ListSubheader,
@@ -59,6 +60,7 @@ type Props = {
59
60
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
60
61
  options: Array<SelectEntry>;
61
62
  selectedOptionId: number | string;
63
+ formControlProps: FormControlProps;
62
64
  } & Omit<SelectProps, 'error'>;
63
65
 
64
66
  const SelectField = ({
@@ -72,6 +74,7 @@ const SelectField = ({
72
74
  ariaLabel,
73
75
  inputProps,
74
76
  compact = false,
77
+ formControlProps,
75
78
  ...props
76
79
  }: Props): JSX.Element => {
77
80
  const { classes, cx } = useStyles();
@@ -92,6 +95,8 @@ const SelectField = ({
92
95
  error={!isNil(error)}
93
96
  fullWidth={fullWidth}
94
97
  size="small"
98
+ {...formControlProps}
99
+
95
100
  >
96
101
  {label && <InputLabel>{label}</InputLabel>}
97
102
  <Select
@@ -146,4 +151,4 @@ const SelectField = ({
146
151
  );
147
152
  };
148
153
 
149
- export default SelectField;
154
+ export default SelectField;
@@ -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
+ }
@@ -26,7 +26,7 @@ import { ReactNode, useMemo } from 'react';
26
26
  import { getPalette } from './palettes';
27
27
 
28
28
  declare module '@mui/styles/defaultTheme' {
29
- interface DefaultTheme extends Theme {}
29
+ interface DefaultTheme extends Theme { }
30
30
  }
31
31
 
32
32
  declare module '@mui/material/TextField' {
@@ -147,46 +147,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
147
147
  },
148
148
  MuiCssBaseline: {
149
149
  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
150
  @font-face {
191
151
  font-family: 'Roboto';
192
152
  font-style: normal;
@@ -211,6 +171,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
211
171
  font-weight: 700;
212
172
  src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
213
173
  }
174
+ body {
175
+ background-color: ${theme.palette.background.paper};
176
+ }
214
177
  `
215
178
  },
216
179
  MuiInputBase: {
@@ -235,14 +198,14 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
235
198
  styleOverrides: {
236
199
  root: ({ theme }) => ({
237
200
  '&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected:focus':
238
- {
239
- background: equals(theme.palette.mode, ThemeMode.dark)
240
- ? theme.palette.primary.dark
241
- : theme.palette.primary.light,
242
- color: equals(theme.palette.mode, ThemeMode.dark)
243
- ? theme.palette.common.white
244
- : theme.palette.primary.main
245
- },
201
+ {
202
+ background: equals(theme.palette.mode, ThemeMode.dark)
203
+ ? theme.palette.primary.dark
204
+ : theme.palette.primary.light,
205
+ color: equals(theme.palette.mode, ThemeMode.dark)
206
+ ? theme.palette.common.white
207
+ : theme.palette.primary.main
208
+ },
246
209
  fontSize: theme.typography.body2.fontSize
247
210
  })
248
211
  }
@@ -259,12 +222,12 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
259
222
  styleOverrides: {
260
223
  root: ({ theme }) => ({
261
224
  [`[role="tooltip"] &, &.MuiMenu-paper, &.${autocompleteClasses.paper}`]:
262
- {
263
- backgroundColor: theme.palette.background.default,
264
- border: 'none',
265
- borderRadius: `${theme.shape.borderRadius}px`,
266
- boxShadow: theme.shadows[3]
267
- }
225
+ {
226
+ backgroundColor: theme.palette.background.default,
227
+ border: 'none',
228
+ borderRadius: `${theme.shape.borderRadius}px`,
229
+ boxShadow: theme.shadows[3]
230
+ }
268
231
  })
269
232
  }
270
233
  },
@@ -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
  }