playbook_ui 14.21.2.pre.alpha.PLAY2233removetreemapchart8408 → 14.21.2.pre.alpha.PLAY2241tablestickycolumnsdatanotids8357

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +0 -8
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -30
  6. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +1 -4
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -4
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -25
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +3 -5
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
  13. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +39 -1
  14. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +39 -1
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +3 -3
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +4 -7
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +3 -6
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +3 -6
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +3 -3
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +3 -3
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +4 -7
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +3 -3
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +4 -7
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +10 -19
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +10 -19
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +10 -10
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +10 -10
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +10 -10
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +11 -20
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +3 -3
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +8 -8
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +10 -10
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +14 -23
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +3 -3
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +3 -6
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +3 -6
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.html.erb +3 -3
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +3 -3
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +3 -6
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +3 -3
  41. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +3 -3
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +4 -4
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.jsx +4 -4
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -4
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +4 -4
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +3 -3
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +3 -3
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +3 -3
  50. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +3 -3
  51. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +3 -3
  52. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +3 -3
  53. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +3 -6
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +3 -3
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +3 -3
  57. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -4
  58. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -3
  59. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +0 -4
  60. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.scss +14 -0
  61. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +119 -0
  62. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
  63. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
  64. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
  65. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
  66. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
  67. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
  68. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
  69. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
  70. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
  71. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
  72. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
  73. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
  74. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
  75. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
  76. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
  77. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
  78. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
  79. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
  80. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +63 -0
  81. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
  82. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +48 -0
  83. data/dist/chunks/_typeahead-BmfmVMFP.js +22 -0
  84. data/dist/chunks/_weekday_stacked-DAC7yY_H.js +45 -0
  85. data/dist/chunks/lib-C2o6nu8G.js +29 -0
  86. data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-EyK6DbAT.js} +1 -1
  87. data/dist/chunks/vendor.js +1 -1
  88. data/dist/menu.yml +9 -0
  89. data/dist/playbook-doc.js +3 -3
  90. data/dist/playbook-rails-react-bindings.js +1 -1
  91. data/dist/playbook-rails.js +1 -1
  92. data/dist/playbook.css +1 -1
  93. data/lib/playbook/version.rb +1 -1
  94. metadata +29 -16
  95. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +0 -64
  96. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +0 -7
  97. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.html.erb +0 -52
  98. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.jsx +0 -99
  99. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_rails.md +0 -1
  100. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_react.md +0 -1
  101. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.html.erb +0 -28
  102. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -47
  103. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_rails.md +0 -1
  104. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +0 -1
  105. data/dist/chunks/_typeahead-DOgzItP7.js +0 -22
  106. data/dist/chunks/_weekday_stacked-SYZ-Kt4V.js +0 -45
  107. data/dist/chunks/lib-Carqm8Ip.js +0 -29
