playbook_ui 13.23.0.pre.alpha.PLAY1284investigation2657 → 13.24.0.pre.alpha.PLAY998backgroundkitremoveemptyinlinline2666
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/pb_background/_background.tsx +7 -5
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +16 -2
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.html.erb +23 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +35 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.html.erb +22 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +34 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +2 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +1 -1
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/version.rb +2 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d91c1689890fbb2e1392ecc83ad7b869eea650744de932d645ed6ea4e566d161
|
4
|
+
data.tar.gz: e53e677351b6221797ed074c4cfdcb6ea842c33af17060167257101af7978db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da048d8e1f09cb0d4640c8a1f50e6a1acaf5bb05707d9a843dc011b963b683e8931ec13f80d3f4c98a320addbacd3ca3e9c2a9eca20ff3242d05f4336362f156
|
7
|
+
data.tar.gz: 19a49a4274d753b4b496e8299df73a224ad6356f3ba2bf04d0817d9a69272b48f0c41eab40cb05a46a3dd041ce38a8f67b6cfaffdcf4a7c9092143b1e91950d4
|
@@ -65,7 +65,7 @@ const getResponsiveValue = <T extends string | undefined>(prop: ResponsiveProp<T
|
|
65
65
|
|
66
66
|
const Background = (props: BackgroundProps): React.ReactElement => {
|
67
67
|
const {
|
68
|
-
alt =
|
68
|
+
alt = undefined,
|
69
69
|
aria = {},
|
70
70
|
backgroundColor = 'light',
|
71
71
|
backgroundPosition = '',
|
@@ -130,11 +130,13 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
130
130
|
);
|
131
131
|
|
132
132
|
const backgroundStyle = {
|
133
|
-
backgroundImage: resImageUrl ? `url(${resImageUrl})` : undefined,
|
134
|
-
backgroundRepeat: resBackgroundRepeat || undefined,
|
135
|
-
backgroundSize: resBackgroundSize || undefined,
|
136
|
-
backgroundPosition: resBackgroundPosition || undefined,
|
137
133
|
backgroundColor: customColor || undefined,
|
134
|
+
...(resImageUrl !== '' ? {
|
135
|
+
backgroundImage: resImageUrl ? `url(${resImageUrl})` : undefined,
|
136
|
+
backgroundRepeat: resBackgroundRepeat || undefined,
|
137
|
+
backgroundPosition: resBackgroundPosition || undefined,
|
138
|
+
backgroundSize: resBackgroundSize || undefined,
|
139
|
+
} : {})
|
138
140
|
};
|
139
141
|
|
140
142
|
const Tag: React.ReactElement | any = `${tag}`;
|
@@ -37,6 +37,7 @@ type BarGraphProps = {
|
|
37
37
|
y?: number;
|
38
38
|
aria?: { [key: string]: string };
|
39
39
|
data?: { [key: string]: string };
|
40
|
+
stacking?: "normal" | "percent"
|
40
41
|
axisFormat?: { format: string; }[] | string;
|
41
42
|
};
|
42
43
|
|
@@ -55,6 +56,7 @@ const BarGraph = ({
|
|
55
56
|
axisFormat,
|
56
57
|
id,
|
57
58
|
pointStart,
|
59
|
+
stacking,
|
58
60
|
subTitle,
|
59
61
|
type = "column",
|
60
62
|
title = "Title",
|
@@ -101,7 +103,12 @@ const BarGraph = ({
|
|
101
103
|
opposite: false,
|
102
104
|
title: {
|
103
105
|
text: typeof axisTitle === 'string' ? axisTitle : axisTitle[0].name,
|
104
|
-
}
|
106
|
+
},
|
107
|
+
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
108
|
+
value: 0,
|
109
|
+
zIndex: 10,
|
110
|
+
color: "#E4E8F0"
|
111
|
+
}],
|
105
112
|
}],
|
106
113
|
xAxis: {
|
107
114
|
categories: xAxisCategories,
|
@@ -120,7 +127,9 @@ const BarGraph = ({
|
|
120
127
|
: highchartsTheme.colors,
|
121
128
|
plotOptions: {
|
122
129
|
series: {
|
130
|
+
stacking: stacking,
|
123
131
|
pointStart: pointStart,
|
132
|
+
borderWidth: stacking ? 0 : "",
|
124
133
|
events: {},
|
125
134
|
dataLabels: {
|
126
135
|
enabled: false,
|
@@ -141,7 +150,12 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
141
150
|
opposite: true,
|
142
151
|
title: {
|
143
152
|
text: axisTitle[1].name,
|
144
|
-
}
|
153
|
+
},
|
154
|
+
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
155
|
+
value: 0,
|
156
|
+
zIndex: 10,
|
157
|
+
color: "#E4E8F0"
|
158
|
+
}],
|
145
159
|
});
|
146
160
|
}
|
147
161
|
|
@@ -15,6 +15,7 @@ module Playbook
|
|
15
15
|
values: %w[vertical horizontal],
|
16
16
|
default: "vertical"
|
17
17
|
prop :point_start, type: Playbook::Props::Numeric
|
18
|
+
prop :stacking
|
18
19
|
prop :subtitle
|
19
20
|
prop :title
|
20
21
|
prop :x_axis_categories, type: Playbook::Props::Array,
|
@@ -50,6 +51,7 @@ module Playbook
|
|
50
51
|
dark: dark ? "dark" : "",
|
51
52
|
type: chart_type,
|
52
53
|
title: title,
|
54
|
+
stacking: stacking,
|
53
55
|
subTitle: subtitle,
|
54
56
|
axisTitle: axis_title,
|
55
57
|
axisFormat: axis_format,
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% data = [{
|
2
|
+
name: 'Installation',
|
3
|
+
data: [-475, 400, -1000, 354, -856],
|
4
|
+
threshold: 0
|
5
|
+
}, {
|
6
|
+
name: 'Manufacturing',
|
7
|
+
data: [1475, 200, 1000, 654, -656],
|
8
|
+
threshold: 0
|
9
|
+
},
|
10
|
+
{
|
11
|
+
name: 'Sales & Distribution',
|
12
|
+
data: [1270, 100, -1200, 554, 756],
|
13
|
+
threshold: 0
|
14
|
+
}] %>
|
15
|
+
|
16
|
+
<%= pb_rails("bar_graph", props: {
|
17
|
+
axis_title: 'Number of Employees',
|
18
|
+
chart_data: data,
|
19
|
+
id: "bar-default",
|
20
|
+
x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
21
|
+
title: 'Bar Graph with Negative Numbers',
|
22
|
+
legend: true,
|
23
|
+
}) %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import BarGraph from '../_bar_graph'
|
4
|
+
|
5
|
+
const chartData = [{
|
6
|
+
name: 'Installation',
|
7
|
+
data: [-475, 400, -1000, 354, -856],
|
8
|
+
threshold: 0
|
9
|
+
}, {
|
10
|
+
name: 'Manufacturing',
|
11
|
+
data: [1475, 200, 1000, 654, -656],
|
12
|
+
threshold: 0
|
13
|
+
},
|
14
|
+
{
|
15
|
+
name: 'Sales & Distribution',
|
16
|
+
data: [1270, 100, -1200, 554, 756],
|
17
|
+
threshold: 0
|
18
|
+
}]
|
19
|
+
|
20
|
+
|
21
|
+
const BarGraphStacked = (props) => (
|
22
|
+
<div>
|
23
|
+
<BarGraph
|
24
|
+
axisTitle="Number of Employees"
|
25
|
+
chartData={chartData}
|
26
|
+
id="bar-default"
|
27
|
+
legend
|
28
|
+
title="Bar Graph with Negative Numbers"
|
29
|
+
xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
</div>
|
33
|
+
)
|
34
|
+
|
35
|
+
export default BarGraphStacked
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% data = [{
|
2
|
+
name: 'Installation',
|
3
|
+
data: [1475, 200, 3000, 654, 656],
|
4
|
+
},
|
5
|
+
{
|
6
|
+
name: 'Manufacturing',
|
7
|
+
data: [1270, 800, 200, 454, 956],
|
8
|
+
}, {
|
9
|
+
name: 'Sales & Distribution',
|
10
|
+
data: [975, 1600, 1500, 924, 500],
|
11
|
+
}] %>
|
12
|
+
|
13
|
+
<%= pb_rails("bar_graph", props: {
|
14
|
+
axis_title: 'Number of Employees',
|
15
|
+
chart_data: data,
|
16
|
+
id: "bar-default",
|
17
|
+
y_axis_min: 0,
|
18
|
+
x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
19
|
+
stacking: "normal",
|
20
|
+
title: 'Bar Graph with Stacked Columns',
|
21
|
+
legend: true,
|
22
|
+
}) %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import BarGraph from '../_bar_graph'
|
4
|
+
|
5
|
+
const chartData = [{
|
6
|
+
name: 'Installation',
|
7
|
+
data: [1475, 200, 3000, 654, 656],
|
8
|
+
},
|
9
|
+
{
|
10
|
+
name: 'Manufacturing',
|
11
|
+
data: [1270, 800, 200, 454, 956],
|
12
|
+
}, {
|
13
|
+
name: 'Sales & Distribution',
|
14
|
+
data: [975, 1600, 1500, 924, 500],
|
15
|
+
}]
|
16
|
+
|
17
|
+
|
18
|
+
const BarGraphStacked = (props) => (
|
19
|
+
<div>
|
20
|
+
<BarGraph
|
21
|
+
axisTitle="Number Of Employees"
|
22
|
+
chartData={chartData}
|
23
|
+
id="bar-default"
|
24
|
+
legend
|
25
|
+
stacking="normal"
|
26
|
+
title="Bar Graph with Stacked Columns"
|
27
|
+
xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
|
28
|
+
yAxisMin={0}
|
29
|
+
{...props}
|
30
|
+
/>
|
31
|
+
</div>
|
32
|
+
)
|
33
|
+
|
34
|
+
export default BarGraphStacked
|
@@ -0,0 +1 @@
|
|
1
|
+
The `stacking` prop can be used for a stacked bar graph. The prop allows for `normal` or `percent` as options.
|
@@ -9,6 +9,8 @@ examples:
|
|
9
9
|
- bar_graph_spline: Spline
|
10
10
|
- bar_graph_colors: Color Overrides
|
11
11
|
- bar_graph_custom: Custom Overrides
|
12
|
+
- bar_graph_stacked: Stacked
|
13
|
+
- bar_graph_negative_numbers: Negative Numbers
|
12
14
|
- bar_graph_secondary_y_axis: Secondary Y-Axis
|
13
15
|
|
14
16
|
|
@@ -21,4 +23,6 @@ examples:
|
|
21
23
|
- bar_graph_spline: Spline
|
22
24
|
- bar_graph_colors: Color Overrides
|
23
25
|
- bar_graph_custom: Custom Overrides
|
26
|
+
- bar_graph_stacked: Stacked
|
27
|
+
- bar_graph_negative_numbers: Negative Numbers
|
24
28
|
- bar_graph_secondary_y_axis: Secondary Y-Axis
|
@@ -6,4 +6,6 @@ export { default as BarGraphHeight } from './_bar_graph_height.jsx'
|
|
6
6
|
export { default as BarGraphSpline } from './_bar_graph_spline.jsx'
|
7
7
|
export { default as BarGraphColors } from './_bar_graph_colors.jsx'
|
8
8
|
export { default as BarGraphCustom } from './_bar_graph_custom.jsx'
|
9
|
+
export { default as BarGraphStacked } from './_bar_graph_stacked.jsx'
|
10
|
+
export { default as BarGraphNegativeNumbers } from './_bar_graph_negative_numbers.jsx'
|
9
11
|
export { default as BarGraphSecondaryYAxis } from './_bar_graph_secondary_y_axis.jsx'
|