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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ed156e9b15608fb8116a723d8dca86eb5b4295d88698532dc4bf8242bcd3ef6
|
4
|
+
data.tar.gz: d5a5f5e68f1aeeafdd80dc066ee4be2271e7c4f8c666ef1ccf6ff205a98645ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8aef1428a28b4c32bde81b9d61f76a4cdf02c6f5a08bb226ec4af88b86a83060f1322ed8e5033ba9a212c11fcef9e364d633505c42139beb7a9a167d0084ac
|
7
|
+
data.tar.gz: f58619e5f506e3d5c8dfbcab0605e65566c0a8e22dfdf73ac561a5391da2b02893aa95d2ec252ebc018b9ff8bcfcc9097086d2374c5c33fb53b01cb0d6578de2
|
@@ -92,6 +92,7 @@
|
|
92
92
|
@import 'pb_time_stacked/time_stacked';
|
93
93
|
@import 'pb_walkthrough/walkthrough';
|
94
94
|
@import 'pb_weekday_stacked/weekday_stacked';
|
95
|
+
@import './utilities/mixins';
|
95
96
|
@import './utilities/spacing';
|
96
97
|
@import './utilities/cursor';
|
97
98
|
@import './utilities/max_width';
|
@@ -1,26 +1,24 @@
|
|
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 { globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
7
5
|
|
8
6
|
type BackgroundProps = {
|
9
7
|
alt?: string,
|
10
|
-
aria?:
|
8
|
+
aria?: {[key: string]: string},
|
11
9
|
backgroundColor?: 'gradient' | 'dark' | 'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'category_1' | 'category_2' | 'category_3' | 'category_4' | 'category_5' | 'category_6' | 'category_7' | 'category_8' | 'category_9' | 'category_10' | 'category_11' | 'category_12' | 'category_13' | 'category_14' | 'category_15' | 'category_16' | 'category_17' | 'category_18' | 'category_19' | 'category_20' | 'category_21',
|
12
10
|
backgroundRepeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | 'initial' | 'inherit',
|
13
11
|
backgroundSize?: 'auto' | 'cover' | 'contain',
|
14
|
-
children?:
|
12
|
+
children?: React.ReactChild[] | React.ReactNode,
|
15
13
|
className?: string,
|
16
14
|
customColor?: string,
|
17
|
-
data?:
|
15
|
+
data?: {[key: string]: string},
|
18
16
|
id?: string,
|
19
17
|
imageUrl?: string,
|
20
18
|
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
21
19
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
|
22
20
|
transition?: 'fade' | 'blur' | 'scale',
|
23
|
-
}
|
21
|
+
} & GlobalProps
|
24
22
|
|
25
23
|
const Background = (props: BackgroundProps) => {
|
26
24
|
const {
|
@@ -49,11 +47,13 @@ const Background = (props: BackgroundProps) => {
|
|
49
47
|
}
|
50
48
|
const getBackgroundColor = customColor ? 'pb_background_custom_color' : `pb_background_color_${backgroundColor}`
|
51
49
|
const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), getBackgroundColor, className)
|
52
|
-
const Tag = `${tag}`
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
|
52
|
+
const Tag: React.ReactElement | any = `${tag}`
|
53
|
+
|
54
|
+
const displayReturn = () => {
|
55
|
+
if (imageUrl)
|
56
|
+
return (
|
57
57
|
<Tag
|
58
58
|
alt={alt}
|
59
59
|
style={backgroundStyle}
|
@@ -64,7 +64,9 @@ const Background = (props: BackgroundProps) => {
|
|
64
64
|
>
|
65
65
|
{ children }
|
66
66
|
</Tag>
|
67
|
-
|
67
|
+
)
|
68
|
+
else
|
69
|
+
return (
|
68
70
|
<Tag
|
69
71
|
{...ariaProps}
|
70
72
|
{...dataProps}
|
@@ -74,7 +76,12 @@ const Background = (props: BackgroundProps) => {
|
|
74
76
|
>
|
75
77
|
{ children }
|
76
78
|
</Tag>
|
77
|
-
|
79
|
+
)
|
80
|
+
}
|
81
|
+
|
82
|
+
return (
|
83
|
+
<>
|
84
|
+
{ displayReturn() }
|
78
85
|
</>
|
79
86
|
)
|
80
87
|
}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
|
6
|
-
import { globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
7
5
|
import {
|
8
6
|
buildAriaProps,
|
9
7
|
buildCss,
|
@@ -13,21 +11,22 @@ import {
|
|
13
11
|
import Icon from '../pb_icon/_icon'
|
14
12
|
|
15
13
|
type BadgeProps = {
|
16
|
-
aria?:
|
14
|
+
aria?: {[key: string]: string},
|
17
15
|
className?: string,
|
18
16
|
closeProps?: {
|
19
|
-
onClick?:
|
20
|
-
onMouseDown?:
|
21
|
-
onTouchEnd?:
|
17
|
+
onClick?: React.MouseEventHandler<HTMLSpanElement>,
|
18
|
+
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
|
19
|
+
onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
|
22
20
|
},
|
23
|
-
data?:
|
21
|
+
data?: {[key: string]: string},
|
24
22
|
id?: string,
|
25
|
-
removeIcon?:
|
26
|
-
removeOnClick?:
|
23
|
+
removeIcon?: boolean,
|
24
|
+
removeOnClick?: React.MouseEventHandler<HTMLSpanElement>,
|
27
25
|
rounded?: boolean,
|
28
26
|
text?: string,
|
29
27
|
variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
|
30
|
-
}
|
28
|
+
} & GlobalProps
|
29
|
+
|
31
30
|
const Badge = (props: BadgeProps) => {
|
32
31
|
const {
|
33
32
|
aria = {},
|
@@ -36,7 +35,7 @@ const Badge = (props: BadgeProps) => {
|
|
36
35
|
data = {},
|
37
36
|
id,
|
38
37
|
removeIcon = false,
|
39
|
-
removeOnClick
|
38
|
+
removeOnClick,
|
40
39
|
rounded = false,
|
41
40
|
text,
|
42
41
|
variant = 'neutral',
|
@@ -44,7 +43,7 @@ const Badge = (props: BadgeProps) => {
|
|
44
43
|
const ariaProps = buildAriaProps(aria)
|
45
44
|
const dataProps = buildDataProps(data)
|
46
45
|
const css = classnames(
|
47
|
-
buildCss('pb_badge_kit', variant,
|
46
|
+
buildCss('pb_badge_kit', variant, rounded ? 'rounded' : null),
|
48
47
|
globalProps(props),
|
49
48
|
className
|
50
49
|
)
|
@@ -58,7 +57,7 @@ const Badge = (props: BadgeProps) => {
|
|
58
57
|
>
|
59
58
|
<span>
|
60
59
|
{text}
|
61
|
-
|
60
|
+
{removeIcon && (
|
62
61
|
<span
|
63
62
|
onClick={removeOnClick}
|
64
63
|
style={{ cursor: 'pointer' }}
|
@@ -69,7 +68,7 @@ const Badge = (props: BadgeProps) => {
|
|
69
68
|
icon="times"
|
70
69
|
/>
|
71
70
|
</span>
|
72
|
-
|
71
|
+
)}
|
73
72
|
</span>
|
74
73
|
</div>
|
75
74
|
)
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export { default as BadgeDefault } from './_badge_default
|
2
|
-
export { default as BadgeRounded } from './_badge_rounded
|
3
|
-
export { default as BadgeColors } from './_badge_colors
|
1
|
+
export { default as BadgeDefault } from './_badge_default'
|
2
|
+
export { default as BadgeRounded } from './_badge_rounded'
|
3
|
+
export { default as BadgeColors } from './_badge_colors'
|
@@ -9,7 +9,7 @@ import Highlight from '../pb_highlight/_highlight'
|
|
9
9
|
type BodyProps = {
|
10
10
|
aria?: {[key: string]: string},
|
11
11
|
className?: string,
|
12
|
-
children?: React.ReactChild[],
|
12
|
+
children?: React.ReactChild[] | React.ReactChild,
|
13
13
|
color?: 'default' | 'light' | 'lighter' | 'link',
|
14
14
|
dark?: boolean,
|
15
15
|
data?: {[key: string]: string},
|
@@ -1,18 +1,17 @@
|
|
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'
|
5
|
+
|
6
|
+
import Icon from '../pb_icon/_icon'
|
7
7
|
|
8
|
-
|
8
|
+
type EventHandler = (React.MouseEventHandler<HTMLElement>)
|
9
9
|
|
10
|
-
type EventHandler = (SyntheticInputEvent<HTMLInputElement>) => void
|
11
10
|
type ButtonPropTypes = {
|
12
|
-
aria?:
|
13
|
-
children?:
|
14
|
-
className?: string |
|
15
|
-
data?:
|
11
|
+
aria?: {[key: string]: string},
|
12
|
+
children?: React.ReactChild[] | React.ReactChild,
|
13
|
+
className?: string | string[],
|
14
|
+
data?: {[key: string]: string},
|
16
15
|
disabled?: boolean,
|
17
16
|
fixedWidth?: boolean,
|
18
17
|
form?: string,
|
@@ -26,11 +25,11 @@ type ButtonPropTypes = {
|
|
26
25
|
size?: 'sm' | 'md' | 'lg',
|
27
26
|
text?: string,
|
28
27
|
type: 'inline' | null,
|
29
|
-
htmlType:
|
28
|
+
htmlType: 'submit' | 'reset' | 'button' | undefined,
|
30
29
|
value?: string | null,
|
31
30
|
variant: 'primary' | 'secondary' | 'link',
|
32
31
|
wrapperClass: string,
|
33
|
-
}
|
32
|
+
} & GlobalProps
|
34
33
|
|
35
34
|
const buttonClassName = (props: ButtonPropTypes) => {
|
36
35
|
const {
|
@@ -64,7 +63,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
64
63
|
icon = null,
|
65
64
|
id,
|
66
65
|
loading = false,
|
67
|
-
onClick
|
66
|
+
onClick,
|
68
67
|
link = null,
|
69
68
|
newWindow = false,
|
70
69
|
text,
|
@@ -92,46 +91,66 @@ const Button = (props: ButtonPropTypes) => {
|
|
92
91
|
|
93
92
|
const content = (
|
94
93
|
<span className="pb_button_content">
|
95
|
-
|
94
|
+
{icon && (
|
96
95
|
<i className={`pb_icon_kit far fa-${icon} fa-fw`} />
|
97
|
-
|
98
|
-
</If>
|
96
|
+
)}
|
99
97
|
<span>{text || children}</span>
|
100
98
|
</span>
|
101
99
|
)
|
102
100
|
|
101
|
+
const ifLoading = () => {
|
102
|
+
if (loading){
|
103
|
+
return(
|
104
|
+
<>
|
105
|
+
{loadingIcon}
|
106
|
+
</>
|
107
|
+
)
|
108
|
+
} else {
|
109
|
+
return (
|
110
|
+
content
|
111
|
+
)
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
const displayButton = () => {
|
116
|
+
if (link)
|
117
|
+
return (
|
118
|
+
<a
|
119
|
+
{...ariaProps}
|
120
|
+
{...dataProps}
|
121
|
+
className={css}
|
122
|
+
href={link}
|
123
|
+
id={id}
|
124
|
+
rel="noreferrer"
|
125
|
+
role="link"
|
126
|
+
target={newWindow ? '_blank' : null}
|
127
|
+
>
|
128
|
+
{ifLoading()}
|
129
|
+
</a>
|
130
|
+
)
|
131
|
+
else
|
132
|
+
return (
|
133
|
+
<button
|
134
|
+
{...ariaProps}
|
135
|
+
{...dataProps}
|
136
|
+
className={css}
|
137
|
+
disabled={disabled}
|
138
|
+
form={form}
|
139
|
+
id={id}
|
140
|
+
onClick={onClick}
|
141
|
+
role="button"
|
142
|
+
type={htmlType}
|
143
|
+
value={value}
|
144
|
+
>
|
145
|
+
{ifLoading()}
|
146
|
+
</button>
|
147
|
+
)
|
148
|
+
}
|
149
|
+
|
103
150
|
return (
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
{...dataProps}
|
108
|
-
className={css}
|
109
|
-
href={link}
|
110
|
-
id={id}
|
111
|
-
rel="noreferrer"
|
112
|
-
role="link"
|
113
|
-
target={newWindow ? '_blank' : null}
|
114
|
-
>
|
115
|
-
<If condition={loading}>{loadingIcon}</If>
|
116
|
-
{content}
|
117
|
-
</a>
|
118
|
-
<Else />
|
119
|
-
<button
|
120
|
-
{...ariaProps}
|
121
|
-
{...dataProps}
|
122
|
-
className={css}
|
123
|
-
disabled={disabled}
|
124
|
-
form={form}
|
125
|
-
id={id}
|
126
|
-
onClick={onClick}
|
127
|
-
role="button"
|
128
|
-
type={htmlType}
|
129
|
-
value={value}
|
130
|
-
>
|
131
|
-
<If condition={loading}>{loadingIcon}</If>
|
132
|
-
{content}
|
133
|
-
</button>
|
134
|
-
</If>
|
151
|
+
<>
|
152
|
+
{displayButton()}
|
153
|
+
</>
|
135
154
|
)
|
136
155
|
}
|
137
156
|
|
@@ -1,43 +1,43 @@
|
|
1
1
|
/* eslint-disable react/no-multi-comp */
|
2
|
-
/* @flow */
|
3
2
|
|
4
3
|
import React from 'react'
|
5
4
|
import { get } from 'lodash'
|
6
5
|
import classnames from 'classnames'
|
7
6
|
|
8
7
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
9
|
-
import { globalProps } from '../utilities/globalProps'
|
10
|
-
import { ProductColors, CategoryColors, BackgroundColors } from '../types'
|
8
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
9
|
+
import type { ProductColors, CategoryColors, BackgroundColors } from '../types'
|
11
10
|
|
12
11
|
type CardPropTypes = {
|
13
|
-
aria?:
|
12
|
+
aria?: {[key: string]: string},
|
14
13
|
background?: BackgroundColors | ProductColors | "none",
|
15
14
|
borderNone?: boolean,
|
16
15
|
borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | "none" | "rounded",
|
17
|
-
children:
|
16
|
+
children: React.ReactChild[] | React.ReactChild | number,
|
18
17
|
className?: string,
|
19
|
-
data?:
|
18
|
+
data?: {[key: string]: string},
|
20
19
|
highlight?: {
|
21
20
|
position?: "side" | "top",
|
22
21
|
color?: string,
|
23
22
|
},
|
23
|
+
length?: number,
|
24
24
|
padding?: string,
|
25
25
|
selected?: boolean,
|
26
26
|
tag?: "div" | "section" | "footer" | "header" | "article" | "aside" | "main" | "nav",
|
27
|
-
}
|
27
|
+
} & GlobalProps
|
28
28
|
|
29
29
|
type CardHeaderProps = {
|
30
30
|
headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
|
31
|
-
children:
|
31
|
+
children: React.ReactChild[] | React.ReactChild,
|
32
32
|
className?: string,
|
33
|
-
padding?: string
|
34
|
-
}
|
33
|
+
padding?: string,
|
34
|
+
} & GlobalProps
|
35
35
|
|
36
36
|
type CardBodyProps = {
|
37
|
-
children:
|
37
|
+
children: React.ReactChild[] | React.ReactChild | string,
|
38
38
|
className?: string,
|
39
39
|
padding?: string,
|
40
|
-
}
|
40
|
+
} & GlobalProps
|
41
41
|
|
42
42
|
// Header component
|
43
43
|
const Header = (props: CardHeaderProps) => {
|
@@ -57,7 +57,6 @@ const Header = (props: CardHeaderProps) => {
|
|
57
57
|
const Body = (props: CardBodyProps) => {
|
58
58
|
const { children, padding = 'md', className } = props
|
59
59
|
const bodyCSS = buildCss('pb_card_body_kit')
|
60
|
-
|
61
60
|
const bodySpacing = globalProps(props, { padding })
|
62
61
|
|
63
62
|
return (
|
@@ -84,26 +83,27 @@ const Card = (props: CardPropTypes) => {
|
|
84
83
|
const borderCSS = borderNone == true ? 'border_none' : ''
|
85
84
|
const selectedCSS = selected == true ? 'selected' : 'deselected'
|
86
85
|
const backgroundCSS = background == 'none' ? '' : `background_${background}`
|
87
|
-
const cardCss = buildCss('pb_card_kit', selectedCSS, borderCSS, `border_radius_${borderRadius}`, backgroundCSS,
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
const ariaProps = buildAriaProps(aria)
|
92
|
-
const dataProps = buildDataProps(data)
|
86
|
+
const cardCss = buildCss('pb_card_kit', selectedCSS, borderCSS, `border_radius_${borderRadius}`, backgroundCSS,
|
87
|
+
`highlight_${highlight.position}`,
|
88
|
+
`highlight_${highlight.color}`,
|
89
|
+
)
|
90
|
+
const ariaProps: {[key: string]: string} = buildAriaProps(aria)
|
91
|
+
const dataProps: {[key: string]: string} = buildDataProps(data)
|
93
92
|
|
94
93
|
// coerce to array
|
95
|
-
const cardChildren =
|
96
|
-
typeof children === 'object' && children.length ? children : [children]
|
94
|
+
const cardChildren = React.Children.toArray(children)
|
97
95
|
|
98
|
-
const subComponentTags = (tagName) => {
|
99
|
-
return cardChildren.filter((c) => (
|
96
|
+
const subComponentTags = (tagName: string) => {
|
97
|
+
return cardChildren.filter((c: string) => (
|
100
98
|
get(c, 'type.displayName') === tagName
|
101
99
|
)).map((child, i) => {
|
100
|
+
if(React.isValidElement(child)) {
|
102
101
|
return React.cloneElement(child, { key: `${tagName.toLowerCase()}-${i}` })
|
102
|
+
}
|
103
103
|
})
|
104
104
|
}
|
105
105
|
|
106
|
-
const nonHeaderChildren = cardChildren.filter((child) => (get(child, 'type.displayName') !== 'Header'))
|
106
|
+
const nonHeaderChildren = cardChildren.filter((child: Node) => (get(child, 'type.displayName') !== 'Header'))
|
107
107
|
|
108
108
|
const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
|
109
109
|
const Tag = tagOptions.includes(tag) ? tag : 'div'
|
@@ -35,12 +35,14 @@ const Icon = ({ collapsed }: IconProps) => {
|
|
35
35
|
const CollapsibleMain = ({
|
36
36
|
children,
|
37
37
|
className,
|
38
|
+
cursor = 'pointer',
|
38
39
|
padding = 'md',
|
40
|
+
|
39
41
|
...props
|
40
42
|
}: CollapsibleMainProps) => {
|
41
43
|
const context = useContext(CollapsibleContext)
|
42
44
|
const mainCSS = buildCss('pb_collapsible_main_kit')
|
43
|
-
const mainSpacing = globalProps(props, { padding })
|
45
|
+
const mainSpacing = globalProps(props, { cursor, padding })
|
44
46
|
|
45
47
|
return (
|
46
48
|
<div className={classnames(mainCSS, className, mainSpacing)}>
|
@@ -50,7 +52,7 @@ const CollapsibleMain = ({
|
|
50
52
|
vertical="center"
|
51
53
|
>
|
52
54
|
<FlexItem>{children}</FlexItem>
|
53
|
-
<FlexItem><Icon collapsed={context.collapsed}
|
55
|
+
<FlexItem><Icon collapsed={context.collapsed}/></FlexItem>
|
54
56
|
</Flex>
|
55
57
|
</div>
|
56
58
|
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class: object.classname,
|
5
5
|
aria: object.aria) do %>
|
6
6
|
|
7
|
-
<%= pb_rails("flex", props: {vertical: "center", spacing: "between"}) do %>
|
7
|
+
<%= pb_rails("flex", props: {vertical: "center", spacing: "between", cursor: "pointer"}) do %>
|
8
8
|
<%= pb_rails("flex/flex_item") do %>
|
9
9
|
<%= content.presence %>
|
10
10
|
<% end %>
|
@@ -1,11 +1,10 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
5
|
+
|
7
6
|
type FlexProps = {
|
8
|
-
children:
|
7
|
+
children: React.ReactChild[] | React.ReactNode,
|
9
8
|
className?: string,
|
10
9
|
data?: object,
|
11
10
|
horizontal?: "left" | "center" | "right" | "stretch" | "none",
|
@@ -22,7 +21,7 @@ type FlexProps = {
|
|
22
21
|
columnGap?: "xs" | "sm" | "md" | "lg" | "xl" | "none",
|
23
22
|
wrap?: boolean,
|
24
23
|
alignSelf?: "start" | "end" | "center" | "stretch" | "none"
|
25
|
-
}
|
24
|
+
} & GlobalProps
|
26
25
|
|
27
26
|
const Flex = (props: FlexProps) => {
|
28
27
|
const {
|
@@ -43,6 +42,7 @@ const Flex = (props: FlexProps) => {
|
|
43
42
|
wrap = false,
|
44
43
|
alignSelf = 'none',
|
45
44
|
} = props
|
45
|
+
|
46
46
|
const orientationClass =
|
47
47
|
orientation !== undefined ? `orientation_${orientation}` : ''
|
48
48
|
const justifyClass =
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import Title from '../pb_title/_title'
|
5
|
-
import Icon from '../pb_icon/_icon
|
5
|
+
import Icon from '../pb_icon/_icon'
|
6
6
|
import Avatar from '../pb_avatar/_avatar'
|
7
7
|
import { globalProps } from '../utilities/globalProps'
|
8
8
|
|
@@ -8,7 +8,7 @@ type HighlightProps = {
|
|
8
8
|
className?: string,
|
9
9
|
data?: {[key: string]: string},
|
10
10
|
id?: string,
|
11
|
-
children?: React.ReactChild[] | string,
|
11
|
+
children?: React.ReactChild[] | React.ReactChild | string,
|
12
12
|
text?: string,
|
13
13
|
highlightedText?: string[],
|
14
14
|
} & GlobalProps
|