playbook_ui 13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21365 → 13.10.0.pre.alpha.PLAY1051removinghighchartsdependency1465

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) 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_button/docs/_button_circle_swift.md +28 -0
  4. data/app/pb_kits/playbook/pb_button/docs/_button_default_swift.md +23 -0
  5. data/app/pb_kits/playbook/pb_button/docs/_button_full_width_swift.md +9 -0
  6. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options_swift.md +18 -0
  7. data/app/pb_kits/playbook/pb_button/docs/_button_props_swift.md +11 -0
  8. data/app/pb_kits/playbook/pb_button/docs/_button_size_swift.md +20 -0
  9. data/app/pb_kits/playbook/pb_button/docs/example.yml +8 -0
  10. data/app/pb_kits/playbook/pb_card/docs/_card_background_swift.md +29 -0
  11. data/app/pb_kits/playbook/pb_card/docs/_card_border_none_swift.md +7 -0
  12. data/app/pb_kits/playbook/pb_card/docs/_card_border_radius_swift.md +33 -0
  13. data/app/pb_kits/playbook/pb_card/docs/_card_header_swift.md +33 -0
  14. data/app/pb_kits/playbook/pb_card/docs/_card_highlight_swift.md +17 -0
  15. data/app/pb_kits/playbook/pb_card/docs/_card_light_swift.md +7 -0
  16. data/app/pb_kits/playbook/pb_card/docs/_card_padding_swift.md +33 -0
  17. data/app/pb_kits/playbook/pb_card/docs/_card_props_swift.md +10 -0
  18. data/app/pb_kits/playbook/pb_card/docs/_card_selected_swift.md +0 -0
  19. data/app/pb_kits/playbook/pb_card/docs/_card_separator_swift.md +11 -0
  20. data/app/pb_kits/playbook/pb_card/docs/_card_shadow_swift.md +21 -0
  21. data/app/pb_kits/playbook/pb_card/docs/_card_styles_swift.md +17 -0
  22. data/app/pb_kits/playbook/pb_card/docs/_card_tag_swift.md +0 -0
  23. data/app/pb_kits/playbook/pb_card/docs/example.yml +12 -0
  24. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default_swift.md +10 -0
  25. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_error_swift.md +12 -0
  26. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_swift.md +12 -0
  27. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_props_swift.md +7 -0
  28. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +7 -0
  29. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +67 -63
  30. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +57 -46
  31. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color_props.md +6 -0
  32. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color_swift.md +16 -0
  33. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_defaul_swift.md +7 -0
  34. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_sizes_swift.md +11 -0
  35. data/app/pb_kits/playbook/pb_icon_circle/docs/example.yml +7 -0
  36. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +39 -34
  37. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +19 -24
  38. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +1 -0
  39. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +45 -104
  40. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +43 -100
  41. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
  42. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
  43. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
  44. data/app/pb_kits/playbook/pb_table/docs/_table_header.html.erb +47 -31
  45. data/app/pb_kits/playbook/pb_table/docs/_table_header.md +5 -0
  46. data/app/pb_kits/playbook/pb_table/table_header.html.erb +1 -1
  47. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +33 -28
  48. data/dist/playbook-rails.js +7 -7
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +29 -4
  51. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.html.erb +0 -139
  52. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx +0 -151
