@centreon/ui 25.3.4 → 25.4.0-MON-191119-npm-develop.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 (176) hide show
  1. package/package.json +25 -11
  2. package/public/mockServiceWorker.js +8 -31
  3. package/src/Button/Save/index.stories.tsx +1 -0
  4. package/src/Checkbox/Checkbox.tsx +3 -1
  5. package/src/Checkbox/CheckboxGroup/index.tsx +6 -1
  6. package/src/Colors/index.tsx +1 -1
  7. package/src/Dashboard/Dashboard.styles.ts +1 -1
  8. package/src/Dashboard/Layout.tsx +1 -1
  9. package/src/Dialog/UnsavedChanges/index.stories.tsx +1 -0
  10. package/src/Form/CollapsibleGroup.tsx +13 -13
  11. package/src/Form/Form.cypress.spec.tsx +137 -2
  12. package/src/Form/Form.stories.tsx +11 -31
  13. package/src/Form/Form.tsx +2 -0
  14. package/src/Form/Inputs/Checkbox.tsx +3 -2
  15. package/src/Form/Inputs/ConnectedAutocomplete.tsx +6 -1
  16. package/src/Form/Inputs/Grid.tsx +18 -29
  17. package/src/Form/Inputs/SubGroupDivider.tsx +7 -0
  18. package/src/Form/Inputs/Text.tsx +1 -0
  19. package/src/Form/Inputs/index.tsx +31 -24
  20. package/src/Form/Inputs/models.ts +8 -1
  21. package/src/Form/Section/FormSection.tsx +34 -0
  22. package/src/Form/Section/PanelTabs.tsx +13 -0
  23. package/src/Form/Section/navigateToSection.ts +9 -0
  24. package/src/Form/storiesData.tsx +14 -4
  25. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +46 -6
  26. package/src/Graph/BarChart/BarChart.stories.tsx +60 -0
  27. package/src/Graph/BarChart/BarChart.tsx +56 -32
  28. package/src/Graph/BarChart/BarGroup.tsx +22 -32
  29. package/src/Graph/BarChart/MemoizedGroup.tsx +8 -11
  30. package/src/Graph/BarChart/ResponsiveBarChart.tsx +145 -32
  31. package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +2 -2
  32. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
  33. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +18 -45
  34. package/src/Graph/Chart/BasicComponents/Lines/index.tsx +42 -28
  35. package/src/Graph/Chart/Chart.cypress.spec.tsx +85 -15
  36. package/src/Graph/Chart/Chart.stories.tsx +84 -1
  37. package/src/Graph/Chart/Chart.tsx +17 -4
  38. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +8 -2
  39. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +10 -3
  40. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +19 -2
  41. package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +2 -4
  42. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/index.tsx +14 -3
  43. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/models.ts +3 -0
  44. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +12 -10
  45. package/src/Graph/Chart/InteractiveComponents/index.tsx +63 -5
  46. package/src/Graph/Chart/Legend/index.tsx +26 -2
  47. package/src/Graph/Chart/index.tsx +45 -45
  48. package/src/Graph/Chart/models.ts +8 -0
  49. package/src/Graph/Chart/useChartData.ts +14 -2
  50. package/src/Graph/Gauge/Gauge.tsx +18 -14
  51. package/src/Graph/Gauge/ResponsiveGauge.tsx +10 -6
  52. package/src/Graph/Gauge/useResizeObserver.ts +68 -0
  53. package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +18 -16
  54. package/src/Graph/SingleBar/ThresholdLine.tsx +4 -4
  55. package/src/Graph/SingleBar/models.ts +1 -0
  56. package/src/Graph/Text/Text.styles.ts +2 -2
  57. package/src/Graph/Text/Text.tsx +23 -10
  58. package/src/Graph/Timeline/ResponsiveTimeline.tsx +4 -0
  59. package/src/Graph/Timeline/Timeline.tsx +21 -4
  60. package/src/Graph/Tree/Links.tsx +2 -2
  61. package/src/Graph/Tree/Tree.tsx +2 -2
  62. package/src/Graph/Tree/constants.ts +1 -1
  63. package/src/Graph/common/BaseChart/BaseChart.tsx +6 -1
  64. package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +5 -4
  65. package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
  66. package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +13 -9
  67. package/src/Graph/common/timeSeries/index.test.ts +20 -0
  68. package/src/Graph/common/timeSeries/index.ts +225 -44
  69. package/src/Graph/common/timeSeries/models.ts +6 -2
  70. package/src/Graph/common/utils.ts +45 -12
  71. package/src/Graph/index.ts +3 -1
  72. package/src/Graph/mockedData/dataWithMissingPoint.json +74 -0
  73. package/src/Graph/mockedData/pingServiceWithStackedKeys.json +205 -0
  74. package/src/Icon/RegexIcon.tsx +20 -0
  75. package/src/Icon/index.ts +1 -0
  76. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +68 -14
  77. package/src/InputField/Select/Autocomplete/Connected/index.tsx +49 -14
  78. package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +78 -0
  79. package/src/InputField/Select/Autocomplete/Multi/Multi.styles.ts +26 -0
  80. package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +124 -0
  81. package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -117
  82. package/src/InputField/Select/Autocomplete/index.tsx +28 -17
  83. package/src/InputField/Select/Option.tsx +3 -3
  84. package/src/InputField/Select/index.tsx +4 -0
  85. package/src/InputField/Text/index.tsx +4 -2
  86. package/src/InputField/translatedLabels.ts +4 -0
  87. package/src/Listing/ActionBar/Pagination.tsx +10 -23
  88. package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
  89. package/src/Listing/ActionBar/index.tsx +1 -1
  90. package/src/Listing/Cell/DataCell.tsx +6 -6
  91. package/src/Listing/Cell/EllipsisTypography.tsx +10 -32
  92. package/src/Listing/Cell/index.tsx +37 -76
  93. package/src/Listing/Checkbox.tsx +8 -20
  94. package/src/Listing/Header/Cell/ListingHeaderCell.tsx +17 -14
  95. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +5 -9
  96. package/src/Listing/Header/ListingHeader.tsx +2 -5
  97. package/src/Listing/Header/_internals/Label.tsx +1 -17
  98. package/src/Listing/Row/EmptyRow.tsx +2 -6
  99. package/src/Listing/Row/Row.tsx +7 -36
  100. package/src/Listing/index.stories.tsx +1 -0
  101. package/src/Listing/index.tsx +26 -26
  102. package/src/Listing/useStyleTable.ts +58 -32
  103. package/src/ListingPage/index.stories.tsx +1 -0
  104. package/src/Module/index.tsx +8 -2
  105. package/src/MultiSelectEntries/index.stories.tsx +1 -0
  106. package/src/MultiSelectEntries/index.tsx +1 -1
  107. package/src/Pagination/Pagination.cypress.spec.tsx +137 -0
  108. package/src/Pagination/Pagination.stories.tsx +46 -0
  109. package/src/Pagination/Pagination.styles.ts +56 -0
  110. package/src/Pagination/Pagination.tsx +146 -0
  111. package/src/Pagination/index.ts +3 -0
  112. package/src/Pagination/utils.ts +7 -0
  113. package/src/SortableItems/index.stories.tsx +2 -2
  114. package/src/StoryBookThemeProvider/index.tsx +3 -1
  115. package/src/ThemeProvider/base.css +49 -0
  116. package/src/ThemeProvider/index.tsx +21 -47
  117. package/src/ThemeProvider/palettes.ts +3 -1
  118. package/src/ThemeProvider/tailwindcss.css +230 -0
  119. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +9 -11
  120. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +1 -0
  121. package/src/TimePeriods/DateTimePickerInput.tsx +3 -1
  122. package/src/api/models.ts +9 -0
  123. package/src/api/useGraphQuery/index.ts +108 -12
  124. package/src/components/Avatar/Avatar.stories.tsx +1 -0
  125. package/src/components/Button/Button.module.css +38 -0
  126. package/src/components/Button/Button.stories.tsx +25 -0
  127. package/src/components/Button/Button.tsx +2 -5
  128. package/src/components/CrudPage/CrudPage.stories.tsx +1 -0
  129. package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
  130. package/src/components/DataTable/DataTable.stories.tsx +1 -0
  131. package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -0
  132. package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +3 -1
  133. package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
  134. package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -0
  135. package/src/components/Form/AccessRights/AccessRights.stories.tsx +1 -0
  136. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +4 -3
  137. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +15 -10
  138. package/src/components/Form/FormActions.tsx +21 -12
  139. package/src/components/Layout/AreaIndicator.tsx +4 -6
  140. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -0
  141. package/src/components/Layout/PageLayout/PageLayout.tsx +9 -3
  142. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +5 -3
  143. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +5 -3
  144. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -3
  145. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +17 -17
  146. package/src/components/Menu/Button/MenuButton.tsx +6 -6
  147. package/src/components/Menu/MenuDivider.tsx +1 -5
  148. package/src/components/Menu/MenuItem.tsx +1 -5
  149. package/src/components/Menu/MenuItems.tsx +5 -4
  150. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -0
  151. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +4 -1
  152. package/src/components/Modal/Modal.stories.tsx +21 -0
  153. package/src/components/Modal/Modal.styles.ts +1 -19
  154. package/src/components/Modal/Modal.tsx +1 -1
  155. package/src/components/Modal/ModalBody.tsx +6 -4
  156. package/src/components/Modal/ModalHeader.tsx +9 -5
  157. package/src/components/Modal/modal.module.css +16 -0
  158. package/src/components/Tabs/Tab.styles.ts +0 -6
  159. package/src/components/Tabs/Tabs.tsx +37 -15
  160. package/src/index.ts +3 -0
  161. package/src/queryParameters/url/index.ts +7 -2
  162. package/src/utils/index.ts +1 -0
  163. package/src/utils/useLocale/index.ts +9 -0
  164. package/src/utils/useLocale/useLocale.cypress.spec.tsx +38 -0
  165. package/src/utils/useLocaleDateTimeFormat/index.ts +4 -2
  166. package/src/utils/usePluralizedTranslation.ts +2 -3
  167. package/src/Listing/Cell/DataCell.styles.ts +0 -27
  168. package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
  169. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
  170. package/src/Listing/Header/ListingHeader.styles.ts +0 -16
  171. package/src/Listing/Listing.styles.ts +0 -78
  172. package/src/Listing/Row/EmptyRow.styles.ts +0 -14
  173. package/src/components/Button/Button.styles.ts +0 -44
  174. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
  175. package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
  176. package/src/components/Menu/Menu.styles.ts +0 -68
