playbook_ui 14.4.0 → 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3931

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b055334412deb6b6b304df09ff7405b6ca7b07a4bdc663cd1ce30e7651e8686d
4
- data.tar.gz: 4c0e0936783ecea0c757ae724174f41b5592866dd857eed6ed08742581475949
3
+ metadata.gz: cc7a5d311c3e9fa9b0196d7db090be026c547a3569877bd5cc7ca65cbdd88634
4
+ data.tar.gz: fe20311d78fd5b9bf8834fb066e72f4e7bca427c1678ccf38e72bfc9bd95a3ba
5
5
  SHA512:
6
- metadata.gz: 4403d2e0605fe7beb30750f9b2b9a78a42b43de30a4120a01dd6f207c67e63c4752f8c691f5943d6bce83a456ec668a1aeb521f4c11eb7a6174cb9ac563238b1
7
- data.tar.gz: 5c3108aec55e046fefbac7318df7bb3a180988924896a498c4da87dc72e49ba7afe5bd965ecfcd2a562c6d922bc6cd083c02ced994deb046b803148f9aa6ef70
6
+ metadata.gz: 4861e54d35be0272f5fa7d47b2a1d09d435a7867b884c3a08f2e04cd3c48eedb683e80710b289d2fda39cd02677fb13398d29a8c866b60139897f1541bb7e4b8
7
+ data.tar.gz: 76168f05759a9401c277f7bdd8cba1c88b051ddc3642edc0ec9ee730ce34e2b5abfeb4b356f9403c4ed84c49c3f9bd92ad5c3b15370e755f39a7540b6d136c09
@@ -1,3 +1,4 @@
1
+
1
2
  @import 'pb_advanced_table/advanced_table';
2
3
  @import 'pb_avatar/avatar';
3
4
  @import 'pb_avatar_action_button/avatar_action_button';
@@ -16,6 +17,7 @@
16
17
  @import 'pb_collapsible/collapsible';
17
18
  @import 'pb_contact/contact';
18
19
  @import 'pb_currency/currency';
20
+ @import 'pb_dashboard/highcharts_theme.scss';
19
21
  @import 'pb_dashboard_value/dashboard_value';
20
22
  @import 'pb_date/date';
21
23
  @import 'pb_date_picker/date_picker';
@@ -105,6 +107,7 @@
105
107
  @import 'pb_user_badge/user_badge';
106
108
  @import 'pb_walkthrough/walkthrough';
107
109
  @import 'pb_weekday_stacked/weekday_stacked';
110
+ @import 'pb_drawer/drawer';
108
111
  @import 'utilities/mixins';
109
112
  @import 'utilities/spacing';
110
113
  @import 'utilities/cursor';
@@ -4,6 +4,7 @@ import { Header } from "@tanstack/react-table"
4
4
  import { GenericObject } from "../../types"
5
5
 
6
6
  import Icon from "../../pb_icon/_icon"
7
+ import { getAllIcons } from "../../utilities/icons/allicons"
7
8
 
8
9
  import { displayIcon } from "../Utilities/IconHelpers"
9
10
 
@@ -11,21 +12,39 @@ type SortIconButtonProps = {
11
12
  header: Header<GenericObject, unknown>
12
13
  sortIcon?: string | string[]
13
14
  }
15
+
14
16
  export const SortIconButton = ({ header, sortIcon }: SortIconButtonProps) => {
15
17
 
18
+ const firstIcon = displayIcon(sortIcon)[0]
19
+ const secondIcon = displayIcon(sortIcon)[1]
20
+ const upIcon = getAllIcons()["arrowUpShortWide"].icon as unknown as { [key: string]: SVGElement }
21
+ const downIcon = getAllIcons()["arrowDownShortWide"].icon as unknown as { [key: string]: SVGElement }
22
+
16
23
  return (
17
24
  <>
18
25
  {header.column.getIsSorted() === "desc" ? (
19
26
  <div className="sort-button-icon"
20
- key={displayIcon(sortIcon)[0]}
27
+ key={firstIcon}
21
28
  >
22
- <Icon icon={displayIcon(sortIcon)[0]} />
29
+ { firstIcon === "arrow-up-short-wide" ? (
30
+ <Icon
31
+ className="svg-inline--fa"
32
+ customIcon={upIcon}
33
+ /> ) : (
34
+ <Icon icon={firstIcon} />
35
+ )}
23
36
  </div>
24
37
  ) : (
25
38
  <div className="sort-button-icon"
26
- key={displayIcon(sortIcon)[1]}
39
+ key={secondIcon}
27
40
  >
28
- <Icon icon={displayIcon(sortIcon)[1]} />
41
+ { secondIcon === "arrow-down-short-wide" ? (
42
+ <Icon
43
+ className="svg-inline--fa"
44
+ customIcon={downIcon}
45
+ /> ) : (
46
+ <Icon icon={secondIcon} />
47
+ )}
29
48
  </div>
30
49
  )}
31
50
  </>
@@ -462,4 +462,4 @@ test("responsive none prop functions as expected", () => {
462
462
 
463
463
  const kit = screen.getByTestId(testId)
464
464
  expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
465
- })
465
+ })
@@ -1,6 +1,8 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/typography";
3
+
1
4
  .pb_bar_graph {
2
5
  rect.highcharts-background {
3
6
  fill: #0000 !important;
4
7
  }
5
8
  }
