@scality/core-ui 0.164.0 → 0.166.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/dist/components/barchartv2/Barchart.component.d.ts +20 -1
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.js +33 -5
- package/dist/components/barchartv2/ChartTooltip.d.ts +18 -0
- package/dist/components/barchartv2/ChartTooltip.d.ts.map +1 -0
- package/dist/components/barchartv2/ChartTooltip.js +31 -0
- package/dist/components/barchartv2/utils.d.ts.map +1 -1
- package/dist/components/barchartv2/utils.js +1 -28
- package/dist/components/chartlegend/ChartLegend.d.ts +9 -0
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +38 -9
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +4 -0
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +23 -2
- package/dist/components/constants.d.ts +2 -0
- package/dist/components/constants.d.ts.map +1 -1
- package/dist/components/constants.js +6 -0
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts +3 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.js +2 -2
- package/dist/components/date/FormattedDateTime.d.ts +2 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +10 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +3 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +5 -7
- package/dist/components/text/Text.component.js +1 -1
- package/dist/components/toast/Toast.component.d.ts.map +1 -1
- package/dist/components/toast/Toast.component.js +24 -11
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/next.d.ts +2 -0
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +2 -0
- package/package.json +1 -2
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +100 -4
- package/src/lib/components/barchartv2/Barchart.component.tsx +46 -11
- package/src/lib/components/barchartv2/ChartTooltip.tsx +76 -0
- package/src/lib/components/barchartv2/utils.test.ts +72 -45
- package/src/lib/components/barchartv2/utils.ts +2 -32
- package/src/lib/components/chartlegend/ChartLegend.test.tsx +218 -0
- package/src/lib/components/chartlegend/ChartLegend.tsx +42 -8
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +75 -29
- package/src/lib/components/constants.ts +11 -0
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +5 -2
- package/src/lib/components/date/FormattedDateTime.tsx +15 -1
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +8 -6
- package/src/lib/components/text/Text.component.tsx +1 -1
- package/src/lib/components/toast/Toast.component.tsx +27 -19
- package/src/lib/index.ts +0 -1
- package/src/lib/next.ts +2 -0
- package/stories/constrainedtext.stories.tsx +4 -1
- package/stories/linetimeseriechart.stories.tsx +30 -25
|
@@ -99,7 +99,7 @@ export const GentleEmphaseSecondaryText = styled(SecondaryText) `
|
|
|
99
99
|
: ''}
|
|
100
100
|
`;
|
|
101
101
|
export const Text = styled.span `
|
|
102
|
-
|
|
102
|
+
${(props) => props.color && `color: ${props.theme[props.color]};`}
|
|
103
103
|
${(props) => props.variant === 'Larger'
|
|
104
104
|
? `
|
|
105
105
|
font-size: 1.43rem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toast.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,aAAa,EAAkB,MAAM,wBAAwB,CAAC;AAKvE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,WAYnD,CAAC;AAsFF,iBAAS,KAAK,CAAC,EACb,IAAI,EACJ,OAAO,EACP,OAAO,EACP,QAAsB,EACtB,MAAe,EACf,WAAkB,EAClB,QAAe,EACf,IAAsC,EACtC,KAAqB,EACrB,eAAuB,EACvB,KAAK,GACN,EAAE,UAAU,kDAmDZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { motion } from 'framer-motion';
|
|
3
2
|
import { useRef } from 'react';
|
|
4
3
|
import { useTheme } from 'styled-components';
|
|
5
4
|
import { Box } from '../box/Box';
|
|
@@ -75,6 +74,29 @@ const ContentContainer = styled.div `
|
|
|
75
74
|
padding: 0px 16px;
|
|
76
75
|
position: relative;
|
|
77
76
|
`;
|
|
77
|
+
const FadingToast = styled.div `
|
|
78
|
+
align-items: flex-end;
|
|
79
|
+
background-color: ${props => props.theme.backgroundLevel1};
|
|
80
|
+
border: 1px solid ${props => props.theme.border};
|
|
81
|
+
box-shadow: 0px 4px 10px 4px #000;
|
|
82
|
+
display: flex;
|
|
83
|
+
border-radius: 4px;
|
|
84
|
+
position: relative;
|
|
85
|
+
|
|
86
|
+
@keyframes toastEnter {
|
|
87
|
+
from {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
transform: translateY(-20px);
|
|
90
|
+
}
|
|
91
|
+
to {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
transform: translateY(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
const ToastEnter = styled(FadingToast) `
|
|
98
|
+
animation: toastEnter 0.3s ease forwards;
|
|
99
|
+
`;
|
|
78
100
|
function Toast({ open, message, onClose, position = 'top-right', status = 'info', autoDismiss = true, duration = 5000, icon = _jsx(DefaultIcon, { status: status }), width = DEFAULT_WIDTH, withProgressBar = false, style, }) {
|
|
79
101
|
const ref = useRef(null);
|
|
80
102
|
const { params } = useToastParameters({
|
|
@@ -85,7 +107,6 @@ function Toast({ open, message, onClose, position = 'top-right', status = 'info'
|
|
|
85
107
|
const positionStyle = positionOutput[position];
|
|
86
108
|
const bgColor = useGetBackgroundColor(status);
|
|
87
109
|
const rgbBgColor = useGetRgbBackgroundColor(status);
|
|
88
|
-
const theme = useTheme();
|
|
89
110
|
if (!open) {
|
|
90
111
|
return null;
|
|
91
112
|
}
|
|
@@ -93,14 +114,6 @@ function Toast({ open, message, onClose, position = 'top-right', status = 'info'
|
|
|
93
114
|
position: 'fixed',
|
|
94
115
|
...(style || positionStyle),
|
|
95
116
|
width,
|
|
96
|
-
}, children: [_jsxs(
|
|
97
|
-
alignItems: 'flex-end',
|
|
98
|
-
backgroundColor: theme.backgroundLevel1,
|
|
99
|
-
border: `1px solid ${theme.border}`,
|
|
100
|
-
boxShadow: '0px 4px 10px 4px #000',
|
|
101
|
-
display: 'flex',
|
|
102
|
-
borderRadius: '4px',
|
|
103
|
-
position: 'relative',
|
|
104
|
-
}, children: [_jsx(IconContainer, { bgColor: rgbBgColor, children: icon }), _jsx(ContentContainer, { children: _jsx(BasicText, { children: message }) }), _jsx(Box, { display: "flex", alignItems: "center", alignSelf: "stretch", children: _jsx(Button, { icon: _jsx(Icon, { name: "Close", size: "lg", color: "textSecondary" }), onClick: params === null || params === void 0 ? void 0 : params.onClose, "aria-label": "Close", tooltip: { overlay: 'Close', placement: 'top' } }) })] }, "toast"), withProgressBar && (_jsx(DurationBasedProgressBar, { duration: autoDismiss ? duration : null, color: bgColor }))] }));
|
|
117
|
+
}, children: [_jsxs(ToastEnter, { children: [_jsx(IconContainer, { bgColor: rgbBgColor, children: icon }), _jsx(ContentContainer, { children: _jsx(BasicText, { children: message }) }), _jsx(Box, { display: "flex", alignItems: "center", alignSelf: "stretch", children: _jsx(Button, { icon: _jsx(Icon, { name: "Close", size: "lg", color: "textSecondary" }), onClick: params === null || params === void 0 ? void 0 : params.onClose, "aria-label": "Close", tooltip: { overlay: 'Close', placement: 'top' } }) })] }), withProgressBar && (_jsx(DurationBasedProgressBar, { duration: autoDismiss ? duration : null, color: bgColor }))] }));
|
|
105
118
|
}
|
|
106
119
|
export { Toast };
|
package/dist/index.d.ts
CHANGED
|
@@ -61,5 +61,4 @@ export { InfoMessage } from './components/infomessage/InfoMessage.component';
|
|
|
61
61
|
export { InputList } from './components/inputlist/InputList.component';
|
|
62
62
|
export { InlineInput } from './components/inlineinput/InlineInput';
|
|
63
63
|
export { UnsuccessfulResult } from './components/UnsuccessfulResult.component';
|
|
64
|
-
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
|
65
64
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,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C7E,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -61,4 +61,3 @@ export { InfoMessage } from './components/infomessage/InfoMessage.component';
|
|
|
61
61
|
export { InputList } from './components/inputlist/InputList.component';
|
|
62
62
|
export { InlineInput } from './components/inlineinput/InlineInput';
|
|
63
63
|
export { UnsuccessfulResult } from './components/UnsuccessfulResult.component';
|
|
64
|
-
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
package/dist/next.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export { Box } from './components/box/Box';
|
|
|
14
14
|
export { Input } from './components/inputv2/inputv2';
|
|
15
15
|
export { Accordion } from './components/accordion/Accordion.component';
|
|
16
16
|
export { Barchart, BarchartSortFn, BarchartTooltipFn, } from './components/barchartv2/Barchart.component';
|
|
17
|
+
export { ChartTooltip } from './components/barchartv2/ChartTooltip';
|
|
17
18
|
export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
|
|
18
19
|
export { ChartLegend } from './components/chartlegend/ChartLegend';
|
|
20
|
+
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
|
19
21
|
//# sourceMappingURL=next.d.ts.map
|
package/dist/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/lib/next.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAC;AACnD,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C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C,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC"}
|
package/dist/next.js
CHANGED
|
@@ -14,5 +14,7 @@ export { Box } from './components/box/Box';
|
|
|
14
14
|
export { Input } from './components/inputv2/inputv2';
|
|
15
15
|
export { Accordion } from './components/accordion/Accordion.component';
|
|
16
16
|
export { Barchart, } from './components/barchartv2/Barchart.component';
|
|
17
|
+
export { ChartTooltip } from './components/barchartv2/ChartTooltip';
|
|
17
18
|
export { ChartLegendWrapper } from './components/chartlegend/ChartLegendWrapper';
|
|
18
19
|
export { ChartLegend } from './components/chartlegend/ChartLegend';
|
|
20
|
+
export { LineTimeSerieChart } from './components/linetimeseriechart/linetimeseriechart.component';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/core-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.166.0",
|
|
4
4
|
"description": "Scality common React component library",
|
|
5
5
|
"author": "Scality Engineering",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -112,7 +112,6 @@
|
|
|
112
112
|
"@js-temporal/polyfill": "^0.4.4",
|
|
113
113
|
"@storybook/preview-api": "^8.3.6",
|
|
114
114
|
"downshift": "^7.0.5",
|
|
115
|
-
"framer-motion": "^4.1.17",
|
|
116
115
|
"polished": "3.4.1",
|
|
117
116
|
"pretty-bytes": "^5.6.0",
|
|
118
117
|
"react-debounce-input": "3.2.2",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import { getWrapper } from '../../testUtils';
|
|
3
|
-
import { Barchart } from './Barchart.component';
|
|
3
|
+
import { Barchart, CustomTick, formatDate } from './Barchart.component';
|
|
4
4
|
import { ChartLegendWrapper } from '../chartlegend/ChartLegendWrapper';
|
|
5
|
+
import React from 'react';
|
|
5
6
|
|
|
6
7
|
const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
7
8
|
const ONE_HOUR_IN_MILLISECONDS = 60 * 60 * 1000;
|
|
@@ -362,7 +363,7 @@ describe('Barchart', () => {
|
|
|
362
363
|
expect(categories[2]).toHaveTextContent('category1'); // 10 (lowest)
|
|
363
364
|
});
|
|
364
365
|
|
|
365
|
-
it('should render header with title, secondary title, right title and
|
|
366
|
+
it('should render header with title, secondary title, right title and helpIcon', async () => {
|
|
366
367
|
const { Wrapper } = getWrapper();
|
|
367
368
|
render(
|
|
368
369
|
<Wrapper>
|
|
@@ -382,8 +383,103 @@ describe('Barchart', () => {
|
|
|
382
383
|
expect(screen.getByText('Test Title')).toBeInTheDocument();
|
|
383
384
|
expect(screen.getByText('Test Secondary Title')).toBeInTheDocument();
|
|
384
385
|
expect(screen.getByText('Test Right Title')).toBeInTheDocument();
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
expect(screen.getByLabelText('Info')).toBeInTheDocument();
|
|
387
|
+
});
|
|
388
|
+
describe('formatDate', () => {
|
|
389
|
+
it('should render the CustomTick component with over a day interval', () => {
|
|
390
|
+
const { Wrapper } = getWrapper();
|
|
391
|
+
render(
|
|
392
|
+
<Wrapper>
|
|
393
|
+
<CustomTick
|
|
394
|
+
type={{
|
|
395
|
+
type: 'time',
|
|
396
|
+
timeRange: {
|
|
397
|
+
startDate: new Date('2024-07-05'),
|
|
398
|
+
endDate: new Date('2024-07-07'),
|
|
399
|
+
interval: 2 * ONE_DAY_IN_MILLISECONDS,
|
|
400
|
+
},
|
|
401
|
+
}}
|
|
402
|
+
x={100}
|
|
403
|
+
y={100}
|
|
404
|
+
payload={{ value: new Date('2024-07-05T10:00:00').getTime() }}
|
|
405
|
+
visibleTicksCount={10}
|
|
406
|
+
width={100}
|
|
407
|
+
/>
|
|
408
|
+
</Wrapper>,
|
|
409
|
+
);
|
|
410
|
+
expect(screen.getByText('Fri05Jul 10:00')).toBeInTheDocument();
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it('should render the CustomTick component with day format', () => {
|
|
414
|
+
const { Wrapper } = getWrapper();
|
|
415
|
+
render(
|
|
416
|
+
<Wrapper>
|
|
417
|
+
<CustomTick
|
|
418
|
+
type={{
|
|
419
|
+
type: 'time',
|
|
420
|
+
timeRange: {
|
|
421
|
+
startDate: new Date('2024-07-05'),
|
|
422
|
+
endDate: new Date('2024-07-07'),
|
|
423
|
+
interval: ONE_DAY_IN_MILLISECONDS,
|
|
424
|
+
},
|
|
425
|
+
}}
|
|
426
|
+
x={100}
|
|
427
|
+
y={100}
|
|
428
|
+
payload={{ value: new Date('2024-07-05T10:00:00').getTime() }}
|
|
429
|
+
visibleTicksCount={10}
|
|
430
|
+
width={100}
|
|
431
|
+
/>
|
|
432
|
+
</Wrapper>,
|
|
433
|
+
);
|
|
434
|
+
expect(screen.getByText('Fri05Jul')).toBeInTheDocument();
|
|
435
|
+
});
|
|
436
|
+
it('should render the CustomTick component with hour format', () => {
|
|
437
|
+
const { Wrapper } = getWrapper();
|
|
438
|
+
render(
|
|
439
|
+
<Wrapper>
|
|
440
|
+
<CustomTick
|
|
441
|
+
type={{
|
|
442
|
+
type: 'time',
|
|
443
|
+
timeRange: {
|
|
444
|
+
startDate: new Date('2024-07-05'),
|
|
445
|
+
endDate: new Date('2024-07-07'),
|
|
446
|
+
interval: ONE_HOUR_IN_MILLISECONDS,
|
|
447
|
+
},
|
|
448
|
+
}}
|
|
449
|
+
x={100}
|
|
450
|
+
y={100}
|
|
451
|
+
payload={{ value: new Date('2024-07-05T10:00:00').getTime() }}
|
|
452
|
+
visibleTicksCount={10}
|
|
453
|
+
width={100}
|
|
454
|
+
/>
|
|
455
|
+
</Wrapper>,
|
|
456
|
+
);
|
|
457
|
+
expect(screen.getByText('10:00')).toBeInTheDocument();
|
|
458
|
+
});
|
|
459
|
+
it('should render the CustomTick component with minute format', () => {
|
|
460
|
+
const { Wrapper } = getWrapper();
|
|
461
|
+
render(
|
|
462
|
+
<Wrapper>
|
|
463
|
+
<CustomTick
|
|
464
|
+
type={{
|
|
465
|
+
type: 'time',
|
|
466
|
+
timeRange: {
|
|
467
|
+
startDate: new Date('2024-07-05'),
|
|
468
|
+
endDate: new Date('2024-07-07'),
|
|
469
|
+
interval: 1000 * 30,
|
|
470
|
+
},
|
|
471
|
+
}}
|
|
472
|
+
x={100}
|
|
473
|
+
y={100}
|
|
474
|
+
payload={{ value: new Date('2024-07-05T10:00:00').getTime() }}
|
|
475
|
+
visibleTicksCount={10}
|
|
476
|
+
width={100}
|
|
477
|
+
/>
|
|
478
|
+
</Wrapper>,
|
|
479
|
+
);
|
|
480
|
+
expect(
|
|
481
|
+
screen.getByText(new Date('2024-07-05T10:00:00').getTime()),
|
|
482
|
+
).toBeInTheDocument();
|
|
387
483
|
});
|
|
388
484
|
});
|
|
389
485
|
});
|
|
@@ -20,6 +20,7 @@ import { Loader } from '../loader/Loader.component';
|
|
|
20
20
|
import { Text } from '../text/Text.component';
|
|
21
21
|
import { renderTooltipContent, UnitRange, useChartData } from './utils';
|
|
22
22
|
import { useChartLegend } from '../chartlegend/ChartLegendWrapper';
|
|
23
|
+
import { FormattedDateTime } from '../date/FormattedDateTime';
|
|
23
24
|
|
|
24
25
|
const CHART_CONSTANTS = {
|
|
25
26
|
TICK_WIDTH_OFFSET: 5,
|
|
@@ -32,7 +33,7 @@ const CHART_CONSTANTS = {
|
|
|
32
33
|
top: 0,
|
|
33
34
|
bottom: 0,
|
|
34
35
|
},
|
|
35
|
-
}
|
|
36
|
+
};
|
|
36
37
|
|
|
37
38
|
/* ---------------------------------- TYPE ---------------------------------- */
|
|
38
39
|
|
|
@@ -74,7 +75,7 @@ export type BarchartProps<T extends BarchartBars> = {
|
|
|
74
75
|
tooltip?: BarchartTooltipFn<T>;
|
|
75
76
|
defaultSort?: BarchartSortFn<T>;
|
|
76
77
|
unitRange?: UnitRange;
|
|
77
|
-
helpTooltip?:
|
|
78
|
+
helpTooltip?: React.ReactNode;
|
|
78
79
|
stacked?: boolean;
|
|
79
80
|
/**
|
|
80
81
|
* Sort the bars by default or by legend order
|
|
@@ -95,20 +96,53 @@ interface CustomTickProps {
|
|
|
95
96
|
x: number;
|
|
96
97
|
y: number;
|
|
97
98
|
payload: {
|
|
98
|
-
value:
|
|
99
|
+
value: number;
|
|
99
100
|
};
|
|
100
101
|
visibleTicksCount: number;
|
|
101
102
|
width: number;
|
|
103
|
+
type: TimeType;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/* ---------------------------------- COMPONENTS ---------------------------------- */
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Formats a date based on the interval
|
|
110
|
+
* @param timestamp - Timestamp
|
|
111
|
+
* @param interval - Interval in milliseconds
|
|
112
|
+
* @returns Formatted string
|
|
113
|
+
*/
|
|
114
|
+
export const formatDate = (
|
|
115
|
+
timestamp: number,
|
|
116
|
+
interval: number,
|
|
117
|
+
): React.ReactNode => {
|
|
118
|
+
const date = new Date(timestamp);
|
|
119
|
+
// More than 24 hours interval - use day and time format
|
|
120
|
+
if (interval > 24 * 60 * 60 * 1000) {
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<FormattedDateTime format="chart-date" value={date} />{' '}
|
|
124
|
+
<FormattedDateTime format="time" value={date} />
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
} else if (interval === 24 * 60 * 60 * 1000) {
|
|
128
|
+
// Daily interval - use day format
|
|
129
|
+
return <FormattedDateTime format="chart-date" value={date} />;
|
|
130
|
+
} else if (interval >= 60 * 1000) {
|
|
131
|
+
//Hourly and minute intervals - use minute format
|
|
132
|
+
return <FormattedDateTime format="time" value={date} />;
|
|
133
|
+
} else {
|
|
134
|
+
// minute interval or less - use full timestamp
|
|
135
|
+
return timestamp;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const CustomTick = ({
|
|
107
140
|
x,
|
|
108
141
|
y,
|
|
109
142
|
payload,
|
|
110
143
|
visibleTicksCount,
|
|
111
144
|
width,
|
|
145
|
+
type,
|
|
112
146
|
}: CustomTickProps) => {
|
|
113
147
|
const theme = useTheme();
|
|
114
148
|
const tickWidth =
|
|
@@ -124,9 +158,12 @@ const CustomTick = ({
|
|
|
124
158
|
overflow="visible"
|
|
125
159
|
>
|
|
126
160
|
<ConstrainedText
|
|
161
|
+
color="textSecondary"
|
|
127
162
|
text={
|
|
128
|
-
<Text variant="Smaller"
|
|
129
|
-
{
|
|
163
|
+
<Text variant="Smaller">
|
|
164
|
+
{type.type === 'time'
|
|
165
|
+
? formatDate(payload.value, type.timeRange.interval)
|
|
166
|
+
: String(payload.value)}
|
|
130
167
|
</Text>
|
|
131
168
|
}
|
|
132
169
|
centered
|
|
@@ -157,16 +194,14 @@ const ChartHeader = ({
|
|
|
157
194
|
}: {
|
|
158
195
|
title?: string;
|
|
159
196
|
secondaryTitle?: string;
|
|
160
|
-
helpTooltip?:
|
|
197
|
+
helpTooltip?: React.ReactNode;
|
|
161
198
|
rightTitle?: React.ReactNode;
|
|
162
199
|
}) => {
|
|
163
200
|
return (
|
|
164
201
|
<Wrap>
|
|
165
202
|
<Stack gap="r4">
|
|
166
203
|
<Text variant="ChartTitle">{title}</Text>
|
|
167
|
-
{helpTooltip &&
|
|
168
|
-
<IconHelp tooltipMessage={helpTooltip} title={helpTooltip} />
|
|
169
|
-
)}
|
|
204
|
+
{helpTooltip && <IconHelp tooltipMessage={helpTooltip} />}
|
|
170
205
|
|
|
171
206
|
{secondaryTitle && (
|
|
172
207
|
<Text
|
|
@@ -330,7 +365,7 @@ export const Barchart = <T extends BarchartBars>(props: BarchartProps<T>) => {
|
|
|
330
365
|
/>
|
|
331
366
|
<XAxis
|
|
332
367
|
dataKey="category"
|
|
333
|
-
tick={(props) => <CustomTick {...props} />}
|
|
368
|
+
tick={(props) => <CustomTick {...props} type={type} />}
|
|
334
369
|
type="category"
|
|
335
370
|
interval={0}
|
|
336
371
|
allowDataOverflow={true}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { spacing, Stack, Wrap } from '../../spacing';
|
|
3
|
+
import { Text } from '../text/Text.component';
|
|
4
|
+
import { BarchartBars } from './Barchart.component';
|
|
5
|
+
import { fontSize, fontWeight } from '../../style/theme';
|
|
6
|
+
import { LegendShape } from '../chartlegend/ChartLegend';
|
|
7
|
+
import { FormattedDateTime } from '../date/FormattedDateTime';
|
|
8
|
+
|
|
9
|
+
export const ChartTooltipContainer = styled.div`
|
|
10
|
+
background-color: ${({ theme }) => theme.backgroundLevel1};
|
|
11
|
+
padding: ${spacing.r4} ${spacing.r8};
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
width: max-content;
|
|
14
|
+
max-width: 40rem;
|
|
15
|
+
border: 1px solid ${({ theme }) => theme.border};
|
|
16
|
+
display: flex;
|
|
17
|
+
font-size: ${fontSize.small};
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 16px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const ChartTooltipItem = styled.div<{ isHovered: boolean }>`
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 8px;
|
|
27
|
+
font-weight: ${({ isHovered }) =>
|
|
28
|
+
isHovered ? fontWeight.bold : fontWeight.base};
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const ChartTooltip = <T extends BarchartBars>({
|
|
32
|
+
type,
|
|
33
|
+
currentPoint,
|
|
34
|
+
colorSet,
|
|
35
|
+
}: {
|
|
36
|
+
type: 'time' | 'category';
|
|
37
|
+
currentPoint: {
|
|
38
|
+
category: string | number;
|
|
39
|
+
values: { label: T[number]['label']; value: number; isHovered: boolean }[];
|
|
40
|
+
};
|
|
41
|
+
colorSet: Record<string, string>;
|
|
42
|
+
}) => {
|
|
43
|
+
return (
|
|
44
|
+
<ChartTooltipContainer>
|
|
45
|
+
<Text isEmphazed>
|
|
46
|
+
{type === 'time' ? (
|
|
47
|
+
<FormattedDateTime
|
|
48
|
+
format="long-date"
|
|
49
|
+
value={new Date(currentPoint.category)}
|
|
50
|
+
/>
|
|
51
|
+
) : (
|
|
52
|
+
currentPoint.category
|
|
53
|
+
)}
|
|
54
|
+
</Text>
|
|
55
|
+
<Stack direction="vertical" gap="r8" style={{ width: '100%' }}>
|
|
56
|
+
{currentPoint.values.map((value) => {
|
|
57
|
+
return (
|
|
58
|
+
<Wrap key={value.label}>
|
|
59
|
+
<ChartTooltipItem isHovered={value.isHovered}>
|
|
60
|
+
<LegendShape
|
|
61
|
+
color={colorSet[value.label as keyof typeof colorSet]}
|
|
62
|
+
shape="rectangle"
|
|
63
|
+
chartColors={colorSet}
|
|
64
|
+
/>
|
|
65
|
+
{value.label}
|
|
66
|
+
</ChartTooltipItem>
|
|
67
|
+
<ChartTooltipItem isHovered={value.isHovered}>
|
|
68
|
+
{value.value}
|
|
69
|
+
</ChartTooltipItem>
|
|
70
|
+
</Wrap>
|
|
71
|
+
);
|
|
72
|
+
})}
|
|
73
|
+
</Stack>
|
|
74
|
+
</ChartTooltipContainer>
|
|
75
|
+
);
|
|
76
|
+
};
|