@scality/core-ui 0.166.0 → 0.168.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/.storybook/preview.js +6 -4
- package/README.md +27 -80
- package/dist/components/barchart/BarChart.component.d.ts +5 -0
- package/dist/components/barchart/BarChart.component.d.ts.map +1 -1
- package/dist/components/barchart/BarChart.component.js +5 -0
- package/dist/components/barchartv2/Barchart.component.d.ts +5 -1
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.js +6 -2
- package/dist/components/barchartv2/utils.js +2 -2
- package/dist/components/button/Button.component.d.ts +2 -1
- package/dist/components/button/Button.component.d.ts.map +1 -1
- package/dist/components/button/Button.component.js +2 -1
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +7 -13
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +1 -2
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +4 -9
- package/dist/components/date/FormattedDateTime.d.ts +6 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +11 -0
- package/dist/components/icon/Icon.component.d.ts +9 -11
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +2 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts +3 -2
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
- package/dist/components/linetemporalchart/ChartUtil.js +30 -20
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts +4 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -1
- package/dist/components/linetemporalchart/LineTemporalChart.component.js +4 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +8 -2
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +17 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -11
- package/dist/next.d.ts +1 -0
- package/dist/next.d.ts.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +16 -37
- package/src/lib/components/barchart/BarChart.component.tsx +5 -0
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +11 -7
- package/src/lib/components/barchartv2/Barchart.component.tsx +15 -3
- package/src/lib/components/barchartv2/utils.test.ts +2 -2
- package/src/lib/components/barchartv2/utils.ts +2 -2
- package/src/lib/components/button/Button.component.tsx +2 -1
- package/src/lib/components/chartlegend/ChartLegend.test.tsx +17 -0
- package/src/lib/components/chartlegend/ChartLegend.tsx +6 -12
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +5 -13
- package/src/lib/components/date/FormattedDateTime.tsx +14 -1
- package/src/lib/components/icon/Icon.component.tsx +12 -1
- package/src/lib/components/linetemporalchart/ChartUtil.test.ts +23 -35
- package/src/lib/components/linetemporalchart/ChartUtil.ts +38 -26
- package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +19 -15
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +36 -13
- package/src/lib/components/linetimeseriechart/linetimeseriechart.test.tsx +68 -0
- package/src/lib/components/selectv2/selectv2.test.tsx +1 -1
- package/src/lib/components/toast/useMutationsHandler.test.tsx +22 -32
- package/src/lib/index.ts +6 -11
- package/src/lib/next.ts +1 -0
- package/stories/BarChart/barchart.stories.tsx +108 -13
- package/stories/barchart.stories.tsx +1 -1
- package/stories/card.stories.tsx +7 -5
- package/stories/controls.ts +19 -20
- package/stories/linecharttemporal.stories.tsx +1 -1
- package/stories/linetimeseriechart.stories.tsx +146 -0
- package/stories/navbar.stories.tsx +103 -0
- package/stories/tabsv2.stories.tsx +51 -56
- package/dist/components/areachart/AreaChart.component.d.ts +0 -13
- package/dist/components/areachart/AreaChart.component.d.ts.map +0 -1
- package/dist/components/areachart/AreaChart.component.js +0 -27
- package/dist/components/chips/Chips.component.d.ts +0 -21
- package/dist/components/chips/Chips.component.d.ts.map +0 -1
- package/dist/components/chips/Chips.component.js +0 -105
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts +0 -10
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts.map +0 -1
- package/dist/components/cloudprogressbar/CloudProgressBar.component.js +0 -38
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts +0 -9
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts.map +0 -1
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.js +0 -44
- package/dist/components/linechart/LineChart.component.d.ts +0 -21
- package/dist/components/linechart/LineChart.component.d.ts.map +0 -1
- package/dist/components/linechart/LineChart.component.js +0 -109
- package/dist/components/multiselect/MultiSelect.component.d.ts +0 -28
- package/dist/components/multiselect/MultiSelect.component.d.ts.map +0 -1
- package/dist/components/multiselect/MultiSelect.component.js +0 -73
- package/dist/components/select/Select.component.d.ts +0 -14
- package/dist/components/select/Select.component.d.ts.map +0 -1
- package/dist/components/select/Select.component.js +0 -71
- package/dist/components/spacedbox/SpacedBox.d.ts +0 -34
- package/dist/components/spacedbox/SpacedBox.d.ts.map +0 -1
- package/dist/components/spacedbox/SpacedBox.js +0 -64
- package/dist/components/sparkline/SparkLine.component.d.ts +0 -18
- package/dist/components/sparkline/SparkLine.component.d.ts.map +0 -1
- package/dist/components/sparkline/SparkLine.component.js +0 -148
- package/dist/components/vegachart/VegaChart.component.d.ts +0 -13
- package/dist/components/vegachart/VegaChart.component.d.ts.map +0 -1
- package/dist/components/vegachart/VegaChart.component.js +0 -120
- package/plopfile.js +0 -38
- package/src/lib/components/areachart/AreaChart.component.tsx +0 -49
- package/src/lib/components/chips/Chips.component.tsx +0 -169
- package/src/lib/components/cloudprogressbar/CloudProgressBar.component.tsx +0 -105
- package/src/lib/components/collapsiblepanel/CollapsiblePanel.component.tsx +0 -77
- package/src/lib/components/linechart/LineChart.component.tsx +0 -152
- package/src/lib/components/multiselect/MultiSelect.component.tsx +0 -158
- package/src/lib/components/select/Select.component.tsx +0 -98
- package/src/lib/components/spacedbox/SpacedBox.ts +0 -116
- package/src/lib/components/sparkline/SparkLine.component.tsx +0 -176
- package/src/lib/components/vegachart/VegaChart.component.tsx +0 -146
- package/stories/areachart.stories.tsx +0 -120
- package/stories/chips.stories.tsx +0 -107
- package/stories/cloudprogressbar.stories.tsx +0 -93
- package/stories/collapsiblepanel.stories.tsx +0 -57
- package/stories/data/areachart.ts +0 -122
- package/stories/data/sparklinechart.ts +0 -164
- package/stories/linechart.stories.tsx +0 -319
- package/stories/multiselect.stories.tsx +0 -126
- package/stories/select.stories.tsx +0 -52
- package/stories/sparkline.stories.tsx +0 -85
- package/stories/vegachart.stories.tsx +0 -98
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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
|
|
81
|
-
|
|
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
|
-
|
|
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
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
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
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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
|
|
184
|
-
|
|
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
|
-
|
|
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
|
|
233
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
@@ -25,3 +25,4 @@ export { ChartTooltip } from './components/barchartv2/ChartTooltip';
|
|
|
25
25
|
export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
|
|
26
26
|
export { ChartLegend } from './components/chartlegend/ChartLegend';
|
|
27
27
|
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
|
28
|
+
export { CoreUITheme } from './style/theme';
|
|
@@ -61,7 +61,7 @@ export const Playground: Story = {
|
|
|
61
61
|
}}
|
|
62
62
|
>
|
|
63
63
|
<Stack direction="vertical" gap="r16">
|
|
64
|
-
<Barchart type=
|
|
64
|
+
<Barchart type={{ type: 'category' }} bars={exampleData} />
|
|
65
65
|
<ChartLegend shape="rectangle" direction="horizontal" />
|
|
66
66
|
</Stack>
|
|
67
67
|
</ChartLegendWrapper>
|
|
@@ -332,7 +332,7 @@ export const CapacityWithUnitRange: Story = {
|
|
|
332
332
|
}}
|
|
333
333
|
>
|
|
334
334
|
<Barchart
|
|
335
|
-
type=
|
|
335
|
+
type={{ type: 'category' }}
|
|
336
336
|
bars={capacityDataWithUnitRange}
|
|
337
337
|
unitRange={[
|
|
338
338
|
{
|
|
@@ -402,7 +402,7 @@ export const Stacked: Story = {
|
|
|
402
402
|
}}
|
|
403
403
|
>
|
|
404
404
|
<Stack direction="vertical" gap="r16">
|
|
405
|
-
<Barchart type=
|
|
405
|
+
<Barchart type={{ type: 'category' }} bars={stackedData} stacked />
|
|
406
406
|
<ChartLegend shape="rectangle" />
|
|
407
407
|
</Stack>
|
|
408
408
|
</ChartLegendWrapper>
|
|
@@ -453,7 +453,7 @@ export const DefaultSort: Story = {
|
|
|
453
453
|
}}
|
|
454
454
|
>
|
|
455
455
|
<Barchart
|
|
456
|
-
type=
|
|
456
|
+
type={{ type: 'category' }}
|
|
457
457
|
stacked
|
|
458
458
|
bars={defaultSortData}
|
|
459
459
|
defaultSort={customSort}
|
|
@@ -531,7 +531,7 @@ export const WithCustomTooltip: Story = {
|
|
|
531
531
|
>
|
|
532
532
|
<Stack direction="vertical" gap="r16">
|
|
533
533
|
<Barchart
|
|
534
|
-
type=
|
|
534
|
+
type={{ type: 'category' }}
|
|
535
535
|
bars={exampleData}
|
|
536
536
|
tooltip={customTooltip}
|
|
537
537
|
height={300}
|
|
@@ -602,7 +602,7 @@ export const StatusColors: Story = {
|
|
|
602
602
|
>
|
|
603
603
|
<Stack direction="vertical" gap="r16">
|
|
604
604
|
<Barchart
|
|
605
|
-
type=
|
|
605
|
+
type={{ type: 'category' }}
|
|
606
606
|
bars={statusData}
|
|
607
607
|
stacked
|
|
608
608
|
title="System Health Metrics"
|
|
@@ -656,7 +656,7 @@ export const LegendShapes: Story = {
|
|
|
656
656
|
>
|
|
657
657
|
<Stack direction="vertical" gap="r16">
|
|
658
658
|
<Barchart
|
|
659
|
-
type=
|
|
659
|
+
type={{ type: 'category' }}
|
|
660
660
|
bars={exampleData}
|
|
661
661
|
height={200}
|
|
662
662
|
title="Horizontal Rectangle Legend"
|
|
@@ -673,7 +673,7 @@ export const LegendShapes: Story = {
|
|
|
673
673
|
>
|
|
674
674
|
<Stack direction="vertical" gap="r16">
|
|
675
675
|
<Barchart
|
|
676
|
-
type=
|
|
676
|
+
type={{ type: 'category' }}
|
|
677
677
|
bars={exampleData}
|
|
678
678
|
height={200}
|
|
679
679
|
title="Vertical Line Legend"
|
|
@@ -727,14 +727,14 @@ export const BarchartsWithSingleLegend: Story = {
|
|
|
727
727
|
}}
|
|
728
728
|
>
|
|
729
729
|
<Barchart
|
|
730
|
-
type=
|
|
730
|
+
type={{ type: 'category' }}
|
|
731
731
|
bars={exampleData}
|
|
732
732
|
height={200}
|
|
733
733
|
title="Barchart 1"
|
|
734
734
|
/>
|
|
735
735
|
|
|
736
736
|
<Barchart
|
|
737
|
-
type=
|
|
737
|
+
type={{ type: 'category' }}
|
|
738
738
|
bars={exampleData}
|
|
739
739
|
height={200}
|
|
740
740
|
title="Barchart 2"
|
|
@@ -757,7 +757,7 @@ export const ErrorState: Story = {
|
|
|
757
757
|
}}
|
|
758
758
|
>
|
|
759
759
|
<Barchart
|
|
760
|
-
type=
|
|
760
|
+
type={{ type: 'category' }}
|
|
761
761
|
bars={[]}
|
|
762
762
|
isError
|
|
763
763
|
title="Error State"
|
|
@@ -808,7 +808,7 @@ export const StackedBarSort: Story = {
|
|
|
808
808
|
}}
|
|
809
809
|
>
|
|
810
810
|
<Barchart
|
|
811
|
-
type=
|
|
811
|
+
type={{ type: 'category' }}
|
|
812
812
|
bars={statusesData}
|
|
813
813
|
stacked
|
|
814
814
|
stackedBarSort={sort}
|
|
@@ -883,7 +883,7 @@ export const CompleteExample: Story = {
|
|
|
883
883
|
}}
|
|
884
884
|
>
|
|
885
885
|
<Barchart
|
|
886
|
-
type=
|
|
886
|
+
type={{ type: 'category' }}
|
|
887
887
|
title="Loading BarChart"
|
|
888
888
|
helpTooltip="Click on the button to load or unload data"
|
|
889
889
|
secondaryTitle={isLoading ? 'Loading...' : 'Loaded data'}
|
|
@@ -911,3 +911,98 @@ export const CompleteExample: Story = {
|
|
|
911
911
|
);
|
|
912
912
|
},
|
|
913
913
|
};
|
|
914
|
+
|
|
915
|
+
export const Histogram: Story = {
|
|
916
|
+
render: () => {
|
|
917
|
+
const histogramData = [
|
|
918
|
+
{
|
|
919
|
+
label: 'Success',
|
|
920
|
+
data: [
|
|
921
|
+
['0-10', 1],
|
|
922
|
+
['10-20', 5],
|
|
923
|
+
['20-30', 15],
|
|
924
|
+
['30-40', 40],
|
|
925
|
+
['40-50', 45],
|
|
926
|
+
['50-60', 50],
|
|
927
|
+
['60-70', 40],
|
|
928
|
+
['70-80', 15],
|
|
929
|
+
['80-90', 5],
|
|
930
|
+
['90-100', 1],
|
|
931
|
+
],
|
|
932
|
+
},
|
|
933
|
+
] as const;
|
|
934
|
+
const theme = useTheme() as CoreUITheme;
|
|
935
|
+
return (
|
|
936
|
+
<div style={{ width: '50%', padding: spacing.r16 }}>
|
|
937
|
+
<ChartLegendWrapper
|
|
938
|
+
colorSet={{
|
|
939
|
+
Success: theme.statusHealthy,
|
|
940
|
+
Failed: theme.statusCritical,
|
|
941
|
+
}}
|
|
942
|
+
>
|
|
943
|
+
<Barchart
|
|
944
|
+
type={{ type: 'category', gap: 0 }}
|
|
945
|
+
bars={histogramData}
|
|
946
|
+
title="Histogram"
|
|
947
|
+
/>
|
|
948
|
+
</ChartLegendWrapper>
|
|
949
|
+
</div>
|
|
950
|
+
);
|
|
951
|
+
},
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
export const StackedHistogram: Story = {
|
|
955
|
+
render: () => {
|
|
956
|
+
const histogramData = [
|
|
957
|
+
{
|
|
958
|
+
label: 'Test 1',
|
|
959
|
+
data: [
|
|
960
|
+
['0-10', 1],
|
|
961
|
+
['10-20', 5],
|
|
962
|
+
['20-30', 15],
|
|
963
|
+
['30-40', 40],
|
|
964
|
+
['40-50', 45],
|
|
965
|
+
['50-60', 50],
|
|
966
|
+
['60-70', 40],
|
|
967
|
+
['70-80', 15],
|
|
968
|
+
['80-90', 5],
|
|
969
|
+
['90-100', 1],
|
|
970
|
+
],
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
label: 'Test 2',
|
|
974
|
+
data: [
|
|
975
|
+
['0-10', 1],
|
|
976
|
+
['10-20', 2],
|
|
977
|
+
['20-30', 4],
|
|
978
|
+
['30-40', 4],
|
|
979
|
+
['40-50', 5],
|
|
980
|
+
['50-60', 6],
|
|
981
|
+
['60-70', 6],
|
|
982
|
+
['70-80', 3],
|
|
983
|
+
['80-90', 2],
|
|
984
|
+
['90-100', 1],
|
|
985
|
+
],
|
|
986
|
+
},
|
|
987
|
+
] as const;
|
|
988
|
+
const theme = useTheme() as CoreUITheme;
|
|
989
|
+
return (
|
|
990
|
+
<div style={{ width: '50%', padding: spacing.r16 }}>
|
|
991
|
+
<ChartLegendWrapper
|
|
992
|
+
colorSet={{
|
|
993
|
+
'Test 1': theme.statusHealthy,
|
|
994
|
+
'Test 2': theme.statusWarning,
|
|
995
|
+
}}
|
|
996
|
+
>
|
|
997
|
+
<Barchart
|
|
998
|
+
type={{ type: 'category', gap: 0 }}
|
|
999
|
+
bars={histogramData}
|
|
1000
|
+
title="Stacked Histogram"
|
|
1001
|
+
stacked
|
|
1002
|
+
/>
|
|
1003
|
+
<ChartLegend shape="rectangle" />
|
|
1004
|
+
</ChartLegendWrapper>
|
|
1005
|
+
</div>
|
|
1006
|
+
);
|
|
1007
|
+
},
|
|
1008
|
+
};
|
|
@@ -111,7 +111,7 @@ const horizontalBarChartArgs = {
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
export default {
|
|
114
|
-
title: 'Components/
|
|
114
|
+
title: 'Components/Deprecated/Charts/BarChart',
|
|
115
115
|
component: BarChart,
|
|
116
116
|
decorators: [
|
|
117
117
|
(story: Component) => <SyncedCursorCharts>{story()}</SyncedCursorCharts>,
|
package/stories/card.stories.tsx
CHANGED
|
@@ -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
|
|
11
|
-
import {
|
|
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(
|
|
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={
|
|
47
|
-
backgroundColor={
|
|
48
|
+
color={coreUIAvailableThemes.darkRebrand.buttonSecondary}
|
|
49
|
+
backgroundColor={coreUIAvailableThemes.darkRebrand.textPrimary}
|
|
48
50
|
radius={30}
|
|
49
51
|
strokeWidth={5}
|
|
50
52
|
percent={60}
|
package/stories/controls.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { iconTable } from
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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/
|
|
13
|
+
title: 'Components/Deprecated/Charts/LineTemporalChart',
|
|
14
14
|
component: LineTemporalChart,
|
|
15
15
|
decorators: [
|
|
16
16
|
(story) => (
|
|
@@ -64,6 +64,10 @@ const meta: Meta<typeof LineTimeSerieChart> = {
|
|
|
64
64
|
options: ['default', 'percentage', 'symmetrical'],
|
|
65
65
|
},
|
|
66
66
|
yAxisTitle: { control: 'text' },
|
|
67
|
+
timeFormat: {
|
|
68
|
+
control: 'select',
|
|
69
|
+
options: ['date-time', 'date'],
|
|
70
|
+
},
|
|
67
71
|
},
|
|
68
72
|
};
|
|
69
73
|
|
|
@@ -380,6 +384,99 @@ const prometheusData5 = [
|
|
|
380
384
|
[1740492000, '19859.90'],
|
|
381
385
|
];
|
|
382
386
|
|
|
387
|
+
// Data with irregular intervals but gaps under 2 intervals (less than 24 minutes)
|
|
388
|
+
// Sample frequency is 720 seconds (12 minutes), so 2 intervals = 1440 seconds (24 minutes)
|
|
389
|
+
const irregularIntervalData = [
|
|
390
|
+
[1740405600, '47.55'], // Base timestamp
|
|
391
|
+
[1740406200, '53.01'], // +600 seconds (10 minutes) - under 2 intervals
|
|
392
|
+
[1740407100, '40.19'], // +900 seconds (15 minutes) - under 2 intervals
|
|
393
|
+
[1740408000, '59.19'], // +900 seconds (15 minutes) - under 2 intervals
|
|
394
|
+
[1740409100, '62.50'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
395
|
+
[1740410300, '57.45'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
396
|
+
[1740411000, '45.19'], // +700 seconds (11.7 minutes) - under 2 intervals
|
|
397
|
+
[1740412200, '58.62'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
398
|
+
[1740413000, '53.08'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
399
|
+
[1740414300, '64.91'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
400
|
+
[1740415100, '81.23'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
401
|
+
[1740416400, '64.82'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
402
|
+
[1740417200, '67.17'], // +800 seconds (13.3 minutes) - under 2 intervals
|
|
403
|
+
[1740418500, '55.23'], // +1300 seconds (21.7 minutes) - under 2 intervals
|
|
404
|
+
[1740419400, '47.92'], // +900 seconds (15 minutes) - under 2 intervals
|
|
405
|
+
[1740420600, '72.11'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
406
|
+
[1740421500, '61.91'], // +900 seconds (15 minutes) - under 2 intervals
|
|
407
|
+
[1740422700, '51.07'], // +1200 seconds (20 minutes) - under 2 intervals
|
|
408
|
+
[1740423800, '39.50'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
409
|
+
[1740424900, '46.92'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
410
|
+
];
|
|
411
|
+
|
|
412
|
+
// Data spanning several months - multi-month dataset
|
|
413
|
+
const longTermPrometheusData: [number, string][] = [
|
|
414
|
+
// January 2025
|
|
415
|
+
[1735689600, '42.15'], // Jan 1, 2025
|
|
416
|
+
[1735776000, '38.92'], // Jan 2, 2025
|
|
417
|
+
[1735862400, '55.33'], // Jan 3, 2025
|
|
418
|
+
[1735948800, '67.88'], // Jan 4, 2025
|
|
419
|
+
[1736035200, '44.21'], // Jan 5, 2025
|
|
420
|
+
[1736121600, '72.15'], // Jan 6, 2025
|
|
421
|
+
[1736208000, '39.67'], // Jan 7, 2025
|
|
422
|
+
[1736294400, '58.44'], // Jan 8, 2025
|
|
423
|
+
[1736380800, '63.92'], // Jan 9, 2025
|
|
424
|
+
[1736467200, '41.33'], // Jan 10, 2025
|
|
425
|
+
[1736553600, '76.88'], // Jan 11, 2025
|
|
426
|
+
[1736640000, '52.15'], // Jan 12, 2025
|
|
427
|
+
[1736726400, '48.67'], // Jan 13, 2025
|
|
428
|
+
[1736812800, '69.33'], // Jan 14, 2025
|
|
429
|
+
[1736899200, '35.88'], // Jan 15, 2025
|
|
430
|
+
// February 2025
|
|
431
|
+
[1738368000, '81.15'], // Feb 1, 2025
|
|
432
|
+
[1738454400, '47.67'], // Feb 2, 2025
|
|
433
|
+
[1738540800, '54.33'], // Feb 3, 2025
|
|
434
|
+
[1738627200, '62.88'], // Feb 4, 2025
|
|
435
|
+
[1738713600, '38.15'], // Feb 5, 2025
|
|
436
|
+
[1738800000, '73.67'], // Feb 6, 2025
|
|
437
|
+
[1738886400, '45.33'], // Feb 7, 2025
|
|
438
|
+
[1738972800, '59.88'], // Feb 8, 2025
|
|
439
|
+
[1739059200, '51.15'], // Feb 9, 2025
|
|
440
|
+
[1739145600, '66.67'], // Feb 10, 2025
|
|
441
|
+
[1739232000, '43.33'], // Feb 11, 2025
|
|
442
|
+
[1739318400, '78.88'], // Feb 12, 2025
|
|
443
|
+
[1739404800, '36.15'], // Feb 13, 2025
|
|
444
|
+
[1739491200, '64.67'], // Feb 14, 2025
|
|
445
|
+
[1739577600, '49.33'], // Feb 15, 2025
|
|
446
|
+
// March 2025
|
|
447
|
+
[1740787200, '71.88'], // Mar 1, 2025
|
|
448
|
+
[1740873600, '42.15'], // Mar 2, 2025
|
|
449
|
+
[1740960000, '57.67'], // Mar 3, 2025
|
|
450
|
+
[1741046400, '68.33'], // Mar 4, 2025
|
|
451
|
+
[1741132800, '34.88'], // Mar 5, 2025
|
|
452
|
+
[1741219200, '75.15'], // Mar 6, 2025
|
|
453
|
+
[1741305600, '48.67'], // Mar 7, 2025
|
|
454
|
+
[1741392000, '53.33'], // Mar 8, 2025
|
|
455
|
+
[1741478400, '61.88'], // Mar 9, 2025
|
|
456
|
+
[1741564800, '37.15'], // Mar 10, 2025
|
|
457
|
+
[1741651200, '74.67'], // Mar 11, 2025
|
|
458
|
+
[1741737600, '44.33'], // Mar 12, 2025
|
|
459
|
+
[1741824000, '58.88'], // Mar 13, 2025
|
|
460
|
+
[1741910400, '52.15'], // Mar 14, 2025
|
|
461
|
+
[1741996800, '67.67'], // Mar 15, 2025
|
|
462
|
+
// April 2025
|
|
463
|
+
[1743465600, '41.33'], // Apr 1, 2025
|
|
464
|
+
[1743552000, '76.88'], // Apr 2, 2025
|
|
465
|
+
[1743638400, '35.15'], // Apr 3, 2025
|
|
466
|
+
[1743724800, '63.67'], // Apr 4, 2025
|
|
467
|
+
[1743811200, '50.33'], // Apr 5, 2025
|
|
468
|
+
[1743897600, '72.88'], // Apr 6, 2025
|
|
469
|
+
[1743984000, '39.15'], // Apr 7, 2025
|
|
470
|
+
[1744070400, '56.67'], // Apr 8, 2025
|
|
471
|
+
[1744156800, '65.33'], // Apr 9, 2025
|
|
472
|
+
[1744243200, '33.88'], // Apr 10, 2025
|
|
473
|
+
[1744329600, '77.15'], // Apr 11, 2025
|
|
474
|
+
[1744416000, '46.67'], // Apr 12, 2025
|
|
475
|
+
[1744502400, '54.33'], // Apr 13, 2025
|
|
476
|
+
[1744588800, '60.88'], // Apr 14, 2025
|
|
477
|
+
[1744675200, '49.22'], // Apr 15, 2025
|
|
478
|
+
];
|
|
479
|
+
|
|
383
480
|
export const PercentageChartExample: Story = {
|
|
384
481
|
args: {
|
|
385
482
|
series: [
|
|
@@ -400,6 +497,7 @@ export const PercentageChartExample: Story = {
|
|
|
400
497
|
yAxisTitle: '',
|
|
401
498
|
interval: SAMPLE_FREQUENCY_LAST_TWENTY_FOUR_HOURS,
|
|
402
499
|
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
500
|
+
xAxisFormat: 'date-time',
|
|
403
501
|
},
|
|
404
502
|
};
|
|
405
503
|
const UNIT_RANGE_BS = [
|
|
@@ -488,3 +586,51 @@ export const AutoUnitChartExample: Story = {
|
|
|
488
586
|
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
489
587
|
},
|
|
490
588
|
};
|
|
589
|
+
|
|
590
|
+
export const IrregularIntervalsExample: Story = {
|
|
591
|
+
args: {
|
|
592
|
+
series: [
|
|
593
|
+
{
|
|
594
|
+
data: irregularIntervalData,
|
|
595
|
+
resource: 'ip-10-160-122-207.eu-north-1.compute.internal',
|
|
596
|
+
metricPrefix: 'instance:10.160.122.207:9100',
|
|
597
|
+
getTooltipLabel: (prefix, resource) => `${resource}`,
|
|
598
|
+
},
|
|
599
|
+
],
|
|
600
|
+
title: 'Irregular intervals data',
|
|
601
|
+
height: 200,
|
|
602
|
+
startingTimeStamp: irregularIntervalData[0][0],
|
|
603
|
+
isLoading: false,
|
|
604
|
+
isLegendHidden: false,
|
|
605
|
+
helpText:
|
|
606
|
+
'Data points with irregular timestamps, but all gaps are less than 2 intervals (24 minutes). No missing data points are added.',
|
|
607
|
+
yAxisType: 'percentage',
|
|
608
|
+
yAxisTitle: '',
|
|
609
|
+
interval: SAMPLE_FREQUENCY_LAST_TWENTY_FOUR_HOURS,
|
|
610
|
+
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
611
|
+
},
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
export const DateFormatExample: Story = {
|
|
615
|
+
args: {
|
|
616
|
+
series: [
|
|
617
|
+
{
|
|
618
|
+
data: longTermPrometheusData,
|
|
619
|
+
resource: 'ip-10-160-122-207.eu-north-1.compute.internal',
|
|
620
|
+
metricPrefix: 'instance:10.160.122.207:9100',
|
|
621
|
+
getTooltipLabel: (prefix, resource) => `${resource}`,
|
|
622
|
+
},
|
|
623
|
+
],
|
|
624
|
+
title: 'Long term data',
|
|
625
|
+
height: 200,
|
|
626
|
+
startingTimeStamp: longTermPrometheusData[0][0],
|
|
627
|
+
isLoading: false,
|
|
628
|
+
isLegendHidden: false,
|
|
629
|
+
helpText: 'This is the help text',
|
|
630
|
+
interval: 60 * 60 * 24, // 1 day
|
|
631
|
+
duration:
|
|
632
|
+
longTermPrometheusData[longTermPrometheusData.length - 1][0] -
|
|
633
|
+
longTermPrometheusData[0][0],
|
|
634
|
+
timeFormat: 'date',
|
|
635
|
+
},
|
|
636
|
+
};
|