@@ -10,6 +10,8 @@ import {
10
10
  } from '../common/timeSeries';
11
11
  import { getColorFromDataAndTresholds } from '../common/utils';
12
12
 
13
+ import { type ReactElement } from 'react';
14
+ import useResizeObserver from 'use-resize-observer';
13
15
  import { useTextStyles } from './Text.styles';
14
16
 
15
17
  export interface Props {
@@ -21,6 +23,8 @@ export interface Props {
21
23
  warning: string;
22
24
  };
23
25
  thresholds: Thresholds;
26
+ prefThresholds?: number;
27
+ minThresholds?: string;
24
28
  }
25
29
 
26
30
  export const Text = ({
@@ -28,10 +32,13 @@ export const Text = ({
28
32
  data,
29
33
  displayAsRaw,
30
34
  labels,
31
- baseColor
32
- }: Props): JSX.Element | null => {
35
+ baseColor,
36
+ prefThresholds = 14,
37
+ minThresholds
38
+ }: Props): ReactElement | null => {
33
39
  const theme = useTheme();
34
40
  const { classes, cx } = useTextStyles();
41
+ const { ref, width = 0 } = useResizeObserver();
35
42
 
36
43
  if (isNil(data)) {
37
44
  return null;
@@ -62,11 +69,15 @@ export const Text = ({
62
69
  })
63
70
  );
64
71
 
72
+ const canDisplayThresholdLabel = width > 150;
73
+ const warningLabel = canDisplayThresholdLabel ? `${labels.warning}: ` : '';
74
+ const criticalLabel = canDisplayThresholdLabel ? `${labels.critical}: ` : '';
75
+
65
76
  return (
66
- <div className={classes.graphText}>
77
+ <div className={classes.graphText} ref={ref}>
67
78
  <FluidTypography
68
79
  max="40px"
69
- pref={16}
80
+ pref={14}
70
81
  sx={{ color, fontWeight: 'bold', textAlign: 'center' }}
71
82
  text={
72
83
  formatMetricValueWithUnit({
@@ -80,18 +91,20 @@ export const Text = ({
80
91
  {thresholds.enabled && (
81
92
  <div className={classes.thresholds}>
82
93
  <FluidTypography
83
- containerClassName={cx(classes.threshold, classes.warning)}
94
+ containerClassName={cx(classes.thresholdLabel, classes.warning)}
84
95
  max="30px"
85
- pref={14}
86
- text={`${labels.warning}: ${warningThresholdLabels.join(' - ')}`}
96
+ pref={prefThresholds}
97
+ text={`${warningLabel}${warningThresholdLabels.join(' - ')}`}
87
98
  variant="h5"
99
+ min={minThresholds}
88
100
  />
89
101
  <FluidTypography
90
- containerClassName={cx(classes.threshold, classes.critical)}
102
+ containerClassName={cx(classes.thresholdLabel, classes.critical)}
91
103
  max="30px"
92
- pref={14}
93
- text={`${labels.critical}: ${criticalThresholdLabels.join(' - ')}`}
104
+ pref={prefThresholds}
105
+ text={`${criticalLabel}${criticalThresholdLabels.join(' - ')}`}
94
106
  variant="h5"
107
+ min={minThresholds}
95
108
  />
96
109
  </div>
97
110
  )}
@@ -7,6 +7,8 @@ import {
7
7
  import { Typography, useTheme } from '@mui/material';
8
8
 
9
9
  import dayjs from 'dayjs';
10
+ import timezonePlugin from 'dayjs/plugin/timezone';
11
+ import utc from 'dayjs/plugin/utc';
10
12
 
11
13
  import { userAtom } from '@centreon/ui-context';
12
14
  import { Axis } from '@visx/visx';
@@ -22,6 +24,8 @@ import type { TimelineProps } from './models';
22
24
  import { useStyles } from './timeline.styles';
23
25
  import { useTimeline } from './useTimeline';
24
26
 
27
+ dayjs.extend(utc);
28
+ dayjs.extend(timezonePlugin);
25
29
  interface Props extends TimelineProps {
26
30
  width: number;
27
31
  height: number;
@@ -1,14 +1,31 @@
1
+ import type { ParentSizeProps } from '@visx/responsive/lib/components/ParentSize';
1
2
  import { ParentSize } from '../..';
2
3
 
3
4
  import ResponsiveTimeline from './ResponsiveTimeline';
4
5
  import type { TimelineProps } from './models';
5
6
 
6
- const Timeline = (props: TimelineProps): JSX.Element => (
7
- <ParentSize>
7
+ interface Props extends ParentSizeProps, TimelineProps {}
8
+
9
+ const Timeline = ({
10
+ data,
11
+ startDate,
12
+ endDate,
13
+ TooltipContent,
14
+ tooltipClassName,
15
+ ...rest
16
+ }: Props): JSX.Element => (
17
+ <ParentSize {...rest}>
8
18
  {({ width, height }) => (
9
- <ResponsiveTimeline {...props} height={height} width={width} />
19
+ <ResponsiveTimeline
20
+ data={data}
21
+ startDate={startDate}
22
+ endDate={endDate}
23
+ TooltipContent={TooltipContent}
24
+ tooltipClassName={tooltipClassName}
25
+ height={height}
26
+ width={width}
27
+ />
10
28
  )}
11
29
  </ParentSize>
12
30
  );
13
-
14
31
  export default Timeline;
@@ -26,7 +26,7 @@ const Links = <TData extends BaseProp>({
26
26
  }: Props<TData>): Array<JSX.Element> => {
27
27
  const theme = useTheme();
28
28
 
29
- return links.map((link) => {
29
+ return links.map((link, idx) => {
30
30
  const ancestorIds = link.target
31
31
  .ancestors()
32
32
  .map((ancestor) => ancestor.data.data.id);
@@ -37,7 +37,7 @@ const Links = <TData extends BaseProp>({
37
37
 
38
38
  const LinkComponent = getLinkComponent(treeLink?.type);
39
39
 
40
- const key = `${link.source.data.data.id}-${link.source.data.data.name}-${ancestorIds}_${link.target.data.data.id}-${link.target.data.data.name}-${descendantIds}`;
40
+ const key = `${link.source.data.data.id}-${link.source.data.data.name}-${ancestorIds}_${link.target.data.data.id}-${link.target.data.data.name}-${descendantIds}-${idx}`;
41
41
 
42
42
  return (
43
43
  <LinkComponent
@@ -84,10 +84,10 @@ export const Tree = <TData extends BaseProp>({
84
84
  );
85
85
 
86
86
  return (
87
- <Group left={node.width}>
87
+ <Group left={node.width / 2}>
88
88
  <VisxTree
89
89
  left={0}
90
- nodeSize={[node.width + nodeMargins.y, node.height + nodeMargins.x]}
90
+ nodeSize={[node.height + nodeMargins.x, node.height + node.width]}
91
91
  root={hierarchy(formattedTree, getExpanded)}
92
92
  separation={() => 1}
93
93
  size={[containerWidth, containerHeight]}
@@ -1,2 +1,2 @@
1
1
  export const margins = { bottom: 30, left: 30, right: 30, top: 30 };
2
- export const nodeMargins = { x: 90, y: 16 };
2
+ export const nodeMargins = { x: 2 };
@@ -19,7 +19,10 @@ interface Props {
19
19
  header?: LineChartHeader;
20
20
  height: number | null;
21
21
  isHorizontal?: boolean;
22
- legend: Pick<LegendModel, 'renderExtraComponent' | 'placement' | 'mode'> & {
22
+ legend: Pick<
23
+ LegendModel,
24
+ 'renderExtraComponent' | 'placement' | 'mode' | 'secondaryClick'
25
+ > & {
23
26
  displayLegend: boolean;
24
27
  legendHeight?: number;
25
28
  };
@@ -101,6 +104,7 @@ const BaseChart = ({
101
104
  shouldDisplayLegendInCompactMode={
102
105
  shouldDisplayLegendInCompactMode
103
106
  }
107
+ secondaryClick={legend?.secondaryClick}
104
108
  />
105
109
  </div>
106
110
  )}
@@ -122,6 +126,7 @@ const BaseChart = ({
122
126
  renderExtraComponent={legend.renderExtraComponent}
123
127
  setLinesGraph={setLines}
124
128
  shouldDisplayLegendInCompactMode={shouldDisplayLegendInCompactMode}
129
+ secondaryClick={legend?.secondaryClick}
125
130
  />
126
131
  </div>
127
132
  )}
@@ -8,6 +8,7 @@ import { ChartAxis } from '../../Chart/models';
8
8
  import Axes from '../Axes';
9
9
  import Grids from '../Grids';
10
10
  import { Line, TimeValue } from '../timeSeries/models';
11
+ import { computeGElementMarginLeft } from '../utils';
11
12
 
12
13
  interface Props {
13
14
  allUnits: Array<string>;
@@ -58,10 +59,10 @@ const ChartSvgWrapper = ({
58
59
  width="100%"
59
60
  >
60
61
  <Group.Group
61
- left={
62
- maxAxisCharacters * 5 +
63
- (hasSecondUnit ? margin.top * 0.8 : margin.top * 0.6)
64
- }
62
+ left={computeGElementMarginLeft({
63
+ maxCharacters: maxAxisCharacters,
64
+ hasSecondUnit
65
+ })}
65
66
  top={margin.top}
66
67
  >
67
68
  {showGridLines && (
@@ -1,3 +1,5 @@
1
+ import { ReactElement } from 'react';
2
+
1
3
  import Typography from '@mui/material/Typography';
2
4
 
3
5
  import { useMemoComponent } from '@centreon/ui';
@@ -10,7 +12,7 @@ interface Props {
10
12
  title: string;
11
13
  }
12
14
 
13
- const Header = ({ title, header }: Props): JSX.Element => {
15
+ const Header = ({ title, header }: Props): ReactElement => {
14
16
  const { classes } = ussHeaderChartStyles();
15
17
 
16
18
  const displayTitle = header?.displayTitle ?? true;
@@ -1,7 +1,8 @@
1
- import { MutableRefObject, useRef } from 'react';
1
+ import { RefCallback } from 'react';
2
2
 
3
3
  import { equals, isNil } from 'ramda';
4
4
 
5
+ import useResizeObserver from 'use-resize-observer';
5
6
  import { margin } from '../../Chart/common';
6
7
  import { margins } from '../margins';
7
8
 
@@ -20,8 +21,8 @@ interface UseComputeBaseChartDimensionsProps {
20
21
  interface UseComputeBaseChartDimensionsState {
21
22
  graphHeight: number;
22
23
  graphWidth: number;
23
- legendRef: MutableRefObject<HTMLDivElement | null>;
24
- titleRef: MutableRefObject<HTMLDivElement | null>;
24
+ legendRef: RefCallback<Element>;
25
+ titleRef: RefCallback<Element>;
25
26
  }
26
27
 
27
28
  export const useComputeBaseChartDimensions = ({
@@ -33,11 +34,14 @@ export const useComputeBaseChartDimensions = ({
33
34
  legendHeight,
34
35
  maxAxisCharacters
35
36
  }: UseComputeBaseChartDimensionsProps): UseComputeBaseChartDimensionsState => {
36
- const legendRef = useRef<HTMLDivElement | null>(null);
37
- const titleRef = useRef<HTMLDivElement | null>(null);
37
+ const {
38
+ ref: legendRef,
39
+ width: legendRefWidth,
40
+ height: legendRefHeight
41
+ } = useResizeObserver();
42
+ const { ref: titleRef, height: titleRefHeight } = useResizeObserver();
38
43
 
39
- const currentLegendHeight =
40
- legendHeight ?? (legendRef.current?.getBoundingClientRect().height || 0);
44
+ const currentLegendHeight = legendHeight ?? (legendRefHeight || 0);
41
45
 
42
46
  const legendBoundingHeight =
43
47
  !equals(legendDisplay, false) &&
@@ -47,7 +51,7 @@ export const useComputeBaseChartDimensions = ({
47
51
  const legendBoundingWidth =
48
52
  !equals(legendDisplay, false) &&
49
53
  (equals(legendPlacement, 'left') || equals(legendPlacement, 'right'))
50
- ? legendRef.current?.getBoundingClientRect().width || 0
54
+ ? legendRefWidth || 0
51
55
  : 0;
52
56
 
53
57
  const graphWidth =
@@ -62,7 +66,7 @@ export const useComputeBaseChartDimensions = ({
62
66
  ? (height || 0) -
63
67
  margin.top -
64
68
  legendBoundingHeight -
65
- (titleRef.current?.getBoundingClientRect().height || 0) -
69
+ (titleRefHeight || 0) -
66
70
  5
67
71
  : 0;
68
72
 
@@ -185,6 +185,7 @@ describe('timeSeries', () => {
185
185
  average_value: 1,
186
186
  color: 'black',
187
187
  display: true,
188
+ displayAs: undefined,
188
189
  filled: false,
189
190
  highlight: undefined,
190
191
  invert: null,
@@ -195,6 +196,7 @@ describe('timeSeries', () => {
195
196
  metric_id: 1,
196
197
  minimum_value: 0.5,
197
198
  name: 'Round-Trip-Time Average (ms)',
199
+ stackKey: null,
198
200
  stackOrder: null,
199
201
  transparency: 80,
200
202
  unit: 'ms'
@@ -204,6 +206,7 @@ describe('timeSeries', () => {
204
206
  average_value: 1,
205
207
  color: 'blue',
206
208
  display: true,
209
+ displayAs: undefined,
207
210
  filled: true,
208
211
  highlight: undefined,
209
212
  invert: null,
@@ -214,6 +217,7 @@ describe('timeSeries', () => {
214
217
  metric_id: 2,
215
218
  minimum_value: 0.5,
216
219
  name: 'Time (ms)',
220
+ stackKey: null,
217
221
  stackOrder: null,
218
222
  transparency: 80,
219
223
  unit: 'ms'
@@ -223,6 +227,7 @@ describe('timeSeries', () => {
223
227
  average_value: 1,
224
228
  color: 'red',
225
229
  display: true,
230
+ displayAs: undefined,
226
231
  filled: true,
227
232
  highlight: undefined,
228
233
  invert: null,
@@ -233,6 +238,7 @@ describe('timeSeries', () => {
233
238
  metric_id: 3,
234
239
  minimum_value: 0.5,
235
240
  name: 'Average duration (ms)',
241
+ stackKey: null,
236
242
  stackOrder: 2,
237
243
  transparency: 80,
238
244
  unit: 'ms'
@@ -242,6 +248,7 @@ describe('timeSeries', () => {
242
248
  average_value: 1,
243
249
  color: 'yellow',
244
250
  display: true,
251
+ displayAs: undefined,
245
252
  filled: true,
246
253
  highlight: undefined,
247
254
  invert: '1',
@@ -252,6 +259,7 @@ describe('timeSeries', () => {
252
259
  metric_id: 4,
253
260
  minimum_value: 0.5,
254
261
  name: 'Duration (ms)',
262
+ stackKey: null,
255
263
  stackOrder: 1,
256
264
  transparency: 80,
257
265
  unit: 'ms'
@@ -261,6 +269,7 @@ describe('timeSeries', () => {
261
269
  average_value: 1,
262
270
  color: 'yellow',
263
271
  display: true,
272
+ displayAs: undefined,
264
273
  filled: true,
265
274
  highlight: undefined,
266
275
  invert: null,
@@ -271,6 +280,7 @@ describe('timeSeries', () => {
271
280
  metric_id: 5,
272
281
  minimum_value: 0.5,
273
282
  name: 'Packet Loss (%)',
283
+ stackKey: null,
274
284
  stackOrder: null,
275
285
  transparency: 80,
276
286
  unit: '%'
@@ -331,6 +341,7 @@ describe('timeSeries', () => {
331
341
  average_value: 1,
332
342
  color: 'black',
333
343
  display: true,
344
+ displayAs: undefined,
334
345
  filled: false,
335
346
  highlight: undefined,
336
347
  invert: null,
@@ -341,6 +352,7 @@ describe('timeSeries', () => {
341
352
  metric_id: 1,
342
353
  minimum_value: 0.5,
343
354
  name: 'Round-Trip-Time Average (ms)',
355
+ stackKey: null,
344
356
  stackOrder: null,
345
357
  transparency: 80,
346
358
  unit: 'ms'
@@ -389,6 +401,7 @@ describe('timeSeries', () => {
389
401
  average_value: 1,
390
402
  color: 'yellow',
391
403
  display: true,
404
+ displayAs: undefined,
392
405
  filled: true,
393
406
  highlight: undefined,
394
407
  invert: '1',
@@ -399,6 +412,7 @@ describe('timeSeries', () => {
399
412
  metric_id: 4,
400
413
  minimum_value: 0.5,
401
414
  name: 'Duration (ms)',
415
+ stackKey: null,
402
416
  stackOrder: 1,
403
417
  transparency: 80,
404
418
  unit: 'ms'
@@ -408,6 +422,7 @@ describe('timeSeries', () => {
408
422
  average_value: 1,
409
423
  color: 'red',
410
424
  display: true,
425
+ displayAs: undefined,
411
426
  filled: true,
412
427
  highlight: undefined,
413
428
  invert: null,
@@ -418,6 +433,7 @@ describe('timeSeries', () => {
418
433
  metric_id: 3,
419
434
  minimum_value: 0.5,
420
435
  name: 'Average duration (ms)',
436
+ stackKey: null,
421
437
  stackOrder: 2,
422
438
  transparency: 80,
423
439
  unit: 'ms'
@@ -475,6 +491,7 @@ describe('timeSeries', () => {
475
491
  average_value: 1,
476
492
  color: 'yellow',
477
493
  display: true,
494
+ displayAs: undefined,
478
495
  filled: true,
479
496
  highlight: undefined,
480
497
  invert: '1',
@@ -485,6 +502,7 @@ describe('timeSeries', () => {
485
502
  metric_id: 4,
486
503
  minimum_value: 0.5,
487
504
  name: 'Duration (ms)',
505
+ stackKey: null,
488
506
  stackOrder: 1,
489
507
  transparency: 80,
490
508
  unit: 'ms'
@@ -503,6 +521,7 @@ describe('timeSeries', () => {
503
521
  average_value: 1,
504
522
  color: 'red',
505
523
  display: true,
524
+ displayAs: undefined,
506
525
  filled: true,
507
526
  highlight: undefined,
508
527
  invert: null,
@@ -513,6 +532,7 @@ describe('timeSeries', () => {
513
532
  metric_id: 3,
514
533
  minimum_value: 0.5,
515
534
  name: 'Average duration (ms)',
535
+ stackKey: null,
516
536
  stackOrder: 2,
517
537
  transparency: 80,
518
538
  unit: 'ms'