@scality/core-ui 0.165.0 → 0.167.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 (138) hide show
  1. package/.storybook/preview.js +6 -4
  2. package/README.md +27 -80
  3. package/dist/components/barchart/BarChart.component.d.ts +5 -0
  4. package/dist/components/barchart/BarChart.component.d.ts.map +1 -1
  5. package/dist/components/barchart/BarChart.component.js +5 -0
  6. package/dist/components/barchartv2/Barchart.component.d.ts +19 -0
  7. package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
  8. package/dist/components/barchartv2/Barchart.component.js +31 -5
  9. package/dist/components/barchartv2/ChartTooltip.d.ts +18 -0
  10. package/dist/components/barchartv2/ChartTooltip.d.ts.map +1 -0
  11. package/dist/components/barchartv2/ChartTooltip.js +31 -0
  12. package/dist/components/barchartv2/utils.d.ts +0 -7
  13. package/dist/components/barchartv2/utils.d.ts.map +1 -1
  14. package/dist/components/barchartv2/utils.js +1 -29
  15. package/dist/components/button/Button.component.d.ts +2 -1
  16. package/dist/components/button/Button.component.d.ts.map +1 -1
  17. package/dist/components/button/Button.component.js +2 -1
  18. package/dist/components/chartlegend/ChartLegend.d.ts +9 -0
  19. package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
  20. package/dist/components/chartlegend/ChartLegend.js +32 -9
  21. package/dist/components/chartlegend/ChartLegendWrapper.d.ts +3 -0
  22. package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
  23. package/dist/components/chartlegend/ChartLegendWrapper.js +18 -2
  24. package/dist/components/constants.d.ts +2 -0
  25. package/dist/components/constants.d.ts.map +1 -1
  26. package/dist/components/constants.js +6 -0
  27. package/dist/components/constrainedtext/Constrainedtext.component.d.ts +3 -1
  28. package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
  29. package/dist/components/constrainedtext/Constrainedtext.component.js +2 -2
  30. package/dist/components/date/FormattedDateTime.d.ts +2 -1
  31. package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
  32. package/dist/components/date/FormattedDateTime.js +10 -0
  33. package/dist/components/icon/Icon.component.d.ts +9 -11
  34. package/dist/components/icon/Icon.component.d.ts.map +1 -1
  35. package/dist/components/icon/Icon.component.js +2 -0
  36. package/dist/components/linetemporalchart/ChartUtil.d.ts +3 -2
  37. package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
  38. package/dist/components/linetemporalchart/ChartUtil.js +24 -20
  39. package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts +4 -0
  40. package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -1
  41. package/dist/components/linetemporalchart/LineTemporalChart.component.js +4 -0
  42. package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +4 -2
  43. package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
  44. package/dist/components/linetimeseriechart/linetimeseriechart.component.js +5 -7
  45. package/dist/components/text/Text.component.js +1 -1
  46. package/dist/components/toast/Toast.component.d.ts.map +1 -1
  47. package/dist/components/toast/Toast.component.js +24 -11
  48. package/dist/index.d.ts +1 -11
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +0 -11
  51. package/dist/next.d.ts +2 -0
  52. package/dist/next.d.ts.map +1 -1
  53. package/dist/next.js +1 -0
  54. package/jest.config.js +1 -0
  55. package/package.json +16 -38
  56. package/src/lib/components/barchart/BarChart.component.tsx +5 -0
  57. package/src/lib/components/barchartv2/Barchart.component.test.tsx +99 -1
  58. package/src/lib/components/barchartv2/Barchart.component.tsx +39 -11
  59. package/src/lib/components/barchartv2/ChartTooltip.tsx +76 -0
  60. package/src/lib/components/barchartv2/utils.ts +2 -33
  61. package/src/lib/components/button/Button.component.tsx +2 -1
  62. package/src/lib/components/chartlegend/ChartLegend.test.tsx +235 -0
  63. package/src/lib/components/chartlegend/ChartLegend.tsx +36 -8
  64. package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +67 -29
  65. package/src/lib/components/constants.ts +11 -0
  66. package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +5 -2
  67. package/src/lib/components/date/FormattedDateTime.tsx +15 -1
  68. package/src/lib/components/icon/Icon.component.tsx +12 -1
  69. package/src/lib/components/linetemporalchart/ChartUtil.test.ts +23 -35
  70. package/src/lib/components/linetemporalchart/ChartUtil.ts +32 -26
  71. package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +19 -15
  72. package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +13 -11
  73. package/src/lib/components/selectv2/selectv2.test.tsx +1 -1
  74. package/src/lib/components/text/Text.component.tsx +1 -1
  75. package/src/lib/components/toast/Toast.component.tsx +27 -19
  76. package/src/lib/components/toast/useMutationsHandler.test.tsx +22 -32
  77. package/src/lib/index.ts +6 -11
  78. package/src/lib/next.ts +2 -0
  79. package/stories/barchart.stories.tsx +1 -1
  80. package/stories/card.stories.tsx +7 -5
  81. package/stories/constrainedtext.stories.tsx +4 -1
  82. package/stories/controls.ts +19 -20
  83. package/stories/linecharttemporal.stories.tsx +1 -1
  84. package/stories/linetimeseriechart.stories.tsx +79 -25
  85. package/stories/navbar.stories.tsx +103 -0
  86. package/stories/tabsv2.stories.tsx +51 -56
  87. package/dist/components/areachart/AreaChart.component.d.ts +0 -13
  88. package/dist/components/areachart/AreaChart.component.d.ts.map +0 -1
  89. package/dist/components/areachart/AreaChart.component.js +0 -27
  90. package/dist/components/chips/Chips.component.d.ts +0 -21
  91. package/dist/components/chips/Chips.component.d.ts.map +0 -1
  92. package/dist/components/chips/Chips.component.js +0 -105
  93. package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts +0 -10
  94. package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts.map +0 -1
  95. package/dist/components/cloudprogressbar/CloudProgressBar.component.js +0 -38
  96. package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts +0 -9
  97. package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts.map +0 -1
  98. package/dist/components/collapsiblepanel/CollapsiblePanel.component.js +0 -44
  99. package/dist/components/linechart/LineChart.component.d.ts +0 -21
  100. package/dist/components/linechart/LineChart.component.d.ts.map +0 -1
  101. package/dist/components/linechart/LineChart.component.js +0 -109
  102. package/dist/components/multiselect/MultiSelect.component.d.ts +0 -28
  103. package/dist/components/multiselect/MultiSelect.component.d.ts.map +0 -1
  104. package/dist/components/multiselect/MultiSelect.component.js +0 -73
  105. package/dist/components/select/Select.component.d.ts +0 -14
  106. package/dist/components/select/Select.component.d.ts.map +0 -1
  107. package/dist/components/select/Select.component.js +0 -71
  108. package/dist/components/spacedbox/SpacedBox.d.ts +0 -34
  109. package/dist/components/spacedbox/SpacedBox.d.ts.map +0 -1
  110. package/dist/components/spacedbox/SpacedBox.js +0 -64
  111. package/dist/components/sparkline/SparkLine.component.d.ts +0 -18
  112. package/dist/components/sparkline/SparkLine.component.d.ts.map +0 -1
  113. package/dist/components/sparkline/SparkLine.component.js +0 -148
  114. package/dist/components/vegachart/VegaChart.component.d.ts +0 -13
  115. package/dist/components/vegachart/VegaChart.component.d.ts.map +0 -1
  116. package/dist/components/vegachart/VegaChart.component.js +0 -120
  117. package/plopfile.js +0 -38
  118. package/src/lib/components/areachart/AreaChart.component.tsx +0 -49
  119. package/src/lib/components/chips/Chips.component.tsx +0 -169
  120. package/src/lib/components/cloudprogressbar/CloudProgressBar.component.tsx +0 -105
  121. package/src/lib/components/collapsiblepanel/CollapsiblePanel.component.tsx +0 -77
  122. package/src/lib/components/linechart/LineChart.component.tsx +0 -152
  123. package/src/lib/components/multiselect/MultiSelect.component.tsx +0 -158
  124. package/src/lib/components/select/Select.component.tsx +0 -98
  125. package/src/lib/components/spacedbox/SpacedBox.ts +0 -116
  126. package/src/lib/components/sparkline/SparkLine.component.tsx +0 -176
  127. package/src/lib/components/vegachart/VegaChart.component.tsx +0 -146
  128. package/stories/areachart.stories.tsx +0 -120
  129. package/stories/chips.stories.tsx +0 -107
  130. package/stories/cloudprogressbar.stories.tsx +0 -93
  131. package/stories/collapsiblepanel.stories.tsx +0 -57
  132. package/stories/data/areachart.ts +0 -122
  133. package/stories/data/sparklinechart.ts +0 -164
  134. package/stories/linechart.stories.tsx +0 -319
  135. package/stories/multiselect.stories.tsx +0 -126
  136. package/stories/select.stories.tsx +0 -52
  137. package/stories/sparkline.stories.tsx +0 -85
  138. package/stories/vegachart.stories.tsx +0 -98
