@scality/core-ui 0.161.0 → 0.163.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/README.md +15 -15
- package/dist/components/accordion/Accordion.component.d.ts +0 -1
- package/dist/components/accordion/Accordion.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.d.ts +53 -0
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -0
- package/dist/components/barchartv2/Barchart.component.js +86 -0
- package/dist/components/barchartv2/utils.d.ts +118 -0
- package/dist/components/barchartv2/utils.d.ts.map +1 -0
- package/dist/components/barchartv2/utils.js +337 -0
- package/dist/components/buttonv2/Buttonv2.component.d.ts +1 -1
- package/dist/components/buttonv2/Buttonv2.component.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.d.ts +8 -0
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -0
- package/dist/components/chartlegend/ChartLegend.js +65 -0
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +17 -0
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -0
- package/dist/components/chartlegend/ChartLegendWrapper.js +50 -0
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts +2 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.js +5 -4
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts +0 -1
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.d.ts +4 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +24 -1
- package/dist/components/date/FormattedDateTime.spec.js +12 -0
- package/dist/components/emptytable/Emptytable.component.d.ts +0 -1
- package/dist/components/emptytable/Emptytable.component.d.ts.map +1 -1
- package/dist/components/emptytable/Emptytable.component.js +1 -0
- package/dist/components/error-pages/ErrorPage401.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage401.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPage404.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage404.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPage500.component.d.ts +0 -1
- package/dist/components/error-pages/ErrorPage500.component.d.ts.map +1 -1
- package/dist/components/error-pages/ErrorPageAuth.component.d.ts.map +1 -1
- package/dist/components/form/Form.component.d.ts +2 -2
- package/dist/components/form/Form.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.d.ts +5 -5
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +33 -31
- package/dist/components/infomessage/InfoMessage.component.d.ts +0 -1
- package/dist/components/infomessage/InfoMessage.component.d.ts.map +1 -1
- package/dist/components/lateralnavbarlayout/LateralNavbarLayout.component.d.ts.map +1 -1
- package/dist/components/layout/Layout.component.d.ts.map +1 -1
- package/dist/components/layout/v2/panels.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +33 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +249 -0
- package/dist/components/modal/Modal.component.js +2 -2
- package/dist/components/navbar/Navbar.component.js +2 -2
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts +0 -1
- package/dist/components/scrollbarwrapper/ScrollbarWrapper.component.d.ts.map +1 -1
- package/dist/components/searchinput/SearchInput.component.d.ts +1 -2
- package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
- package/dist/components/selectv2/Selectv2.component.d.ts +5 -5
- package/dist/components/selectv2/Selectv2.component.d.ts.map +1 -1
- package/dist/components/selectv2/Selectv2.component.js +11 -6
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts +0 -1
- package/dist/components/statuswrapper/Statuswrapper.component.d.ts.map +1 -1
- package/dist/components/steppers/Stepper.component.d.ts.map +1 -1
- package/dist/components/steppers/Stepper.component.js +9 -8
- package/dist/components/tablev2/Search.js +2 -2
- package/dist/components/tablev2/SingleSelectableContent.d.ts +1 -2
- package/dist/components/tablev2/SingleSelectableContent.d.ts.map +1 -1
- package/dist/components/tablev2/TableCommon.d.ts +2 -2
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
- package/dist/components/tablev2/TableSync.d.ts +8 -0
- package/dist/components/tablev2/TableSync.d.ts.map +1 -0
- package/dist/components/tablev2/TableSync.js +11 -0
- package/dist/components/tablev2/Tablev2.component.d.ts +2 -1
- package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -1
- package/dist/components/tablev2/Tablev2.component.js +10 -9
- package/dist/components/tabsv2/ScrollButton.d.ts +1 -2
- package/dist/components/tabsv2/ScrollButton.d.ts.map +1 -1
- package/dist/components/tabsv2/ScrollButton.js +2 -2
- package/dist/components/tabsv2/Tabsv2.component.d.ts +2 -2
- package/dist/components/tabsv2/Tabsv2.component.d.ts.map +1 -1
- package/dist/components/tabsv2/Tabsv2.component.js +2 -2
- package/dist/components/text/Text.component.d.ts +0 -1
- package/dist/components/text/Text.component.d.ts.map +1 -1
- package/dist/components/textarea/TextArea.component.d.ts +3 -3
- package/dist/components/textarea/TextArea.component.d.ts.map +1 -1
- package/dist/components/textbadge/TextBadge.component.d.ts +0 -1
- package/dist/components/textbadge/TextBadge.component.d.ts.map +1 -1
- package/dist/components/toast/Toast.component.d.ts +1 -1
- package/dist/components/toast/Toast.component.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +4 -5
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts +1 -2
- package/dist/components/vegachartv2/SyncedCursorCharts.d.ts.map +1 -1
- package/dist/components/vegachartv2/SyncedCursorCharts.js +3 -5
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts +1 -2
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts.map +1 -1
- package/dist/components/vegachartv2/VegaChartV2.component.js +2 -2
- package/dist/icons/branding.d.ts.map +1 -1
- package/dist/icons/scality-loading.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/next.d.ts +2 -0
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +2 -0
- package/dist/style/theme.d.ts +20 -0
- package/dist/style/theme.d.ts.map +1 -1
- package/dist/style/theme.js +46 -1
- package/package.json +7 -4
- package/setupTests.js +6 -0
- package/src/lib/components/accordion/Accordion.component.tsx +1 -1
- package/src/lib/components/accordion/Accordion.test.tsx +7 -15
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +364 -0
- package/src/lib/components/barchartv2/Barchart.component.tsx +321 -0
- package/src/lib/components/barchartv2/utils.test.ts +899 -0
- package/src/lib/components/barchartv2/utils.ts +534 -0
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +1 -1
- package/src/lib/components/chartlegend/ChartLegend.tsx +113 -0
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +85 -0
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +22 -3
- package/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx +0 -1
- package/src/lib/components/date/FormattedDateTime.spec.tsx +24 -0
- package/src/lib/components/date/FormattedDateTime.tsx +42 -2
- package/src/lib/components/emptytable/Emptytable.component.tsx +1 -1
- package/src/lib/components/error-pages/ErrorPage401.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPage404.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPage500.component.tsx +0 -1
- package/src/lib/components/error-pages/ErrorPageAuth.component.tsx +0 -1
- package/src/lib/components/form/Form.component.tsx +1 -1
- package/src/lib/components/healthselectorv2/HealthSelector.component.test.tsx +3 -3
- package/src/lib/components/icon/Icon.component.tsx +48 -60
- package/src/lib/components/infomessage/InfoMessage.component.tsx +0 -1
- package/src/lib/components/inlineinput/InlineInput.test.tsx +22 -19
- package/src/lib/components/inputlist/InputList.test.tsx +21 -19
- package/src/lib/components/lateralnavbarlayout/LateralNavbarLayout.component.tsx +0 -1
- package/src/lib/components/layout/Layout.component.tsx +0 -1
- package/src/lib/components/layout/v2/panels.tsx +1 -1
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +502 -0
- package/src/lib/components/modal/Modal.component.tsx +2 -2
- package/src/lib/components/navbar/Navbar.component.tsx +2 -2
- package/src/lib/components/scrollbarwrapper/ScrollbarWrapper.component.tsx +0 -1
- package/src/lib/components/searchinput/SearchInput.component.tsx +0 -1
- package/src/lib/components/searchinput/SearchInput.test.tsx +3 -7
- package/src/lib/components/selectv2/Selectv2.component.tsx +24 -14
- package/src/lib/components/selectv2/selectv2.test.tsx +62 -57
- package/src/lib/components/sidebar/Sidebar.component.tsx +1 -1
- package/src/lib/components/statuswrapper/Statuswrapper.component.tsx +0 -1
- package/src/lib/components/steppers/Stepper.component.tsx +10 -8
- package/src/lib/components/tablev2/Search.tsx +2 -2
- package/src/lib/components/tablev2/SingleSelectableContent.tsx +2 -2
- package/src/lib/components/tablev2/TableCommon.tsx +1 -1
- package/src/lib/components/tablev2/TableSync.test.tsx +28 -0
- package/src/lib/components/tablev2/TableSync.tsx +36 -0
- package/src/lib/components/tablev2/Tablev2.component.tsx +11 -9
- package/src/lib/components/tablev2/Tablev2.test.tsx +36 -37
- package/src/lib/components/tabsv2/ScrollButton.tsx +2 -2
- package/src/lib/components/tabsv2/Tabsv2.component.tsx +6 -6
- package/src/lib/components/text/Text.component.tsx +4 -5
- package/src/lib/components/textarea/TextArea.component.tsx +3 -2
- package/src/lib/components/textbadge/TextBadge.component.tsx +0 -1
- package/src/lib/components/toast/Toast.component.tsx +1 -1
- package/src/lib/components/toast/ToastProvider.tsx +17 -7
- package/src/lib/components/vegachartv2/SyncedCursorCharts.tsx +5 -7
- package/src/lib/components/vegachartv2/VegaChartV2.component.tsx +2 -2
- package/src/lib/icons/branding.tsx +0 -2
- package/src/lib/icons/scality-loading.tsx +0 -2
- package/src/lib/index.ts +1 -0
- package/src/lib/next.ts +6 -0
- package/src/lib/style/theme.ts +53 -1
- package/stories/BarChart/barchart.stories.tsx +822 -0
- package/stories/areachart.stories.tsx +0 -1
- package/stories/format.mdx +4 -2
- package/stories/linetimeseriechart.stories.tsx +485 -0
- package/stories/tablev2.stories.tsx +41 -0
- package/tsconfig.json +5 -2
package/dist/next.js
CHANGED
|
@@ -13,3 +13,5 @@ export { CoreUiThemeProvider } from './components/coreuithemeprovider/CoreUiThem
|
|
|
13
13
|
export { Box } from './components/box/Box';
|
|
14
14
|
export { Input } from './components/inputv2/inputv2';
|
|
15
15
|
export { Accordion } from './components/accordion/Accordion.component';
|
|
16
|
+
export { Barchart, } from './components/barchartv2/Barchart.component';
|
|
17
|
+
export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
|
package/dist/style/theme.d.ts
CHANGED
|
@@ -63,6 +63,14 @@ export declare const coreUIAvailableThemes: Record<CoreUIThemeName, CoreUITheme>
|
|
|
63
63
|
* import { coreUIAvailableThemes } from '@scality/core-ui/dist/style/theme';
|
|
64
64
|
*/
|
|
65
65
|
export declare const defaultTheme: Record<"darkRebrand" | "artescaLight" | "ring9dark", CoreUITheme>;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated
|
|
68
|
+
* Instead should use useTheme()
|
|
69
|
+
* import { useTheme } from 'styled-components';
|
|
70
|
+
* const theme = useTheme();
|
|
71
|
+
* e.g: color={theme.statusHealthy}
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
66
74
|
export declare const brand: CoreUITheme;
|
|
67
75
|
export type ThemeColors = keyof CoreUITheme;
|
|
68
76
|
export declare const lineColor1 = "#A14FBF";
|
|
@@ -73,6 +81,17 @@ export declare const lineColor5 = "#E3FF73";
|
|
|
73
81
|
export declare const lineColor6 = "#BE2543";
|
|
74
82
|
export declare const lineColor7 = "#FD8144";
|
|
75
83
|
export declare const lineColor8 = "#F6B187";
|
|
84
|
+
export type ChartColors = keyof typeof chartColors;
|
|
85
|
+
export declare const chartColors: {
|
|
86
|
+
lineColor1: string;
|
|
87
|
+
lineColor2: string;
|
|
88
|
+
lineColor3: string;
|
|
89
|
+
lineColor4: string;
|
|
90
|
+
lineColor5: string;
|
|
91
|
+
lineColor6: string;
|
|
92
|
+
lineColor7: string;
|
|
93
|
+
lineColor8: string;
|
|
94
|
+
};
|
|
76
95
|
export declare const fontSize: {
|
|
77
96
|
smaller: string;
|
|
78
97
|
small: string;
|
|
@@ -157,4 +176,5 @@ export declare const navbarHeight = "3rem";
|
|
|
157
176
|
export declare const navbarItemWidth = "4.286rem";
|
|
158
177
|
export declare const sidebarItemHeight: string;
|
|
159
178
|
export declare const sidebarWidth: string;
|
|
179
|
+
export declare const lineTimeSeriesColorRange: string[];
|
|
160
180
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/style/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/style/theme.ts"],"names":[],"mappings":"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"}
|
package/dist/style/theme.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lighten, darken } from 'polished';
|
|
1
2
|
//== Colors
|
|
2
3
|
export const hotPink = '#E40046';
|
|
3
4
|
export const pink = '#EB4962';
|
|
@@ -118,7 +119,14 @@ export const coreUIAvailableThemes = {
|
|
|
118
119
|
* import { coreUIAvailableThemes } from '@scality/core-ui/dist/style/theme';
|
|
119
120
|
*/
|
|
120
121
|
export const defaultTheme = coreUIAvailableThemes;
|
|
121
|
-
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated
|
|
124
|
+
* Instead should use useTheme()
|
|
125
|
+
* import { useTheme } from 'styled-components';
|
|
126
|
+
* const theme = useTheme();
|
|
127
|
+
* e.g: color={theme.statusHealthy}
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
122
130
|
export const brand = coreUIAvailableThemes.darkRebrand;
|
|
123
131
|
// LineChart colors
|
|
124
132
|
export const lineColor1 = '#A14FBF';
|
|
@@ -129,6 +137,16 @@ export const lineColor5 = '#E3FF73';
|
|
|
129
137
|
export const lineColor6 = '#BE2543';
|
|
130
138
|
export const lineColor7 = '#FD8144';
|
|
131
139
|
export const lineColor8 = '#F6B187';
|
|
140
|
+
export const chartColors = {
|
|
141
|
+
lineColor1,
|
|
142
|
+
lineColor2,
|
|
143
|
+
lineColor3,
|
|
144
|
+
lineColor4,
|
|
145
|
+
lineColor5,
|
|
146
|
+
lineColor6,
|
|
147
|
+
lineColor7,
|
|
148
|
+
lineColor8,
|
|
149
|
+
};
|
|
132
150
|
export const fontSize = {
|
|
133
151
|
smaller: '0.71rem',
|
|
134
152
|
small: '0.85rem',
|
|
@@ -232,3 +250,30 @@ export const navbarItemWidth = '4.286rem';
|
|
|
232
250
|
//sidebar
|
|
233
251
|
export const sidebarItemHeight = spacing.sp40;
|
|
234
252
|
export const sidebarWidth = spacing.sp40;
|
|
253
|
+
// We use 8 main color from the palette and decline them (lighter/ darker) when we have more than 8 datasets
|
|
254
|
+
export const lineTimeSeriesColorRange = [
|
|
255
|
+
lineColor1,
|
|
256
|
+
lineColor2,
|
|
257
|
+
lineColor3,
|
|
258
|
+
lineColor4,
|
|
259
|
+
lineColor5,
|
|
260
|
+
lineColor6,
|
|
261
|
+
lineColor7,
|
|
262
|
+
lineColor8,
|
|
263
|
+
lighten(0.3, lineColor1),
|
|
264
|
+
lighten(0.3, lineColor2),
|
|
265
|
+
lighten(0.3, lineColor3),
|
|
266
|
+
lighten(0.3, lineColor4),
|
|
267
|
+
lighten(0.3, lineColor5),
|
|
268
|
+
lighten(0.3, lineColor6),
|
|
269
|
+
lighten(0.3, lineColor7),
|
|
270
|
+
lighten(0.3, lineColor8),
|
|
271
|
+
darken(0.2, lineColor1),
|
|
272
|
+
darken(0.2, lineColor2),
|
|
273
|
+
darken(0.2, lineColor3),
|
|
274
|
+
darken(0.2, lineColor4),
|
|
275
|
+
darken(0.3, lineColor5),
|
|
276
|
+
darken(0.3, lineColor6),
|
|
277
|
+
darken(0.3, lineColor7),
|
|
278
|
+
darken(0.3, lineColor8),
|
|
279
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/core-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.163.0",
|
|
4
4
|
"description": "Scality common React component library",
|
|
5
5
|
"author": "Scality Engineering",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"mainSrc": "src/lib/index.js",
|
|
10
10
|
"sideEffects": false,
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
13
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
14
|
+
},
|
|
11
15
|
"scripts": {
|
|
12
16
|
"analyze": "source-map-explorer 'dist/*.js'",
|
|
13
17
|
"build": "rimraf dist && tsc",
|
|
@@ -104,16 +108,14 @@
|
|
|
104
108
|
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
|
105
109
|
"@fortawesome/free-regular-svg-icons": "^5.15.3",
|
|
106
110
|
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
|
107
|
-
"@fortawesome/react-fontawesome": "^0.
|
|
111
|
+
"@fortawesome/react-fontawesome": "^0.2.3",
|
|
108
112
|
"@js-temporal/polyfill": "^0.4.4",
|
|
109
113
|
"@storybook/preview-api": "^8.3.6",
|
|
110
114
|
"downshift": "^7.0.5",
|
|
111
115
|
"framer-motion": "^4.1.17",
|
|
112
116
|
"polished": "3.4.1",
|
|
113
117
|
"pretty-bytes": "^5.6.0",
|
|
114
|
-
"react": "^18.3.1",
|
|
115
118
|
"react-debounce-input": "3.2.2",
|
|
116
|
-
"react-dom": "^18.3.1",
|
|
117
119
|
"react-dropzone": "^14.2.3",
|
|
118
120
|
"react-hook-form": "^7.49.2",
|
|
119
121
|
"react-query": "^3.34.0",
|
|
@@ -125,6 +127,7 @@
|
|
|
125
127
|
"react-virtualized": "9.22.3",
|
|
126
128
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
127
129
|
"react-window": "^1.8.6",
|
|
130
|
+
"recharts": "^3.0.2",
|
|
128
131
|
"styled-components": "^5.2.1",
|
|
129
132
|
"styled-system": "^5.1.5",
|
|
130
133
|
"vega": "^5.17.3",
|
package/setupTests.js
CHANGED
|
@@ -5,3 +5,9 @@ import 'regenerator-runtime/runtime';
|
|
|
5
5
|
import { TextEncoder, TextDecoder } from 'util';
|
|
6
6
|
|
|
7
7
|
Object.assign(global, { TextDecoder, TextEncoder });
|
|
8
|
+
|
|
9
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
10
|
+
observe: jest.fn(),
|
|
11
|
+
unobserve: jest.fn(),
|
|
12
|
+
disconnect: jest.fn(),
|
|
13
|
+
}));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { Accordion } from './Accordion.component';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
6
5
|
|
|
7
6
|
describe('Accordion', () => {
|
|
8
7
|
const selectors = {
|
|
@@ -11,20 +10,18 @@ describe('Accordion', () => {
|
|
|
11
10
|
accordionContent: () => screen.queryByText(/Test content/i),
|
|
12
11
|
};
|
|
13
12
|
const SUT = ({ open = false }) => {
|
|
14
|
-
const queryClient = new QueryClient();
|
|
15
13
|
return (
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
</Accordion>
|
|
20
|
-
</QueryClientProvider>
|
|
14
|
+
<Accordion title="Advanced Testings" id="test-accordion" open={open}>
|
|
15
|
+
<div>Test content</div>
|
|
16
|
+
</Accordion>
|
|
21
17
|
);
|
|
22
18
|
};
|
|
23
19
|
const renderAccordion = (open = false) => {
|
|
24
20
|
render(<SUT open={open} />);
|
|
25
21
|
};
|
|
26
|
-
it('should render the Accordion component with title and content', () => {
|
|
22
|
+
it('should render the Accordion component with title and content', async () => {
|
|
27
23
|
renderAccordion();
|
|
24
|
+
await waitFor(() => screen.findByRole('img', { hidden: true }));
|
|
28
25
|
|
|
29
26
|
const accordionToggle = selectors.accordionToggle();
|
|
30
27
|
expect(accordionToggle).toBeInTheDocument();
|
|
@@ -54,7 +51,6 @@ describe('Accordion', () => {
|
|
|
54
51
|
});
|
|
55
52
|
|
|
56
53
|
it('should toggle the content when open prop changes', () => {
|
|
57
|
-
const queryClient = new QueryClient();
|
|
58
54
|
const TestWrapper = () => {
|
|
59
55
|
const [isOpen, setisOpen] = useState(false);
|
|
60
56
|
return (
|
|
@@ -65,11 +61,7 @@ describe('Accordion', () => {
|
|
|
65
61
|
);
|
|
66
62
|
};
|
|
67
63
|
|
|
68
|
-
render(
|
|
69
|
-
<QueryClientProvider client={queryClient}>
|
|
70
|
-
<TestWrapper />
|
|
71
|
-
</QueryClientProvider>,
|
|
72
|
-
);
|
|
64
|
+
render(<TestWrapper />);
|
|
73
65
|
|
|
74
66
|
userEvent.click(screen.getByRole('button', { name: /Test button/i }));
|
|
75
67
|
expect(selectors.accordionContent()).toBeInTheDocument();
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getWrapper } from '../../testUtils';
|
|
4
|
+
import { Barchart } from './Barchart.component';
|
|
5
|
+
import { ChartLegendWrapper } from '../chartlegend/ChartLegendWrapper';
|
|
6
|
+
|
|
7
|
+
const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
8
|
+
const ONE_HOUR_IN_MILLISECONDS = 60 * 60 * 1000;
|
|
9
|
+
|
|
10
|
+
// Mock ResponsiveContainer to test the Barchart component
|
|
11
|
+
jest.mock('recharts', () => {
|
|
12
|
+
const OriginalResponsiveContainerModule = jest.requireActual('recharts');
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
...OriginalResponsiveContainerModule,
|
|
16
|
+
ResponsiveContainer: ({ height, children }) => (
|
|
17
|
+
<OriginalResponsiveContainerModule.ResponsiveContainer
|
|
18
|
+
width={800}
|
|
19
|
+
height={300}
|
|
20
|
+
data-testid="responsive-container"
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</OriginalResponsiveContainerModule.ResponsiveContainer>
|
|
24
|
+
),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const testBars = [
|
|
29
|
+
{
|
|
30
|
+
label: 'Success',
|
|
31
|
+
data: [
|
|
32
|
+
['category1', 10],
|
|
33
|
+
['category2', 20],
|
|
34
|
+
['category3', 30],
|
|
35
|
+
],
|
|
36
|
+
color: 'green',
|
|
37
|
+
},
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
const testTimeBars = [
|
|
41
|
+
{
|
|
42
|
+
label: 'Success',
|
|
43
|
+
data: [
|
|
44
|
+
[new Date('2024-07-05'), 10],
|
|
45
|
+
[new Date('2024-07-06'), 20],
|
|
46
|
+
[new Date('2024-07-07'), 30],
|
|
47
|
+
],
|
|
48
|
+
color: 'green',
|
|
49
|
+
},
|
|
50
|
+
] as const;
|
|
51
|
+
|
|
52
|
+
const testColorSet = {
|
|
53
|
+
Success: 'lineColor1',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
describe('Barchart', () => {
|
|
57
|
+
describe('Basic rendering', () => {
|
|
58
|
+
it('should render the Barchart component with category data', async () => {
|
|
59
|
+
const { Wrapper } = getWrapper();
|
|
60
|
+
render(
|
|
61
|
+
<Wrapper>
|
|
62
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
63
|
+
<Barchart type="category" bars={testBars} />
|
|
64
|
+
</ChartLegendWrapper>
|
|
65
|
+
</Wrapper>,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
expect(screen.getByText('category1')).toBeInTheDocument();
|
|
69
|
+
expect(screen.getByText('category2')).toBeInTheDocument();
|
|
70
|
+
expect(screen.getByText('category3')).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
it('should render the Barchart component with time data', async () => {
|
|
73
|
+
const { Wrapper } = getWrapper();
|
|
74
|
+
render(
|
|
75
|
+
<Wrapper>
|
|
76
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
77
|
+
<Barchart
|
|
78
|
+
type={{
|
|
79
|
+
type: 'time',
|
|
80
|
+
timeRange: {
|
|
81
|
+
startDate: new Date('2024-07-05'),
|
|
82
|
+
endDate: new Date('2024-07-07'),
|
|
83
|
+
interval: ONE_DAY_IN_MILLISECONDS,
|
|
84
|
+
},
|
|
85
|
+
}}
|
|
86
|
+
bars={testTimeBars}
|
|
87
|
+
/>
|
|
88
|
+
</ChartLegendWrapper>
|
|
89
|
+
</Wrapper>,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(screen.getByText('Fri05Jul')).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByText('Sat06Jul')).toBeInTheDocument();
|
|
94
|
+
expect(screen.getByText('Sun07Jul')).toBeInTheDocument();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('Time data', () => {
|
|
99
|
+
it('should render the chart with correct starting days even if the data is missing', async () => {
|
|
100
|
+
const { Wrapper } = getWrapper();
|
|
101
|
+
render(
|
|
102
|
+
<Wrapper>
|
|
103
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
104
|
+
<Barchart
|
|
105
|
+
type={{
|
|
106
|
+
type: 'time',
|
|
107
|
+
timeRange: {
|
|
108
|
+
startDate: new Date('2024-07-03'),
|
|
109
|
+
endDate: new Date('2024-07-07'),
|
|
110
|
+
interval: ONE_DAY_IN_MILLISECONDS,
|
|
111
|
+
},
|
|
112
|
+
}}
|
|
113
|
+
// data starts on 2024-07-05
|
|
114
|
+
bars={testTimeBars}
|
|
115
|
+
/>
|
|
116
|
+
</ChartLegendWrapper>
|
|
117
|
+
</Wrapper>,
|
|
118
|
+
);
|
|
119
|
+
expect(screen.getByText('Wed03Jul')).toBeInTheDocument();
|
|
120
|
+
expect(screen.getByText('Thu04Jul')).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByText('Fri05Jul')).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByText('Sat06Jul')).toBeInTheDocument();
|
|
123
|
+
expect(screen.getByText('Sun07Jul')).toBeInTheDocument();
|
|
124
|
+
});
|
|
125
|
+
it('should render when there are missing data in the time range', async () => {
|
|
126
|
+
const bars = [
|
|
127
|
+
{
|
|
128
|
+
label: 'Success',
|
|
129
|
+
data: [
|
|
130
|
+
[new Date('2024-07-05'), 10], // Friday
|
|
131
|
+
[new Date('2024-07-08'), 15], // Monday
|
|
132
|
+
] as [Date, number][],
|
|
133
|
+
color: 'green',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: 'Failed',
|
|
137
|
+
data: [
|
|
138
|
+
[new Date('2024-07-05'), 2], // Friday
|
|
139
|
+
[new Date('2024-07-08'), 3], // Monday
|
|
140
|
+
] as [Date, number][],
|
|
141
|
+
color: 'red',
|
|
142
|
+
},
|
|
143
|
+
] as const;
|
|
144
|
+
|
|
145
|
+
const type = {
|
|
146
|
+
type: 'time' as const,
|
|
147
|
+
timeRange: {
|
|
148
|
+
startDate: new Date('2024-07-05'),
|
|
149
|
+
endDate: new Date('2024-07-08'),
|
|
150
|
+
interval: ONE_DAY_IN_MILLISECONDS,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
const { Wrapper } = getWrapper();
|
|
154
|
+
render(
|
|
155
|
+
<Wrapper>
|
|
156
|
+
<ChartLegendWrapper
|
|
157
|
+
colorSet={{
|
|
158
|
+
Success: 'lineColor1',
|
|
159
|
+
Failed: 'lineColor2',
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
<Barchart type={type} bars={bars} />
|
|
163
|
+
</ChartLegendWrapper>
|
|
164
|
+
</Wrapper>,
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// Check that all days are present
|
|
168
|
+
await waitFor(() => {
|
|
169
|
+
expect(screen.getByText('Fri05Jul')).toBeInTheDocument();
|
|
170
|
+
expect(screen.getByText('Sat06Jul')).toBeInTheDocument();
|
|
171
|
+
expect(screen.getByText('Sun07Jul')).toBeInTheDocument();
|
|
172
|
+
expect(screen.getByText('Mon08Jul')).toBeInTheDocument();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
it('should render for a specific time range', async () => {
|
|
176
|
+
// 7 days data from 2024-07-05 to 2024-07-11
|
|
177
|
+
const testTimeBars = [
|
|
178
|
+
{
|
|
179
|
+
label: 'Success',
|
|
180
|
+
data: [
|
|
181
|
+
[new Date('2024-07-05'), 10],
|
|
182
|
+
[new Date('2024-07-06'), 10],
|
|
183
|
+
[new Date('2024-07-07'), 10],
|
|
184
|
+
[new Date('2024-07-08'), 10],
|
|
185
|
+
[new Date('2024-07-09'), 10],
|
|
186
|
+
[new Date('2024-07-10'), 10],
|
|
187
|
+
[new Date('2024-07-11'), 10],
|
|
188
|
+
],
|
|
189
|
+
color: 'green',
|
|
190
|
+
},
|
|
191
|
+
] as const;
|
|
192
|
+
|
|
193
|
+
const type = {
|
|
194
|
+
type: 'time' as const,
|
|
195
|
+
timeRange: {
|
|
196
|
+
startDate: new Date('2024-07-05'),
|
|
197
|
+
endDate: new Date('2024-07-11'),
|
|
198
|
+
interval: ONE_DAY_IN_MILLISECONDS,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
const { Wrapper } = getWrapper();
|
|
202
|
+
render(
|
|
203
|
+
<Wrapper>
|
|
204
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
205
|
+
<Barchart type={type} bars={testTimeBars} />
|
|
206
|
+
</ChartLegendWrapper>
|
|
207
|
+
</Wrapper>,
|
|
208
|
+
);
|
|
209
|
+
await waitFor(() => {
|
|
210
|
+
expect(screen.getByText('Fri05Jul')).toBeInTheDocument();
|
|
211
|
+
expect(screen.getByText('Sat06Jul')).toBeInTheDocument();
|
|
212
|
+
expect(screen.getByText('Sun07Jul')).toBeInTheDocument();
|
|
213
|
+
expect(screen.getByText('Mon08Jul')).toBeInTheDocument();
|
|
214
|
+
expect(screen.getByText('Tue09Jul')).toBeInTheDocument();
|
|
215
|
+
expect(screen.getByText('Wed10Jul')).toBeInTheDocument();
|
|
216
|
+
expect(screen.getByText('Thu11Jul')).toBeInTheDocument();
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
it('should render the Barchart component with hourly intervals', async () => {
|
|
220
|
+
const testHourlyBars = [
|
|
221
|
+
{
|
|
222
|
+
label: 'Success',
|
|
223
|
+
data: [
|
|
224
|
+
[new Date('2024-07-05T10:00:00'), 10],
|
|
225
|
+
[new Date('2024-07-05T12:00:00'), 20],
|
|
226
|
+
],
|
|
227
|
+
color: 'green',
|
|
228
|
+
},
|
|
229
|
+
] as const;
|
|
230
|
+
|
|
231
|
+
const { Wrapper } = getWrapper();
|
|
232
|
+
render(
|
|
233
|
+
<Wrapper>
|
|
234
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
235
|
+
<Barchart
|
|
236
|
+
type={{
|
|
237
|
+
type: 'time',
|
|
238
|
+
timeRange: {
|
|
239
|
+
startDate: new Date('2024-07-05T10:00:00'),
|
|
240
|
+
endDate: new Date('2024-07-05T12:00:00'),
|
|
241
|
+
interval: ONE_HOUR_IN_MILLISECONDS,
|
|
242
|
+
},
|
|
243
|
+
}}
|
|
244
|
+
bars={testHourlyBars}
|
|
245
|
+
/>
|
|
246
|
+
</ChartLegendWrapper>
|
|
247
|
+
</Wrapper>,
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
expect(screen.getByText('10:00')).toBeInTheDocument();
|
|
251
|
+
expect(screen.getByText('11:00')).toBeInTheDocument();
|
|
252
|
+
expect(screen.getByText('12:00')).toBeInTheDocument();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('should render stacked bars', () => {
|
|
257
|
+
const testStackedBars = [
|
|
258
|
+
{
|
|
259
|
+
label: 'Success',
|
|
260
|
+
data: [
|
|
261
|
+
['category1', 10],
|
|
262
|
+
['category2', 20],
|
|
263
|
+
['category3', 30],
|
|
264
|
+
],
|
|
265
|
+
color: 'green',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
label: 'Failed',
|
|
269
|
+
data: [
|
|
270
|
+
['category1', 5],
|
|
271
|
+
['category2', 8],
|
|
272
|
+
['category3', 12],
|
|
273
|
+
],
|
|
274
|
+
color: 'red',
|
|
275
|
+
},
|
|
276
|
+
] as const;
|
|
277
|
+
|
|
278
|
+
const { Wrapper } = getWrapper();
|
|
279
|
+
render(
|
|
280
|
+
<Wrapper>
|
|
281
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
282
|
+
<Barchart type="category" bars={testStackedBars} stacked={true} />
|
|
283
|
+
</ChartLegendWrapper>
|
|
284
|
+
</Wrapper>,
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
expect(screen.getByText('category1')).toBeInTheDocument();
|
|
288
|
+
expect(screen.getByText('category2')).toBeInTheDocument();
|
|
289
|
+
expect(screen.getByText('category3')).toBeInTheDocument();
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('should sort categories using defaultSort function', () => {
|
|
293
|
+
const testBars = [
|
|
294
|
+
{
|
|
295
|
+
label: 'Success',
|
|
296
|
+
data: [
|
|
297
|
+
['category1', 10],
|
|
298
|
+
['category2', 20],
|
|
299
|
+
['category3', 30],
|
|
300
|
+
],
|
|
301
|
+
color: 'green',
|
|
302
|
+
},
|
|
303
|
+
] as const;
|
|
304
|
+
|
|
305
|
+
const { Wrapper } = getWrapper();
|
|
306
|
+
render(
|
|
307
|
+
<Wrapper>
|
|
308
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
309
|
+
<Barchart
|
|
310
|
+
type="category"
|
|
311
|
+
bars={testBars}
|
|
312
|
+
defaultSort={(pointA, pointB) => {
|
|
313
|
+
const valueA = pointA.Success;
|
|
314
|
+
const valueB = pointB.Success;
|
|
315
|
+
return valueB - valueA > 0 ? 1 : valueB - valueA < 0 ? -1 : 0;
|
|
316
|
+
}}
|
|
317
|
+
/>
|
|
318
|
+
</ChartLegendWrapper>
|
|
319
|
+
</Wrapper>,
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
// Categories should be rendered in descending order by value
|
|
323
|
+
const categories = screen.getAllByText(/category[123]/);
|
|
324
|
+
expect(categories[0]).toHaveTextContent('category3'); // 30 (highest)
|
|
325
|
+
expect(categories[1]).toHaveTextContent('category2'); // 20 (middle)
|
|
326
|
+
expect(categories[2]).toHaveTextContent('category1'); // 10 (lowest)
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it('should render the Barchart component with loading state', () => {
|
|
330
|
+
const { Wrapper } = getWrapper();
|
|
331
|
+
render(
|
|
332
|
+
<Wrapper>
|
|
333
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
334
|
+
<Barchart type="category" bars={[]} isLoading />
|
|
335
|
+
</ChartLegendWrapper>
|
|
336
|
+
</Wrapper>,
|
|
337
|
+
);
|
|
338
|
+
expect(screen.getByText('Loading Chart Data...')).toBeInTheDocument();
|
|
339
|
+
});
|
|
340
|
+
it('should render header with title, secondary title, right title and help tooltip', async () => {
|
|
341
|
+
const { Wrapper } = getWrapper();
|
|
342
|
+
render(
|
|
343
|
+
<Wrapper>
|
|
344
|
+
<ChartLegendWrapper colorSet={testColorSet}>
|
|
345
|
+
<Barchart
|
|
346
|
+
type="category"
|
|
347
|
+
bars={[]}
|
|
348
|
+
title="Test Title"
|
|
349
|
+
secondaryTitle="Test Secondary Title"
|
|
350
|
+
rightTitle="Test Right Title"
|
|
351
|
+
helpTooltip="Test Help Tooltip"
|
|
352
|
+
/>
|
|
353
|
+
</ChartLegendWrapper>
|
|
354
|
+
</Wrapper>,
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
expect(screen.getByText('Test Title')).toBeInTheDocument();
|
|
358
|
+
expect(screen.getByText('Test Secondary Title')).toBeInTheDocument();
|
|
359
|
+
expect(screen.getByText('Test Right Title')).toBeInTheDocument();
|
|
360
|
+
await waitFor(() => {
|
|
361
|
+
expect(screen.getByLabelText('Test Help Tooltip')).toBeInTheDocument();
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
});
|