playbook_ui 13.28.0.pre.alpha.PLAY13592980 → 13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -3
  3. data/app/pb_kits/playbook/index.js +2 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +4 -1
  5. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +31 -0
  6. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +16 -0
  7. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -2
  8. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +45 -0
  9. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +16 -0
  10. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +53 -0
  11. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +14 -8
  12. data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +24 -0
  13. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +7 -1
  14. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +9 -1
  15. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +10 -0
  16. data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +53 -0
  17. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +92 -0
  18. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +53 -0
  19. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +159 -0
  20. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +121 -0
  21. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -0
  22. data/app/pb_kits/playbook/pb_draggable/docs/index.js +3 -0
  23. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +65 -0
  24. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +54 -0
  25. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +57 -0
  26. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -2
  27. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +35 -0
  28. data/app/pb_kits/playbook/pb_icon/icon.rb +2 -3
  29. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +4 -1
  30. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +52 -0
  31. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +16 -0
  32. data/app/pb_kits/playbook/pb_table/_table.tsx +5 -0
  33. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +33 -32
  34. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +1 -1
  35. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.html.erb +33 -0
  36. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.md +2 -0
  37. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +33 -33
  38. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +1 -1
  39. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.html.erb +34 -0
  40. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.md +2 -0
  41. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +51 -50
  42. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +1 -1
  43. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.html.erb +54 -0
  44. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.md +2 -0
  45. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +37 -38
  46. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.md +1 -0
  47. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.html.erb +53 -0
  48. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.md +1 -0
  49. data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_row.html.erb → _table_outer_padding.html.erb} +7 -7
  50. data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.jsx +76 -0
  51. data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.md +1 -0
  52. data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -9
  53. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  54. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
  55. data/app/pb_kits/playbook/pb_table/styles/_outer_padding.scss +21 -0
  56. data/app/pb_kits/playbook/pb_table/table.rb +14 -1
  57. data/app/pb_kits/playbook/pb_table/table.test.js +5 -1
  58. data/app/pb_kits/playbook/pb_table/table_header.html.erb +0 -2
  59. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +61 -0
  60. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  61. data/app/pb_kits/playbook/tokens/_vertical_align.scss +18 -0
  62. data/app/pb_kits/playbook/utilities/_vertical_align.scss +16 -0
  63. data/app/pb_kits/playbook/utilities/globalProps.ts +12 -1
  64. data/dist/menu.yml +5 -2
  65. data/dist/playbook-rails.js +6 -6
  66. data/lib/playbook/classnames.rb +1 -0
  67. data/lib/playbook/kit_base.rb +2 -0
  68. data/lib/playbook/version.rb +1 -1
  69. data/lib/playbook/vertical_align.rb +37 -0
  70. metadata +35 -6
  71. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.html.erb +0 -34
  72. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +0 -63
  73. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +0 -52
