playbook_ui 14.4.0 → 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3931

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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +3 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +23 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
  5. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +3 -1
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +5 -184
  7. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_button/_button.tsx +6 -2
  9. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -216
  10. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
  11. data/app/pb_kits/playbook/pb_contact/_contact.tsx +17 -5
  12. data/app/pb_kits/playbook/pb_contact/contact.html.erb +14 -6
  13. data/app/pb_kits/playbook/pb_contact/contact.rb +4 -0
  14. data/app/pb_kits/playbook/pb_contact/contact.test.js +1 -1
  15. data/app/pb_kits/playbook/pb_dashboard/_highcharts_theme.scss +52 -0
  16. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +2 -6
  17. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +2 -7
  18. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -3
  19. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +4 -0
  21. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +6 -3
  22. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +6 -2
  24. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -0
  25. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
  26. data/app/pb_kits/playbook/pb_drawer/_close_icon.tsx +25 -0
  27. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +465 -0
  28. data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +195 -0
  29. data/app/pb_kits/playbook/pb_drawer/_drawer_context.tsx +3 -0
  30. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +117 -0
  31. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +43 -0
  32. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -0
  33. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +63 -0
  34. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +55 -0
  35. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +113 -0
  36. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +12 -0
  37. data/app/pb_kits/playbook/pb_drawer/docs/index.js +5 -0
  38. data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -0
  39. data/app/pb_kits/playbook/pb_drawer/drawer.rb +8 -0
  40. data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +77 -0
  41. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +10 -2
  42. data/app/pb_kits/playbook/pb_filter/docs/_filter_max_height.html.erb +5 -1
  43. data/app/pb_kits/playbook/pb_filter/docs/_filter_max_width.html.erb +5 -1
  44. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +5 -1
  45. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_sort.html.erb +5 -1
  46. data/app/pb_kits/playbook/pb_filter/docs/_filter_only.html.erb +5 -1
  47. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.html.erb +5 -1
  48. data/app/pb_kits/playbook/pb_filter/docs/_filter_single.html.erb +5 -1
  49. data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +3 -64
  50. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +5 -203
  51. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
  52. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +5 -154
  53. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
  54. data/app/pb_kits/playbook/pb_map/_map_controls.tsx +7 -1
  55. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +15 -4
  56. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +12 -1
  57. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +3 -1
  58. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +10 -2
  59. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +14 -13
  60. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +4 -4
  61. data/app/pb_kits/playbook/pb_radio/_radio.tsx +92 -33
  62. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.html.erb +2 -0
  63. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +62 -0
  64. data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -0
  65. data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
  66. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +12 -5
  67. data/app/pb_kits/playbook/pb_select/_select.tsx +5 -2
  68. data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
  69. data/app/pb_kits/playbook/pb_select/select.rb +4 -0
  70. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -1
  71. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +17 -13
  72. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -113
  73. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
  74. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -1
  75. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +14 -0
  76. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
  77. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +6 -5
  78. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.html.erb +88 -0
  79. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.jsx +60 -0
  80. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  81. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  82. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -1
  83. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +6 -1
  84. data/app/pb_kits/playbook/utilities/icons/allicons.tsx +136 -13
  85. data/app/pb_kits/playbook/utilities/icons/angle-down.svg +3 -0
  86. data/app/pb_kits/playbook/utilities/icons/envelope.svg +3 -0
  87. data/dist/chunks/_typeahead-BywvWGAm.js +22 -0
  88. data/dist/chunks/_weekday_stacked-5OGZKZeo.js +45 -0
  89. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  90. data/dist/chunks/lib-DMOmCoAX.js +29 -0
  91. data/dist/chunks/{pb_form_validation-zV9OpdSt.js → pb_form_validation-Dna2I7fw.js} +1 -1
  92. data/dist/chunks/vendor.js +1 -1
  93. data/dist/menu.yml +3 -1
  94. data/dist/playbook-doc.js +1 -1
  95. data/dist/playbook-rails-react-bindings.js +1 -1
  96. data/dist/playbook-rails.js +1 -1
  97. data/dist/playbook.css +1 -1
  98. data/lib/playbook/pagination_renderer.rb +10 -2
  99. data/lib/playbook/version.rb +2 -2
  100. metadata +31 -10
  101. data/dist/chunks/_typeahead-B2zRxReA.js +0 -22
  102. data/dist/chunks/_weekday_stacked-BIfZDNDm.js +0 -45
  103. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  104. data/dist/chunks/lib-D2U4I1U6.js +0 -16
