playbook_ui 14.22.0.pre.alpha.PLAY2132phonenumberinputvalidationtooaggressive8863 → 14.22.0.pre.alpha.PLAY2207preservesearchinputrails8526

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +7 -6
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +11 -32
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -5
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -6
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -4
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
  9. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  10. data/app/pb_kits/playbook/pb_badge/_badge.scss +6 -5
  11. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +15 -33
  12. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +72 -0
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +6 -0
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +15 -33
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +22 -52
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +16 -12
  17. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +15 -31
  18. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +16 -39
  19. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +38 -86
  20. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +15 -32
  21. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
  22. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
  23. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +22 -72
  24. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
  25. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +15 -31
  26. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +16 -37
  27. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +3 -1
  28. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +3 -1
  29. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +2 -0
  30. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +1 -36
  31. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +26 -71
  32. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +16 -29
  33. data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors_rails.md → _circle_chart_colors.md} +1 -1
  34. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +16 -28
  35. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +2 -4
  36. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +15 -23
  37. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +51 -81
  38. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +75 -103
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +6 -3
  40. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +13 -19
  41. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
  42. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
  43. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +17 -30
  44. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +20 -34
  45. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +20 -29
  46. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +20 -28
  47. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +1 -0
  48. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -0
  49. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +17 -27
  50. data/app/pb_kits/playbook/pb_table/_table.tsx +4 -4
  51. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +8 -8
  52. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +1 -1
  53. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +12 -12
  54. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +3 -3
  55. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +12 -12
  56. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +3 -3
  57. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -1
  58. data/app/pb_kits/playbook/pb_tooltip/index.js +36 -59
  59. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -9
  60. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.html.erb +0 -1
  61. data/dist/chunks/{_typeahead-Do6525vz.js → _typeahead-B7FRYVtS.js} +3 -3
  62. data/dist/chunks/_weekday_stacked-B0oaGhTW.js +45 -0
  63. data/dist/chunks/{lib-DYpq0k8j.js → lib-Carqm8Ip.js} +1 -1
  64. data/dist/chunks/{pb_form_validation-BUOKwfvW.js → pb_form_validation-DqRmTS8m.js} +1 -1
  65. data/dist/chunks/vendor.js +1 -1
  66. data/dist/playbook-doc.js +2 -2
  67. data/dist/playbook-rails-react-bindings.js +1 -1
  68. data/dist/playbook-rails.js +1 -1
  69. data/dist/playbook.css +1 -1
  70. data/lib/playbook/version.rb +1 -1
  71. metadata +14 -19
  72. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +0 -65
  73. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +0 -5
  74. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.jsx +0 -69
  75. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +0 -1
  76. data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +0 -106
  77. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +0 -3
  78. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +0 -2
  79. data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +0 -1
  80. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +0 -14
  81. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +0 -1
  82. data/dist/chunks/_circle_chart-C56zcOHC.js +0 -1
  83. data/dist/chunks/_weekday_stacked-CrFm3XuJ.js +0 -45
  84. /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open_react.md → _tooltip_click_open.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d6a59e379ef07855a87f0d7307d5a76bf1de432a900d969397a397d9a10a99e
4
- data.tar.gz: 372b3ab76782e480172dc12fad993af8a3344ce87f46af9890c7bd46c47186f1
3
+ metadata.gz: fb55b0bca007611e41aa7ce0472e8e483b7cd331474f40cb148c7b1035a49f55
4
+ data.tar.gz: '062979c589167bf83791e83d6ba8bdf57027f60a5f3dca112becf14c5329eeb3'
5
5
  SHA512:
6
- metadata.gz: 290439859254bfa9e21304b8e4c3d3c575d329f60ad001044e9cb74e5745f30e82a4056ccc703c4cfaae45f7ec77402ea2e2e0cdfbe541371ee527d8947aadeb
7
- data.tar.gz: 12344f42764d13b4412482833c296637561d36c02a86584db409d3fee0b45a053b58806e1d1ed7eb0b978c3b263b937af3948ba42296585f39e2cdd1adb5654b
6
+ metadata.gz: 8bcbbe90d7ab4ba8461d71468d0f12ba34c2fcda3d6254de02d4ef3b0ab9ca49009af25122de796e7e7403dbacc0241781d03fd5401516a605dc2bb831c6fd46
7
+ data.tar.gz: c1d521f3b072a5326b6caa43efbdd462c68d8861b91a8db031fa8c974c088e947709d0c2bfe28a46a38358232d152a01924d097214e74b7e88883a82f432e4ef
@@ -20,7 +20,7 @@ interface CustomCellProps {
20
20
  customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
21
21
  selectableRows?: boolean
22
22
  customStyle?: GenericObject
23
- }
23
+ }
24
24
 