@@ -1,127 +1,68 @@
1
- <% treeData = [
2
- {
3
- label: "HQ",
4
- value: "HQ",
5
- id: "hq",
6
- },
7
- {
8
- label: "Philadelphia",
9
- value: "Philadelphia",
10
- id: "phl",
1
+ <% treeData = [{
2
+ label: "Power Home Remodeling",
3
+ value: "Power Home Remodeling",
4
+ id: "200",
5
+ expanded: true,
11
6
  children: [
12
7
  {
13
- label: "Marketing & Sales PHL",
14
- value: "Marketing & Sales PHL",
15
- id: "marketingPHL",
16
- },
17
- {
18
- label: "Installation Office PHL",
19
- value: "Installation Office PHL",
20
- id: "installationPHL",
21
- },
22
- {
23
- label: "Warehouse PHL",
24
- value: "Warehouse PHL",
25
- id: "warehousePHL",
26
- },
27
- ]
28
- },
29
- {
30
- label: "New Jersey",
31
- value: "New Jersey",
32
- id: "nj",
33
- children: [
34
- {
35
- label: "New Jersey",
36
- value: "New Jersey",
37
- id: "nj1",
8
+ label: "People",
9
+ value: "People",
10
+ id: "201",
11
+ expanded: true,
38
12
  children: [
39
13
  {
40
- label: "Marketing & Sales NJ",
41
- value: "Marketing & Sales NJ",
42
- id: "marketingNJ",
14
+ label: "Talent Acquisition",
15
+ value: "Talent Acquisition",
16
+ id: "202",
43
17
  },
44
18
  {
45
- label: "Installation Office NJ",
46
- value: "Installation Office NJ",
47
- id: "installationNJ",
19
+ label: "Business Affairs",
20
+ value: "Business Affairs",
21
+ id: "203",
22
+ children: [
23
+ {
24
+ label: "Initiatives",
25
+ value: "Initiatives",
26
+ id: "204",
27
+ },
28
+ {
29
+ label: "Learning & Development",
30
+ value: "Learning & Development",
31
+ id: "205",
32
+ },
33
+ ],
48
34
  },
49
35
  {
50
- label: "Warehouse NJ",
51
- value: "Warehouse NJ",
52
- id: "warehouseNJ",
36
+ label: "People Experience",
37
+ value: "People Experience",
38
+ id: "206",
53
39
  },
54
40
  ],
55
41
  },
56
42
  {
57
- label: "Princeton",
58
- value: "Princeton",
59
- id: "princeton",
43
+ label: "Contact Center",
44
+ value: "Contact Center",
45
+ id: "207",
60
46
  children: [
61
47
  {
62
- label: "Marketing & Sales Princeton",
63
- value: "Marketing & Sales Princeton",
64
- id: "marketingPR",
48
+ label: "Appointment Management",
49
+ value: "Appointment Management",
50
+ id: "208",
65
51
  },
66
52
  {
67
- label: "Installation Office Princeton",
68
- value: "Installation Office Princeton",
69
- id: "installationPR",
53
+ label: "Customer Service",
54
+ value: "Customer Service",
55
+ id: "209",
70
56
  },
71
57
  {
72
- label: "Warehouse Princeton",
73
- value: "Warehouse Princeton",
74
- id: "warehousePR",
58
+ label: "Energy",
59
+ value: "Energy",
60
+ id: "210",
75
61
  },
76
- ]
77
- },
78
- ]
79
- },
80
- {
81
- label: "Maryland",
82
- value: "Maryland",
83
- id: "MD",
84
- children: [
85
- {
86
- label: "Marketing & Sales MD",
87
- value: "Marketing & Sales MD",
88
- id: "marketingMD",
89
- },
90
- {
91
- label: "Installation Office MD",
92
- value: "Installation Office MD",
93
- id: "installationMD",
94
- },
95
- {
96
- label: "Warehouse MD",
97
- value: "Warehouse MD",
98
- id: "warehouseMD",
99
- },
100
- ]
101
- },
102
- {
103
- label: "Connecticut",
104
- value: "Connecticut",
105
- id: "CT",
106
- children: [
107
- {
108
- label: "Marketing & Sales CT",
109
- value: "Marketing & Sales CT",
110
- id: "marketingCT",
111
- },
112
- {
113
- label: "Installation Office CT",
114
- value: "Installation Office CT",
115
- id: "installationCT",
116
- },
117
- {
118
- label: "Warehouse CT",
119
- value: "Warehouse CT",
120
- id: "warehouseCT",
62
+ ],
121
63
  },
122
- ]
123
- },
124
- ]; %>
64
+ ],
65
+ }] %>
125
66
 