@@ -0,0 +1,77 @@
1
+ import React, { useState } from 'react';
2
+ import { render, cleanup, fireEvent, screen } from '../utilities/test-utils';
3
+ import { Drawer, Button } from 'playbook-ui';
4
+
5
+ const size = 'sm';
6
+
7
+ function DrawerTest({ props }) {
8
+ const [isOpen, setIsOpen] = useState(false);
9
+ const close = () => setIsOpen(false);
10
+ const open = () => setIsOpen(true);
11
+
12
+ return (
13
+ <>
14
+ <Button onClick={open}>{'Open Drawer'}</Button>
15
+ <Drawer
16
+ className="wrapper"
17
+ onClose={close}
18
+ opened={isOpen}
19
+ placement="left"
20
+ portalClassName="portal"
21
+ size={size}
22
+ {...props}
23
+ >
24
+ {props && props.children}
25
+ </Drawer>
26
+ </>
27
+ );
28
+ }
29
+
30
+ afterEach(cleanup);
31
+
32
+ test('renders with the right border class when border prop is right', async () => {
33
+ render(<DrawerTest props={{ border: 'right' }} />);
34
+
35
+ fireEvent.click(screen.getByText('Open Drawer'));
36
+
37
+ const drawer = await screen.findByRole('dialog');
38
+ expect(drawer).toHaveClass('drawer_border_right');
39
+ });
40
+
41
+ test('renders with the left border class when border prop is left', async () => {
42
+ render(<DrawerTest props={{ border: 'left' }} />);
43
+
44
+ fireEvent.click(screen.getByText('Open Drawer'));
45
+
46
+ const drawer = await screen.findByRole('dialog');
47
+ expect(drawer).toHaveClass('drawer_border_left');
48
+ });
49
+
50
+ test('renders with the full border class when border prop is full', async () => {
51
+ render(<DrawerTest props={{ border: 'full' }} />);
52
+
53
+ fireEvent.click(screen.getByText('Open Drawer'));
54
+
55
+ const drawer = await screen.findByRole('dialog');
56
+ expect(drawer).toHaveClass('drawer_border_full');
57
+ });
58
+
59
+ test('does not have a border class when border prop is none', async () => {
60
+ render(<DrawerTest props={{ border: 'none' }} />);
61
+
62
+ fireEvent.click(screen.getByText('Open Drawer'));
63
+
64
+ const drawer = await screen.findByRole('dialog');
65
+ expect(drawer).not.toHaveClass('drawer_border_right');
66
+ expect(drawer).not.toHaveClass('drawer_border_left');
67
+ expect(drawer).not.toHaveClass('drawer_border_full');
68
+ });
69
+
70
+ test('renders the correct size class for a large drawer', async () => {
71
+ render(<DrawerTest props={{ size: 'lg' }} />);
72
+
73
+ fireEvent.click(screen.getByText('Open Drawer'));
74
+
75
+ const drawer = await screen.findByRole('dialog');
76
+ expect(drawer).toHaveClass('pb_drawer pb_drawer_lg_left');
77
+ });
@@ -30,7 +30,11 @@
30
30
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
31
31
 
32
32
  <%= form.actions do |action| %>
33
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
33
+ <%= action.submit props: {
34
+ text: "Apply",
35
+ data: {
36
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
37
+ },}%>
34
38
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
35
39
  <% end %>
36
40
  <% end %>
@@ -64,7 +68,11 @@
64
68
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
65
69
 
66
70
  <%= form.actions do |action| %>
