playbook_ui 15.7.0.pre.alpha.play263313229 → 15.7.0.pre.alpha.play270013253

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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -4
  3. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +2 -2
  4. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +3 -2
  5. data/dist/chunks/_typeahead-CZqKJ2_B.js +6 -0
  6. data/dist/chunks/lib-DOcjHvyR.js +29 -0
  7. data/dist/chunks/vendor.js +2 -2
  8. data/dist/menu.yml +0 -29
  9. data/dist/playbook-rails-react-bindings.js +1 -1
  10. data/dist/playbook-rails.js +1 -1
  11. data/dist/playbook.css +1 -1
  12. data/lib/playbook/version.rb +1 -1
  13. metadata +4 -147
  14. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +0 -6
  15. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -196
  16. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +0 -31
  17. data/app/pb_kits/playbook/pb_bar_graph/barGraphSettings.js +0 -32
  18. data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +0 -106
  19. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.html.erb +0 -1
  20. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +0 -98
  21. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.html.erb +0 -26
  22. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +0 -55
  23. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.md +0 -2
  24. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +0 -42
  25. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.md +0 -2
  26. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +0 -26
  27. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +0 -55
  28. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.html.erb +0 -26
  29. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +0 -69
  30. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +0 -3
  31. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.html.erb +0 -58
  32. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +0 -64
  33. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.html.erb +0 -14
  34. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +0 -40
  35. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.html.erb +0 -15
  36. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +0 -48
  37. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.html.erb +0 -62
  38. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +0 -136
  39. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +0 -17
  40. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.html.erb +0 -23
  41. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +0 -52
  42. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.html.erb +0 -26
  43. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +0 -86
  44. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +0 -3
  45. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.html.erb +0 -20
  46. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +0 -46
  47. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.md +0 -2
  48. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.html.erb +0 -22
  49. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +0 -55
  50. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.md +0 -1
  51. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +0 -1
  52. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +0 -28
  53. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -11
  54. data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +0 -2
  55. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss +0 -16
  56. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +0 -228
  57. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +0 -45
  58. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +0 -88
  59. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +0 -10
  60. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +0 -99
  61. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.html.erb +0 -26
  62. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +0 -88
  63. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.html.erb +0 -20
  64. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +0 -44
  65. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_rails.md +0 -2
  66. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +0 -2
  67. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.html.erb +0 -20
  68. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +0 -43
  69. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +0 -5
  70. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.html.erb +0 -19
  71. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +0 -38
  72. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.html.erb +0 -136
  73. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +0 -152
  74. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +0 -86
  75. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +0 -142
  76. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +0 -14
  77. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +0 -63
  78. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.html.erb +0 -22
  79. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +0 -45
  80. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.html.erb +0 -37
  81. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +0 -61
  82. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.html.erb +0 -22
  83. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +0 -41
  84. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.html.erb +0 -38
  85. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +0 -55
  86. data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +0 -1
  87. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -26
  88. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -11
  89. data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +0 -104
  90. data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +0 -16
  91. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +0 -174
  92. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +0 -173
  93. data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +0 -20
  94. data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -49
  95. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +0 -215
  96. data/app/pb_kits/playbook/pb_gauge/docs/_description.md +0 -1
  97. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.html.erb +0 -12
  98. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +0 -36
  99. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_rails.md +0 -2
  100. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +0 -2
  101. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +0 -32
  102. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +0 -146
  103. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_rails.md +0 -1
  104. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +0 -1
  105. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb +0 -11
  106. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +0 -30
  107. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.html.erb +0 -12
  108. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +0 -36
  109. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb +0 -14
  110. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +0 -49
  111. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb +0 -15
  112. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +0 -62
  113. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +0 -76
  114. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb +0 -15
  115. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +0 -54
  116. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.md +0 -1
  117. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb +0 -27
  118. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +0 -80
  119. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.md +0 -2
  120. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb +0 -14
  121. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +0 -38
  122. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb +0 -29
  123. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +0 -72
  124. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +0 -1
  125. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -27
  126. data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -11
  127. data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +0 -2
  128. data/app/pb_kits/playbook/pb_gauge/gauge.rb +0 -56
  129. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +0 -35
  130. data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +0 -91
  131. data/app/pb_kits/playbook/pb_line_graph/_line_graph.scss +0 -3
  132. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +0 -166
  133. data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +0 -1
  134. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.html.erb +0 -26
  135. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +0 -56
  136. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_rails.md +0 -2
  137. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +0 -3
  138. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.html.erb +0 -26
  139. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +0 -52
  140. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.html.erb +0 -26
  141. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +0 -70
  142. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +0 -3
  143. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.html.erb +0 -15
  144. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +0 -43
  145. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.html.erb +0 -16
  146. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +0 -49
  147. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.html.erb +0 -62
  148. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +0 -129
  149. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +0 -14
  150. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -18
  151. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -6
  152. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +0 -52
  153. data/app/pb_kits/playbook/pb_line_graph/lineGraphSettings.js +0 -30
  154. data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +0 -125
  155. data/app/pb_kits/playbook/pb_line_graph/line_graph.html.erb +0 -1
  156. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +0 -93
  157. data/dist/chunks/_typeahead-Ckz1ce-2.js +0 -6
  158. data/dist/chunks/lib-DxDBrGZX.js +0 -29