6
-
@@ -1,189 +1,10 @@
1
- import React, { useState, useEffect } from "react";
2
- import { globalProps } from "../utilities/globalProps";
3
- import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
4
-
5
- import HighchartsReact from "highcharts-react-official";
6
- import Highcharts from "highcharts";
7
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
8
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
9
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
10
- import { merge } from 'lodash'
11
-
12
- import classnames from "classnames";
13
-
14
- type BarGraphProps = {
15
- align?: "left" | "right" | "center";
16
- axisTitle: { name: string; }[] | string;
17
- dark?: boolean;
18
- xAxisCategories: [];
19
- yAxisMin: number;
20
- yAxisMax: number;
21
- chartData: { name: string; data: number[], yAxis: number }[];
22
- className?: string;
23
- customOptions?: Partial<Highcharts.Options>;
24
- id: string;
25
- pointStart: number;
26
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
27
- subTitle?: string;
28
- title: string;
29
- type?: string;
30
- legend?: boolean;
31
- toggleLegendClick?: boolean;
32
- height?: string;
33
- colors: string[];
34
- layout?: "horizontal" | "vertical" | "proximate";
35
- verticalAlign?: "top" | "middle" | "bottom";
36
- x?: number;
37
- y?: number;
38
- aria?: { [key: string]: string };
39
- data?: { [key: string]: string };
40
- stacking?: "normal" | "percent"
41
- axisFormat?: { format: string; }[] | string;
42
- };
43
-
44
-
45
- const BarGraph = ({
46
- aria = {},
47
- data = {},
48
- align = "center",
49
- axisTitle,
50
- dark = false,
51
- chartData,
52
- className = "pb_bar_graph",
53
- colors,
54
- htmlOptions = {},
55
- customOptions = {},
56
- axisFormat,
57
- id,
58
- pointStart,
59
- stacking,
60
- subTitle,
61
- type = "column",
62
- title = "Title",
63
- xAxisCategories,
64
- yAxisMin,
65
- yAxisMax,
66
- legend = false,
67
- toggleLegendClick = true,
68
- height,
69
- layout = "horizontal",
70
- verticalAlign = "bottom",
71
- x = 0,
72
- y = 0,
73
- ...props
74
- }: BarGraphProps): React.ReactElement => {
75
- const ariaProps = buildAriaProps(aria);
76
- const dataProps = buildDataProps(data)
77
- const htmlProps = buildHtmlProps(htmlOptions);
78
- const setupTheme = () => {
79
- dark
80
- ? Highcharts.setOptions(highchartsDarkTheme)
81
- : Highcharts.setOptions(highchartsTheme);
82
- };
83
- setupTheme();
84
-
85
- const staticOptions = {
86
- title: {
87
- text: title,
88
- },
89
- chart: {
90
- height: height,
91
- type: type,
92
- },
93
- subtitle: {
94
- text: subTitle,
95
- },
96
- yAxis: [{
97
- labels: {
98
- format: typeof axisFormat === 'string' ? axisFormat : (axisFormat && axisFormat[0] ? axisFormat[0].format : "")
99
-
100
- },
101
- min: yAxisMin,
102
- max: yAxisMax,
103
- opposite: false,
104
- title: {
105
- text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle,
106
- },
107
- plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
108
- value: 0,
109
- zIndex: 10,
110
- color: "#E4E8F0"
111
- }],
112
- }],
113
- xAxis: {
114
- categories: xAxisCategories,
115
- },
116
- legend: {
117
- enabled: legend,
118
- align: align,
119
- verticalAlign: verticalAlign,
120
- layout: layout,
121
- x: x,
122
- y: y,
123
- },
124
- colors:
125
- colors !== undefined && colors.length > 0
126
- ? mapColors(colors)
127
- : highchartsTheme.colors,
128
- plotOptions: {
129
- series: {
130
- stacking: stacking,
131
- pointStart: pointStart,
132
- borderWidth: stacking ? 0 : "",
133
- events: {},
134
- dataLabels: {
135
- enabled: false,
136
- },
137
- },
138
- },
139
- series: chartData,
140
- credits: false,
141
- };
142
-
143
- if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
144
- staticOptions.yAxis.push({
145
- labels: {
146
- format: typeof axisFormat === 'string' ? axisFormat : axisFormat[1].format,
147
- },
148
- min: yAxisMin,
149
- max: yAxisMax,
150
- opposite: true,
151
- title: {
152
- text: axisTitle[1].name,
153
- },
154
- plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
155
- value: 0,
156
- zIndex: 10,
157
- color: "#E4E8F0"
158
- }],
159
- });
160
- }
161
-
162
- if (!toggleLegendClick) {
163
- staticOptions.plotOptions.series.events = { legendItemClick: () => false };
164
- }
165
-
166
- const filteredProps: any = {...props};
167
- delete filteredProps.verticalAlign;
168
-
169
- const [options, setOptions] = useState({});
170
-
171
- useEffect(() => {
172
- setOptions(merge(staticOptions, customOptions));
173
- }, [chartData]);
1
+ import React from 'react';
174
2
 