@@ -0,0 +1,159 @@
1
+ import React, { useState } from "react";
2
+ import {
3
+ Flex,
4
+ Caption,
5
+ Card,
6
+ FlexItem,
7
+ Badge,
8
+ Avatar,
9
+ Title,
10
+ Body,
11
+ Draggable,
12
+ DraggableProvider,
13
+ } from "../../";
14
+
15
+ // Initial groups to drag between
16
+ const containers = ["To Do", "In Progress", "Done"];
17
+
18
+ // Initial items to be dragged
19
+ const data = [
20
+ {
21
+ id: "1",
22
+ container: "To Do",
23
+ title: "Task 1",
24
+ description: "Bug fixes",
25
+ assignee_name: "Terry Miles",
26
+ assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
27
+ },
28
+ {
29
+ id: "2",
30
+ container: "To Do",
31
+ title: "Task 2",
32
+ description: "Documentation",
33
+ assignee_name: "Sophia Miles",
34
+ assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
35
+ },
36
+ {
37
+ id: "3",
38
+ container: "In Progress",
39
+ title: "Task 3",
40
+ description: "Add a variant",
41
+ assignee_name: "Alice Jones",
42
+ assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
43
+ },
44
+ {
45
+ id: "4",
46
+ container: "To Do",
47
+ title: "Task 4",
48
+ description: "Add jest tests",
49
+ assignee_name: "Mike James",
50
+ assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
51
+ },
52
+ {
53
+ id: "5",
54
+ container: "Done",
55
+ title: "Task 5",
56
+ description: "Alpha testing",
57
+ assignee_name: "James Guy",
58
+ assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
59
+ },
60
+ {
61
+ id: "6",
62
+ container: "In Progress",
63
+ title: "Task 6",
64
+ description: "Release",
65
+ assignee_name: "Sally Jones",
66
+ assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
67
+ },
68
+ ];
69
+
70
+ const DraggableMultipleContainer = (props) => {
71
+ const [initialState, setInitialState] = useState(data);
72
+
73
+ const badgeProperties = (container) => {
74
+ switch (container) {
75
+ case "To Do":
76
+ return { text: "queue", color: "warning" };
77
+ case "In Progress":
78
+ return { text: "progress", color: "primary" };
79
+ default:
80
+ return { text: "done", color: "success" };
81
+ }
82
+ };
83
+
84
+ return (
85
+ <DraggableProvider initialItems={data}
86
+ onChange={(items) => setInitialState(items)}
87
+ >
88
+ <Draggable
89
+ display="flex"
90
+ justifyContent="center"
91
+ {...props}
92
+ >
93
+ {containers?.map((container) => (
94
+ <Draggable.Container
95
+ container={container}
96
+ key={container}
97
+ padding="sm"
98
+ >
99
+ <Caption textAlign="center">{container}</Caption>
100
+ <Flex
101
+ alignItems="stretch"
102
+ orientation="column"
103
+ >
104
+ {initialState
105
+ .filter((item) => item.container === container)
106
+ .map(
107
+ ({
108
+ assignee_img,
109
+ assignee_name,
110
+ description,
111
+ id,
112
+ title,
113
+ }) => (
114
+ <Draggable.Item
115
+ container={container}
116
+ id={id}
117
+ key={id}
118
+ >
119
+ <Card
120
+ marginBottom="sm"
121
+ padding="sm"
122
+ >
123
+ <Flex justify="between">
124
+ <FlexItem>
125
+ <Flex>
126
+ <Avatar
127
+ imageUrl={assignee_img}
128
+ name={assignee_name}
129
+ size="xxs"
130
+ />
131
+ <Title paddingLeft="xs"
132
+ size={4}
133
+ text={title}
134
+ />
135
+ </Flex>
136
+ </FlexItem>
137
+ <Badge
138
+ marginLeft="sm"
139
+ rounded
140
+ text={badgeProperties(container).text}
141
+ variant={badgeProperties(container).color}
142
+ />
143
+ </Flex>
144
+ <Body paddingTop="xs"
145
+ text={description}
146
+ />
147
+ </Card>
148
+ </Draggable.Item>
149
+ )
150
+ )}
151
+ </Flex>
152
+ </Draggable.Container>
153
+ ))}
154
+ </Draggable>
155
+ </DraggableProvider>
156
+ );
157
+ };
158
+
159
+ export default DraggableMultipleContainer;
@@ -0,0 +1,121 @@
1
+ import React, { useState } from "react";
2
+ import {
3
+ Flex,
4
+ Badge,
5
+ Title,
6
+ Icon,
7
+ Draggable,
8
+ DraggableProvider,
9
+ Card,
10
+ Caption,
11
+ } from "../../";
12
+
13
+ // Initial items to be dragged
14
+ const data = [
15
+ {
16
+ id: "1",
17
+ text: "Joe Black",
18
+ },
19
+ {
20
+ id: "2",
21
+ text: "Nancy White",
22
+ },
23
+ {
24
+ id: "3",
25
+ text: "Bill Green",
26
+ },
27
+ ];
28
+
29
+ const DraggableWithCards = (props) => {
30
+ const [initialState, setInitialState] = useState(data);
31
+
32
+ return (
33
+ <DraggableProvider
34
+ initialItems={data}
35
+ onChange={(items) => setInitialState(items)}
36
+ >
37
+ <Draggable {...props}>
38
+ <Draggable.Container>
39
+ {initialState.map(({ id, text }) => (
40
+ <Draggable.Item id={id}
41
+ key={id}
42
+ >
43
+ <Card
44
+ highlight={{ position: "side", color: "primary" }}
45
+ marginBottom="xs"
46
+ >
47
+ <Flex alignItems="stretch"
48
+ flexDirection="column"
49
+ >
50
+ <Flex gap="xs">
51
+ <Title size={4}
52
+ text={text}
53
+ />
54
+ <Badge
55
+ text="35-12345"
56
+ variant="primary"
57
+ />
58
+ </Flex>
59
+
60
+ <Flex
61
+ gap="sm"
62
+ spacing="between"
63
+ >
64
+ <Caption
65
+ size="xs"
66
+ text="8:00A"
67
+ />
68
+ <Flex gap="xxs">
69
+ <Caption
70
+ size="xs"
71
+ text="Township Name"
72
+ />
73
+ <Caption size="xs"
74
+ text="•"
75
+ />
76
+ <Caption size="xs"
77
+ text="90210"
78
+ />
79
+ </Flex>
80
+ </Flex>
81
+
82
+ <Flex gap="xxs"
83
+ spacing="between"
84
+ >
85
+ <Flex gap="xxs">
86
+ <Caption color="error"
87
+ size="xs"
88
+ >
89
+ <Icon icon="house-circle-exclamation" />
90
+ </Caption>
91
+ <Caption color="success"
92
+ size="xs">
93
+ <Icon icon="file-circle-check" />
94
+ </Caption>
95
+ </Flex>
96
+ <Flex>
97
+ <Badge rounded
98
+ text="Schedule QA"
99
+ variant="warning"
100
+ />
101
+ <Badge rounded
102
+ text="Flex"
103
+ variant="primary"
104
+ />
105
+ <Badge rounded
106
+ text="R99"
107
+ variant="primary"
108
+ />
109
+ </Flex>
110
+ </Flex>
111
+ </Flex>
112
+ </Card>
113
+ </Draggable.Item>
114
+ ))}
115
+ </Draggable.Container>
116
+ </Draggable>
117
+ </DraggableProvider>
118
+ );
119
+ };
120
+
121
+ export default DraggableWithCards;
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+
4
+ react:
5
+ - draggable_default: Default
6
+ - draggable_with_cards: Draggable with Cards
7
+ - draggable_multiple_containers: Dragging Across Multiple Containers
8
+
9
+
@@ -0,0 +1,3 @@
1
+ export { default as DraggableDefault } from './_draggable_default.jsx'
2
+ export { default as DraggableWithCards } from './_draggable_with_cards.jsx'
3
+ export { default as DraggableMultipleContainers } from './_draggable_multiple_containers.jsx'
@@ -0,0 +1,65 @@
1
+ import React, {useState} from "react"
2
+ import { render, screen } from "../utilities/test-utils"
3
+
4
+ import { Draggable, DraggableProvider, SelectableList } from '../'
5
+
6
+ const testId = 'draggable'
7
+
8
+ const data = [
9
+ {
10
+ id: "1",
11
+ text: "Task 1",
12
+ },
13
+ {
14
+ id: "2",
15
+ text: "Task 2",
16
+ },
17
+ {
18
+ id: "3",
19
+ text: "Task 3",
20
+ },
21
+ {
22
+ id: "4",
23
+ text: "Task 4",
24
+ },
25
+ ];
26
+
27
+
28
+ const DefaultDraggableKit = () => {
29
+ const [initialState, setInitialState] = useState(data);
30
+
31
+ return (
32
+ <DraggableProvider
33
+ initialItems={data}
34
+ onChange={(items) => setInitialState(items)}
35
+ >
36
+ <Draggable
37
+ data={{ testid: testId }}
38
+ draggableItems={data}
39
+ onDragChange={(items) => setInitialItems(items)}
40
+ >
41
+ <Draggable.Container>
42
+ <SelectableList variant="checkbox">
43
+ {initialState.map(({ id, text }) => (
44
+ <Draggable.Item id={id}
45
+ key={id}
46
+ >
47
+ <SelectableList.Item label={text}
48
+ name={id}
49
+ value={id}
50
+ />
51
+ </Draggable.Item>
52
+ ))}
53
+ </SelectableList>
54
+ </Draggable.Container>
55
+ </Draggable>
56
+ </DraggableProvider>
57
+ );
58
+ };
59
+
60
+ test('generated default kit and classname', () => {
61
+ render(<DefaultDraggableKit/>)
62
+ const kit = screen.getByTestId(testId)
63
+ expect(kit).toBeInTheDocument()
64
+ expect(kit).toHaveClass('pb_draggable')
65
+ })
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import classnames from "classnames";
3
+ import {
4
+ buildAriaProps,
5
+ buildCss,
6
+ buildDataProps,
7
+ buildHtmlProps
8
+ } from "../../utilities/props";
9
+ import { globalProps } from "../../utilities/globalProps";
10
+ import { DraggableContext } from "../context";
11
+
12
+ type DraggableContainerProps = {
13
+ aria?: { [key: string]: string };
14
+ children?: React.ReactNode;
15
+ className?: string;
16
+ container?: any;
17
+ data?: { [key: string]: string };
18
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
+ id?: string;
20
+ };
21
+
22
+ const DraggableContainer = (props: DraggableContainerProps) => {
23
+ const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id } = props;
24
+
25
+ const { handleDragOver, handleDrop, activeContainer } = DraggableContext();
26
+
27
+ const ariaProps = buildAriaProps(aria);
28
+ const dataProps = buildDataProps(data);
29
+ const htmlProps = buildHtmlProps(htmlOptions);
30
+
31
+ const classes = classnames(
32
+ buildCss("pb_draggable_container"),
33
+ `${activeContainer === container ? "active" : ""}`,
34
+ globalProps(props),
35
+ className
36
+ );
37
+
38
+ return (
39
+ <div
40
+ {...ariaProps}
41
+ {...dataProps}
42
+ {...htmlProps}
43
+ className={classes}
44
+ id={id}
45
+ key={container}
46
+ onDragOver={(e) => handleDragOver(e, container)}
47
+ onDrop={() => handleDrop(container)}
48
+ >
49
+ {children}
50
+ </div>
51
+ );
52
+ };
53
+
54
+ export default DraggableContainer;
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import classnames from "classnames";
3
+ import {
4
+ buildAriaProps,
5
+ buildCss,
6
+ buildDataProps,
7
+ buildHtmlProps
8
+ } from "../../utilities/props";
9
+ import { globalProps } from "../../utilities/globalProps";
10
+ import { DraggableContext } from "../context";
11
+
12
+ type DraggableItemProps = {
13
+ aria?: { [key: string]: string };
14
+ children?: React.ReactNode;
15
+ className?: string;
16
+ container?: any;
17
+ data?: { [key: string]: string };
18
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
+ id?: string;
20
+ };
21
+
22
+ const DraggableItem = (props: DraggableItemProps) => {
23
+ const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id } = props;
24
+
25
+ const { isDragging, handleDragStart, handleDragEnter, handleDragEnd } =
26
+ DraggableContext();
27
+
28
+ const ariaProps = buildAriaProps(aria);
29
+ const dataProps = buildDataProps(data);
30
+ const htmlProps = buildHtmlProps(htmlOptions);
31
+
32
+ const classes = classnames(
33
+ buildCss("pb_draggable_item"),
34
+ `${isDragging === id ? "is_dragging" : ""}`,
35
+ globalProps(props),
36
+ className
37
+ );
38
+
39
+ return (
40
+ <div
41
+ {...ariaProps}
42
+ {...dataProps}
43
+ {...htmlProps}
44
+ className={classes}
45
+ draggable
46
+ id={id}
47
+ key={id}
48
+ onDragEnd={() => handleDragEnd()}
49
+ onDragEnter={() => handleDragEnter(id, container)}
50
+ onDragStart={() => handleDragStart(id, container)}
51
+ >
52
+ {children}
53
+ </div>
54
+ );
55
+ };
56
+
57
+ export default DraggableItem;
@@ -107,7 +107,7 @@
107
107
  }