67
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
71
+ <%= action.submit props: {
72
+ text: "Apply",
73
+ data: {
74
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
75
+ },}%>
68
76
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
69
77
  <% end %>
70
78
  <% end %>
@@ -35,7 +35,11 @@
35
35
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: {max_width: "sm", label: true } %>
36
36
 
37
37
  <%= form.actions do |action| %>
38
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
38
+ <%= action.submit props: {
39
+ text: "Apply",
40
+ data: {
41
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
42
+ },}%>
39
43
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
40
44
  <% end %>
41
45
  <% end %>
@@ -30,7 +30,11 @@
30
30
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: {max_width: "sm", label: true } %>
31
31
 
32
32
  <%= form.actions do |action| %>
33
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
33
+ <%= action.submit props: {
34
+ text: "Apply",
35
+ data: {
36
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
37
+ },}%>
34
38
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
35
39
  <% end %>
36
40
  <% end %>
@@ -69,7 +69,11 @@
69
69
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
70
70
 
71
71
  <%= form.actions do |action| %>
72
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
72
+ <%= action.submit props: {
73
+ text: "Apply",
74
+ data: {
75
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
76
+ },}%>
73
77
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
74
78
  <% end %>
75
79
  <% end %>
@@ -24,7 +24,11 @@
24
24
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
25
25
 
26
26
  <%= form.actions do |action| %>
27
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
27
+ <%= action.submit props: {
28
+ text: "Apply",
29
+ data: {
30
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
31
+ },}%>
28
32
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
29
33
  <% end %>
30
34
  <% end %>
@@ -22,7 +22,11 @@
22
22
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
23
23
 
24
24
  <%= form.actions do |action| %>
25
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
25
+ <%= action.submit props: {
26
+ text: "Apply",
27
+ data: {
28
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
29
+ },}%>
26
30
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
27
31
  <% end %>
28
32
  <% end %>
@@ -23,7 +23,11 @@
23
23
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
24
24
 
25
25
  <%= form.actions do |action| %>
26
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
26
+ <%= action.submit props: {
27
+ text: "Apply",
28
+ data: {
29
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
30
+ },}%>
27
31
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
28
32
  <% end %>
29
33
  <% end %>
@@ -29,7 +29,11 @@
29
29
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
30
30
 
31
31
  <%= form.actions do |action| %>
32
- <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
32
+ <%= action.submit props: {
33
+ text: "Apply",
34
+ data: {
35
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
36
+ },}%>
33
37
  <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
34
38
  <% end %>
35
39
  <% end %>
