@spaced-out/ui-design-system 0.1.86 → 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.
Files changed (71) hide show
  1. package/.cspell/custom-words.txt +5 -1
  2. package/.storybook/preview-head.html +4 -0
  3. package/CHANGELOG.md +7 -0
  4. package/design-tokens/color/app-color.json +26 -0
  5. package/design-tokens/font/base-font.json +1 -1
  6. package/design-tokens/size/base-size.json +12 -0
  7. package/lib/components/ChartWrapper/ChartWrapper.js +124 -0
  8. package/lib/components/ChartWrapper/ChartWrapper.js.flow +156 -0
  9. package/lib/components/ChartWrapper/ChartWrapper.module.css +19 -0
  10. package/lib/components/ChartWrapper/index.js +16 -0
  11. package/lib/components/ChartWrapper/index.js.flow +3 -0
  12. package/lib/components/Charts/ChartTooltip.js +18 -0
  13. package/lib/components/Charts/ChartTooltip.js.flow +15 -0
  14. package/lib/components/Charts/ChartTooltip.module.css +36 -0
  15. package/lib/components/Charts/index.js +71 -0
  16. package/lib/components/Charts/index.js.flow +8 -0
  17. package/lib/components/ColumnChart/ColumnChart.js +79 -0
  18. package/lib/components/ColumnChart/ColumnChart.js.flow +108 -0
  19. package/lib/components/ColumnChart/ColumnChart.module.css +12 -0
  20. package/lib/components/ColumnChart/index.js +16 -0
  21. package/lib/components/ColumnChart/index.js.flow +3 -0
  22. package/lib/components/DonutChart/DonutChart.js +94 -0
  23. package/lib/components/DonutChart/DonutChart.js.flow +146 -0
  24. package/lib/components/DonutChart/DonutChart.module.css +65 -0
  25. package/lib/components/DonutChart/index.js +16 -0
  26. package/lib/components/DonutChart/index.js.flow +3 -0
  27. package/lib/components/Icon/index.js +31 -25
  28. package/lib/components/Icon/index.js.flow +3 -6
  29. package/lib/components/LineChart/LineChart.js +64 -0
  30. package/lib/components/LineChart/LineChart.js.flow +85 -0
  31. package/lib/components/LineChart/LineChart.module.css +17 -0
  32. package/lib/components/LineChart/index.js +16 -0
  33. package/lib/components/LineChart/index.js.flow +3 -0
  34. package/lib/components/SpiderChart/SpiderChart.js +88 -0
  35. package/lib/components/SpiderChart/SpiderChart.js.flow +123 -0
  36. package/lib/components/SpiderChart/SpiderChart.module.css +17 -0
  37. package/lib/components/SpiderChart/index.js +16 -0
  38. package/lib/components/SpiderChart/index.js.flow +3 -0
  39. package/lib/components/index.js +11 -0
  40. package/lib/components/index.js.flow +1 -0
  41. package/lib/styles/index.css +25 -1
  42. package/lib/styles/index.js +28 -4
  43. package/lib/styles/index.js.flow +25 -1
  44. package/lib/styles/variables/_color.css +16 -0
  45. package/lib/styles/variables/_color.js +17 -1
  46. package/lib/styles/variables/_color.js.flow +16 -0
  47. package/lib/styles/variables/_font.css +1 -1
  48. package/lib/styles/variables/_font.js +1 -1
  49. package/lib/styles/variables/_font.js.flow +1 -1
  50. package/lib/styles/variables/_size.css +8 -0
  51. package/lib/styles/variables/_size.js +9 -1
  52. package/lib/styles/variables/_size.js.flow +8 -0
  53. package/lib/types/charts.js +0 -0
  54. package/lib/types/charts.js.flow +151 -0
  55. package/lib/utils/charts/charts.js +71 -0
  56. package/lib/utils/charts/charts.js.flow +89 -0
  57. package/lib/utils/charts/columnChart.js +55 -0
  58. package/lib/utils/charts/columnChart.js.flow +59 -0
  59. package/lib/utils/charts/donutChart.js +114 -0
  60. package/lib/utils/charts/donutChart.js.flow +138 -0
  61. package/lib/utils/charts/helpers.js +65 -0
  62. package/lib/utils/charts/helpers.js.flow +68 -0
  63. package/lib/utils/charts/index.js +82 -0
  64. package/lib/utils/charts/index.js.flow +9 -0
  65. package/lib/utils/charts/lineChart.js +47 -0
  66. package/lib/utils/charts/lineChart.js.flow +49 -0
  67. package/lib/utils/charts/spiderChart.js +59 -0
  68. package/lib/utils/charts/spiderChart.js.flow +72 -0
  69. package/lib/utils/charts/typography.js +59 -0
  70. package/lib/utils/charts/typography.js.flow +67 -0
  71. package/package.json +4 -1
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ColumnChart = 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 _ColumnChartModule = _interopRequireDefault(require("./ColumnChart.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 ColumnChart = _ref => {
23
+ let {
24
+ classNames,
25
+ cardTitle,
26
+ customExportOptions,
27
+ series,
28
+ drilldown,
29
+ headerActions,
30
+ ...userOptions
31
+ } = _ref;
32
+ const chartRef = /*#__PURE__*/React.createRef();
33
+ const columnChartSeries = series.map((seriesItem, index) => ({
34
+ ...seriesItem,
35
+ name: seriesItem.name,
36
+ data: seriesItem.data,
37
+ color: (0, _charts.getDataVizColor)(index),
38
+ pointWidth: _charts.columnPlotWidth
39
+ }));
40
+ const addColorToDrilldownSeries = series => series?.map(seriesItem => ({
41
+ ...seriesItem,
42
+ data: seriesItem.data.map((dataItem, index) => ({
43
+ ...dataItem,
44
+ color: (0, _charts.getDataVizColor)(index),
45
+ pointWidth: _charts.columnPlotWidth
46
+ }))
47
+ }));
48
+ const columnDrilldown = drilldown ? {
49
+ ...drilldown,
50
+ series: addColorToDrilldownSeries(drilldown.series)
51
+ } : {};
52
+ const defaultColumnChartOptions = (0, _charts.getColumnChartOptions)();
53
+
54
+ //$FlowFixMe[cannot-spread-inexact]
55
+ const chartOptions = (0, _charts.mergeChartUserOptions)(defaultColumnChartOptions, {
56
+ series: columnChartSeries,
57
+ drilldown: columnDrilldown,
58
+ ...userOptions
59
+ });
60
+ const {
61
+ highChart,
62
+ ...wrapperClassNames
63
+ } = classNames || {};
64
+ return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
65
+ title: cardTitle,
66
+ ref: chartRef,
67
+ classNames: wrapperClassNames,
68
+ customExportOptions: customExportOptions,
69
+ headerActions: headerActions
70
+ }, /*#__PURE__*/React.createElement(_highchartsReactOfficial.default, {
71
+ highcharts: _highcharts.default,
72
+ containerProps: {
73
+ className: (0, _classify.default)(_ColumnChartModule.default.columnChartContainer, highChart)
74
+ },
75
+ ref: chartRef,
76
+ options: chartOptions
77
+ }));
78
+ };
79
+ exports.ColumnChart = ColumnChart;
@@ -0,0 +1,108 @@
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 type {Drilldown} from '../../types/charts';
10
+ import {
11
+ columnPlotWidth,
12
+ getColumnChartOptions,
13
+ getDataVizColor,
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 './ColumnChart.module.css';
21
+
22
+
23
+ type ClassNames = $ReadOnly<{
24
+ ...ChartWrapperClassNames,
25
+ highChart?: string,
26
+ }>;
27
+
28
+ type ColumnSeriesItem = {
29
+ name: string,
30
+ data: [],
31
+ };
32
+
33
+ export type ColumnChartProps = {
34
+ classNames?: ClassNames,
35
+ cardTitle?: string,
36
+ customExportOptions?: Array<ExportOptionType> | null,
37
+ series: Array<ColumnSeriesItem>,
38
+ drilldown: Drilldown,
39
+ headerActions?: React.Node,
40
+ ...
41
+ };
42
+
43
+ export const ColumnChart = ({
44
+ classNames,
45
+ cardTitle,
46
+ customExportOptions,
47
+ series,
48
+ drilldown,
49
+ headerActions,
50
+ ...userOptions
51
+ }: ColumnChartProps): React.Node => {
52
+ const chartRef = React.createRef();
53
+
54
+ const columnChartSeries = series.map((seriesItem, index) => ({
55
+ ...seriesItem,
56
+ name: seriesItem.name,
57
+ data: seriesItem.data,
58
+ color: getDataVizColor(index),
59
+ pointWidth: columnPlotWidth,
60
+ }));
61
+
62
+ const addColorToDrilldownSeries = (series) =>
63
+ series?.map((seriesItem) => ({
64
+ ...seriesItem,
65
+ data: seriesItem.data.map((dataItem, index) => ({
66
+ ...dataItem,
67
+ color: getDataVizColor(index),
68
+ pointWidth: columnPlotWidth,
69
+ })),
70
+ }));
71
+
72
+ const columnDrilldown = drilldown
73
+ ? {
74
+ ...drilldown,
75
+ series: addColorToDrilldownSeries(drilldown.series),
76
+ }
77
+ : {};
78
+
79
+ const defaultColumnChartOptions = getColumnChartOptions();
80
+
81
+ //$FlowFixMe[cannot-spread-inexact]
82
+ const chartOptions = mergeChartUserOptions(defaultColumnChartOptions, {
83
+ series: columnChartSeries,
84
+ drilldown: columnDrilldown,
85
+ ...userOptions,
86
+ });
87
+
88
+ const {highChart, ...wrapperClassNames} = classNames || {};
89
+
90
+ return (
91
+ <ChartWrapper
92
+ title={cardTitle}
93
+ ref={chartRef}
94
+ classNames={wrapperClassNames}
95
+ customExportOptions={customExportOptions}
96
+ headerActions={headerActions}
97
+ >
98
+ <HighchartsReact
99
+ highcharts={Highcharts}
100
+ containerProps={{
101
+ className: classify(css.columnChartContainer, highChart),
102
+ }}
103
+ ref={chartRef}
104
+ options={chartOptions}
105
+ />
106
+ </ChartWrapper>
107
+ );
108
+ };
@@ -0,0 +1,12 @@
1
+ @value (colorFillPrimary) from '../../styles/variables/_color.css';
2
+ @value (size400, size660, sizeFluid) from '../../styles/variables/_size.css';
3
+
4
+ .columnChartContainer {
5
+ width: sizeFluid;
6
+ min-width: size660;
7
+ min-height: size400;
8
+ max-height: size400;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ColumnChart = require("./ColumnChart");
7
+ Object.keys(_ColumnChart).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ColumnChart[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ColumnChart[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './ColumnChart';
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DonutChart = 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 _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
14
+ var _DonutChartModule = _interopRequireDefault(require("./DonutChart.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
+ const DonutChart = _ref => {
24
+ let {
25
+ classNames,
26
+ cardTitle,
27
+ customExportOptions,
28
+ headerActions,
29
+ series,
30
+ drilldown,
31
+ legend,
32
+ centerText,
33
+ centerSubtext,
34
+ ...userOptions
35
+ } = _ref;
36
+ const chartRef = React.useRef();
37
+ const {
38
+ highChart,
39
+ subtitleClassNames,
40
+ ...wrapperClassNames
41
+ } = classNames || {};
42
+ const defaultCenterHTML = `<span class=${(0, _classify.default)(_DonutChartModule.default.subtitleWrap, subtitleClassNames?.wrapper)}>
43
+ <span class="${(0, _classify.default)(_typographyModule.default.jumboMedium, _DonutChartModule.default.subtitleText, subtitleClassNames?.text)}">
44
+ ${centerText ? centerText : ''}
45
+ </span>
46
+ <span class="${(0, _classify.default)(_typographyModule.default.bodySmall, _DonutChartModule.default.subtitleSubtext, subtitleClassNames?.subtext)}">
47
+ ${centerSubtext ? centerSubtext : ''}
48
+ </span>
49
+ <span>`;
50
+ const donutChartSeries = series.map(seriesItem => ({
51
+ ...seriesItem,
52
+ data: seriesItem.data.map((dataItem, index) => ({
53
+ ...dataItem,
54
+ color: (0, _charts.getDataVizColor)(index)
55
+ }))
56
+ }));
57
+ const addColorToDrilldownSeries = series => series?.map(seriesItem => ({
58
+ ...seriesItem,
59
+ data: seriesItem.data.map((dataItem, index) => ({
60
+ ...dataItem,
61
+ color: (0, _charts.getDataVizColor)(index)
62
+ }))
63
+ }));
64
+ const donutDrilldown = drilldown ? {
65
+ ...drilldown,
66
+ series: addColorToDrilldownSeries(drilldown.series)
67
+ } : {};
68
+ const defaultLineChartOptions = (0, _charts.getDonutChartOptions)({
69
+ legend,
70
+ defaultCenterHTML
71
+ });
72
+ const chartOptions = (0, _charts.mergeChartUserOptions)(defaultLineChartOptions, {
73
+ series: donutChartSeries,
74
+ drilldown: donutDrilldown,
75
+ ...userOptions
76
+ });
77
+ return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
78
+ title: cardTitle
79
+ //$FlowFixMe[incompatible-type]
80
+ ,
81
+ ref: chartRef,
82
+ customExportOptions: customExportOptions,
83
+ headerActions: headerActions,
84
+ classNames: wrapperClassNames
85
+ }, /*#__PURE__*/React.createElement(_highchartsReactOfficial.default, {
86
+ highcharts: _highcharts.default,
87
+ containerProps: {
88
+ className: (0, _classify.default)(_DonutChartModule.default.donutChartContainer, highChart)
89
+ },
90
+ ref: chartRef,
91
+ options: chartOptions
92
+ }));
93
+ };
94
+ exports.DonutChart = DonutChart;
@@ -0,0 +1,146 @@
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 type {
10
+ Drilldown,
11
+ LegendOptionsType,
12
+ SeriesOptionsType,
13
+ } from '../../types/charts';
14
+ import {
15
+ getDataVizColor,
16
+ getDonutChartOptions,
17
+ mergeChartUserOptions,
18
+ } from '../../utils/charts';
19
+ import classify from '../../utils/classify';
20
+ import type {ChartWrapperClassNames, ExportOptionType} from '../ChartWrapper';
21
+ import {ChartWrapper} from '../ChartWrapper';
22
+
23
+ import typographyCss from '../../styles/typography.module.css';
24
+ import css from './DonutChart.module.css';
25
+
26
+
27
+ type ClassNames = $ReadOnly<{
28
+ ...ChartWrapperClassNames,
29
+ highChart?: string,
30
+ subtitleClassNames?: SubtitleClassNames,
31
+ }>;
32
+ type DonutChartData = {
33
+ name: string,
34
+ value: number,
35
+ };
36
+
37
+ export type SubtitleClassNames = {
38
+ wrapper?: string,
39
+ text?: string,
40
+ subtext?: string,
41
+ };
42
+
43
+ export type DonutChartProps = {
44
+ classNames?: ClassNames,
45
+ cardTitle?: React.Node,
46
+ customExportOptions?: Array<ExportOptionType> | null,
47
+ headerActions?: React.Node,
48
+ centerText?: string,
49
+ centerSubtext?: string,
50
+ series: Array<SeriesOptionsType>,
51
+ drilldown: Drilldown,
52
+ legend?: LegendOptionsType,
53
+ };
54
+
55
+ export const DonutChart = ({
56
+ classNames,
57
+ cardTitle,
58
+ customExportOptions,
59
+ headerActions,
60
+ series,
61
+ drilldown,
62
+ legend,
63
+ centerText,
64
+ centerSubtext,
65
+ ...userOptions
66
+ }: DonutChartProps): React.Node => {
67
+ const chartRef = React.useRef();
68
+
69
+ const {highChart, subtitleClassNames, ...wrapperClassNames} =
70
+ classNames || {};
71
+
72
+ const defaultCenterHTML = `<span class=${classify(
73
+ css.subtitleWrap,
74
+ subtitleClassNames?.wrapper,
75
+ )}>
76
+ <span class="${classify(
77
+ typographyCss.jumboMedium,
78
+ css.subtitleText,
79
+ subtitleClassNames?.text,
80
+ )}">
81
+ ${centerText ? centerText : ''}
82
+ </span>
83
+ <span class="${classify(
84
+ typographyCss.bodySmall,
85
+ css.subtitleSubtext,
86
+ subtitleClassNames?.subtext,
87
+ )}">
88
+ ${centerSubtext ? centerSubtext : ''}
89
+ </span>
90
+ <span>`;
91
+
92
+ const donutChartSeries = series.map((seriesItem) => ({
93
+ ...seriesItem,
94
+ data: seriesItem.data.map((dataItem, index) => ({
95
+ ...dataItem,
96
+ color: getDataVizColor(index),
97
+ })),
98
+ }));
99
+
100
+ const addColorToDrilldownSeries = (series) =>
101
+ series?.map((seriesItem) => ({
102
+ ...seriesItem,
103
+ data: seriesItem.data.map((dataItem, index) => ({
104
+ ...dataItem,
105
+ color: getDataVizColor(index),
106
+ })),
107
+ }));
108
+
109
+ const donutDrilldown = drilldown
110
+ ? {
111
+ ...drilldown,
112
+ series: addColorToDrilldownSeries(drilldown.series),
113
+ }
114
+ : {};
115
+
116
+ const defaultLineChartOptions = getDonutChartOptions({
117
+ legend,
118
+ defaultCenterHTML,
119
+ });
120
+
121
+ const chartOptions = mergeChartUserOptions(defaultLineChartOptions, {
122
+ series: donutChartSeries,
123
+ drilldown: donutDrilldown,
124
+ ...userOptions,
125
+ });
126
+
127
+ return (
128
+ <ChartWrapper
129
+ title={cardTitle}
130
+ //$FlowFixMe[incompatible-type]
131
+ ref={chartRef}
132
+ customExportOptions={customExportOptions}
133
+ headerActions={headerActions}
134
+ classNames={wrapperClassNames}
135
+ >
136
+ <HighchartsReact
137
+ highcharts={Highcharts}
138
+ containerProps={{
139
+ className: classify(css.donutChartContainer, highChart),
140
+ }}
141
+ ref={chartRef}
142
+ options={chartOptions}
143
+ />
144
+ </ChartWrapper>
145
+ );
146
+ };
@@ -0,0 +1,65 @@
1
+ @value (
2
+ fontSize12,
3
+ fontSize36,
4
+ fontWeightMedium,
5
+ fontWeightBook,
6
+ fontLineHeight100,
7
+ fontLineHeight130,
8
+ fontLetterSpacingMinus3,
9
+ fontLetterSpacing4
10
+ ) from '../../styles/variables/_font.css';
11
+
12
+ @value (colorTextPrimary, colorTextSecondary) from '../../styles/variables/_color.css';
13
+ @value (size240, size300, size400, size500, sizeFluid) from '../../styles/variables/_size.css';
14
+
15
+ @value (spaceNone, spaceXSmall) from '../../styles/variables/_space.css';
16
+
17
+ .wrapper {
18
+ display: flex;
19
+ }
20
+
21
+ .donutChartContainer {
22
+ width: sizeFluid;
23
+ min-width: size500;
24
+ min-height: size300;
25
+ display: block;
26
+ align-items: center;
27
+ justify-content: center;
28
+ }
29
+
30
+ .subtitleWrap {
31
+ display: flex;
32
+ gap: spaceXSmall;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ justify-content: center;
36
+ overflow: hidden;
37
+ text-overflow: ellipsis;
38
+ width: sizeFluid;
39
+ }
40
+
41
+ .subtitleText {
42
+ margin: spaceNone;
43
+ color: colorTextPrimary;
44
+
45
+ text-align: center;
46
+
47
+ width: sizeFluid;
48
+ overflow: hidden;
49
+ white-space: nowrap;
50
+ text-overflow: ellipsis;
51
+ display: block;
52
+ }
53
+
54
+ .subtitleSubtext {
55
+ margin: spaceNone;
56
+ color: colorTextSecondary;
57
+
58
+ text-align: center;
59
+
60
+ width: sizeFluid;
61
+ overflow: hidden;
62
+ display: block;
63
+ white-space: nowrap;
64
+ text-overflow: ellipsis;
65
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _DonutChart = require("./DonutChart");
7
+ Object.keys(_DonutChart).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _DonutChart[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _DonutChart[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './DonutChart';
@@ -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
- var _SemanticIcon = require("./SemanticIcon");
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 type {CloseIconProps} from './ClickableIcon';
4
- export {ClickableIcon, CloseIcon} from './ClickableIcon';
5
- export type {IconProps, IconSize, IconType} from './Icon';
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;