playbook_ui 10.26.0.pre.alpha3 → 10.26.0.pre.alpha5
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 +1 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +2 -1
- data/app/pb_kits/playbook/pb_background/{_background.jsx → _background.tsx} +20 -13
- data/app/pb_kits/playbook/pb_badge/{_badge.jsx → _badge.tsx} +14 -15
- data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -3
- data/app/pb_kits/playbook/pb_body/_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_button/{_button.jsx → _button.tsx} +65 -46
- data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_caption/{_caption.jsx → _caption.tsx} +7 -8
- data/app/pb_kits/playbook/pb_card/{_card.jsx → _card.tsx} +23 -23
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_none.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_radius.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +17 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_selected.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +4 -2
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +37 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +37 -0
- data/app/pb_kits/playbook/pb_flex/{_flex.jsx → _flex.tsx} +5 -5
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/{_icon.jsx → _icon.tsx} +40 -30
- data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +6 -8
- data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pill/docs/_pill_variants.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +7 -0
- data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +6 -4
- data/app/pb_kits/playbook/pb_title/{_title.jsx → _title.tsx} +10 -12
- data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +43 -0
- data/app/pb_kits/playbook/pb_user/{_user.jsx → _user.tsx} +20 -24
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +34 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
- data/app/pb_kits/playbook/tokens/_display.scss +3 -3
- data/app/pb_kits/playbook/tokens/_screen_sizes.scss +25 -5
- data/app/pb_kits/playbook/utilities/_align_content.scss +10 -29
- data/app/pb_kits/playbook/utilities/_align_items.scss +11 -35
- data/app/pb_kits/playbook/utilities/_align_self.scss +10 -29
- data/app/pb_kits/playbook/utilities/_display.scss +9 -42
- data/app/pb_kits/playbook/utilities/_flex.scss +19 -14
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +7 -18
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +6 -13
- data/app/pb_kits/playbook/utilities/_justify_content.scss +10 -23
- data/app/pb_kits/playbook/utilities/_justify_self.scss +9 -19
- data/app/pb_kits/playbook/utilities/_mixins.scss +26 -0
- data/app/pb_kits/playbook/utilities/_order.scss +17 -55
- data/app/pb_kits/playbook/utilities/globalProps.ts +127 -113
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +36 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +38 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +64 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test-utils.js +2 -0
- data/app/pb_kits/playbook/utilities/text.ts +22 -0
- data/dist/reset.css +60 -1
- data/lib/playbook/align_content.rb +11 -3
- data/lib/playbook/align_items.rb +10 -2
- data/lib/playbook/align_self.rb +9 -1
- data/lib/playbook/display.rb +2 -4
- data/lib/playbook/flex.rb +9 -1
- data/lib/playbook/flex_direction.rb +10 -2
- data/lib/playbook/flex_grow.rb +9 -1
- data/lib/playbook/flex_shrink.rb +9 -1
- data/lib/playbook/flex_wrap.rb +10 -2
- data/lib/playbook/justify_content.rb +10 -2
- data/lib/playbook/justify_self.rb +9 -1
- data/lib/playbook/order.rb +10 -2
- data/lib/playbook/version.rb +2 -2
- metadata +47 -13
- data/app/pb_kits/playbook/utilities/text.js +0 -15
@@ -0,0 +1,79 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Evergreen",
|
4
|
+
id: "Evergreen",
|
5
|
+
color: "#0056CF",
|
6
|
+
}, {
|
7
|
+
name: "Pine",
|
8
|
+
id: "Pine",
|
9
|
+
parent: "Evergreen",
|
10
|
+
value: 300,
|
11
|
+
color: "#477BC4",
|
12
|
+
}, {
|
13
|
+
name: "Ponderosa Pine",
|
14
|
+
parent: "Pine",
|
15
|
+
value: 50,
|
16
|
+
}, {
|
17
|
+
name: "Scots Pine",
|
18
|
+
parent: "Pine",
|
19
|
+
value: 150,
|
20
|
+
}, {
|
21
|
+
name: "White Pine",
|
22
|
+
parent: "Pine",
|
23
|
+
value: 100,
|
24
|
+
}, {
|
25
|
+
name: "Douglas Fir",
|
26
|
+
parent: "Evergreen",
|
27
|
+
value: 150,
|
28
|
+
}, {
|
29
|
+
name: "Juniper",
|
30
|
+
parent: "Evergreen",
|
31
|
+
value: 80,
|
32
|
+
}, {
|
33
|
+
name: "Hemlock",
|
34
|
+
parent: "Evergreen",
|
35
|
+
value: 30,
|
36
|
+
}, {
|
37
|
+
name: "Deciduous",
|
38
|
+
id: "Deciduous",
|
39
|
+
color: "#F9BB00",
|
40
|
+
}, {
|
41
|
+
name: "Oak",
|
42
|
+
parent: "Deciduous",
|
43
|
+
value: 80,
|
44
|
+
}, {
|
45
|
+
name: "Maple",
|
46
|
+
id: "Maple",
|
47
|
+
parent: "Deciduous",
|
48
|
+
value: 180,
|
49
|
+
color: "#F7CE52",
|
50
|
+
}, {
|
51
|
+
name: "Red Maple",
|
52
|
+
parent: "Maple",
|
53
|
+
value: 80,
|
54
|
+
}, {
|
55
|
+
name: "Sugar Maple",
|
56
|
+
parent: "Maple",
|
57
|
+
value: 100,
|
58
|
+
}, {
|
59
|
+
name: "Beech",
|
60
|
+
parent: "Deciduous",
|
61
|
+
value: 50,
|
62
|
+
}, {
|
63
|
+
name: "Willow",
|
64
|
+
parent: "Deciduous",
|
65
|
+
value: 100,
|
66
|
+
}, {
|
67
|
+
name: "Juniper",
|
68
|
+
parent: "Deciduous",
|
69
|
+
value: 90,
|
70
|
+
},
|
71
|
+
] %>
|
72
|
+
|
73
|
+
<%= pb_rails("treemap_chart", props: {
|
74
|
+
chart_data: data,
|
75
|
+
drillable: true,
|
76
|
+
grouped: true,
|
77
|
+
id: "treemap-drillable",
|
78
|
+
title: "Drillable Grouped Tree Species",
|
79
|
+
}) %>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Evergreen",
|
8
|
+
id: "Evergreen",
|
9
|
+
color: "#0056CF",
|
10
|
+
}, {
|
11
|
+
name: "Pine",
|
12
|
+
id: "Pine",
|
13
|
+
parent: "Evergreen",
|
14
|
+
value: 300,
|
15
|
+
color: "#477BC4",
|
16
|
+
}, {
|
17
|
+
name: "Ponderosa Pine",
|
18
|
+
parent: "Pine",
|
19
|
+
value: 50,
|
20
|
+
}, {
|
21
|
+
name: "Scots Pine",
|
22
|
+
parent: "Pine",
|
23
|
+
value: 150,
|
24
|
+
}, {
|
25
|
+
name: "White Pine",
|
26
|
+
parent: "Pine",
|
27
|
+
value: 100,
|
28
|
+
}, {
|
29
|
+
name: "Douglas Fir",
|
30
|
+
parent: "Evergreen",
|
31
|
+
value: 150,
|
32
|
+
}, {
|
33
|
+
name: "Juniper",
|
34
|
+
parent: "Evergreen",
|
35
|
+
value: 80,
|
36
|
+
}, {
|
37
|
+
name: "Hemlock",
|
38
|
+
parent: "Evergreen",
|
39
|
+
value: 30,
|
40
|
+
}, {
|
41
|
+
name: "Deciduous",
|
42
|
+
id: "Deciduous",
|
43
|
+
color: "#F9BB00",
|
44
|
+
}, {
|
45
|
+
name: "Oak",
|
46
|
+
parent: "Deciduous",
|
47
|
+
value: 80,
|
48
|
+
}, {
|
49
|
+
name: "Maple",
|
50
|
+
id: "Maple",
|
51
|
+
parent: "Deciduous",
|
52
|
+
value: 180,
|
53
|
+
color: "#F7CE52",
|
54
|
+
}, {
|
55
|
+
name: "Red Maple",
|
56
|
+
parent: "Maple",
|
57
|
+
value: 80,
|
58
|
+
}, {
|
59
|
+
name: "Sugar Maple",
|
60
|
+
parent: "Maple",
|
61
|
+
value: 100,
|
62
|
+
}, {
|
63
|
+
name: "Beech",
|
64
|
+
parent: "Deciduous",
|
65
|
+
value: 50,
|
66
|
+
}, {
|
67
|
+
name: "Willow",
|
68
|
+
parent: "Deciduous",
|
69
|
+
value: 100,
|
70
|
+
}, {
|
71
|
+
name: "Juniper",
|
72
|
+
parent: "Deciduous",
|
73
|
+
value: 90,
|
74
|
+
},
|
75
|
+
]
|
76
|
+
|
77
|
+
const TreemapChartDrillable = (props) => (
|
78
|
+
<div>
|
79
|
+
<TreemapChart
|
80
|
+
chartData={chartData}
|
81
|
+
drillable
|
82
|
+
grouped
|
83
|
+
id="treemap-drillable"
|
84
|
+
title="Drillable Grouped Tree Species"
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</div>
|
88
|
+
)
|
89
|
+
|
90
|
+
export default TreemapChartDrillable
|
@@ -0,0 +1 @@
|
|
1
|
+
Adding the `drillable` prop allows the tree to be traversed up and down by clicking into each box. Relationships are established through the `chartData`, detailed in the <a href="#treemap-grouped-data">Grouped Data section above</a>.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: 'Meat',
|
4
|
+
id: 'Meat',
|
5
|
+
color: "#0056CF",
|
6
|
+
}, {
|
7
|
+
name: 'Pepperoni',
|
8
|
+
parent: 'Meat',
|
9
|
+
value: 250,
|
10
|
+
}, {
|
11
|
+
name: 'Meatball',
|
12
|
+
parent: 'Meat',
|
13
|
+
value: 400,
|
14
|
+
}, {
|
15
|
+
name: "Anchovy",
|
16
|
+
parent: 'Meat',
|
17
|
+
value: 40,
|
18
|
+
}, {
|
19
|
+
name: 'Vegetarian',
|
20
|
+
id: 'Vegetarian',
|
21
|
+
color: "#F9BB00",
|
22
|
+
}, {
|
23
|
+
name: 'Onions',
|
24
|
+
parent: 'Vegetarian',
|
25
|
+
value: 300,
|
26
|
+
}, {
|
27
|
+
name: 'Pineapple',
|
28
|
+
parent: 'Vegetarian',
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Peppers",
|
32
|
+
parent: 'Vegetarian',
|
33
|
+
value: 80,
|
34
|
+
}, {
|
35
|
+
name: "Specialty",
|
36
|
+
id: "Specialty",
|
37
|
+
color: "#9E64E9",
|
38
|
+
},{
|
39
|
+
name: "Buffalo Chicken",
|
40
|
+
parent: "Specialty",
|
41
|
+
value: 400,
|
42
|
+
}, {
|
43
|
+
name: "Supreme",
|
44
|
+
parent: "Specialty",
|
45
|
+
value: 150,
|
46
|
+
}
|
47
|
+
] %>
|
48
|
+
|
49
|
+
<%= pb_rails("treemap_chart", props: {
|
50
|
+
chart_data: data,
|
51
|
+
grouped: true,
|
52
|
+
id: "treemap-grouped",
|
53
|
+
title: "Grouped Toppings",
|
54
|
+
}) %>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: 'Meat',
|
8
|
+
id: 'Meat',
|
9
|
+
color: "#0056CF",
|
10
|
+
}, {
|
11
|
+
name: 'Pepperoni',
|
12
|
+
parent: 'Meat',
|
13
|
+
value: 250,
|
14
|
+
}, {
|
15
|
+
name: 'Meatball',
|
16
|
+
parent: 'Meat',
|
17
|
+
value: 400,
|
18
|
+
}, {
|
19
|
+
name: "Anchovy",
|
20
|
+
parent: 'Meat',
|
21
|
+
value: 40,
|
22
|
+
}, {
|
23
|
+
name: 'Vegetarian',
|
24
|
+
id: 'Vegetarian',
|
25
|
+
color: "#F9BB00",
|
26
|
+
}, {
|
27
|
+
name: 'Onions',
|
28
|
+
parent: 'Vegetarian',
|
29
|
+
value: 300,
|
30
|
+
}, {
|
31
|
+
name: 'Pineapple',
|
32
|
+
parent: 'Vegetarian',
|
33
|
+
value: 90,
|
34
|
+
}, {
|
35
|
+
name: "Peppers",
|
36
|
+
parent: 'Vegetarian',
|
37
|
+
value: 80,
|
38
|
+
}, {
|
39
|
+
name: "Specialty",
|
40
|
+
id: "Specialty",
|
41
|
+
color: "#9E64E9",
|
42
|
+
},{
|
43
|
+
name: "Buffalo Chicken",
|
44
|
+
parent: "Specialty",
|
45
|
+
value: 400,
|
46
|
+
}, {
|
47
|
+
name: "Supreme",
|
48
|
+
parent: "Specialty",
|
49
|
+
value: 150,
|
50
|
+
}
|
51
|
+
]
|
52
|
+
|
53
|
+
const TreemapChartGroupedData = (props) => (
|
54
|
+
<div>
|
55
|
+
<TreemapChart
|
56
|
+
chartData={chartData}
|
57
|
+
grouped
|
58
|
+
id="treemap-grouped-data"
|
59
|
+
title="Grouped Toppings"
|
60
|
+
{...props}
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
)
|
64
|
+
|
65
|
+
export default TreemapChartGroupedData
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Data can be grouped into distinct segments by specifying the relationship in the `chartData`. For a point to be a parent, it needs an `id` of type `string` included in its object. Any other data points may then reference that `id` as their `parent` value to establish the tree structure.
|
2
|
+
|
3
|
+
Parents can also be passed a custom color to be applied to all of its child points.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Pepperoni",
|
4
|
+
parent: "Toppings",
|
5
|
+
value: 600,
|
6
|
+
}, {
|
7
|
+
name: "Cheese",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 510,
|
10
|
+
}, {
|
11
|
+
name: "Mushroom",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 330,
|
14
|
+
},{
|
15
|
+
name: "Onions",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 250,
|
18
|
+
}, {
|
19
|
+
name: "Olives",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 204,
|
22
|
+
}, {
|
23
|
+
name: "Pineapple",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 90,
|
26
|
+
}, {
|
27
|
+
name: "Pizza Toppings",
|
28
|
+
id: "Toppings",
|
29
|
+
},
|
30
|
+
] %>
|
31
|
+
|
32
|
+
<%= pb_rails("treemap_chart", props: {
|
33
|
+
chart_data: data,
|
34
|
+
id: "treemap-tooltip",
|
35
|
+
title: "Favored Pizza Toppings",
|
36
|
+
tooltip_html: "<p>Custom tooltip for {point.name} <br/>with value: {point.value}</p>",
|
37
|
+
}) %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Pepperoni",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 600,
|
10
|
+
}, {
|
11
|
+
name: "Cheese",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 510,
|
14
|
+
}, {
|
15
|
+
name: "Mushroom",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 330,
|
18
|
+
},{
|
19
|
+
name: "Onions",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 250,
|
22
|
+
}, {
|
23
|
+
name: "Olives",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 204,
|
26
|
+
}, {
|
27
|
+
name: "Pineapple",
|
28
|
+
parent: "Toppings",
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Pizza Toppings",
|
32
|
+
id: "Toppings",
|
33
|
+
},
|
34
|
+
]
|
35
|
+
|
36
|
+
const TreemapChartTooltip = (props) => (
|
37
|
+
<div>
|
38
|
+
<TreemapChart
|
39
|
+
chartData={chartData}
|
40
|
+
id="treemap-tooltip"
|
41
|
+
title="Favored Pizza Toppings"
|
42
|
+
tooltipHtml={"<p>Custom tooltip for {point.name} <br/>with value: {point.value}</p>"}
|
43
|
+
{...props}
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
)
|
47
|
+
|
48
|
+
export default TreemapChartTooltip
|
@@ -0,0 +1,15 @@
|
|
1
|
+
examples:
|
2
|
+
|
3
|
+
rails:
|
4
|
+
- treemap_chart_default: Default
|
5
|
+
- treemap_chart_grouped_data: Grouped Data
|
6
|
+
- treemap_chart_drillable: Drillable
|
7
|
+
- treemap_chart_colors: Color Overrides
|
8
|
+
- treemap_chart_tooltip: Tooltip Customization
|
9
|
+
|
10
|
+
react:
|
11
|
+
- treemap_chart_default: Default
|
12
|
+
- treemap_chart_grouped_data: Grouped Data
|
13
|
+
- treemap_chart_drillable: Drillable
|
14
|
+
- treemap_chart_colors: Color Overrides
|
15
|
+
- treemap_chart_tooltip: Tooltip Customization
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { default as TreemapChartDefault } from './_treemap_chart_default.jsx'
|
2
|
+
export { default as TreemapChartGroupedData } from './_treemap_chart_grouped_data.jsx'
|
3
|
+
export { default as TreemapChartDrillable } from './_treemap_chart_drillable.jsx'
|
4
|
+
export { default as TreemapChartColors } from './_treemap_chart_colors.jsx'
|
5
|
+
export { default as TreemapChartTooltip } from './_treemap_chart_tooltip.jsx'
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= react_component('TreemapChart', object.chart_options) %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbTreemapChart
|
5
|
+
class TreemapChart < Playbook::KitBase
|
6
|
+
prop :chart_data, type: Playbook::Props::Array,
|
7
|
+
default: []
|
8
|
+
prop :colors, type: Playbook::Props::Array,
|
9
|
+
default: []
|
10
|
+
prop :drillable, type: Playbook::Props::Boolean, default: false
|
11
|
+
prop :grouped, type: Playbook::Props::Boolean, default: false
|
12
|
+
prop :height
|
13
|
+
prop :title, default: ""
|
14
|
+
prop :tooltip_html, default: '<span style="font-weight: bold; color:{point.color};">● </span>
|
15
|
+
{point.name}: ' + '<b>{point.value}
|
16
|
+
</b>'
|
17
|
+
|
18
|
+
def chart_type
|
19
|
+
"treemap"
|
20
|
+
end
|
21
|
+
|
22
|
+
def chart_options
|
23
|
+
{
|
24
|
+
chartData: chart_data,
|
25
|
+
className: classname,
|
26
|
+
colors: colors,
|
27
|
+
dark: dark ? "dark" : "",
|
28
|
+
drillable: drillable,
|
29
|
+
grouped: grouped,
|
30
|
+
height: height,
|
31
|
+
id: id,
|
32
|
+
title: title,
|
33
|
+
tooltipHtml: tooltip_html,
|
34
|
+
type: chart_type,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def classname
|
39
|
+
generate_classname("pb_treemap_chart")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
/* @flow */
|
2
1
|
|
3
2
|
import React from 'react'
|
4
3
|
import classnames from 'classnames'
|
5
4
|
|
6
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
|
-
import { globalProps } from '../utilities/globalProps'
|
6
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
8
7
|
|
9
8
|
import Avatar from '../pb_avatar/_avatar'
|
10
9
|
import Body from '../pb_body/_body'
|
@@ -12,19 +11,19 @@ import Title from '../pb_title/_title'
|
|
12
11
|
|
13
12
|
type UserProps = {
|
14
13
|
align?: "left" | "center" | "right",
|
15
|
-
aria?:
|
16
|
-
avatar?:
|
17
|
-
avatarUrl?:
|
18
|
-
className?:
|
14
|
+
aria?: {[key: string]: string},
|
15
|
+
avatar?: boolean,
|
16
|
+
avatarUrl?: string,
|
17
|
+
className?: string,
|
19
18
|
dark?: boolean,
|
20
|
-
data?:
|
21
|
-
id?:
|
22
|
-
name?:
|
19
|
+
data?: {[key: string]: string},
|
20
|
+
id?: string,
|
21
|
+
name?: string,
|
23
22
|
orientation?: "horiztonal" | "vertical",
|
24
23
|
size?: "sm" | "md" | "lg",
|
25
|
-
territory?:
|
26
|
-
title?:
|
27
|
-
}
|
24
|
+
territory?: string,
|
25
|
+
title?: string,
|
26
|
+
} & GlobalProps
|
28
27
|
|
29
28
|
const User = (props: UserProps) => {
|
30
29
|
const {
|
@@ -43,14 +42,8 @@ const User = (props: UserProps) => {
|
|
43
42
|
title = '',
|
44
43
|
} = props
|
45
44
|
|
46
|
-
const
|
47
|
-
|
48
|
-
md: 'md',
|
49
|
-
sm: 'sm',
|
50
|
-
}
|
51
|
-
|
52
|
-
const ariaProps = buildAriaProps(aria)
|
53
|
-
const dataProps = buildDataProps(data)
|
45
|
+
const dataProps: {[key: string]: string} = buildDataProps(data)
|
46
|
+
const ariaProps: {[key: string]: string} = buildAriaProps(aria)
|
54
47
|
|
55
48
|
const classes = classnames(
|
56
49
|
buildCss('pb_user_kit', align, orientation, size),
|
@@ -58,6 +51,8 @@ const User = (props: UserProps) => {
|
|
58
51
|
className,
|
59
52
|
)
|
60
53
|
|
54
|
+
const avatarPresent = avatar || avatarUrl
|
55
|
+
|
61
56
|
return (
|
62
57
|
<div
|
63
58
|
{...ariaProps}
|
@@ -65,14 +60,14 @@ const User = (props: UserProps) => {
|
|
65
60
|
className={classes}
|
66
61
|
id={id}
|
67
62
|
>
|
68
|
-
|
63
|
+
{ avatarPresent &&
|
69
64
|
<Avatar
|
70
65
|
imageUrl={avatarUrl}
|
71
66
|
name={name}
|
72
|
-
size={
|
67
|
+
size={size}
|
68
|
+
status={null}
|
73
69
|
/>
|
74
|
-
|
75
|
-
|
70
|
+
}
|
76
71
|
<div className="content_wrapper">
|
77
72
|
<Title
|
78
73
|
dark={dark}
|
@@ -82,6 +77,7 @@ const User = (props: UserProps) => {
|
|
82
77
|
<Body
|
83
78
|
color="light"
|
84
79
|
dark={dark}
|
80
|
+
variant={null}
|
85
81
|
>
|
86
82
|
{territory === '' ? title : `${territory} • ${title}`}
|
87
83
|
</Body>
|
@@ -91,6 +91,7 @@ import * as Title from 'pb_title/docs'
|
|
91
91
|
import * as TitleCount from 'pb_title_count/docs'
|
92
92
|
import * as TitleDetail from 'pb_title_detail/docs'
|
93
93
|
import * as Toggle from 'pb_toggle/docs'
|
94
|
+
import * as TreemapChart from 'pb_treemap_chart/docs'
|
94
95
|
import * as Typeahead from 'pb_typeahead/docs'
|
95
96
|
import * as User from 'pb_user/docs'
|
96
97
|
import * as UserBadge from 'pb_user_badge/docs'
|
@@ -185,6 +186,7 @@ WebpackerReact.setup({
|
|
185
186
|
...TitleCount,
|
186
187
|
...TitleDetail,
|
187
188
|
...Toggle,
|
189
|
+
...TreemapChart,
|
188
190
|
...Typeahead,
|
189
191
|
...User,
|
190
192
|
...UserBadge,
|
@@ -13,6 +13,7 @@ import Legend from './pb_legend/_legend'
|
|
13
13
|
import LineGraph from './pb_line_graph/_line_graph'
|
14
14
|
import Passphrase from './pb_passphrase/_passphrase'
|
15
15
|
import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
|
16
|
+
import TreemapChart from './pb_treemap_chart/_treemap_chart'
|
16
17
|
import Typeahead from './pb_typeahead/_typeahead'
|
17
18
|
|
18
19
|
WebpackerReact.registerComponents({
|
@@ -26,6 +27,7 @@ WebpackerReact.registerComponents({
|
|
26
27
|
LineGraph,
|
27
28
|
Passphrase,
|
28
29
|
RichTextEditor,
|
30
|
+
TreemapChart,
|
29
31
|
Typeahead,
|
30
32
|
})
|
31
33
|
|
@@ -7,6 +7,7 @@ import colors from '../tokens/exports/_colors.scss'
|
|
7
7
|
import pie from 'highcharts/modules/variable-pie'
|
8
8
|
import highchartsMore from 'highcharts/highcharts-more'
|
9
9
|
import solidGauge from 'highcharts/modules/solid-gauge'
|
10
|
+
import treemap from 'highcharts/modules/treemap'
|
10
11
|
|
11
12
|
pie(Highcharts)
|
12
13
|
|
@@ -63,6 +64,8 @@ class pbChart {
|
|
63
64
|
this.setupPieChart(options)
|
64
65
|
} else if (this.options.type == 'gauge') {
|
65
66
|
this.setupGauge(options)
|
67
|
+
} else if (this.options.type == 'treemap') {
|
68
|
+
this.setupTreemap(options)
|
66
69
|
} else {
|
67
70
|
this.setupChart(options)
|
68
71
|
}
|
@@ -191,6 +194,37 @@ class pbChart {
|
|
191
194
|
})
|
192
195
|
}
|
193
196
|
|
197
|
+
setupTreemap(options) {
|
198
|
+
treemap(Highcharts)
|
199
|
+
this.setupTheme()
|
200
|
+
options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
|
201
|
+
|
202
|
+
Highcharts.chart(this.defaults.id, {
|
203
|
+
title: {
|
204
|
+
text: this.defaults.title,
|
205
|
+
},
|
206
|
+
chart: {
|
207
|
+
height: this.defaults.height,
|
208
|
+
type: this.defaults.type,
|
209
|
+
},
|
210
|
+
credits: false,
|
211
|
+
series: [{
|
212
|
+
data: this.defaults.chartData,
|
213
|
+
}],
|
214
|
+
plotOptions: {
|
215
|
+
treemap: {
|
216
|
+
allowTraversingTree: this.defaults.drillable,
|
217
|
+
colorByPoint: !this.defaults.grouped,
|
218
|
+
colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
|
219
|
+
},
|
220
|
+
},
|
221
|
+
tooltip: {
|
222
|
+
pointFormat: this.defaults.tooltipHtml,
|
223
|
+
useHTML: true,
|
224
|
+
},
|
225
|
+
})
|
226
|
+
}
|
227
|
+
|
194
228
|
setupChart(options) {
|
195
229
|
this.setupTheme()
|
196
230
|
const configOptions = {
|
@@ -9,6 +9,7 @@ $royal: #0056CF;
|
|
9
9
|
$purple: #9E64E9;
|
10
10
|
$teal: #00C4D7;
|
11
11
|
$red: #FF2229;
|
12
|
+
$red_dark: #ff4a50;
|
12
13
|
$yellow: #F9BB00;
|
13
14
|
$green: #00CA74;
|
14
15
|
$orange: #FD804C;
|
@@ -154,7 +155,7 @@ $data_colors: (
|
|
154
155
|
$success: $green;
|
155
156
|
$warning: $yellow;
|
156
157
|
$error: $red;
|
157
|
-
$error_dark:
|
158
|
+
$error_dark: $red_dark;
|
158
159
|
$error_dark_body: lighten($error_dark, 2%);
|
159
160
|
$info: $teal;
|
160
161
|
$neutral: $slate;
|
@@ -2,12 +2,12 @@ $display_inline: inline;
|
|
2
2
|
$display_block: block;
|
3
3
|
$display_inline_block: inline-block;
|
4
4
|
$display_flex: flex;
|
5
|
-
$
|
5
|
+
$display_none: none;
|
6
6
|
$display_inline_flex: inline-flex;
|
7
7
|
$displays: (
|
8
|
-
|
8
|
+
display_none: $display_none,
|
9
9
|
display_flex: $display_flex,
|
10
10
|
display_inline: $display_inline,
|
11
11
|
display_inline_block: $display_inline_block,
|
12
12
|
display_block: $display_block
|
13
|
-
);
|
13
|
+
);
|