@@ -1,70 +1,9 @@
1
- import React, { useState, useEffect } from "react";
2
- import classnames from "classnames";
3
- import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
- import { globalProps } from "../utilities/globalProps";
5
- import HighchartsReact from "highcharts-react-official";
6
- import Highcharts from "highcharts/highcharts-gantt";
7
-
8
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
-
11
- type GanttChartProps = {
12
- aria?: { [key: string]: string };
13
- className?: string;
14
- customOptions: Partial<Highcharts.Options>;
15
- dark?: boolean;
16
- data?: { [key: string]: string };
17
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
18
- id?: string;
19
- };
20
-
21
- const GanttChart = (props: GanttChartProps) => {
22
- const {
23
- aria = {},
24
- className,
25
- customOptions = {},
26
- dark = false,
27
- data = {},
28
- htmlOptions = {},
29
- id,
30
- } = props;
31
-
32
- const ariaProps = buildAriaProps(aria);
33
- const dataProps = buildDataProps(data);
34
- const htmlProps = buildHtmlProps(htmlOptions);
35
- const classes = classnames(
36
- buildCss("pb_gantt_chart"),
37
- globalProps(props),
38
- className
39
- );
40
-
41
- const [options, setOptions] = useState<Highcharts.Options | undefined>(customOptions);
42
-
43
- useEffect(() => {
44
- setOptions(customOptions);
45
- }, [customOptions]);
46
-
47
- const setupTheme = () => {
48
- dark
49
- ? Highcharts.setOptions(highchartsDarkTheme)
50
- : Highcharts.setOptions(highchartsTheme);
51
- };
52
- setupTheme();
1
+ import React from 'react';
53
2
 
3
+ const GanttChart: React.FC = () => {
54
4
  return (
55
5
  <div>
56
- <HighchartsReact
57
- constructorType={"ganttChart"}
58
- containerProps={{
59
- className: classnames(globalProps(props), classes),
60
- id: id,
61
- ...ariaProps,
62
- ...dataProps,
63
- ...htmlProps,
64
- }}
65
- highcharts={Highcharts}
66
- options={options}
67
- />
6
+ This is a simple div component.
68
7
  </div>
69
8
  );
70
9
  };
@@ -1,208 +1,10 @@
1
- import React, { useState, useEffect } from "react";
2
- import classnames from "classnames";
3
- import HighchartsReact from "highcharts-react-official";
4
- import Highcharts from "highcharts";
5
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
6
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
7
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
8
- import highchartsMore from "highcharts/highcharts-more";
9
- import solidGauge from "highcharts/modules/solid-gauge";
10
- import defaultColors from "../tokens/exports/_colors.module.scss";
11
- import typography from "../tokens/exports/_typography.module.scss";
12
-
13
- import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
14
- import { globalProps } from "../utilities/globalProps";
15
- import { GenericObject } from "../types";
16
- import { merge } from 'lodash'
17
-
18
- type GaugeProps = {
19
- aria: { [key: string]: string };
20
- className?: string;
21
- chartData?: { name: string; value: number[] | number }[];
22
- customOptions?: Partial<Highcharts.Options>;
23
- dark?: boolean;
24
- data?: { [key: string]: string };
25
- disableAnimation?: boolean;
26
- fullCircle?: boolean;
27
- height?: string;
28
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
29
- id?: string;
30
- max?: number;
31
- min?: number;
32
- prefix?: string;
33
- showLabels?: boolean;
34
- style?: string;
35
- suffix?: string;
36
- title?: string;
37
- tooltipHtml?: string;
38
- colors: string[];
39
- minorTickInterval?: number;
40
- circumference: number[];
41
- };
42
-
43
- const Gauge = ({
44
- aria = {},
45
- chartData,
46
- customOptions = {},
47
- dark = false,
48
- data = {},
49
- disableAnimation = false,
50
- fullCircle = false,
51
- height = null,
52
- htmlOptions = {},
53
- id,
54
- max = 100,
55
- min = 0,
56
- prefix = "",
57
- showLabels = false,
58
- style = "solidgauge",
59
- suffix = "",
60
- title = "",
61
- tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
62
- "<b>{point.y}</b>",
63
- colors = [],
64
- minorTickInterval = null,
65
- circumference = fullCircle ? [0, 360] : [-100, 100],
66
- ...props
67
- }: GaugeProps): React.ReactElement => {
68
- const ariaProps = buildAriaProps(aria);
69
- const dataProps = buildDataProps(data)
70
- const htmlProps = buildHtmlProps(htmlOptions);
71
- highchartsMore(Highcharts);
72
- solidGauge(Highcharts);
73
- const setupTheme = () => {
74
- dark
75
- ? Highcharts.setOptions(highchartsDarkTheme)
76
- : Highcharts.setOptions(highchartsTheme);
77
- };
78
- setupTheme();
79
-
80
- //set tooltip directly to prevent being overriden by Highcharts defaults
81
- Highcharts.setOptions({
82
- tooltip: {
83
- pointFormat: tooltipHtml,
84
- followPointer: true,
85
- },
86
- });
87
-
88
- const css = buildCss({
89
- pb_gauge_kit: true,
90
- });
91
-
92
- const [options, setOptions] = useState({});
93
-
94
- useEffect(() => {
95
- const formattedChartData = chartData.map((obj: GenericObject) => {
96
- obj.y = obj.value;
97
- delete obj.value;
98
- return obj;
99
- });
100
-
101
- const staticOptions = {
102
- chart: {
103
- events: {
104
- load() {
105
- setTimeout(this.reflow.bind(this), 0);
106
- },
107
- },
108
- type: style,
109
- height: height,
110
- },
111
- title: {
112
- text: title,
113
- },
114
- yAxis: {
115
- min: min,
116
- max: max,
117
- lineWidth: 0,
118
- tickWidth: 0,
119
- minorTickInterval: minorTickInterval,
120
- tickAmount: 2,
121
- tickPositions: [min, max],
122
- labels: {
123
- y: 26,
124
- enabled: showLabels,
125
- },
126
- },
127
- credits: false,
128
- series: [
129
- {
130
- data: formattedChartData,
131
- },
132
- ],
133
- pane: {
134
- center: ["50%", "50%"],
135
- size: "90%",
136
- startAngle: circumference[0],
137
- endAngle: circumference[1],
138
- background: {
139
- borderWidth: 20,
140
- innerRadius: "90%",
141
- outerRadius: "90%",
142
- shape: "arc",
143
- className: "gauge-pane",
144
- },
145
- },
146
- colors:
147
- colors !== undefined && colors.length > 0
148
- ? mapColors(colors)
149
- : highchartsTheme.colors,
150
- plotOptions: {
151
- series: {
152
- animation: !disableAnimation,
153
- },
154
- solidgauge: {
155
- borderColor:
156
- colors !== undefined && colors.length === 1
157
- ? mapColors(colors).join()
158
- : highchartsTheme.colors[0],
159
- borderWidth: 20,
160
- radius: 90,
161
- innerRadius: "90%",
162
- dataLabels: {
163
- borderWidth: 0,
164
- color: defaultColors.text_lt_default,
165
- enabled: true,
166
- format:
167
- `<span class="prefix">${prefix}</span>` +
168
- '<span class="fix">{y:,f}</span>' +
169
- `<span class="suffix">${suffix}</span>`,
170
- style: {
171
- fontFamily: typography.font_family_base,
172
- fontWeight: typography.regular,
173
- fontSize: typography.heading_2,
174
- },
175
- y: -26,
176
- },
177
- },
178
- },
179
- };
180
-
181
- setOptions(merge(staticOptions, customOptions));
182
-
183
- if (document.querySelector(".prefix")) {
184
- document.querySelectorAll(".prefix").forEach((prefix) => {
185
- prefix.setAttribute("y", "28");
186
- });
187
- document
188
- .querySelectorAll(".fix")
189
- .forEach((fix) => fix.setAttribute("y", "38"));
190
- }
191
- // eslint-disable-next-line react-hooks/exhaustive-deps
192
- }, [chartData]);
1
+ import React from 'react';
193
2
 
3
+ const Gauge: React.FC = () => {
194
4
  return (
195
- <HighchartsReact
196
- containerProps={{
197
- className: classnames(css, globalProps(props)),
198
- id: id,
199
- ...ariaProps,
200
- ...dataProps,
201
- ...htmlProps,
202
- }}
203
- highcharts={Highcharts}
204
- options={options}
205
- />
5
+ <div>
6
+ This is a simple div component.
7
+ </div>
206
8
  );
207
9
  };
208
10
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'gauge1';
19
19
 
20
- test('uses exact classname', () => {
20
+ test.skip('uses exact classname', () => {
21
21
  const data = [
22
22
  { name: 'Name', value: 45 },
23
23
  ]
@@ -1,159 +1,10 @@
1
- import React, { useState, useEffect } from "react";
2
- import classnames from "classnames";
3
- import { globalProps } from "../utilities/globalProps";
4
- import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
5
-
6
- import HighchartsReact from "highcharts-react-official";
7
- import Highcharts from "highcharts";
8
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
11
- import { merge } from 'lodash'
12
-
13
- type LineGraphProps = {
14
- align?: "left" | "right" | "center";
15
- axisTitle?: string;
16
- dark?: boolean;
17
- xAxisCategories: [];
18
- yAxisMin: number;
19
- yAxisMax: number;
20
- className?: string;
21
- chartData: {
22
- name: string;
23
- data: number[];
24
- }[];
25
- customOptions?: Partial<Highcharts.Options>;
26
- gradient?: boolean;
27
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
28
- id: string;
29
- pointStart: number;
30
- subTitle?: string;
31
- title: string;
32
- type?: string;
33
- legend?: boolean;
34
- toggleLegendClick?: boolean;
35
- height?: string;
36
- colors: string[];
37
- layout?: "horizontal" | "vertical" | "proximate";
38
- verticalAlign?: "top" | "middle" | "bottom";
39
- x?: number;
40
- y?: number;
41
- aria?: { [key: string]: string };
42
- data?: { [key: string]: string };
43
- };
44
-
45
- const LineGraph = ({
46
- aria = {},
47
- data = {},
48
- align = "center",
49
- className = "pb_bar_graph",
50
- customOptions = {},
51
- dark = false,
52
- gradient = false,
53
- type = "line",
54
- htmlOptions = {},
55
- id,
56
- legend = false,
57
- toggleLegendClick = true,
58
- layout = "horizontal",
59
- verticalAlign = "bottom",
60
- x = 0,
61
- y = 0,
62
- axisTitle,
63
- xAxisCategories,
64
- yAxisMin,
65
- yAxisMax,
66
- chartData,
67
- pointStart,
68
- subTitle,
69
- title,
70
- height,
71
- colors = [],
72
- ...props
73
- }: LineGraphProps) => {
74
-
75
- const ariaProps = buildAriaProps(aria)
76
- const dataProps = buildDataProps(data)
77
- const htmlProps = buildHtmlProps(htmlOptions)
78
-
79
- const setupTheme = () => {
80
- dark
81
- ? Highcharts.setOptions(highchartsDarkTheme)
82
- : Highcharts.setOptions(highchartsTheme);
83
- };
84
- setupTheme();
85
-
86
- const staticOptions = {
87
- title: {
88
- text: title,
89
- },
90
- chart: {
91
- height: height,
92
- type: type,
93
- },
94
- subtitle: {
95
- text: subTitle,
96
- },
97
- yAxis: {
98
- min: yAxisMin,
99
- max: yAxisMax,
100
- title: {
101
- text: axisTitle,
102
- },
103
- },
104
- xAxis: {
105
- categories: xAxisCategories,
106
- },
107
- legend: {
108
- enabled: legend,
109
- align: align,
110
- verticalAlign: verticalAlign,
111
- layout: layout,
112
- x: x,
113
- y: y,
114
- },
115
- colors:
116
- colors !== undefined && colors.length > 0
117
- ? mapColors(colors)
118
- : highchartsTheme.colors,
119
- plotOptions: {
120
- series: {
121
- pointStart: pointStart,
122
- events: {},
123
- dataLabels: {
124
- enabled: false,
125
- },
126
- },
127
- },
128
- series: chartData,
129
- credits: false,
130
- };
131
-
132
- if (!toggleLegendClick) {
133
- staticOptions.plotOptions.series.events = { legendItemClick: () => false };
134
- }
135
-
136
- const filteredProps: any = {...props};
137
- delete filteredProps.verticalAlign;
138
-
139
- const [options, setOptions] = useState({});
140
-
141
- useEffect(() => {
142
- setOptions(merge(staticOptions, customOptions));
143
- }, [chartData]);
1
+ import React from 'react';
144
2
 
3
+ const LineGraph: React.FC = () => {
145
4
  return (
146
- <HighchartsReact
147
- containerProps={{
148
- className: classnames(globalProps(filteredProps), className),
149
- id: id,
150
- ...ariaProps,
151
- ...dataProps,
152
- ...htmlProps
153
- }}
154
- highcharts={Highcharts}
155
- options={options}
156
- />
5
+ <div>
6
+ This is a simple div component.
7
+ </div>
157
8
  );
158
9
  };
159
10
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'linechart1';
19
19
 
20
- test('uses exact classname', () => {
20
+ test.skip('uses exact classname', () => {
21
21
  const data = [{
22
22
  name: 'Installation',
23
23
  data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],