playbook_ui 13.12.0.pre.alpha.play1051highchartstest1567 → 13.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +32 -36
  3. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +63 -68
  4. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +3 -257
  5. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +47 -59
  6. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +34 -40
  7. data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +0 -8
  8. data/app/pb_kits/playbook/pb_textarea/docs/example.yml +0 -5
  9. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +102 -107
  10. data/app/pb_kits/playbook/playbook-doc.js +4 -4
  11. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -4
  12. data/dist/playbook-rails.js +7 -7
  13. data/lib/playbook/version.rb +2 -2
  14. metadata +7 -16
  15. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +0 -14
  16. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +0 -7
  17. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +0 -8
  18. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +0 -8
  19. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +0 -7
  20. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +0 -18
  21. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +0 -27
  22. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +0 -11
  23. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef5bfd872ac45c9283c70342d8e4858b83b17902df462f1f52d1c477a294dd39
4
- data.tar.gz: 29cbb47a5e2045916a9250d8db3a6338df401e284f34955186ebd9722aa0956f
3
+ metadata.gz: 5274804bb3a050a4c0649d20d667e714fed94f191bb3dbb8bf2476198a83e0a7
4
+ data.tar.gz: e6ea6a7dbfff42131377ee9ee4a6ecbac3bee1a69f34923dbb0e11c44ff25911
5
5
  SHA512:
6
- metadata.gz: 899b51e7c5ddaf7f8072761b523f52063bc3c10c6d912d4f6f6f894baef1c6980596ef6f9dbbda3af68c71d669879b6df31c5e5ffd738d56dc48b3b4a161c585
7
- data.tar.gz: db352b4f212fe4592d5bc229ac43bd99eb91f3be0841fdc820002b8323aadb921b802da15db36091cb8f4664f9c2af1551d877fed0c46ae926f0717c1bda2959
6
+ metadata.gz: a69c18f1d029ac13eaff14aceda3b01e96004eab1621cdccfc9c46e47a6041f83bfa797cb422221c4604c306da163dc8248e775ac1606377ee3e586a3989879d
7
+ data.tar.gz: 975179da601fbf2a3a3abf924c59e4bc307938dfa9fabbd45ddee638d1bd2729f8dd62d256eba2a4e0d2a0884c29d8d8d5b8ca6d106c6ef51301a0a0dfb9fd45
@@ -3,6 +3,7 @@ import { globalProps } from "../utilities/globalProps";
3
3
  import { buildAriaProps, buildDataProps } from "../utilities/props";
4
4
 
5
5
  import HighchartsReact from "highcharts-react-official";
6
+ import Highcharts from "highcharts";
6
7
  import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
7
8
  import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
8
9
  import mapColors from "../pb_dashboard/pbChartsColorsHelper";
@@ -10,31 +11,32 @@ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
10
11
  import classnames from "classnames";
11
12
 
12
13
  type BarGraphProps = {
13
- align?: "left" | "right" | "center",
14
- axisTitle: string,
15
- dark?: boolean,
16
- xAxisCategories: [],
17
- yAxisMin: number,
18
- yAxisMax: number,
19
- chartData: { name: string, data: number[] }[],
20
- className?: string,
21
- id: any,
22
- pointStart: number | any,
23
- subTitle?: string,
24
- title: string,
25
- type?: string,
26
- legend?: boolean,
27
- toggleLegendClick?: boolean,
28
- height?: string,
29
- colors: string[],
30
- layout?: "horizontal" | "vertical" | "proximate",
31
- verticalAlign?: "top" | "middle" | "bottom",
32
- x?: number,
33
- y?: number,
34
- aria?: { [key: string]: string },
35
- data?: { [key: string]: string },
14
+ align?: "left" | "right" | "center";
15
+ axisTitle: string;
16
+ dark?: boolean;
17
+ xAxisCategories: [];
18
+ yAxisMin: number;
19
+ yAxisMax: number;
20
+ chartData: { name: string; data: number[] }[];
21
+ className?: string;
22
+ id: any;
23
+ pointStart: number | any;
24
+ subTitle?: string;
25
+ title: string;
26
+ type?: string;
27
+ legend?: boolean;
28
+ toggleLegendClick?: boolean;
29
+ height?: string;
30
+ colors: string[];
31
+ layout?: "horizontal" | "vertical" | "proximate";
32
+ verticalAlign?: "top" | "middle" | "bottom";
33
+ x?: number;
34
+ y?: number;
35
+ aria?: { [key: string]: string };
36
+ data?: { [key: string]: string };
36
37
  };
