playbook_ui 10.26.0.pre.alpha.display1 → 10.26.0
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/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_card/{_card.jsx → _card.tsx} +24 -24
- 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 +1 -1
- 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_flex/{_flex.jsx → _flex.tsx} +5 -5
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +1 -1
- 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_kit/dateTime.js +2 -1
- data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +5 -7
- 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/_table.jsx +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +83 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +94 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +10 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +23 -0
- data/app/pb_kits/playbook/pb_table/table.rb +7 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_user/{_user.jsx → _user.tsx} +20 -24
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
- data/app/pb_kits/playbook/tokens/_display.scss +1 -1
- 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 +2 -36
- 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 +125 -111
- 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 +1 -60
- 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 +1 -3
- 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 +32 -14
- data/app/pb_kits/playbook/utilities/text.js +0 -15
@@ -1,16 +1,14 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
7
5
|
|
8
6
|
type IconProps = {
|
9
|
-
aria?:
|
10
|
-
border?:
|
7
|
+
aria?: {[key: string]: string},
|
8
|
+
border?: string,
|
11
9
|
className?: string,
|
12
|
-
customIcon?: SVGElement,
|
13
|
-
data?:
|
10
|
+
customIcon?: {[key: string] :SVGElement},
|
11
|
+
data?: {[key: string]: string},
|
14
12
|
fixedWidth?: boolean,
|
15
13
|
flip?: "horizontal" | "vertical" | "both" | "none",
|
16
14
|
icon: string,
|
@@ -34,12 +32,13 @@ type IconProps = {
|
|
34
32
|
| "9x"
|
35
33
|
| "10x",
|
36
34
|
spin?: boolean,
|
37
|
-
}
|
35
|
+
} & GlobalProps
|
38
36
|
|
39
37
|
const flipMap = {
|
40
38
|
horizontal: 'fa-flip-horizontal',
|
41
39
|
vertical: 'fa-flip-vertical',
|
42
40
|
both: 'fa-flip-horizontal fa-flip-vertical',
|
41
|
+
none: ""
|
43
42
|
}
|
44
43
|
|
45
44
|
const Icon = (props: IconProps) => {
|
@@ -50,7 +49,7 @@ const Icon = (props: IconProps) => {
|
|
50
49
|
customIcon,
|
51
50
|
data = {},
|
52
51
|
fixedWidth = true,
|
53
|
-
flip =
|
52
|
+
flip = "none",
|
54
53
|
icon,
|
55
54
|
id,
|
56
55
|
inverse = false,
|
@@ -90,31 +89,42 @@ const Icon = (props: IconProps) => {
|
|
90
89
|
)
|
91
90
|
|
92
91
|
aria.label ? null : aria.label = `${icon} icon`
|
93
|
-
const ariaProps = buildAriaProps(aria)
|
94
|
-
const dataProps = buildDataProps(data)
|
92
|
+
const ariaProps: {[key: string]: any} = buildAriaProps(aria)
|
93
|
+
const dataProps: {[key: string]: any} = buildDataProps(data)
|
95
94
|
|
96
95
|
// Add a conditional here to show only the SVG if custom
|
96
|
+
const displaySVG = (customIcon: any) => {
|
97
|
+
if (customIcon)
|
98
|
+
return (
|
99
|
+
<>
|
100
|
+
{
|
101
|
+
React.cloneElement(customIcon, {
|
102
|
+
...dataProps,
|
103
|
+
className: classes,
|
104
|
+
id,
|
105
|
+
})
|
106
|
+
}
|
107
|
+
</>
|
108
|
+
)
|
109
|
+
else
|
110
|
+
return (
|
111
|
+
<>
|
112
|
+
<i
|
113
|
+
{...dataProps}
|
114
|
+
className={classes}
|
115
|
+
id={id}
|
116
|
+
/>
|
117
|
+
<span
|
118
|
+
{...ariaProps}
|
119
|
+
hidden
|
120
|
+
/>
|
121
|
+
</>
|
122
|
+
)
|
123
|
+
}
|
124
|
+
|
97
125
|
return (
|
98
126
|
<>
|
99
|
-
|
100
|
-
{
|
101
|
-
React.cloneElement(customIcon, {
|
102
|
-
...dataProps,
|
103
|
-
className: classes,
|
104
|
-
id,
|
105
|
-
})
|
106
|
-
}
|
107
|
-
<Else />
|
108
|
-
<i
|
109
|
-
{...dataProps}
|
110
|
-
className={classes}
|
111
|
-
id={id}
|
112
|
-
/>
|
113
|
-
<span
|
114
|
-
{...ariaProps}
|
115
|
-
hidden
|
116
|
-
/>
|
117
|
-
</If>
|
127
|
+
{displaySVG(customIcon)}
|
118
128
|
</>
|
119
129
|
)
|
120
130
|
}
|
@@ -1,21 +1,19 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
|
5
3
|
import classnames from 'classnames'
|
6
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?:
|
9
|
+
aria?: {[key: string]: string},
|
12
10
|
className?: string,
|
13
|
-
data?:
|
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
|
@@ -20,6 +20,7 @@ type TableProps = {
|
|
20
20
|
responsive: "collapse" | "scroll" | "none",
|
21
21
|
singleLine: boolean,
|
22
22
|
size: "sm" | "md" | "lg",
|
23
|
+
sticky?: boolean,
|
23
24
|
}
|
24
25
|
|
25
26
|
const Table = (props: TableProps) => {
|
@@ -37,6 +38,7 @@ const Table = (props: TableProps) => {
|
|
37
38
|
responsive = 'collapse',
|
38
39
|
singleLine = false,
|
39
40
|
size = 'sm',
|
41
|
+
sticky = false,
|
40
42
|
} = props
|
41
43
|
|
42
44
|
const ariaProps = buildAriaProps(aria)
|
@@ -60,6 +62,7 @@ const Table = (props: TableProps) => {
|
|
60
62
|
'data_table': dataTable,
|
61
63
|
'single-line': singleLine,
|
62
64
|
'no-hover': disableHover,
|
65
|
+
'sticky-header': sticky,
|
63
66
|
},
|
64
67
|
globalProps(props),
|
65
68
|
tableCollapseCss,
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<%= pb_rails("table", props: { sticky: true }) do %>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Column 1</th>
|
5
|
+
<th>Column 2</th>
|
6
|
+
<th>Column 3</th>
|
7
|
+
<th>Column 4</th>
|
8
|
+
<th>Column 5</th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<tr>
|
13
|
+
<td>Value 1</td>
|
14
|
+
<td>Value 2</td>
|
15
|
+
<td>Value 3</td>
|
16
|
+
<td>Value 4</td>
|
17
|
+
<td>Value 5</td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td>Value 1</td>
|
21
|
+
<td>Value 2</td>
|
22
|
+
<td>Value 3</td>
|
23
|
+
<td>Value 4</td>
|
24
|
+
<td>Value 5</td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td>Value 1</td>
|
28
|
+
<td>Value 2</td>
|
29
|
+
<td>Value 3</td>
|
30
|
+
<td>Value 4</td>
|
31
|
+
<td>Value 5</td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td>Value 1</td>
|
35
|
+
<td>Value 2</td>
|
36
|
+
<td>Value 3</td>
|
37
|
+
<td>Value 4</td>
|
38
|
+
<td>Value 5</td>
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td>Value 1</td>
|
42
|
+
<td>Value 2</td>
|
43
|
+
<td>Value 3</td>
|
44
|
+
<td>Value 4</td>
|
45
|
+
<td>Value 5</td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td>Value 1</td>
|
49
|
+
<td>Value 2</td>
|
50
|
+
<td>Value 3</td>
|
51
|
+
<td>Value 4</td>
|
52
|
+
<td>Value 5</td>
|
53
|
+
</tr>
|
54
|
+
<tr>
|
55
|
+
<td>Value 1</td>
|
56
|
+
<td>Value 2</td>
|
57
|
+
<td>Value 3</td>
|
58
|
+
<td>Value 4</td>
|
59
|
+
<td>Value 5</td>
|
60
|
+
</tr>
|
61
|
+
<tr>
|
62
|
+
<td>Value 1</td>
|
63
|
+
<td>Value 2</td>
|
64
|
+
<td>Value 3</td>
|
65
|
+
<td>Value 4</td>
|
66
|
+
<td>Value 5</td>
|
67
|
+
</tr>
|
68
|
+
<tr>
|
69
|
+
<td>Value 1</td>
|
70
|
+
<td>Value 2</td>
|
71
|
+
<td>Value 3</td>
|
72
|
+
<td>Value 4</td>
|
73
|
+
<td>Value 5</td>
|
74
|
+
</tr>
|
75
|
+
<tr>
|
76
|
+
<td>Value 1</td>
|
77
|
+
<td>Value 2</td>
|
78
|
+
<td>Value 3</td>
|
79
|
+
<td>Value 4</td>
|
80
|
+
<td>Value 5</td>
|
81
|
+
</tr>
|
82
|
+
</tbody>
|
83
|
+
<% end %>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import React from "react"
|
2
|
+
|
3
|
+
import Table from "../_table"
|
4
|
+
|
5
|
+
const TableSticky = (props) => (
|
6
|
+
<Table
|
7
|
+
sticky
|
8
|
+
{...props}
|
9
|
+
>
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th>{'Column 1'}</th>
|
13
|
+
<th>{'Column 2'}</th>
|
14
|
+
<th>{'Column 3'}</th>
|
15
|
+
<th>{'Column 4'}</th>
|
16
|
+
<th>{'Column 5'}</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<tr>
|
21
|
+
<td>{'Value 1'}</td>
|
22
|
+
<td>{'Value 2'}</td>
|
23
|
+
<td>{'Value 3'}</td>
|
24
|
+
<td>{'Value 4'}</td>
|
25
|
+
<td>{'Value 5'}</td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td>{'Value 1'}</td>
|
29
|
+
<td>{'Value 2'}</td>
|
30
|
+
<td>{'Value 3'}</td>
|
31
|
+
<td>{'Value 4'}</td>
|
32
|
+
<td>{'Value 5'}</td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<td>{'Value 1'}</td>
|
36
|
+
<td>{'Value 2'}</td>
|
37
|
+
<td>{'Value 3'}</td>
|
38
|
+
<td>{'Value 4'}</td>
|
39
|
+
<td>{'Value 5'}</td>
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
<td>{'Value 1'}</td>
|
43
|
+
<td>{'Value 2'}</td>
|
44
|
+
<td>{'Value 3'}</td>
|
45
|
+
<td>{'Value 4'}</td>
|
46
|
+
<td>{'Value 5'}</td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td>{'Value 1'}</td>
|
50
|
+
<td>{'Value 2'}</td>
|
51
|
+
<td>{'Value 3'}</td>
|
52
|
+
<td>{'Value 4'}</td>
|
53
|
+
<td>{'Value 5'}</td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td>{'Value 1'}</td>
|
57
|
+
<td>{'Value 2'}</td>
|
58
|
+
<td>{'Value 3'}</td>
|
59
|
+
<td>{'Value 4'}</td>
|
60
|
+
<td>{'Value 5'}</td>
|
61
|
+
</tr>
|
62
|
+
<tr>
|
63
|
+
<td>{'Value 1'}</td>
|
64
|
+
<td>{'Value 2'}</td>
|
65
|
+
<td>{'Value 3'}</td>
|
66
|
+
<td>{'Value 4'}</td>
|
67
|
+
<td>{'Value 5'}</td>
|
68
|
+
</tr>
|
69
|
+
<tr>
|
70
|
+
<td>{'Value 1'}</td>
|
71
|
+
<td>{'Value 2'}</td>
|
72
|
+
<td>{'Value 3'}</td>
|
73
|
+
<td>{'Value 4'}</td>
|
74
|
+
<td>{'Value 5'}</td>
|
75
|
+
</tr>
|
76
|
+
<tr>
|
77
|
+
<td>{'Value 1'}</td>
|
78
|
+
<td>{'Value 2'}</td>
|
79
|
+
<td>{'Value 3'}</td>
|
80
|
+
<td>{'Value 4'}</td>
|
81
|
+
<td>{'Value 5'}</td>
|
82
|
+
</tr>
|
83
|
+
<tr>
|
84
|
+
<td>{'Value 1'}</td>
|
85
|
+
<td>{'Value 2'}</td>
|
86
|
+
<td>{'Value 3'}</td>
|
87
|
+
<td>{'Value 4'}</td>
|
88
|
+
<td>{'Value 5'}</td>
|
89
|
+
</tr>
|
90
|
+
</tbody>
|
91
|
+
</Table>
|
92
|
+
)
|
93
|
+
|
94
|
+
export default TableSticky
|
@@ -0,0 +1,10 @@
|
|
1
|
+
React: Use `sticky` on a table to allow the table header to be fixed in place when the user scrolls up and down on the page.
|
2
|
+
|
3
|
+
Rails: Pass `sticky: true` to props.
|
4
|
+
|
5
|
+
If the table header is not sticking in the right place you will need to pass a inline `top` style to the `thead`.
|
6
|
+
React Example: `<thead style={{ top: "-16px" }}>`
|
7
|
+
Rails Example: `<thead style="top: -16px">`
|
8
|
+
|
9
|
+
### Troubleshooting CSS Problems
|
10
|
+
Sticky may not work if any parent/ancestor of the sticky element has any of the `overflow` properties set. Additionally, specifying a height on the overflowing container provides measurement for this feature to work properly. In some cases, it may be necessary to set the same parent/ancestor container to `position: static` as well.
|
@@ -3,6 +3,7 @@ examples:
|
|
3
3
|
- table_sm: Small
|
4
4
|
- table_md: Medium
|
5
5
|
- table_lg: Large
|
6
|
+
- table_sticky: Sticky Header
|
6
7
|
- table_alignment_row: Row Alignment
|
7
8
|
- table_alignment_column: Column Alignment
|
8
9
|
- table_alignment_shift_row: Shift Row
|
@@ -25,6 +26,7 @@ examples:
|
|
25
26
|
- table_sm: Small
|
26
27
|
- table_md: Medium
|
27
28
|
- table_lg: Large
|
29
|
+
- table_sticky: Sticky Header
|
28
30
|
- table_alignment_row: Row Alignment
|
29
31
|
- table_alignment_column: Column Alignment
|
30
32
|
- table_alignment_shift_row: Shift Row
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export { default as TableSm } from './_table_sm.jsx'
|
2
2
|
export { default as TableMd } from './_table_md.jsx'
|
3
3
|
export { default as TableLg } from './_table_lg.jsx'
|
4
|
+
export { default as TableSticky } from './_table_sticky.jsx'
|
4
5
|
export { default as TableSideHighlight } from './_table_side_highlight.jsx'
|
5
6
|
export { default as TableContainer } from './_table_container.jsx'
|
6
7
|
export { default as TableDataTable } from './_table_data_table.jsx'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@import "../../tokens/colors";
|
2
|
+
|
3
|
+
[class^="pb_table"] {
|
4
|
+
&.sticky-header {
|
5
|
+
thead {
|
6
|
+
background: $white;
|
7
|
+
position: sticky;
|
8
|
+
top: 0;
|
9
|
+
z-index: 1;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
&.dark {
|
14
|
+
&.sticky-header {
|
15
|
+
thead {
|
16
|
+
background: $bg_dark;
|
17
|
+
position: sticky;
|
18
|
+
top: 0;
|
19
|
+
z-index: 1;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -21,11 +21,13 @@ module Playbook
|
|
21
21
|
values: %w[sm md lg],
|
22
22
|
default: "sm"
|
23
23
|
prop :text
|
24
|
+
prop :sticky, type: Playbook::Props::Boolean,
|
25
|
+
default: false
|
24
26
|
|
25
27
|
def classname
|
26
28
|
generate_classname(
|
27
29
|
"pb_table", "table-#{size}", single_line_class, dark_class,
|
28
|
-
disable_hover_class, container_class, data_table_class, collapse_class,
|
30
|
+
disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
|
29
31
|
"table-responsive-#{responsive}", separator: " "
|
30
32
|
)
|
31
33
|
end
|
@@ -55,6 +57,10 @@ module Playbook
|
|
55
57
|
def collapse_class
|
56
58
|
responsive != "none" ? "table-collapse-#{collapse}" : ""
|
57
59
|
end
|
60
|
+
|
61
|
+
def sticky_class
|
62
|
+
sticky ? "sticky-header" : nil
|
63
|
+
end
|
58
64
|
end
|
59
65
|
end
|
60
66
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ensureAccessible, renderKit } from "../utilities/test-utils"
|
2
|
+
|
3
|
+
import Table from "./_table"
|
4
|
+
|
5
|
+
const props = {
|
6
|
+
data: { testid: "table" },
|
7
|
+
sticky: false
|
8
|
+
}
|
9
|
+
|
10
|
+
it("should be accessible", async () => {
|
11
|
+
ensureAccessible(Table, props)
|
12
|
+
})
|
13
|
+
|
14
|
+
test("when sticky is true", () => {
|
15
|
+
const kit = renderKit(Table, props, { sticky: true })
|
16
|
+
expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card sticky-header table-collapse-sm")
|
17
|
+
})
|
@@ -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>
|
@@ -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;
|
@@ -10,13 +10,33 @@ $screen-xl-min: 1200px;
|
|
10
10
|
$screen-xl-max: $screen-xl-min - 1;
|
11
11
|
|
12
12
|
$breakpoints: (
|
13
|
-
xs: $screen-xs-min,
|
14
|
-
sm: $screen-sm-min,
|
15
|
-
md: $screen-md-min,
|
16
|
-
lg: $screen-lg-min,
|
17
|
-
xl: $screen-xl-min
|
13
|
+
xs: $screen-xs-min,
|
14
|
+
sm: $screen-sm-min,
|
15
|
+
md: $screen-md-min,
|
16
|
+
lg: $screen-lg-min,
|
17
|
+
xl: $screen-xl-min
|
18
18
|
);
|
19
19
|
|
20
|
+
$breakpoints_grid: (
|
21
|
+
xs: (
|
22
|
+
max: $screen-xs-min
|
23
|
+
),
|
24
|
+
sm: (
|
25
|
+
min: $screen-sm-min,
|
26
|
+
max: $screen-md-max
|
27
|
+
),
|
28
|
+
md: (
|
29
|
+
min: $screen-md-min,
|
30
|
+
max: $screen-lg-max
|
31
|
+
),
|
32
|
+
lg: (
|
33
|
+
min: $screen-lg-min,
|
34
|
+
max: $screen-xl-max
|
35
|
+
),
|
36
|
+
xl: (
|
37
|
+
min: $screen-xl-min,
|
38
|
+
)
|
39
|
+
);
|
20
40
|
|
21
41
|
@function breakpoint($breakpoint_name) {
|
22
42
|
@return map-get($breakpoints, $breakpoint_name);
|
@@ -1,29 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
.align_content_center {
|
12
|
-
display: flex;
|
13
|
-
align-content: center !important;
|
14
|
-
}
|
15
|
-
|
16
|
-
.align_content_space_between {
|
17
|
-
display: flex;
|
18
|
-
align-content: space-between !important;
|
19
|
-
}
|
20
|
-
|
21
|
-
.align_content_space_around {
|
22
|
-
display: flex;
|
23
|
-
align-content: space-around !important;
|
24
|
-
}
|
25
|
-
|
26
|
-
.align_content_space_evenly {
|
27
|
-
display: flex;
|
28
|
-
align-content: space-evenly !important;
|
29
|
-
}
|
1
|
+
$align_content_values: (
|
2
|
+
start: start,
|
3
|
+
end: end,
|
4
|
+
center: center,
|
5
|
+
space_between: space-between,
|
6
|
+
space_around: space-around,
|
7
|
+
space_evenly: space-evenly
|
8
|
+
);
|
9
|
+
|
10
|
+
@include global_props_responsive_css($align_content_values, 'align_content', 'align-content');
|