playbook_ui 13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655 → 13.12.0.pre.alpha.PLAY1051removinghighchartsdependency1551

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +36 -32
  3. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -0
  4. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +67 -63
  5. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +57 -46
  6. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +39 -34
  7. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -6
  8. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -6
  9. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -7
  10. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -4
  11. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +33 -28
  12. data/dist/playbook-rails.js +7 -7
  13. data/lib/playbook/version.rb +1 -1
  14. metadata +2 -18
  15. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +0 -11
  16. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +0 -7
  17. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +0 -13
  18. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +0 -11
  19. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +0 -15
  20. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +0 -5
  21. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +0 -15
  22. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +0 -15
  23. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +0 -35
  24. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +0 -29
  25. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +0 -13
  26. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +0 -24
  27. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +0 -13
  28. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +0 -11
  29. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +0 -10
  30. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +0 -6
@@ -5,7 +5,6 @@ import { globalProps } from "../utilities/globalProps";
5
5
  import { buildAriaProps, buildDataProps } from "../utilities/props";
6
6
 
7
7
  import HighchartsReact from "highcharts-react-official";
8
- import Highcharts from "highcharts";
9
8
  import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
10
9
  import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
11
10
  import mapColors from "../pb_dashboard/pbChartsColorsHelper";
@@ -13,24 +12,24 @@ import treemap from 'highcharts/modules/treemap'
13
12
 
14
13
  type TreemapChartProps = {
15
14
  chartData: {
16
- name: string;
17
- parent?: string | number;
18
- value: number;
19
- color?: string;
20
- id?: string | number;
21
- }[];
22
- className?: string;
23
- colors: string[];
24
- dark?: boolean;
25
- drillable: boolean;
26
- grouped: boolean;
27
- height?: string;
28
- id: number | string;
29
- title?: string;
30
- tooltipHtml: string;
31
- type?: string;
32
- aria?: { [key: string]: string };
33
- data?: { [key: string]: string };
15
+ name: string,
16
+ parent?: string | number,
17
+ value: number,
18
+ color?: string,
19
+ id?: string | number,
20
+ }[],
21
+ className?: string,
22
+ colors: string[],
23
+ dark?: boolean,
24
+ drillable: boolean,
25
+ grouped: boolean,
26
+ height?: string,
27
+ id: number | string,
28
+ title?: string,
29
+ tooltipHtml: string,
30
+ type?: string,
31
+ aria?: { [key: string]: string },
32
+ data?: { [key: string]: string },
34
33
  };
35
34
 
36
35
  const TreemapChart = ({
@@ -50,13 +49,6 @@ const TreemapChart = ({
50
49
  }: TreemapChartProps) => {
51
50
  const ariaProps = buildAriaProps(aria);
52
51
  const dataProps = buildDataProps(data);
53
- const setupTheme = () => {
54
- dark
55
- ? Highcharts.setOptions(highchartsDarkTheme)
56
- : Highcharts.setOptions(highchartsTheme);
57
- };
58
- treemap(Highcharts)
59
- setupTheme();
60
52
 
61
53
  const staticOptions = {
62
54
  title: {
@@ -88,13 +80,26 @@ const TreemapChart = ({
88
80
  };
89
81
 
90
82
  const [options, setOptions] = useState({});
83
+ const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
91
84
 
92
85
  useEffect(() => {
93
-
94
86
  setOptions({ ...staticOptions });
87
+
88
+ const interval = setInterval(() => {
89
+ if (window.Highcharts) {
90
+ clearInterval(interval)
91
+ dark
92
+ ? window.Highcharts.setOptions(highchartsDarkTheme)
93
+ : window.Highcharts.setOptions(highchartsTheme)
94
+
95
+ treemap(window.Highcharts)
96
+ setIsHighchartsLoaded(true)
97
+ }
98
+ }, 0)
95
99
  }, [chartData]);
96
100
 
97
101
  return (
102
+ isHighchartsLoaded &&
98
103
  <HighchartsReact
99
104
  containerProps={{
100
105
  className: classnames(globalProps(props), "pb_treemap_chart"),
@@ -102,7 +107,7 @@ const TreemapChart = ({
102
107
  ...ariaProps,
103
108
  ...dataProps,
104
109
  }}
105
- highcharts={Highcharts}
110
+ highcharts={window.Highcharts}
106
111
  options={options}
107
112
  />
108
113
  );