playbook_ui 13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21358 → 13.10.0.pre.alpha.PLAY1051removinghighchartsdependency1465
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +36 -32
- data/app/pb_kits/playbook/pb_button/docs/_button_circle_swift.md +28 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_default_swift.md +23 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_full_width_swift.md +9 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_options_swift.md +18 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size_swift.md +20 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_background_swift.md +29 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_border_none_swift.md +7 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_border_radius_swift.md +33 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header_swift.md +33 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight_swift.md +17 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_light_swift.md +7 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_padding_swift.md +33 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_props_swift.md +10 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_selected_swift.md +0 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_separator_swift.md +11 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_shadow_swift.md +21 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_styles_swift.md +17 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_tag_swift.md +0 -0
- data/app/pb_kits/playbook/pb_card/docs/example.yml +12 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default_swift.md +10 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_error_swift.md +12 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_swift.md +12 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +67 -63
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +57 -46
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color_props.md +6 -0
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color_swift.md +16 -0
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_defaul_swift.md +7 -0
- data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_sizes_swift.md +11 -0
- data/app/pb_kits/playbook/pb_icon_circle/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +39 -34
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +45 -104
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +43 -100
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_header.html.erb +47 -31
- data/app/pb_kits/playbook/pb_table/docs/_table_header.md +5 -0
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +33 -28
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +1 -1
- metadata +29 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.html.erb +0 -133
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx +0 -145
@@ -3,8 +3,6 @@ import classnames from "classnames";
|
|
3
3
|
import HighchartsReact from "highcharts-react-official";
|
4
4
|
import highchartsMore from "highcharts/highcharts-more";
|
5
5
|
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
|
8
6
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
7
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
8
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -12,35 +10,35 @@ import { globalProps } from "../utilities/globalProps";
|
|
12
10
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
13
11
|
|
14
12
|
type CircleChartProps = {
|
15
|
-
align?: "left" | "right" | "center"
|
16
|
-
aria: { [key: string]: string }
|
17
|
-
chartData?: []
|
18
|
-
children?: Node
|
19
|
-
className?: string
|
20
|
-
colors?: string[]
|
21
|
-
dark?: Boolean
|
22
|
-
data?: Object
|
23
|
-
dataLabelHtml?: string
|
24
|
-
dataLabels?: boolean
|
25
|
-
height?: string
|
26
|
-
id?: string
|
27
|
-
innerSize?: "sm" | "md" | "lg" | "none"
|
28
|
-
legend?: boolean
|
29
|
-
maxPointSize?: number
|
30
|
-
minPointSize?: number
|
31
|
-
rounded?: boolean
|
32
|
-
startAngle?: number
|
33
|
-
style?: string
|
34
|
-
title?: string
|
35
|
-
tooltipHtml: string
|
36
|
-
useHtml?: boolean
|
37
|
-
zMin?: number
|
38
|
-
layout?: "horizontal" | "vertical" | "proximate"
|
39
|
-
verticalAlign?: "top" | "middle" | "bottom"
|
40
|
-
x?: number
|
41
|
-
y?: number
|
42
|
-
borderColor?: string
|
43
|
-
borderWidth?: number
|
13
|
+
align?: "left" | "right" | "center",
|
14
|
+
aria: { [key: string]: string },
|
15
|
+
chartData?: [],
|
16
|
+
children?: Node,
|
17
|
+
className?: string,
|
18
|
+
colors?: string[],
|
19
|
+
dark?: Boolean,
|
20
|
+
data?: Object,
|
21
|
+
dataLabelHtml?: string,
|
22
|
+
dataLabels?: boolean,
|
23
|
+
height?: string,
|
24
|
+
id?: string,
|
25
|
+
innerSize?: "sm" | "md" | "lg" | "none",
|
26
|
+
legend?: boolean,
|
27
|
+
maxPointSize?: number,
|
28
|
+
minPointSize?: number,
|
29
|
+
rounded?: boolean,
|
30
|
+
startAngle?: number,
|
31
|
+
style?: string,
|
32
|
+
title?: string,
|
33
|
+
tooltipHtml: string,
|
34
|
+
useHtml?: boolean,
|
35
|
+
zMin?: number,
|
36
|
+
layout?: "horizontal" | "vertical" | "proximate",
|
37
|
+
verticalAlign?: "top" | "middle" | "bottom",
|
38
|
+
x?: number,
|
39
|
+
y?: number,
|
40
|
+
borderColor?: string,
|
41
|
+
borderWidth?: number,
|
44
42
|
};
|
45
43
|
|
46
44
|
// Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
|
@@ -90,29 +88,11 @@ const CircleChart = ({
|
|
90
88
|
}: CircleChartProps) => {
|
91
89
|
const ariaProps = buildAriaProps(aria);
|
92
90
|
const dataProps = buildDataProps(data);
|
93
|
-
highchartsMore(Highcharts);
|
94
|
-
|
95
|
-
const setupTheme = () => {
|
96
|
-
dark
|
97
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
98
|
-
: Highcharts.setOptions(highchartsTheme);
|
99
|
-
};
|
100
|
-
setupTheme();
|
101
|
-
|
102
|
-
Highcharts.setOptions({
|
103
|
-
tooltip: {
|
104
|
-
headerFormat: null,
|
105
|
-
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
106
|
-
useHTML: useHtml,
|
107
|
-
},
|
108
|
-
});
|
109
|
-
|
110
91
|
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
111
|
-
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
112
|
-
innerSizes[size];
|
113
|
-
|
92
|
+
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") => innerSizes[size];
|
114
93
|
|
115
94
|
const [options, setOptions] = useState({});
|
95
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
116
96
|
|
117
97
|
useEffect(() => {
|
118
98
|
const formattedChartData = chartData.map((obj: any) => {
|
@@ -169,26 +149,50 @@ const CircleChart = ({
|
|
169
149
|
credits: false,
|
170
150
|
};
|
171
151
|
setOptions({ ...staticOptions });
|
172
|
-
}, [chartData]);
|
173
152
|
|
153
|
+
const interval = setInterval(() => {
|
154
|
+
if (window.Highcharts) {
|
155
|
+
clearInterval(interval)
|
156
|
+
dark
|
157
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
158
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
159
|
+
|
160
|
+
highchartsMore(window.Highcharts);
|
161
|
+
|
162
|
+
window.Highcharts.setOptions({
|
163
|
+
tooltip: {
|
164
|
+
headerFormat: null,
|
165
|
+
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
166
|
+
useHTML: useHtml,
|
167
|
+
},
|
168
|
+
});
|
169
|
+
|
170
|
+
setIsHighchartsLoaded(true)
|
171
|
+
}
|
172
|
+
}, 0)
|
173
|
+
}, [chartData]);
|
174
174
|
|
175
175
|
return (
|
176
176
|
<>
|
177
177
|
{children ? (
|
178
178
|
<div id={`wrapper-circle-chart-${id}`}>
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
179
|
+
{
|
180
|
+
isHighchartsLoaded &&
|
181
|
+
<HighchartsReact
|
182
|
+
containerProps={{
|
183
|
+
className: classnames("pb_circle_chart", globalProps(props)),
|
184
|
+
id: id,
|
185
|
+
...ariaProps,
|
186
|
+
...dataProps,
|
187
|
+
}}
|
188
|
+
highcharts={window.Highcharts}
|
189
|
+
options={options}
|
190
|
+
/>
|
191
|
+
}
|
189
192
|
<div className="pb-circle-chart-block">{children}</div>
|
190
193
|
</div>
|
191
194
|
) : (
|
195
|
+
isHighchartsLoaded &&
|
192
196
|
<HighchartsReact
|
193
197
|
containerProps={{
|
194
198
|
className: classnames("pb_circle_chart", globalProps(props)),
|
@@ -196,7 +200,7 @@ const CircleChart = ({
|
|
196
200
|
...ariaProps,
|
197
201
|
...dataProps,
|
198
202
|
}}
|
199
|
-
highcharts={Highcharts}
|
203
|
+
highcharts={window.Highcharts}
|
200
204
|
options={options}
|
201
205
|
/>
|
202
206
|
)}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
import HighchartsReact from "highcharts-react-official";
|
4
|
-
import Highcharts from "highcharts";
|
5
4
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
6
5
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
7
6
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -14,26 +13,26 @@ import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
|
14
13
|
import { globalProps } from "../utilities/globalProps";
|
15
14
|
|
16
15
|
type GaugeProps = {
|
17
|
-
aria: { [key: string]: string }
|
18
|
-
className?: string
|
19
|
-
chartData?: { name: string
|
20
|
-
dark?: Boolean
|
21
|
-
data?: { [key: string]: string }
|
22
|
-
disableAnimation?: boolean
|
23
|
-
fullCircle?: boolean
|
24
|
-
height?: string
|
25
|
-
id?: string
|
26
|
-
max?: number
|
27
|
-
min?: number
|
28
|
-
prefix?: string
|
29
|
-
showLabels?: boolean
|
30
|
-
style?: string
|
31
|
-
suffix?: string
|
32
|
-
title?: string
|
33
|
-
tooltipHtml?: string
|
34
|
-
colors: string[]
|
35
|
-
minorTickInterval: any
|
36
|
-
circumference: number[]
|
16
|
+
aria: { [key: string]: string },
|
17
|
+
className?: string,
|
18
|
+
chartData?: { name: string, value: number[] | number }[],
|
19
|
+
dark?: Boolean,
|
20
|
+
data?: { [key: string]: string },
|
21
|
+
disableAnimation?: boolean,
|
22
|
+
fullCircle?: boolean,
|
23
|
+
height?: string,
|
24
|
+
id?: string,
|
25
|
+
max?: number,
|
26
|
+
min?: number,
|
27
|
+
prefix?: string,
|
28
|
+
showLabels?: boolean,
|
29
|
+
style?: string,
|
30
|
+
suffix?: string,
|
31
|
+
title?: string,
|
32
|
+
tooltipHtml?: string,
|
33
|
+
colors: string[],
|
34
|
+
minorTickInterval: any,
|
35
|
+
circumference: number[],
|
37
36
|
};
|
38
37
|
|
39
38
|
const Gauge = ({
|
@@ -62,28 +61,13 @@ const Gauge = ({
|
|
62
61
|
}: GaugeProps) => {
|
63
62
|
const ariaProps = buildAriaProps(aria);
|
64
63
|
const dataProps = buildDataProps(data);
|
65
|
-
highchartsMore(Highcharts);
|
66
|
-
solidGauge(Highcharts);
|
67
|
-
const setupTheme = () => {
|
68
|
-
dark
|
69
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
70
|
-
: Highcharts.setOptions(highchartsTheme);
|
71
|
-
};
|
72
|
-
setupTheme();
|
73
|
-
|
74
|
-
//set tooltip directly to prevent being overriden by Highcharts defaults
|
75
|
-
Highcharts.setOptions({
|
76
|
-
tooltip: {
|
77
|
-
pointFormat: tooltipHtml,
|
78
|
-
followPointer: true,
|
79
|
-
},
|
80
|
-
});
|
81
64
|
|
82
65
|
const css = buildCss({
|
83
66
|
pb_gauge_kit: true,
|
84
67
|
});
|
85
68
|
|
86
69
|
const [options, setOptions] = useState({});
|
70
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
87
71
|
|
88
72
|
useEffect(() => {
|
89
73
|
const formattedChartData = chartData.map((obj: any) => {
|
@@ -174,18 +158,45 @@ const Gauge = ({
|
|
174
158
|
|
175
159
|
setOptions({ ...staticOptions });
|
176
160
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
161
|
+
const interval = setInterval(() => {
|
162
|
+
if (window.Highcharts) {
|
163
|
+
clearInterval(interval)
|
164
|
+
|
165
|
+
const gaugeInterval = setInterval(() => {
|
166
|
+
if (document.querySelector(".prefix")) {
|
167
|
+
clearInterval(gaugeInterval)
|
168
|
+
document.querySelectorAll(".prefix").forEach((prefix) => {
|
169
|
+
prefix.setAttribute("y", "28");
|
170
|
+
});
|
171
|
+
document
|
172
|
+
.querySelectorAll(".fix")
|
173
|
+
.forEach((fix) => fix.setAttribute("y", "38"));
|
174
|
+
}
|
175
|
+
}, 0)
|
176
|
+
|
177
|
+
dark
|
178
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
179
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
180
|
+
|
181
|
+
highchartsMore(window.Highcharts);
|
182
|
+
solidGauge(window.Highcharts);
|
183
|
+
|
184
|
+
//set tooltip directly to prevent being overriden by window.Highcharts defaults
|
185
|
+
window.Highcharts.setOptions({
|
186
|
+
tooltip: {
|
187
|
+
pointFormat: tooltipHtml,
|
188
|
+
followPointer: true,
|
189
|
+
},
|
190
|
+
});
|
191
|
+
|
192
|
+
setIsHighchartsLoaded(true)
|
193
|
+
}
|
194
|
+
}, 0)
|
185
195
|
|
186
196
|
}, [chartData]);
|
187
197
|
|
188
198
|
return (
|
199
|
+
isHighchartsLoaded &&
|
189
200
|
<HighchartsReact
|
190
201
|
containerProps={{
|
191
202
|
className: classnames(css, globalProps(props)),
|
@@ -193,7 +204,7 @@ const Gauge = ({
|
|
193
204
|
...ariaProps,
|
194
205
|
...dataProps,
|
195
206
|
}}
|
196
|
-
highcharts={Highcharts}
|
207
|
+
highcharts={window.Highcharts}
|
197
208
|
options={options}
|
198
209
|
/>
|
199
210
|
);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **Icon** | `PlaybookGenericIcon` | Sets the kit's Icon | | |
|
5
|
+
| **Size** | `PBIcon.IconSize` | Changes the size of the Circle Icon | `.x1` | `xSmall` `small` `large` `x1` `x2` `x3` `x4` `x5` `x6` `x7` `x8` `x9` `x10` |
|
6
|
+
| **Color** | `Color` | Changes color of the Icon and background | `.status(.neutral)` | `Color` |
|
@@ -0,0 +1,16 @@
|
|
1
|
+
![icon-circle-colors](https://github.com/powerhome/playbook/assets/92755007/d6507900-98e9-49fb-acfb-a238bef08d1b)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
VStack(spacing: Spacing.small) {
|
6
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data1))
|
7
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data2))
|
8
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data3))
|
9
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data4))
|
10
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data5))
|
11
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data6))
|
12
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data7))
|
13
|
+
PBIconCircle(FontAwesome.rocket, size: .small, color: Color.data(.data8))
|
14
|
+
}
|
15
|
+
|
16
|
+
```
|
@@ -0,0 +1,11 @@
|
|
1
|
+
![circle-icon-sizes](https://github.com/powerhome/playbook/assets/92755007/2a474df1-5712-4c2a-9d6b-fb740ae949f2)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
VStack(alignment: .leading, spacing: Spacing.small) {
|
6
|
+
PBIconCircle(FontAwesome.rocket, size: .small)
|
7
|
+
PBIconCircle(FontAwesome.rocket, size: .x1)
|
8
|
+
PBIconCircle(FontAwesome.rocket, size: .large)
|
9
|
+
}
|
10
|
+
|
11
|
+
```
|
@@ -12,3 +12,10 @@ examples:
|
|
12
12
|
- icon_circle_sizes: Size
|
13
13
|
- icon_circle_color: Color
|
14
14
|
- icon_circle_emoji: With Emoji
|
15
|
+
|
16
|
+
swift:
|
17
|
+
- icon_circle_defaul_swift: Default
|
18
|
+
- icon_circle_sizes_swift: Size
|
19
|
+
- icon_circle_color_swift: Color
|
20
|
+
- icon_circle_color_props: ""
|
21
|
+
|
@@ -4,39 +4,38 @@ import { globalProps } from "../utilities/globalProps";
|
|
4
4
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
5
5
|
|
6
6
|
import HighchartsReact from "highcharts-react-official";
|
7
|
-
import Highcharts from "highcharts";
|
8
7
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
8
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
9
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
10
|
|
12
11
|
type LineGraphProps = {
|
13
|
-
align?: "left" | "right" | "center"
|
14
|
-
axisTitle?: string
|
15
|
-
dark?: Boolean
|
16
|
-
xAxisCategories: []
|
17
|
-
yAxisMin: number
|
18
|
-
yAxisMax: number
|
19
|
-
className?: string
|
12
|
+
align?: "left" | "right" | "center",
|
13
|
+
axisTitle?: string,
|
14
|
+
dark?: Boolean,
|
15
|
+
xAxisCategories: [],
|
16
|
+
yAxisMin: number,
|
17
|
+
yAxisMax: number,
|
18
|
+
className?: string,
|
20
19
|
chartData: {
|
21
|
-
name: string
|
22
|
-
data: number[]
|
23
|
-
}[]
|
24
|
-
gradient?: boolean
|
25
|
-
id: string
|
26
|
-
pointStart: number
|
27
|
-
subTitle?: string
|
28
|
-
title: string
|
29
|
-
type?: string
|
30
|
-
legend?: boolean
|
31
|
-
toggleLegendClick?: boolean
|
32
|
-
height?: string
|
33
|
-
colors: string[]
|
34
|
-
layout?: "horizontal" | "vertical" | "proximate"
|
35
|
-
verticalAlign?: "top" | "middle" | "bottom"
|
36
|
-
x?: number
|
37
|
-
y?: number
|
38
|
-
aria?: { [key: string]: string }
|
39
|
-
data?: { [key: string]: string }
|
20
|
+
name: string,
|
21
|
+
data: number[],
|
22
|
+
}[],
|
23
|
+
gradient?: boolean,
|
24
|
+
id: string,
|
25
|
+
pointStart: number,
|
26
|
+
subTitle?: string,
|
27
|
+
title: string,
|
28
|
+
type?: string,
|
29
|
+
legend?: boolean,
|
30
|
+
toggleLegendClick?: boolean,
|
31
|
+
height?: string,
|
32
|
+
colors: string[],
|
33
|
+
layout?: "horizontal" | "vertical" | "proximate",
|
34
|
+
verticalAlign?: "top" | "middle" | "bottom",
|
35
|
+
x?: number,
|
36
|
+
y?: number,
|
37
|
+
aria?: { [key: string]: string },
|
38
|
+
data?: { [key: string]: string },
|
40
39
|
};
|
41
40
|
|
42
41
|
const LineGraph = ({
|
@@ -68,12 +67,6 @@ const LineGraph = ({
|
|
68
67
|
}: LineGraphProps) => {
|
69
68
|
const ariaProps = buildAriaProps(aria);
|
70
69
|
const dataProps = buildDataProps(data);
|
71
|
-
const setupTheme = () => {
|
72
|
-
dark
|
73
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
74
|
-
: Highcharts.setOptions(highchartsTheme);
|
75
|
-
};
|
76
|
-
setupTheme();
|
77
70
|
|
78
71
|
const staticOptions = {
|
79
72
|
title: {
|
@@ -126,12 +119,24 @@ const LineGraph = ({
|
|
126
119
|
}
|
127
120
|
|
128
121
|
const [options, setOptions] = useState({});
|
122
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
129
123
|
|
130
124
|
useEffect(() => {
|
131
125
|
setOptions({ ...staticOptions });
|
126
|
+
|
127
|
+
const interval = setInterval(() => {
|
128
|
+
if (window.Highcharts) {
|
129
|
+
clearInterval(interval)
|
130
|
+
dark
|
131
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
132
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
133
|
+
setIsHighchartsLoaded(true)
|
134
|
+
}
|
135
|
+
}, 0)
|
132
136
|
}, [chartData]);
|
133
137
|
|
134
138
|
return (
|
139
|
+
isHighchartsLoaded &&
|
135
140
|
<HighchartsReact
|
136
141
|
containerProps={{
|
137
142
|
className: classnames(globalProps(props), className),
|
@@ -139,7 +144,7 @@ const LineGraph = ({
|
|
139
144
|
...ariaProps,
|
140
145
|
...dataProps,
|
141
146
|
}}
|
142
|
-
highcharts={Highcharts}
|
147
|
+
highcharts={window.Highcharts}
|
143
148
|
options={options}
|
144
149
|
/>
|
145
150
|
);
|
@@ -4,7 +4,6 @@ import { globalProps, GlobalProps } from "../utilities/globalProps"
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props"
|
5
5
|
import Checkbox from "../pb_checkbox/_checkbox"
|
6
6
|
import Radio from "../pb_radio/_radio"
|
7
|
-
import Body from "../pb_body/_body"
|
8
7
|
import Icon from "../pb_icon/_icon"
|
9
8
|
import FormPill from "../pb_form_pill/_form_pill"
|
10
9
|
import CircleIconButton from "../pb_circle_icon_button/_circle_icon_button"
|
@@ -32,7 +31,6 @@ type MultiLevelSelectProps = {
|
|
32
31
|
treeData?: { [key: string]: string }[]
|
33
32
|
onSelect?: (prop: { [key: string]: any }) => void
|
34
33
|
selectedIds?: string[]
|
35
|
-
ultimateChildrenOnly?: boolean
|
36
34
|
variant?: "multi" | "single"
|
37
35
|
} & GlobalProps
|
38
36
|
|
@@ -49,7 +47,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
49
47
|
treeData,
|
50
48
|
onSelect = () => null,
|
51
49
|
selectedIds,
|
52
|
-
ultimateChildrenOnly = false,
|
53
50
|
variant = "multi"
|
54
51
|
} = props
|
55
52
|
|
@@ -368,9 +365,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
368
365
|
/>
|
369
366
|
</div>
|
370
367
|
{ variant === "single" ? (
|
371
|
-
ultimateChildrenOnly && item.children ? (
|
372
|
-
<Body>{item.label}</Body>
|
373
|
-
) :
|
374
368
|
<Radio
|
375
369
|
checked={item.checked}
|
376
370
|
id={`${item.id}-${item.label}`}
|
@@ -535,4 +529,4 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
535
529
|
)
|
536
530
|
}
|
537
531
|
|
538
|
-
export default MultiLevelSelect
|
532
|
+
export default MultiLevelSelect
|