@spaced-out/ui-design-system 0.1.85 → 0.1.87-beta.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/.cspell/custom-words.txt +5 -1
- package/.storybook/preview-head.html +4 -0
- package/CHANGELOG.md +14 -0
- package/design-tokens/color/app-color.json +26 -0
- package/design-tokens/font/base-font.json +1 -1
- package/design-tokens/size/base-size.json +12 -0
- package/lib/components/ChartWrapper/ChartWrapper.js +124 -0
- package/lib/components/ChartWrapper/ChartWrapper.js.flow +156 -0
- package/lib/components/ChartWrapper/ChartWrapper.module.css +19 -0
- package/lib/components/ChartWrapper/index.js +16 -0
- package/lib/components/ChartWrapper/index.js.flow +3 -0
- package/lib/components/Charts/ChartTooltip.js +18 -0
- package/lib/components/Charts/ChartTooltip.js.flow +15 -0
- package/lib/components/Charts/ChartTooltip.module.css +36 -0
- package/lib/components/Charts/index.js +71 -0
- package/lib/components/Charts/index.js.flow +8 -0
- package/lib/components/ColumnChart/ColumnChart.js +79 -0
- package/lib/components/ColumnChart/ColumnChart.js.flow +108 -0
- package/lib/components/ColumnChart/ColumnChart.module.css +12 -0
- package/lib/components/ColumnChart/index.js +16 -0
- package/lib/components/ColumnChart/index.js.flow +3 -0
- package/lib/components/DonutChart/DonutChart.js +94 -0
- package/lib/components/DonutChart/DonutChart.js.flow +146 -0
- package/lib/components/DonutChart/DonutChart.module.css +65 -0
- package/lib/components/DonutChart/index.js +16 -0
- package/lib/components/DonutChart/index.js.flow +3 -0
- package/lib/components/Grid/Grid.js +19 -8
- package/lib/components/Grid/Grid.js.flow +24 -7
- package/lib/components/Grid/Grid.module.css +1 -2
- package/lib/components/Icon/index.js +31 -25
- package/lib/components/Icon/index.js.flow +3 -6
- package/lib/components/LineChart/LineChart.js +64 -0
- package/lib/components/LineChart/LineChart.js.flow +85 -0
- package/lib/components/LineChart/LineChart.module.css +17 -0
- package/lib/components/LineChart/index.js +16 -0
- package/lib/components/LineChart/index.js.flow +3 -0
- package/lib/components/SpiderChart/SpiderChart.js +88 -0
- package/lib/components/SpiderChart/SpiderChart.js.flow +123 -0
- package/lib/components/SpiderChart/SpiderChart.module.css +17 -0
- package/lib/components/SpiderChart/index.js +16 -0
- package/lib/components/SpiderChart/index.js.flow +3 -0
- package/lib/components/index.js +11 -0
- package/lib/components/index.js.flow +1 -0
- package/lib/styles/index.css +25 -1
- package/lib/styles/index.js +28 -4
- package/lib/styles/index.js.flow +25 -1
- package/lib/styles/variables/_color.css +16 -0
- package/lib/styles/variables/_color.js +17 -1
- package/lib/styles/variables/_color.js.flow +16 -0
- package/lib/styles/variables/_font.css +1 -1
- package/lib/styles/variables/_font.js +1 -1
- package/lib/styles/variables/_font.js.flow +1 -1
- package/lib/styles/variables/_size.css +8 -0
- package/lib/styles/variables/_size.js +9 -1
- package/lib/styles/variables/_size.js.flow +8 -0
- package/lib/types/charts.js +0 -0
- package/lib/types/charts.js.flow +151 -0
- package/lib/utils/charts/charts.js +71 -0
- package/lib/utils/charts/charts.js.flow +89 -0
- package/lib/utils/charts/columnChart.js +55 -0
- package/lib/utils/charts/columnChart.js.flow +59 -0
- package/lib/utils/charts/donutChart.js +114 -0
- package/lib/utils/charts/donutChart.js.flow +138 -0
- package/lib/utils/charts/helpers.js +65 -0
- package/lib/utils/charts/helpers.js.flow +68 -0
- package/lib/utils/charts/index.js +82 -0
- package/lib/utils/charts/index.js.flow +9 -0
- package/lib/utils/charts/lineChart.js +47 -0
- package/lib/utils/charts/lineChart.js.flow +49 -0
- package/lib/utils/charts/spiderChart.js +59 -0
- package/lib/utils/charts/spiderChart.js.flow +72 -0
- package/lib/utils/charts/typography.js +59 -0
- package/lib/utils/charts/typography.js.flow +67 -0
- package/package.json +4 -1
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
.gridRow {
|
|
13
13
|
display: grid !important;
|
|
14
14
|
width: sizeFluid;
|
|
15
|
-
min-width: size960;
|
|
16
15
|
height: sizeFluid;
|
|
17
16
|
gap: spaceMedium;
|
|
18
17
|
padding: spaceNone spaceLarge;
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
grid-auto-columns: 1fr;
|
|
21
20
|
grid-column-gap: spaceMedium;
|
|
22
21
|
grid-row-gap: spaceMedium;
|
|
23
|
-
grid-auto-rows:
|
|
22
|
+
grid-auto-rows: auto;
|
|
24
23
|
box-sizing: border-box;
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -3,30 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "ClickableIcon", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ClickableIcon.ClickableIcon;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "CloseIcon", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _ClickableIcon.CloseIcon;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "Icon", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _Icon.Icon;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "SemanticIcon", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _SemanticIcon.SemanticIcon;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
6
|
var _ClickableIcon = require("./ClickableIcon");
|
|
7
|
+
Object.keys(_ClickableIcon).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ClickableIcon[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ClickableIcon[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
31
17
|
var _Icon = require("./Icon");
|
|
32
|
-
|
|
18
|
+
Object.keys(_Icon).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _Icon[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _Icon[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _SemanticIcon = require("./SemanticIcon");
|
|
29
|
+
Object.keys(_SemanticIcon).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _SemanticIcon[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _SemanticIcon[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export {Icon} from './Icon';
|
|
7
|
-
export type {SemanticIconProps} from './SemanticIcon';
|
|
8
|
-
export {SemanticIcon} from './SemanticIcon';
|
|
3
|
+
export * from './ClickableIcon';
|
|
4
|
+
export * from './Icon';
|
|
5
|
+
export * from './SemanticIcon';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LineChart = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _highcharts = _interopRequireDefault(require("highcharts"));
|
|
9
|
+
var _highchartsReactOfficial = _interopRequireDefault(require("highcharts-react-official"));
|
|
10
|
+
var _charts = require("../../utils/charts");
|
|
11
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
12
|
+
var _ChartWrapper = require("../ChartWrapper");
|
|
13
|
+
var _LineChartModule = _interopRequireDefault(require("./LineChart.module.css"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
//$FlowFixMe[untyped-import]
|
|
19
|
+
|
|
20
|
+
//$FlowFixMe[untyped-import]
|
|
21
|
+
|
|
22
|
+
const LineChart = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
classNames,
|
|
25
|
+
cardTitle,
|
|
26
|
+
customExportOptions,
|
|
27
|
+
series,
|
|
28
|
+
headerActions,
|
|
29
|
+
...userOptions
|
|
30
|
+
} = _ref;
|
|
31
|
+
const chartRef = /*#__PURE__*/React.createRef();
|
|
32
|
+
const lineChartSeries = series.map((seriesItem, index) => ({
|
|
33
|
+
...seriesItem,
|
|
34
|
+
name: seriesItem.name,
|
|
35
|
+
data: seriesItem.data,
|
|
36
|
+
color: (0, _charts.getDataVizColor)(index)
|
|
37
|
+
}));
|
|
38
|
+
const defaultLineChartOptions = (0, _charts.getLineChartOptions)();
|
|
39
|
+
|
|
40
|
+
//$FlowFixMe[cannot-spread-inexact]
|
|
41
|
+
const chartOptions = (0, _charts.mergeChartUserOptions)(defaultLineChartOptions, {
|
|
42
|
+
series: lineChartSeries,
|
|
43
|
+
...userOptions
|
|
44
|
+
});
|
|
45
|
+
const {
|
|
46
|
+
highChart,
|
|
47
|
+
...wrapperClassNames
|
|
48
|
+
} = classNames || {};
|
|
49
|
+
return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
|
|
50
|
+
title: cardTitle,
|
|
51
|
+
ref: chartRef,
|
|
52
|
+
classNames: wrapperClassNames,
|
|
53
|
+
customExportOptions: customExportOptions,
|
|
54
|
+
headerActions: headerActions
|
|
55
|
+
}, /*#__PURE__*/React.createElement(_highchartsReactOfficial.default, {
|
|
56
|
+
highcharts: _highcharts.default,
|
|
57
|
+
containerProps: {
|
|
58
|
+
className: (0, _classify.default)(_LineChartModule.default.lineChartContainer, highChart)
|
|
59
|
+
},
|
|
60
|
+
ref: chartRef,
|
|
61
|
+
options: chartOptions
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
exports.LineChart = LineChart;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
//$FlowFixMe[untyped-import]
|
|
5
|
+
import Highcharts from 'highcharts';
|
|
6
|
+
//$FlowFixMe[untyped-import]
|
|
7
|
+
import HighchartsReact from 'highcharts-react-official';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
getDataVizColor,
|
|
11
|
+
getLineChartOptions,
|
|
12
|
+
mergeChartUserOptions,
|
|
13
|
+
} from '../../utils/charts';
|
|
14
|
+
import classify from '../../utils/classify';
|
|
15
|
+
import type {ChartWrapperClassNames, ExportOptionType} from '../ChartWrapper';
|
|
16
|
+
import {ChartWrapper} from '../ChartWrapper';
|
|
17
|
+
|
|
18
|
+
import css from './LineChart.module.css';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
type ClassNames = $ReadOnly<{
|
|
22
|
+
...ChartWrapperClassNames,
|
|
23
|
+
highChart?: string,
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
type LineSeriesItem = {
|
|
27
|
+
name: string,
|
|
28
|
+
data: [],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type LineChartProps = {
|
|
32
|
+
classNames?: ClassNames,
|
|
33
|
+
cardTitle?: string,
|
|
34
|
+
customExportOptions?: Array<ExportOptionType> | null,
|
|
35
|
+
series: Array<LineSeriesItem>,
|
|
36
|
+
headerActions?: React.Node,
|
|
37
|
+
...
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const LineChart = ({
|
|
41
|
+
classNames,
|
|
42
|
+
cardTitle,
|
|
43
|
+
customExportOptions,
|
|
44
|
+
series,
|
|
45
|
+
headerActions,
|
|
46
|
+
...userOptions
|
|
47
|
+
}: LineChartProps): React.Node => {
|
|
48
|
+
const chartRef = React.createRef();
|
|
49
|
+
|
|
50
|
+
const lineChartSeries = series.map((seriesItem, index) => ({
|
|
51
|
+
...seriesItem,
|
|
52
|
+
name: seriesItem.name,
|
|
53
|
+
data: seriesItem.data,
|
|
54
|
+
color: getDataVizColor(index),
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
const defaultLineChartOptions = getLineChartOptions();
|
|
58
|
+
|
|
59
|
+
//$FlowFixMe[cannot-spread-inexact]
|
|
60
|
+
const chartOptions = mergeChartUserOptions(defaultLineChartOptions, {
|
|
61
|
+
series: lineChartSeries,
|
|
62
|
+
...userOptions,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const {highChart, ...wrapperClassNames} = classNames || {};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<ChartWrapper
|
|
69
|
+
title={cardTitle}
|
|
70
|
+
ref={chartRef}
|
|
71
|
+
classNames={wrapperClassNames}
|
|
72
|
+
customExportOptions={customExportOptions}
|
|
73
|
+
headerActions={headerActions}
|
|
74
|
+
>
|
|
75
|
+
<HighchartsReact
|
|
76
|
+
highcharts={Highcharts}
|
|
77
|
+
containerProps={{
|
|
78
|
+
className: classify(css.lineChartContainer, highChart),
|
|
79
|
+
}}
|
|
80
|
+
ref={chartRef}
|
|
81
|
+
options={chartOptions}
|
|
82
|
+
/>
|
|
83
|
+
</ChartWrapper>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@value (colorFillPrimary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (size400, size660, sizeFluid) from '../../styles/variables/_size.css';
|
|
3
|
+
|
|
4
|
+
.wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.lineChartContainer {
|
|
10
|
+
width: sizeFluid;
|
|
11
|
+
min-width: size660;
|
|
12
|
+
min-height: size400;
|
|
13
|
+
max-height: size400;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _LineChart = require("./LineChart");
|
|
7
|
+
Object.keys(_LineChart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _LineChart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _LineChart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SpiderChart = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _highcharts = _interopRequireDefault(require("highcharts"));
|
|
9
|
+
var _highchartsMore = _interopRequireDefault(require("highcharts/highcharts-more"));
|
|
10
|
+
var _highchartsReactOfficial = _interopRequireDefault(require("highcharts-react-official"));
|
|
11
|
+
var _charts = require("../../utils/charts");
|
|
12
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
13
|
+
var _ChartWrapper = require("../ChartWrapper");
|
|
14
|
+
var _SpiderChartModule = _interopRequireDefault(require("./SpiderChart.module.css"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
|
|
19
|
+
//$FlowFixMe[untyped-import]
|
|
20
|
+
|
|
21
|
+
//$FlowFixMe[untyped-import]
|
|
22
|
+
|
|
23
|
+
//$FlowFixMe[untyped-import]
|
|
24
|
+
|
|
25
|
+
(0, _highchartsMore.default)(_highcharts.default);
|
|
26
|
+
const SpiderChart = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
classNames,
|
|
29
|
+
cardTitle,
|
|
30
|
+
customExportOptions,
|
|
31
|
+
headerActions,
|
|
32
|
+
legend,
|
|
33
|
+
series,
|
|
34
|
+
xAxis: {
|
|
35
|
+
categories,
|
|
36
|
+
tickmarkPlacement = 'on',
|
|
37
|
+
lineWidth: xAxisLineWidth = 0,
|
|
38
|
+
...xAxisProps
|
|
39
|
+
} = {},
|
|
40
|
+
yAxis: {
|
|
41
|
+
gridLineInterpolation = 'polygon',
|
|
42
|
+
lineWidth: yAxisLineWidth = 0,
|
|
43
|
+
min: yAxisMin = 0,
|
|
44
|
+
...yAxisProps
|
|
45
|
+
} = {},
|
|
46
|
+
...userOptions
|
|
47
|
+
} = _ref;
|
|
48
|
+
const chartRef = React.useRef(null);
|
|
49
|
+
const [chartWidth, setChartWidth] = React.useState(0);
|
|
50
|
+
React.useLayoutEffect(() => {
|
|
51
|
+
setChartWidth(chartRef.current?.chart.plotWidth);
|
|
52
|
+
}, []);
|
|
53
|
+
const spiderSeries = series.map((seriesItem, index) => ({
|
|
54
|
+
...seriesItem,
|
|
55
|
+
name: seriesItem.name,
|
|
56
|
+
data: seriesItem.data,
|
|
57
|
+
pointPlacement: 'on',
|
|
58
|
+
color: (0, _charts.getDataVizColor)(index)
|
|
59
|
+
}));
|
|
60
|
+
const defaultSpiderChartOptions = (0, _charts.getSpiderChartOptions)();
|
|
61
|
+
|
|
62
|
+
//$FlowFixMe[cannot-spread-inexact]
|
|
63
|
+
const chartOptions = (0, _charts.mergeChartUserOptions)(defaultSpiderChartOptions, {
|
|
64
|
+
series: spiderSeries,
|
|
65
|
+
...userOptions
|
|
66
|
+
});
|
|
67
|
+
const {
|
|
68
|
+
highChart,
|
|
69
|
+
...wrapperClassNames
|
|
70
|
+
} = classNames || {};
|
|
71
|
+
return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
|
|
72
|
+
title: cardTitle
|
|
73
|
+
//$FlowFixMe[incompatible-type]
|
|
74
|
+
,
|
|
75
|
+
ref: chartRef,
|
|
76
|
+
customExportOptions: customExportOptions,
|
|
77
|
+
classNames: wrapperClassNames,
|
|
78
|
+
headerActions: headerActions
|
|
79
|
+
}, /*#__PURE__*/React.createElement(_highchartsReactOfficial.default, {
|
|
80
|
+
highcharts: _highcharts.default,
|
|
81
|
+
ref: chartRef,
|
|
82
|
+
containerProps: {
|
|
83
|
+
className: (0, _classify.default)(_SpiderChartModule.default.spiderChartContainer, highChart)
|
|
84
|
+
},
|
|
85
|
+
options: chartOptions
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
exports.SpiderChart = SpiderChart;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
//$FlowFixMe[untyped-import]
|
|
5
|
+
import Highcharts from 'highcharts';
|
|
6
|
+
//$FlowFixMe[untyped-import]
|
|
7
|
+
import HighChartsMore from 'highcharts/highcharts-more';
|
|
8
|
+
//$FlowFixMe[untyped-import]
|
|
9
|
+
import HighchartsReact from 'highcharts-react-official';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
getDataVizColor,
|
|
13
|
+
getSpiderChartOptions,
|
|
14
|
+
mergeChartUserOptions,
|
|
15
|
+
} from '../../utils/charts';
|
|
16
|
+
import classify from '../../utils/classify';
|
|
17
|
+
import type {ChartWrapperClassNames, ExportOptionType} from '../ChartWrapper';
|
|
18
|
+
import {ChartWrapper} from '../ChartWrapper';
|
|
19
|
+
|
|
20
|
+
import css from './SpiderChart.module.css';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
HighChartsMore(Highcharts);
|
|
24
|
+
|
|
25
|
+
type ClassNames = $ReadOnly<{
|
|
26
|
+
...ChartWrapperClassNames,
|
|
27
|
+
highChart?: string,
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
type SpiderSeriesItem = {
|
|
31
|
+
name: string,
|
|
32
|
+
data: [],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type SpiderChartProps = {
|
|
36
|
+
classNames?: ClassNames,
|
|
37
|
+
cardTitle?: React.Node,
|
|
38
|
+
customExportOptions?: Array<ExportOptionType> | null,
|
|
39
|
+
headerActions?: React.Node,
|
|
40
|
+
series: Array<SpiderSeriesItem>,
|
|
41
|
+
legend: {...},
|
|
42
|
+
xAxis: {
|
|
43
|
+
categories: Array<string>,
|
|
44
|
+
tickmarkPlacement: string,
|
|
45
|
+
lineWidth: number,
|
|
46
|
+
...
|
|
47
|
+
},
|
|
48
|
+
yAxis: {
|
|
49
|
+
gridLineInterpolation: 'circle' | 'polygon',
|
|
50
|
+
lineWidth: 0,
|
|
51
|
+
min: 0,
|
|
52
|
+
...
|
|
53
|
+
},
|
|
54
|
+
...
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const SpiderChart = ({
|
|
58
|
+
classNames,
|
|
59
|
+
cardTitle,
|
|
60
|
+
customExportOptions,
|
|
61
|
+
headerActions,
|
|
62
|
+
legend,
|
|
63
|
+
series,
|
|
64
|
+
xAxis: {
|
|
65
|
+
categories,
|
|
66
|
+
tickmarkPlacement = 'on',
|
|
67
|
+
lineWidth: xAxisLineWidth = 0,
|
|
68
|
+
...xAxisProps
|
|
69
|
+
} = {},
|
|
70
|
+
yAxis: {
|
|
71
|
+
gridLineInterpolation = 'polygon',
|
|
72
|
+
lineWidth: yAxisLineWidth = 0,
|
|
73
|
+
min: yAxisMin = 0,
|
|
74
|
+
...yAxisProps
|
|
75
|
+
} = {},
|
|
76
|
+
|
|
77
|
+
...userOptions
|
|
78
|
+
}: SpiderChartProps): React.Node => {
|
|
79
|
+
const chartRef = React.useRef(null);
|
|
80
|
+
const [chartWidth, setChartWidth] = React.useState(0);
|
|
81
|
+
|
|
82
|
+
React.useLayoutEffect(() => {
|
|
83
|
+
setChartWidth(chartRef.current?.chart.plotWidth);
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
const spiderSeries = series.map((seriesItem, index) => ({
|
|
87
|
+
...seriesItem,
|
|
88
|
+
name: seriesItem.name,
|
|
89
|
+
data: seriesItem.data,
|
|
90
|
+
pointPlacement: 'on',
|
|
91
|
+
color: getDataVizColor(index),
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
const defaultSpiderChartOptions = getSpiderChartOptions();
|
|
95
|
+
|
|
96
|
+
//$FlowFixMe[cannot-spread-inexact]
|
|
97
|
+
const chartOptions = mergeChartUserOptions(defaultSpiderChartOptions, {
|
|
98
|
+
series: spiderSeries,
|
|
99
|
+
...userOptions,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const {highChart, ...wrapperClassNames} = classNames || {};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<ChartWrapper
|
|
106
|
+
title={cardTitle}
|
|
107
|
+
//$FlowFixMe[incompatible-type]
|
|
108
|
+
ref={chartRef}
|
|
109
|
+
customExportOptions={customExportOptions}
|
|
110
|
+
classNames={wrapperClassNames}
|
|
111
|
+
headerActions={headerActions}
|
|
112
|
+
>
|
|
113
|
+
<HighchartsReact
|
|
114
|
+
highcharts={Highcharts}
|
|
115
|
+
ref={chartRef}
|
|
116
|
+
containerProps={{
|
|
117
|
+
className: classify(css.spiderChartContainer, highChart),
|
|
118
|
+
}}
|
|
119
|
+
options={chartOptions}
|
|
120
|
+
/>
|
|
121
|
+
</ChartWrapper>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@value (colorFillPrimary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (size400, size540, size660, size880, sizeFluid) from '../../styles/variables/_size.css';
|
|
3
|
+
|
|
4
|
+
.wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.spiderChartContainer {
|
|
9
|
+
width: sizeFluid;
|
|
10
|
+
min-width: size660;
|
|
11
|
+
max-width: size880;
|
|
12
|
+
min-height: size400;
|
|
13
|
+
max-height: size540;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _SpiderChart = require("./SpiderChart");
|
|
7
|
+
Object.keys(_SpiderChart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _SpiderChart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _SpiderChart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/lib/components/index.js
CHANGED
|
@@ -102,6 +102,17 @@ Object.keys(_Card).forEach(function (key) {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
+
var _Charts = require("./Charts");
|
|
106
|
+
Object.keys(_Charts).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _Charts[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _Charts[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
105
116
|
var _Checkbox = require("./Checkbox");
|
|
106
117
|
Object.keys(_Checkbox).forEach(function (key) {
|
|
107
118
|
if (key === "default" || key === "__esModule") return;
|
package/lib/styles/index.css
CHANGED
|
@@ -128,6 +128,22 @@
|
|
|
128
128
|
|
|
129
129
|
@value colorSubMenuStar: #DFBD0D;
|
|
130
130
|
|
|
131
|
+
@value colorDataViz1: #8dbaf8;
|
|
132
|
+
|
|
133
|
+
@value colorDataViz2: #b4a2e8;
|
|
134
|
+
|
|
135
|
+
@value colorDataViz3: #8bcfad;
|
|
136
|
+
|
|
137
|
+
@value colorDataViz4: #f0c48f;
|
|
138
|
+
|
|
139
|
+
@value colorDataViz5: #f297ad;
|
|
140
|
+
|
|
141
|
+
@value colorDataViz6: #B0F0E3;
|
|
142
|
+
|
|
143
|
+
@value colorDataViz7: #F5B8E1;
|
|
144
|
+
|
|
145
|
+
@value colorDataViz8: #F5EBB4;
|
|
146
|
+
|
|
131
147
|
@value colorGrayLightest: #EBEBEB;
|
|
132
148
|
|
|
133
149
|
@value colorNeutral: #706F9B;
|
|
@@ -194,7 +210,7 @@
|
|
|
194
210
|
|
|
195
211
|
@value elevationToast: 60;
|
|
196
212
|
|
|
197
|
-
@value fontFamilyCentra: "Centra
|
|
213
|
+
@value fontFamilyCentra: "Centra No 2";
|
|
198
214
|
|
|
199
215
|
@value fontWeightBook: 400;
|
|
200
216
|
|
|
@@ -400,6 +416,8 @@
|
|
|
400
416
|
|
|
401
417
|
@value size160: 160px;
|
|
402
418
|
|
|
419
|
+
@value size180: 180px;
|
|
420
|
+
|
|
403
421
|
@value size228: 228px;
|
|
404
422
|
|
|
405
423
|
@value size240: 240px;
|
|
@@ -422,12 +440,18 @@
|
|
|
422
440
|
|
|
423
441
|
@value size500: 500px;
|
|
424
442
|
|
|
443
|
+
@value size540: 540px;
|
|
444
|
+
|
|
425
445
|
@value size580: 580px;
|
|
426
446
|
|
|
427
447
|
@value size640: 640px;
|
|
428
448
|
|
|
449
|
+
@value size660: 660px;
|
|
450
|
+
|
|
429
451
|
@value size720: 720px;
|
|
430
452
|
|
|
453
|
+
@value size880: 880px;
|
|
454
|
+
|
|
431
455
|
@value size960: 960px;
|
|
432
456
|
|
|
433
457
|
@value size1280: 1280px;
|