playbook_ui 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3954 → 14.5.0.pre.alpha.PLAY1510railsformloading3975

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -1
  3. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +1 -3
  4. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +184 -5
  5. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
  6. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +216 -5
  7. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +11 -3
  9. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +13 -3
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +30 -7
  11. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +0 -2
  12. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +8 -0
  13. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +1 -0
  14. data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
  15. data/app/pb_kits/playbook/pb_form/form.rb +2 -0
  16. data/app/pb_kits/playbook/pb_form/formHelper.js +41 -0
  17. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
  18. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
  19. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
  20. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
  21. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  23. data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +64 -3
  24. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +203 -5
  25. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
  26. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +154 -5
  27. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
  28. data/app/pb_kits/playbook/pb_map/pbMapTheme.ts +17 -195
  29. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +113 -5
  30. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
  31. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
  32. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
  33. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
  34. data/dist/chunks/_typeahead-CnC6UeRx.js +22 -0
  35. data/dist/chunks/_weekday_stacked-DzL3HGZ_.js +45 -0
  36. data/dist/chunks/lib-DJCA-0lC.js +29 -0
  37. data/dist/chunks/{pb_form_validation-Bu-tMfIi.js → pb_form_validation-CyF9hGTn.js} +1 -1
  38. data/dist/chunks/vendor.js +1 -1
  39. data/dist/playbook-doc.js +1 -1
  40. data/dist/playbook-rails-react-bindings.js +1 -1
  41. data/dist/playbook-rails.js +1 -1
  42. data/dist/playbook.css +1 -1
  43. data/lib/playbook/pb_forms_helper.rb +3 -1
  44. data/lib/playbook/version.rb +1 -1
  45. metadata +12 -7
  46. data/app/pb_kits/playbook/pb_dashboard/_highcharts_theme.scss +0 -52
  47. data/dist/chunks/_typeahead-D84d1KBa.js +0 -22
  48. data/dist/chunks/_weekday_stacked-CmT_2e83.js +0 -45
  49. data/dist/chunks/lib-BCt68dVK.js +0 -29
@@ -0,0 +1,41 @@
1
+ const formHelper = () => {
2
+ const loadingForm = document.querySelector(".pb_form_loading")
3
+ if (loadingForm) {
4
+ loadingForm.addEventListener("submit", function(event) {
5
+ event.preventDefault();
6
+
7
+ const submitButton = event['submitter'];
8
+ const cancelButton = event['target'].querySelector('button[type="reset"]');
9
+
10
+ if (submitButton) {
11
+ let currentClass = submitButton.className;
12
+ let newClass = currentClass.replace("_enabled", "_disabled_loading");
13
+
14
+ let cancelClass = cancelButton.className;
15
+ let newCancelClass = cancelClass.replace("_enabled", "_disabled");
16
+
17
+ submitButton.disabled = true;
18
+ submitButton.className = newClass;
19
+
20
+ if (cancelButton) {
21
+ cancelButton.disabled = true;
22
+ cancelButton.className = newCancelClass;
23
+ }
24
+
25
+ setTimeout(function() {
26
+ submitButton.disabled = false;
27
+ submitButton.className = currentClass;
28
+
29
+ if (cancelButton) {
30
+ cancelButton.disabled = false;
31
+ cancelButton.className = cancelClass;
32
+ }
33
+ }, 5000);
34
+ }
35
+
36
+ this.submit();
37
+ });
38
+ }
39
+ };
40
+
41
+ export default formHelper;
@@ -47,9 +47,13 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
47
47
 
48
48
  const iconClass = icon ? "_icon" : ""
49
49
  const closeIconSize = size === "small" ? "xs" : "sm"
50
+
51
+ const filteredProps: FormPillProps = {...props}
52
+ delete filteredProps.truncate
53
+
50
54
  const css = classnames(
51
55
  `pb_form_pill_kit_${color}${iconClass}`,
52
- globalProps(props),
56
+ globalProps(filteredProps),
53
57
  className,
54
58
  size === 'small' ? 'small' : null,
55
59
  textTransform,
@@ -77,6 +81,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
77
81
  className="pb_form_pill_text"
78
82
  size={4}
79
83
  text={name}
84
+ truncate={props.truncate}
80
85
  />
81
86
  </>
82
87
  )}
@@ -92,6 +97,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
92
97
  className="pb_form_pill_text"
