playbook_ui 10.26.0.pre.alpha.sticky1 → 10.26.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/data/menu.yml +1 -0
  3. data/app/pb_kits/playbook/index.js +2 -1
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_badge/{_badge.jsx → _badge.tsx} +14 -15
  6. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +1 -1
  8. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -3
  10. data/app/pb_kits/playbook/pb_body/_body.tsx +8 -8
  11. data/app/pb_kits/playbook/pb_button/{_button.jsx → _button.tsx} +65 -46
  12. data/app/pb_kits/playbook/pb_button/docs/_button_options.jsx +1 -1
  13. data/app/pb_kits/playbook/pb_caption/{_caption.jsx → _caption.tsx} +7 -8
  14. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -0
  15. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +4 -2
  16. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
  17. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +37 -0
  18. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +37 -0
  19. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  20. data/app/pb_kits/playbook/pb_icon/{_icon.jsx → _icon.tsx} +40 -30
  21. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
  22. data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +6 -8
  23. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +1 -1
  24. data/app/pb_kits/playbook/pb_pill/docs/_pill_variants.jsx +1 -1
  25. data/app/pb_kits/playbook/pb_title/{_title.jsx → _title.tsx} +10 -12
  26. data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
  27. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
  28. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
  29. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
  30. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
  31. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
  32. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
  33. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
  34. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
  35. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
  36. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
  37. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
  38. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
  39. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
  40. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
  41. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
  42. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
  43. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
  44. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
  45. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
  46. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
  47. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +43 -0
  48. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  49. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
  50. data/app/pb_kits/playbook/plugins/pb_chart.js +34 -0
  51. data/app/pb_kits/playbook/tokens/_display.scss +13 -0
  52. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +36 -0
  53. data/app/pb_kits/playbook/utilities/_display.scss +26 -2
  54. data/app/pb_kits/playbook/utilities/globalProps.ts +31 -16
  55. data/lib/playbook/display.rb +21 -7
  56. data/lib/playbook/version.rb +2 -2
  57. metadata +30 -8
@@ -1,21 +1,19 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
 
5
3
  import classnames from 'classnames'
6
- import Title from '../pb_title/_title.jsx'
4
+ import Title from '../pb_title/_title'
7
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
6
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
9
7
 
10
8
  type PillProps = {
11
- aria?: object,
9
+ aria?: {[key: string]: string},
12
10
  className?: string,
13
- data?: object,
11
+ data?: {[key: string]: string},
14
12
  id?: string,
15
13
  text: string,
16
14
  variant?: "success" | "warning" | "error" | "info" | "neutral",
17
15
  textTransform?: "none" | "lowercase"
18
- }
16
+ } & GlobalProps
19
17
 