@@ -109,55 +109,61 @@ export function getUnitLabel(
109
109
 
110
110
  /**
111
111
  * This function manually adds the missing data points with `null` value caused by downtime of the VMs
112
+ * Missing data points are only added when the gap between consecutive data points is bigger than 2 intervals
112
113
  *
113
114
  * @param {array} orginalValues - The array of the data points are already sorted according to the time series
114
115
  * @param {number} startingTimeStamp - The starting timestamp in seconds
115
116
  * @param {number} sampleDuration - The time span value in seconds
116
- * @param {number} sampleFrequency - The time difference between two data points in seconds
117
+ * @param {number} sampleInterval - The time difference between two data points in seconds
117
118
  *
118
119
  */
119
120
  export function addMissingDataPoint(
120
- orginalValues: [number, string | null][],
121
- startingTimeStamp: number,
122
- sampleDuration: number,
123
- sampleFrequency: number,
124
- ): [number, string | null][] {
121
+ orginalValues: [number, number | string | null][],
122
+ startingTimeStamp?: number,
123
+ sampleDuration?: number,
124
+ sampleInterval?: number,
125
+ ): [number, number | string | null][] {
125
126
  if (
126
127
  !orginalValues ||
127
128
  startingTimeStamp === undefined ||
128
129
  !sampleDuration ||
129
- !sampleFrequency ||
130
+ !sampleInterval ||
130
131
  startingTimeStamp < 0 ||
131
132
  sampleDuration <= 0 ||
132
- sampleFrequency <= 0
133
+ sampleInterval <= 0
133
134
  ) {
134
135
  return [];
135
136
  }
136
137
 
137
- const newValues = [];
138
- const numberOfDataPoints = sampleDuration / sampleFrequency + 1;
139
- let samplingPointTime = startingTimeStamp;
140
-
141
- // initialize the array with all "NAN" value, in order for the tooltip to display dash(-)
142
- for (let i = 0; i < numberOfDataPoints; i++) {
143
- newValues.push([samplingPointTime, NAN_STRING]);
144
- samplingPointTime += sampleFrequency;
138
+ // If there are no original values, return empty array
139
+ if (orginalValues.length === 0) {
140
+ return [];
145
141
  }
146
142
 
147
- // copy the existing data points from `orginalValue` array to `newValues`
148
- if (newValues.length === 0) return [];
149
- let nextIndex = 0;
143
+ const newValues: [number, number | string | null][] = [];
144
+
145
+ // Process all but the last element
146
+ for (let i = 0; i < orginalValues.length - 1; i++) {
147
+ // Always add the current data point
148
+ newValues.push(orginalValues[i]);
150
149
 
151
- for (let i = 0; i < newValues.length; i++) {
152
- if (
153
- orginalValues[nextIndex] &&
154
- newValues[i][0] === orginalValues[nextIndex][0]
155
- ) {
156
- newValues[i][1] = orginalValues[nextIndex][1];
157
- nextIndex++;
150
+ const currentTimestamp = orginalValues[i][0];
151
+ const nextTimestamp = orginalValues[i + 1][0];
152
+ const gap = nextTimestamp - currentTimestamp;
153
+
154
+ // Calculate how many missing points to add
155
+ const missingIntervals = Math.floor(gap / sampleInterval) - 1;
156
+
157
+ // Add missing data points with NAN_STRING (only executes if missingIntervals > 0)
158
+ for (let j = 1; j <= missingIntervals; j++) {
159
+ const missingTimestamp = currentTimestamp + j * sampleInterval;
160
+ newValues.push([missingTimestamp, NAN_STRING]);
158
161
  }
159
162
  }
160
163
 
164
+ // Add the last element
165
+ newValues.push(orginalValues[orginalValues.length - 1]);
166
+
161
167
  return newValues;
162
168
  }
163
169
  // get the value for the based value
@@ -165,6 +165,10 @@ const colorRange = [
165
165
  ];
166
166
 
167
167
  // Note: we need to make sure the start time and end timefor the prometheus query between the series are the same.
168
+ /**
169
+ * @deprecated Use LineTimeSerieChart instead
170
+ * @example import { LineTimeSerieChart } from '@scality/core-ui/dist/next';
171
+ */
168
172
  function LineTemporalChart({
169
173
  series,
170
174
  title,
@@ -451,10 +455,10 @@ function LineTemporalChart({
451
455
  ],
452
456
  }
453
457
  : yAxisType === 'percentage'
454
- ? {
455
- domain: [0, 100],
456
- }
457
- : undefined,
458
+ ? {
459
+ domain: [0, 100],
460
+ }
461
+ : undefined,
458
462
  };
459
463
  }, [yAxisTitle, yAxisType]);
460
464
  const symmetricalColorRange =
@@ -652,15 +656,15 @@ function LineTemporalChart({
652
656
  },
653
657
  }
654
658
  : yAxisType === 'symmetrical'
655
- ? {
656
- // for symmetrical chart we manually draw the line from minValue to maxValue
657
- ...syncedVerticalRuler,
658
- encoding: {
659
- ...syncedVerticalRuler.encoding,
660
- ...syncedVerticalRulerSymmetrical.encoding,
661
- },
662
- }
663
- : syncedVerticalRuler,
659
+ ? {
660
+ // for symmetrical chart we manually draw the line from minValue to maxValue
661
+ ...syncedVerticalRuler,
662
+ encoding: {
663
+ ...syncedVerticalRuler.encoding,
664
+ ...syncedVerticalRulerSymmetrical.encoding,
665
+ },
666
+ }
667
+ : syncedVerticalRuler,
664
668
  ],
665
669
  },
666
670
  tooltipConfig,
@@ -698,8 +702,8 @@ function LineTemporalChart({
698
702
  const unitLabel = unitRange
699
703
  ? getUnitLabel(unitRange, maxValue).unitLabel
700
704
  : yAxisType === 'percentage'
701
- ? '%'
702
- : '';
705
+ ? '%'
706
+ : '';
703
707
  return (
704
708
  <LineTemporalChartWrapper>
705
709
  <ChartHeader>
@@ -10,7 +10,6 @@ import {
10
10
  } from 'recharts';
11
11
  import { useMemo, useRef } from 'react';
12
12
  import { useTheme } from 'styled-components';
13
- import { useMetricsTimeSpan } from '../linetemporalchart/MetricTimespanProvider';
14
13
  import { addMissingDataPoint } from '../linetemporalchart/ChartUtil';
15
14
  import styled from 'styled-components';
16
15
  import { fontSize, fontWeight } from '../../style/theme';
@@ -92,8 +91,8 @@ const TooltipInstanceValue = styled.div`
92
91
  export type Serie = {
93
92
  // the name of the resource
94
93
  resource: string;
95
- // the original data format from prometheus
96
- data: [number, string | null][];
94
+ // the original data format from prometheus, extend the value to include number type.
95
+ data: [number, number | string | null][];
97
96
  // it's mandatory to display tooltip label in the tooltip
98
97
  getTooltipLabel: (metricPrefix?: string, resource?: string) => string;
99
98
  // the name of the metric prefix with read, write, in, out
@@ -123,6 +122,8 @@ export type LineChartProps = (
123
122
  title: string;
124
123
  height: number;
125
124
  startingTimeStamp: number;
125
+ interval: number;
126
+ duration: number;
126
127
  unitRange?: {
127
128
  threshold: number;
128
129
  label: string;
@@ -200,6 +201,8 @@ export function LineTimeSerieChart({
200
201
  title,
201
202
  height,
202
203
  startingTimeStamp,
204
+ interval,
205
+ duration,
203
206
  unitRange,
204
207
  isLoading = false,
205
208
  yAxisType = 'default',
@@ -208,7 +211,6 @@ export function LineTimeSerieChart({
208
211
  ...rest
209
212
  }: LineChartProps) {
210
213
  const theme = useTheme();
211
- const { frequency, duration } = useMetricsTimeSpan();
212
214
  const { getColor } = useChartLegend();
213
215
  const chartRef = useRef(null);
214
216
 
@@ -223,7 +225,7 @@ export function LineTimeSerieChart({
223
225
  line.data,
224
226
  startingTimeStamp,
225
227
  duration,
226
- frequency,
228
+ interval,
227
229
  ),
228
230
  })),
229
231
  // Convert positive values to negative values
@@ -233,7 +235,7 @@ export function LineTimeSerieChart({
233
235
  line.data,
234
236
  startingTimeStamp,
235
237
  duration,
236
- frequency,
238
+ interval,
237
239
  ).map(
238
240
  ([timestamp, value]) =>
239
241
  [timestamp, value === null ? null : `-${Number(value)}`] as [
@@ -249,7 +251,7 @@ export function LineTimeSerieChart({
249
251
  line.data,
250
252
  startingTimeStamp,
251
253
  duration,
252
- frequency,
254
+ interval,
253
255
  ),
254
256
  }));
255
257
 
@@ -257,7 +259,7 @@ export function LineTimeSerieChart({
257
259
  // Initialize an object to hold data points by timestamp
258
260
  const dataPointsByTime: Record<
259
261
  number,
260
- { timestamp: number } & Record<string, string | number | null>
262
+ { timestamp: number } & Record<string, number | null>
261
263
  > = {};
262
264
  const seriesToProcess =
263
265
  yAxisType === 'symmetrical' && isSymmetricalSeries(normalizedSeries)
@@ -283,11 +285,11 @@ export function LineTimeSerieChart({
283
285
  // Convert object to array for Recharts
284
286
  return Object.values(dataPointsByTime).sort(
285
287
  (
286
- a: { timestamp: number } & Record<string, string | number | null>,
287
- b: { timestamp: number } & Record<string, string | number | null>,
288
+ a: { timestamp: number } & Record<string, number | null>,
289
+ b: { timestamp: number } & Record<string, number | null>,
288
290
  ) => (a.timestamp as number) - (b.timestamp as number),
289
291
  );
290
- }, [series, startingTimeStamp, duration, frequency, yAxisType]);
292
+ }, [series, startingTimeStamp, duration, interval, yAxisType]);
291
293
 
292
294
  // Calculate 5 perfectly evenly spaced ticks
293
295
  const xAxisTicks = useMemo(() => {
@@ -69,7 +69,7 @@ describe('SelectV2', () => {
69
69
  it('should throw error if <Option/> is outside <Select/>', () => {
70
70
  // mock console.error as this is the only way to silent expected error thrown by the component
71
71
  const consoleErrorFn = jest.spyOn(console, 'error').mockImplementation(() => jest.fn());
72
- expect(() => render(<Option value="Option 1" />)).toThrowError();
72
+ expect(() => render(<Option value="Option 1" />)).toThrow();
73
73
  consoleErrorFn.mockRestore();
74
74
  });
75
75
 
@@ -133,7 +133,7 @@ export const Text = styled.span<{
133
133
  isEmphazed?: boolean;
134
134
  isGentleEmphazed?: boolean;
135
135
  }>`
136
- color: ${(props) => props.theme[props.color || 'textPrimary']};
136
+ ${(props) => props.color && `color: ${props.theme[props.color]};`}
137
137
  ${(props) =>
138
138
  props.variant === 'Larger'
139
139
  ? `
@@ -1,4 +1,3 @@
1
- import { motion } from 'framer-motion';
2
1
  import { ReactNode, useRef } from 'react';
3
2
  import { useTheme } from 'styled-components';
4
3
  import { Box } from '../box/Box';
@@ -99,6 +98,31 @@ const ContentContainer = styled.div`
99
98
  position: relative;
100
99
  `;
101
100
 
101
+ const FadingToast = styled.div`
102
+ align-items: flex-end;
103
+ background-color: ${props => props.theme.backgroundLevel1};
104
+ border: 1px solid ${props => props.theme.border};
105
+ box-shadow: 0px 4px 10px 4px #000;
106
+ display: flex;
107
+ border-radius: 4px;
108
+ position: relative;
109
+
110
+ @keyframes toastEnter {
111
+ from {
112
+ opacity: 0;
113
+ transform: translateY(-20px);
114
+ }
115
+ to {
116
+ opacity: 1;
117
+ transform: translateY(0);
118
+ }
119
+ }
120
+ `;
121
+
122
+ const ToastEnter = styled(FadingToast)`
123
+ animation: toastEnter 0.3s ease forwards;
124
+ `;
125
+
102
126
  function Toast({
103
127
  open,
104
128
  message,
@@ -123,7 +147,6 @@ function Toast({
123
147
 
124
148
  const bgColor = useGetBackgroundColor(status);
125
149
  const rgbBgColor = useGetRgbBackgroundColor(status);
126
- const theme = useTheme();
127
150
 
128
151
  if (!open) {
129
152
  return null;
@@ -141,22 +164,7 @@ function Toast({
141
164
  width,
142
165
  }}
143
166
  >
144
- <motion.div
145
- key="toast"
146
- initial={{ opacity: 0, y: -20 }}
147
- animate={{ opacity: 1, y: 0 }}
148
- exit={{ opacity: 0, y: 20 }}
149
- transition={{ duration: 0.3 }}
150
- style={{
151
- alignItems: 'flex-end',
152
- backgroundColor: theme.backgroundLevel1,
153
- border: `1px solid ${theme.border}`,
154
- boxShadow: '0px 4px 10px 4px #000',
155
- display: 'flex',
156
- borderRadius: '4px',
157
- position: 'relative',
158
- }}
159
- >
167
+ <ToastEnter>
160
168
  <IconContainer bgColor={rgbBgColor}>{icon}</IconContainer>
161
169
  <ContentContainer>
162
170
  <BasicText>{message}</BasicText>
@@ -169,7 +177,7 @@ function Toast({
169
177
  tooltip={{ overlay: 'Close', placement: 'top' }}
170
178
  />
171
179
  </Box>
172
- </motion.div>
180
+ </ToastEnter>
173
181
  {withProgressBar && (
174
182
  <DurationBasedProgressBar
175
183
  duration={autoDismiss ? duration : null}
@@ -1,4 +1,4 @@
1
- import { act, renderHook } from '@testing-library/react-hooks';
1
+ import { renderHook, waitFor } from '@testing-library/react';
2
2
  import { useToast } from './ToastProvider';
3
3
  import { useMutationsHandler } from './useMutationsHandler';
4
4
 
@@ -68,7 +68,7 @@ describe('useMutationsHandler', () => {
68
68
  showToast,
69
69
  }));
70
70
 
71
- const { waitFor } = renderHook(() =>
71
+ renderHook(() =>
72
72
  useMutationsHandler({
73
73
  mainMutation,
74
74
  dependantMutations,
@@ -77,10 +77,8 @@ describe('useMutationsHandler', () => {
77
77
  }),
78
78
  );
79
79
 
80
- await act(async () => {
81
- await waitFor(() => {
82
- expect(onMainMutationSuccess).toHaveBeenCalled();
83
- });
80
+ await waitFor(() => {
81
+ expect(onMainMutationSuccess).toHaveBeenCalled();
84
82
  });
85
83
  });
86
84
 
@@ -91,7 +89,7 @@ describe('useMutationsHandler', () => {
91
89
  showToast,
92
90
  }));
93
91
 
94
- const { waitFor } = renderHook(() =>
92
+ renderHook(() =>
95
93
  useMutationsHandler({
96
94
  mainMutation,
97
95
  dependantMutations,
@@ -99,13 +97,11 @@ describe('useMutationsHandler', () => {
99
97
  }),
100
98
  );
101
99
 
102
- await act(async () => {
103
- await waitFor(() => {
104
- expect(showToast).toHaveBeenCalledWith({
105
- open: true,
106
- status: 'success',
107
- message: 'message',
108
- });
100
+ await waitFor(() => {
101
+ expect(showToast).toHaveBeenCalledWith({
102
+ open: true,
103
+ status: 'success',
104
+ message: 'message',
109
105
  });
110
106
  });
111
107
  });
@@ -131,7 +127,7 @@ describe('useMutationsHandler', () => {
131
127
  },
132
128
  ] as const;
133
129
 
134
- const { waitFor } = renderHook(() =>
130
+ renderHook(() =>
135
131
  useMutationsHandler({
136
132
  mainMutation,
137
133
  dependantMutations: mutationsWithError,
@@ -139,13 +135,11 @@ describe('useMutationsHandler', () => {
139
135
  }),
140
136
  );
141
137
 
142
- await act(async () => {
143
- await waitFor(() => {
144
- expect(showToast).toHaveBeenCalledWith({
145
- open: true,
146
- status: 'error',
147
- message: 'message',
148
- });
138
+ await waitFor(() => {
139
+ expect(showToast).toHaveBeenCalledWith({
140
+ open: true,
141
+ status: 'error',
142
+ message: 'message',
149
143
  });
150
144
  });
151
145
  });
@@ -171,7 +165,7 @@ describe('useMutationsHandler', () => {
171
165
  showToast,
172
166
  }));
173
167
 
174
- const { waitFor } = renderHook(() =>
168
+ renderHook(() =>
175
169
  useMutationsHandler({
176
170
  mainMutation,
177
171
  dependantMutations: otherMutations,
@@ -180,10 +174,8 @@ describe('useMutationsHandler', () => {
180
174
  }),
181
175
  );
182
176
 
183
- await act(async () => {
184
- await waitFor(() => {
185
- expect(onAllMutationsSuccess).toHaveBeenCalled();
186
- });
177
+ await waitFor(() => {
178
+ expect(onAllMutationsSuccess).toHaveBeenCalled();
187
179
  });
188
180
  });
189
181
 
@@ -220,7 +212,7 @@ describe('useMutationsHandler', () => {
220
212
  showToast,
221
213
  }));
222
214
 
223
- const { waitFor } = renderHook(() =>
215
+ renderHook(() =>
224
216
  useMutationsHandler({
225
217
  mainMutation: firstMutation,
226
218
  dependantMutations: otherMutations,
@@ -229,10 +221,8 @@ describe('useMutationsHandler', () => {
229
221
  }),
230
222
  );
231
223
 
232
- await act(async () => {
233
- await waitFor(() => {
234
- expect(onAllMutationsSuccess).not.toHaveBeenCalled();
235
- });
224
+ await waitFor(() => {
225
+ expect(onAllMutationsSuccess).not.toHaveBeenCalled();
236
226
  });
237
227
  });
238
228
  });
package/src/lib/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export { Banner } from './components/banner/Banner.component';
2
2
  export { Breadcrumb } from './components/breadcrumb/Breadcrumb.component';
3
- export { Button } from './components/button/Button.component';
4
3
  export { Checkbox } from './components/checkbox/Checkbox.component';
5
- export { Chips } from './components/chips/Chips.component';
6
4
  export { Dropdown } from './components/dropdown/Dropdown.component';
7
5
  export {
8
6
  LOADER_SIZE,
@@ -21,22 +19,18 @@ export { Modal } from './components/modal/Modal.component';
21
19
  export { Navbar } from './components/navbar/Navbar.component';
22
20
  export { Notifications } from './components/notifications/Notifications.component';
23
21
  export { SearchInput } from './components/searchinput/SearchInput.component';
24
- export { Select } from './components/select/Select.component';
22
+
25
23
  export { Sidebar } from './components/sidebar/Sidebar.component';
26
24
  export { Steppers } from './components/steppers/Steppers.component';
27
25
  export { Toggle } from './components/toggle/Toggle.component';
28
26
  export { Tooltip } from './components/tooltip/Tooltip.component';
29
- export { MultiSelect } from './components/multiselect/MultiSelect.component';
30
- export { VegaChart } from './components/vegachart/VegaChart.component';
31
- export { LineChart } from './components/linechart/LineChart.component';
27
+
32
28
  export { ProgressBar } from './components/progressbar/ProgressBar.component';
33
29
  export { TextArea } from './components/textarea/TextArea.component';
34
- export { CloudProgressBar } from './components/cloudprogressbar/CloudProgressBar.component';
35
- export { Sparkline } from './components/sparkline/SparkLine.component';
30
+
36
31
  export { BarChart } from './components/barchart/BarChart.component';
37
32
  export { CircularProgressBar } from './components/circularprogressbar/CircularProgressBar.component';
38
- export { AreaChart } from './components/areachart/AreaChart.component';
39
- export { CollapsiblePanel } from './components/collapsiblepanel/CollapsiblePanel.component';
33
+
40
34
  export { LateralNavbarLayout } from './components/lateralnavbarlayout/LateralNavbarLayout.component';
41
35
  export { GlobalHealthBar } from './components/globalhealthbar/GlobalHealthBar.component';
42
36
  export { ConstrainedText } from './components/constrainedtext/Constrainedtext.component';
@@ -48,7 +42,7 @@ export { ErrorPage404 } from './components/error-pages/ErrorPage404.component';
48
42
  export { ErrorPage500 } from './components/error-pages/ErrorPage500.component';
49
43
  export { ErrorPageAuth } from './components/error-pages/ErrorPageAuth.component';
50
44
  export { TextBadge } from './components/textbadge/TextBadge.component';
51
- export { SpacedBox } from './components/spacedbox/SpacedBox';
45
+
52
46
  export { Layout as Layout2 } from './components/layout/v2';
53
47
  export { TwoPanelLayout } from './components/layout/v2/panels';
54
48
  export { AppContainer } from './components/layout/v2/AppContainer';
@@ -82,3 +76,4 @@ export { InfoMessage } from './components/infomessage/InfoMessage.component';
82
76
  export { InputList } from './components/inputlist/InputList.component';
83
77
  export { InlineInput } from './components/inlineinput/InlineInput';
84
78
  export { UnsuccessfulResult } from './components/UnsuccessfulResult.component';
79
+ export { CoreUITheme } from './style/theme';
package/src/lib/next.ts CHANGED
@@ -21,6 +21,8 @@ export {
21
21
  BarchartSortFn,
22
22
  BarchartTooltipFn,
23
23
  } from './components/barchartv2/Barchart.component';
24
+ export { ChartTooltip } from './components/barchartv2/ChartTooltip';
24
25
  export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
25
26
  export { ChartLegend } from './components/chartlegend/ChartLegend';
26
27
  export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
28
+ export { CoreUITheme } from './style/theme';
@@ -111,7 +111,7 @@ const horizontalBarChartArgs = {
111
111
  };
112
112
 
113
113
  export default {
114
- title: 'Components/Data Display/Charts/BarChart',
114
+ title: 'Components/Deprecated/Charts/BarChart',
115
115
  component: BarChart,
116
116
  decorators: [
117
117
  (story: Component) => <SyncedCursorCharts>{story()}</SyncedCursorCharts>,
@@ -7,12 +7,14 @@ import {
7
7
  CardBodyContainer,
8
8
  } from '../src/lib/components/card/Card.component';
9
9
  import { CircularProgressBar } from '../src/lib/components/circularprogressbar/CircularProgressBar.component';
10
- import { Text, Wrapper } from './common';
11
- import { brand } from '../src/lib/style/theme';
10
+ import { Text } from './common';
11
+ import { coreUIAvailableThemes } from '../src/lib/style/theme';
12
12
  import { action } from '@storybook/addon-actions';
13
13
 
14
14
  // RGB color in theme provoke an error, excludes from control options
15
- const colors = Object.keys(brand).filter((color) => !/RGB/.test(color));
15
+ const colors = Object.keys(coreUIAvailableThemes.darkRebrand).filter(
16
+ (color) => !/RGB/.test(color),
17
+ );
16
18
 
17
19
  export default {
18
20
  title: 'Components/Data Display/Card',
@@ -43,8 +45,8 @@ const Row = styled.div`
43
45
  `;
44
46
  const defaultBody = (
45
47
  <CircularProgressBar
46
- color={brand.buttonSecondary}
47
- backgroundColor={brand.textPrimary}
48
+ color={coreUIAvailableThemes.darkRebrand.buttonSecondary}
49
+ backgroundColor={coreUIAvailableThemes.darkRebrand.textPrimary}
48
50
  radius={30}
49
51
  strokeWidth={5}
50
52
  percent={60}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ConstrainedText } from '../src/lib/components/constrainedtext/Constrainedtext.component';
3
3
  import { Wrapper } from './common';
4
4
  import { placementOptions } from './controls';
5
+ import { Text } from '../src/lib/components/text/Text.component';
5
6
  export default {
6
7
  title: 'Components/Constrained Text',
7
8
  component: ConstrainedText,
@@ -34,10 +35,12 @@ export const Default = {
34
35
  };
35
36
 
36
37
  export const CustomizedTooltip = {
38
+ ...Default,
37
39
  args: {
38
- text: 'This is a long phrase',
40
+ text: <Text>This is a long long phrase</Text>,
39
41
  tooltipStyle: { width: '100px', color: 'lightblue' },
40
42
  tooltipPlacement: 'right',
43
+ color: 'statusCritical',
41
44
  },
42
45
  };
43
46
 
@@ -1,23 +1,23 @@
1
- import { iconTable } from "../src/lib/components/icon/Icon.component";
1
+ import { iconTable } from '../src/lib/components/icon/Icon.component';
2
2
 
3
3
  export const iconOptions = Object.keys(iconTable);
4
4
 
5
5
  export const sizesOptions = ['smaller', 'small', 'base', 'large', 'larger'];
6
6
 
7
7
  export const placementOptions = [
8
- 'top',
9
- 'bottom',
10
- 'left',
11
- 'top-start',
12
- 'top-end',
13
- 'right',
14
- 'right-start',
15
- 'right-end',
16
- 'bottom-end',
17
- 'bottom-start',
18
- 'left-start',
19
- 'left-end',
20
- ];
8
+ 'top',
9
+ 'bottom',
10
+ 'left',
11
+ 'top-start',
12
+ 'top-end',
13
+ 'right',
14
+ 'right-start',
15
+ 'right-end',
16
+ 'bottom-end',
17
+ 'bottom-start',
18
+ 'left-start',
19
+ 'left-end',
20
+ ];
21
21
  export const localeArgtype = {
22
22
  control: { type: 'radio' },
23
23
  options: ['en', 'fr'],
@@ -40,9 +40,8 @@ export const variantsOptions = [
40
40
  'backgroundLevel1',
41
41
  ];
42
42
 
43
-
44
- export const tooltipArgTypes = {
45
- tooltip: {
43
+ export const tooltipArgTypes = {
44
+ tooltip: {
46
45
  description:
47
46
  "Object with 'overlay','placement' and 'overlayStyle' properties",
48
47
  control: false,
@@ -53,7 +52,7 @@ export const tooltipArgTypes = {
53
52
  options: placementOptions,
54
53
  },
55
54
  tooltipOverlayStyle: {
56
- control:'object',
55
+ control: 'object',
57
56
  description: 'Object of CSS properties',
58
- }}
59
-
57
+ },
58
+ };
@@ -10,7 +10,7 @@ import { Wrapper } from './common';
10
10
  import { dataLineChartV2, dataLineChartV2_readwrite } from './data/linechart';
11
11
  import { defaultRenderTooltipSerie } from '../src/lib/components/linetemporalchart/tooltip';
12
12
  export default {
13
- title: 'Components/Data Display/Charts/LineTemporalChart',
13
+ title: 'Components/Deprecated/Charts/LineTemporalChart',
14
14
  component: LineTemporalChart,
15
15
  decorators: [
16
16
  (story) => (