@centreon/ui 24.5.13 → 24.6.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 (28) hide show
  1. package/package.json +1 -1
  2. package/src/Graph/LineChart/BasicComponents/Axes/index.tsx +12 -3
  3. package/src/Graph/LineChart/BasicComponents/Axes/models.ts +3 -1
  4. package/src/Graph/LineChart/BasicComponents/Grids/index.tsx +28 -4
  5. package/src/Graph/LineChart/BasicComponents/Lines/Point.tsx +36 -0
  6. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +37 -8
  7. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +65 -6
  8. package/src/Graph/LineChart/BasicComponents/Lines/index.tsx +59 -6
  9. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +1 -1
  10. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +1 -1
  11. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +9 -3
  12. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +36 -4
  13. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +2 -2
  14. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/index.tsx +10 -11
  15. package/src/Graph/LineChart/Legend/Legend.styles.ts +27 -4
  16. package/src/Graph/LineChart/Legend/LegendHeader.tsx +14 -4
  17. package/src/Graph/LineChart/Legend/index.tsx +41 -12
  18. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +273 -10
  19. package/src/Graph/LineChart/LineChart.tsx +195 -98
  20. package/src/Graph/LineChart/common/index.ts +7 -4
  21. package/src/Graph/LineChart/index.stories.tsx +11 -1
  22. package/src/Graph/LineChart/index.tsx +12 -7
  23. package/src/Graph/LineChart/models.ts +27 -2
  24. package/src/Graph/common/timeSeries/index.ts +39 -6
  25. package/src/Graph/common/timeSeries/models.ts +7 -1
  26. package/src/Graph/common/utils.ts +32 -0
  27. package/src/InputField/Number/Number.tsx +4 -3
  28. package/src/InputField/Text/index.tsx +14 -0
@@ -6,6 +6,7 @@ import {
6
6
  gt,
7
7
  gte,
8
8
  head,
9
+ isNil,
9
10
  length,
10
11
  lt,
11
12
  lte,
@@ -140,3 +141,34 @@ export const emphasizeCurveColor = ({
140
141
 
141
142
  return darken(color, normalizeLevel({ factor, level: levels[index] }));
142
143
  };
144
+
145
+ interface GetStrokeDashArrayProps {
146
+ dashLength?: number;
147
+ dashOffset?: number;
148
+ dotOffset?: number;
149
+ lineWidth?: number;
150
+ }
151
+
152
+ export const getStrokeDashArray = ({
153
+ dashLength,
154
+ dashOffset,
155
+ dotOffset,
156
+ lineWidth
157
+ }: GetStrokeDashArrayProps): string | undefined => {
158
+ if (isNil(dotOffset) && isNil(dashLength) && isNil(dashOffset)) {
159
+ return undefined;
160
+ }
161
+
162
+ if (dotOffset) {
163
+ return `${lineWidth} ${dotOffset}`;
164
+ }
165
+
166
+ if (dashLength || dashOffset) {
167
+ return `${dashLength || 1} ${dashOffset || 1}`;
168
+ }
169
+
170
+ return undefined;
171
+ };
172
+
173
+ export const getPointRadius = (lineWidth?: number): number =>
174
+ Math.max(Math.ceil((lineWidth ?? 2) * 1.2), 2);
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent, useState } from 'react';
2
2
 
3
- import { T, always, cond, isEmpty, isNil } from 'ramda';
3
+ import { T, always, clamp, cond, isEmpty } from 'ramda';
4
4
 
5
5
  import TextField, { TextProps } from '../Text';
6
6
 
@@ -43,8 +43,9 @@ const NumberField = ({
43
43
  [
44
44
  T,
45
45
  always(
46
- Math.max(
47
- !isNil(inputProps?.min) ? inputProps?.min : -Infinity,
46
+ clamp(
47
+ inputProps?.min || -Infinity,
48
+ inputProps?.max || Infinity,
48
49
  number
49
50
  )
50
51
  )
@@ -22,6 +22,12 @@ const useStyles = makeStyles()((theme: Theme) => ({
22
22
  paddingRight: theme.spacing(1),
23
23
  paddingTop: theme.spacing(0.6)
24
24
  },
25
+ compactLabel: {
26
+ top: '-10px'
27
+ },
28
+ compactLabelShrink: {
29
+ top: '0px'
30
+ },
25
31
  hiddenText: {
26
32
  display: 'table',
27
33
  lineHeight: 0,
@@ -164,6 +170,14 @@ const TextField = forwardRef(
164
170
  onChange={changeInputValue}
165
171
  {...getValueProps()}
166
172
  {...rest}
173
+ InputLabelProps={{
174
+ classes: {
175
+ root: cx(equals(size, 'compact') && classes.compactLabel),
176
+ shrink: cx(
177
+ equals(size, 'compact') && classes.compactLabelShrink
178
+ )
179
+ }
180
+ }}
167
181
  InputProps={{
168
182
  className: cx(
169
183
  classes.inputBase,