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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045be6d1cc5d7923963af542060ef78d8a45fc31c65eebb95923a18ab641c26e
|
4
|
+
data.tar.gz: 435afe93b7139f04a498ed7ce11091061cdb8e1a3d471f31d9dc9bbad937d0d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c0785c96569ca1bbbe5c1b84b6a9b4d0f475d5e77f6aa79d50d0e9508844b123312cf199b06d6a024cdba74fd2375ad491badb9ef17c3f64c93cdbe56a735e
|
7
|
+
data.tar.gz: ade48dc78c3998cf6483daae945badafbde0f2214fa902bbc17096166d7b4ea54cd66ad67eac20254ec4f1caa44238da44f96cb5c4cf16d5c020ff0d323bc06d
|
@@ -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';
|
@@ -4,7 +4,6 @@ import 'lazysizes/plugins/attrchange/ls.attrchange'
|
|
4
4
|
import 'lazysizes'
|
5
5
|
|
6
6
|
// vvv React Component JSX Imports from the React Kits vvv
|
7
|
-
export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
|
8
7
|
export { default as Avatar } from './pb_avatar/_avatar'
|
9
8
|
export { default as AvatarActionButton } from './pb_avatar_action_button/_avatar_action_button'
|
10
9
|
export { default as Background } from './pb_background/_background'
|
@@ -98,9 +97,11 @@ export { default as Title } from './pb_title/_title'
|
|
98
97
|
export { default as TitleCount } from './pb_title_count/_title_count'
|
99
98
|
export { default as TitleDetail } from './pb_title_detail/_title_detail'
|
100
99
|
export { default as Toggle } from './pb_toggle/_toggle'
|
100
|
+
export { default as TreemapChart } from './pb_treemap_chart/_treemap_chart'
|
101
101
|
export { default as Typeahead } from './pb_typeahead/_typeahead'
|
102
102
|
export { default as User } from './pb_user/_user'
|
103
103
|
export { default as UserBadge } from './pb_user_badge/_user_badge'
|
104
|
+
export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
|
104
105
|
export { default as WeekdayStacked } from './pb_weekday_stacked/_weekday_stacked'
|
105
106
|
// ^^^ React Component JSX Imports from the React Kits ^^^
|
106
107
|
|
@@ -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,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 CaptionProps = {
|
9
|
-
aria?:
|
10
|
-
children:
|
7
|
+
aria?: {[key: string]: string},
|
8
|
+
children: React.ReactChild[],
|
11
9
|
className?: string,
|
12
10
|
color?: "default" | "light" | "lighter" | "success" | "error" | "link",
|
13
|
-
data?:
|
11
|
+
data?: {[key: string]: string},
|
14
12
|
id?: string,
|
15
13
|
size?: "xs" | "sm" | "md" | "lg" | "xl",
|
16
14
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption",
|
17
15
|
text?: string,
|
18
16
|
variant?: null | "link",
|
19
|
-
};
|
17
|
+
} & GlobalProps;
|
20
18
|
|
21
|
-
const Caption = (props: CaptionProps) => {
|
19
|
+
const Caption = (props: CaptionProps): React.ReactElement => {
|
22
20
|
if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
|
23
21
|
const {
|
24
22
|
aria = {},
|
@@ -32,6 +30,7 @@ const Caption = (props: CaptionProps) => {
|
|
32
30
|
text,
|
33
31
|
variant = null,
|
34
32
|
} = props
|
33
|
+
|
35
34
|
const tagOptions = [
|
36
35
|
'h1',
|
37
36
|
'h2',
|
@@ -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'
|
8
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
10
9
|
import { 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'
|
@@ -1,10 +1,25 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import Card from '../_card
|
2
|
+
import Card from '../_card'
|
3
3
|
|
4
4
|
const CardLight = (props) => {
|
5
5
|
return (
|
6
6
|
<div>
|
7
|
-
<Card
|
7
|
+
<Card
|
8
|
+
flexDirection={{xs: "row", sm: "column", md: "rowReverse", lg: "columnReverse"}}
|
9
|
+
{...props}
|
10
|
+
>{'Card content'}</Card>
|
11
|
+
<Card
|
12
|
+
flexDirection="column"
|
13
|
+
{...props}
|
14
|
+
>{'Card content'}</Card>
|
15
|
+
<Card
|
16
|
+
flexDirection="rowReverse"
|
17
|
+
{...props}
|
18
|
+
>{'Card content'}</Card>
|
19
|
+
<Card
|
20
|
+
flexDirection="columnReverse"
|
21
|
+
{...props}
|
22
|
+
>{'Card content'}</Card>
|
8
23
|
</div>
|
9
24
|
)
|
10
25
|
}
|
@@ -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 %>
|