126
67
  <%= pb_rails("multi_level_select", props: {
127
68
  id: "multi-level-select-single-rails",
@@ -3,126 +3,69 @@ import MultiLevelSelect from "../_multi_level_select";
3
3
 
4
4
  const treeData = [
5
5
  {
6
- label: "HQ",
7
- value: "HQ",
8
- id: "hq",
9
- },
10
- {
11
- label: "Philadelphia",
12
- value: "Philadelphia",
13
- id: "phl",
6
+ label: "Power Home Remodeling",
7
+ value: "Power Home Remodeling",
8
+ id: "powerhome2",
9
+ expanded: true,
14
10
  children: [
15
11
  {
16
- label: "Marketing & Sales PHL",
17
- value: "Marketing & Sales PHL",
18
- id: "marketingPHL",
19
- },
20
- {
21
- label: "Installation Office PHL",
22
- value: "Installation Office PHL",
23
- id: "installationPHL",
24
- },
25
- {
26
- label: "Warehouse PHL",
27
- value: "Warehouse PHL",
28
- id: "warehousePHL",
29
- },
30
- ]
31
- },
32
- {
33
- label: "New Jersey",
34
- value: "New Jersey",
35
- id: "nj",
36
- children: [
37
- {
38
- label: "New Jersey",
39
- value: "New Jersey",
40
- id: "nj1",
12
+ label: "People",
13
+ value: "People",
14
+ id: "people2",
15
+ expanded: true,
41
16
  children: [
42
17
  {
43
- label: "Marketing & Sales NJ",
44
- value: "Marketing & Sales NJ",
45
- id: "marketingNJ",
18
+ label: "Talent Acquisition",
19
+ value: "Talent Acquisition",
20
+ id: "talent2",
46
21
  },
47
22
  {
48
- label: "Installation Office NJ",
49
- value: "Installation Office NJ",
50
- id: "installationNJ",
23
+ label: "Business Affairs",
24
+ value: "Business Affairs",
25
+ id: "business2",
26
+ children: [
27
+ {
28
+ label: "Initiatives",
29
+ value: "Initiatives",
30
+ id: "initiative2",
31
+ },
32
+ {
33
+ label: "Learning & Development",
34
+ value: "Learning & Development",
35
+ id: "development2",
36
+ },
37
+ ],
51
38
  },
52
39
  {
53
- label: "Warehouse NJ",
54
- value: "Warehouse NJ",
55
- id: "warehouseNJ",
40
+ label: "People Experience",
41
+ value: "People Experience",
42
+ id: "experience2",
56
43
  },
57
44
  ],
58
45
  },
59
46
  {
60
- label: "Princeton",
61
- value: "Princeton",
62
- id: "princeton",
47
+ label: "Contact Center",
48
+ value: "Contact Center",
49
+ id: "contact2",
63
50
  children: [
64
51
  {
65
- label: "Marketing & Sales Princeton",
66
- value: "Marketing & Sales Princeton",
67
- id: "marketingPR",
52
+ label: "Appointment Management",
53
+ value: "Appointment Management",
54
+ id: "appointment2",
68
55
  },
69
56
  {
70
- label: "Installation Office Princeton",
71
- value: "Installation Office Princeton",
72
- id: "installationPR",
57
+ label: "Customer Service",
58
+ value: "Customer Service",
59
+ id: "customer2",
73
60
  },
74
61
  {
75
- label: "Warehouse Princeton",
76
- value: "Warehouse Princeton",
77
- id: "warehousePR",
62
+ label: "Energy",
63
+ value: "Energy",
64
+ id: "energy2",
78
65
  },
79
- ]
80
- },
81
- ]
82
- },
83
- {
84
- label: "Maryland",
85
- value: "Maryland",
86
- id: "MD",
87
- children: [
88
- {
89
- label: "Marketing & Sales MD",
90
- value: "Marketing & Sales MD",
91
- id: "marketingMD",
92
- },
93
- {
94
- label: "Installation Office MD",
95
- value: "Installation Office MD",
96
- id: "installationMD",
97
- },
98
- {
99
- label: "Warehouse MD",
100
- value: "Warehouse MD",
101
- id: "warehouseMD",
102
- },
103
- ]
104
- },
105
- {
106
- label: "Connecticut",
107
- value: "Connecticut",
108
- id: "CT",
109
- children: [
110
- {
111
- label: "Marketing & Sales CT",
112
- value: "Marketing & Sales CT",
113
- id: "marketingCT",
114
- },
115
- {
116
- label: "Installation Office CT",
117
- value: "Installation Office CT",
118
- id: "installationCT",
119
- },
120
- {
121
- label: "Warehouse CT",
122
- value: "Warehouse CT",
123
- id: "warehouseCT",
66
+ ],
124
67
  },
125
- ]
68
+ ],
126
69
  },
127
70
  ];
128
71
 
@@ -2,7 +2,6 @@ examples:
2
2
  rails:
3
3
  - multi_level_select_default: Default
4
4
  - multi_level_select_single: Single Select
5
- - multi_level_select_single_children_only: Single Select Ultimate Children Only
6
5
  - multi_level_select_return_all_selected: Return All Selected
7
6
  - multi_level_select_selected_ids: Selected Ids
8
7
  - multi_level_select_with_form: With Form
@@ -10,6 +9,5 @@ examples:
10
9
  react:
