@scality/core-ui 0.169.0 → 0.171.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/__mocks__/uuid.js +11 -0
- package/dist/components/barchartv2/Barchart.component.js +2 -2
- package/dist/components/buttonv2/Buttonv2.component.js +1 -1
- package/dist/components/chartlegend/ChartLegend.d.ts +3 -1
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +2 -2
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +3 -1
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +43 -9
- package/dist/components/date/FormattedDateTime.d.ts +41 -2
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +55 -8
- package/dist/components/date/FormattedDateTime.spec.js +12 -3
- package/dist/components/icon/Icon.component.d.ts +2 -0
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +2 -0
- package/dist/components/layout/v2/index.d.ts +2 -1
- package/dist/components/layout/v2/index.d.ts.map +1 -1
- package/dist/components/layout/v2/index.js +3 -3
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
- package/dist/components/linetemporalchart/ChartUtil.js +12 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +10 -5
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +84 -49
- package/dist/components/text/Text.component.d.ts +2 -1
- package/dist/components/text/Text.component.d.ts.map +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +1 -1
- package/dist/style/theme.js +1 -1
- package/package.json +3 -1
- package/src/lib/components/barchartv2/Barchart.component.tsx +2 -2
- package/src/lib/components/barchartv2/ChartTooltip.test.tsx +1 -1
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +1 -1
- package/src/lib/components/chartlegend/ChartLegend.tsx +4 -2
- package/src/lib/components/chartlegend/ChartLegendWrapper.test.tsx +197 -0
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +65 -9
- package/src/lib/components/date/FormattedDateTime.spec.tsx +27 -2
- package/src/lib/components/date/FormattedDateTime.tsx +61 -11
- package/src/lib/components/icon/Icon.component.tsx +2 -0
- package/src/lib/components/layout/v2/index.tsx +5 -3
- package/src/lib/components/linetemporalchart/ChartUtil.ts +26 -0
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +227 -157
- package/src/lib/components/text/Text.component.tsx +8 -1
- package/src/lib/next.ts +4 -1
- package/src/lib/style/theme.ts +1 -1
- package/stories/BarChart/barchart.stories.tsx +7 -1
- package/stories/formattedate.stories.tsx +7 -0
- package/stories/layout.stories.tsx +19 -0
- package/stories/linetimeseriechart.stories.tsx +217 -1
|
@@ -14,13 +14,13 @@ import { Text } from '../text/Text.component';
|
|
|
14
14
|
import { ChartTooltip } from './ChartTooltip';
|
|
15
15
|
import { useChartData } from './utils';
|
|
16
16
|
const CHART_CONSTANTS = {
|
|
17
|
-
TICK_WIDTH_OFFSET:
|
|
17
|
+
TICK_WIDTH_OFFSET: 4,
|
|
18
18
|
BAR_SIZE: 12,
|
|
19
19
|
MIN_POINT_SIZE: 3,
|
|
20
20
|
DEFAULT_HEIGHT: 200,
|
|
21
21
|
CHART_MARGIN: {
|
|
22
22
|
left: 0,
|
|
23
|
-
right:
|
|
23
|
+
right: -10,
|
|
24
24
|
top: 0,
|
|
25
25
|
bottom: 0,
|
|
26
26
|
},
|
|
@@ -99,6 +99,7 @@ export const ButtonStyled = styled.button `
|
|
|
99
99
|
case 'outline':
|
|
100
100
|
return css `
|
|
101
101
|
border: ${spacing.r1} solid transparent;
|
|
102
|
+
border-color: ${brand.border}; // fallback for linear-gradient button themes
|
|
102
103
|
border-color: ${brand.buttonSecondary};
|
|
103
104
|
background-color: transparent;
|
|
104
105
|
color: ${brand.textPrimary};
|
|
@@ -125,7 +126,6 @@ export const ButtonStyled = styled.button `
|
|
|
125
126
|
position: absolute;
|
|
126
127
|
inset: 0;
|
|
127
128
|
padding: ${spacing.r1};
|
|
128
|
-
background-image: ${brand.buttonSecondary};
|
|
129
129
|
border-radius: inherit;
|
|
130
130
|
mask: linear-gradient(white, white) content-box, linear-gradient(white, white);
|
|
131
131
|
mask-composite: exclude;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { TextVariant } from '../text/Text.component';
|
|
1
2
|
type ChartLegendProps = {
|
|
2
3
|
shape: 'line' | 'rectangle';
|
|
3
4
|
disabled?: boolean;
|
|
4
5
|
direction?: 'horizontal' | 'vertical';
|
|
6
|
+
legendSize?: TextVariant;
|
|
5
7
|
};
|
|
6
8
|
export declare const LegendItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
7
9
|
disabled?: boolean;
|
|
@@ -12,6 +14,6 @@ export declare const LegendShape: import("styled-components").StyledComponent<"d
|
|
|
12
14
|
shape: "line" | "rectangle";
|
|
13
15
|
chartColors: Record<string, string>;
|
|
14
16
|
}, never>;
|
|
15
|
-
export declare const ChartLegend: ({ shape, disabled, direction, }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const ChartLegend: ({ shape, disabled, direction, legendSize, }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export {};
|
|
17
19
|
//# sourceMappingURL=ChartLegend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/lib/components/chartlegend/ChartLegend.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/lib/components/chartlegend/ChartLegend.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI3D,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAUF,eAAO,MAAM,UAAU;eACV,OAAO;eACP,OAAO;SAYnB,CAAC;AAEF,eAAO,MAAM,WAAW;YACd,MAAM;WACP,MAAM,GAAG,WAAW;iBACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;SAsBpC,CAAC;AAEF,eAAO,MAAM,WAAW,gDAKrB,gBAAgB,4CAyElB,CAAC"}
|
|
@@ -44,7 +44,7 @@ export const LegendShape = styled.div `
|
|
|
44
44
|
}
|
|
45
45
|
}}
|
|
46
46
|
`;
|
|
47
|
-
export const ChartLegend = ({ shape, disabled = false, direction = 'horizontal', }) => {
|
|
47
|
+
export const ChartLegend = ({ shape, disabled = false, direction = 'horizontal', legendSize = 'Basic', }) => {
|
|
48
48
|
const { listResources, getColor, isSelected, addSelectedResource, removeSelectedResource, selectAllResources, selectOnlyResource, isOnlyOneSelected, } = useChartLegend();
|
|
49
49
|
const resources = listResources();
|
|
50
50
|
const handleLegendClick = useCallback((resource, event) => {
|
|
@@ -83,6 +83,6 @@ export const ChartLegend = ({ shape, disabled = false, direction = 'horizontal',
|
|
|
83
83
|
return (_jsx(Legend, { direction: direction, children: resources.map((resource) => {
|
|
84
84
|
const color = getColor(resource);
|
|
85
85
|
const selected = isSelected(resource);
|
|
86
|
-
return (_jsxs(LegendItem, { disabled: disabled, selected: selected, "aria-label": `${resource} ${selected ? 'selected' : 'not selected'}`, onClick: (event) => handleLegendClick(resource, event), children: [_jsx(LegendShape, { color: color, shape: shape, chartColors: chartColors }), _jsx(Text, { variant:
|
|
86
|
+
return (_jsxs(LegendItem, { disabled: disabled, selected: selected, "aria-label": `${resource} ${selected ? 'selected' : 'not selected'}`, onClick: (event) => handleLegendClick(resource, event), children: [_jsx(LegendShape, { color: color, shape: shape, chartColors: chartColors }), _jsx(Text, { variant: legendSize, children: resource })] }, resource));
|
|
87
87
|
}) }));
|
|
88
88
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ChartColors } from '../../style/theme';
|
|
3
|
+
export declare const useChartId: () => string;
|
|
3
4
|
export type ChartLegendState = {
|
|
4
5
|
selectedResources: string[];
|
|
5
6
|
addSelectedResource: (resource: string) => void;
|
|
@@ -10,10 +11,11 @@ export type ChartLegendState = {
|
|
|
10
11
|
getColor: (resource: string) => string | undefined;
|
|
11
12
|
listResources: () => string[];
|
|
12
13
|
isOnlyOneSelected: () => boolean;
|
|
14
|
+
register: (chartId: string, seriesNames: string[]) => void;
|
|
13
15
|
};
|
|
14
16
|
export type ChartLegendWrapperProps = {
|
|
15
17
|
children: ReactNode;
|
|
16
|
-
colorSet: Record<string, ChartColors | string
|
|
18
|
+
colorSet: Record<string, ChartColors | string> | ((seriesNames: string[]) => Record<string, ChartColors | string>);
|
|
17
19
|
};
|
|
18
20
|
export declare const ChartLegendWrapper: ({ children, colorSet, }: ChartLegendWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export declare const useChartLegend: () => ChartLegendState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegendWrapper.d.ts","sourceRoot":"","sources":["../../../src/lib/components/chartlegend/ChartLegendWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,
|
|
1
|
+
{"version":3,"file":"ChartLegendWrapper.d.ts","sourceRoot":"","sources":["../../../src/lib/components/chartlegend/ChartLegendWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,eAAO,MAAM,UAAU,QAAO,MAQ7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,sBAAsB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACnD,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC5D,CAAC;AAIF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EACJ,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,GACpC,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC;CACvE,CAAC;AAEF,eAAO,MAAM,kBAAkB,4BAG5B,uBAAuB,4CA0HzB,CAAC;AAEF,eAAO,MAAM,cAAc,wBAM1B,CAAC"}
|
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useState, useMemo, useCallback, } from 'react';
|
|
2
|
+
import { createContext, useContext, useState, useMemo, useCallback, useEffect, useRef, } from 'react';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
export const useChartId = () => {
|
|
5
|
+
const idRef = useRef(null);
|
|
6
|
+
if (idRef.current === null) {
|
|
7
|
+
idRef.current = uuidv4();
|
|
8
|
+
}
|
|
9
|
+
return idRef.current;
|
|
10
|
+
};
|
|
3
11
|
const ChartLegendContext = createContext(null);
|
|
4
12
|
export const ChartLegendWrapper = ({ children, colorSet, }) => {
|
|
5
|
-
const
|
|
13
|
+
const [registeredColorSets, setRegisteredColorSets] = useState({});
|
|
14
|
+
const [internalColorSet, setInternalColorSet] = useState(() => {
|
|
15
|
+
return typeof colorSet === 'function' ? {} : colorSet;
|
|
16
|
+
});
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (typeof colorSet === 'function') {
|
|
19
|
+
const allUniqueSeriesNames = Array.from(new Set(Object.values(registeredColorSets).flat()));
|
|
20
|
+
if (allUniqueSeriesNames.length > 0) {
|
|
21
|
+
const newColorSet = colorSet(allUniqueSeriesNames);
|
|
22
|
+
setInternalColorSet(newColorSet);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setInternalColorSet(colorSet);
|
|
27
|
+
}
|
|
28
|
+
}, [registeredColorSets, colorSet]);
|
|
29
|
+
const allResources = useMemo(() => Object.keys(internalColorSet), [internalColorSet]);
|
|
6
30
|
const [selectedResources, setSelectedResources] = useState(allResources);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setSelectedResources(allResources);
|
|
33
|
+
}, [allResources]);
|
|
34
|
+
const register = useCallback((chartId, seriesNames) => {
|
|
35
|
+
setRegisteredColorSets((prev) => ({
|
|
36
|
+
...prev,
|
|
37
|
+
[chartId]: seriesNames,
|
|
38
|
+
}));
|
|
39
|
+
}, []);
|
|
7
40
|
const addSelectedResource = useCallback((resource) => {
|
|
8
41
|
setSelectedResources((prev) => prev.includes(resource) ? prev : [...prev, resource]);
|
|
9
42
|
}, []);
|
|
@@ -11,8 +44,8 @@ export const ChartLegendWrapper = ({ children, colorSet, }) => {
|
|
|
11
44
|
setSelectedResources((prev) => prev.filter((r) => r !== resource));
|
|
12
45
|
}, []);
|
|
13
46
|
const selectAllResources = useCallback(() => {
|
|
14
|
-
setSelectedResources(
|
|
15
|
-
}, [
|
|
47
|
+
setSelectedResources(Object.keys(internalColorSet));
|
|
48
|
+
}, [internalColorSet]);
|
|
16
49
|
const selectOnlyResource = useCallback((resource) => {
|
|
17
50
|
setSelectedResources([resource]);
|
|
18
51
|
}, []);
|
|
@@ -23,16 +56,16 @@ export const ChartLegendWrapper = ({ children, colorSet, }) => {
|
|
|
23
56
|
return selectedResources.includes(resource);
|
|
24
57
|
}, [selectedResources]);
|
|
25
58
|
const getColor = useCallback((resource) => {
|
|
26
|
-
const color =
|
|
59
|
+
const color = internalColorSet[resource];
|
|
27
60
|
if (!color) {
|
|
28
61
|
console.warn(`ChartLegendWrapper: No color defined for resource "${resource}"`);
|
|
29
62
|
return undefined;
|
|
30
63
|
}
|
|
31
64
|
return color;
|
|
32
|
-
}, [
|
|
65
|
+
}, [internalColorSet]);
|
|
33
66
|
const listResources = useCallback(() => {
|
|
34
|
-
return Object.keys(
|
|
35
|
-
}, [
|
|
67
|
+
return Object.keys(internalColorSet);
|
|
68
|
+
}, [internalColorSet]);
|
|
36
69
|
const chartLegendState = useMemo(() => ({
|
|
37
70
|
selectedResources,
|
|
38
71
|
addSelectedResource,
|
|
@@ -43,6 +76,7 @@ export const ChartLegendWrapper = ({ children, colorSet, }) => {
|
|
|
43
76
|
getColor,
|
|
44
77
|
listResources,
|
|
45
78
|
isOnlyOneSelected,
|
|
79
|
+
register,
|
|
46
80
|
}), [
|
|
47
81
|
selectedResources,
|
|
48
82
|
addSelectedResource,
|
|
@@ -53,10 +87,10 @@ export const ChartLegendWrapper = ({ children, colorSet, }) => {
|
|
|
53
87
|
getColor,
|
|
54
88
|
listResources,
|
|
55
89
|
isOnlyOneSelected,
|
|
90
|
+
register,
|
|
56
91
|
]);
|
|
57
92
|
return (_jsx(ChartLegendContext.Provider, { value: chartLegendState, children: children }));
|
|
58
93
|
};
|
|
59
|
-
// Hook for accessing legend state in custom components
|
|
60
94
|
export const useChartLegend = () => {
|
|
61
95
|
const context = useContext(ChartLegendContext);
|
|
62
96
|
if (!context) {
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Long date formatter, with weekday, year, month and day. Used for describing long term date.
|
|
3
|
+
* @example Wednesday 6 October 2025
|
|
4
|
+
*/
|
|
1
5
|
export declare const LONG_DATE_FORMATER: Intl.DateTimeFormat;
|
|
2
6
|
/**
|
|
3
7
|
* @description Long date formatter, without weekday.
|
|
4
8
|
* @example 01 September 2025
|
|
5
9
|
*/
|
|
6
10
|
export declare const LONG_DATE_FORMATER_WITHOUT_WEEKDAY: Intl.DateTimeFormat;
|
|
11
|
+
/**
|
|
12
|
+
* @description Date formatter, with year, month and day. Used for describing long term date.
|
|
13
|
+
* @example 2025-01-01
|
|
14
|
+
*/
|
|
7
15
|
export declare const DATE_FORMATER: Intl.DateTimeFormat;
|
|
16
|
+
/**
|
|
17
|
+
* @description Day month formatter, with weekday, day and month. Used for describing long term date.
|
|
18
|
+
* @example Wed 6 Oct
|
|
19
|
+
*/
|
|
8
20
|
export declare const DAY_MONTH_FORMATER: Intl.DateTimeFormat;
|
|
21
|
+
/**
|
|
22
|
+
* @description Time formatter, with hour, minute and second. Used for describing long term date.
|
|
23
|
+
* @example 18:33:00
|
|
24
|
+
*/
|
|
9
25
|
export declare const TIME_SECOND_FORMATER: Intl.DateTimeFormat;
|
|
26
|
+
/**
|
|
27
|
+
* @description Time formatter, with hour and minute. Used for describing long term date.
|
|
28
|
+
* @example 18:33
|
|
29
|
+
*/
|
|
10
30
|
export declare const TIME_FORMATER: Intl.DateTimeFormat;
|
|
31
|
+
/**
|
|
32
|
+
* @description Day month abbreviated hour minute second formatter. Used for describing long term date.
|
|
33
|
+
* @example 6 Oct 18:33:00
|
|
34
|
+
*/
|
|
11
35
|
export declare const DAY_MONTH_ABBREVIATED_HOUR_MINUTE_SECOND: Intl.DateTimeFormat;
|
|
12
36
|
/**
|
|
13
|
-
* @description Day month abbreviated hour minute formatter
|
|
14
|
-
* @example
|
|
37
|
+
* @description Day month abbreviated hour minute formatter. Used for describing long term date.
|
|
38
|
+
* @example 6 Oct 18:33
|
|
15
39
|
*/
|
|
16
40
|
export declare const DAY_MONTH_ABBREVIATED_HOUR_MINUTE: Intl.DateTimeFormat;
|
|
17
41
|
/**
|
|
@@ -28,6 +52,21 @@ type FormattedDateTimeProps = {
|
|
|
28
52
|
format: 'date' | 'date-time' | 'date-time-second' | 'time' | 'time-second' | 'relative' | 'day-month-abbreviated-hour-minute' | 'day-month-abbreviated-hour-minute-second' | 'long-date' | 'long-date-without-weekday' | 'chart-date' | 'year-month-day' | 'month-day';
|
|
29
53
|
value: Date;
|
|
30
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* @description Formats the date and time according to the format specified.
|
|
57
|
+
* @example
|
|
58
|
+
* date: '2025-01-01'
|
|
59
|
+
* 'date-time': '2025-01-01 00:00'
|
|
60
|
+
* 'date-time-second': '2025-01-01 00:00:00'
|
|
61
|
+
* time: '00:00'
|
|
62
|
+
* 'time-second': '00:00:00'
|
|
63
|
+
* relative: '1 month ago'
|
|
64
|
+
* 'day-month-abbreviated-hour-minute': '6 Oct 18:33'
|
|
65
|
+
* 'day-month-abbreviated-hour-minute-second': '6 Oct 18:33:00'
|
|
66
|
+
* 'long-date': 'Wednesday 6 October 2025'
|
|
67
|
+
* 'chart-date': '6 Oct'
|
|
68
|
+
* 'year-month-day': '2025-10-06'
|
|
69
|
+
*/
|
|
31
70
|
export declare const FormattedDateTime: ({ format, value, }: FormattedDateTimeProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
71
|
export {};
|
|
33
72
|
//# sourceMappingURL=FormattedDateTime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormattedDateTime.d.ts","sourceRoot":"","sources":["../../../src/lib/components/date/FormattedDateTime.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,qBAK7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kCAAkC,qBAI7C,CAAC;AAEH,eAAO,MAAM,aAAa,qBAKxB,CAAC;AAEH,eAAO,MAAM,kBAAkB,qBAI7B,CAAC;AAEH,eAAO,MAAM,oBAAoB,qBAK/B,CAAC;AAEH,eAAO,MAAM,aAAa,qBAIxB,CAAC;AAEH,eAAO,MAAM,wCAAwC,qBAUpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,qBAM5C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,qBAInC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qBAG9B,CAAC;AAEH,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EACF,MAAM,GACN,WAAW,GACX,kBAAkB,GAClB,MAAM,GACN,aAAa,GACb,UAAU,GACV,mCAAmC,GACnC,0CAA0C,GAC1C,WAAW,GACX,2BAA2B,GAC3B,YAAY,GACZ,gBAAgB,GAChB,WAAW,CAAC;IAEhB,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAaF,eAAO,MAAM,iBAAiB,uBAG3B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"FormattedDateTime.d.ts","sourceRoot":"","sources":["../../../src/lib/components/date/FormattedDateTime.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAK7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kCAAkC,qBAI7C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAKxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAI7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qBAK/B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAIxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wCAAwC,qBAUpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,qBAM5C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,qBAInC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qBAG9B,CAAC;AAEH,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EACF,MAAM,GACN,WAAW,GACX,kBAAkB,GAClB,MAAM,GACN,aAAa,GACb,UAAU,GACV,mCAAmC,GACnC,0CAA0C,GAC1C,WAAW,GACX,2BAA2B,GAC3B,YAAY,GACZ,gBAAgB,GAChB,WAAW,CAAC;IAEhB,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAaF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,uBAG3B,sBAAsB,4CAsIxB,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getDateDaysDiff } from './dateDiffer';
|
|
3
3
|
import { Tooltip } from '../tooltip/Tooltip.component';
|
|
4
|
+
/**
|
|
5
|
+
* @description Long date formatter, with weekday, year, month and day. Used for describing long term date.
|
|
6
|
+
* @example Wednesday 6 October 2025
|
|
7
|
+
*/
|
|
4
8
|
export const LONG_DATE_FORMATER = Intl.DateTimeFormat('en-GB', {
|
|
5
9
|
weekday: 'long',
|
|
6
10
|
year: 'numeric',
|
|
7
11
|
month: 'long',
|
|
8
|
-
day: '
|
|
12
|
+
day: '2-digit',
|
|
9
13
|
});
|
|
10
14
|
/**
|
|
11
15
|
* @description Long date formatter, without weekday.
|
|
@@ -16,30 +20,50 @@ export const LONG_DATE_FORMATER_WITHOUT_WEEKDAY = Intl.DateTimeFormat('en-GB', {
|
|
|
16
20
|
month: 'long',
|
|
17
21
|
day: '2-digit',
|
|
18
22
|
});
|
|
23
|
+
/**
|
|
24
|
+
* @description Date formatter, with year, month and day. Used for describing long term date.
|
|
25
|
+
* @example 2025-01-01
|
|
26
|
+
*/
|
|
19
27
|
export const DATE_FORMATER = Intl.DateTimeFormat('fr-CA', {
|
|
20
28
|
year: 'numeric',
|
|
21
29
|
month: '2-digit',
|
|
22
30
|
day: '2-digit',
|
|
23
31
|
hour12: false,
|
|
24
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* @description Day month formatter, with weekday, day and month. Used for describing long term date.
|
|
35
|
+
* @example Wed 6 Oct
|
|
36
|
+
*/
|
|
25
37
|
export const DAY_MONTH_FORMATER = Intl.DateTimeFormat('en-GB', {
|
|
26
38
|
weekday: 'short',
|
|
27
39
|
day: '2-digit',
|
|
28
40
|
month: 'short',
|
|
29
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* @description Time formatter, with hour, minute and second. Used for describing long term date.
|
|
44
|
+
* @example 18:33:00
|
|
45
|
+
*/
|
|
30
46
|
export const TIME_SECOND_FORMATER = Intl.DateTimeFormat('en-GB', {
|
|
31
47
|
hour12: false,
|
|
32
48
|
hour: '2-digit',
|
|
33
49
|
minute: '2-digit',
|
|
34
50
|
second: '2-digit',
|
|
35
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* @description Time formatter, with hour and minute. Used for describing long term date.
|
|
54
|
+
* @example 18:33
|
|
55
|
+
*/
|
|
36
56
|
export const TIME_FORMATER = Intl.DateTimeFormat('en-GB', {
|
|
37
57
|
hour12: false,
|
|
38
58
|
hour: '2-digit',
|
|
39
59
|
minute: '2-digit',
|
|
40
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* @description Day month abbreviated hour minute second formatter. Used for describing long term date.
|
|
63
|
+
* @example 6 Oct 18:33:00
|
|
64
|
+
*/
|
|
41
65
|
export const DAY_MONTH_ABBREVIATED_HOUR_MINUTE_SECOND = Intl.DateTimeFormat('en-GB', {
|
|
42
|
-
day: '
|
|
66
|
+
day: '2-digit',
|
|
43
67
|
month: 'short',
|
|
44
68
|
hour: '2-digit',
|
|
45
69
|
minute: '2-digit',
|
|
@@ -47,11 +71,11 @@ export const DAY_MONTH_ABBREVIATED_HOUR_MINUTE_SECOND = Intl.DateTimeFormat('en-
|
|
|
47
71
|
hour12: false,
|
|
48
72
|
});
|
|
49
73
|
/**
|
|
50
|
-
* @description Day month abbreviated hour minute formatter
|
|
51
|
-
* @example
|
|
74
|
+
* @description Day month abbreviated hour minute formatter. Used for describing long term date.
|
|
75
|
+
* @example 6 Oct 18:33
|
|
52
76
|
*/
|
|
53
77
|
export const DAY_MONTH_ABBREVIATED_HOUR_MINUTE = Intl.DateTimeFormat('en-GB', {
|
|
54
|
-
day: '
|
|
78
|
+
day: '2-digit',
|
|
55
79
|
month: 'short',
|
|
56
80
|
hour: '2-digit',
|
|
57
81
|
minute: '2-digit',
|
|
@@ -82,6 +106,21 @@ const isItFutureOrIsItPast = (timeDiff, stringToBeFormatted) => {
|
|
|
82
106
|
return `in ${stringToBeFormatted}`;
|
|
83
107
|
}
|
|
84
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* @description Formats the date and time according to the format specified.
|
|
111
|
+
* @example
|
|
112
|
+
* date: '2025-01-01'
|
|
113
|
+
* 'date-time': '2025-01-01 00:00'
|
|
114
|
+
* 'date-time-second': '2025-01-01 00:00:00'
|
|
115
|
+
* time: '00:00'
|
|
116
|
+
* 'time-second': '00:00:00'
|
|
117
|
+
* relative: '1 month ago'
|
|
118
|
+
* 'day-month-abbreviated-hour-minute': '6 Oct 18:33'
|
|
119
|
+
* 'day-month-abbreviated-hour-minute-second': '6 Oct 18:33:00'
|
|
120
|
+
* 'long-date': 'Wednesday 6 October 2025'
|
|
121
|
+
* 'chart-date': '6 Oct'
|
|
122
|
+
* 'year-month-day': '2025-10-06'
|
|
123
|
+
*/
|
|
85
124
|
export const FormattedDateTime = ({ format, value, }) => {
|
|
86
125
|
switch (format) {
|
|
87
126
|
case 'date':
|
|
@@ -116,15 +155,23 @@ export const FormattedDateTime = ({ format, value, }) => {
|
|
|
116
155
|
}
|
|
117
156
|
return (_jsx(Tooltip, { overlay: _jsx(FormattedDateTime, { format: "date-time-second", value: value }), children: "few seconds ago" }));
|
|
118
157
|
case 'day-month-abbreviated-hour-minute':
|
|
119
|
-
return (_jsx(_Fragment, { children: DAY_MONTH_ABBREVIATED_HOUR_MINUTE.format(value)
|
|
158
|
+
return (_jsx(_Fragment, { children: DAY_MONTH_ABBREVIATED_HOUR_MINUTE.format(value)
|
|
159
|
+
.replace(',', '')
|
|
160
|
+
.replace(/Sept/g, 'Sep') }));
|
|
120
161
|
case 'day-month-abbreviated-hour-minute-second':
|
|
121
|
-
return (_jsx(_Fragment, { children: DAY_MONTH_ABBREVIATED_HOUR_MINUTE_SECOND.format(value)
|
|
162
|
+
return (_jsx(_Fragment, { children: DAY_MONTH_ABBREVIATED_HOUR_MINUTE_SECOND.format(value)
|
|
163
|
+
.replace(',', '')
|
|
164
|
+
// replace Sept with Sep to keep 3 letter month
|
|
165
|
+
.replace(/Sept/g, 'Sep') }));
|
|
122
166
|
case 'long-date':
|
|
123
167
|
return _jsx(_Fragment, { children: LONG_DATE_FORMATER.format(value) });
|
|
124
168
|
case 'long-date-without-weekday':
|
|
125
169
|
return _jsx(_Fragment, { children: LONG_DATE_FORMATER_WITHOUT_WEEKDAY.format(value) });
|
|
126
170
|
case 'chart-date':
|
|
127
|
-
return _jsx(_Fragment, { children: DAY_MONTH_FORMATER.format(value)
|
|
171
|
+
return (_jsx(_Fragment, { children: DAY_MONTH_FORMATER.format(value)
|
|
172
|
+
.replace(/[ ,]/g, '')
|
|
173
|
+
// replace Sept with Sep to keep 3 letter month
|
|
174
|
+
.replace(/Sept/g, 'Sep') }));
|
|
128
175
|
case 'year-month-day':
|
|
129
176
|
return _jsx(_Fragment, { children: YEAR_MONTH_DAY_FORMATTER.format(value) });
|
|
130
177
|
case 'month-day':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { FormattedDateTime } from './FormattedDateTime';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
@@ -141,12 +141,21 @@ describe('FormatttedDateTime', () => {
|
|
|
141
141
|
//S
|
|
142
142
|
render(_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute", value: new Date('2022-10-06T18:33:00Z') }));
|
|
143
143
|
//V
|
|
144
|
-
expect(screen.getByText('
|
|
144
|
+
expect(screen.getByText('06 Oct 18:33')).toBeInTheDocument();
|
|
145
145
|
});
|
|
146
146
|
it('should display the date in the expected format of date in the chart', () => {
|
|
147
147
|
//S
|
|
148
148
|
render(_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute-second", value: new Date('2022-10-06T18:33:00Z') }));
|
|
149
149
|
//V
|
|
150
|
-
expect(screen.getByText('
|
|
150
|
+
expect(screen.getByText('06 Oct 18:33:00')).toBeInTheDocument();
|
|
151
|
+
});
|
|
152
|
+
it('should display 3 letter month for September date', () => {
|
|
153
|
+
//S
|
|
154
|
+
render(_jsxs(_Fragment, { children: [_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute", value: new Date('2022-09-06T18:33:00Z') }), _jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute-second", value: new Date('2022-09-06T18:33:00Z') }), _jsx(FormattedDateTime, { format: "chart-date", value: new Date('2022-09-06T18:33:00Z') })] }));
|
|
155
|
+
//V
|
|
156
|
+
expect(screen.getByText(/06 Sep 18:33/)).toBeInTheDocument();
|
|
157
|
+
expect(screen.getByText(/06 Sep 18:33:00/)).toBeInTheDocument();
|
|
158
|
+
expect(screen.getByText(/Tue06Sep/)).toBeInTheDocument();
|
|
159
|
+
expect(screen.queryByText(/Sept/)).not.toBeInTheDocument();
|
|
151
160
|
});
|
|
152
161
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAO,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SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAiBF,eAAO,MAAM,WAAW;UAAsB,QAAQ;SAiCrD,CAAC;AA2DF,iBAAS,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAU7C;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -131,6 +131,8 @@ export const iconTable = {
|
|
|
131
131
|
Stop: 'fas faStop',
|
|
132
132
|
Play: 'fas faPlay',
|
|
133
133
|
Mail: 'fas faEnvelope',
|
|
134
|
+
ThumbsUp: 'fas faThumbsUp',
|
|
135
|
+
ThumbsDown: 'fas faThumbsDown',
|
|
134
136
|
};
|
|
135
137
|
export const customIcons = {
|
|
136
138
|
'Remote-user': ({ 'aria-label': ariaLabel, color, size }) => (_jsx(RemoteUser, { ariaLabel: ariaLabel, color: color, size: size })),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
export declare function Layout({ children: app, headerNavigation, }: {
|
|
2
|
+
export declare function Layout({ children: app, headerNavigation, variant, }: {
|
|
3
3
|
children: ReactElement | ReactElement[];
|
|
4
4
|
headerNavigation: ReactElement;
|
|
5
|
+
variant?: 'transparent';
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/v2/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAgBrC,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EAAE,GAAG,EACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/v2/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAgBrC,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EAAE,GAAG,EACb,gBAAgB,EAChB,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACxC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,2CAOA"}
|
|
@@ -6,11 +6,11 @@ const LayoutContainer = styled.div `
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
height: 100vh;
|
|
8
8
|
box-sizing: border-box;
|
|
9
|
-
background: ${
|
|
9
|
+
background: ${props => props.variant === 'transparent' ? 'transparent' : props.theme.backgroundLevel1};
|
|
10
10
|
`;
|
|
11
11
|
const Navigation = styled.div `
|
|
12
12
|
height: ${navbarHeight};
|
|
13
13
|
`;
|
|
14
|
-
export function Layout({ children: app, headerNavigation, }) {
|
|
15
|
-
return (_jsxs(LayoutContainer, { className: "layout-container", children: [_jsx(Navigation, { children: headerNavigation }), app] }));
|
|
14
|
+
export function Layout({ children: app, headerNavigation, variant, }) {
|
|
15
|
+
return (_jsxs(LayoutContainer, { className: "layout-container", variant: variant, children: [_jsx(Navigation, { children: headerNavigation }), app] }));
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartUtil.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetemporalchart/ChartUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,+BAA+B,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,MAAM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;IAEzB,QAAQ,EAAE,OAAO,CAAC;CACnB,EAAE,CAAC;AAKJ,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,UAEtD;AACD,wBAAgB,gBAAgB,CAC9B,2BAA2B,EAAE,KAAK,EAAE,GACnC,QAAQ,CAqBV;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAU3E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,EAAE,EACH,QAAQ,EAAE,MAAM,GACf;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAwCA;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,EACjD,iBAAiB,CAAC,EAAE,MAAM,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAoEpC;AAID,eAAO,MAAM,gBAAgB,UAAW,MAAM,QAAQ,MAAM,WAE3D,CAAC;AACF,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,CAAC,QAAQ,MAAM,KAAG,CAQxE,CAAC;AACF,eAAO,MAAM,gBAAgB,kBAAmB,MAAM,QAAQ,MAAM,WAEnE,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,KAAK,EAAE,KAAG,MAAM,EAMvD,CAAC"}
|
|
@@ -94,8 +94,16 @@ export function addMissingDataPoint(orginalValues, startingTimeStamp, sampleDura
|
|
|
94
94
|
return [];
|
|
95
95
|
}
|
|
96
96
|
const newValues = [];
|
|
97
|
+
// add missing data points for the starting time
|
|
98
|
+
for (let i = startingTimeStamp; i < orginalValues[0][0]; i += sampleInterval) {
|
|
99
|
+
newValues.push([i, NAN_STRING]);
|
|
100
|
+
}
|
|
97
101
|
// Process all but the last element
|
|
98
102
|
for (let i = 0; i < orginalValues.length - 1; i++) {
|
|
103
|
+
if (orginalValues[i][0] < startingTimeStamp ||
|
|
104
|
+
orginalValues[i][0] > startingTimeStamp + sampleDuration) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
99
107
|
// Always add the current data point
|
|
100
108
|
newValues.push(orginalValues[i]);
|
|
101
109
|
const currentTimestamp = orginalValues[i][0];
|
|
@@ -111,6 +119,10 @@ export function addMissingDataPoint(orginalValues, startingTimeStamp, sampleDura
|
|
|
111
119
|
}
|
|
112
120
|
// Add the last element
|
|
113
121
|
newValues.push(orginalValues[orginalValues.length - 1]);
|
|
122
|
+
// add missing data points for the ending time
|
|
123
|
+
for (let i = orginalValues[orginalValues.length - 1][0] + sampleInterval; i < startingTimeStamp + sampleDuration; i += sampleInterval) {
|
|
124
|
+
newValues.push([i, NAN_STRING]);
|
|
125
|
+
}
|
|
114
126
|
return newValues;
|
|
115
127
|
}
|
|
116
128
|
// get the value for the based value
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { TooltipContentProps } from 'recharts';
|
|
2
|
+
export declare const TooltipContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const TooltipTime: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
1
4
|
export type Serie = {
|
|
2
5
|
resource: string;
|
|
3
6
|
data: [number, number | string | null][];
|
|
@@ -7,14 +10,14 @@ export type Serie = {
|
|
|
7
10
|
};
|
|
8
11
|
type NonSymmetricalChartSerie = {
|
|
9
12
|
yAxisType?: 'default' | 'percentage';
|
|
10
|
-
series: Serie[];
|
|
13
|
+
series: Serie[] | undefined;
|
|
11
14
|
};
|
|
12
15
|
type SymmetricalChartSerie = {
|
|
13
16
|
yAxisType: 'symmetrical';
|
|
14
17
|
series: {
|
|
15
|
-
above: Serie[];
|
|
16
|
-
below: Serie[];
|
|
17
|
-
};
|
|
18
|
+
above: Serie[] | undefined;
|
|
19
|
+
below: Serie[] | undefined;
|
|
20
|
+
} | undefined;
|
|
18
21
|
};
|
|
19
22
|
export type LineChartProps = (NonSymmetricalChartSerie | SymmetricalChartSerie) & {
|
|
20
23
|
title: string;
|
|
@@ -26,6 +29,7 @@ export type LineChartProps = (NonSymmetricalChartSerie | SymmetricalChartSerie)
|
|
|
26
29
|
threshold: number;
|
|
27
30
|
label: string;
|
|
28
31
|
}[];
|
|
32
|
+
syncId?: string;
|
|
29
33
|
isLoading?: boolean;
|
|
30
34
|
/**
|
|
31
35
|
* The format of the x axis, default is 'date-time' which is like 01 Sep 16:00
|
|
@@ -35,7 +39,8 @@ export type LineChartProps = (NonSymmetricalChartSerie | SymmetricalChartSerie)
|
|
|
35
39
|
timeFormat?: 'date-time' | 'date';
|
|
36
40
|
yAxisTitle?: string;
|
|
37
41
|
helpText?: string;
|
|
42
|
+
renderTooltip?: (tooltipProps: TooltipContentProps<number, string>, unitLabel?: string, timeFormat?: 'date-time' | 'date') => React.ReactNode;
|
|
38
43
|
};
|
|
39
|
-
export declare function LineTimeSerieChart({ series, title, height, startingTimeStamp, interval, duration, unitRange, isLoading, timeFormat, yAxisType, yAxisTitle, helpText, ...rest }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare function LineTimeSerieChart({ series, title, height, startingTimeStamp, interval, duration, unitRange, isLoading, timeFormat, yAxisType, yAxisTitle, helpText, syncId, renderTooltip, ...rest }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
40
45
|
export {};
|
|
41
46
|
//# sourceMappingURL=linetimeseriechart.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linetimeseriechart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"linetimeseriechart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AA8BlB,eAAO,MAAM,gBAAgB,yGAO5B,CAAC;AAEF,eAAO,MAAM,WAAW,yGAMvB,CAAC;AAwCF,MAAM,MAAM,KAAK,GAAG;IAElB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAEzC,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;CAC7B,CAAC;AAGF,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,EACF;QACE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;QAC3B,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CACzB,wBAAwB,GACxB,qBAAqB,CACxB,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,C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