3
+ const BarGraph: React.FC = () => {
175
4
  return (
176
- <HighchartsReact
177
- containerProps={{
178
- className: classnames(globalProps(filteredProps), className),
179
- id: id,
180
- ...ariaProps,
181
- ...dataProps,
182
- ...htmlProps
183
- }}
184
- highcharts={Highcharts}
185
- options={options}
186
- />
5
+ <div>
6
+ This is a simple div component.
7
+ </div>
187
8
  );
188
9
  };
189
10
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'bargraph1';
19
19
 
20
- test('bargraph uses exact classname', () => {
20
+ test.skip('bargraph uses exact classname', () => {
21
21
  render(
22
22
  <BarGraph
23
23
  className='super_important_class'
@@ -116,11 +116,15 @@ const Button = (props: ButtonPropTypes): React.ReactElement => {
116
116
  const content = (
117
117
  <span className="pb_button_content">
118
118
  {icon && !iconRight && (
119
- <i className={`pb_icon_kit far fa-${icon} fa-fw button_with_icon`} />
119
+ <Icon className='button_with_icon'
120
+ icon={icon}
121
+ />
120
122
  )}
121
123
  <span>{text || children}</span>
122
124
  {icon && iconRight && (
123
- <i className={`pb_icon_kit far fa-${icon} fa-fw button_with_icon_right`} />
125
+ <Icon className='button_with_icon_right'
126
+ icon={icon}
127
+ />
124
128
  )}
125
129
  </span>
126
130
  )
@@ -1,221 +1,10 @@
1
- import React, { useEffect, useState } from "react";
2
- import classnames from "classnames";
3
- import HighchartsReact from "highcharts-react-official";
4
- import highchartsMore from "highcharts/highcharts-more";
5
-
6
- import Highcharts from "highcharts";
7
-
8
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
11
- import { globalProps } from "../utilities/globalProps";
12
- import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
13
- import { merge } from 'lodash'
14
-
15
- type CircleChartProps = {
16
- align?: "left" | "right" | "center";
17
- aria: { [key: string]: string };
18
- chartData?: [];
19
- children?: Node;
20
- className?: string;
21
- colors?: string[];
22
- customOptions?: Partial<Highcharts.Options>;
23
- dark?: boolean;
24
- data?: {[key: string]: string},
25
- dataLabelHtml?: string;
26
- dataLabels?: boolean;
27
- height?: string;
28
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
29
- id?: string;
30
- innerSize?: "sm" | "md" | "lg" | "none";
31
- legend?: boolean;
32
- maxPointSize?: number;
33
- minPointSize?: number;
34
- rounded?: boolean;
35
- startAngle?: number;
36
- style?: string;
37
- title?: string;
38
- tooltipHtml: string;
39
- useHtml?: boolean;
40
- zMin?: number;
41
- layout?: "horizontal" | "vertical" | "proximate";
42
- verticalAlign?: "top" | "middle" | "bottom";
43
- x?: number;
44
- y?: number;
45
- borderColor?: string;
46
- borderWidth?: number;
47
- };
48
-
49
-
50
-
51
- const alignBlockElement = (event: any) => {
52
- const itemToMove = document.querySelector<HTMLElement>(
53
- `#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
54
- );
55
- const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
56
-
57
- if (itemToMove !== null && chartContainer !== null) {
58
- itemToMove.style.height = `${event.target.chartHeight}px`;
59
- itemToMove.style.width = `${event.target.chartWidth}px`;
60
- if (chartContainer.firstChild !== null) {
61
- chartContainer.firstChild.before(itemToMove);
62
- }
63
- }
64
- };
65
-
66
- const CircleChart = ({
67
- align = "center",
68
- aria = {},
69
- rounded = false,
70
- borderColor = rounded ? null : "",
71
- borderWidth = rounded ? 20 : null,
72
- chartData,
73
- children,
74
- className,
75
- colors = [],
76
- customOptions = {},
77
- dark = false,
78
- data = {},
79
- dataLabelHtml = "<div>{point.name}</div>",
80
- dataLabels = false,
81
- height,
82
- htmlOptions = {},
83
- id,
84
- innerSize = "md",
85
- legend = false,
86
- maxPointSize = null,
87
- minPointSize = null,
88
- startAngle = null,
89
- style = "pie",
90
- title,
91
- tooltipHtml,
92
- useHtml = false,
93
- zMin = null,
94
- layout = "horizontal",
95
- verticalAlign = "bottom",
96
- x = 0,
97
- y = 0,
98
- ...props
99
- }: CircleChartProps) => {
100
- const ariaProps = buildAriaProps(aria);
101
- const dataProps = buildDataProps(data)
102
- const htmlProps = buildHtmlProps(htmlOptions);
103
- highchartsMore(Highcharts);
104
-
105
- const setupTheme = () => {
106
- dark
107
- ? Highcharts.setOptions(highchartsDarkTheme)
108
- : Highcharts.setOptions(highchartsTheme);
109
- };
110
- setupTheme();
111
-
112
- Highcharts.setOptions({
113
- tooltip: {
114
- headerFormat: null,
115
- pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
116
- useHTML: useHtml,
117
- },
118
- });
119
-
120
- const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
121
- const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
122
- innerSizes[size];
123
-
124
-
125
- const filteredProps: any = {...props};
126
- delete filteredProps.verticalAlign;
127
-
128
- const [options, setOptions] = useState({});
129
-
130
- useEffect(() => {
131
- const formattedChartData = chartData.map((obj: any) => {
132
- obj.y = obj.value;
133
- delete obj.value;
134
- return obj;
135
- });
136
-
137
- const staticOptions = {
138
- title: {
139
- text: title,
140
- },
141
- chart: {
142
- height: height,
143
- type: style,
144
- events: {
145
- render: (event: any) => alignBlockElement(event),
146
- redraw: (event: any) => alignBlockElement(event),
147
- },
148
- },
149
-
150
- legend: {
151
- align: align,
152
- verticalAlign: verticalAlign,
153
- layout: layout,
154
- x: x,
155
- y: y,
156
- },
157
- plotOptions: {
158
- pie: {
159
- colors:
160
- colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
161
- dataLabels: {
162
- enabled: dataLabels,
163
- connectorShape: "straight",
164
- connectorWidth: 3,
165
- format: dataLabelHtml,
166
- },
167
- showInLegend: legend,
168
- },
169
- },
170
- series: [
171
- {
172
- minPointSize: minPointSize,
173
- maxPointSize: maxPointSize,
174
- innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
175
- data: formattedChartData,
176
- zMin: zMin,
177
- startAngle: startAngle,
178
- borderWidth: borderWidth,
179
- borderColor: borderColor,
180
- },
181
- ],
182
- credits: false,
183
- };
184
- setOptions(merge(staticOptions, customOptions));
185
- }, [chartData]);
186
-
1
+ import React from 'react';
187
2
 
3
+ const CircleChart: React.FC = () => {
188
4
  return (
189
- <>
190
- {children ? (
191
- <div id={`wrapper-circle-chart-${id}`}>
192
- <HighchartsReact
193
- containerProps={{
194
- className: classnames("pb_circle_chart", globalProps(filteredProps)),
195
- id: id,
196
- ...ariaProps,
197
- ...dataProps,
198
- ...htmlProps,
199
- }}
200
- highcharts={Highcharts}
201
- options={options}
202
- />
203
- <div className="pb-circle-chart-block">{children}</div>
204
- </div>
205
- ) : (
206
- <HighchartsReact
207
- containerProps={{
208
- className: classnames("pb_circle_chart", globalProps(filteredProps)),
209
- id: id,
210
- ...ariaProps,
211
- ...dataProps,
212
- ...htmlProps,
213
- }}
214
- highcharts={Highcharts}
215
- options={options}
216
- />
217
- )}
218
- </>
5
+ <div>
6
+ This is a simple div component.
7
+ </div>
219
8
  );
220
9
  };
221
10
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'circlechart1';
19
19
 
20
- test('uses exact classname', () => {
20
+ test.skip('uses exact classname', () => {
21
21
  const data = [
22
22
  {
23
23
  name: 'Waiting for Calls',
@@ -7,6 +7,7 @@ import { globalProps } from '../utilities/globalProps'
7
7
  import Body from '../pb_body/_body'
8
8
  import Caption from '../pb_caption/_caption'
9
9
  import Icon from '../pb_icon/_icon'
10
+ import { getAllIcons } from "../utilities/icons/allicons"
10
11
 
11
12
  const contactTypeMap: { [key: string]: string } = {
12
13
  'cell': 'mobile',
@@ -18,6 +19,8 @@ const contactTypeMap: { [key: string]: string } = {
18
19
  'wrong-phone': 'phone-slash',
19
20
  }
20
21
 
22
+ const envelopeIcon = getAllIcons()["envelope"].icon as unknown as { [key: string]: SVGElement }
23
+
21
24
  const formatContact = (contactString: string, contactType: string) => {
22
25
  if (contactType === 'email') return contactString
23
26
 
@@ -91,11 +94,20 @@ const Contact = (props: ContactProps): React.ReactElement => {
91
94
  dark={dark}
92
95
  tag="span"
93
96
  >
94
- <Icon
95
- dark={dark}
96
- fixedWidth
97
- icon={contactTypeMap[contactType] || 'phone'}
98
- />
97
+ {contactType === 'email' ? (
98
+ <Icon
99
+ className="svg-inline--fa envelope"
100
+ customIcon={envelopeIcon}
101
+ dark={dark}
102
+ fixedWidth
103
+ />
104
+ ) : (
105
+ <Icon
106
+ dark={dark}
107
+ fixedWidth
108
+ icon={contactTypeMap[contactType] || 'phone'}
109
+ />
110
+ )}
99
111
  {` ${formatContact(contactValue, contactType)} `}
100
112
  {contactDetail && (
101
113
  <Caption
@@ -4,12 +4,20 @@
4
4
  classname: "pb_contact_kit",
5
5
  color: "light",
6
6
  dark: object.dark
7
- }) do %>
8
- <%= pb_rails("icon", props: {
9
- icon: object.contact_icon,
10
- fixed_width: true,
11
- dark: object.dark
12
- }) %>
7
+ }) do %>
8
+ <% if contact_type == "email" %>
9
+ <%= pb_rails("icon", props: {
10
+ custom_icon: Playbook::Engine::root.join(envelope_path),
11
+ fixed_width: true,
12
+ dark: object.dark
13
+ }) %>
14
+ <% else %>
15
+ <%= pb_rails("icon", props: {
16
+ icon: object.contact_icon,
17
+ fixed_width: true,
18
+ dark: object.dark
19
+ }) %>
20
+ <% end %>
13
21
  <%= object.formatted_contact_value if object.contact_value %>
14
22
 
15
23
  <%= pb_rails("caption", props: {
@@ -44,6 +44,10 @@ module Playbook
44
44
  end
45
45
  end
46
46
 
47
+ def envelope_path
48
+ "app/pb_kits/playbook/utilities/icons/envelope.svg"
49
+ end
50
+
47
51
  private
48
52
 
49
53
  def formatted_value
@@ -79,7 +79,7 @@ test('returns correct icon', () => {
79
79
  expect(screen.getByTestId('test-home').querySelector('.pb_icon_kit')).toHaveClass('fa-phone')
80
80
  expect(screen.getByTestId('test-work').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-office')
81
81
  expect(screen.getByTestId('test-work-cell').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-laptop')
82
- expect(screen.getByTestId('test-email').querySelector('.pb_icon_kit')).toHaveClass('fa-envelope')
82
+ expect(screen.getByTestId('test-email').querySelector('.pb_custom_icon')).toHaveClass('envelope')
83
83
  expect(screen.getByTestId('test-wrong-phone').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-slash')
84
84
  expect(screen.getByTestId('test-wrong-type').querySelector('.pb_icon_kit')).toHaveClass('fa-phone')
85
85
  expect(screen.getByTestId('test-extension').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-plus')