@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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getColumnChartOptions = exports.columnPlotWidth = void 0;
|
|
7
|
+
var _charts = require("./charts");
|
|
8
|
+
var _helpers = require("./helpers");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This function modifies the the common chart behavior to column chart default behavior.
|
|
12
|
+
* It will not take userPassed option into account.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const getColumnChartOptions = () => ({
|
|
16
|
+
..._charts.commonChartOptions,
|
|
17
|
+
chart: {
|
|
18
|
+
type: 'column'
|
|
19
|
+
},
|
|
20
|
+
legend: {
|
|
21
|
+
..._charts.commonChartOptions.legend,
|
|
22
|
+
..._helpers.bottomLegendRow,
|
|
23
|
+
symbolWidth: 18
|
|
24
|
+
},
|
|
25
|
+
xAxis: {
|
|
26
|
+
labels: {
|
|
27
|
+
style: _helpers.xAxisLabelStyle
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
margin: 12,
|
|
31
|
+
style: _helpers.xAxisTitleStyle
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
yAxis: {
|
|
35
|
+
labels: {
|
|
36
|
+
align: 'right',
|
|
37
|
+
distance: 12,
|
|
38
|
+
style: _helpers.yAxisLabelStyle
|
|
39
|
+
},
|
|
40
|
+
title: {
|
|
41
|
+
margin: 12,
|
|
42
|
+
style: _helpers.yAxisTitleStyle
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
drilldown: {
|
|
46
|
+
activeAxisLabelStyle: _helpers.activeLabelStyle,
|
|
47
|
+
activeDataLabelStyle: _helpers.activeLabelStyle,
|
|
48
|
+
breadcrumbs: {
|
|
49
|
+
floating: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
exports.getColumnChartOptions = getColumnChartOptions;
|
|
54
|
+
const columnPlotWidth = 28;
|
|
55
|
+
exports.columnPlotWidth = columnPlotWidth;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import type {ChartOptions} from '../../types/charts';
|
|
4
|
+
|
|
5
|
+
import {commonChartOptions} from './charts';
|
|
6
|
+
import {
|
|
7
|
+
activeLabelStyle,
|
|
8
|
+
bottomLegendRow,
|
|
9
|
+
xAxisLabelStyle,
|
|
10
|
+
xAxisTitleStyle,
|
|
11
|
+
yAxisLabelStyle,
|
|
12
|
+
yAxisTitleStyle,
|
|
13
|
+
} from './helpers';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This function modifies the the common chart behavior to column chart default behavior.
|
|
17
|
+
* It will not take userPassed option into account.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const getColumnChartOptions = (): ChartOptions => ({
|
|
21
|
+
...commonChartOptions,
|
|
22
|
+
chart: {
|
|
23
|
+
type: 'column',
|
|
24
|
+
},
|
|
25
|
+
legend: {
|
|
26
|
+
...commonChartOptions.legend,
|
|
27
|
+
...bottomLegendRow,
|
|
28
|
+
symbolWidth: 18,
|
|
29
|
+
},
|
|
30
|
+
xAxis: {
|
|
31
|
+
labels: {
|
|
32
|
+
style: xAxisLabelStyle,
|
|
33
|
+
},
|
|
34
|
+
title: {
|
|
35
|
+
margin: 12,
|
|
36
|
+
style: xAxisTitleStyle,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
yAxis: {
|
|
40
|
+
labels: {
|
|
41
|
+
align: 'right',
|
|
42
|
+
distance: 12,
|
|
43
|
+
style: yAxisLabelStyle,
|
|
44
|
+
},
|
|
45
|
+
title: {
|
|
46
|
+
margin: 12,
|
|
47
|
+
style: yAxisTitleStyle,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
drilldown: {
|
|
51
|
+
activeAxisLabelStyle: activeLabelStyle,
|
|
52
|
+
activeDataLabelStyle: activeLabelStyle,
|
|
53
|
+
breadcrumbs: {
|
|
54
|
+
floating: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const columnPlotWidth = 28;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.rightLegendColumn = exports.getDonutChartOptions = void 0;
|
|
7
|
+
var _charts = require("./charts");
|
|
8
|
+
var _helpers = require("./helpers");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Defining these constants here so that internal calculations are self explanatory.
|
|
12
|
+
*/
|
|
13
|
+
const INNER_SIZE = 0.5; // set .5 here for 50% inner size w.r.t the pie chart outer circle.
|
|
14
|
+
const LEGEND_WIDTH = 0.4; // set .4 here for 40% legend width w.r.t the plot width.
|
|
15
|
+
const CHART_WIDTH = 1 - LEGEND_WIDTH;
|
|
16
|
+
const CHART_CENTER = (1 - LEGEND_WIDTH) / 2;
|
|
17
|
+
const CHART_SIZE = 0.8; // chart size w.r.t area allocated to chart drawing;
|
|
18
|
+
|
|
19
|
+
const rightLegendColumn = {
|
|
20
|
+
layout: 'vertical',
|
|
21
|
+
align: 'right',
|
|
22
|
+
verticalAlign: 'middle',
|
|
23
|
+
itemMarginBottom: 12,
|
|
24
|
+
symbolPadding: 8,
|
|
25
|
+
symbolWidth: 8,
|
|
26
|
+
// take it as 10% of width as left margin
|
|
27
|
+
width: `${LEGEND_WIDTH * 90}%`
|
|
28
|
+
};
|
|
29
|
+
exports.rightLegendColumn = rightLegendColumn;
|
|
30
|
+
const commonLegendOption = _charts.commonChartOptions.legend;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This function modifies the the common chart behavior to donut chart default behavior.
|
|
34
|
+
* It will not take userPassed option into account.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const getDonutChartOptions = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
legend,
|
|
40
|
+
defaultCenterHTML,
|
|
41
|
+
subtitleSize,
|
|
42
|
+
centerTextX,
|
|
43
|
+
tooltip
|
|
44
|
+
} = _ref;
|
|
45
|
+
const legendOption = (0, _helpers.deepMerge)(_charts.commonChartOptions.legend, legend);
|
|
46
|
+
const isLegendEnabled = legendOption.enabled;
|
|
47
|
+
return {
|
|
48
|
+
..._charts.commonChartOptions,
|
|
49
|
+
chart: {
|
|
50
|
+
..._charts.commonChartOptions.chart,
|
|
51
|
+
type: 'pie',
|
|
52
|
+
spacing: [0, 0, 0, 0],
|
|
53
|
+
margin: [0, 0, 0, 0],
|
|
54
|
+
events: {
|
|
55
|
+
render() {
|
|
56
|
+
//$FlowFixMe[object-this-reference]
|
|
57
|
+
const chart = this;
|
|
58
|
+
const containerWidth = chart.renderTo.offsetWidth;
|
|
59
|
+
const desiredHeight = CHART_WIDTH * containerWidth;
|
|
60
|
+
// 5px adjustment required due to borderWidth mostly.
|
|
61
|
+
const centerTextX = isLegendEnabled ? parseInt(chart.plotWidth) * CHART_CENTER + 5 : 0;
|
|
62
|
+
chart.update({
|
|
63
|
+
chart: {
|
|
64
|
+
height: desiredHeight // Set the height dynamically based on the container's width
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
subtitle: {
|
|
68
|
+
x: centerTextX
|
|
69
|
+
}
|
|
70
|
+
}, false);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
legend: {
|
|
75
|
+
...legendOption,
|
|
76
|
+
...rightLegendColumn
|
|
77
|
+
},
|
|
78
|
+
plotOptions: {
|
|
79
|
+
pie: {
|
|
80
|
+
innerSize: `${INNER_SIZE * 100}%`,
|
|
81
|
+
allowPointSelect: true,
|
|
82
|
+
cursor: 'pointer',
|
|
83
|
+
dataLabels: {
|
|
84
|
+
// auto disabling the data label when legend is enabled.
|
|
85
|
+
enabled: !isLegendEnabled,
|
|
86
|
+
distance: 20
|
|
87
|
+
},
|
|
88
|
+
showInLegend: true,
|
|
89
|
+
center: isLegendEnabled ? [`${CHART_CENTER * 100}%`, '50%'] : ['50%', '50%'],
|
|
90
|
+
size: `${CHART_SIZE * 100}%`,
|
|
91
|
+
borderWidth: 5,
|
|
92
|
+
borderRadius: 10,
|
|
93
|
+
minSize: 240,
|
|
94
|
+
clip: false
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
subtitle: {
|
|
98
|
+
useHTML: true,
|
|
99
|
+
text: defaultCenterHTML,
|
|
100
|
+
verticalAlign: 'middle',
|
|
101
|
+
align: isLegendEnabled ? 'left' : 'center',
|
|
102
|
+
style: {
|
|
103
|
+
alignContent: 'center',
|
|
104
|
+
// Note: Width was not working, have given miWidth and maxWidth
|
|
105
|
+
minWidth: isLegendEnabled ? `${CHART_WIDTH * CHART_SIZE * INNER_SIZE * 80}%` : `${CHART_SIZE * INNER_SIZE * 80}%`,
|
|
106
|
+
maxWidth: isLegendEnabled ? `${CHART_WIDTH * CHART_SIZE * INNER_SIZE * 80}%` : `${CHART_SIZE * INNER_SIZE * 80}%`,
|
|
107
|
+
...(isLegendEnabled ? {
|
|
108
|
+
transform: 'translate(-50%)'
|
|
109
|
+
} : {})
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.getDonutChartOptions = getDonutChartOptions;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ChartOptions,
|
|
5
|
+
LegendOptionsType,
|
|
6
|
+
Tooltip,
|
|
7
|
+
} from '../../types/charts';
|
|
8
|
+
|
|
9
|
+
import {commonChartOptions} from './charts';
|
|
10
|
+
import {deepMerge} from './helpers';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
type DonutChartDataType = {
|
|
14
|
+
name?: string,
|
|
15
|
+
color?: string,
|
|
16
|
+
y?: number,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type DonutChartPropsType = {
|
|
20
|
+
legend?: LegendOptionsType,
|
|
21
|
+
defaultCenterHTML?: string,
|
|
22
|
+
subtitleSize?: string,
|
|
23
|
+
centerTextX?: number,
|
|
24
|
+
tooltip?: Tooltip,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Defining these constants here so that internal calculations are self explanatory.
|
|
29
|
+
*/
|
|
30
|
+
const INNER_SIZE = 0.5; // set .5 here for 50% inner size w.r.t the pie chart outer circle.
|
|
31
|
+
const LEGEND_WIDTH = 0.4; // set .4 here for 40% legend width w.r.t the plot width.
|
|
32
|
+
const CHART_WIDTH = 1 - LEGEND_WIDTH;
|
|
33
|
+
const CHART_CENTER = (1 - LEGEND_WIDTH) / 2;
|
|
34
|
+
const CHART_SIZE = 0.8; // chart size w.r.t area allocated to chart drawing;
|
|
35
|
+
|
|
36
|
+
export const rightLegendColumn = {
|
|
37
|
+
layout: 'vertical',
|
|
38
|
+
align: 'right',
|
|
39
|
+
verticalAlign: 'middle',
|
|
40
|
+
itemMarginBottom: 12,
|
|
41
|
+
symbolPadding: 8,
|
|
42
|
+
symbolWidth: 8,
|
|
43
|
+
// take it as 10% of width as left margin
|
|
44
|
+
width: `${LEGEND_WIDTH * 90}%`,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const commonLegendOption = commonChartOptions.legend;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* This function modifies the the common chart behavior to donut chart default behavior.
|
|
51
|
+
* It will not take userPassed option into account.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export const getDonutChartOptions = ({
|
|
55
|
+
legend,
|
|
56
|
+
defaultCenterHTML,
|
|
57
|
+
subtitleSize,
|
|
58
|
+
centerTextX,
|
|
59
|
+
tooltip,
|
|
60
|
+
}: //$FlowFixMe[prop-missing]
|
|
61
|
+
DonutChartPropsType): ChartOptions => {
|
|
62
|
+
const legendOption = deepMerge(commonChartOptions.legend, legend);
|
|
63
|
+
const isLegendEnabled = legendOption.enabled;
|
|
64
|
+
return {
|
|
65
|
+
...commonChartOptions,
|
|
66
|
+
chart: {
|
|
67
|
+
...commonChartOptions.chart,
|
|
68
|
+
type: 'pie',
|
|
69
|
+
spacing: [0, 0, 0, 0],
|
|
70
|
+
margin: [0, 0, 0, 0],
|
|
71
|
+
events: {
|
|
72
|
+
render() {
|
|
73
|
+
//$FlowFixMe[object-this-reference]
|
|
74
|
+
const chart = this;
|
|
75
|
+
const containerWidth = chart.renderTo.offsetWidth;
|
|
76
|
+
const desiredHeight = CHART_WIDTH * containerWidth;
|
|
77
|
+
// 5px adjustment required due to borderWidth mostly.
|
|
78
|
+
const centerTextX = isLegendEnabled
|
|
79
|
+
? parseInt(chart.plotWidth) * CHART_CENTER + 5
|
|
80
|
+
: 0;
|
|
81
|
+
chart.update(
|
|
82
|
+
{
|
|
83
|
+
chart: {
|
|
84
|
+
height: desiredHeight, // Set the height dynamically based on the container's width
|
|
85
|
+
},
|
|
86
|
+
subtitle: {
|
|
87
|
+
x: centerTextX,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
false,
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
legend: {
|
|
96
|
+
...legendOption,
|
|
97
|
+
...rightLegendColumn,
|
|
98
|
+
},
|
|
99
|
+
plotOptions: {
|
|
100
|
+
pie: {
|
|
101
|
+
innerSize: `${INNER_SIZE * 100}%`,
|
|
102
|
+
allowPointSelect: true,
|
|
103
|
+
cursor: 'pointer',
|
|
104
|
+
dataLabels: {
|
|
105
|
+
// auto disabling the data label when legend is enabled.
|
|
106
|
+
enabled: !isLegendEnabled,
|
|
107
|
+
distance: 20,
|
|
108
|
+
},
|
|
109
|
+
showInLegend: true,
|
|
110
|
+
center: isLegendEnabled
|
|
111
|
+
? [`${CHART_CENTER * 100}%`, '50%']
|
|
112
|
+
: ['50%', '50%'],
|
|
113
|
+
size: `${CHART_SIZE * 100}%`,
|
|
114
|
+
borderWidth: 5,
|
|
115
|
+
borderRadius: 10,
|
|
116
|
+
minSize: 240,
|
|
117
|
+
clip: false,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
subtitle: {
|
|
121
|
+
useHTML: true,
|
|
122
|
+
text: defaultCenterHTML,
|
|
123
|
+
verticalAlign: 'middle',
|
|
124
|
+
align: isLegendEnabled ? 'left' : 'center',
|
|
125
|
+
style: {
|
|
126
|
+
alignContent: 'center',
|
|
127
|
+
// Note: Width was not working, have given miWidth and maxWidth
|
|
128
|
+
minWidth: isLegendEnabled
|
|
129
|
+
? `${CHART_WIDTH * CHART_SIZE * INNER_SIZE * 80}%`
|
|
130
|
+
: `${CHART_SIZE * INNER_SIZE * 80}%`,
|
|
131
|
+
maxWidth: isLegendEnabled
|
|
132
|
+
? `${CHART_WIDTH * CHART_SIZE * INNER_SIZE * 80}%`
|
|
133
|
+
: `${CHART_SIZE * INNER_SIZE * 80}%`,
|
|
134
|
+
...(isLegendEnabled ? {transform: 'translate(-50%)'} : {}),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.yAxisTitleStyle = exports.yAxisLabelStyle = exports.xAxisTitleStyle = exports.xAxisLabelStyle = exports.rightLineLegendColumn = exports.deepMerge = exports.bottomLegendRow = exports.activeLabelStyle = void 0;
|
|
7
|
+
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
8
|
+
var _color = require("../../styles/variables/_color");
|
|
9
|
+
var _typography = require("./typography");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const deepMerge = function (obj1, obj2) {
|
|
13
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
14
|
+
args[_key - 2] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
return (
|
|
17
|
+
// {} is used here to ensure obj1 is not modified
|
|
18
|
+
(0, _merge.default)({}, obj1, obj2, ...args)
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
exports.deepMerge = deepMerge;
|
|
22
|
+
const rightLineLegendColumn = {
|
|
23
|
+
layout: 'vertical',
|
|
24
|
+
align: 'right',
|
|
25
|
+
verticalAlign: 'middle',
|
|
26
|
+
itemMarginBottom: 12,
|
|
27
|
+
symbolPadding: 4,
|
|
28
|
+
symbolWidth: 16,
|
|
29
|
+
width: '40%'
|
|
30
|
+
};
|
|
31
|
+
exports.rightLineLegendColumn = rightLineLegendColumn;
|
|
32
|
+
const bottomLegendRow = {
|
|
33
|
+
layout: 'horizontal',
|
|
34
|
+
align: 'center',
|
|
35
|
+
verticalAlign: 'bottom',
|
|
36
|
+
itemDistance: 20,
|
|
37
|
+
symbolPadding: 4,
|
|
38
|
+
symbolWidth: 16
|
|
39
|
+
};
|
|
40
|
+
exports.bottomLegendRow = bottomLegendRow;
|
|
41
|
+
const yAxisTitleStyle = {
|
|
42
|
+
..._typography.bodySmall,
|
|
43
|
+
color: _color.colorTextSecondary
|
|
44
|
+
};
|
|
45
|
+
exports.yAxisTitleStyle = yAxisTitleStyle;
|
|
46
|
+
const xAxisTitleStyle = {
|
|
47
|
+
..._typography.bodySmall,
|
|
48
|
+
color: _color.colorTextSecondary
|
|
49
|
+
};
|
|
50
|
+
exports.xAxisTitleStyle = xAxisTitleStyle;
|
|
51
|
+
const yAxisLabelStyle = {
|
|
52
|
+
..._typography.formLabelSmall
|
|
53
|
+
};
|
|
54
|
+
exports.yAxisLabelStyle = yAxisLabelStyle;
|
|
55
|
+
const xAxisLabelStyle = {
|
|
56
|
+
..._typography.buttonTextExtraSmall
|
|
57
|
+
};
|
|
58
|
+
exports.xAxisLabelStyle = xAxisLabelStyle;
|
|
59
|
+
const activeLabelStyle = {
|
|
60
|
+
..._typography.buttonTextExtraSmall,
|
|
61
|
+
..._typography.underline,
|
|
62
|
+
color: _color.colorTextPrimary,
|
|
63
|
+
fill: _color.colorTextPrimary
|
|
64
|
+
};
|
|
65
|
+
exports.activeLabelStyle = activeLabelStyle;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import merge from 'lodash/merge';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
colorTextPrimary,
|
|
7
|
+
colorTextSecondary,
|
|
8
|
+
} from '../../styles/variables/_color';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
bodySmall,
|
|
12
|
+
buttonTextExtraSmall,
|
|
13
|
+
formLabelSmall,
|
|
14
|
+
underline,
|
|
15
|
+
} from './typography';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const deepMerge = <T: {}>(
|
|
19
|
+
obj1?: $Shape<T>,
|
|
20
|
+
obj2?: $Shape<T>,
|
|
21
|
+
...args: Array<?$Shape<T>>
|
|
22
|
+
): T =>
|
|
23
|
+
// {} is used here to ensure obj1 is not modified
|
|
24
|
+
merge({}, obj1, obj2, ...args);
|
|
25
|
+
|
|
26
|
+
export const rightLineLegendColumn = {
|
|
27
|
+
layout: 'vertical',
|
|
28
|
+
align: 'right',
|
|
29
|
+
verticalAlign: 'middle',
|
|
30
|
+
itemMarginBottom: 12,
|
|
31
|
+
symbolPadding: 4,
|
|
32
|
+
symbolWidth: 16,
|
|
33
|
+
width: '40%',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const bottomLegendRow = {
|
|
37
|
+
layout: 'horizontal',
|
|
38
|
+
align: 'center',
|
|
39
|
+
verticalAlign: 'bottom',
|
|
40
|
+
itemDistance: 20,
|
|
41
|
+
symbolPadding: 4,
|
|
42
|
+
symbolWidth: 16,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const yAxisTitleStyle = {
|
|
46
|
+
...bodySmall,
|
|
47
|
+
color: colorTextSecondary,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const xAxisTitleStyle = {
|
|
51
|
+
...bodySmall,
|
|
52
|
+
color: colorTextSecondary,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const yAxisLabelStyle = {
|
|
56
|
+
...formLabelSmall,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const xAxisLabelStyle = {
|
|
60
|
+
...buttonTextExtraSmall,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const activeLabelStyle = {
|
|
64
|
+
...buttonTextExtraSmall,
|
|
65
|
+
...underline,
|
|
66
|
+
color: colorTextPrimary,
|
|
67
|
+
fill: colorTextPrimary,
|
|
68
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _charts = require("./charts");
|
|
7
|
+
Object.keys(_charts).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _charts[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _charts[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 _helpers = require("./helpers");
|
|
40
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _helpers[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _lineChart = require("./lineChart");
|
|
51
|
+
Object.keys(_lineChart).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _lineChart[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _lineChart[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _spiderChart = require("./spiderChart");
|
|
62
|
+
Object.keys(_spiderChart).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _spiderChart[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _spiderChart[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _typography = require("./typography");
|
|
73
|
+
Object.keys(_typography).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _typography[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _typography[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLineChartOptions = void 0;
|
|
7
|
+
var _charts = require("./charts");
|
|
8
|
+
var _helpers = require("./helpers");
|
|
9
|
+
var _typography = require("./typography");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This function modifies the the common chart behavior to line chart default behavior.
|
|
13
|
+
* It will not take userPassed option into account.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const getLineChartOptions = () => ({
|
|
17
|
+
..._charts.commonChartOptions,
|
|
18
|
+
chart: {
|
|
19
|
+
type: 'line'
|
|
20
|
+
},
|
|
21
|
+
legend: {
|
|
22
|
+
..._charts.commonChartOptions.legend,
|
|
23
|
+
..._helpers.bottomLegendRow,
|
|
24
|
+
symbolWidth: 18
|
|
25
|
+
},
|
|
26
|
+
xAxis: {
|
|
27
|
+
labels: {
|
|
28
|
+
style: _typography.formLabelSmall
|
|
29
|
+
},
|
|
30
|
+
title: {
|
|
31
|
+
margin: 12,
|
|
32
|
+
style: _helpers.xAxisTitleStyle
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
yAxis: {
|
|
36
|
+
labels: {
|
|
37
|
+
align: 'right',
|
|
38
|
+
distance: 12,
|
|
39
|
+
style: _helpers.yAxisLabelStyle
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
margin: 12,
|
|
43
|
+
style: _helpers.yAxisTitleStyle
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
exports.getLineChartOptions = getLineChartOptions;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import type {ChartOptions} from '../../types/charts';
|
|
4
|
+
|
|
5
|
+
import {commonChartOptions} from './charts';
|
|
6
|
+
import {
|
|
7
|
+
bottomLegendRow,
|
|
8
|
+
xAxisTitleStyle,
|
|
9
|
+
yAxisLabelStyle,
|
|
10
|
+
yAxisTitleStyle,
|
|
11
|
+
} from './helpers';
|
|
12
|
+
import {formLabelSmall} from './typography';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This function modifies the the common chart behavior to line chart default behavior.
|
|
16
|
+
* It will not take userPassed option into account.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const getLineChartOptions = (): ChartOptions => ({
|
|
20
|
+
...commonChartOptions,
|
|
21
|
+
chart: {
|
|
22
|
+
type: 'line',
|
|
23
|
+
},
|
|
24
|
+
legend: {
|
|
25
|
+
...commonChartOptions.legend,
|
|
26
|
+
...bottomLegendRow,
|
|
27
|
+
symbolWidth: 18,
|
|
28
|
+
},
|
|
29
|
+
xAxis: {
|
|
30
|
+
labels: {
|
|
31
|
+
style: formLabelSmall,
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
margin: 12,
|
|
35
|
+
style: xAxisTitleStyle,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
yAxis: {
|
|
39
|
+
labels: {
|
|
40
|
+
align: 'right',
|
|
41
|
+
distance: 12,
|
|
42
|
+
style: yAxisLabelStyle,
|
|
43
|
+
},
|
|
44
|
+
title: {
|
|
45
|
+
margin: 12,
|
|
46
|
+
style: yAxisTitleStyle,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|