20
18
  const Pill = (props: PillProps) => {
21
19
  const {
@@ -49,4 +47,4 @@ const Pill = (props: PillProps) => {
49
47
  )
50
48
  }
51
49
 
52
- export default Pill
50
+ export default Pill
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Pill from '../_pill.jsx'
2
+ import Pill from '../_pill'
3
3
 
4
4
  const PillDefault = (props) => {
5
5
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Pill from '../_pill.jsx'
2
+ import Pill from '../_pill'
3
3
 
4
4
  const PillVariants = (props) => {
5
5
  return (
@@ -1,24 +1,22 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { deprecatedProps, globalProps } from '../utilities/globalProps'
4
+ import { deprecatedProps, GlobalProps, globalProps } from '../utilities/globalProps'
7
5
 
8
6
  type TitleProps = {
9
- aria?: object,
10
- children?: array<React.ReactNode> | React.ReactNode,
7
+ aria?: {[key: string]: string},
8
+ children?: React.ReactChild[],
11
9
  className?: string,
12
10
  color?: "default" | "light" | "lighter" | "success" | "error" | "link",
13
- data?: object,
11
+ data?: {[key: string]: string},
14
12
  id?: string,
15
13
  size?: 1 | 2 | 3 | 4,
16
14
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
17
15
  text?: string,
18
16
  variant?: null | "link",
19
- }
17
+ } & GlobalProps
20
18
 
21
- const Title = (props: TitleProps) => {
19
+ const Title = (props: TitleProps): React.ReactElement => {
22
20
  if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
23
21
  const {
24
22
  aria = {},
@@ -33,14 +31,14 @@ const Title = (props: TitleProps) => {
33
31
  variant = null,
34
32
  } = props
35
33
 
36
- const ariaProps = buildAriaProps(aria)
37
- const dataProps = buildDataProps(data)
34
+ const ariaProps: {[key: string]: string | number} = buildAriaProps(aria)
35
+ const dataProps: {[key: string]: string | number} = buildDataProps(data)
38
36
  const classes = classnames(
39
- buildCss('pb_title_kit', size, variant, color),
37
+ buildCss('pb_title_kit', `size_${size}`, variant, color),
40
38
  globalProps(props),
41
39
  className,
42
40
  )
43
- const Tag = `${tag}`
41
+ const Tag: React.ReactElement | any = `${tag}`
44
42
 
45
43
  return (
46
44
  <Tag
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
12
12
  )
13
13
 
14
14
  const kit = screen.getByTestId('primary-test')
15
- expect(kit).toHaveClass('pb_title_kit_3')
15
+ expect(kit).toHaveClass('pb_title_kit_size_3')
16
16
  })
17
17
 
18
18
  test('with colors', () => {
@@ -25,5 +25,5 @@ test('with colors', () => {
25
25
  )
26
26
 
27
27
  const kit = screen.getByTestId('primary-test')
28
- expect(kit).toHaveClass('pb_title_kit_3_success')
28
+ expect(kit).toHaveClass('pb_title_kit_size_3_success')
29
29
  })
@@ -0,0 +1,79 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+
6
+ import { globalProps } from '../utilities/globalProps'
7
+ import pbChart from '../plugins/pb_chart'
8
+
9
+ type TreemapChartProps = {
10
+ chartData: array<{
11
+ name: string,
12
+ parent?: string | number,
13
+ value: number,
14
+ color?: string,
15
+ id?: string | number,
16
+ }>,
17
+ className?: string,
18
+ colors: array,
19
+ dark?: boolean,
20
+ drillable: boolean,
21
+ grouped: boolean,
22
+ height?: string,
23
+ id: number,
24
+ title: string,
25
+ tooltipHtml: string,
26
+ type?: string,
27
+ }
28
+
29
+ export default class TreemapChart extends React.Component<TreemapChartProps> {
30
+ static defaultProps = {
31
+ className: 'pb_treemap_chart',
32
+ dark: false,
33
+ drillable: false,
34
+ grouped: false,
35
+ type: 'treemap',
36
+ }
37
+
38
+ componentDidMount() {
39
+ const {
40
+ chartData,
41
+ className,
42
+ colors = [],
43
+ dark,
44
+ drillable,
45
+ grouped,
46
+ height,
47
+ id,
48
+ title = "",
49
+ tooltipHtml = '<span style="font-weight: bold; color:{point.color};">&#9679; </span>{point.name}: <b>{point.value}</b>',
50
+ type,
51
+ } = this.props
52
+
53
+ new pbChart(`.${className}`, {
54
+ chartData: chartData,
55
+ colors: colors,
56
+ dark,
57
+ drillable,
58
+ grouped,
59
+ height: height,
60
+ id: id,
61
+ title: title,
62
+ tooltipHtml,
63
+ type,
64
+ })
65
+ }
66
+
67
+ props: TreemapChartProps
68
+
69
+ render() {
70
+ const { className, id } = this.props
71
+
72
+ return (
73
+ <div
74
+ className={classnames(globalProps(this.props), className)}
75
+ id={id}
76
+ />
77
+ )
78
+ }
79
+ }
@@ -0,0 +1,5 @@
1
+ Treemap charts are used to compare the relative size of groups of data. They can also use a nested data structure, allowing a user to drill down into a group to see its constituent data points.
2
+
3
+ The default height of treemap is 400px and can be changed. The default height is in pixel units, but can also use percentage string (percentage would be that of the width. For example, `height:"50%"` would mean that the height is 50% of the width). This allows for preserving the aspect ratio across responsive sizes.
4
+
5
+ For more information, see: <a href="https://api.highcharts.com/highcharts/chart.height" target="_blank"> highcharts/chart.height</a>.
@@ -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
+ colors: ["data-4", "data-7", "#8E6E53", "#124732"],
35
+ id: "treemap-colors",
36
+ title: "Favored Pizza Toppings",
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 TreemapChartColors = (props) => (
37
+ <div>
38
+ <TreemapChart
39
+ chartData={chartData}
40
+ colors={["data-4", "data-7", "#8E6E53", "#124732"]}
41
+ id="treemap-colors"
42
+ title="Favored Pizza Toppings"
43
+ {...props}
44
+ />
45
+ </div>
46
+ )
47
+
48
+ export default TreemapChartColors
@@ -0,0 +1,2 @@
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`
@@ -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
+
33
+ <%= pb_rails("treemap_chart", props: {
34
+ chart_data: data,
35
+ id: "treemap-default",
36
+ title: "Favored Pizza Toppings",
37
+ }) %>
@@ -0,0 +1,47 @@
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 TreemapChartDefault = (props) => (
37
+ <div>
38
+ <TreemapChart
39
+ chartData={chartData}
40
+ id="treemap-default"
41
+ title="Favored Pizza Toppings"
42
+ {...props}
43
+ />
44
+ </div>
45
+ )
46
+
47
+ export default TreemapChartDefault
@@ -0,0 +1,3 @@
1
+ Points are automatically arranged by their `value` size.
2
+
3
+ By default, point colors are assigned sequentially from the global `data` colors. Note that data points without a value (such as parent nodes) will still take on the next available color.
@@ -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.