@spaced-out/ui-design-system 0.1.94-beta.0 → 0.1.94-beta.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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.94-beta.1](https://github.com/spaced-out/ui-design-system/compare/v0.1.94-beta.0...v0.1.94-beta.1) (2024-05-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * **charts:** added loading prop to handle loading state for charts ([#201](https://github.com/spaced-out/ui-design-system/issues/201)) ([3d41fc1](https://github.com/spaced-out/ui-design-system/commit/3d41fc1b4ab64b97e80c09ba29f6b664e1b15465))
11
+
5
12
  ### [0.1.94-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.1.93...v0.1.94-beta.0) (2024-05-13)
6
13
 
7
14
 
@@ -13,6 +13,7 @@ var _size = require("../../styles/variables/_size");
13
13
  var _classify = _interopRequireDefault(require("../../utils/classify"));
14
14
  var _ButtonDropdown = require("../ButtonDropdown");
15
15
  var _Card = require("../Card");
16
+ var _CircularLoader = require("../CircularLoader");
16
17
  var _ChartWrapperModule = _interopRequireDefault(require("./ChartWrapper.module.css"));
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  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); }
@@ -82,6 +83,7 @@ const CustomExportButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
82
83
  }
83
84
  };
84
85
  return /*#__PURE__*/React.createElement(_ButtonDropdown.ButtonDropdown, {
86
+ ariaLabel: "Export Chart Menu",
85
87
  menu: {
86
88
  isFluid: true,
87
89
  menuDisabled: false,
@@ -98,6 +100,7 @@ const CustomExportButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
98
100
  });
99
101
  const ChartWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
100
102
  let {
103
+ isLoading,
101
104
  title,
102
105
  children,
103
106
  classNames,
@@ -108,7 +111,10 @@ const ChartWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
108
111
  classNames: {
109
112
  wrapper: (0, _classify.default)(_ChartWrapperModule.default.wrapper, classNames?.wrapper)
110
113
  }
111
- }, /*#__PURE__*/React.createElement(_Card.CardHeader, {
114
+ }, isLoading ? /*#__PURE__*/React.createElement(_CircularLoader.CircularLoader, {
115
+ size: "large",
116
+ className: (0, _classify.default)(_ChartWrapperModule.default.loader, classNames?.loader)
117
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Card.CardHeader, {
112
118
  className: classNames?.header
113
119
  }, /*#__PURE__*/React.createElement(_Card.CardTitle, {
114
120
  className: classNames?.title
@@ -119,6 +125,6 @@ const ChartWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
119
125
  customExportOptions: customExportOptions
120
126
  }), headerActions ? headerActions : null)), /*#__PURE__*/React.createElement(_Card.CardContent, {
121
127
  className: (0, _classify.default)(_ChartWrapperModule.default.chartContent, classNames?.content)
122
- }, children));
128
+ }, children)));
123
129
  });
124
130
  exports.ChartWrapper = ChartWrapper;
@@ -14,6 +14,7 @@ import {size180} from '../../styles/variables/_size';
14
14
  import classify from '../../utils/classify';
15
15
  import {ANCHOR_POSITION_TYPE, ButtonDropdown} from '../ButtonDropdown';
16
16
  import {Card, CardActions, CardContent, CardHeader, CardTitle} from '../Card';
17
+ import {CircularLoader} from '../CircularLoader';
17
18
  import type {MenuOption} from '../Menu';
18
19
 
19
20
  import css from './ChartWrapper.module.css';
@@ -89,6 +90,7 @@ const CustomExportButton = React.forwardRef<
89
90
 
