@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
package/.cspell/custom-words.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
VishalBarnawal
|
|
2
1
|
Aditya
|
|
3
2
|
aditya-kaushal
|
|
4
3
|
amet
|
|
@@ -16,6 +15,8 @@ Crespo
|
|
|
16
15
|
datetime
|
|
17
16
|
DEFAULTTEXT
|
|
18
17
|
dismissable
|
|
18
|
+
drilldown
|
|
19
|
+
Drilldown
|
|
19
20
|
dropzone
|
|
20
21
|
eqeqeq
|
|
21
22
|
fbjs
|
|
@@ -24,6 +25,7 @@ flowtype
|
|
|
24
25
|
fontawesome
|
|
25
26
|
framename
|
|
26
27
|
Gaurav
|
|
28
|
+
highcharts
|
|
27
29
|
innerref
|
|
28
30
|
interdimensional
|
|
29
31
|
Lipsey
|
|
@@ -55,6 +57,7 @@ systemjs
|
|
|
55
57
|
tablist
|
|
56
58
|
tabout
|
|
57
59
|
testid
|
|
60
|
+
tickmark
|
|
58
61
|
tnum
|
|
59
62
|
transclude
|
|
60
63
|
Typeahead
|
|
@@ -62,6 +65,7 @@ typeof
|
|
|
62
65
|
valuenow
|
|
63
66
|
Verda
|
|
64
67
|
vish
|
|
68
|
+
VishalBarnawal
|
|
65
69
|
xmark
|
|
66
70
|
yourcomponentname
|
|
67
71
|
yxxx
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.87-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.1.86...v0.1.87-beta.0) (2024-04-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* [GDS-343] added donut, spider, line and column charts using highcharts-react-official ([#181](https://github.com/spaced-out/ui-design-system/issues/181)) ([4ebc82e](https://github.com/spaced-out/ui-design-system/commit/4ebc82e3f84085860a8011a9a870710e68485529)), closes [#171](https://github.com/spaced-out/ui-design-system/issues/171) [#173](https://github.com/spaced-out/ui-design-system/issues/173) [#174](https://github.com/spaced-out/ui-design-system/issues/174) [#177](https://github.com/spaced-out/ui-design-system/issues/177) [#180](https://github.com/spaced-out/ui-design-system/issues/180) [#182](https://github.com/spaced-out/ui-design-system/issues/182) [#183](https://github.com/spaced-out/ui-design-system/issues/183) [#184](https://github.com/spaced-out/ui-design-system/issues/184)
|
|
11
|
+
|
|
12
|
+
### [0.1.86](https://github.com/spaced-out/ui-design-system/compare/v0.1.85...v0.1.86) (2024-04-19)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* [GDS-362] adding responsive grid ([#190](https://github.com/spaced-out/ui-design-system/issues/190)) ([313c5c8](https://github.com/spaced-out/ui-design-system/commit/313c5c8b58502eae3bd95324f7cbdaad1b1f4d58))
|
|
18
|
+
|
|
5
19
|
### [0.1.85](https://github.com/spaced-out/ui-design-system/compare/v0.1.84...v0.1.85) (2024-04-18)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -195,6 +195,32 @@
|
|
|
195
195
|
"value": "{baseColor.yellow.500.value}"
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
+
"data-viz": {
|
|
199
|
+
"1": {
|
|
200
|
+
"value": "{baseColor.blue.200.value}"
|
|
201
|
+
},
|
|
202
|
+
"2": {
|
|
203
|
+
"value": "{baseColor.purple.200.value}"
|
|
204
|
+
},
|
|
205
|
+
"3": {
|
|
206
|
+
"value": "{baseColor.green.200.value}"
|
|
207
|
+
},
|
|
208
|
+
"4": {
|
|
209
|
+
"value": "{baseColor.orange.200.value}"
|
|
210
|
+
},
|
|
211
|
+
"5": {
|
|
212
|
+
"value": "{baseColor.red.200.value}"
|
|
213
|
+
},
|
|
214
|
+
"6": {
|
|
215
|
+
"value": "{baseColor.teal.100.value}"
|
|
216
|
+
},
|
|
217
|
+
"7": {
|
|
218
|
+
"value": "{baseColor.pink.100.value}"
|
|
219
|
+
},
|
|
220
|
+
"8": {
|
|
221
|
+
"value": "{baseColor.yellow.100.value}"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
198
224
|
"gray.lightest": {
|
|
199
225
|
"value": "{baseColor.gray.75.value}"
|
|
200
226
|
},
|
|
@@ -84,6 +84,9 @@
|
|
|
84
84
|
"160": {
|
|
85
85
|
"value": "160px"
|
|
86
86
|
},
|
|
87
|
+
"180": {
|
|
88
|
+
"value": "180px"
|
|
89
|
+
},
|
|
87
90
|
"228": {
|
|
88
91
|
"value": "228px"
|
|
89
92
|
},
|
|
@@ -117,15 +120,24 @@
|
|
|
117
120
|
"500": {
|
|
118
121
|
"value": "500px"
|
|
119
122
|
},
|
|
123
|
+
"540": {
|
|
124
|
+
"value": "540px"
|
|
125
|
+
},
|
|
120
126
|
"580": {
|
|
121
127
|
"value": "580px"
|
|
122
128
|
},
|
|
123
129
|
"640": {
|
|
124
130
|
"value": "640px"
|
|
125
131
|
},
|
|
132
|
+
"660": {
|
|
133
|
+
"value": "660px"
|
|
134
|
+
},
|
|
126
135
|
"720": {
|
|
127
136
|
"value": "720px"
|
|
128
137
|
},
|
|
138
|
+
"880": {
|
|
139
|
+
"value": "880px"
|
|
140
|
+
},
|
|
129
141
|
"960": {
|
|
130
142
|
"value": "960px"
|
|
131
143
|
},
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EXPORT_OPTIONS = exports.ChartWrapper = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _highcharts = _interopRequireDefault(require("highcharts"));
|
|
9
|
+
var _accessibility = _interopRequireDefault(require("highcharts/modules/accessibility"));
|
|
10
|
+
var _drilldown = _interopRequireDefault(require("highcharts/modules/drilldown"));
|
|
11
|
+
var _exporting = _interopRequireDefault(require("highcharts/modules/exporting"));
|
|
12
|
+
var _size = require("../../styles/variables/_size");
|
|
13
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
14
|
+
var _ButtonDropdown = require("../ButtonDropdown");
|
|
15
|
+
var _Card = require("../Card");
|
|
16
|
+
var _ChartWrapperModule = _interopRequireDefault(require("./ChartWrapper.module.css"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
//$FlowFixMe[untyped-import]
|
|
22
|
+
|
|
23
|
+
//$FlowFixMe[untyped-import]
|
|
24
|
+
|
|
25
|
+
//$FlowFixMe[untyped-import]
|
|
26
|
+
|
|
27
|
+
//$FlowFixMe[untyped-import]
|
|
28
|
+
|
|
29
|
+
const EXPORT_OPTIONS = Object.freeze({
|
|
30
|
+
download_as_png: {
|
|
31
|
+
key: 'download_as_png',
|
|
32
|
+
label: 'Download as PNG',
|
|
33
|
+
format: 'image/png'
|
|
34
|
+
},
|
|
35
|
+
download_as_jpeg: {
|
|
36
|
+
key: 'download_as_jpeg',
|
|
37
|
+
label: 'Download as JPEG',
|
|
38
|
+
format: 'image/jpeg'
|
|
39
|
+
},
|
|
40
|
+
download_as_pdf: {
|
|
41
|
+
key: 'download_as_pdf',
|
|
42
|
+
label: 'Download as PDF',
|
|
43
|
+
format: 'application/pdf'
|
|
44
|
+
},
|
|
45
|
+
download_as_svg: {
|
|
46
|
+
key: 'download_as_svg',
|
|
47
|
+
label: 'Download as SVG',
|
|
48
|
+
format: 'image/svg+xml'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// on assumption that all export options will be shown by default
|
|
53
|
+
exports.EXPORT_OPTIONS = EXPORT_OPTIONS;
|
|
54
|
+
const DEFAULT_EXPORT_OPTIONS = Object.keys(EXPORT_OPTIONS).map(exportKey => EXPORT_OPTIONS[exportKey]);
|
|
55
|
+
const CustomExportButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
56
|
+
let {
|
|
57
|
+
customExportOptions = null
|
|
58
|
+
} = _ref;
|
|
59
|
+
(0, _exporting.default)(_highcharts.default);
|
|
60
|
+
(0, _drilldown.default)(_highcharts.default);
|
|
61
|
+
(0, _accessibility.default)(_highcharts.default);
|
|
62
|
+
const exportOptions = customExportOptions ? customExportOptions : DEFAULT_EXPORT_OPTIONS;
|
|
63
|
+
const menuOptions = exportOptions.map(exportOption => {
|
|
64
|
+
const {
|
|
65
|
+
key,
|
|
66
|
+
label
|
|
67
|
+
} = exportOption;
|
|
68
|
+
return {
|
|
69
|
+
key,
|
|
70
|
+
label
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
const handleDownload = exportKey => {
|
|
74
|
+
const exportOptionObject = exportOptions.find(exportOption => exportOption.key === exportKey);
|
|
75
|
+
const exportFormat = exportOptionObject?.format || '';
|
|
76
|
+
if (ref.current) {
|
|
77
|
+
// $FlowFixMe[prop-missing]
|
|
78
|
+
// $FlowFixMe[incompatible-use]
|
|
79
|
+
ref.current.chart?.exportChart({
|
|
80
|
+
type: exportFormat
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/React.createElement(_ButtonDropdown.ButtonDropdown, {
|
|
85
|
+
menu: {
|
|
86
|
+
isFluid: true,
|
|
87
|
+
menuDisabled: false,
|
|
88
|
+
options: menuOptions,
|
|
89
|
+
size: 'medium',
|
|
90
|
+
width: _size.size180
|
|
91
|
+
},
|
|
92
|
+
iconLeftName: "ellipsis",
|
|
93
|
+
onOptionSelect: option => handleDownload(option.key),
|
|
94
|
+
size: "small",
|
|
95
|
+
type: "ghost",
|
|
96
|
+
anchorPosition: _ButtonDropdown.ANCHOR_POSITION_TYPE.bottomEnd
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
const ChartWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
100
|
+
let {
|
|
101
|
+
title,
|
|
102
|
+
children,
|
|
103
|
+
classNames,
|
|
104
|
+
customExportOptions,
|
|
105
|
+
headerActions
|
|
106
|
+
} = _ref2;
|
|
107
|
+
return /*#__PURE__*/React.createElement(_Card.Card, {
|
|
108
|
+
classNames: {
|
|
109
|
+
wrapper: (0, _classify.default)(_ChartWrapperModule.default.wrapper, classNames?.wrapper)
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement(_Card.CardHeader, {
|
|
112
|
+
className: classNames?.header
|
|
113
|
+
}, /*#__PURE__*/React.createElement(_Card.CardTitle, {
|
|
114
|
+
className: classNames?.title
|
|
115
|
+
}, title), /*#__PURE__*/React.createElement(_Card.CardActions, {
|
|
116
|
+
className: (0, _classify.default)(_ChartWrapperModule.default.chartCardActions, classNames?.actions)
|
|
117
|
+
}, /*#__PURE__*/React.createElement(CustomExportButton, {
|
|
118
|
+
ref: ref,
|
|
119
|
+
customExportOptions: customExportOptions
|
|
120
|
+
}), headerActions ? headerActions : null)), /*#__PURE__*/React.createElement(_Card.CardContent, {
|
|
121
|
+
className: (0, _classify.default)(_ChartWrapperModule.default.chartContent, classNames?.content)
|
|
122
|
+
}, children));
|
|
123
|
+
});
|
|
124
|
+
exports.ChartWrapper = ChartWrapper;
|
|
@@ -0,0 +1,156 @@
|
|
|
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 accessibility from 'highcharts/modules/accessibility';
|
|
8
|
+
//$FlowFixMe[untyped-import]
|
|
9
|
+
import drilldown from 'highcharts/modules/drilldown';
|
|
10
|
+
//$FlowFixMe[untyped-import]
|
|
11
|
+
import exporting from 'highcharts/modules/exporting';
|
|
12
|
+
|
|
13
|
+
import {size180} from '../../styles/variables/_size';
|
|
14
|
+
import classify from '../../utils/classify';
|
|
15
|
+
import {ANCHOR_POSITION_TYPE, ButtonDropdown} from '../ButtonDropdown';
|
|
16
|
+
import {Card, CardActions, CardContent, CardHeader, CardTitle} from '../Card';
|
|
17
|
+
import type {MenuOption} from '../Menu';
|
|
18
|
+
|
|
19
|
+
import css from './ChartWrapper.module.css';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export type ExportOptionType = {
|
|
23
|
+
key: string,
|
|
24
|
+
label: string,
|
|
25
|
+
format: string,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const EXPORT_OPTIONS = Object.freeze({
|
|
29
|
+
download_as_png: {
|
|
30
|
+
key: 'download_as_png',
|
|
31
|
+
label: 'Download as PNG',
|
|
32
|
+
format: 'image/png',
|
|
33
|
+
},
|
|
34
|
+
download_as_jpeg: {
|
|
35
|
+
key: 'download_as_jpeg',
|
|
36
|
+
label: 'Download as JPEG',
|
|
37
|
+
format: 'image/jpeg',
|
|
38
|
+
},
|
|
39
|
+
download_as_pdf: {
|
|
40
|
+
key: 'download_as_pdf',
|
|
41
|
+
label: 'Download as PDF',
|
|
42
|
+
format: 'application/pdf',
|
|
43
|
+
},
|
|
44
|
+
download_as_svg: {
|
|
45
|
+
key: 'download_as_svg',
|
|
46
|
+
label: 'Download as SVG',
|
|
47
|
+
format: 'image/svg+xml',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// on assumption that all export options will be shown by default
|
|
52
|
+
const DEFAULT_EXPORT_OPTIONS = Object.keys(EXPORT_OPTIONS).map(
|
|
53
|
+
(exportKey) => EXPORT_OPTIONS[exportKey],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
type CustomExportButtonProps = {
|
|
57
|
+
ref?: HTMLDivElement,
|
|
58
|
+
customExportOptions?: Array<ExportOptionType> | null,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const CustomExportButton = React.forwardRef<
|
|
62
|
+
CustomExportButtonProps,
|
|
63
|
+
HTMLDivElement,
|
|
64
|
+
>(({customExportOptions = null}: CustomExportButtonProps, ref) => {
|
|
65
|
+
exporting(Highcharts);
|
|
66
|
+
drilldown(Highcharts);
|
|
67
|
+
accessibility(Highcharts);
|
|
68
|
+
|
|
69
|
+
const exportOptions = customExportOptions
|
|
70
|
+
? customExportOptions
|
|
71
|
+
: DEFAULT_EXPORT_OPTIONS;
|
|
72
|
+
|
|
73
|
+
const menuOptions: Array<MenuOption> = exportOptions.map((exportOption) => {
|
|
74
|
+
const {key, label} = exportOption;
|
|
75
|
+
return {key, label};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const handleDownload = (exportKey: string): void => {
|
|
79
|
+
const exportOptionObject = exportOptions.find(
|
|
80
|
+
(exportOption) => exportOption.key === exportKey,
|
|
81
|
+
);
|
|
82
|
+
const exportFormat = exportOptionObject?.format || '';
|
|
83
|
+
if (ref.current) {
|
|
84
|
+
// $FlowFixMe[prop-missing]
|
|
85
|
+
// $FlowFixMe[incompatible-use]
|
|
86
|
+
ref.current.chart?.exportChart({type: exportFormat});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<ButtonDropdown
|
|
92
|
+
menu={{
|
|
93
|
+
isFluid: true,
|
|
94
|
+
menuDisabled: false,
|
|
95
|
+
options: menuOptions,
|
|
96
|
+
size: 'medium',
|
|
97
|
+
width: size180,
|
|
98
|
+
}}
|
|
99
|
+
iconLeftName="ellipsis"
|
|
100
|
+
onOptionSelect={(option) => handleDownload(option.key)}
|
|
101
|
+
size="small"
|
|
102
|
+
type="ghost"
|
|
103
|
+
anchorPosition={ANCHOR_POSITION_TYPE.bottomEnd}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export type ChartWrapperClassNames = $ReadOnly<{
|
|
109
|
+
wrapper?: string,
|
|
110
|
+
header?: string,
|
|
111
|
+
title?: string,
|
|
112
|
+
actions?: string,
|
|
113
|
+
content?: string,
|
|
114
|
+
}>;
|
|
115
|
+
|
|
116
|
+
type ChartWrapperProps = {
|
|
117
|
+
title: React.Node,
|
|
118
|
+
children?: React.Node,
|
|
119
|
+
classNames?: ChartWrapperClassNames,
|
|
120
|
+
customExportOptions?: Array<ExportOptionType> | null,
|
|
121
|
+
headerActions?: React.Node,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const ChartWrapper: React$AbstractComponent<
|
|
125
|
+
ChartWrapperProps,
|
|
126
|
+
HTMLDivElement,
|
|
127
|
+
> = React.forwardRef<ChartWrapperProps, HTMLDivElement>(
|
|
128
|
+
(
|
|
129
|
+
{
|
|
130
|
+
title,
|
|
131
|
+
children,
|
|
132
|
+
classNames,
|
|
133
|
+
customExportOptions,
|
|
134
|
+
headerActions,
|
|
135
|
+
}: ChartWrapperProps,
|
|
136
|
+
ref,
|
|
137
|
+
): React.Node => (
|
|
138
|
+
<Card classNames={{wrapper: classify(css.wrapper, classNames?.wrapper)}}>
|
|
139
|
+
<CardHeader className={classNames?.header}>
|
|
140
|
+
<CardTitle className={classNames?.title}>{title}</CardTitle>
|
|
141
|
+
<CardActions
|
|
142
|
+
className={classify(css.chartCardActions, classNames?.actions)}
|
|
143
|
+
>
|
|
144
|
+
<CustomExportButton
|
|
145
|
+
ref={ref}
|
|
146
|
+
customExportOptions={customExportOptions}
|
|
147
|
+
/>
|
|
148
|
+
{headerActions ? headerActions : null}
|
|
149
|
+
</CardActions>
|
|
150
|
+
</CardHeader>
|
|
151
|
+
<CardContent className={classify(css.chartContent, classNames?.content)}>
|
|
152
|
+
{children}
|
|
153
|
+
</CardContent>
|
|
154
|
+
</Card>
|
|
155
|
+
),
|
|
156
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@value (spaceXSmall) from '../../styles/variables/_space.css';
|
|
2
|
+
@value (size960) from '../../styles/variables/_size.css';
|
|
3
|
+
|
|
4
|
+
.wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
max-width: size960;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.chartCardActions {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: spaceXSmall;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.chartContent {
|
|
17
|
+
overflow-x: auto;
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartWrapper = require("./ChartWrapper");
|
|
7
|
+
Object.keys(_ChartWrapper).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartWrapper[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartWrapper[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tooltipTheme = void 0;
|
|
7
|
+
var _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
|
|
8
|
+
var _ChartTooltipModule = _interopRequireDefault(require("./ChartTooltip.module.css"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
const tooltipTheme = {
|
|
12
|
+
headerFormat: `<span class="${_typographyModule.default.bodySmall} ${_ChartTooltipModule.default.tooltipHeader}">{point.key}</span>`,
|
|
13
|
+
pointFormat: `<span class=${_ChartTooltipModule.default.tooltipPoint}>
|
|
14
|
+
<span style="background-color:{point.color};" class=${_ChartTooltipModule.default.indicatorCircle}></span>
|
|
15
|
+
<span class="${_ChartTooltipModule.default.tooltipContent} ${_typographyModule.default.bodyMedium}"> {series.name}: {point.y}</span>
|
|
16
|
+
</span>`
|
|
17
|
+
};
|
|
18
|
+
exports.tooltipTheme = tooltipTheme;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import type {Tooltip} from '../../types/charts';
|
|
4
|
+
|
|
5
|
+
import typographyCss from '../../styles/typography.module.css';
|
|
6
|
+
import css from './ChartTooltip.module.css';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const tooltipTheme: Tooltip = {
|
|
10
|
+
headerFormat: `<span class="${typographyCss.bodySmall} ${css.tooltipHeader}">{point.key}</span>`,
|
|
11
|
+
pointFormat: `<span class=${css.tooltipPoint}>
|
|
12
|
+
<span style="background-color:{point.color};" class=${css.indicatorCircle}></span>
|
|
13
|
+
<span class="${css.tooltipContent} ${typographyCss.bodyMedium}"> {series.name}: {point.y}</span>
|
|
14
|
+
</span>`,
|
|
15
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@value (fontWeightMedium,
|
|
2
|
+
fontSize14,
|
|
3
|
+
fontWeightBook,
|
|
4
|
+
fontLineHeight150,
|
|
5
|
+
fontLetterSpacing0) from '../../styles/variables/_font.css';
|
|
6
|
+
@value (colorTextInversePrimary, colorTextInverseSecondary) from '../../styles/variables/_color.css';
|
|
7
|
+
@value (spaceNone, spaceXXSmall) from '../../styles/variables/_space.css';
|
|
8
|
+
@value (size8) from '../../styles/variables/_size.css';
|
|
9
|
+
@value (borderRadiusCircle) from '../../styles/variables/_border.css';
|
|
10
|
+
|
|
11
|
+
.tooltipHeader {
|
|
12
|
+
margin: spaceNone;
|
|
13
|
+
color: colorTextInversePrimary;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tooltipPoint {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
gap: spaceXXSmall;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.indicatorCircle {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
width: size8;
|
|
27
|
+
height: size8;
|
|
28
|
+
border-radius: borderRadiusCircle;
|
|
29
|
+
margin: spaceXXSmall spaceNone;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tooltipContent {
|
|
33
|
+
margin: spaceNone;
|
|
34
|
+
color: colorTextInverseSecondary;
|
|
35
|
+
text-align: center;
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartWrapper = require("../ChartWrapper");
|
|
7
|
+
Object.keys(_ChartWrapper).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartWrapper[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartWrapper[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _ColumnChart = require("../ColumnChart");
|
|
18
|
+
Object.keys(_ColumnChart).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _ColumnChart[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _ColumnChart[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _DonutChart = require("../DonutChart");
|
|
29
|
+
Object.keys(_DonutChart).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _DonutChart[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _DonutChart[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _LineChart = require("../LineChart");
|
|
40
|
+
Object.keys(_LineChart).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _LineChart[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _LineChart[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _SpiderChart = require("../SpiderChart");
|
|
51
|
+
Object.keys(_SpiderChart).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _SpiderChart[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _SpiderChart[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _ChartTooltip = require("./ChartTooltip");
|
|
62
|
+
Object.keys(_ChartTooltip).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _ChartTooltip[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _ChartTooltip[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|