@@ -1,228 +0,0 @@
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
- import { deprecatedKitWarning } from "../utilities/deprecated";
6
-
7
- import Highcharts from "highcharts";
8
-
9
- import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
10
- import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
11
- import mapColors from "../pb_dashboard/pbChartsColorsHelper";
12
- import { globalProps } from "../utilities/globalProps";
13
- import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
14
- import { merge } from '../utilities/object'
15
-
16
- type CircleChartProps = {
17
- align?: "left" | "right" | "center";
18
- aria: { [key: string]: string };
19
- chartData?: [];
20
- children?: Node;
21
- className?: string;
22
- colors?: string[];
23
- customOptions?: Partial<Highcharts.Options>;
24
- dark?: boolean;
25
- data?: {[key: string]: string},
26
- dataLabelHtml?: string;
27
- dataLabels?: boolean;
28
- height?: string;
29
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
30
- id?: string;
31
- innerSize?: "sm" | "md" | "lg" | "none";
32
- legend?: boolean;
33
- maxPointSize?: number;
34
- minPointSize?: number;
35
- rounded?: boolean;
36
- startAngle?: number;
37
- style?: string;
38
- title?: string;
39
- tooltipHtml: string;
40
- useHtml?: boolean;
41
- zMin?: number;
42
- layout?: "horizontal" | "vertical" | "proximate";
43
- verticalAlign?: "top" | "middle" | "bottom";
44
- x?: number;
45
- y?: number;
46
- borderColor?: string;
47
- borderWidth?: number;
48
- };
49
-
50
-
51
-
52
- const alignBlockElement = (event: any) => {
53
- const itemToMove = document.querySelector<HTMLElement>(
54
- `#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
55
- );
56
- const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
57
-
58
- if (itemToMove !== null && chartContainer !== null) {
59
- itemToMove.style.height = `${event.target.chartHeight}px`;
60
- itemToMove.style.width = `${event.target.chartWidth}px`;
61
- if (chartContainer.firstChild !== null) {
62
- chartContainer.firstChild.before(itemToMove);
63
- }
64
- }
65
- };
66
-
67
- const CircleChart = ({
68
- align = "center",
69
- aria = {},
70
- rounded = false,
71
- borderColor = rounded ? null : "",
72
- borderWidth = rounded ? 20 : null,
73
- chartData,
74
- children,
75
- className,
76
- colors = [],
77
- customOptions = {},
78
- dark = false,
79
- data = {},
80
- dataLabelHtml = "<div>{point.name}</div>",
81
- dataLabels = false,
82
- height,
83
- htmlOptions = {},
84
- id,
85
- innerSize = "md",
86
- legend = false,
87
- maxPointSize = null,
88
- minPointSize = null,
89
- startAngle = null,
90
- style = "pie",
91
- title,
92
- tooltipHtml,
93
- useHtml = false,
94
- zMin = null,
95
- layout = "horizontal",
96
- verticalAlign = "bottom",
97
- x = 0,
98
- y = 0,
99
- ...props
100
- }: CircleChartProps) => {
101
- const ariaProps = buildAriaProps(aria);
102
- const dataProps = buildDataProps(data)
103
- const htmlProps = buildHtmlProps(htmlOptions);
104
- highchartsMore(Highcharts);
105
-
106
- const setupTheme = () => {
107
- dark
108
- ? Highcharts.setOptions(highchartsDarkTheme)
109
- : Highcharts.setOptions(highchartsTheme);
110
- };
111
- setupTheme();
112
-
113
- Highcharts.setOptions({
114
- tooltip: {
115
- headerFormat: null,
116
- pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
117
- useHTML: useHtml,
118
- },
119
- });
120
-
121
- const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
122
- const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
123
- innerSizes[size];
124
-
125
-
126
- const filteredProps: any = {...props};
127
- delete filteredProps.verticalAlign;
128
-
129
- const [options, setOptions] = useState({});
130
-
131
- useEffect(() => {
132
- const formattedChartData = chartData.map((obj: any) => {
133
- obj.y = obj.value;
134
- delete obj.value;
135
- return obj;
136
- });
137
-
138
- const staticOptions = {
139
- title: {
140
- text: title,
141
- },
142
- chart: {
143
- height: height,
144
- type: style,
145
- events: {
146
- render: (event: any) => alignBlockElement(event),
147
- redraw: (event: any) => alignBlockElement(event),
148
- },
149
- },
150
-
151
- legend: {
152
- align: align,
153
- verticalAlign: verticalAlign,
154
- layout: layout,
155
- x: x,
156
- y: y,
157
- },
158
- plotOptions: {
159
- pie: {
160
- colors:
161
- colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
162
- dataLabels: {
163
- enabled: dataLabels,
164
- connectorShape: "straight",
165
- connectorWidth: 3,
166
- format: dataLabelHtml,
167
- },
168
- showInLegend: legend,
169
- },
170
- },
171
- series: [
172
- {
173
- minPointSize: minPointSize,
174
- maxPointSize: maxPointSize,
175
- innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
176
- data: formattedChartData,
177
- zMin: zMin,
178
- startAngle: startAngle,
179
- borderWidth: borderWidth,
180
- borderColor: borderColor,
181
- },
182
- ],
183
- credits: false,
184
- };
185
- setOptions(merge(staticOptions, customOptions));
186
- }, [chartData]);
187
-
188
- useEffect(() => {
189
- // Warn about deprecated kit
190
- deprecatedKitWarning('CircleChart', 'Please use "PbCircleChart" instead.');
191
- }, []);
192
-
193
-
194
- return (
195
- <>
196
- {children ? (
197
- <div id={`wrapper-circle-chart-${id}`}>
198
- <HighchartsReact
199
- containerProps={{
200
- className: classnames("pb_circle_chart", globalProps(filteredProps)),
201
- id: id,
202
- ...ariaProps,
203
- ...dataProps,
204
- ...htmlProps,
205
- }}
206
- highcharts={Highcharts}
207
- options={options}
208
- />
209
- <div className="pb-circle-chart-block">{children}</div>
210
- </div>
211
- ) : (
212
- <HighchartsReact
213
- containerProps={{
214
- className: classnames("pb_circle_chart", globalProps(filteredProps)),
215
- id: id,
216
- ...ariaProps,
217
- ...dataProps,
218
- ...htmlProps,
219
- }}
220
- highcharts={Highcharts}
221
- options={options}
222
- />
223
- )}
224
- </>
225
- );
226
- };
227
-
228
- export default CircleChart;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '../utilities/test-utils';
3
- import CircleChart from './_circle_chart';
4
-
5
- beforeEach(() => {
6
- // Silences error logs within the test suite.
7
- jest.spyOn(console, 'error');
8
- jest.spyOn(console, 'warn');
9
- console.error.mockImplementation(() => {});
10
- console.warn.mockImplementation(() => {});
11
- });
12
-
13
- afterEach(() => {
14
- console.error.mockRestore();
15
- console.warn.mockRestore();
16
- });
17
-
18
- const testId = 'circlechart1';
19
-
20
- test('uses exact classname', () => {
21
- const data = [
22
- {
23
- name: 'Waiting for Calls',
24
- value: 41,
25
- },
26
- {
27
- name: 'On Call',
28
- value: 49,
29
- },
30
- {
31
- name: 'After Call',
32
- value: 10,
33
- },
34
- ]
35
- render(
36
- <CircleChart
37
- chartData={data}
38
- data={{ testid: testId }}
39
- id='circlechartid'
40
- />
41
- );
42
-
43
- const kit = screen.getByTestId(testId);
44
- expect(kit).toHaveClass('pb_circle_chart');
45
- });
@@ -1,88 +0,0 @@
1
- import colors from '../tokens/exports/_colors.module.scss'
2
- import typography from '../tokens/exports/_typography.module.scss'
3
-
4
- const circleChartTheme = {
5
- title: {
6
- text: "",
7
- style: {
8
- color: colors.text_lt_default,
9
- fontFamily: typography.font_family_base,
10
- fontWeight: typography.bold,
11
- fontSize: typography.heading_3,
12
- },
13
- },
14
- chart: {
15
- type: "pie",
16
- },
17
- tooltip: {
18
- backgroundColor: {
19
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
20
- stops: [
21
- [0, colors.bg_dark],
22
- [1, colors.bg_dark],
23
- ],
24
- },
25
- pointFormat:
26
- '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
27
- "<b>{point.y}</b>",
28
- followPointer: true,
29
- shadow: false,
30
- borderWidth: 0,
31
- borderRadius: 10,
32
- style: {
33
- fontFamily: typography.font_family_base,
34
- color: colors.text_dk_default,
35
- fontWeight: typography.regular,
36
- fontSize: typography.text_smaller,
37
- },
38
- },
39
- plotOptions: {
40
- pie: {
41
- dataLabels: {
42
- enabled: false,
43
- connectorShape: "straight",
44
- connectorWidth: 3,
45
- format: "<div>{point.name}</div>",
46
- style: {
47
- fontFamily: typography.font_family_base,
48
- fontSize: typography.text_smaller,
49
- color: colors.text_lt_light,
50
- fontWeight: typography.regular,
51
- textOutline: '2px $white',
52
- },
53
- },
54
- innerSize: '50%',
55
- borderColor: "",
56
- borderWidth: null as number | null,
57
- colors: [
58
- colors.data_1,
59
- colors.data_2,
60
- colors.data_3,
61
- colors.data_4,
62
- colors.data_5,
63
- colors.data_6,
64
- colors.data_7,
65
- ],
66
- },
67
- },
68
- legend: {
69
- layout: 'horizontal',
70
- align: 'center',
71
- verticalAlign: 'bottom',
72
- itemStyle: {
73
- fontFamily: typography.font_family_base,
74
- color: colors.text_lt_light,
75
- fontWeight: typography.regular,
76
- fontSize: typography.text_smaller,
77
- },
78
- itemHoverStyle: {
79
- color: colors.text_lt_default,
80
- },
81
- itemHiddenStyle: {
82
- color: colors.text_lt_lighter,
83
- },
84
- },
85
- credits: { enabled: false }
86
- }
87
-
88
- export default circleChartTheme;
@@ -1,10 +0,0 @@
1
- <% if content.present? %>
2
- <div id=wrapper-circle-chart-<%= object.id %> >
3
- <%= react_component('CircleChart', object.chart_options) %>
4
- <div class="pb-circle-chart-block">
5
- <%= content %>
6
- </div>
7
- </div>
8
- <% else %>
9
- <%= react_component('CircleChart', object.chart_options) %>
10
- <% end %>
@@ -1,99 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbCircleChart
5
- class CircleChart < Playbook::KitBase
6
- prop :align, type: Playbook::Props::Enum,
7
- values: %w[left right center],
8
- default: "center"
9
- prop :border_width, type: Playbook::Props::Numeric
10
- prop :chart_data, type: Playbook::Props::Array,
11
- default: []
12
- prop :custom_options, default: {}
13
- prop :style, type: Playbook::Props::Enum,
14
- values: %w[pie],
15
- default: "pie"
16
- prop :data_labels, type: Playbook::Props::Boolean, default: false
17
- prop :min_point_size, type: Playbook::Props::Numeric
18
- prop :max_point_size, type: Playbook::Props::Numeric
19
- prop :inner_size, type: Playbook::Props::Enum,
20
- values: %w[sm md lg none],
21
- default: "md"
22
- prop :z_min, type: Playbook::Props::Numeric
23
- prop :start_angle, type: Playbook::Props::Numeric
24
- prop :data_label_html, default: "<div>{point.name}</div>"
25
- prop :tooltip_html
26
- prop :use_html, type: Playbook::Props::Boolean, default: false
27
- prop :legend, type: Playbook::Props::Boolean, default: false
28
- prop :title, default: ""
29
- prop :tooltip_html, default: '<span style="font-weight: bold; color:{point.color};">&#9679; </span>
30
- {point.name}: ' + '<b>{point.y}
31
- </b>'
32
- prop :height
33
- prop :rounded, type: Playbook::Props::Boolean, default: false
34
- prop :colors, type: Playbook::Props::Array,
35
- default: []
36
- prop :layout, type: Playbook::Props::Enum,
37
- values: %w[horizontal vertical proximate],
38
- default: "horizontal"
39
- prop :vertical_align, type: Playbook::Props::Enum,
40
- values: %w[top middle bottom],
41
- default: "bottom"
42
- prop :x, type: Playbook::Props::Numeric
43
- prop :y, type: Playbook::Props::Numeric
44
-
45
- def standard_options
46
- {
47
- align: align,
48
- borderWidth: border_width,
49
- id: id,
50
- colors: colors,
51
- chartData: chart_data,
52
- dark: dark ? "dark" : "",
53
- title: title,
54
- height: height,
55
- type: style,
56
- legend: legend,
57
- dataLabelHtml: data_label_html,
58
- dataLabels: data_labels,
59
- tooltipHtml: tooltip_html,
60
- useHTML: use_html,
61
- minPointSize: min_point_size,
62
- maxPointSize: max_point_size,
63
- innerSize: inner_size,
64
- zMin: z_min,
65
- startAngle: start_angle,
66
- rounded: rounded,
67
- layout: layout,
68
- verticalAlign: vertical_align,
69
- x: x,
70
- y: y,
71
- }
72
- end
73
-
74
- def chart_options
75
- standard_options.deep_merge(custom_options)
76
- end
77
-
78
- def vertical_align_props
79
- if vertical_align
80
- if object.vertical_align
81
- original_result = super
82
- class_to_remove = "vertical_align_#{object.vertical_align}"
83
-
84
- modified_result = original_result.gsub(class_to_remove, "").strip
85
- modified_result.empty? ? nil : modified_result
86
- else
87
- super
88
- end
89
- else
90
- super
91
- end
92
- end
93
-
94
- def classname
95
- generate_classname("pb_circle_chart")
96
- end
97
- end
98
- end
99
- end
@@ -1,26 +0,0 @@
1
- <% data_51 = [{
2
- name: 'Waiting for Calls',
3
- value: 41,
4
- },
5
- {
6
- name: 'On Call',
7
- value: 49,
8
- },
9
- {
10
- name: 'After Call',
11
- value: 10,
12
- }
13
- ] %>
14
-
15
- <br><br>
16
-
17
- <%= pb_rails("circle_chart", props: {
18
- chart_data: data_51,
19
- id: "with-a-block-2",
20
- rounded: true,
21
- }) do %>
22
- <%= pb_rails('title', props: {text: "83", size: 1, tag: 'div'}) %>
23
- <% end %>
24
-
25
-
26
-
@@ -1,88 +0,0 @@
1
- import React from 'react'
2
- import circleChartTheme from '../circleChartTheme'
3
- import Highcharts from "highcharts"
4
- import HighchartsReact from "highcharts-react-official"
5
- import Title from '../../pb_title/_title'
6
-
7
- const dataWithABlock = [
8
- {
9
- name: 'Waiting for Calls',
10
- y: 41,
11
- },
12
- {
13
- name: 'On Call',
14
- y: 49,
15
- },
16
- {
17
- name: 'After Call',
18
- y: 10,
19
- },
20
- ]
21
-
22
- const CircleChartBlock = (props) => {
23
- const chartOptions = {
24
- series: [{
25
- data: dataWithABlock,
26
- innerSize: '100%',
27
- borderWidth: 20,
28
- borderColor: null,
29
- }],
30
- chart: {
31
- events: {
32
- render: function() {
33
- const chart = this;
34
- const blockElement = document.querySelector('.pb-circle-chart-block');
35
- if (blockElement) {
36
- blockElement.style.width = chart.chartWidth + 'px';
37
- blockElement.style.height = chart.chartHeight + 'px';
38
- }
39
- },
40
- redraw: function() {
41
- const chart = this;
42
- const blockElement = document.querySelector('.pb-circle-chart-block');
43
- if (blockElement) {
44
- blockElement.style.width = chart.chartWidth + 'px';
45
- blockElement.style.height = chart.chartHeight + 'px';
46
- }
47
- }
48
- }
49
- }
50
- }
51
-
52
- const options = Highcharts.merge({}, circleChartTheme, chartOptions)
53
-
54
- return (
55
- <div>
56
- <div style={{ position: 'relative' }}>
57
- <HighchartsReact
58
- highcharts={Highcharts}
59
- options={options}
60
- />
61
- <div
62
- className="pb-circle-chart-block"
63
- style={{
64
- position: 'absolute',
65
- top: 0,
66
- left: 0,
67
- display: 'flex',
68
- justifyContent: 'center',
69
- alignItems: 'center',
70
- zIndex: 1,
71
- textAlign: 'center',
72
- pointerEvents: 'none'
73
- }}
74
- >
75
- <Title
76
- size={1}
77
- tag="div"
78
- {...props}
79
- >
80
- {'83'}
81
- </Title>
82
- </div>
83
- </div>
84
- </div>
85
- )
86
- }
87
-
88
- export default CircleChartBlock
@@ -1,20 +0,0 @@
1
- <% data_set = [{
2
- name: 'Waiting for Calls',
3
- value: 41,
4
- },
5
- {
6
- name: 'On Call',
7
- value: 49,
8
- },
9
- {
10
- name: 'After Call',
11
- value: 10,
12
- }
13
- ] %>
14
-
15
-
16
- <%= pb_rails("circle_chart", props: {
17
- chart_data: data_set,
18
- id: "default-test-colors",
19
- colors: ['data-6', 'data-4', 'data-2']
20
- }) %>
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import circleChartTheme from '../circleChartTheme'
3
- import Highcharts from "highcharts"
4
- import HighchartsReact from "highcharts-react-official"
5
- import colors from '../../tokens/exports/_colors.module.scss'
6
-
7
- const dataWithColors = [
8
- {
9
- name: 'Waiting for Calls',
10
- y: 41,
11
- },
12
- {
13
- name: 'On Call',
14
- y: 49,
15
- },
16
- {
17
- name: 'After Call',
18
- y: 10,
19
- },
20
- ]
21
-
22
- const CircleChartColors = () => {
23
- const chartOptions = {
24
- series: [{ data: dataWithColors }],
25
- plotOptions: {
26
- pie: {
27
- colors: ["#144075", colors.data_4, colors.data_2]
28
- }
29
- }
30
- }
31
-
32
- const options = Highcharts.merge({}, circleChartTheme, chartOptions)
33
-
34
- return (
35
- <div>
36
- <HighchartsReact
37
- highcharts={Highcharts}
38
- options={options}
39
- />
40
- </div>
41
- )
42
- }
43
-
44
- export default CircleChartColors
@@ -1,2 +0,0 @@
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`.
@@ -1,2 +0,0 @@
1
- Custom data colors allow for color customization to match the needs of business requirements.
2
- Import the colors from Playbook's tokens, then set custom colors in the plotOptions.pie.colors array using the desired color variables. Hex colors are also available `eg: #CA0095`.
@@ -1,20 +0,0 @@
1
- <% data = [{
2
- name: 'Waiting for Calls',
3
- value: 41,
4
- },
5
- {
6
- name: 'On Call',
7
- value: 49,
8
- },
9
- {
10
- name: 'After Call',
11
- value: 10,
12
- }
13
- ] %>
14
-
15
-
16
- <%= pb_rails("circle_chart", props: {
17
- chart_data: data,
18
- tooltip_html: "<p>Custom tooltip for {point.name} <br/>with value: {point.y}</p>",
19
- id: "default-test"
20
- }) %>