90
91
  return (
91
92
  <ButtonDropdown
93
+ ariaLabel="Export Chart Menu"
92
94
  menu={{
93
95
  isFluid: true,
94
96
  menuDisabled: false,
@@ -111,9 +113,11 @@ export type ChartWrapperClassNames = $ReadOnly<{
111
113
  title?: string,
112
114
  actions?: string,
113
115
  content?: string,
116
+ loader?: string,
114
117
  }>;
115
118
 
116
119
  type ChartWrapperProps = {
120
+ isLoading?: boolean,
117
121
  title: React.Node,
118
122
  children?: React.Node,
119
123
  classNames?: ChartWrapperClassNames,
@@ -127,6 +131,7 @@ export const ChartWrapper: React$AbstractComponent<
127
131
  > = React.forwardRef<ChartWrapperProps, HTMLDivElement>(
128
132
  (
129
133
  {
134
+ isLoading,
130
135
  title,
131
136
  children,
132
137
  classNames,
@@ -136,21 +141,32 @@ export const ChartWrapper: React$AbstractComponent<
136
141
  ref,
137
142
  ): React.Node => (
138
143
  <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>
144
+ {isLoading ? (
145
+ <CircularLoader
146
+ size="large"
147
+ className={classify(css.loader, classNames?.loader)}
148
+ />
149
+ ) : (
150
+ <>
151
+ <CardHeader className={classNames?.header}>
152
+ <CardTitle className={classNames?.title}>{title}</CardTitle>
153
+ <CardActions
154
+ className={classify(css.chartCardActions, classNames?.actions)}
155
+ >
156
+ <CustomExportButton
157
+ ref={ref}
158
+ customExportOptions={customExportOptions}
159
+ />
160
+ {headerActions ? headerActions : null}
161
+ </CardActions>
162
+ </CardHeader>
163
+ <CardContent
164
+ className={classify(css.chartContent, classNames?.content)}
165
+ >
166
+ {children}
167
+ </CardContent>
168
+ </>
169
+ )}
154
170
  </Card>
155
171
  ),
156
172
  );
@@ -1,5 +1,5 @@
1
1
  @value (spaceXSmall) from '../../styles/variables/_space.css';
2
- @value (size960) from '../../styles/variables/_size.css';
2
+ @value (size4,size5,size50,size400,size960) from '../../styles/variables/_size.css';
3
3
 
4
4
  .wrapper {
5
5
  display: flex;
@@ -17,3 +17,10 @@
17
17
  overflow-x: auto;
18
18
  display: flex;
19
19
  }
20
+
21
+ .loader {
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ height: calc(size4 + size5 + size50 + size400);
26
+ }
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _charts = require("../../types/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
+ });
6
17
  var _ChartWrapper = require("../ChartWrapper");
7
18
  Object.keys(_ChartWrapper).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -1,5 +1,6 @@
1
1
  // @flow strict
2
2
 
3
+ export * from '../../types/charts';
3
4
  export * from '../ChartWrapper';
4
5
  export * from '../ColumnChart';
5
6
  export * from '../DonutChart';
@@ -21,6 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
 
22
22
  const ColumnChart = _ref => {
23
23
  let {
24
+ isLoading,
24
25
  classNames,
25
26
  cardTitle,
26
27
  customExportOptions,
@@ -65,6 +66,7 @@ const ColumnChart = _ref => {
65
66
  ...wrapperClassNames
66
67
  } = classNames || {};
67
68
  return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
69
+ isLoading: isLoading,
68
70
  title: cardTitle,
69
71
  ref: chartRef,
70
72
  classNames: wrapperClassNames,
@@ -6,7 +6,7 @@ import Highcharts from 'highcharts';
6
6
  //$FlowFixMe[untyped-import]
7
7
  import HighchartsReact from 'highcharts-react-official';
8
8
 
9
- import type {Drilldown} from '../../types/charts';
9
+ import type {DataOptionsType, Drilldown} from '../../types/charts';
10
10
  import {
11
11
  columnPlotWidth,
12
12
  getColumnChartOptions,
@@ -25,22 +25,24 @@ type ClassNames = $ReadOnly<{
25
25
  highChart?: string,
26
26
  }>;
27
27
 
28
- type ColumnSeriesItem = {
28
+ type ColumnSeries = {
29
29
  name: string,
30
- data: [],
30
+ data: DataOptionsType[],
31
31
  };
32
32
 
33
33
  export type ColumnChartProps = {
34
+ isLoading?: boolean,
34
35
  classNames?: ClassNames,
35
- cardTitle?: string,
36
+ cardTitle?: React.Node,
36
37
  customExportOptions?: Array<ExportOptionType> | null,
37
- series: Array<ColumnSeriesItem>,
38
- drilldown: Drilldown,
38
+ series: Array<ColumnSeries>,
39
+ drilldown?: Drilldown,
39
40
  headerActions?: React.Node,
40
41
  ...
41
42
  };
42
43
 
43
44
  export const ColumnChart = ({
45
+ isLoading,
44
46
  classNames,
45
47
  cardTitle,
46
48
  customExportOptions,
@@ -90,6 +92,7 @@ export const ColumnChart = ({
90
92
 
91
93
  return (
92
94
  <ChartWrapper
95
+ isLoading={isLoading}
93
96
  title={cardTitle}
94
97
  ref={chartRef}
95
98
  classNames={wrapperClassNames}
@@ -22,6 +22,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22
22
 
23
23
  const DonutChart = _ref => {
24
24
  let {
25
+ isLoading,
25
26
  classNames,
26
27
  cardTitle,
27
28
  customExportOptions,
@@ -72,15 +73,16 @@ const DonutChart = _ref => {
72
73
  legend,
73
74
  defaultCenterHTML
74
75
  });
76
+
77
+ //$FlowFixMe[cannot-spread-inexact]
75
78
  const chartOptions = (0, _charts.mergeChartUserOptions)(defaultLineChartOptions, {
76
79
  series: donutChartSeries,
77
80
  drilldown: donutDrilldown,
78
81
  ...userOptions
79
82
  });
80
83
  return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
81
- title: cardTitle
82
- //$FlowFixMe[incompatible-type]
83
- ,
84
+ isLoading: isLoading,
85
+ title: cardTitle,
84
86
  ref: chartRef,
85
87
  customExportOptions: customExportOptions,
86
88
  headerActions: headerActions,
@@ -29,10 +29,6 @@ type ClassNames = $ReadOnly<{
29
29
  highChart?: string,
30
30
  subtitleClassNames?: SubtitleClassNames,
31
31
  }>;
32
- type DonutChartData = {
33
- name: string,
34
- value: number,
35
- };
36
32
 
37
33
  export type SubtitleClassNames = {
38
34
  wrapper?: string,
@@ -41,6 +37,7 @@ export type SubtitleClassNames = {
41
37
  };
42
38
 
43
39
  export type DonutChartProps = {
40
+ isLoading?: boolean,
44
41
  classNames?: ClassNames,
45
42
  cardTitle?: React.Node,
46
43
  customExportOptions?: Array<ExportOptionType> | null,
@@ -48,11 +45,13 @@ export type DonutChartProps = {
48
45
  centerText?: string,
49
46
  centerSubtext?: string,
50
47
  series: Array<SeriesOptionsType>,
51
- drilldown: Drilldown,
48
+ drilldown?: Drilldown,
52
49
  legend?: LegendOptionsType,
50
+ ...
53
51
  };
54
52
 
55
53
  export const DonutChart = ({
54
+ isLoading,
56
55
  classNames,
57
56
  cardTitle,
58
57
  customExportOptions,
@@ -119,6 +118,7 @@ export const DonutChart = ({
119
118
  defaultCenterHTML,
120
119
  });
121
120
 
121
+ //$FlowFixMe[cannot-spread-inexact]
122
122
  const chartOptions = mergeChartUserOptions(defaultLineChartOptions, {
123
123
  series: donutChartSeries,
124
124
  drilldown: donutDrilldown,
@@ -127,8 +127,8 @@ export const DonutChart = ({
127
127
 
128
128
  return (
129
129
  <ChartWrapper
130
+ isLoading={isLoading}
130
131
  title={cardTitle}
131
- //$FlowFixMe[incompatible-type]
132
132
  ref={chartRef}
133
133
  customExportOptions={customExportOptions}
134
134
  headerActions={headerActions}
@@ -21,6 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
 
22
22
  const LineChart = _ref => {
23
23
  let {
24
+ isLoading,
24
25
  classNames,
25
26
  cardTitle,
26
27
  customExportOptions,
@@ -55,6 +56,7 @@ const LineChart = _ref => {
55
56
  ...wrapperClassNames
56
57
  } = classNames || {};
57
58
  return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
59
+ isLoading: isLoading,
58
60
  title: cardTitle,
59
61
  ref: chartRef,
60
62
  classNames: wrapperClassNames,
@@ -6,7 +6,7 @@ import Highcharts from 'highcharts';
6
6
  //$FlowFixMe[untyped-import]
7
7
  import HighchartsReact from 'highcharts-react-official';
8
8
 
9
- import type {Drilldown} from '../../types/charts';
9
+ import type {DataOptionsType, Drilldown} from '../../types/charts';
10
10
  import {
11
11
  getDataVizColor,
12
12
  getLineChartOptions,
@@ -26,20 +26,22 @@ type ClassNames = $ReadOnly<{
26
26
 
27
27
  type LineSeriesItem = {
28
28
  name: string,
29
- data: [],
29
+ data: DataOptionsType[],
30
30
  };
31
31
 
32
32
  export type LineChartProps = {
33
+ isLoading?: boolean,
33
34
  classNames?: ClassNames,
34
- cardTitle?: string,
35
+ cardTitle?: React.Node,
35
36
  customExportOptions?: Array<ExportOptionType> | null,
36
37
  series: Array<LineSeriesItem>,
37
38
  headerActions?: React.Node,
38
- drilldown: Drilldown,
39
+ drilldown?: Drilldown,
39
40
  ...
40
41
  };
41
42
 
42
43
  export const LineChart = ({
44
+ isLoading,
43
45
  classNames,
44
46
  cardTitle,
45
47
  customExportOptions,
@@ -77,6 +79,7 @@ export const LineChart = ({
77
79
 
78
80
  return (
79
81
  <ChartWrapper
82
+ isLoading={isLoading}
80
83
  title={cardTitle}
81
84
  ref={chartRef}
82
85
  classNames={wrapperClassNames}
@@ -27,6 +27,7 @@ if (!!_highchartsMore.default && !!_highcharts.default && typeof _highchartsMore
27
27
  }
28
28
  const SpiderChart = _ref => {
29
29
  let {
30
+ isLoading,
30
31
  classNames,
31
32
  cardTitle,
32
33
  customExportOptions,
@@ -54,6 +55,7 @@ const SpiderChart = _ref => {
54
55
  ...wrapperClassNames
55
56
  } = classNames || {};
56
57
  return /*#__PURE__*/React.createElement(_ChartWrapper.ChartWrapper, {
58
+ isLoading: isLoading,
57
59
  title: cardTitle,
58
60
  ref: chartRef,
59
61
  customExportOptions: customExportOptions,
@@ -8,6 +8,7 @@ import highChartsMore from 'highcharts/highcharts-more';
8
8
  //$FlowFixMe[untyped-import]
9
9
  import HighchartsReact from 'highcharts-react-official';
10
10
 
11
+ import type {DataOptionsType} from '../../types/charts';
11
12
  import {
12
13
  getDataVizColor,
13
14
  getSpiderChartOptions,
@@ -36,32 +37,21 @@ type ClassNames = $ReadOnly<{
36
37
 
37
38
  type SpiderSeriesItem = {
38
39
  name: string,
39
- data: [],
40
+ data: DataOptionsType[],
40
41
  };
41
42
 
42
43
  export type SpiderChartProps = {
44
+ isLoading?: boolean,
43
45
  classNames?: ClassNames,
44
46
  cardTitle?: React.Node,
45
47
  customExportOptions?: Array<ExportOptionType> | null,
46
48
  headerActions?: React.Node,
47
49
  series: Array<SpiderSeriesItem>,
48
- legend: {...},
49
- xAxis: {
50
- categories: Array<string>,
51
- tickmarkPlacement: string,
52
- lineWidth: number,
53
- ...
54
- },
55
- yAxis: {
56
- gridLineInterpolation: 'circle' | 'polygon',
57
- lineWidth: 0,
58
- min: 0,
59
- ...
60
- },
61
50
  ...
62
51
  };
63
52
 
64
53
  export const SpiderChart = ({
54
+ isLoading,
65
55
  classNames,
66
56
  cardTitle,
67
57
  customExportOptions,
@@ -91,6 +81,7 @@ export const SpiderChart = ({
91
81
 
92
82
  return (
93
83
  <ChartWrapper
84
+ isLoading={isLoading}
94
85
  title={cardTitle}
95
86
  ref={chartRef}
96
87
  customExportOptions={customExportOptions}
@@ -1,13 +1,13 @@
1
1
  @value (colorFillPrimary, colorBackgroundTertiary) from '../../styles/variables/_color.css';
2
2
  @value (sizeFluid) from '../../styles/variables/_size.css';
3
- @value (spaceLarge, spaceMedium, spaceXSmall, spaceSmall) from '../../styles/variables/_space.css';
3
+ @value (spaceMedium, spaceXSmall, spaceSmall) from '../../styles/variables/_space.css';
4
4
 
5
5
  .wrapper {
6
6
  display: flex;
7
7
  width: sizeFluid;
8
8
  align-items: center;
9
9
  justify-content: space-between;
10
- padding: spaceMedium spaceLarge;
10
+ padding: spaceMedium spaceMedium;
11
11
  gap: spaceXSmall;
12
12
  background: colorBackgroundTertiary;
13
13
  }
@@ -25,12 +25,13 @@ export type ChartOptions = {
25
25
  tooltip?: Tooltip,
26
26
  xAxis?: AxisOptions,
27
27
  yAxis?: AxisOptions,
28
+ zAxis?: AxisOptions,
28
29
  drilldown?: Drilldown,
29
30
  legend?: LegendOptionsType,
30
31
  plotOptions?: PlotOptionsType,
31
32
  series?: Array<SeriesOptionsType>,
32
33
  subtitle?: {
33
- useHTML: true,
34
+ useHTML: boolean,
34
35
  text?: string,
35
36
  verticalAlign: 'middle',
36
37
  align: string,
@@ -41,6 +42,8 @@ export type ChartOptions = {
41
42
  center: [string, string],
42
43
  size: string,
43
44
  },
45
+ credits?: Credits,
46
+ legend?: Legend,
44
47
  ...
45
48
  };
46
49
 
@@ -103,7 +106,13 @@ export type CSSObject = {
103
106
  ...
104
107
  };
105
108
 
106
- export type DataOptionsType = {y: number, name: string, color: string, ...};
109
+ export type DataOptionsType = {
110
+ y: number,
111
+ name: string,
112
+ color: string,
113
+ drilldown?: string,
114
+ ...
115
+ };
107
116
 
108
117
  export type SeriesOptionsType = {
109
118
  id?: string,
@@ -150,3 +159,39 @@ export type Tooltip = {
150
159
  shared?: boolean,
151
160
  ...
152
161
  };
162
+
163
+ export type Legend = {
164
+ align?: 'left' | 'center' | 'right',
165
+ alignColumns?: boolean,
166
+ backgroundColor?: string,
167
+ borderColor?: string,
168
+ borderRadius?: number,
169
+ borderWidth?: number,
170
+ className?: string,
171
+ enabled?: boolean,
172
+ floating?: boolean,
173
+ itemDistance?: number,
174
+ itemMarginBottom?: number,
175
+ itemMarginBottom?: number,
176
+ itemMarginBottom?: number,
177
+ labelFormat?: string,
178
+ layout?: 'horizontal' | 'vertical' | 'proximate',
179
+ margin?: number,
180
+ maxHeight?: number,
181
+ padding?: number,
182
+ reversed?: boolean,
183
+ x?: number,
184
+ y?: number,
185
+ ...
186
+ };
187
+
188
+ export type Credits = {
189
+ enabled?: boolean,
190
+ href?: string,
191
+ position?: {
192
+ align?: 'right' | 'left',
193
+ verticalAlign?: 'bottom' | 'top',
194
+ x?: number,
195
+ y?: number,
196
+ },
197
+ };
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mergeChartUserOptions = exports.getDataVizColor = exports.commonChartOptions = exports.breadcrumbStyle = exports.DATA_VIZ_COLORS = void 0;
7
- var _Charts = require("../../components/Charts");
8
7
  var _color = require("../../styles/variables/_color");
9
8
  var _helpers = require("./helpers");
10
9
  var _typography = require("./typography");
10
+ var _ChartTooltipModule = _interopRequireDefault(require("../../components/Charts/ChartTooltip.module.css"));
11
+ var _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  const DATA_VIZ_COLORS = [_color.colorDataViz1, _color.colorDataViz2, _color.colorDataViz3, _color.colorDataViz4, _color.colorDataViz5, _color.colorDataViz6, _color.colorDataViz7, _color.colorDataViz8];
13
15
  exports.DATA_VIZ_COLORS = DATA_VIZ_COLORS;
@@ -45,7 +47,11 @@ const commonChartOptions = {
45
47
  backgroundColor: _color.colorTooltipFill,
46
48
  useHTML: true,
47
49
  outside: true,
48
- ..._Charts.tooltipTheme
50
+ headerFormat: `<span class="${_typographyModule.default.bodySmall} ${_ChartTooltipModule.default.tooltipHeader}">{point.key}</span>`,
51
+ pointFormat: `<span class=${_ChartTooltipModule.default.tooltipPoint}>
52
+ <span style="background-color:{point.color};" class=${_ChartTooltipModule.default.indicatorCircle}></span>
53
+ <span class="${_ChartTooltipModule.default.tooltipContent} ${_typographyModule.default.bodyMedium}"> {series.name}: {point.y}</span>
54
+ </span>`
49
55
  },
50
56
  drilldown: {
51
57
  breadcrumbs: {
@@ -57,7 +63,6 @@ const commonChartOptions = {
57
63
  }
58
64
  },
59
65
  legend: {
60
- useHTML: true,
61
66
  itemStyle: {
62
67
  ..._typography.formLabelSmall,
63
68
  paddingTop: '1px'
@@ -1,6 +1,5 @@
1
1
  // @flow strict
2
2
 
3
- import {tooltipTheme} from '../../components/Charts';
4
3
  import {
5
4
  colorDataViz1,
6
5
  colorDataViz2,
@@ -18,6 +17,9 @@ import type {ChartOptions} from '../../types/charts';
18
17
  import {deepMerge} from './helpers';
19
18
  import {formLabelSmall, subTitleExtraSmall} from './typography';
20
19
 
20
+ import css from '../../components/Charts/ChartTooltip.module.css';
21
+ import typographyCss from '../../styles/typography.module.css';
22
+
21
23
 
22
24
  export const DATA_VIZ_COLORS = [
23
25
  colorDataViz1,
@@ -64,7 +66,11 @@ export const commonChartOptions: $Shape<ChartOptions> = {
64
66
  backgroundColor: colorTooltipFill,
65
67
  useHTML: true,
66
68
  outside: true,
67
- ...tooltipTheme,
69
+ headerFormat: `<span class="${typographyCss.bodySmall} ${css.tooltipHeader}">{point.key}</span>`,
70
+ pointFormat: `<span class=${css.tooltipPoint}>
71
+ <span style="background-color:{point.color};" class=${css.indicatorCircle}></span>
72
+ <span class="${css.tooltipContent} ${typographyCss.bodyMedium}"> {series.name}: {point.y}</span>
73
+ </span>`,
68
74
  },
69
75
  drilldown: {
70
76
  breadcrumbs: {
@@ -76,7 +82,6 @@ export const commonChartOptions: $Shape<ChartOptions> = {
76
82
  },
77
83
  },
78
84
  legend: {
79
- useHTML: true,
80
85
  itemStyle: {...formLabelSmall, paddingTop: '1px'},
81
86
  symbolHeight: 8,
82
87
  enabled: true,
@@ -26,21 +26,16 @@ const rightLegendColumn = {
26
26
  // take it as 10% of width as left margin
27
27
  width: `${LEGEND_WIDTH * 90}%`
28
28
  };
29
- exports.rightLegendColumn = rightLegendColumn;
30
- const commonLegendOption = _charts.commonChartOptions.legend;
31
29
 
32
30
  /**
33
31
  * This function modifies the the common chart behavior to donut chart default behavior.
34
32
  * It will not take userPassed option into account.
35
33
  */
36
-
34
+ exports.rightLegendColumn = rightLegendColumn;
37
35
  const getDonutChartOptions = _ref => {
38
36
  let {
39
37
  legend,
40
- defaultCenterHTML,
41
- subtitleSize,
42
- centerTextX,
43
- tooltip
38
+ defaultCenterHTML
44
39
  } = _ref;
45
40
  const legendOption = (0, _helpers.deepMerge)(_charts.commonChartOptions.legend, legend);
46
41
  const isLegendEnabled = legendOption.enabled;
@@ -1,27 +1,14 @@
1
1
  // @flow strict
2
2
 
3
- import type {
4
- ChartOptions,
5
- LegendOptionsType,
6
- Tooltip,
7
- } from '../../types/charts';
3
+ import type {ChartOptions, LegendOptionsType} from '../../types/charts';
8
4
 
9
5
  import {commonChartOptions} from './charts';
10
6
  import {deepMerge} from './helpers';
11
7
 
12
8
 
13
- type DonutChartDataType = {
14
- name?: string,
15
- color?: string,
16
- y?: number,
17
- };
18
-
19
9
  type DonutChartPropsType = {
20
10
  legend?: LegendOptionsType,
21
11
  defaultCenterHTML?: string,
22
- subtitleSize?: string,
23
- centerTextX?: number,
24
- tooltip?: Tooltip,
25
12
  };
26
13
 
27
14
  /**
@@ -44,8 +31,6 @@ export const rightLegendColumn = {
44
31
  width: `${LEGEND_WIDTH * 90}%`,
45
32
  };
46
33
 
47
- const commonLegendOption = commonChartOptions.legend;
48
-
49
34
  /**
50
35
  * This function modifies the the common chart behavior to donut chart default behavior.
51
36
  * It will not take userPassed option into account.
@@ -54,11 +39,7 @@ const commonLegendOption = commonChartOptions.legend;
54
39
  export const getDonutChartOptions = ({
55
40
  legend,
56
41
  defaultCenterHTML,
57
- subtitleSize,
58
- centerTextX,
59
- tooltip,
60
- }: //$FlowFixMe[prop-missing]
61
- DonutChartPropsType): ChartOptions => {
42
+ }: DonutChartPropsType): ChartOptions => {
62
43
  const legendOption = deepMerge(commonChartOptions.legend, legend);
63
44
  const isLegendEnabled = legendOption.enabled;
64
45
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.94-beta.0",
3
+ "version": "0.1.94-beta.1",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {