playbook_ui 14.24.0 → 14.25.0.pre.alpha.testingcss9700
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +34 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +64 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +10 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +2 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +24 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +3 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_date/_date.tsx +5 -3
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
- data/app/pb_kits/playbook/pb_date/date.rb +2 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +17 -0
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +3 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +22 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +43 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +6 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +212 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +8 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +112 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +3 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -1
- data/dist/chunks/_line_graph-DPTwfQR-.js +544 -0
- data/dist/chunks/_typeahead-CEqlHw0H.js +30978 -0
- data/dist/chunks/_weekday_stacked-D3dG14OB.js +20894 -0
- data/dist/chunks/lazysizes-BUUj27EF.js +611 -0
- data/dist/chunks/lib-CIetbXpr.js +9609 -0
- data/dist/chunks/pb_form_validation-D_g9rOE9.js +60 -0
- data/dist/chunks/vendor.js +11 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +67243 -3
- data/dist/playbook-rails-react-bindings.js +112 -1
- data/dist/playbook-rails.js +2464 -1
- data/dist/playbook.css +92354 -2
- data/dist/reset.css +89 -1
- data/lib/playbook/version.rb +2 -2
- metadata +25 -8
- data/dist/chunks/_line_graph-BLS62QjW.js +0 -1
- data/dist/chunks/_typeahead-CZL6rvfn.js +0 -6
- data/dist/chunks/_weekday_stacked-Cv8-Sf6X.js +0 -37
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
- data/dist/chunks/lib-DgtxnJqa.js +0 -29
- data/dist/chunks/pb_form_validation-_NsOWfBS.js +0 -1
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { b as buildAriaProps, c as buildDataProps, d as buildHtmlProps, H as HighchartsReact, e as Highcharts, f as classnames, g as globalProps, h as HighchartsMore, S as SolidGauge, i as buildCss } from "./_typeahead-CEqlHw0H.js";
|
|
4
|
+
import { c as colors, h as highchartsTheme, m as merge, a as highchartsDarkTheme, t as typography } from "./lib-CIetbXpr.js";
|
|
5
|
+
const mapColors = (array) => {
|
|
6
|
+
const regex = /(data)\-[1-8]/;
|
|
7
|
+
const newArray = array.map((item) => {
|
|
8
|
+
return regex.test(item) ? `${colors[`data_${item[item.length - 1]}`]}` : item;
|
|
9
|
+
});
|
|
10
|
+
return newArray;
|
|
11
|
+
};
|
|
12
|
+
const BarGraph = ({
|
|
13
|
+
aria = {},
|
|
14
|
+
data = {},
|
|
15
|
+
align = "center",
|
|
16
|
+
axisTitle,
|
|
17
|
+
dark = false,
|
|
18
|
+
chartData,
|
|
19
|
+
className = "pb_bar_graph",
|
|
20
|
+
colors: colors2,
|
|
21
|
+
htmlOptions = {},
|
|
22
|
+
customOptions = {},
|
|
23
|
+
axisFormat,
|
|
24
|
+
id,
|
|
25
|
+
pointStart,
|
|
26
|
+
stacking,
|
|
27
|
+
subTitle,
|
|
28
|
+
type = "column",
|
|
29
|
+
title = "Title",
|
|
30
|
+
xAxisCategories,
|
|
31
|
+
yAxisMin,
|
|
32
|
+
yAxisMax,
|
|
33
|
+
legend = false,
|
|
34
|
+
toggleLegendClick = true,
|
|
35
|
+
height,
|
|
36
|
+
layout = "horizontal",
|
|
37
|
+
verticalAlign = "bottom",
|
|
38
|
+
x = 0,
|
|
39
|
+
y = 0,
|
|
40
|
+
...props
|
|
41
|
+
}) => {
|
|
42
|
+
const ariaProps = buildAriaProps(aria);
|
|
43
|
+
const dataProps = buildDataProps(data);
|
|
44
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
|
45
|
+
const setupTheme = () => {
|
|
46
|
+
dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme);
|
|
47
|
+
};
|
|
48
|
+
setupTheme();
|
|
49
|
+
const staticOptions = {
|
|
50
|
+
title: {
|
|
51
|
+
text: title
|
|
52
|
+
},
|
|
53
|
+
chart: {
|
|
54
|
+
height,
|
|
55
|
+
type
|
|
56
|
+
},
|
|
57
|
+
subtitle: {
|
|
58
|
+
text: subTitle
|
|
59
|
+
},
|
|
60
|
+
yAxis: [{
|
|
61
|
+
labels: {
|
|
62
|
+
format: typeof axisFormat === "string" ? axisFormat : axisFormat && axisFormat[0] ? axisFormat[0].format : ""
|
|
63
|
+
},
|
|
64
|
+
min: yAxisMin,
|
|
65
|
+
max: yAxisMax,
|
|
66
|
+
opposite: false,
|
|
67
|
+
title: {
|
|
68
|
+
text: Array.isArray(axisTitle) ? axisTitle.length > 0 ? axisTitle[0].name : null : axisTitle
|
|
69
|
+
},
|
|
70
|
+
plotLines: typeof yAxisMin !== "undefined" && yAxisMin !== null ? [] : [{
|
|
71
|
+
value: 0,
|
|
72
|
+
zIndex: 10,
|
|
73
|
+
color: "#E4E8F0"
|
|
74
|
+
}]
|
|
75
|
+
}],
|
|
76
|
+
xAxis: {
|
|
77
|
+
categories: xAxisCategories
|
|
78
|
+
},
|
|
79
|
+
legend: {
|
|
80
|
+
enabled: legend,
|
|
81
|
+
align,
|
|
82
|
+
verticalAlign,
|
|
83
|
+
layout,
|
|
84
|
+
x,
|
|
85
|
+
y
|
|
86
|
+
},
|
|
87
|
+
colors: colors2 !== void 0 && colors2.length > 0 ? mapColors(colors2) : highchartsTheme.colors,
|
|
88
|
+
plotOptions: {
|
|
89
|
+
series: {
|
|
90
|
+
stacking,
|
|
91
|
+
pointStart,
|
|
92
|
+
borderWidth: stacking ? 0 : "",
|
|
93
|
+
events: {},
|
|
94
|
+
dataLabels: {
|
|
95
|
+
enabled: false
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
series: chartData,
|
|
100
|
+
credits: false
|
|
101
|
+
};
|
|
102
|
+
if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
103
|
+
staticOptions.yAxis.push({
|
|
104
|
+
labels: {
|
|
105
|
+
format: typeof axisFormat === "string" ? axisFormat : axisFormat[1].format
|
|
106
|
+
},
|
|
107
|
+
min: yAxisMin,
|
|
108
|
+
max: yAxisMax,
|
|
109
|
+
opposite: true,
|
|
110
|
+
title: {
|
|
111
|
+
text: axisTitle[1].name
|
|
112
|
+
},
|
|
113
|
+
plotLines: typeof yAxisMin !== "undefined" && yAxisMin !== null ? [] : [{
|
|
114
|
+
value: 0,
|
|
115
|
+
zIndex: 10,
|
|
116
|
+
color: "#E4E8F0"
|
|
117
|
+
}]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (!toggleLegendClick) {
|
|
121
|
+
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
|
122
|
+
}
|
|
123
|
+
const filteredProps = { ...props };
|
|
124
|
+
delete filteredProps.verticalAlign;
|
|
125
|
+
const [options, setOptions] = useState({});
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
setOptions(merge(staticOptions, customOptions));
|
|
128
|
+
}, [chartData]);
|
|
129
|
+
return /* @__PURE__ */ jsx(
|
|
130
|
+
HighchartsReact,
|
|
131
|
+
{
|
|
132
|
+
containerProps: {
|
|
133
|
+
className: classnames(globalProps(filteredProps), className),
|
|
134
|
+
id,
|
|
135
|
+
...ariaProps,
|
|
136
|
+
...dataProps,
|
|
137
|
+
...htmlProps
|
|
138
|
+
},
|
|
139
|
+
highcharts: Highcharts,
|
|
140
|
+
options
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
const alignBlockElement = (event) => {
|
|
145
|
+
const itemToMove = document.querySelector(
|
|
146
|
+
`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
|
|
147
|
+
);
|
|
148
|
+
const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
|
|
149
|
+
if (itemToMove !== null && chartContainer !== null) {
|
|
150
|
+
itemToMove.style.height = `${event.target.chartHeight}px`;
|
|
151
|
+
itemToMove.style.width = `${event.target.chartWidth}px`;
|
|
152
|
+
if (chartContainer.firstChild !== null) {
|
|
153
|
+
chartContainer.firstChild.before(itemToMove);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const CircleChart = ({
|
|
158
|
+
align = "center",
|
|
159
|
+
aria = {},
|
|
160
|
+
rounded = false,
|
|
161
|
+
borderColor = rounded ? null : "",
|
|
162
|
+
borderWidth = rounded ? 20 : null,
|
|
163
|
+
chartData,
|
|
164
|
+
children,
|
|
165
|
+
className,
|
|
166
|
+
colors: colors2 = [],
|
|
167
|
+
customOptions = {},
|
|
168
|
+
dark = false,
|
|
169
|
+
data = {},
|
|
170
|
+
dataLabelHtml = "<div>{point.name}</div>",
|
|
171
|
+
dataLabels = false,
|
|
172
|
+
height,
|
|
173
|
+
htmlOptions = {},
|
|
174
|
+
id,
|
|
175
|
+
innerSize = "md",
|
|
176
|
+
legend = false,
|
|
177
|
+
maxPointSize = null,
|
|
178
|
+
minPointSize = null,
|
|
179
|
+
startAngle = null,
|
|
180
|
+
style = "pie",
|
|
181
|
+
title,
|
|
182
|
+
tooltipHtml,
|
|
183
|
+
useHtml = false,
|
|
184
|
+
zMin = null,
|
|
185
|
+
layout = "horizontal",
|
|
186
|
+
verticalAlign = "bottom",
|
|
187
|
+
x = 0,
|
|
188
|
+
y = 0,
|
|
189
|
+
...props
|
|
190
|
+
}) => {
|
|
191
|
+
const ariaProps = buildAriaProps(aria);
|
|
192
|
+
const dataProps = buildDataProps(data);
|
|
193
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
|
194
|
+
HighchartsMore(Highcharts);
|
|
195
|
+
const setupTheme = () => {
|
|
196
|
+
dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme);
|
|
197
|
+
};
|
|
198
|
+
setupTheme();
|
|
199
|
+
Highcharts.setOptions({
|
|
200
|
+
tooltip: {
|
|
201
|
+
headerFormat: null,
|
|
202
|
+
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',
|
|
203
|
+
useHTML: useHtml
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
|
207
|
+
const innerSizeFormat = (size) => innerSizes[size];
|
|
208
|
+
const filteredProps = { ...props };
|
|
209
|
+
delete filteredProps.verticalAlign;
|
|
210
|
+
const [options, setOptions] = useState({});
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
const formattedChartData = chartData.map((obj) => {
|
|
213
|
+
obj.y = obj.value;
|
|
214
|
+
delete obj.value;
|
|
215
|
+
return obj;
|
|
216
|
+
});
|
|
217
|
+
const staticOptions = {
|
|
218
|
+
title: {
|
|
219
|
+
text: title
|
|
220
|
+
},
|
|
221
|
+
chart: {
|
|
222
|
+
height,
|
|
223
|
+
type: style,
|
|
224
|
+
events: {
|
|
225
|
+
render: (event) => alignBlockElement(event),
|
|
226
|
+
redraw: (event) => alignBlockElement(event)
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
legend: {
|
|
230
|
+
align,
|
|
231
|
+
verticalAlign,
|
|
232
|
+
layout,
|
|
233
|
+
x,
|
|
234
|
+
y
|
|
235
|
+
},
|
|
236
|
+
plotOptions: {
|
|
237
|
+
pie: {
|
|
238
|
+
colors: colors2.length > 0 ? mapColors(colors2) : highchartsTheme.colors,
|
|
239
|
+
dataLabels: {
|
|
240
|
+
enabled: dataLabels,
|
|
241
|
+
connectorShape: "straight",
|
|
242
|
+
connectorWidth: 3,
|
|
243
|
+
format: dataLabelHtml
|
|
244
|
+
},
|
|
245
|
+
showInLegend: legend
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
series: [
|
|
249
|
+
{
|
|
250
|
+
minPointSize,
|
|
251
|
+
maxPointSize,
|
|
252
|
+
innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
|
|
253
|
+
data: formattedChartData,
|
|
254
|
+
zMin,
|
|
255
|
+
startAngle,
|
|
256
|
+
borderWidth,
|
|
257
|
+
borderColor
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
credits: false
|
|
261
|
+
};
|
|
262
|
+
setOptions(merge(staticOptions, customOptions));
|
|
263
|
+
}, [chartData]);
|
|
264
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children ? /* @__PURE__ */ jsxs("div", { id: `wrapper-circle-chart-${id}`, children: [
|
|
265
|
+
/* @__PURE__ */ jsx(
|
|
266
|
+
HighchartsReact,
|
|
267
|
+
{
|
|
268
|
+
containerProps: {
|
|
269
|
+
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
|
270
|
+
id,
|
|
271
|
+
...ariaProps,
|
|
272
|
+
...dataProps,
|
|
273
|
+
...htmlProps
|
|
274
|
+
},
|
|
275
|
+
highcharts: Highcharts,
|
|
276
|
+
options
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ jsx("div", { className: "pb-circle-chart-block", children })
|
|
280
|
+
] }) : /* @__PURE__ */ jsx(
|
|
281
|
+
HighchartsReact,
|
|
282
|
+
{
|
|
283
|
+
containerProps: {
|
|
284
|
+
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
|
285
|
+
id,
|
|
286
|
+
...ariaProps,
|
|
287
|
+
...dataProps,
|
|
288
|
+
...htmlProps
|
|
289
|
+
},
|
|
290
|
+
highcharts: Highcharts,
|
|
291
|
+
options
|
|
292
|
+
}
|
|
293
|
+
) });
|
|
294
|
+
};
|
|
295
|
+
const Gauge = ({
|
|
296
|
+
aria = {},
|
|
297
|
+
chartData,
|
|
298
|
+
customOptions = {},
|
|
299
|
+
dark = false,
|
|
300
|
+
data = {},
|
|
301
|
+
disableAnimation = false,
|
|
302
|
+
fullCircle = false,
|
|
303
|
+
height = null,
|
|
304
|
+
htmlOptions = {},
|
|
305
|
+
id,
|
|
306
|
+
max = 100,
|
|
307
|
+
min = 0,
|
|
308
|
+
prefix = "",
|
|
309
|
+
showLabels = false,
|
|
310
|
+
style = "solidgauge",
|
|
311
|
+
suffix = "",
|
|
312
|
+
title = "",
|
|
313
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',
|
|
314
|
+
colors: colors$1 = [],
|
|
315
|
+
minorTickInterval = null,
|
|
316
|
+
circumference = fullCircle ? [0, 360] : [-100, 100],
|
|
317
|
+
...props
|
|
318
|
+
}) => {
|
|
319
|
+
const ariaProps = buildAriaProps(aria);
|
|
320
|
+
const dataProps = buildDataProps(data);
|
|
321
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
|
322
|
+
HighchartsMore(Highcharts);
|
|
323
|
+
SolidGauge(Highcharts);
|
|
324
|
+
const setupTheme = () => {
|
|
325
|
+
dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme);
|
|
326
|
+
};
|
|
327
|
+
setupTheme();
|
|
328
|
+
Highcharts.setOptions({
|
|
329
|
+
tooltip: {
|
|
330
|
+
pointFormat: tooltipHtml,
|
|
331
|
+
followPointer: true
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
const css = buildCss({
|
|
335
|
+
pb_gauge_kit: true
|
|
336
|
+
});
|
|
337
|
+
const [options, setOptions] = useState({});
|
|
338
|
+
useEffect(() => {
|
|
339
|
+
const formattedChartData = chartData.map((obj) => {
|
|
340
|
+
obj.y = obj.value;
|
|
341
|
+
delete obj.value;
|
|
342
|
+
return obj;
|
|
343
|
+
});
|
|
344
|
+
const staticOptions = {
|
|
345
|
+
chart: {
|
|
346
|
+
events: {
|
|
347
|
+
load() {
|
|
348
|
+
setTimeout(this.reflow.bind(this), 0);
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
type: style,
|
|
352
|
+
height
|
|
353
|
+
},
|
|
354
|
+
title: {
|
|
355
|
+
text: title
|
|
356
|
+
},
|
|
357
|
+
yAxis: {
|
|
358
|
+
min,
|
|
359
|
+
max,
|
|
360
|
+
lineWidth: 0,
|
|
361
|
+
tickWidth: 0,
|
|
362
|
+
minorTickInterval,
|
|
363
|
+
tickAmount: 2,
|
|
364
|
+
tickPositions: [min, max],
|
|
365
|
+
labels: {
|
|
366
|
+
y: 26,
|
|
367
|
+
enabled: showLabels
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
credits: false,
|
|
371
|
+
series: [
|
|
372
|
+
{
|
|
373
|
+
data: formattedChartData
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
pane: {
|
|
377
|
+
center: ["50%", "50%"],
|
|
378
|
+
size: "90%",
|
|
379
|
+
startAngle: circumference[0],
|
|
380
|
+
endAngle: circumference[1],
|
|
381
|
+
background: {
|
|
382
|
+
borderWidth: 20,
|
|
383
|
+
innerRadius: "90%",
|
|
384
|
+
outerRadius: "90%",
|
|
385
|
+
shape: "arc",
|
|
386
|
+
className: "gauge-pane"
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
colors: colors$1 !== void 0 && colors$1.length > 0 ? mapColors(colors$1) : highchartsTheme.colors,
|
|
390
|
+
plotOptions: {
|
|
391
|
+
series: {
|
|
392
|
+
animation: !disableAnimation
|
|
393
|
+
},
|
|
394
|
+
solidgauge: {
|
|
395
|
+
borderColor: colors$1 !== void 0 && colors$1.length === 1 ? mapColors(colors$1).join() : highchartsTheme.colors[0],
|
|
396
|
+
borderWidth: 20,
|
|
397
|
+
radius: 90,
|
|
398
|
+
innerRadius: "90%",
|
|
399
|
+
dataLabels: {
|
|
400
|
+
borderWidth: 0,
|
|
401
|
+
color: colors.text_lt_default,
|
|
402
|
+
enabled: true,
|
|
403
|
+
format: `<span class="prefix${dark ? " dark" : ""}">${prefix}</span><span class="fix${dark ? " dark" : ""}">{y:,f}</span><span class="suffix${dark ? " dark" : ""}">${suffix}</span>`,
|
|
404
|
+
style: {
|
|
405
|
+
fontFamily: typography.font_family_base,
|
|
406
|
+
fontWeight: typography.regular,
|
|
407
|
+
fontSize: typography.heading_2
|
|
408
|
+
},
|
|
409
|
+
y: -26
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
setOptions(merge(staticOptions, customOptions));
|
|
415
|
+
if (document.querySelector(".prefix")) {
|
|
416
|
+
document.querySelectorAll(".prefix").forEach((prefix2) => {
|
|
417
|
+
prefix2.setAttribute("y", "28");
|
|
418
|
+
});
|
|
419
|
+
document.querySelectorAll(".fix").forEach((fix) => fix.setAttribute("y", "38"));
|
|
420
|
+
}
|
|
421
|
+
}, [chartData]);
|
|
422
|
+
return /* @__PURE__ */ jsx(
|
|
423
|
+
HighchartsReact,
|
|
424
|
+
{
|
|
425
|
+
containerProps: {
|
|
426
|
+
className: classnames(css, globalProps(props)),
|
|
427
|
+
id,
|
|
428
|
+
...ariaProps,
|
|
429
|
+
...dataProps,
|
|
430
|
+
...htmlProps
|
|
431
|
+
},
|
|
432
|
+
highcharts: Highcharts,
|
|
433
|
+
options
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
};
|
|
437
|
+
const LineGraph = ({
|
|
438
|
+
aria = {},
|
|
439
|
+
data = {},
|
|
440
|
+
align = "center",
|
|
441
|
+
className = "pb_bar_graph",
|
|
442
|
+
customOptions = {},
|
|
443
|
+
dark = false,
|
|
444
|
+
gradient = false,
|
|
445
|
+
type = "line",
|
|
446
|
+
htmlOptions = {},
|
|
447
|
+
id,
|
|
448
|
+
legend = false,
|
|
449
|
+
toggleLegendClick = true,
|
|
450
|
+
layout = "horizontal",
|
|
451
|
+
verticalAlign = "bottom",
|
|
452
|
+
x = 0,
|
|
453
|
+
y = 0,
|
|
454
|
+
axisTitle,
|
|
455
|
+
xAxisCategories,
|
|
456
|
+
yAxisMin,
|
|
457
|
+
yAxisMax,
|
|
458
|
+
chartData,
|
|
459
|
+
pointStart,
|
|
460
|
+
subTitle,
|
|
461
|
+
title,
|
|
462
|
+
height,
|
|
463
|
+
colors: colors2 = [],
|
|
464
|
+
...props
|
|
465
|
+
}) => {
|
|
466
|
+
const ariaProps = buildAriaProps(aria);
|
|
467
|
+
const dataProps = buildDataProps(data);
|
|
468
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
|
469
|
+
const setupTheme = () => {
|
|
470
|
+
dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme);
|
|
471
|
+
};
|
|
472
|
+
setupTheme();
|
|
473
|
+
const staticOptions = {
|
|
474
|
+
title: {
|
|
475
|
+
text: title
|
|
476
|
+
},
|
|
477
|
+
chart: {
|
|
478
|
+
height,
|
|
479
|
+
type
|
|
480
|
+
},
|
|
481
|
+
subtitle: {
|
|
482
|
+
text: subTitle
|
|
483
|
+
},
|
|
484
|
+
yAxis: {
|
|
485
|
+
min: yAxisMin,
|
|
486
|
+
max: yAxisMax,
|
|
487
|
+
title: {
|
|
488
|
+
text: axisTitle
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
xAxis: {
|
|
492
|
+
categories: xAxisCategories
|
|
493
|
+
},
|
|
494
|
+
legend: {
|
|
495
|
+
enabled: legend,
|
|
496
|
+
align,
|
|
497
|
+
verticalAlign,
|
|
498
|
+
layout,
|
|
499
|
+
x,
|
|
500
|
+
y
|
|
501
|
+
},
|
|
502
|
+
colors: colors2 !== void 0 && colors2.length > 0 ? mapColors(colors2) : highchartsTheme.colors,
|
|
503
|
+
plotOptions: {
|
|
504
|
+
series: {
|
|
505
|
+
pointStart,
|
|
506
|
+
events: {},
|
|
507
|
+
dataLabels: {
|
|
508
|
+
enabled: false
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
series: chartData,
|
|
513
|
+
credits: false
|
|
514
|
+
};
|
|
515
|
+
if (!toggleLegendClick) {
|
|
516
|
+
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
|
517
|
+
}
|
|
518
|
+
const filteredProps = { ...props };
|
|
519
|
+
delete filteredProps.verticalAlign;
|
|
520
|
+
const [options, setOptions] = useState({});
|
|
521
|
+
useEffect(() => {
|
|
522
|
+
setOptions(merge(staticOptions, customOptions));
|
|
523
|
+
}, [chartData]);
|
|
524
|
+
return /* @__PURE__ */ jsx(
|
|
525
|
+
HighchartsReact,
|
|
526
|
+
{
|
|
527
|
+
containerProps: {
|
|
528
|
+
className: classnames(globalProps(filteredProps), className),
|
|
529
|
+
id,
|
|
530
|
+
...ariaProps,
|
|
531
|
+
...dataProps,
|
|
532
|
+
...htmlProps
|
|
533
|
+
},
|
|
534
|
+
highcharts: Highcharts,
|
|
535
|
+
options
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
};
|
|
539
|
+
export {
|
|
540
|
+
BarGraph as B,
|
|
541
|
+
CircleChart as C,
|
|
542
|
+
Gauge as G,
|
|
543
|
+
LineGraph as L
|
|
544
|
+
};
|