@@ -2,7 +2,7 @@
2
2
  options = [
3
3
  {
4
4
  label: "Jasper Furniss",
5
- value: "jasperFurniss",
5
+ value: "Jasper Furniss",
6
6
  territory: "PHL",
7
7
  title: "Lead UX Engineer",
8
8
  id: "jasper-furniss",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  {
12
12
  label: "Ramon Ruiz",
13
- value: "ramonRuiz",
13
+ value: "Ramon Ruiz",
14
14
  territory: "PHL",
15
15
  title: "Senior UX Designer",
16
16
  id: "ramon-ruiz",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  label: "Carlos Lima",
21
- value: "carlosLima",
21
+ value: "Carlos Lima",
22
22
  territory: "PHL",
23
23
  title: "Nitro Developer",
24
24
  id: "carlos-lima",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  {
28
28
  label: "Courtney Long",
29
- value: "courtneyLong",
29
+ value: "Courtney Long",
30
30
  territory: "PHL",
31
31
  title: "Lead UX Designer",
32
32
  id: "courtney-long",
@@ -12,21 +12,21 @@ const DropdownWithCustomOptions = (props) => {
12
12
  const options = [
13
13
  {
14
14
  label: "United States",
15
- value: "unitedStates",
15
+ value: "United States",
16
16
  areaCode: "+1",
17
17
  icon: "🇺🇸",
18
18
  id: "United-states"
19
19
  },
20
20
  {
21
21
  label: "Canada",
22
- value: "canada",
22
+ value: "Canada",
23
23
  areaCode: "+1",
24
24
  icon: "🇨🇦",
25
25
  id: "canada"
26
26
  },
27
27
  {
28
28
  label: "Pakistan",
29
- value: "pakistan",
29
+ value: "Pakistan",
30
30
  areaCode: "+92",
31
31
  icon: "🇵🇰",
32
32
  id: "pakistan"
@@ -2,21 +2,21 @@
2
2
  options = [
3
3
  {
4
4
  label: "United States",
5
- value: "unitedStates",
5
+ value: "United States",
6
6
  areaCode: "+1",
7
7
  icon: "🇺🇸",
8
8
  id: "us"
9
9
  },
10
10
  {
11
11
  label: "Canada",
12
- value: "canada",
12
+ value: "Canada",
13
13
  areaCode: "+1",
14
14
  icon: "🇨🇦",
15
15
  id: "ca"
16
16
  },
17
17
  {
18
18
  label: "Pakistan",
19
- value: "pakistan",
19
+ value: "Pakistan",
20
20
  areaCode: "+92",
21
21
  icon: "🇵🇰",
22
22
  id: "pk"
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'unitedStates', id: 'us' },
4
- { label: 'Canada', value: 'canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
6
  ]
7
7
 
8
8
  %>
@@ -6,21 +6,21 @@ const DropdownWithCustomPadding = (props) => {
6
6
  const options = [
7
7
  {
8
8
  label: "United States",
9
- value: "unitedStates",
9
+ value: "United States",
10
10
  areaCode: "+1",
11
11
  icon: "🇺🇸",
12
12
  id: "United-states"
13
13
  },
14
14
  {
15
15
  label: "Canada",
16
- value: "canada",
16
+ value: "Canada",
17
17
  areaCode: "+1",
18
18
  icon: "🇨🇦",
19
19
  id: "canada"
20
20
  },
21
21
  {
22
22
  label: "Pakistan",
23
- value: "pakistan",
23
+ value: "Pakistan",
24
24
  areaCode: "+92",
25
25
  icon: "🇵🇰",
26
26
  id: "pakistan"
@@ -14,21 +14,21 @@ const [selectedOption, setSelectedOption] = useState();
14
14
  const options = [
15
15
  {
16
16
  label: "United States",
17
- value: "unitedStates",
17
+ value: "United States",
18
18
  areaCode: "+1",
19
19
  icon: "🇺🇸",
20
20
  id: "United-states"
21
21
  },
22
22
  {
23
23
  label: "Canada",
24
- value: "canada",
24
+ value: "Canada",
25
25
  areaCode: "+1",
26
26
  icon: "🇨🇦",
27
27
  id: "canada"
28
28
  },
29
29
  {
30
30
  label: "Pakistan",
31
- value: "pakistan",
31
+ value: "Pakistan",
32
32
  areaCode: "+92",
33
33
  icon: "🇵🇰",
34
34
  id: "pakistan"
@@ -2,21 +2,21 @@
2
2
  options = [
3
3
  {
4
4
  label: "United States",
5
- value: "unitedStates",
5
+ value: "United States",
6
6
  areaCode: "+1",
7
7
  icon: "🇺🇸",
8
8
  id: "us"
9
9
  },
10
10
  {
11
11
  label: "Canada",
12
- value: "canada",
12
+ value: "Canada",
13
13
  areaCode: "+1",
14
14
  icon: "🇨🇦",
15
15
  id: "ca"
16
16
  },
17
17
  {
18
18
  label: "Pakistan",
19
- value: "pakistan",
19
+ value: "Pakistan",
20
20
  areaCode: "+92",
21
21
  icon: "🇵🇰",
22
22
  id: "pk"
@@ -11,21 +11,21 @@ const [isDropDownClosed, setIsDropdownClosed] = useDropdown(true);
11
11
  const options = [
12
12
  {
13
13
  label: "United States",
14
- value: "unitedStates",
14
+ value: "United States",
15
15
  areaCode: "+1",
16
16
  icon: "🇺🇸",
17
17
  id: "United-states"
18
18
  },
19
19
  {
20
20
  label: "Canada",
21
- value: "canada",
21
+ value: "Canada",
22
22
  areaCode: "+1",
23
23
  icon: "🇨🇦",
24
24
  id: "canada"
25
25
  },
26
26
  {
27
27
  label: "Pakistan",
28
- value: "pakistan",
28
+ value: "Pakistan",
29
29
  areaCode: "+92",
30
30
  icon: "🇵🇰",
31
31
  id: "pakistan"
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'unitedStates', id: 'us' },
4
- { label: 'Canada', value: 'canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
6
  ]
7
7
 
8
8
  %>
@@ -6,18 +6,15 @@ const DropdownDefault = (props) => {
6
6
  const options = [
7
7
  {
8
8
  label: "United States",
9
- value: "unitedStates",
10
- id: "us"
9
+ value: "United States",
11
10
  },
12
11
  {
13
12
  label: "Canada",
14
- value: "canada",
15
- id: "ca"
13
+ value: "Canada",
16
14
  },
17
15
  {
18
16
  label: "Pakistan",
19
- value: "pakistan",
20
- id: "pk"
17
+ value: "Pakistan",
21
18
  }
22
19
  ];
23
20
 
@@ -8,20 +8,20 @@ const [selectedOption, setSelectedOption] = useState();
8
8
  const options = [
9
9
  {
10
10
  label: "United States",
11
- value: "unitedStates",
11
+ value: "United States",
12
12
  icon: "🇺🇸",
13
13
  id: "United-states"
14
14
 
15
15
  },
16
16
  {
17
17
  label: "United Kingdom",
18
- value: "unitedKingdom",
18
+ value: "United Kingdom",
19
19
  icon: "🇬🇧",
20
20
  id: "united-kingdom"
21
21
  },
22
22
  {
23
23
  label: "Pakistan",
24
- value: "pakistan",
24
+ value: "Pakistan",
25
25
  icon: "🇵🇰",
26
26
  id: "pakistan"
27
27
  }
@@ -2,21 +2,21 @@
2
2
  options = [
3
3
  {
4
4
  label: "United States",
5
- value: "unitedStates",
5
+ value: "United States",
6
6
  areaCode: "+1",
7
7
  icon: "🇺🇸",
8
8
  id: "us"
9
9
  },
10
10
  {
11
11
  label: "United Kingdom",
12
- value: "unitedKingdom",
12
+ value: "United Kingdom",
13
13
  areaCode: "+44",
14
14
  icon: "🇬🇧",
15
15
  id: "gb"
16
16
  },
17
17
  {
18
18
  label: "Pakistan",
19
- value: "pakistan",
19
+ value: "Pakistan",
20
20
  areaCode: "+92",
21
21
  icon: "🇵🇰",
22
22
  id: "pk"
@@ -15,8 +15,6 @@ examples:
15
15
  - dropdown_with_custom_trigger_rails: Custom Trigger
16
16
  - dropdown_with_search_rails: Custom Trigger Dropdown with Search
17
17
  - dropdown_with_custom_padding: Custom Option Padding
18
- - dropdown_with_custom_icon_options: Custom Icon Options
19
- # - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
20
18
  - dropdown_error: Dropdown with Error
21
19
  - dropdown_default_value: Default Value
22
20
  - dropdown_multi_select_with_default: Multi Select Default Value
@@ -39,8 +37,6 @@ examples:
39
37
  - dropdown_with_custom_trigger: Custom Trigger
40
38
  - dropdown_with_search: Custom Trigger Dropdown with Search
41
39
  - dropdown_with_custom_padding: Custom Option Padding
42
- - dropdown_with_custom_icon_options: Custom Icon Options
43
- # - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
44
40
  - dropdown_error: Dropdown with Error
45
41
  - dropdown_default_value: Default Value
46
42
  - dropdown_multi_select_with_default: Multi Select Default Value
@@ -19,6 +19,4 @@ export { default as DropdownMultiSelect } from './_dropdown_multi_select.jsx'
19
19
  export { default as DropdownMultiSelectDisplay } from './_dropdown_multi_select_display.jsx'
20
20
  export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_multi_select_with_autocomplete.jsx'
21
21
  export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
22
- export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
23
- export {default as DropdownWithCustomIconOptions} from './_dropdown_with_custom_icon_options.jsx'
24
- export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
22
+ export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
@@ -4,10 +4,6 @@
4
4
  border-right: 1px solid $border_light !important;
5
5
  }
6
6
 
7
- thead tr:not(:first-child) th {
8
- border-right: 1px solid $border_light !important;
9
- }
10
-
11
7
  @media screen and (min-width: $screen-xs-min) {
12
8
  tr:hover, .pb_table_tr:hover {
13
9
  td:last-child, .pb_table_td:last-child {
@@ -0,0 +1,14 @@
1
+ .pb_treemap_chart {
2
+ .highcharts-drillup-button {
3
+ .highcharts-button-box {
4
+ fill: $primary;
5
+ &:hover {
6
+ fill: #004ebb;
7
+ }
8
+ }
9
+ text {
10
+ transform: translateX(25px);
11
+ fill: $white;
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,119 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import classnames from "classnames";
3
+
4
+ import { globalProps } from "../utilities/globalProps";
5
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
6
+
7
+ import HighchartsReact from "highcharts-react-official";
8
+ import Highcharts from "highcharts";
9
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
10
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
11
+ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
12
+ import treemap from 'highcharts/modules/treemap'
13
+ import { merge } from '../utilities/object'
14
+
15
+ type TreemapChartProps = {
16
+ chartData: {
17
+ name: string;
18
+ parent?: string | number;
19
+ value: number;
20
+ color?: string;
21
+ id?: string | number;
22
+ }[];
23
+ className?: string;
24
+ colors: string[];
25
+ customOptions?: Partial<Highcharts.Options>;
26
+ dark?: boolean;
27
+ drillable: boolean;
28
+ grouped: boolean;
29
+ height?: string;
30
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
31
+ id: number | string;
32
+ title?: string;
33
+ tooltipHtml: string;
34
+ type?: string;
35
+ aria?: { [key: string]: string };
36
+ data?: { [key: string]: string };
37
+ };
38
+
39
+ const TreemapChart = ({
40
+ aria = {},
41
+ data = {},
42
+ chartData,
43
+ colors,
44
+ customOptions = {},
45
+ dark = false,
46
+ drillable = false,
47
+ grouped = false,
48
+ height,
49
+ htmlOptions = {},
50
+ id,
51
+ title = "",
52
+ tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
53
+ type = "treemap",
54
+ ...props
55
+ }: TreemapChartProps): React.ReactElement => {
56
+
57
+ const ariaProps = buildAriaProps(aria)
58
+ const dataProps = buildDataProps(data)
59
+ const htmlProps = buildHtmlProps(htmlOptions)
60
+
61
+ const setupTheme = () => {
62
+ dark
63
+ ? Highcharts.setOptions(highchartsDarkTheme)
64
+ : Highcharts.setOptions(highchartsTheme);
65
+ };
66
+ treemap(Highcharts)
67
+ setupTheme();
68
+
69
+ const staticOptions = {
70
+ title: {
71
+ text: title,
72
+ },
73
+ chart: {
74
+ height: height,
75
+ type: type,
76
+ },
77
+ credits: false,
78
+ series: [
79
+ {
80
+ data: chartData,
81
+ },
82
+ ],
83
+ plotOptions: {
84
+ treemap: {
85
+ tooltip: {
86
+ pointFormat: tooltipHtml,
87
+ },
88
+ allowTraversingTree: drillable,
89
+ colorByPoint: !grouped,
90
+ colors:
91
+ colors !== undefined && colors.length > 0
92
+ ? mapColors(colors)
93
+ : highchartsTheme.colors,
94
+ },
95
+ },
96
+ };
97
+
98
+ const [options, setOptions] = useState({});
99
+
100
+ useEffect(() => {
101
+ setOptions(merge(staticOptions, customOptions));
102
+ }, [chartData]);
103
+
104
+ return (
105
+ <HighchartsReact
106
+ containerProps={{
107
+ className: classnames(globalProps(props), "pb_treemap_chart"),
108
+ id: id,
109
+ ...ariaProps,
110
+ ...dataProps,
111
+ ...htmlProps
112
+ }}
113
+ highcharts={Highcharts}
114
+ options={options}
115
+ />
116
+ );
117
+ };
118
+
119
+ export default TreemapChart;
@@ -0,0 +1,5 @@
1
+ Treemap charts are used to compare the relative size of groups of data. They can also use a nested data structure, allowing a user to drill down into a group to see its constituent data points.
2
+
3
+ The default height of treemap is 400px and can be changed. The default height is in pixel units, but can also use percentage string (percentage would be that of the width. For example, `height:"50%"` would mean that the height is 50% of the width). This allows for preserving the aspect ratio across responsive sizes.
4
+
5
+ For more information, see: <a href="https://api.highcharts.com/highcharts/chart.height" target="_blank"> highcharts/chart.height</a>.
@@ -0,0 +1,37 @@
1
+ <% data = [
2
+ {
3
+ name: "Pepperoni",
4
+ parent: "Toppings",
5
+ value: 600,
6
+ }, {
7
+ name: "Cheese",
8
+ parent: "Toppings",
9
+ value: 510,
10
+ }, {
11
+ name: "Mushroom",
12
+ parent: "Toppings",
13
+ value: 330,
14
+ },{
15
+ name: "Onions",
16
+ parent: "Toppings",
17
+ value: 250,
18
+ }, {
19
+ name: "Olives",
20
+ parent: "Toppings",
21
+ value: 204,
22
+ }, {
23
+ name: "Pineapple",
24
+ parent: "Toppings",
25
+ value: 90,
26
+ }, {
27
+ name: "Pizza Toppings",
28
+ id: "Toppings",
29
+ },
30
+ ] %>
31
+
32
+ <%= pb_rails("treemap_chart", props: {
33
+ chart_data: data,
34
+ colors: ["data-4", "data-7", "#8E6E53", "#124732"],
35
+ id: "treemap-colors",
36
+ title: "Favored Pizza Toppings",
37
+ }) %>
@@ -0,0 +1,48 @@
1
+ import React from 'react'
2
+
3
+ import TreemapChart from '../_treemap_chart'
4
+
5
+ const chartData = [
6
+ {
7
+ name: "Pepperoni",
8
+ parent: "Toppings",
9
+ value: 600,
10
+ }, {
11
+ name: "Cheese",
12
+ parent: "Toppings",
13
+ value: 510,
14
+ }, {
15
+ name: "Mushroom",
16
+ parent: "Toppings",
17
+ value: 330,
18
+ },{
19
+ name: "Onions",
20
+ parent: "Toppings",
21
+ value: 250,
22
+ }, {
23
+ name: "Olives",
24
+ parent: "Toppings",
25
+ value: 204,
26
+ }, {
27
+ name: "Pineapple",
28
+ parent: "Toppings",
29
+ value: 90,
30
+ }, {
31
+ name: "Pizza Toppings",
32
+ id: "Toppings",
33
+ },
34
+ ]
35
+
36
+ const TreemapChartColors = (props) => (
37
+ <div>
38
+ <TreemapChart
39
+ chartData={chartData}
40
+ colors={["data-4", "data-7", "#8E6E53", "#124732"]}
41
+ id="treemap-colors"
42
+ title="Favored Pizza Toppings"
43
+ {...props}
44
+ />
45
+ </div>
46
+ )
47
+
48
+ export default TreemapChartColors
@@ -0,0 +1,2 @@
1
+ Custom data colors allow for color customization to match the needs of business requirements.
2
+ Pass the prop `colors` and use desired values `data-1 | data-2 | data-3 | data-4 | data-5 | data-6 | data-7 | data-8` in an array. Hex colors are also available `eg: #CA0095`
@@ -0,0 +1,37 @@
1
+ <% data = [
2
+ {
3
+ name: "Pepperoni",
4
+ parent: "Toppings",
5
+ value: 600,
6
+ }, {
7
+ name: "Cheese",
8
+ parent: "Toppings",
9
+ value: 510,
10
+ }, {
11
+ name: "Mushroom",
12
+ parent: "Toppings",
13
+ value: 330,
14
+ },{
15
+ name: "Onions",
16
+ parent: "Toppings",
17
+ value: 250,
18
+ }, {
19
+ name: "Olives",
20
+ parent: "Toppings",
21
+ value: 204,
22
+ }, {
23
+ name: "Pineapple",
24
+ parent: "Toppings",
25
+ value: 90,
26
+ }, {
27
+ name: "Pizza Toppings",
28
+ id: "Toppings",
29
+ },
30
+ ] %>
31
+
32
+
33
+ <%= pb_rails("treemap_chart", props: {
34
+ chart_data: data,
35
+ id: "treemap-default",
36
+ title: "Favored Pizza Toppings",
37
+ }) %>
@@ -0,0 +1,47 @@
1
+ import React from 'react'
2
+
3
+ import TreemapChart from '../_treemap_chart'
4
+
5
+ const chartData = [
6
+ {
7
+ name: "Pepperoni",
8
+ parent: "Toppings",
9
+ value: 600,
10
+ }, {
11
+ name: "Cheese",
12
+ parent: "Toppings",
13
+ value: 510,
14
+ }, {
15
+ name: "Mushroom",
16
+ parent: "Toppings",
17
+ value: 330,
18
+ },{
19
+ name: "Onions",
20
+ parent: "Toppings",
21
+ value: 250,
22
+ }, {
23
+ name: "Olives",
24
+ parent: "Toppings",
25
+ value: 204,
26
+ }, {
27
+ name: "Pineapple",
28
+ parent: "Toppings",
29
+ value: 90,
30
+ }, {
31
+ name: "Pizza Toppings",
32
+ id: "Toppings",
33
+ },
34
+ ]
35
+
36
+ const TreemapChartDefault = (props) => (
37
+ <div>
38
+ <TreemapChart
39
+ chartData={chartData}
40
+ id="treemap-default"
41
+ title="Favored Pizza Toppings"
42
+ {...props}
43
+ />
44
+ </div>
45
+ )
46
+
47
+ export default TreemapChartDefault
@@ -0,0 +1,3 @@
1
+ Points are automatically arranged by their `value` size.
2
+
3
+ By default, point colors are assigned sequentially from the global `data` colors. Note that data points without a value (such as parent nodes) will still take on the next available color.