37
38
 
39
+
38
40
  const BarGraph = ({
39
41
  aria = {},
40
42
  data = {},
@@ -63,6 +65,12 @@ const BarGraph = ({
63
65
  }: BarGraphProps): React.ReactElement => {
64
66
  const ariaProps = buildAriaProps(aria);
65
67
  const dataProps = buildDataProps(data);
68
+ const setupTheme = () => {
69
+ dark
70
+ ? Highcharts.setOptions(highchartsDarkTheme)
71
+ : Highcharts.setOptions(highchartsTheme);
72
+ };
73
+ setupTheme();
66
74
 
67
75
  const staticOptions = {
68
76
  title: {
@@ -115,24 +123,12 @@ const BarGraph = ({
115
123
  }
116
124
 
117
125
  const [options, setOptions] = useState({});
118
- const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false)
119
126
 
120
127
  useEffect(() => {
121
128
  setOptions({ ...staticOptions });
122
-
123
- const interval = setInterval(() => {
124
- if (window.Highcharts) {
125
- clearInterval(interval)
126
- dark
127
- ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
128
- : window.Highcharts.setOptions(highchartsTheme)
129
- setIsHighchartsLoaded(true)
130
- }
131
- }, 0)
132
129
  }, [chartData]);
133
130
 
134
131
  return (
135
- isHighchartsLoaded &&
136
132
  <HighchartsReact
137
133
  containerProps={{
138
134
  className: classnames(globalProps(props), className),
@@ -140,7 +136,7 @@ const BarGraph = ({
140
136
  ...ariaProps,
141
137
  ...dataProps,
142
138
  }}
143
- highcharts={window.Highcharts}
139
+ highcharts={Highcharts}
144
140
  options={options}
145
141
  />
146
142
  );
@@ -1,9 +1,10 @@
1
- /* eslint-disable */
2
1
  import React, { useEffect, useState } from "react";
3
2
  import classnames from "classnames";
4
3
  import HighchartsReact from "highcharts-react-official";
5
4
  import highchartsMore from "highcharts/highcharts-more";
6
5
 
6
+ import Highcharts from "highcharts";
7
+
7
8
  import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
8
9
  import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
9
10
  import mapColors from "../pb_dashboard/pbChartsColorsHelper";
@@ -11,35 +12,35 @@ import { globalProps } from "../utilities/globalProps";
11
12
  import { buildAriaProps, buildDataProps } from "../utilities/props";
12
13
 
13
14
  type CircleChartProps = {
14
- align?: "left" | "right" | "center",
15
- aria: { [key: string]: string },
16
- chartData?: [],
17
- children?: Node,
18
- className?: string,
19
- colors?: string[],
20
- dark?: boolean,
21
- data?: unknown,
22
- dataLabelHtml?: string,
23
- dataLabels?: boolean,
24
- height?: string,
25
- id?: string,
26
- innerSize?: "sm" | "md" | "lg" | "none",
27
- legend?: boolean,
28
- maxPointSize?: number,
29
- minPointSize?: number,
30
- rounded?: boolean,
31
- startAngle?: number,
32
- style?: string,
33
- title?: string,
34
- tooltipHtml: string,
35
- useHtml?: boolean,
36
- zMin?: number,
37
- layout?: "horizontal" | "vertical" | "proximate",
38
- verticalAlign?: "top" | "middle" | "bottom",
39
- x?: number,
40
- y?: number,
41
- borderColor?: string,
42
- borderWidth?: number,
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;
43
44
  };
44
45
 
45
46
  // Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
@@ -89,11 +90,29 @@ const CircleChart = ({
89
90
  }: CircleChartProps) => {
90
91
  const ariaProps = buildAriaProps(aria);
91
92
  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
+
92
110
  const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
93
- const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") => innerSizes[size];
111
+ const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
112
+ innerSizes[size];
113
+
94
114
 
95
115
  const [options, setOptions] = useState({});
96
- const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
97
116
 
98
117
  useEffect(() => {
99
118
  const formattedChartData = chartData.map((obj: any) => {
@@ -150,50 +169,26 @@ const CircleChart = ({
150
169
  credits: false,
151
170
  };
152
171
  setOptions({ ...staticOptions });
153
-
154
- const interval = setInterval(() => {
155
- if (window.Highcharts) {
156
- clearInterval(interval)
157
- dark
158
- ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
159
- : window.Highcharts.setOptions(highchartsTheme)
160
-
161
- highchartsMore(window.Highcharts);
162
-
163
- window.Highcharts.setOptions({
164
- tooltip: {
165
- headerFormat: null,
166
- pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
167
- useHTML: useHtml,
168
- },
169
- });
170
-
171
- setIsHighchartsLoaded(true)
172
- }
173
- }, 0)
174
172
  }, [chartData]);
175
173
 
174
+
176
175
  return (
177
176
  <>
178
177
  {children ? (
179
178
  <div id={`wrapper-circle-chart-${id}`}>
180
- {
181
- isHighchartsLoaded &&
182
- <HighchartsReact
183
- containerProps={{
184
- className: classnames("pb_circle_chart", globalProps(props)),
185
- id: id,
186
- ...ariaProps,
187
- ...dataProps,
188
- }}
189
- highcharts={window.Highcharts}
190
- options={options}
191
- />
192
- }
179
+ <HighchartsReact
180
+ containerProps={{
181
+ className: classnames("pb_circle_chart", globalProps(props)),
182
+ id: id,
183
+ ...ariaProps,
184
+ ...dataProps,
185
+ }}
186
+ highcharts={Highcharts}
187
+ options={options}
188
+ />
193
189
  <div className="pb-circle-chart-block">{children}</div>
194
190
  </div>
195
191
  ) : (
196
- isHighchartsLoaded &&
197
192
  <HighchartsReact
198
193
  containerProps={{
199
194
  className: classnames("pb_circle_chart", globalProps(props)),
@@ -201,7 +196,7 @@ const CircleChart = ({
201
196
  ...ariaProps,
202
197
  ...dataProps,
203
198
  }}
204
- highcharts={window.Highcharts}
199
+ highcharts={Highcharts}
205
200
  options={options}
206
201
  />
207
202
  )}
@@ -3,263 +3,10 @@ import typography from '../tokens/exports/_typography.scss'
3
3
 
4
4
  import { ThemeProps } from './themeTypes'
5
5
 
6
- //import Highcharts from 'highcharts'
6
+ import Highcharts from 'highcharts'
7
7
 
8
8
  const pbButtonHoverColor = '#004ebb'
9
- // const highchartsDarkTheme: ThemeProps = {
10
- // lang: {
11
- // thousandsSep: ',',
12
- // },
13
- // colors: [
14
- // colors.data_1,
15
- // colors.data_2,
16
- // colors.data_3,
17
- // colors.data_4,
18
- // colors.data_5,
19
- // colors.data_6,
20
- // colors.data_7,
21
- // ],
22
- // chart: {
23
- // borderWidth: 0,
24
- // borderRadius: 0,
25
- // plotBackgroundColor: null,
26
- // plotShadow: false,
27
- // plotBorderWidth: 0,
28
- // },
29
- // title: {
30
- // style: {
31
- // color: colors.text_dk_default,
32
- // fontFamily: typography.font_family_base,
33
- // fontWeight: typography.regular,
34
- // fontSize: typography.heading_3,
35
- // },
36
- // },
37
- // subtitle: {
38
- // style: {
39
- // fontFamily: typography.font_family_base,
40
- // color: colors.text_dk_light,
41
- // fontWeight: typography.regular,
42
- // fontSize: typography.text_base,
43
- // },
44
- // },
45
- // xAxis: {
46
- // gridLineWidth: 0,
47
- // lineColor: colors.border_dark,
48
- // tickColor: colors.border_dark,
49
- // labels: {
50
- // style: {
51
- // fontFamily: typography.font_family_base,
52
- // color: colors.text_dk_lighter,
53
- // fontWeight: typography.bold,
54
- // fontSize: typography.text_smaller,
55
- // },
56
- // },
57
- // title: {
58
- // style: {
59
- // color: colors.text_dk_default,
60
- // fontFamily: typography.font_family_base,
61
- // fontWeight: typography.regular,
62
- // fontSize: typography.heading_4,
63
- // },
64
- // },
65
- // },
66
- // yAxis: {
67
- // alternateGridColor: null,
68
- // minorTickInterval: null,
69
- // gridLineColor: colors.border_dark,
70
- // minorGridLineColor: colors.border_dark,
71
- // lineWidth: 0,
72
- // tickWidth: 0,
73
- // labels: {
74
- // style: {
75
- // fontFamily: typography.font_family_base,
76
- // color: colors.text_dk_lighter,
77
- // fontWeight: typography.bold,
78
- // fontSize: typography.text_smaller,
79
- // },
80
- // },
81
- // title: {
82
- // style: {
83
- // fontFamily: typography.font_family_base,
84
- // color: colors.text_dk_lighter,
85
- // fontWeight: typography.bold,
86
- // fontSize: typography.text_smaller,
87
- // },
88
- // },
89
- // },
90
- // legend: {
91
- // layout: 'horizontal',
92
- // align: 'center',
93
- // verticalAlign: 'bottom',
94
- // itemStyle: {
95
- // fontFamily: typography.font_family_base,
96
- // color: colors.text_dk_light,
97
- // fontWeight: typography.regular,
98
- // fontSize: typography.text_smaller,
99
- // },
100
- // itemHoverStyle: {
101
- // color: colors.text_dk_default,
102
- // },
103
- // itemHiddenStyle: {
104
- // color: colors.text_dk_lighter,
105
- // },
106
- // },
107
- // labels: {
108
- // style: {
109
- // color: colors.primary,
110
- // },
111
- // },
112
- // tooltip: {
113
- // backgroundColor: {
114
- // linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
115
- // stops: [
116
- // [0, colors.card_light],
117
- // [1, colors.card_light],
118
- // ],
119
- // },
120
- // shadow: false,
121
- // borderWidth: 0,
122
- // borderRadius: 10,
123
- // style: {
124
- // fontFamily: typography.font_family_base,
125
- // color: colors.text_lt_default,
126
- // fontWeight: typography.regular,
127
- // fontSize: typography.text_smaller,
128
- // },
129
- // },
130
- // // specific to gauge
131
- // // unfilled gauge color
132
- // pane: {
133
- // background: {
134
- // borderColor: colors.border_dark,
135
- // },
136
- // },
137
-
138
- // plotOptions: {
139
- // series: {
140
- // borderColor: colors.bg_dark_card,
141
- // borderWidth: 2,
142
- // type: 'area',
143
- // nullColor: colors.text_dk_lighter,
144
- // fillColor: {
145
- // linearGradient: {
146
- // x1: 0,
147
- // y1: 0,
148
- // x2: 0,
149
- // y2: 1,
150
- // },
151
- // stops: [
152
- // [0, Highcharts.getOptions().colors[0]],
153
- // [1, 'white'],
154
- // ],
155
- // },
156
- // threshold: null,
157
- // },
158
- // // PIE STYLES
159
- // pie: {
160
- // colors: [
161
- // colors.data_1,
162
- // colors.data_2,
163
- // colors.data_3,
164
- // colors.data_4,
165
- // colors.data_5,
166
- // colors.data_6,
167
- // colors.data_7,
168
- // ],
169
- // dataLabels: {
170
- // style: {
171
- // fontFamily: typography.font_family_base,
172
- // fontSize: typography.text_smaller,
173
- // color: colors.text_dk_light,
174
- // fontWeight: typography.regular,
175
- // },
176
- // },
177
- // },
178
-
179
- // // LINE CHART STYLES
180
- // line: {
181
- // dataLabels: {
182
- // color: colors.text_dk_light,
183
- // },
184
- // marker: {
185
- // lineColor: colors.border_dark,
186
- // },
187
- // area: {
188
- // shadow: false,
189
- // states: {
190
- // hover: {
191
- // lineWidth: 1,
192
- // },
193
- // },
194
- // threshold: null,
195
- // },
196
- // },
197
-
198
- // //TREEMAP CHART STYLES
199
- // treemap: {
200
- // layoutAlgorithm: "squarified",
201
- // allowTraversingTree: false,
202
- // animationLimit: 1000,
203
- // colors: [
204
- // colors.data_1,
205
- // colors.data_2,
206
- // colors.data_3,
207
- // colors.data_4,
208
- // colors.data_5,
209
- // colors.data_6,
210
- // colors.data_7,
211
- // colors.data_8,
212
- // ],
213
- // colorByPoint: true,
214
- // dataLabels: {
215
- // enabled: true,
216
- // style: {
217
- // fontFamily: typography.font_family_base,
218
- // fontWeight: typography.bold,
219
- // fontSize: typography.heading_4,
220
- // },
221
- // },
222
- // levels: [
223
- // {
224
- // level: 1,
225
- // dataLabels: {
226
- // enabled: false,
227
- // },
228
- // },
229
- // ],
230
- // traverseUpButton: {
231
- // position: { y: -50 },
232
- // text: '< Back',
233
- // theme: {
234
- // r: 4,
235
- // states: {
236
- // hover: {
237
- // style: {
238
- // fill: pbButtonHoverColor,
239
- // },
240
- // },
241
- // },
242
- // style: {
243
- // fill: colors.royal,
244
- // color: colors.white,
245
- // fontSize: `${typography.text_small}`,
246
- // fontWeight: typography.bold,
247
- // fontFamily: `${typography.font_family_base}`,
248
- // },
249
- // stroke: colors.royal,
250
- // height: 24,
251
- // width: 90,
252
- // },
253
- // },
254
- // },
255
- // },
256
- // credits: {
257
- // enabled: false
258
- // },
259
- // }
260
-
261
- function highchartsDarkTheme(highcharts: any): ThemeProps {
262
- return {
9
+ const highchartsDarkTheme: ThemeProps = {
263
10
  lang: {
264
11
  thousandsSep: ',',
265
12
  },
@@ -402,7 +149,7 @@ function highchartsDarkTheme(highcharts: any): ThemeProps {
402
149
  y2: 1,
403
150
  },
404
151
  stops: [
405
- [0, highcharts.getOptions().colors[0]],
152
+ [0, Highcharts.getOptions().colors[0]],
406
153
  [1, 'white'],
407
154
  ],
408
155
  },
@@ -510,6 +257,5 @@ function highchartsDarkTheme(highcharts: any): ThemeProps {
510
257
  enabled: false
511
258
  },
512
259
  }
513
- }
514
260
 
515
261
  export { highchartsDarkTheme }