108
108
 
109
109
  & > [class^=pb_date_picker_kit]:not(:last-child) {
110
- .text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .flatpickr-wrapper {
110
+ .input_wrapper input, [class^=pb_text_input_kit] .date_picker_input_wrapper .flatpickr-wrapper {
111
111
  border-bottom-right-radius: 0;
112
112
  border-top-right-radius: 0;
113
113
  border-right-width: 0;
@@ -115,7 +115,7 @@
115
115
  }
116
116
 
117
117
  & > [class^=pb_date_picker_kit]:not(:first-child) {
118
- .text_input_wrapper input, [class^=pb_text_input_kit] .text_input_wrapper .flatpickr-wrapper {
118
+ .input_wrapper input, [class^=pb_text_input_kit] .date_picker_input_wrapper .flatpickr-wrapper {
119
119
  border-bottom-left-radius: 0;
120
120
  border-top-left-radius: 0;
121
121
  }
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { render, screen } from '../utilities/test-utils';
3
+ import Gauge from './_gauge';
4
+
5
+ beforeEach(() => {
6
+ // Silences error logs within the test suite.
7
+ jest.spyOn(console, 'error');
8
+ jest.spyOn(console, 'warn');
9
+ console.error.mockImplementation(() => {});
10
+ console.warn.mockImplementation(() => {});
11
+ });
12
+
13
+ afterEach(() => {
14
+ console.error.mockRestore();
15
+ console.warn.mockRestore();
16
+ });
17
+
18
+ const testId = 'gauge1';
19
+
20
+ test('uses exact classname', () => {
21
+ const data = [
22
+ { name: 'Name', value: 45 },
23
+ ]
24
+ render(
25
+ <Gauge
26
+ chartData={data}
27
+ data={{ testid: testId }}
28
+ id='gaugeid'
29
+ />
30
+ );
31
+
32
+ const kit = screen.getByTestId(testId);
33
+ expect(kit).toHaveClass('pb_gauge_kit');
34
+ });
35
+
@@ -81,10 +81,9 @@ module Playbook
81
81
 
82
82
  def asset_path
83
83
  return unless Rails.application.config.respond_to?(:icon_path)
84
+ return unless Dir.entries(Rails.application.config.icon_path).include? "#{icon}.svg"
84
85
 
85
- base_path = Rails.application.config.icon_path
86
- icon_path = Dir.glob(Rails.root.join(base_path, "**", "#{icon}.svg")).first
87
- icon_path if icon_path && File.exist?(icon_path)
86
+ Rails.root.join(Rails.application.config.icon_path, "#{icon}.svg")
88
87
  end
89
88
 
90
89
  def render_svg
@@ -130,6 +130,9 @@ const LineGraph = ({
130
130
  staticOptions.plotOptions.series.events = { legendItemClick: () => false };
131
131
  }
132
132
 
133
+ const filteredProps: any = {...props};
134
+ delete filteredProps.verticalAlign;
135
+
133
136
  const [options, setOptions] = useState({});
134
137
 
135
138
  useEffect(() => {
@@ -139,7 +142,7 @@ const LineGraph = ({
139
142
  return (
140
143
  <HighchartsReact
141
144
  containerProps={{
142
- className: classnames(globalProps(props), className),
145
+ className: classnames(globalProps(filteredProps), className),
143
146
  id: id,
144
147
  ...ariaProps,
145
148
  ...dataProps,
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { render, screen } from '../utilities/test-utils';
3
+ import LineGraph from './_line_graph';
4
+
5
+ beforeEach(() => {
6
+ // Silences error logs within the test suite.
7
+ jest.spyOn(console, 'error');
8
+ jest.spyOn(console, 'warn');
9
+ console.error.mockImplementation(() => {});
10
+ console.warn.mockImplementation(() => {});
11
+ });
12
+
13
+ afterEach(() => {
14
+ console.error.mockRestore();
15
+ console.warn.mockRestore();
16
+ });
17
+
18
+ const testId = 'linechart1';
19
+
20
+ test('uses exact classname', () => {
21
+ const data = [{
22
+ name: 'Installation',
23
+ data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],
24
+ }, {
25
+ name: 'Manufacturing',
26
+ data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434],
27
+ }, {
28
+ name: 'Sales & Distribution',
29
+ data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387],
30
+ }, {
31
+ name: 'Project Development',
32
+ data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227],
33
+ }, {
34
+ name: 'Other',
35
+ data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111],
36
+ }]
37
+ render(
38
+ <LineGraph
39
+ axisTitle="Number of Employees"
40
+ chartData={data}
41
+ data={{ testid: testId }}
42
+ id="line-default"
43
+ subTitle="Source: thesolarfoundation.com"
44
+ title="Solar Employment Growth by Sector, 2010-2016"
45
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
46
+ yAxisMin={0}
47
+ />
48
+ );
49
+
50
+ const kit = screen.getByTestId(testId);
51
+ expect(kit).toHaveClass('pb_bar_graph');
52
+ });
@@ -64,6 +64,22 @@ module Playbook
64
64
  }
65
65
  end
66
66
 
67
+ def vertical_align_props
68
+ if vertical_align
69
+ if object.vertical_align
70
+ original_result = super
71
+ class_to_remove = "vertical_align_#{object.vertical_align}"
72
+
73
+ modified_result = original_result.gsub(class_to_remove, "").strip
74
+ modified_result.empty? ? nil : modified_result
75
+ else
76
+ super
77
+ end
78
+ else
79
+ super
80
+ end
81
+ end
82
+
67
83
  def classname
68
84
  generate_classname("pb_line_graph")
69
85
  end
@@ -23,6 +23,7 @@ type TableProps = {
23
23
  disableHover?: boolean,
24
24
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
25
25
  id?: string,
26
+ outerPadding?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
26
27
  responsive?: "collapse" | "scroll" | "none",
27
28
  singleLine?: boolean,
28
29
  size?: "sm" | "md" | "lg",
@@ -45,6 +46,7 @@ const Table = (props: TableProps) => {
45
46
  disableHover = false,
46
47
  htmlOptions = {},
47
48
  id,
49
+ outerPadding = '',
48
50
  responsive = 'collapse',
49
51
  singleLine = false,
50
52
  size = 'sm',
@@ -59,6 +61,8 @@ const Table = (props: TableProps) => {
59
61
  const htmlProps = buildHtmlProps(htmlOptions)
60
62
  const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''
61
63
  const verticalBorderCss = verticalBorder ? 'vertical-border' : ''
64
+ const spaceCssName = outerPadding !== 'none' ? 'space_' : ''
65
+ const outerPaddingCss = outerPadding ? `outer_padding_${spaceCssName}${outerPadding}` : ''
62
66
  const isTableTag = tag === 'table'
63
67
 
64
68
  const classNames = classnames(
@@ -73,6 +77,7 @@ const Table = (props: TableProps) => {
73
77
  'no-hover': disableHover,
74
78
  'sticky-header': sticky,
75
79
  'striped': striped,
80
+ [outerPaddingCss]: outerPadding !== '',
76
81
  },
77
82
  globalProps(props),
78
83
  tableCollapseCss,