11
10
  - multi_level_select_default: Default
12
11
  - multi_level_select_single: Single Select
13
- - multi_level_select_single_children_only: Single Select Ultimate Children Only
14
12
  - multi_level_select_return_all_selected: Return All Selected
15
13
  - multi_level_select_selected_ids: Selected Ids
@@ -1,5 +1,4 @@
1
1
  export { default as MultiLevelSelectDefault } from './_multi_level_select_default.jsx'
2
2
  export { default as MultiLevelSelectSingle } from './_multi_level_select_single.jsx'
3
- export { default as MultiLevelSelectSingleChildrenOnly } from './_multi_level_select_single_children_only.jsx'
4
3
  export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
5
4
  export { default as MultiLevelSelectSelectedIds } from "./_multi_level_select_selected_ids.jsx"
@@ -16,8 +16,6 @@ module Playbook
16
16
  default: "pills"
17
17
  prop :input_name, type: Playbook::Props::String,
18
18
  default: ""
19
- prop :ultimate_children_only, type: Playbook::Props::Boolean,
20
- default: false
21
19
  prop :variant, type: Playbook::Props::Enum,
22
20
  values: %w[multi single],
23
21
  default: "multi"
@@ -35,7 +33,6 @@ module Playbook
35
33
  returnAllSelected: return_all_selected,
36
34
  selectedIds: selected_ids,
37
35
  input_name: input_name,
38
- ultimateChildrenOnly: ultimate_children_only,
39
36
  variant: variant,
40
37
  }
41
38
  end
@@ -1,12 +1,37 @@
1
- <%= pb_rails("table", props: { size: "lg"} ) do %>
1
+ <%# Example data for demonstration purposes %>
2
+ <% data_rows = [
3
+ { 'territory' => 'North', 'firstname' => 'John', 'lastname' => 'Doe', 'age' => 30, 'job' => 'Engineer' },
4
+ { 'territory' => 'South', 'firstname' => 'Alice', 'lastname' => 'Smith', 'age' => 28, 'job' => 'Designer' },
5
+ { 'territory' => 'East', 'firstname' => 'Mike', 'lastname' => 'Johnson', 'age' => 35, 'job' => 'Manager' },
6
+ { 'territory' => 'West', 'firstname' => 'Sarah', 'lastname' => 'Brown', 'age' => 29, 'job' => 'Developer' },
7
+ { 'territory' => 'Central', 'firstname' => 'David', 'lastname' => 'Wilson', 'age' => 32, 'job' => 'Analyst' }
8
+ ]
9
+ %>
10
+
11
+ <%# Example sort method for demonstration purposes %>
12
+ <% if params["sort"] %>
13
+ <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %>
14
+ <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %>
15
+ <% data_rows.sort! do |a, b|
16
+ value_a = a[sort_param]
17
+ value_b = b[sort_param]
18
+
19
+ value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/)
20
+ value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/)
21
+
22
+ sort_direction * (value_a <=> value_b)
23
+ end %>
24
+ <% end %>
25
+
26
+ <%= pb_rails("table", props: { data_table: true, vertical_border: true, id: "table-header" } ) do %>
2
27
  <thead>
3
28
  <tr>
4
29
  <%= pb_rails("table/table_header", props: {
5
30
  text: "Territory",
6
31
  id: "territory",
7
32
  sort_menu: [
8
- { item: "Territory", link: "?sort=territory_desc", active: params["sort"] == "territory_desc", direction: "desc" },
9
- { item: "Territory", link: "?sort=territory_asc", active: params["sort"] == "territory_asc", direction: "asc" }
33
+ { item: "Territory", link: "?sort=territory_asc#table-header", active: params["sort"] == "territory_asc", direction: "asc" },
34
+ { item: "Territory", link: "?sort=territory_desc#table-header", active: params["sort"] == "territory_desc", direction: "desc" }
10
35
  ],
11
36
  }) %>
