@scality/core-ui 0.167.0 → 0.169.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/.github/workflows/github-pages.yml +5 -3
- package/.storybook/preview.js +1 -0
- package/dist/components/barchartv2/Barchart.component.d.ts +5 -1
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.js +12 -7
- package/dist/components/barchartv2/ChartTooltip.d.ts +9 -13
- package/dist/components/barchartv2/ChartTooltip.d.ts.map +1 -1
- package/dist/components/barchartv2/ChartTooltip.js +14 -4
- package/dist/components/barchartv2/utils.d.ts +9 -2
- package/dist/components/barchartv2/utils.d.ts.map +1 -1
- package/dist/components/barchartv2/utils.js +14 -18
- package/dist/components/buttonv2/Buttonv2.component.d.ts.map +1 -1
- package/dist/components/buttonv2/Buttonv2.component.js +27 -6
- package/dist/components/date/FormattedDateTime.d.ts +20 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +36 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
- package/dist/components/linetemporalchart/ChartUtil.js +6 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +7 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +36 -32
- package/dist/components/linetimeseriechart/utils.d.ts +16 -0
- package/dist/components/linetimeseriechart/utils.d.ts.map +1 -0
- package/dist/components/linetimeseriechart/utils.js +28 -0
- package/dist/style/theme.d.ts +2 -2
- package/dist/style/theme.d.ts.map +1 -1
- package/dist/style/theme.js +26 -0
- package/package.json +5 -4
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +12 -8
- package/src/lib/components/barchartv2/Barchart.component.tsx +29 -9
- package/src/lib/components/barchartv2/ChartTooltip.test.tsx +119 -0
- package/src/lib/components/barchartv2/ChartTooltip.tsx +49 -19
- package/src/lib/components/barchartv2/utils.test.ts +31 -46
- package/src/lib/components/barchartv2/utils.ts +24 -31
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +27 -6
- package/src/lib/components/date/FormattedDateTime.tsx +43 -1
- package/src/lib/components/linetemporalchart/ChartUtil.ts +6 -0
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +81 -54
- package/src/lib/components/linetimeseriechart/linetimeseriechart.test.tsx +71 -0
- package/src/lib/components/linetimeseriechart/utils.test.ts +87 -0
- package/src/lib/components/linetimeseriechart/utils.ts +43 -0
- package/src/lib/style/theme.ts +26 -0
- package/stories/BarChart/barchart.stories.tsx +108 -13
- package/stories/color.mdx +12 -0
- package/stories/linetimeseriechart.stories.tsx +97 -0
|
@@ -61,7 +61,7 @@ export const Playground: Story = {
|
|
|
61
61
|
}}
|
|
62
62
|
>
|
|
63
63
|
<Stack direction="vertical" gap="r16">
|
|
64
|
-
<Barchart type=
|
|
64
|
+
<Barchart type={{ type: 'category' }} bars={exampleData} />
|
|
65
65
|
<ChartLegend shape="rectangle" direction="horizontal" />
|
|
66
66
|
</Stack>
|
|
67
67
|
</ChartLegendWrapper>
|
|
@@ -332,7 +332,7 @@ export const CapacityWithUnitRange: Story = {
|
|
|
332
332
|
}}
|
|
333
333
|
>
|
|
334
334
|
<Barchart
|
|
335
|
-
type=
|
|
335
|
+
type={{ type: 'category' }}
|
|
336
336
|
bars={capacityDataWithUnitRange}
|
|
337
337
|
unitRange={[
|
|
338
338
|
{
|
|
@@ -402,7 +402,7 @@ export const Stacked: Story = {
|
|
|
402
402
|
}}
|
|
403
403
|
>
|
|
404
404
|
<Stack direction="vertical" gap="r16">
|
|
405
|
-
<Barchart type=
|
|
405
|
+
<Barchart type={{ type: 'category' }} bars={stackedData} stacked />
|
|
406
406
|
<ChartLegend shape="rectangle" />
|
|
407
407
|
</Stack>
|
|
408
408
|
</ChartLegendWrapper>
|
|
@@ -453,7 +453,7 @@ export const DefaultSort: Story = {
|
|
|
453
453
|
}}
|
|
454
454
|
>
|
|
455
455
|
<Barchart
|
|
456
|
-
type=
|
|
456
|
+
type={{ type: 'category' }}
|
|
457
457
|
stacked
|
|
458
458
|
bars={defaultSortData}
|
|
459
459
|
defaultSort={customSort}
|
|
@@ -531,7 +531,7 @@ export const WithCustomTooltip: Story = {
|
|
|
531
531
|
>
|
|
532
532
|
<Stack direction="vertical" gap="r16">
|
|
533
533
|
<Barchart
|
|
534
|
-
type=
|
|
534
|
+
type={{ type: 'category' }}
|
|
535
535
|
bars={exampleData}
|
|
536
536
|
tooltip={customTooltip}
|
|
537
537
|
height={300}
|
|
@@ -602,7 +602,7 @@ export const StatusColors: Story = {
|
|
|
602
602
|
>
|
|
603
603
|
<Stack direction="vertical" gap="r16">
|
|
604
604
|
<Barchart
|
|
605
|
-
type=
|
|
605
|
+
type={{ type: 'category' }}
|
|
606
606
|
bars={statusData}
|
|
607
607
|
stacked
|
|
608
608
|
title="System Health Metrics"
|
|
@@ -656,7 +656,7 @@ export const LegendShapes: Story = {
|
|
|
656
656
|
>
|
|
657
657
|
<Stack direction="vertical" gap="r16">
|
|
658
658
|
<Barchart
|
|
659
|
-
type=
|
|
659
|
+
type={{ type: 'category' }}
|
|
660
660
|
bars={exampleData}
|
|
661
661
|
height={200}
|
|
662
662
|
title="Horizontal Rectangle Legend"
|
|
@@ -673,7 +673,7 @@ export const LegendShapes: Story = {
|
|
|
673
673
|
>
|
|
674
674
|
<Stack direction="vertical" gap="r16">
|
|
675
675
|
<Barchart
|
|
676
|
-
type=
|
|
676
|
+
type={{ type: 'category' }}
|
|
677
677
|
bars={exampleData}
|
|
678
678
|
height={200}
|
|
679
679
|
title="Vertical Line Legend"
|
|
@@ -727,14 +727,14 @@ export const BarchartsWithSingleLegend: Story = {
|
|
|
727
727
|
}}
|
|
728
728
|
>
|
|
729
729
|
<Barchart
|
|
730
|
-
type=
|
|
730
|
+
type={{ type: 'category' }}
|
|
731
731
|
bars={exampleData}
|
|
732
732
|
height={200}
|
|
733
733
|
title="Barchart 1"
|
|
734
734
|
/>
|
|
735
735
|
|
|
736
736
|
<Barchart
|
|
737
|
-
type=
|
|
737
|
+
type={{ type: 'category' }}
|
|
738
738
|
bars={exampleData}
|
|
739
739
|
height={200}
|
|
740
740
|
title="Barchart 2"
|
|
@@ -757,7 +757,7 @@ export const ErrorState: Story = {
|
|
|
757
757
|
}}
|
|
758
758
|
>
|
|
759
759
|
<Barchart
|
|
760
|
-
type=
|
|
760
|
+
type={{ type: 'category' }}
|
|
761
761
|
bars={[]}
|
|
762
762
|
isError
|
|
763
763
|
title="Error State"
|
|
@@ -808,7 +808,7 @@ export const StackedBarSort: Story = {
|
|
|
808
808
|
}}
|
|
809
809
|
>
|
|
810
810
|
<Barchart
|
|
811
|
-
type=
|
|
811
|
+
type={{ type: 'category' }}
|
|
812
812
|
bars={statusesData}
|
|
813
813
|
stacked
|
|
814
814
|
stackedBarSort={sort}
|
|
@@ -883,7 +883,7 @@ export const CompleteExample: Story = {
|
|
|
883
883
|
}}
|
|
884
884
|
>
|
|
885
885
|
<Barchart
|
|
886
|
-
type=
|
|
886
|
+
type={{ type: 'category' }}
|
|
887
887
|
title="Loading BarChart"
|
|
888
888
|
helpTooltip="Click on the button to load or unload data"
|
|
889
889
|
secondaryTitle={isLoading ? 'Loading...' : 'Loaded data'}
|
|
@@ -911,3 +911,98 @@ export const CompleteExample: Story = {
|
|
|
911
911
|
);
|
|
912
912
|
},
|
|
913
913
|
};
|
|
914
|
+
|
|
915
|
+
export const Histogram: Story = {
|
|
916
|
+
render: () => {
|
|
917
|
+
const histogramData = [
|
|
918
|
+
{
|
|
919
|
+
label: 'Success',
|
|
920
|
+
data: [
|
|
921
|
+
['0-10', 1],
|
|
922
|
+
['10-20', 5],
|
|
923
|
+
['20-30', 15],
|
|
924
|
+
['30-40', 40],
|
|
925
|
+
['40-50', 45],
|
|
926
|
+
['50-60', 50],
|
|
927
|
+
['60-70', 40],
|
|
928
|
+
['70-80', 15],
|
|
929
|
+
['80-90', 5],
|
|
930
|
+
['90-100', 1],
|
|
931
|
+
],
|
|
932
|
+
},
|
|
933
|
+
] as const;
|
|
934
|
+
const theme = useTheme() as CoreUITheme;
|
|
935
|
+
return (
|
|
936
|
+
<div style={{ width: '50%', padding: spacing.r16 }}>
|
|
937
|
+
<ChartLegendWrapper
|
|
938
|
+
colorSet={{
|
|
939
|
+
Success: theme.statusHealthy,
|
|
940
|
+
}}
|
|
941
|
+
>
|
|
942
|
+
<Barchart
|
|
943
|
+
type={{ type: 'category', gap: 0 }}
|
|
944
|
+
bars={histogramData}
|
|
945
|
+
title="Histogram"
|
|
946
|
+
/>
|
|
947
|
+
<ChartLegend shape="rectangle" />
|
|
948
|
+
</ChartLegendWrapper>
|
|
949
|
+
</div>
|
|
950
|
+
);
|
|
951
|
+
},
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
export const StackedHistogram: Story = {
|
|
955
|
+
render: () => {
|
|
956
|
+
const histogramData = [
|
|
957
|
+
{
|
|
958
|
+
label: 'Test 1',
|
|
959
|
+
data: [
|
|
960
|
+
['0-10', 1],
|
|
961
|
+
['10-20', 5],
|
|
962
|
+
['20-30', 15],
|
|
963
|
+
['30-40', 40],
|
|
964
|
+
['40-50', 45],
|
|
965
|
+
['50-60', 50],
|
|
966
|
+
['60-70', 40],
|
|
967
|
+
['70-80', 15],
|
|
968
|
+
['80-90', 5],
|
|
969
|
+
['90-100', 1],
|
|
970
|
+
],
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
label: 'Test 2',
|
|
974
|
+
data: [
|
|
975
|
+
['0-10', 1],
|
|
976
|
+
['10-20', 2],
|
|
977
|
+
['20-30', 4],
|
|
978
|
+
['30-40', 4],
|
|
979
|
+
['40-50', 5],
|
|
980
|
+
['50-60', 6],
|
|
981
|
+
['60-70', 6],
|
|
982
|
+
['70-80', 3],
|
|
983
|
+
['80-90', 2],
|
|
984
|
+
['90-100', 1],
|
|
985
|
+
],
|
|
986
|
+
},
|
|
987
|
+
] as const;
|
|
988
|
+
const theme = useTheme() as CoreUITheme;
|
|
989
|
+
return (
|
|
990
|
+
<div style={{ width: '50%', padding: spacing.r16 }}>
|
|
991
|
+
<ChartLegendWrapper
|
|
992
|
+
colorSet={{
|
|
993
|
+
'Test 1': theme.statusHealthy,
|
|
994
|
+
'Test 2': theme.statusWarning,
|
|
995
|
+
}}
|
|
996
|
+
>
|
|
997
|
+
<Barchart
|
|
998
|
+
type={{ type: 'category', gap: 0 }}
|
|
999
|
+
bars={histogramData}
|
|
1000
|
+
title="Stacked Histogram"
|
|
1001
|
+
stacked
|
|
1002
|
+
/>
|
|
1003
|
+
<ChartLegend shape="rectangle" />
|
|
1004
|
+
</ChartLegendWrapper>
|
|
1005
|
+
</div>
|
|
1006
|
+
);
|
|
1007
|
+
},
|
|
1008
|
+
};
|
package/stories/color.mdx
CHANGED
|
@@ -41,3 +41,15 @@ import { coreUIAvailableThemes } from '../src/lib/style/theme';
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
</ColorPalette>
|
|
44
|
+
|
|
45
|
+
## G-Dark
|
|
46
|
+
|
|
47
|
+
<ColorPalette>
|
|
48
|
+
{
|
|
49
|
+
Object.entries(coreUIAvailableThemes['G-Dark']).map(([key, value]) => {
|
|
50
|
+
if (!/RGB/.test(key)) return <ColorItem title={key} colors={[value]}/>;
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
</ColorPalette>
|
|
@@ -64,6 +64,10 @@ const meta: Meta<typeof LineTimeSerieChart> = {
|
|
|
64
64
|
options: ['default', 'percentage', 'symmetrical'],
|
|
65
65
|
},
|
|
66
66
|
yAxisTitle: { control: 'text' },
|
|
67
|
+
timeFormat: {
|
|
68
|
+
control: 'select',
|
|
69
|
+
options: ['date-time', 'date'],
|
|
70
|
+
},
|
|
67
71
|
},
|
|
68
72
|
};
|
|
69
73
|
|
|
@@ -405,6 +409,74 @@ const irregularIntervalData = [
|
|
|
405
409
|
[1740424900, '46.92'], // +1100 seconds (18.3 minutes) - under 2 intervals
|
|
406
410
|
];
|
|
407
411
|
|
|
412
|
+
// Data spanning several months - multi-month dataset
|
|
413
|
+
const longTermPrometheusData: [number, string][] = [
|
|
414
|
+
// January 2025
|
|
415
|
+
[1735689600, '42.15'], // Jan 1, 2025
|
|
416
|
+
[1735776000, '38.92'], // Jan 2, 2025
|
|
417
|
+
[1735862400, '55.33'], // Jan 3, 2025
|
|
418
|
+
[1735948800, '67.88'], // Jan 4, 2025
|
|
419
|
+
[1736035200, '44.21'], // Jan 5, 2025
|
|
420
|
+
[1736121600, '72.15'], // Jan 6, 2025
|
|
421
|
+
[1736208000, '39.67'], // Jan 7, 2025
|
|
422
|
+
[1736294400, '58.44'], // Jan 8, 2025
|
|
423
|
+
[1736380800, '63.92'], // Jan 9, 2025
|
|
424
|
+
[1736467200, '41.33'], // Jan 10, 2025
|
|
425
|
+
[1736553600, '76.88'], // Jan 11, 2025
|
|
426
|
+
[1736640000, '52.15'], // Jan 12, 2025
|
|
427
|
+
[1736726400, '48.67'], // Jan 13, 2025
|
|
428
|
+
[1736812800, '69.33'], // Jan 14, 2025
|
|
429
|
+
[1736899200, '35.88'], // Jan 15, 2025
|
|
430
|
+
// February 2025
|
|
431
|
+
[1738368000, '81.15'], // Feb 1, 2025
|
|
432
|
+
[1738454400, '47.67'], // Feb 2, 2025
|
|
433
|
+
[1738540800, '54.33'], // Feb 3, 2025
|
|
434
|
+
[1738627200, '62.88'], // Feb 4, 2025
|
|
435
|
+
[1738713600, '38.15'], // Feb 5, 2025
|
|
436
|
+
[1738800000, '73.67'], // Feb 6, 2025
|
|
437
|
+
[1738886400, '45.33'], // Feb 7, 2025
|
|
438
|
+
[1738972800, '59.88'], // Feb 8, 2025
|
|
439
|
+
[1739059200, '51.15'], // Feb 9, 2025
|
|
440
|
+
[1739145600, '66.67'], // Feb 10, 2025
|
|
441
|
+
[1739232000, '43.33'], // Feb 11, 2025
|
|
442
|
+
[1739318400, '78.88'], // Feb 12, 2025
|
|
443
|
+
[1739404800, '36.15'], // Feb 13, 2025
|
|
444
|
+
[1739491200, '64.67'], // Feb 14, 2025
|
|
445
|
+
[1739577600, '49.33'], // Feb 15, 2025
|
|
446
|
+
// March 2025
|
|
447
|
+
[1740787200, '71.88'], // Mar 1, 2025
|
|
448
|
+
[1740873600, '42.15'], // Mar 2, 2025
|
|
449
|
+
[1740960000, '57.67'], // Mar 3, 2025
|
|
450
|
+
[1741046400, '68.33'], // Mar 4, 2025
|
|
451
|
+
[1741132800, '34.88'], // Mar 5, 2025
|
|
452
|
+
[1741219200, '75.15'], // Mar 6, 2025
|
|
453
|
+
[1741305600, '48.67'], // Mar 7, 2025
|
|
454
|
+
[1741392000, '53.33'], // Mar 8, 2025
|
|
455
|
+
[1741478400, '61.88'], // Mar 9, 2025
|
|
456
|
+
[1741564800, '37.15'], // Mar 10, 2025
|
|
457
|
+
[1741651200, '74.67'], // Mar 11, 2025
|
|
458
|
+
[1741737600, '44.33'], // Mar 12, 2025
|
|
459
|
+
[1741824000, '58.88'], // Mar 13, 2025
|
|
460
|
+
[1741910400, '52.15'], // Mar 14, 2025
|
|
461
|
+
[1741996800, '67.67'], // Mar 15, 2025
|
|
462
|
+
// April 2025
|
|
463
|
+
[1743465600, '41.33'], // Apr 1, 2025
|
|
464
|
+
[1743552000, '76.88'], // Apr 2, 2025
|
|
465
|
+
[1743638400, '35.15'], // Apr 3, 2025
|
|
466
|
+
[1743724800, '63.67'], // Apr 4, 2025
|
|
467
|
+
[1743811200, '50.33'], // Apr 5, 2025
|
|
468
|
+
[1743897600, '72.88'], // Apr 6, 2025
|
|
469
|
+
[1743984000, '39.15'], // Apr 7, 2025
|
|
470
|
+
[1744070400, '56.67'], // Apr 8, 2025
|
|
471
|
+
[1744156800, '65.33'], // Apr 9, 2025
|
|
472
|
+
[1744243200, '33.88'], // Apr 10, 2025
|
|
473
|
+
[1744329600, '77.15'], // Apr 11, 2025
|
|
474
|
+
[1744416000, '46.67'], // Apr 12, 2025
|
|
475
|
+
[1744502400, '54.33'], // Apr 13, 2025
|
|
476
|
+
[1744588800, '60.88'], // Apr 14, 2025
|
|
477
|
+
[1744675200, '49.22'], // Apr 15, 2025
|
|
478
|
+
];
|
|
479
|
+
|
|
408
480
|
export const PercentageChartExample: Story = {
|
|
409
481
|
args: {
|
|
410
482
|
series: [
|
|
@@ -425,6 +497,7 @@ export const PercentageChartExample: Story = {
|
|
|
425
497
|
yAxisTitle: '',
|
|
426
498
|
interval: SAMPLE_FREQUENCY_LAST_TWENTY_FOUR_HOURS,
|
|
427
499
|
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
500
|
+
xAxisFormat: 'date-time',
|
|
428
501
|
},
|
|
429
502
|
};
|
|
430
503
|
const UNIT_RANGE_BS = [
|
|
@@ -537,3 +610,27 @@ export const IrregularIntervalsExample: Story = {
|
|
|
537
610
|
duration: SAMPLE_DURATION_LAST_TWENTY_FOUR_HOURS,
|
|
538
611
|
},
|
|
539
612
|
};
|
|
613
|
+
|
|
614
|
+
export const DateFormatExample: Story = {
|
|
615
|
+
args: {
|
|
616
|
+
series: [
|
|
617
|
+
{
|
|
618
|
+
data: longTermPrometheusData,
|
|
619
|
+
resource: 'ip-10-160-122-207.eu-north-1.compute.internal',
|
|
620
|
+
metricPrefix: 'instance:10.160.122.207:9100',
|
|
621
|
+
getTooltipLabel: (prefix, resource) => `${resource}`,
|
|
622
|
+
},
|
|
623
|
+
],
|
|
624
|
+
title: 'Long term data',
|
|
625
|
+
height: 200,
|
|
626
|
+
startingTimeStamp: longTermPrometheusData[0][0],
|
|
627
|
+
isLoading: false,
|
|
628
|
+
isLegendHidden: false,
|
|
629
|
+
helpText: 'This is the help text',
|
|
630
|
+
interval: 60 * 60 * 24, // 1 day
|
|
631
|
+
duration:
|
|
632
|
+
longTermPrometheusData[longTermPrometheusData.length - 1][0] -
|
|
633
|
+
longTermPrometheusData[0][0],
|
|
634
|
+
timeFormat: 'date',
|
|
635
|
+
},
|
|
636
|
+
};
|