playbook_ui 11.16.0.pre.alpha.paginationrails1 → 11.16.0.pre.alpha.reactupgrade1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -2
- data/app/pb_kits/playbook/data/menu.yml +0 -1
- data/app/pb_kits/playbook/index.js +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +111 -0
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +151 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +21 -9
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +47 -7
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsDarkTheme.ts → pbChartsDarkTheme.js} +21 -6
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsLightTheme.ts → pbChartsLightTheme.js} +21 -6
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +112 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -4
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +1 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +8 -8
- data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +11 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +8 -3
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +113 -0
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +120 -130
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +1 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/playbook-doc.js +0 -2
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +0 -4
- data/app/pb_kits/playbook/playbook-rails.js +4 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +322 -0
- data/lib/playbook/kit_base.rb +0 -2
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook.rb +0 -1
- metadata +10 -36
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -145
- data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +0 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +0 -207
- data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +0 -16
- data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +0 -16
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +0 -202
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +0 -148
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +0 -68
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -41
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb +0 -28
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +0 -7
- data/app/pb_kits/playbook/pb_pagination/pagination.rb +0 -18
- data/app/pb_kits/playbook/pb_pagination/pagination.test.jsx +0 -17
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +0 -111
- data/lib/playbook/pagination_renderer.rb +0 -41
@@ -1,207 +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
|
-
|
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 } from "../utilities/props";
|
13
|
-
|
14
|
-
type CircleChartProps = {
|
15
|
-
align?: "left" | "right" | "center";
|
16
|
-
aria: { [key: string]: string };
|
17
|
-
chartData?: [];
|
18
|
-
children?: Node;
|
19
|
-
className?: string;
|
20
|
-
colors?: string[];
|
21
|
-
dark?: Boolean;
|
22
|
-
data?: Object;
|
23
|
-
dataLabelHtml?: string;
|
24
|
-
dataLabels?: boolean;
|
25
|
-
height?: string;
|
26
|
-
id?: string;
|
27
|
-
innerSize?: "sm" | "md" | "lg" | "none";
|
28
|
-
legend?: boolean;
|
29
|
-
maxPointSize?: number;
|
30
|
-
minPointSize?: number;
|
31
|
-
rounded?: boolean;
|
32
|
-
startAngle?: number;
|
33
|
-
style?: string;
|
34
|
-
title?: string;
|
35
|
-
useHtml?: boolean;
|
36
|
-
zMin?: number;
|
37
|
-
layout?: "horizontal" | "vertical" | "proximate";
|
38
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
39
|
-
x?: number;
|
40
|
-
y?: number;
|
41
|
-
borderColor?: string;
|
42
|
-
borderWidth?: number;
|
43
|
-
};
|
44
|
-
|
45
|
-
// Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
|
46
|
-
const alignBlockElement = (event: any) => {
|
47
|
-
const itemToMove = document.querySelector(
|
48
|
-
`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
|
49
|
-
) as HTMLElement;
|
50
|
-
const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
|
51
|
-
if (itemToMove !== null) {
|
52
|
-
itemToMove.style.height = `${event.target.chartHeight}px`;
|
53
|
-
itemToMove.style.width = `${event.target.chartWidth}px`;
|
54
|
-
chartContainer.firstChild.before(itemToMove);
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
const CircleChart = ({
|
59
|
-
align = "center",
|
60
|
-
aria = {},
|
61
|
-
rounded = false,
|
62
|
-
borderColor = rounded ? null : "",
|
63
|
-
borderWidth = rounded ? 20 : null,
|
64
|
-
chartData,
|
65
|
-
children,
|
66
|
-
className,
|
67
|
-
colors = [],
|
68
|
-
dark = false,
|
69
|
-
data = {},
|
70
|
-
dataLabelHtml = "<div>{point.name}</div>",
|
71
|
-
dataLabels = false,
|
72
|
-
height,
|
73
|
-
id,
|
74
|
-
innerSize = "md",
|
75
|
-
legend = false,
|
76
|
-
maxPointSize = null,
|
77
|
-
minPointSize = null,
|
78
|
-
startAngle = null,
|
79
|
-
style = "pie",
|
80
|
-
title,
|
81
|
-
useHtml = false,
|
82
|
-
zMin = null,
|
83
|
-
layout = "horizontal",
|
84
|
-
verticalAlign = "bottom",
|
85
|
-
x = 0,
|
86
|
-
y = 0,
|
87
|
-
...props
|
88
|
-
}: CircleChartProps) => {
|
89
|
-
const ariaProps = buildAriaProps(aria);
|
90
|
-
const dataProps = buildDataProps(data);
|
91
|
-
highchartsMore(Highcharts);
|
92
|
-
|
93
|
-
const setupTheme = () => {
|
94
|
-
dark
|
95
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
96
|
-
: Highcharts.setOptions(highchartsTheme);
|
97
|
-
};
|
98
|
-
setupTheme();
|
99
|
-
|
100
|
-
Highcharts.setOptions({
|
101
|
-
tooltip: {
|
102
|
-
headerFormat: null,
|
103
|
-
pointFormat:
|
104
|
-
'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
|
105
|
-
"<b>{point.y}</b>",
|
106
|
-
useHTML: useHtml,
|
107
|
-
},
|
108
|
-
});
|
109
|
-
|
110
|
-
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
111
|
-
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
112
|
-
innerSizes[size];
|
113
|
-
|
114
|
-
|
115
|
-
const [options, setOptions] = useState({});
|
116
|
-
|
117
|
-
useEffect(() => {
|
118
|
-
const formattedChartData = chartData.map((obj: any) => {
|
119
|
-
obj.y = obj.value;
|
120
|
-
delete obj.value;
|
121
|
-
return obj;
|
122
|
-
});
|
123
|
-
|
124
|
-
const staticOptions = {
|
125
|
-
title: {
|
126
|
-
text: title,
|
127
|
-
},
|
128
|
-
chart: {
|
129
|
-
height: height,
|
130
|
-
type: style,
|
131
|
-
events: {
|
132
|
-
render: (event: any) => alignBlockElement(event),
|
133
|
-
redraw: (event: any) => alignBlockElement(event),
|
134
|
-
},
|
135
|
-
},
|
136
|
-
|
137
|
-
legend: {
|
138
|
-
align: align,
|
139
|
-
verticalAlign: verticalAlign,
|
140
|
-
layout: layout,
|
141
|
-
x: x,
|
142
|
-
y: y,
|
143
|
-
},
|
144
|
-
plotOptions: {
|
145
|
-
pie: {
|
146
|
-
colors:
|
147
|
-
colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
|
148
|
-
dataLabels: {
|
149
|
-
enabled: dataLabels,
|
150
|
-
connectorShape: "straight",
|
151
|
-
connectorWidth: 3,
|
152
|
-
format: dataLabelHtml,
|
153
|
-
},
|
154
|
-
showInLegend: legend,
|
155
|
-
},
|
156
|
-
},
|
157
|
-
series: [
|
158
|
-
{
|
159
|
-
minPointSize: minPointSize,
|
160
|
-
maxPointSize: maxPointSize,
|
161
|
-
innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
|
162
|
-
data: formattedChartData,
|
163
|
-
zMin: zMin,
|
164
|
-
startAngle: startAngle,
|
165
|
-
borderWidth: borderWidth,
|
166
|
-
borderColor: borderColor,
|
167
|
-
},
|
168
|
-
],
|
169
|
-
credits: false,
|
170
|
-
};
|
171
|
-
setOptions({ ...staticOptions });
|
172
|
-
}, [chartData]);
|
173
|
-
|
174
|
-
|
175
|
-
return (
|
176
|
-
<>
|
177
|
-
{children ? (
|
178
|
-
<div id={`wrapper-circle-chart-${id}`}>
|
179
|
-
<HighchartsReact
|
180
|
-
containerProps={{
|
181
|
-
className: classnames("pb_circle_chart", globalProps(props)),
|
182
|
-
id: id,
|
183
|
-
...ariaProps,
|
184
|
-
...dataProps,
|
185
|
-
}}
|
186
|
-
highcharts={Highcharts}
|
187
|
-
options={options}
|
188
|
-
/>
|
189
|
-
<div className="pb-circle-chart-block">{children}</div>
|
190
|
-
</div>
|
191
|
-
) : (
|
192
|
-
<HighchartsReact
|
193
|
-
containerProps={{
|
194
|
-
className: classnames("pb_circle_chart", globalProps(props)),
|
195
|
-
id: id,
|
196
|
-
...ariaProps,
|
197
|
-
...dataProps,
|
198
|
-
}}
|
199
|
-
highcharts={Highcharts}
|
200
|
-
options={options}
|
201
|
-
/>
|
202
|
-
)}
|
203
|
-
</>
|
204
|
-
);
|
205
|
-
};
|
206
|
-
|
207
|
-
export default CircleChart;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import colors from "../tokens/exports/_colors.scss";
|
2
|
-
|
3
|
-
|
4
|
-
// Map Data Color String Props to our SCSS Variables
|
5
|
-
const mapColors = (array: string[]) => {
|
6
|
-
const regex = /(data)\-[1-8]/; //eslint-disable-line
|
7
|
-
|
8
|
-
const newArray = array.map((item) => {
|
9
|
-
return regex.test(item)
|
10
|
-
? `${colors[`data_${item[item.length - 1]}`]}`
|
11
|
-
: item;
|
12
|
-
});
|
13
|
-
return newArray;
|
14
|
-
};
|
15
|
-
|
16
|
-
export default mapColors
|
@@ -1,16 +0,0 @@
|
|
1
|
-
export type ThemeProps = {
|
2
|
-
lang?: {[key: string]: string}
|
3
|
-
credits?: {[key: string]: boolean}
|
4
|
-
colors?: string[]
|
5
|
-
chart?: {[key: string]: any}
|
6
|
-
title?: {[key: string]: string | {}}
|
7
|
-
subtitle?: {[key: string]: string | {};}
|
8
|
-
xAxis?: {[key: string]: any;}
|
9
|
-
yAxis?: {[key: string]: any;}
|
10
|
-
legend?: {[key: string]: string | {};}
|
11
|
-
labels?: {[key: string]: {};}
|
12
|
-
tooltip?: {[key: string]: any;}
|
13
|
-
pane?: {[key: string]: {};}
|
14
|
-
plotOptions?: {[key: string]: any;}
|
15
|
-
colorKey?: string
|
16
|
-
}
|
@@ -1,202 +0,0 @@
|
|
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.scss";
|
11
|
-
import typography from "../tokens/exports/_typography.scss";
|
12
|
-
|
13
|
-
import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
14
|
-
import { globalProps } from "../utilities/globalProps";
|
15
|
-
|
16
|
-
type GaugeProps = {
|
17
|
-
aria: { [key: string]: string };
|
18
|
-
className?: string;
|
19
|
-
chartData?: { name: string; value: number[] | number }[];
|
20
|
-
dark?: Boolean;
|
21
|
-
data?: { [key: string]: string };
|
22
|
-
disableAnimation?: boolean;
|
23
|
-
fullCircle?: boolean;
|
24
|
-
height?: string;
|
25
|
-
id?: string;
|
26
|
-
max?: number;
|
27
|
-
min?: number;
|
28
|
-
prefix?: string;
|
29
|
-
showLabels?: boolean;
|
30
|
-
style?: string;
|
31
|
-
suffix?: string;
|
32
|
-
title?: string;
|
33
|
-
tooltipHtml?: string;
|
34
|
-
colors: string[];
|
35
|
-
minorTickInterval: any;
|
36
|
-
circumference: number[];
|
37
|
-
};
|
38
|
-
|
39
|
-
const Gauge = ({
|
40
|
-
aria = {},
|
41
|
-
className,
|
42
|
-
chartData,
|
43
|
-
dark = false,
|
44
|
-
data = {},
|
45
|
-
disableAnimation = false,
|
46
|
-
fullCircle = false,
|
47
|
-
height = null,
|
48
|
-
id,
|
49
|
-
max = 100,
|
50
|
-
min = 0,
|
51
|
-
prefix = "",
|
52
|
-
showLabels = false,
|
53
|
-
style = "solidgauge",
|
54
|
-
suffix = "",
|
55
|
-
title = "",
|
56
|
-
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
|
57
|
-
"<b>{point.y}</b>",
|
58
|
-
colors = [],
|
59
|
-
minorTickInterval = null,
|
60
|
-
circumference = fullCircle ? [0, 360] : [-100, 100],
|
61
|
-
...props
|
62
|
-
}: GaugeProps) => {
|
63
|
-
const ariaProps = buildAriaProps(aria);
|
64
|
-
const dataProps = buildDataProps(data);
|
65
|
-
highchartsMore(Highcharts);
|
66
|
-
solidGauge(Highcharts);
|
67
|
-
const setupTheme = () => {
|
68
|
-
dark
|
69
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
70
|
-
: Highcharts.setOptions(highchartsTheme);
|
71
|
-
};
|
72
|
-
setupTheme();
|
73
|
-
|
74
|
-
//set tooltip directly to prevent being overriden by Highcharts defaults
|
75
|
-
Highcharts.setOptions({
|
76
|
-
tooltip: {
|
77
|
-
pointFormat: tooltipHtml,
|
78
|
-
followPointer: true,
|
79
|
-
},
|
80
|
-
});
|
81
|
-
|
82
|
-
const css = buildCss({
|
83
|
-
pb_gauge_kit: true,
|
84
|
-
});
|
85
|
-
|
86
|
-
const [options, setOptions] = useState({});
|
87
|
-
|
88
|
-
useEffect(() => {
|
89
|
-
const formattedChartData = chartData.map((obj: any) => {
|
90
|
-
obj.y = obj.value;
|
91
|
-
delete obj.value;
|
92
|
-
return obj;
|
93
|
-
});
|
94
|
-
|
95
|
-
const staticOptions = {
|
96
|
-
chart: {
|
97
|
-
events: {
|
98
|
-
load() {
|
99
|
-
setTimeout(this.reflow.bind(this), 0);
|
100
|
-
},
|
101
|
-
},
|
102
|
-
type: style,
|
103
|
-
height: height,
|
104
|
-
},
|
105
|
-
title: {
|
106
|
-
text: title,
|
107
|
-
},
|
108
|
-
yAxis: {
|
109
|
-
min: min,
|
110
|
-
max: max,
|
111
|
-
lineWidth: 0,
|
112
|
-
tickWidth: 0,
|
113
|
-
minorTickInterval: minorTickInterval,
|
114
|
-
tickAmount: 2,
|
115
|
-
tickPositions: [min, max],
|
116
|
-
labels: {
|
117
|
-
y: 26,
|
118
|
-
enabled: showLabels,
|
119
|
-
},
|
120
|
-
},
|
121
|
-
credits: false,
|
122
|
-
series: [
|
123
|
-
{
|
124
|
-
data: formattedChartData,
|
125
|
-
},
|
126
|
-
],
|
127
|
-
pane: {
|
128
|
-
center: ["50%", "50%"],
|
129
|
-
size: "90%",
|
130
|
-
startAngle: circumference[0],
|
131
|
-
endAngle: circumference[1],
|
132
|
-
background: {
|
133
|
-
borderWidth: 20,
|
134
|
-
innerRadius: "90%",
|
135
|
-
outerRadius: "90%",
|
136
|
-
shape: "arc",
|
137
|
-
className: "gauge-pane",
|
138
|
-
},
|
139
|
-
},
|
140
|
-
colors:
|
141
|
-
colors !== undefined && colors.length > 0
|
142
|
-
? mapColors(colors)
|
143
|
-
: highchartsTheme.colors,
|
144
|
-
plotOptions: {
|
145
|
-
series: {
|
146
|
-
animation: !disableAnimation,
|
147
|
-
},
|
148
|
-
solidgauge: {
|
149
|
-
borderColor:
|
150
|
-
colors !== undefined && colors.length === 1
|
151
|
-
? mapColors(colors).join()
|
152
|
-
: highchartsTheme.colors[0],
|
153
|
-
borderWidth: 20,
|
154
|
-
radius: 90,
|
155
|
-
innerRadius: "90%",
|
156
|
-
dataLabels: {
|
157
|
-
borderWidth: 0,
|
158
|
-
color: defaultColors.text_lt_default,
|
159
|
-
enabled: true,
|
160
|
-
format:
|
161
|
-
`<span class="prefix">${prefix}</span>` +
|
162
|
-
'<span class="fix">{y:,f}</span>' +
|
163
|
-
`<span class="suffix">${suffix}</span>`,
|
164
|
-
style: {
|
165
|
-
fontFamily: typography.font_family_base,
|
166
|
-
fontWeight: typography.regular,
|
167
|
-
fontSize: typography.heading_2,
|
168
|
-
},
|
169
|
-
y: -26,
|
170
|
-
},
|
171
|
-
},
|
172
|
-
},
|
173
|
-
};
|
174
|
-
|
175
|
-
setOptions({ ...staticOptions });
|
176
|
-
|
177
|
-
if (document.querySelector(".prefix")) {
|
178
|
-
document.querySelectorAll(".prefix").forEach((prefix) => {
|
179
|
-
prefix.setAttribute("y", "28");
|
180
|
-
});
|
181
|
-
document
|
182
|
-
.querySelectorAll(".fix")
|
183
|
-
.forEach((fix) => fix.setAttribute("y", "38"));
|
184
|
-
}
|
185
|
-
|
186
|
-
}, [chartData]);
|
187
|
-
|
188
|
-
return (
|
189
|
-
<HighchartsReact
|
190
|
-
containerProps={{
|
191
|
-
className: classnames(css, globalProps(props)),
|
192
|
-
id: id,
|
193
|
-
...ariaProps,
|
194
|
-
...dataProps,
|
195
|
-
}}
|
196
|
-
highcharts={Highcharts}
|
197
|
-
options={options}
|
198
|
-
/>
|
199
|
-
);
|
200
|
-
};
|
201
|
-
|
202
|
-
export default Gauge;
|
@@ -1,148 +0,0 @@
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
2
|
-
import classnames from "classnames";
|
3
|
-
import { globalProps } from "../utilities/globalProps";
|
4
|
-
import { buildAriaProps, buildDataProps } 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
|
-
|
12
|
-
type LineGraphProps = {
|
13
|
-
align?: "left" | "right" | "center";
|
14
|
-
axisTitle?: string;
|
15
|
-
dark?: Boolean;
|
16
|
-
xAxisCategories: [];
|
17
|
-
yAxisMin: number;
|
18
|
-
yAxisMax: number;
|
19
|
-
className?: string;
|
20
|
-
chartData: {
|
21
|
-
name: string;
|
22
|
-
data: number[];
|
23
|
-
}[];
|
24
|
-
gradient?: boolean;
|
25
|
-
id: string;
|
26
|
-
pointStart: number;
|
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
|
-
};
|
41
|
-
|
42
|
-
const LineGraph = ({
|
43
|
-
aria = {},
|
44
|
-
data = {},
|
45
|
-
align = "center",
|
46
|
-
className = "pb_bar_graph",
|
47
|
-
dark = false,
|
48
|
-
gradient = false,
|
49
|
-
type = "line",
|
50
|
-
id,
|
51
|
-
legend = false,
|
52
|
-
toggleLegendClick = true,
|
53
|
-
layout = "horizontal",
|
54
|
-
verticalAlign = "bottom",
|
55
|
-
x = 0,
|
56
|
-
y = 0,
|
57
|
-
axisTitle,
|
58
|
-
xAxisCategories,
|
59
|
-
yAxisMin,
|
60
|
-
yAxisMax,
|
61
|
-
chartData,
|
62
|
-
pointStart,
|
63
|
-
subTitle,
|
64
|
-
title,
|
65
|
-
height,
|
66
|
-
colors = [],
|
67
|
-
...props
|
68
|
-
}: LineGraphProps) => {
|
69
|
-
const ariaProps = buildAriaProps(aria);
|
70
|
-
const dataProps = buildDataProps(data);
|
71
|
-
const setupTheme = () => {
|
72
|
-
dark
|
73
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
74
|
-
: Highcharts.setOptions(highchartsTheme);
|
75
|
-
};
|
76
|
-
setupTheme();
|
77
|
-
|
78
|
-
const staticOptions = {
|
79
|
-
title: {
|
80
|
-
text: title,
|
81
|
-
},
|
82
|
-
chart: {
|
83
|
-
height: height,
|
84
|
-
type: type,
|
85
|
-
},
|
86
|
-
subtitle: {
|
87
|
-
text: subTitle,
|
88
|
-
},
|
89
|
-
yAxis: {
|
90
|
-
min: yAxisMin,
|
91
|
-
max: yAxisMax,
|
92
|
-
title: {
|
93
|
-
text: axisTitle,
|
94
|
-
},
|
95
|
-
},
|
96
|
-
xAxis: {
|
97
|
-
categories: xAxisCategories,
|
98
|
-
},
|
99
|
-
legend: {
|
100
|
-
enabled: legend,
|
101
|
-
align: align,
|
102
|
-
verticalAlign: verticalAlign,
|
103
|
-
layout: layout,
|
104
|
-
x: x,
|
105
|
-
y: y,
|
106
|
-
},
|
107
|
-
colors:
|
108
|
-
colors !== undefined && colors.length > 0
|
109
|
-
? mapColors(colors)
|
110
|
-
: highchartsTheme.colors,
|
111
|
-
plotOptions: {
|
112
|
-
series: {
|
113
|
-
pointStart: pointStart,
|
114
|
-
events: {},
|
115
|
-
dataLabels: {
|
116
|
-
enabled: false,
|
117
|
-
},
|
118
|
-
},
|
119
|
-
},
|
120
|
-
series: chartData,
|
121
|
-
credits: false,
|
122
|
-
};
|
123
|
-
|
124
|
-
if (!toggleLegendClick) {
|
125
|
-
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
126
|
-
}
|
127
|
-
|
128
|
-
const [options, setOptions] = useState({});
|
129
|
-
|
130
|
-
useEffect(() => {
|
131
|
-
setOptions({ ...staticOptions });
|
132
|
-
}, [chartData]);
|
133
|
-
|
134
|
-
return (
|
135
|
-
<HighchartsReact
|
136
|
-
containerProps={{
|
137
|
-
className: classnames(globalProps(props), className),
|
138
|
-
id: id,
|
139
|
-
...ariaProps,
|
140
|
-
...dataProps,
|
141
|
-
}}
|
142
|
-
highcharts={Highcharts}
|
143
|
-
options={options}
|
144
|
-
/>
|
145
|
-
);
|
146
|
-
};
|
147
|
-
|
148
|
-
export default LineGraph;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@import "tokens/colors";
|
2
|
-
@import "tokens/typography";
|
3
|
-
@import "tokens/border_radius";
|
4
|
-
@import "tokens/shadows";
|
5
|
-
|
6
|
-
.pb_pagination {
|
7
|
-
display: inline-block;
|
8
|
-
border-radius: $border_rad_light;
|
9
|
-
border: 1px solid $border_light;
|
10
|
-
background-color: $white;
|
11
|
-
padding: 3px 0px 3.6px 0px;
|
12
|
-
li {
|
13
|
-
display: inline;
|
14
|
-
> a, li > span {
|
15
|
-
padding: 7px 13px;
|
16
|
-
text-decoration: none;
|
17
|
-
margin-left: -1px;
|
18
|
-
border: 0 !important;
|
19
|
-
}}
|
20
|
-
li:first-child > a, li:first-child > span {
|
21
|
-
padding: 7px 13px;
|
22
|
-
margin-left: .5px;
|
23
|
-
border-right: 1px solid $border_light !important;
|
24
|
-
z-index: 2;
|
25
|
-
}
|
26
|
-
li:last-child > a, li:last-child > span {
|
27
|
-
padding: 7px 13px;
|
28
|
-
margin-right: .5px;
|
29
|
-
border-left: 1px solid $border_light !important;
|
30
|
-
z-index: 2;
|
31
|
-
}
|
32
|
-
a {
|
33
|
-
color: $text_lt_default !important;
|
34
|
-
font-size: $text_small;
|
35
|
-
font-weight: $regular;
|
36
|
-
border: none;
|
37
|
-
|
38
|
-
&:hover {
|
39
|
-
background-color: $active_light;
|
40
|
-
color: $primary !important;
|
41
|
-
border-radius: $border_rad_light;
|
42
|
-
}
|
43
|
-
|
44
|
-
&:focus {
|
45
|
-
outline: 1px solid $primary !important;
|
46
|
-
border-radius: $border_rad_light;
|
47
|
-
outline-offset: -1px;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
.active > span {
|
51
|
-
background-color: $primary !important;
|
52
|
-
border-radius: $border_rad_light;
|
53
|
-
color: #fff;
|
54
|
-
padding: 7px 10px;
|
55
|
-
border: 0 !important;
|
56
|
-
text-decoration: none;
|
57
|
-
font-weight: $bold;
|
58
|
-
font-size: $text_small;
|
59
|
-
|
60
|
-
&:hover {
|
61
|
-
box-shadow: $shadow_deeper;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
.disabled > span {
|
65
|
-
padding: 7px 10px;
|
66
|
-
font-size: $text_small;
|
67
|
-
}
|
68
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/* @flow */
|
4
|
-
|
5
|
-
import React from 'react'
|
6
|
-
import classnames from 'classnames'
|
7
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps'
|
9
|
-
|
10
|
-
type PaginationProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
}
|
16
|
-
|
17
|
-
const Pagination = (props: PaginationProps) => {
|
18
|
-
const {
|
19
|
-
aria = {},
|
20
|
-
className,
|
21
|
-
data = {},
|
22
|
-
id,
|
23
|
-
} = props
|
24
|
-
|
25
|
-
const ariaProps = buildAriaProps(aria)
|
26
|
-
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_pagination'), globalProps(props), className)
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
{...ariaProps}
|
32
|
-
{...dataProps}
|
33
|
-
className={classes}
|
34
|
-
id={id}
|
35
|
-
>
|
36
|
-
{className}
|
37
|
-
</div>
|
38
|
-
)
|
39
|
-
}
|
40
|
-
|
41
|
-
export default Pagination
|