12
37
  <%= pb_rails("table/table_header", props: {
@@ -14,45 +39,36 @@
14
39
  text: "Full Name",
15
40
  colspan: 2,
16
41
  sort_menu: [
17
- { item: "First Name Descending", link: "?sort=firstname_desc", active: params["sort"] == "firstname_desc", direction: "desc" },
18
- { item: "First Name Ascending", link: "?sort=firstname_asc", active: params["sort"] == "firstname_asc", direction: "asc" },
19
- { item: "Last Name Descending", link: "?sort=lastname_desc", active: params["sort"] == "lastname_desc", direction: "desc" },
20
- { item: "Last Name Ascending", link: "?sort=lastname_asc", active: params["sort"] == "lastname_asc", direction: "asc" }
42
+ { item: "First Name Descending", link: "?sort=firstname_desc#table-header", active: params["sort"] == "firstname_desc", direction: "desc" },
43
+ { item: "First Name Ascending", link: "?sort=firstname_asc#table-header", active: params["sort"] == "firstname_asc", direction: "asc" },
44
+ { item: "Last Name Descending", link: "?sort=lastname_desc#table-header", active: params["sort"] == "lastname_desc", direction: "desc" },
45
+ { item: "Last Name Ascending", link: "?sort=lastname_asc#table-header", active: params["sort"] == "lastname_asc", direction: "asc" }
21
46
  ],
22
47
  }) %>
23
48
  <%= pb_rails("table/table_header", props: {
24
49
  text: "Age",
25
50
  id: "age",
26
- sort_dropdown: true,
27
51
  sort_menu: [
28
- { item: "Age Descending", link: "?sort=age_desc", active: params["sort"] == "age_desc", direction: "desc" },
29
- { item: "Age Ascending", link: "?sort=age_asc", active: params["sort"] == "age_asc", direction: "asc" }
52
+ { item: "Age Descending", link: "?sort=age_desc#table-header", active: params["sort"] == "age_desc", direction: "desc" },
53
+ { item: "Age Ascending", link: "?sort=age_asc#table-header", active: params["sort"] == "age_asc", direction: "asc" }
30
54
  ],
31
55
  }) %>
32
56
  <%= pb_rails("table/table_header", props: { text: "Job Title" }) %>
33
57
  </tr>
34
58
  </thead>
35
59
  <tbody>
36
- <tr>
37
- <td>Ter 1</td>
38
- <td>First Name 1</td>
39
- <td>Last Name 1</td>
40
- <td>Age 1</td>
41
- <td>Job 1</td>
42
- </tr>
43
- <tr>
44
- <td>Ter 2</td>
45
- <td>First Name 2</td>
46
- <td>Last Name 2</td>
47
- <td>Age 2</td>
48
- <td>Job 2</td>
49
- </tr>
50
- <tr>
51
- <td>Ter 3</td>
52
- <td>First Name 3</td>
53
- <td>Last Name 3</td>
54
- <td>Age 3</td>
55
- <td>Job 3</td>
56
- </tr>
60
+ <% data_rows.each do |row| %>
61
+ <tr>
62
+ <% row.each do |key, value| %>
63
+ <%= pb_rails("background", props: {
64
+ background_color: (params["sort"] && params["sort"].start_with?(key) ? "info_subtle" : "card_light"),
65
+ text_align: (value.is_a?(Integer) ? "right" : ""),
66
+ tag: "td"
67
+ }) do %>
68
+ <%= value %>
69
+ <% end %>
70
+ <% end %>
71
+ </tr>
72
+ <% end %>
57
73
  </tbody>
58
74
  <% end %>
@@ -6,3 +6,8 @@ presence of `sort_menu` enables the sort link within the header
6
6
  * `sort_dropdown` (boolean) optionally declares that (true) clicking a header's sort link opens a dropdown of sort options, or (false) each sort link click cycles through available sort_menu items in the order they are passed
7
7
  * passing a valid `colspan` will render sort options within a dropdown by default, without requiring `sort_dropdown` explicitly. Alternatively, the default sort dropdown can be prevented on headers with `colspan` by setting `sort_dropdown: false`, which reverts the column to sorting to multi-click default (each click of the sort link cycles through the available sort_menu items in the order they are passed)
8
8
  * `id` (string) is required for headers that have a dropdown (for popover reference); otherwise they are optional
9
+
10
+ </br>
11
+ <div class="pb_pill_kit_warning"><div class="pb_title_kit_size_4 pb_pill_text">Disclaimer</div></div>
12
+
13
+ This example uses a custom sort method that may need to be modified or replaced within your project.
@@ -3,7 +3,7 @@
3
3
  aria: object.aria,
4
4
  class: object.classname,
5
5
  data: object.data,
6
- id: "pb-th#{object.id}") do %>
6
+ id: "pb-th#{object.id}" ) do %>
7
7
  <% unless sorting_style? %>
8
8
  <%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_nolink" }) do %>
9
9
  <%= content.presence || object.text %>
@@ -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
  );