25
25
  export const CustomCell = ({
26
26
  getValue,
@@ -35,7 +35,7 @@ export const CustomCell = ({
35
35
 
36
36
  const handleOnExpand = (row: Row<GenericObject>) => {
37
37
  onRowToggleClick && onRowToggleClick(row);
38
-
38
+
39
39
  if (!expandedControl) {
40
40
  setExpanded({ ...expanded, [row.id]: !row.getIsExpanded() });
41
41
  }
@@ -46,8 +46,8 @@ export const CustomCell = ({
46
46
 
47
47
  return (
48
48
  <div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
49
- <Flex
50
- alignItems="center"
49
+ <Flex
50
+ alignItems="center"
51
51
  columnGap="xs"
52
52
  justify="start"
53
53
  orientation="row"
@@ -71,11 +71,12 @@ export const CustomCell = ({
71
71
  >
72
72
  {row.getIsExpanded() ? (
73
73
  <Icon cursor="pointer"
74
- icon="circle-play-down"
74
+ icon="circle-play"
75
+ rotation={90}
75
76
  />
76
77
  ) : (
77
78
  <Icon cursor="pointer"
78
- icon="circle-play"
79
+ icon="circle-play"
79
80
  />
80
81
  )}
81
82
  </button>
@@ -7,7 +7,6 @@ import { GlobalProps } from "../../utilities/globalProps"
7
7
 
8
8
  import Flex from "../../pb_flex/_flex"
9
9
  import Caption from "../../pb_caption/_caption"
10
- import Icon from "../../pb_icon/_icon"
11
10
 
12
11
  import { ToggleIconButton } from "./ToggleIconButton"
13
12
  import { renderCollapsibleTrail } from "./CollapsibleTrail"
@@ -33,19 +32,17 @@ export const SubRowHeaderRow = ({
33
32
  subRowHeaders,
34
33
  table,
35
34
  }: SubRowHeaderRowProps & GlobalProps) => {
36
- const { inlineRowLoading, customSort, onCustomSortClick } = useContext(AdvancedTableContext)
35
+ const { inlineRowLoading } = useContext(AdvancedTableContext)
37
36
 
38
37
  const numberOfColumns = table.getAllFlatColumns().length
39
38
  const rowHasChildren = row.original.children ? true : false
40
39
  const canExpand = inlineRowLoading ? rowHasChildren : row.getCanExpand()
41
- const hasSubrowsToSort = row.getParentRow()?.subRows
42
-
43
40
 
44
41
  return (
45
42
  <tr className="custom-row bg-silver">
46
43
  <td
47
44
  className={`custom-row-first-column ${
48
- isChrome() ? "chrome-styles" : ""
45
+ isChrome() ? "chrome-styles" : ""
49
46
  }`}
50
47
  colSpan={1}
51
48
  >
@@ -53,39 +50,21 @@ export const SubRowHeaderRow = ({
53
50
  <div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
54
51
  <Flex align="center"
55
52
  columnGap="xs"
56
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
- //@ts-ignore
58
- justifyContent={customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 ? "between" : undefined}
59
53
  >
60
- <Flex columnGap="xs">
61
- {enableToggleExpansion === "all" && canExpand ? (
62
- <ToggleIconButton onClick={onClick}
63
- row={row}
64
- />
65
- ) : null}
66
- <Caption
67
- marginLeft={canExpand ? "none" : "xs"}
68
- text={subRowHeaders[row.depth - 1]}
54
+ {enableToggleExpansion === "all" && canExpand ? (
55
+ <ToggleIconButton onClick={onClick}
56
+ row={row}
69
57
  />
70
- </Flex>
71
- {customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 && (
72
- <button
73
- aria-label="Sort this group"
74
- className="sort-button-icon gray-icon"
75
- onClick={() => { onCustomSortClick && onCustomSortClick(row.getParentRow()?.subRows)}}
76
- >
77
- <Icon
78
- cursor="pointer"
79
- fixedWidth
80
- icon="sort"
81
- />
82
- </button>
83
- )}
58
+ ) : null}
59
+ <Caption
60
+ marginLeft={canExpand ? "none" : "xs"}
61
+ text={subRowHeaders[row.depth - 1]}
62
+ />
84
63
  </Flex>
85
64
  </div>
86
65
  </td>
87
66
 
88
67
  <td colSpan={numberOfColumns - 1} />
89
68
  </tr>
90
- );
69
+ )
91
70
  }
@@ -87,7 +87,7 @@ export function useTableState({
87
87
  // Handle grouped columns
88
88
  if (column.columns && column.columns.length > 0) {
89
89
  return {
90
- header: column.header || column.label || "",
90
+ header: column.label || "",
91
91
  columns: buildColumns(column.columns, false),
92
92
  };
93
93
  }
@@ -95,7 +95,7 @@ export function useTableState({
95
95
  // Define the base column structure
96
96
  const columnStructure = {
97
97
  ...columnHelper.accessor(column.accessor, {
98
- header: column.header ?? column.label ?? "",
98
+ header: column.label || "",
99
99
  }),
100
100
  };
101
101
 
@@ -189,11 +189,6 @@
189
189
  box-sizing: border-box !important;
190
190
  }
191
191
  }
192
- // Fixes for tooltip picking up th styling from Table kit
193
- .pb_tooltip_kit {
194
- font-weight: unset;
195
- text-transform: unset;
196
- }
197
192
  }
198
193
 
199
194
  .pb_advanced_table_body {
@@ -36,7 +36,6 @@ type AdvancedTableProps = {
36
36
  columnDefinitions: GenericObject[]
37
37
  columnGroupBorderColor?: "text_lt_default" | "text_lt_light" | "text_lt_lighter" | "text_dk_default" | "text_dk_light" | "text_dk_lighter"
38
38
  columnVisibilityControl?: GenericObject
39
- customSort?:boolean;
40
39
  dark?: boolean
41
40
  data?: { [key: string]: string }
42
41
  enableToggleExpansion?: "all" | "header" | "none"
@@ -68,7 +67,6 @@ type AdvancedTableProps = {
68
67
  tableProps?: GenericObject
69
68
  toggleExpansionIcon?: string | string[]
70
69
  onRowSelectionChange?: (arg: RowSelectionState) => void
71
- onCustomSortClick?: (arg: GenericObject[]) => void
72
70
  virtualizedRows?: boolean
73
71
  allowFullScreen?: boolean
74
72
  fullScreenControl?: (controls: FullscreenControls) => void
@@ -83,7 +81,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
83
81
  columnDefinitions,
84
82
  columnGroupBorderColor,
85
83
  columnVisibilityControl,
86
- customSort,
87
84
  dark = false,
88
85
  data = {},
89
86
  enableToggleExpansion = "header",
@@ -98,7 +95,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
98
95
  maxHeight,
99
96
  onRowToggleClick,
100
97
  onToggleExpansionClick,
101
- onCustomSortClick,
102
98
  pagination = false,
103
99
  paginationProps,
104
100
  pinnedRows,
@@ -329,7 +325,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
329
325
  columnDefinitions={columnDefinitions}
330
326
  columnGroupBorderColor={columnGroupBorderColor}
331
327
  columnVisibilityControl={columnVisibilityControl}
332
- customSort={customSort}
333
328
  enableToggleExpansion={enableToggleExpansion}
334
329
  enableVirtualization={virtualizedRows}
335
330
  expandByDepth={expandByDepth}
@@ -341,7 +336,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
341
336
  isActionBarVisible={isActionBarVisible}
342
337
  isFullscreen={isFullscreen}
343
338
  loading={loading}
344
- onCustomSortClick={onCustomSortClick}
345
339
  onExpandByDepthClick={onExpandByDepthClick}
346
340
  pinnedRows={pinnedRows}
347
341
  responsive={responsive}
@@ -19,15 +19,14 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- - advanced_table_column_styling_rails: Column Styling
23
- - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
+ # - advanced_table_column_styling_rails: Column Styling
23
+ # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
24
 
25
25
  react:
26
26
  - advanced_table_default: Default (Required Props)
27
27
  - advanced_table_loading: Loading State
28
28
  - advanced_table_sort: Enable Sorting
29
29
  - advanced_table_sort_control: Sort Control
30
- - advanced_table_custom_sort: Custom Sort
31
30
  - advanced_table_expanded_control: Expanded Control
32
31
  - advanced_table_expand_by_depth: Expand by Depth
33
32
  - advanced_table_subrow_headers: SubRow Headers
@@ -41,7 +40,6 @@ examples:
41
40
  - advanced_table_inline_row_loading: Inline Row Loading
42
41
  - advanced_table_responsive: Responsive Tables
43
42
  - advanced_table_custom_cell: Custom Components for Cells
44
- - advanced_table_with_custom_header: Custom Header Cell
45
43
  - advanced_table_pagination: Pagination
46
44
  - advanced_table_pagination_with_props: Pagination Props
47
45
  - advanced_table_column_headers: Multi-Header Columns
@@ -38,5 +38,3 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
38
38
  export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
39
39
  export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
40
40
  export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
41
- export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
42
- export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
@@ -30,11 +30,11 @@
30
30
  class="gray-icon expand-toggle-icon"
31
31
  data-advanced-table="true">
32
32
  <%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
33
- <%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play-down", cursor: "pointer" }) %>
33
+ <%= pb_rails("icon", props: { id: "advanced-table_close_icon", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
34
34
  </button>
35
35
  <% end %>
36
36
  <% end %>
37
- <%= pb_rails("flex/flex_item") do %>
37
+ <%= pb_rails("flex/flex_item") do %>
38
38
  <% if column[:custom_renderer].present? %>
39
39
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
40
40
  <% elsif index.zero? %>
@@ -5,7 +5,7 @@
5
5
  @import "../tokens/typography";
6
6
 
7
7
  [class^=pb_badge_kit] {
8
- $pb_badge_height_rounded: 16px;
8
+ $pb_badge_height: 18px;
9
9
 
10
10
  display: inline-flex;
11
11
  align-items: center;
@@ -13,6 +13,7 @@
13
13
  border-radius: $border_rad_light;
14
14
  padding: 0 $space_xs/2;
15
15
  border-width: 1px;
16
+ border-style: solid;
16
17
  border-color: $card_light;
17
18
  white-space: nowrap;
18
19
 
@@ -30,10 +31,10 @@
30
31
  }
31
32
 
32
33
  &[class*=_rounded] {
33
- height: $pb_badge_height_rounded;
34
- min-height: $pb_badge_height_rounded;
35
- min-width: $pb_badge_height_rounded;
36
- border-radius: $pb_badge_height_rounded / 2;
34
+ height: $pb_badge_height;
35
+ min-height: $pb_badge_height;
36
+ min-width: $pb_badge_height;
37
+ border-radius: $pb_badge_height / 2;
37
38
  }
38
39
 
39
40
  &[class*=_notification] {
@@ -1,10 +1,6 @@
1
1
  import React from 'react'
2
- import colors from '../../tokens/exports/_colors.module.scss'
3
- import barGraphTheme from '../barGraphTheme';
4
- import Highcharts from "highcharts";
5
- import HighchartsReact from "highcharts-react-official";
6
-
7
2
 
3
+ import BarGraph from '../_bar_graph'
8
4
 
9
5
  const chartData = [{
10
6
  name: 'Installation',
@@ -23,33 +19,19 @@ const chartData = [{
23
19
  data: [1111, 677, 3245, 500, 200],
24
20
  }]
25
21
 
26
- const chartOptions = {
27
- series: chartData,
28
- title: {
29
- text: "Bar Graph with Custom Data Colors",
30
- },
31
- xAxis: {
32
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
33
- },
34
- yAxis: {
35
- title: {
36
- text: "Number of Employees",
37
- },
38
- },
39
- colors: [colors.data_4, colors.data_5, colors.data_6, colors.data_7, colors.data_8],
40
- }
41
-
42
- const BarGraphColors = () => {
43
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
44
-
45
- return (
46
- <div>
47
- <HighchartsReact
48
- highcharts={Highcharts}
49
- options={options}
50
- />
51
- </div>
52
- )
53
- }
22
+ const BarGraphColors = (props) => (
23
+ <div>
24
+ <BarGraph
25
+ axisTitle="Number of Employees"
26
+ chartData={chartData}
27
+ colors={['data-4', 'data-5', 'data-6', 'data-7', 'data-8']}
28
+ id="bar-colors"
29
+ title="Bar Graph with Custom Data Colors"
30
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
31
+ yAxisMin={0}
32
+ {...props}
33
+ />
34
+ </div>
35
+ )
54
36
 
55
37
  export default BarGraphColors
@@ -0,0 +1,72 @@
1
+ import React from 'react'
2
+ import ReactDOMServer from 'react-dom/server'
3
+ import BarGraph from '../_bar_graph'
4
+ import Icon from '../../pb_icon/_icon'
5
+
6
+ const chartData = [
7
+ {
8
+ name: 'Role',
9
+ data: [0, 200, 300, 654, 656],
10
+ },
11
+ {
12
+ name: 'Company',
13
+ data: [150, 524, 320, 440, 500],
14
+ },
15
+ ]
16
+
17
+ const renderIcon = (iconName, color) => {
18
+ return ReactDOMServer.renderToStaticMarkup(
19
+ <Icon
20
+ color={color}
21
+ icon={iconName}
22
+ />)
23
+ };
24
+
25
+ const barGraphOptions = {
26
+ yAxis: {
27
+ tickInterval: 5,
28
+ },
29
+ xAxis: {
30
+ categories: ['1', '2', '3', '4', '5'],
31
+ labels: {
32
+ useHTML: true,
33
+ formatter: function () {
34
+ switch (this.value) {
35
+ case '1':
36
+ return `${renderIcon('frown', 'error')}`;
37
+ case '2':
38
+ return `${renderIcon('frown', 'warning')}`;
39
+ case '3':
40
+ return `${renderIcon('frown-open', 'neutral')}`;
41
+ case '4':
42
+ return `${renderIcon('smile', 'category_7')}`;
43
+ case '5':
44
+ return `${renderIcon('smile-beam', 'success')}`;
45
+ default:
46
+ return ''
47
+ }
48
+ },
49
+ style: {
50
+ fontSize: '1.4em',
51
+ },
52
+ y: 42,
53
+ },
54
+ },
55
+ legend: {
56
+ itemMarginTop: 62,
57
+ },
58
+ }
59
+
60
+ const BarGraphCustom = () => (
61
+ <div>
62
+ <BarGraph
63
+ chartData={chartData}
64
+ customOptions={barGraphOptions}
65
+ id="happiness-dashboard"
66
+ legend
67
+ title="Bar Graph with Custom Overrides"
68
+ />
69
+ </div>
70
+ )
71
+
72
+ export default BarGraphCustom
@@ -0,0 +1,6 @@
1
+ The `customOptions` prop provides comprehensive access to additional [Highcharts options](https://api.highcharts.com/highcharts/) that are not explicitly defined as props.
2
+ It's important to note that certain options may require specific script imports to function properly.
3
+
4
+ Note: If you are having trouble getting any Highcharts options to work, please match the formatting of our [staticOptions](https://github.com/powerhome/playbook/blob/master/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx#L85-L141). For example, `yAxis` will need to be wrapped with square brackets.
5
+
6
+ You may also need to override any of the [defaults](https://github.com/powerhome/playbook/blob/master/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx#L45-L73) in order to get that options to work.
@@ -1,8 +1,6 @@
1
1
  import React from 'react'
2
- import barGraphTheme from '../barGraphTheme';
3
- import Highcharts from "highcharts";
4
- import HighchartsReact from "highcharts-react-official";
5
2
 
3
+ import BarGraph from '../_bar_graph'
6
4
 
7
5
  const chartData = [{
8
6
  name: 'Installation',
@@ -21,35 +19,19 @@ const chartData = [{
21
19
  data: [1111, 677, 3245, 500, 200],
22
20
  }]
23
21
 
24
- const chartOptions = {
25
- series: chartData,
26
- title: {
27
- text: 'Solar Employment Growth by Sector, 2010-2016',
28
- },
29
- subtitle: {
30
- text: 'Source: thesolarfoundation.com',
31
- },
32
- xAxis: {
33
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
34
- },
35
- yAxis: {
36
- title: {
37
- text: 'Number of Employees',
38
- },
39
- },
40
- }
41
-
42
- const BarGraphDefault = () => {
43
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
44
-
45
- return (
46
- <div>
47
- <HighchartsReact
48
- highcharts={Highcharts}
49
- options={options}
50
- />
51
- </div>
52
- )
53
- }
22
+ const BarGraphDefault = (props) => (
23
+ <div>
24
+ <BarGraph
25
+ axisTitle="Number of Employees"
26
+ chartData={chartData}
27
+ id="bar-default"
28
+ subTitle="Source: thesolarfoundation.com"
29
+ title="Solar Employment Growth by Sector, 2010-2016"
30
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
31
+ yAxisMin={0}
32
+ {...props}
33
+ />
34
+ </div>
35
+ )
54
36
 
55
37
  export default BarGraphDefault
@@ -1,69 +1,39 @@
1
1
  import React from 'react'
2
- import barGraphTheme from '../barGraphTheme';
3
- import Highcharts from "highcharts";
4
- import HighchartsReact from "highcharts-react-official";
5
2
 
3
+ import BarGraph from '../_bar_graph'
6
4
 
7
5
  const chartData = [{
8
6
  name: 'Number of Installations',
9
7
  data: [1475, 200, 3000, 654, 656],
10
8
  }]
11
9
 
12
- const pixelHeightChartOptions = {
13
- chart: {
14
- height: "300"
15
- },
16
- series: chartData,
17
- title: {
18
- text: "Fixed Height (300px)",
19
- },
20
- xAxis: {
21
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
22
- },
23
- yAxis: {
24
- title: {
25
- text: "Number of Employees",
26
- },
27
- },
28
- };
29
-
30
- const percentageHeightChartOptions = {
31
- chart: {
32
- height: "50%"
33
- },
34
- series: chartData,
35
- title: {
36
- text: "Percentage Height (50%)",
37
- },
38
- xAxis: {
39
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
40
- },
41
- yAxis: {
42
- title: {
43
- text: "Number of Employees",
44
- },
45
- },
46
- };
47
-
48
- const pixelOptions = Highcharts.merge({}, barGraphTheme, pixelHeightChartOptions)
49
-
50
- const percentageOptions = Highcharts.merge({}, barGraphTheme, percentageHeightChartOptions)
51
-
52
- const BarGraphHeight = () => (
10
+ const BarGraphDefault = (props) => (
53
11
  <div>
54
- <HighchartsReact
55
- highcharts={Highcharts}
56
- options={pixelOptions}
57
- />
12
+ <BarGraph
13
+ axisTitle="Number of Employees"
14
+ chartData={chartData}
15
+ height="300"
16
+ id="bar-fixed-height"
17
+ title="Fixed Height (300px)"
18
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
19
+ yAxisMin={0}
20
+ {...props}
21
+ />
58
22
 
59
23
  <br />
60
24
  <br />
61
25
 
62
- <HighchartsReact
63
- highcharts={Highcharts}
64
- options={percentageOptions}
26
+ <BarGraph
27
+ axisTitle="Number of Employees"
28
+ chartData={chartData}
29
+ height="50%"
30
+ id="bar-percentage-height"
31
+ title="Percentage Height (50%)"
32
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
33
+ yAxisMin={0}
34
+ {...props}
65
35
  />
66
36
  </div>
67
37
  )
68
38
 
69
- export default BarGraphHeight
39
+ export default BarGraphDefault
@@ -1,10 +1,9 @@
1
1
  import React from 'react'
2
- import barGraphTheme from '../barGraphTheme';
3
- import Highcharts from "highcharts";
4
- import HighchartsReact from "highcharts-react-official";
5
2
 
3
+ import BarGraph from '../_bar_graph'
6
4
 
7
- const chartOptions = {
5
+
6
+ const barGraphOptions = {
8
7
  chart: {
9
8
  type: 'bar'
10
9
  },
@@ -23,8 +22,13 @@ const chartOptions = {
23
22
  lineWidth: 0
24
23
  },
25
24
  yAxis: {
25
+ min: 0,
26
26
  title: {
27
- text: '',
27
+ text: 'Population (millions)',
28
+ align: 'high'
29
+ },
30
+ labels: {
31
+ overflow: 'justify'
28
32
  },
29
33
  },
30
34
  tooltip: {
@@ -47,16 +51,16 @@ const chartOptions = {
47
51
  }, {
48
52
  name: 'Year 2018',
49
53
  data: [1276, 1007, 4561, 746]
50
- }],
54
+ }]
51
55
  }
52
56
 
53
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
54
-
55
- const BarGraphHorizontal = () => (
57
+ const BarGraphHorizontal = (props) => (
56
58
  <div>
57
- <HighchartsReact
58
- highcharts={Highcharts}
59
- options={options}
59
+ <BarGraph
60
+ customOptions={barGraphOptions}
61
+ id="bar-horizontal"
62
+ yAxisMin={0}
63
+ {...props}
60
64
  />
61
65
  </div>
62
66
  )