93
98
  size={4}
94
99
  text={name}
100
+ truncate={props.truncate}
95
101
  />
96
102
  <Icon
97
103
  className="pb_form_pill_icon"
@@ -111,6 +117,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
111
117
  className="pb_form_pill_tag"
112
118
  size={4}
113
119
  text={text}
120
+ truncate={props.truncate}
114
121
  />
115
122
  </>
116
123
  )}
@@ -119,6 +126,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
119
126
  className="pb_form_pill_tag"
120
127
  size={4}
121
128
  text={text}
129
+ truncate={props.truncate}
122
130
  />
123
131
  )}
124
132
  <div
@@ -0,0 +1,19 @@
1
+ <%
2
+ names = [
3
+ { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
4
+ { label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
5
+ { label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
6
+ { label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
7
+ { label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
8
+ ]
9
+ %>
10
+
11
+ <%= pb_rails("typeahead", props: {
12
+ html_options: { style: { maxWidth: "240px" }},
13
+ id: "typeahead-form-pill",
14
+ is_multi: true,
15
+ options: names,
16
+ label: "Names",
17
+ pills: true,
18
+ truncate: 1,
19
+ }) %>
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import Typeahead from '../../pb_typeahead/_typeahead'
3
+
4
+ const names = [
5
+ { label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
6
+ { label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
7
+ { label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
8
+ { label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
9
+ { label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
10
+ ]
11
+
12
+ const FormPillTruncatedText = (props) => {
13
+ return (
14
+ <>
15
+ <Typeahead
16
+ htmlOptions={{ style: { maxWidth: "240px" }}}
17
+ isMulti
18
+ label="Names"
19
+ options={names}
20
+ truncate={1}
21
+ {...props}
22
+ />
23
+ </>
24
+ )
25
+ }
26
+
27
+ export default FormPillTruncatedText
@@ -0,0 +1 @@
1
+ For pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
@@ -3,6 +3,7 @@ examples:
3
3
  rails:
4
4
  - form_pill_user: Form Pill User
5
5
  - form_pill_size: Form Pill Size
6
+ - form_pill_truncated_text: Truncated Text
6
7
  - form_pill_tag: Form Pill Tag
7
8
  - form_pill_example: Example
8
9
  - form_pill_icon: Form Pill Icon
@@ -11,6 +12,7 @@ examples:
11
12
  react:
12
13
  - form_pill_user: Form Pill User
13
14
  - form_pill_size: Form Pill Size
15
+ - form_pill_truncated_text: Truncated Text
14
16
  - form_pill_tag: Form Pill Tag
15
17
  - form_pill_example: Example
16
18
  - form_pill_icon: Form Pill Icon
@@ -4,3 +4,4 @@ export { default as FormPillTag } from './_form_pill_tag.jsx'
4
4
  export { default as FormPillExample } from './_form_pill_example.jsx'
5
5
  export { default as FormPillIcon } from './_form_pill_icon.jsx'
6
6
  export { default as FormPillColors } from './_form_pill_colors.jsx'
7
+ export { default as FormPillTruncatedText } from './_form_pill_truncated_text.jsx'
@@ -1,9 +1,70 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from "react";
2
+ import classnames from "classnames";
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
+ import { globalProps } from "../utilities/globalProps";
5
+ import HighchartsReact from "highcharts-react-official";
6
+ import Highcharts from "highcharts/highcharts-gantt";
7
+
8
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
+
11
+ type GanttChartProps = {
12
+ aria?: { [key: string]: string };
13
+ className?: string;
14
+ customOptions: Partial<Highcharts.Options>;
15
+ dark?: boolean;
16
+ data?: { [key: string]: string };
17
+ htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
18
+ id?: string;
19
+ };
20
+
21
+ const GanttChart = (props: GanttChartProps) => {
22
+ const {
23
+ aria = {},
24
+ className,
25
+ customOptions = {},
26
+ dark = false,
27
+ data = {},
28
+ htmlOptions = {},
29
+ id,
30
+ } = props;
31
+
32
+ const ariaProps = buildAriaProps(aria);
33
+ const dataProps = buildDataProps(data);
34
+ const htmlProps = buildHtmlProps(htmlOptions);
35
+ const classes = classnames(
36
+ buildCss("pb_gantt_chart"),
37
+ globalProps(props),
38
+ className
39
+ );
40
+
41
+ const [options, setOptions] = useState<Highcharts.Options | undefined>(customOptions);
42
+
43
+ useEffect(() => {
44
+ setOptions(customOptions);
45
+ }, [customOptions]);
46
+
47
+ const setupTheme = () => {
48
+ dark
49
+ ? Highcharts.setOptions(highchartsDarkTheme)
50
+ : Highcharts.setOptions(highchartsTheme);
51
+ };
52
+ setupTheme();
2
53
 
3
- const GanttChart: React.FC = () => {
4
54
  return (
5
55
  <div>
6
- This is a simple div component.
56
+ <HighchartsReact
57
+ constructorType={"ganttChart"}
58
+ containerProps={{
59
+ className: classnames(globalProps(props), classes),
60
+ id: id,
61
+ ...ariaProps,
62
+ ...dataProps,
63
+ ...htmlProps,
64
+ }}
65
+ highcharts={Highcharts}
66
+ options={options}
67
+ />
7
68
  </div>
8
69
  );
9
70
  };
@@ -1,10 +1,208 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from "react";
2
+ import classnames from "classnames";
3
+ import HighchartsReact from "highcharts-react-official";
4
+ import Highcharts from "highcharts";
5
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
6
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
7
+ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
8
+ import highchartsMore from "highcharts/highcharts-more";
9
+ import solidGauge from "highcharts/modules/solid-gauge";
10
+ import defaultColors from "../tokens/exports/_colors.module.scss";
11
+ import typography from "../tokens/exports/_typography.module.scss";
12
+
13
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
14
+ import { globalProps } from "../utilities/globalProps";
15
+ import { GenericObject } from "../types";
16
+ import { merge } from 'lodash'
17
+
18
+ type GaugeProps = {
19
+ aria: { [key: string]: string };
20
+ className?: string;
21
+ chartData?: { name: string; value: number[] | number }[];
22
+ customOptions?: Partial<Highcharts.Options>;
23
+ dark?: boolean;
24
+ data?: { [key: string]: string };
25
+ disableAnimation?: boolean;
26
+ fullCircle?: boolean;
27
+ height?: string;
28
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
29
+ id?: string;
30
+ max?: number;
31
+ min?: number;
32
+ prefix?: string;
33
+ showLabels?: boolean;
34
+ style?: string;
35
+ suffix?: string;
36
+ title?: string;
37
+ tooltipHtml?: string;
38
+ colors: string[];
39
+ minorTickInterval?: number;
40
+ circumference: number[];
41
+ };
42
+
43
+ const Gauge = ({
44
+ aria = {},
45
+ chartData,
46
+ customOptions = {},
47
+ dark = false,
48
+ data = {},
49
+ disableAnimation = false,
50
+ fullCircle = false,
51
+ height = null,
52
+ htmlOptions = {},
53
+ id,
54
+ max = 100,
55
+ min = 0,
56
+ prefix = "",
57
+ showLabels = false,
58
+ style = "solidgauge",
59
+ suffix = "",
60
+ title = "",
61
+ tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
62
+ "<b>{point.y}</b>",
63
+ colors = [],
64
+ minorTickInterval = null,
65
+ circumference = fullCircle ? [0, 360] : [-100, 100],
66
+ ...props
67
+ }: GaugeProps): React.ReactElement => {
68
+ const ariaProps = buildAriaProps(aria);
69
+ const dataProps = buildDataProps(data)
70
+ const htmlProps = buildHtmlProps(htmlOptions);
71
+ highchartsMore(Highcharts);
72
+ solidGauge(Highcharts);
73
+ const setupTheme = () => {
74
+ dark
75
+ ? Highcharts.setOptions(highchartsDarkTheme)
76
+ : Highcharts.setOptions(highchartsTheme);
77
+ };
78
+ setupTheme();
79
+
80
+ //set tooltip directly to prevent being overriden by Highcharts defaults
81
+ Highcharts.setOptions({
82
+ tooltip: {
83
+ pointFormat: tooltipHtml,
84
+ followPointer: true,
85
+ },
86
+ });
87
+
88
+ const css = buildCss({
89
+ pb_gauge_kit: true,
90
+ });
91
+
92
+ const [options, setOptions] = useState({});
93
+
94
+ useEffect(() => {
95
+ const formattedChartData = chartData.map((obj: GenericObject) => {
96
+ obj.y = obj.value;
97
+ delete obj.value;
98
+ return obj;
99
+ });
100
+
101
+ const staticOptions = {
102
+ chart: {
103
+ events: {
104
+ load() {
105
+ setTimeout(this.reflow.bind(this), 0);
106
+ },
107
+ },
108
+ type: style,
109
+ height: height,
110
+ },
111
+ title: {
112
+ text: title,
113
+ },
114
+ yAxis: {
115
+ min: min,
116
+ max: max,
117
+ lineWidth: 0,
118
+ tickWidth: 0,
119
+ minorTickInterval: minorTickInterval,
120
+ tickAmount: 2,
121
+ tickPositions: [min, max],
122
+ labels: {
123
+ y: 26,
124
+ enabled: showLabels,
125
+ },
126
+ },
127
+ credits: false,
128
+ series: [
129
+ {
130
+ data: formattedChartData,
131
+ },
132
+ ],
133
+ pane: {
134
+ center: ["50%", "50%"],
135
+ size: "90%",
136
+ startAngle: circumference[0],
137
+ endAngle: circumference[1],
138
+ background: {
139
+ borderWidth: 20,
140
+ innerRadius: "90%",
141
+ outerRadius: "90%",
142
+ shape: "arc",
143
+ className: "gauge-pane",
144
+ },
145
+ },
146
+ colors:
147
+ colors !== undefined && colors.length > 0
148
+ ? mapColors(colors)
149
+ : highchartsTheme.colors,
150
+ plotOptions: {
151
+ series: {
152
+ animation: !disableAnimation,
153
+ },
154
+ solidgauge: {
155
+ borderColor:
156
+ colors !== undefined && colors.length === 1
157
+ ? mapColors(colors).join()
158
+ : highchartsTheme.colors[0],
159
+ borderWidth: 20,
160
+ radius: 90,
161
+ innerRadius: "90%",
162
+ dataLabels: {
163
+ borderWidth: 0,
164
+ color: defaultColors.text_lt_default,
165
+ enabled: true,
166
+ format:
167
+ `<span class="prefix">${prefix}</span>` +
168
+ '<span class="fix">{y:,f}</span>' +
169
+ `<span class="suffix">${suffix}</span>`,
170
+ style: {
171
+ fontFamily: typography.font_family_base,
172
+ fontWeight: typography.regular,
173
+ fontSize: typography.heading_2,
174
+ },
175
+ y: -26,
176
+ },
177
+ },
178
+ },
179
+ };
180
+
181
+ setOptions(merge(staticOptions, customOptions));
182
+
183
+ if (document.querySelector(".prefix")) {
184
+ document.querySelectorAll(".prefix").forEach((prefix) => {
185
+ prefix.setAttribute("y", "28");
186
+ });
187
+ document
188
+ .querySelectorAll(".fix")
189
+ .forEach((fix) => fix.setAttribute("y", "38"));
190
+ }
191
+ // eslint-disable-next-line react-hooks/exhaustive-deps
192
+ }, [chartData]);
2
193
 
3
- const Gauge: React.FC = () => {
4
194
  return (
5
- <div>
6
- This is a simple div component.
7
- </div>
195
+ <HighchartsReact
196
+ containerProps={{
197
+ className: classnames(css, globalProps(props)),
198
+ id: id,
199
+ ...ariaProps,
200
+ ...dataProps,
201
+ ...htmlProps,
202
+ }}
203
+ highcharts={Highcharts}
204
+ options={options}
205
+ />
8
206
  );
9
207
  };
10
208
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'gauge1';
19
19
 
20
- test.skip('uses exact classname', () => {
20
+ test('uses exact classname', () => {
21
21
  const data = [
22
22
  { name: 'Name', value: 45 },
23
23
  ]
@@ -1,10 +1,159 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from "react";
2
+ import classnames from "classnames";
3
+ import { globalProps } from "../utilities/globalProps";
4
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
5
+
6
+ import HighchartsReact from "highcharts-react-official";
7
+ import Highcharts from "highcharts";
8
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
+ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
11
+ import { merge } from 'lodash'
12
+
13
+ type LineGraphProps = {
14
+ align?: "left" | "right" | "center";
15
+ axisTitle?: string;
16
+ dark?: boolean;
17
+ xAxisCategories: [];
18
+ yAxisMin: number;
19
+ yAxisMax: number;
20
+ className?: string;
21
+ chartData: {
22
+ name: string;
23
+ data: number[];
24
+ }[];
25
+ customOptions?: Partial<Highcharts.Options>;
26
+ gradient?: boolean;
27
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
28
+ id: string;
29
+ pointStart: number;
30
+ subTitle?: string;
31
+ title: string;
32
+ type?: string;
33
+ legend?: boolean;
34
+ toggleLegendClick?: boolean;
35
+ height?: string;
36
+ colors: string[];
37
+ layout?: "horizontal" | "vertical" | "proximate";
38
+ verticalAlign?: "top" | "middle" | "bottom";
39
+ x?: number;
40
+ y?: number;
41
+ aria?: { [key: string]: string };
42
+ data?: { [key: string]: string };
43
+ };
44
+
45
+ const LineGraph = ({
46
+ aria = {},
47
+ data = {},
48
+ align = "center",
49
+ className = "pb_bar_graph",
50
+ customOptions = {},
51
+ dark = false,
52
+ gradient = false,
53
+ type = "line",
54
+ htmlOptions = {},
55
+ id,
56
+ legend = false,
57
+ toggleLegendClick = true,
58
+ layout = "horizontal",
59
+ verticalAlign = "bottom",
60
+ x = 0,
61
+ y = 0,
62
+ axisTitle,
63
+ xAxisCategories,
64
+ yAxisMin,
65
+ yAxisMax,
66
+ chartData,
67
+ pointStart,
68
+ subTitle,
69
+ title,
70
+ height,
71
+ colors = [],
72
+ ...props
73
+ }: LineGraphProps) => {
74
+
75
+ const ariaProps = buildAriaProps(aria)
76
+ const dataProps = buildDataProps(data)
77
+ const htmlProps = buildHtmlProps(htmlOptions)
78
+
79
+ const setupTheme = () => {
80
+ dark
81
+ ? Highcharts.setOptions(highchartsDarkTheme)
82
+ : Highcharts.setOptions(highchartsTheme);
83
+ };
84
+ setupTheme();
85
+
86
+ const staticOptions = {
87
+ title: {
88
+ text: title,
89
+ },
90
+ chart: {
91
+ height: height,
92
+ type: type,
93
+ },
94
+ subtitle: {
95
+ text: subTitle,
96
+ },
97
+ yAxis: {
98
+ min: yAxisMin,
99
+ max: yAxisMax,
100
+ title: {
101
+ text: axisTitle,
102
+ },
103
+ },
104
+ xAxis: {
105
+ categories: xAxisCategories,
106
+ },
107
+ legend: {
108
+ enabled: legend,
109
+ align: align,
110
+ verticalAlign: verticalAlign,
111
+ layout: layout,
112
+ x: x,
113
+ y: y,
114
+ },
115
+ colors:
116
+ colors !== undefined && colors.length > 0
117
+ ? mapColors(colors)
118
+ : highchartsTheme.colors,
119
+ plotOptions: {
120
+ series: {
121
+ pointStart: pointStart,
122
+ events: {},
123
+ dataLabels: {
124
+ enabled: false,
125
+ },
126
+ },
127
+ },
128
+ series: chartData,
129
+ credits: false,
130
+ };
131
+
132
+ if (!toggleLegendClick) {
133
+ staticOptions.plotOptions.series.events = { legendItemClick: () => false };
134
+ }
135
+
136
+ const filteredProps: any = {...props};
137
+ delete filteredProps.verticalAlign;
138
+
139
+ const [options, setOptions] = useState({});
140
+
141
+ useEffect(() => {
142
+ setOptions(merge(staticOptions, customOptions));
143
+ }, [chartData]);
2
144
 
3
- const LineGraph: React.FC = () => {
4
145
  return (
5
- <div>
6
- This is a simple div component.
7
- </div>
146
+ <HighchartsReact
147
+ containerProps={{
148
+ className: classnames(globalProps(filteredProps), className),
149
+ id: id,
150
+ ...ariaProps,
151
+ ...dataProps,
152
+ ...htmlProps
153
+ }}
154
+ highcharts={Highcharts}
155
+ options={options}
156
+ />
8
157
  );
9
158
  };
10
159
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'linechart1';
19
19
 
20
- test.skip('uses exact classname', () => {
20
+ test('uses exact classname', () => {
21
21
  const data = [{
22
22
  name: 'Installation',
23
23
  data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],