playbook_ui 10.23.0.pre.cachetest → 10.23.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/index.js +0 -3
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
- data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +13 -14
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_background/_background.jsx +8 -3
- data/app/pb_kits/playbook/pb_background/_background.scss +24 -8
- data/app/pb_kits/playbook/pb_background/background.rb +6 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
- data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.jsx +8 -4
- data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
- data/app/pb_kits/playbook/pb_button/button.rb +13 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +88 -0
- data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
- data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
- data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
- data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
- data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
- data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
- data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
- data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
- data/app/pb_kits/playbook/pb_image/image.rb +1 -1
- data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
- data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -1
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/index.js +4 -9
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
- data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
- data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
- data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
- data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
- data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
- data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
- data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
- data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
- data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
- data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
- data/app/pb_kits/playbook/utilities/_order.scss +55 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +274 -0
- data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
- data/lib/playbook/align_content.rb +29 -0
- data/lib/playbook/align_items.rb +29 -0
- data/lib/playbook/align_self.rb +29 -0
- data/lib/playbook/classnames.rb +11 -0
- data/lib/playbook/flex.rb +29 -0
- data/lib/playbook/flex_direction.rb +29 -0
- data/lib/playbook/flex_grow.rb +29 -0
- data/lib/playbook/flex_shrink.rb +29 -0
- data/lib/playbook/flex_wrap.rb +29 -0
- data/lib/playbook/justify_content.rb +29 -0
- data/lib/playbook/justify_self.rb +29 -0
- data/lib/playbook/kit_base.rb +22 -0
- data/lib/playbook/order.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- metadata +44 -11
- data/app/pb_kits/playbook/types.js +0 -4
- data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6798a70ed76fb5f5a6e1b65a7906c237fed66449377b09cdd42ed93133fd9148
|
4
|
+
data.tar.gz: 4cff4b45c818dc8844e10a4ffa3a2708a4041d1277af4a2adb473138661a95c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4b508b9345c83fd51fb058bd42de424ffbe05df3ec05ca043e1803a434b1955648b3591e83b9a5894065e5138f4ac4d136d23471f3f26794a2625f80533df26
|
7
|
+
data.tar.gz: 0a3f4fa1c1fa89edbd972f83ef5c3379212dd17fb4dc4233af400068724b9a6c0cb3b27100818989b48cc70fab6b9a6e556f3694087b75be9b037e498e7a6e22
|
@@ -118,6 +118,3 @@ export { default as PbTable } from './pb_table'
|
|
118
118
|
export { default as PbTextarea } from './pb_textarea'
|
119
119
|
export { default as PbTooltip } from './pb_tooltip'
|
120
120
|
export { default as PbTypeahead } from './pb_typeahead'
|
121
|
-
|
122
|
-
// eslint-disable-next-line no-console
|
123
|
-
console.log('CACHE BUSTED')
|
@@ -16,8 +16,8 @@ $avatar-sizes: (
|
|
16
16
|
position: relative;
|
17
17
|
|
18
18
|
@each $name, $size in $avatar-sizes {
|
19
|
-
&[class*=
|
20
|
-
&[class*=
|
19
|
+
&[class*=_size_#{$name}],
|
20
|
+
&[class*=_size_#{$name}_thumb] {
|
21
21
|
width: $size;
|
22
22
|
height: $size;
|
23
23
|
object-fit: cover;
|
@@ -1,8 +1,5 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React, { useState } from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
|
-
import { map } from 'lodash'
|
6
3
|
|
7
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
5
|
import { globalProps } from '../utilities/globalProps'
|
@@ -11,9 +8,9 @@ import Image from '../pb_image/_image'
|
|
11
8
|
import OnlineStatus from '../pb_online_status/_online_status'
|
12
9
|
|
13
10
|
type AvatarProps = {
|
14
|
-
aria?:
|
11
|
+
aria?: {[key: string]: string},
|
15
12
|
className?: string,
|
16
|
-
data?:
|
13
|
+
data?: {[key: string]: string},
|
17
14
|
dark?: boolean,
|
18
15
|
id?: string,
|
19
16
|
imageAlt?: string,
|
@@ -23,8 +20,8 @@ type AvatarProps = {
|
|
23
20
|
status: "away" | "offline" | "online",
|
24
21
|
}
|
25
22
|
|
26
|
-
const firstTwoInitials = (name) =>
|
27
|
-
|
23
|
+
const firstTwoInitials = (name: string) =>
|
24
|
+
name.split(/\s/).map((name) => name[0])
|
28
25
|
.join('')
|
29
26
|
.substring(0, 2)
|
30
27
|
|
@@ -41,10 +38,10 @@ const Avatar = (props: AvatarProps) => {
|
|
41
38
|
status = null,
|
42
39
|
dark = false,
|
43
40
|
} = props
|
44
|
-
const dataProps = buildDataProps(data)
|
45
|
-
const ariaProps = buildAriaProps(aria)
|
41
|
+
const dataProps: {[key: string]: any} = buildDataProps(data)
|
42
|
+
const ariaProps: {[key: string]: any} = buildAriaProps(aria)
|
46
43
|
const classes = classnames(
|
47
|
-
buildCss('pb_avatar_kit', size),
|
44
|
+
buildCss('pb_avatar_kit', `size_${size}`),
|
48
45
|
globalProps(props),
|
49
46
|
className
|
50
47
|
)
|
@@ -55,6 +52,8 @@ const Avatar = (props: AvatarProps) => {
|
|
55
52
|
const [error, setError] = useState(false)
|
56
53
|
const handleError = () => setError(true)
|
57
54
|
|
55
|
+
const canShowImage = imageUrl && !error
|
56
|
+
|
58
57
|
return (
|
59
58
|
<div
|
60
59
|
{...ariaProps}
|
@@ -66,21 +65,21 @@ const Avatar = (props: AvatarProps) => {
|
|
66
65
|
className="avatar_wrapper"
|
67
66
|
data-initials={initials}
|
68
67
|
>
|
69
|
-
|
68
|
+
{ canShowImage && (
|
70
69
|
<Image
|
71
70
|
alt={imageAlt}
|
72
71
|
onError={handleError}
|
73
72
|
url={imageUrl}
|
74
73
|
/>
|
75
|
-
|
74
|
+
)}
|
76
75
|
</div>
|
77
|
-
|
76
|
+
{status && (
|
78
77
|
<OnlineStatus
|
79
78
|
className={`size_${size}`}
|
80
79
|
dark={dark}
|
81
80
|
status={status}
|
82
81
|
/>
|
83
|
-
|
82
|
+
)}
|
84
83
|
</div>
|
85
84
|
)
|
86
85
|
}
|
@@ -22,7 +22,7 @@ test('loads the given image url and name', () => {
|
|
22
22
|
const image = screen.getByAltText(imageAlt)
|
23
23
|
const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1)
|
24
24
|
|
25
|
-
expect(kit).toHaveClass('
|
25
|
+
expect(kit).toHaveClass('pb_avatar_kit_size_md')
|
26
26
|
expect(kit).toHaveAttribute('data-initials', initials)
|
27
27
|
expect(image).toHaveAttribute('data-src', imageUrl)
|
28
28
|
expect(image).toHaveAttribute('src', imageUrl)
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
buildCss,
|
9
9
|
buildDataProps,
|
10
10
|
} from '../utilities/props'
|
11
|
-
import { globalProps } from '../utilities/globalProps
|
11
|
+
import { globalProps } from '../utilities/globalProps'
|
12
12
|
|
13
13
|
import Avatar from '../pb_avatar/_avatar'
|
14
14
|
import Icon from '../pb_icon/_icon'
|
@@ -3,9 +3,10 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type BackgroundProps = {
|
9
|
+
alt?: string,
|
9
10
|
aria?: object,
|
10
11
|
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',
|
11
12
|
children?: array<React.ReactNode> | React.ReactNode,
|
@@ -15,10 +16,12 @@ type BackgroundProps = {
|
|
15
16
|
imageUrl?: string,
|
16
17
|
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
17
18
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
|
19
|
+
transition?: 'fade' | 'blur' | 'scale',
|
18
20
|
}
|
19
21
|
|
20
22
|
const Background = (props: BackgroundProps) => {
|
21
23
|
const {
|
24
|
+
alt = '',
|
22
25
|
aria = {},
|
23
26
|
backgroundColor = 'light',
|
24
27
|
children,
|
@@ -27,22 +30,24 @@ const Background = (props: BackgroundProps) => {
|
|
27
30
|
id,
|
28
31
|
imageUrl = '',
|
29
32
|
tag = 'div',
|
33
|
+
transition = '',
|
30
34
|
} = props
|
31
35
|
|
32
36
|
const ariaProps = buildAriaProps(aria)
|
33
37
|
const dataProps = buildDataProps(data)
|
34
38
|
|
35
|
-
const classes = classnames(buildCss('pb_background_kit'), globalProps(props), `pb_background_color_${backgroundColor}`, className)
|
36
|
-
const Tag = `${tag}`
|
37
39
|
const backgroundStyle = {
|
38
40
|
backgroundImage: `url(${imageUrl})`,
|
39
41
|
backgroundSize: 'cover',
|
40
42
|
}
|
43
|
+
const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), `pb_background_color_${backgroundColor}`, className)
|
44
|
+
const Tag = `${tag}`
|
41
45
|
|
42
46
|
return (
|
43
47
|
<>
|
44
48
|
<If condition={imageUrl}>
|
45
49
|
<Tag
|
50
|
+
alt={alt}
|
46
51
|
style={backgroundStyle}
|
47
52
|
{...ariaProps}
|
48
53
|
{...dataProps}
|
@@ -22,14 +22,30 @@ $background_colors: map-merge($additional_colors, $merge_kits2);
|
|
22
22
|
}
|
23
23
|
};
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
&.fade {
|
26
|
+
opacity: 0;
|
27
|
+
&.lazyloaded {
|
28
|
+
opacity: 1;
|
29
|
+
transition: opacity 400ms ease-in;
|
30
|
+
}
|
29
31
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
|
33
|
+
&.blur {
|
34
|
+
filter: blur(5px);
|
35
|
+
&.lazyloaded {
|
36
|
+
-webkit-filter: blur(0);
|
37
|
+
filter: blur(0);
|
38
|
+
transition: filter 400ms ease-in;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
&.scale {
|
43
|
+
opacity: 0;
|
44
|
+
transform: scale(0.9);
|
45
|
+
&.lazyloaded {
|
46
|
+
opacity: 1;
|
47
|
+
transform: scale(1);
|
48
|
+
transition: 700ms ease-in;
|
49
|
+
}
|
34
50
|
}
|
35
51
|
}
|
@@ -12,18 +12,18 @@ module Playbook
|
|
12
12
|
values: %w[h1 h2 h3 h4 h5 h6 p div span],
|
13
13
|
default: "div"
|
14
14
|
|
15
|
+
prop :transition, type: Playbook::Props::Enum,
|
16
|
+
values: ["blur", "fade", "scale", nil],
|
17
|
+
default: nil
|
18
|
+
|
15
19
|
def classname
|
16
|
-
generate_classname("pb_background_kit", image_classname,
|
20
|
+
generate_classname("pb_background_kit", image_classname, separator: " ")
|
17
21
|
end
|
18
22
|
|
19
23
|
private
|
20
24
|
|
21
25
|
def image_classname
|
22
|
-
image_url.present? ? "lazyload
|
23
|
-
end
|
24
|
-
|
25
|
-
def background_color_classname
|
26
|
-
!image_url.present? ? "pb_background_color_#{background_color}" : ""
|
26
|
+
image_url.present? ? "lazyload #{transition}" : "pb_background_color_#{background_color}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= pb_rails("background", props: { image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
|
2
|
-
<%= pb_rails("flex", props: { horizontal: "center", orientation: "column" }) do %>
|
1
|
+
<%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
|
2
|
+
<%= pb_rails("flex", props: { horizontal: "center", orientation: "column", margin_bottom: "xl" }) do %>
|
3
3
|
<%= pb_rails("flex/flex_item") do %>
|
4
4
|
<%= pb_rails("title", props: { dark: true, size: 1, text: "Background Kit Image" })%>
|
5
5
|
<% end %>
|
@@ -11,3 +11,51 @@
|
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
<% end %>
|
14
|
+
|
15
|
+
|
16
|
+
<%= pb_rails("flex", props: { margin_top: "lg" }) do %>
|
17
|
+
<%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %>
|
18
|
+
<%= pb_rails("select", props: {
|
19
|
+
id: "transition-dropdown",
|
20
|
+
label: "",
|
21
|
+
blank_selection: "Select a Transition...",
|
22
|
+
options: [
|
23
|
+
{
|
24
|
+
value: 'fade',
|
25
|
+
},
|
26
|
+
{
|
27
|
+
value: 'blur',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
value: 'scale',
|
31
|
+
},
|
32
|
+
]
|
33
|
+
}) %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<script>
|
38
|
+
window.addEventListener('DOMContentLoaded', () => {
|
39
|
+
const transitionDropdown = document.querySelector("#transition-dropdown")
|
40
|
+
var option = ''
|
41
|
+
|
42
|
+
transitionDropdown.addEventListener('change', function() {
|
43
|
+
if (this.value === '') {
|
44
|
+
(transitionDropdown).className = (transitionDropdown).className + ' _disabled'
|
45
|
+
} else {
|
46
|
+
(transitionDropdown).removeAttribute("disabled");
|
47
|
+
(transitionDropdown).className = (transitionDropdown)
|
48
|
+
option = this.value
|
49
|
+
}
|
50
|
+
});
|
51
|
+
|
52
|
+
const updateTransition = (transition) => {
|
53
|
+
const imageTransition = document.querySelector('.background-image')
|
54
|
+
imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded")
|
55
|
+
imageTransition.classList.add(transition, "lazyload")
|
56
|
+
}
|
57
|
+
(transitionDropdown).addEventListener('change', function() {
|
58
|
+
updateTransition(option)
|
59
|
+
})
|
60
|
+
});
|
61
|
+
</script>
|
@@ -1,36 +1,79 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React, { useState } from 'react'
|
2
2
|
import { Background } from '../..'
|
3
|
-
import { Card, Flex, FlexItem, Title } from '../..'
|
3
|
+
import { Card, Flex, FlexItem, Select, Title } from '../..'
|
4
4
|
|
5
|
-
const BackgroundImage = (props) =>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
5
|
+
const BackgroundImage = (props) => {
|
6
|
+
const [transition, setTransition] = useState('')
|
7
|
+
|
8
|
+
const handleTransition = ({ target }) => {
|
9
|
+
setTransition(target.value)
|
10
|
+
}
|
11
|
+
|
12
|
+
const options = [
|
13
|
+
{
|
14
|
+
value: 'fade',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
value: 'blur',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
value: 'scale',
|
21
|
+
},
|
22
|
+
]
|
23
|
+
|
24
|
+
return (
|
25
|
+
<>
|
26
|
+
<Background
|
27
|
+
alt="colorful background"
|
28
|
+
className="background lazyload"
|
29
|
+
imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
|
30
|
+
transition={transition}
|
23
31
|
{...props}
|
24
32
|
>
|
25
|
-
<
|
26
|
-
|
33
|
+
<Flex
|
34
|
+
orientation="column"
|
35
|
+
vertical="center"
|
27
36
|
{...props}
|
28
37
|
>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
<FlexItem>
|
39
|
+
<Title
|
40
|
+
dark
|
41
|
+
padding="lg"
|
42
|
+
size={1}
|
43
|
+
text="Background Kit Image"
|
44
|
+
{...props}
|
45
|
+
/>
|
46
|
+
</FlexItem>
|
47
|
+
<FlexItem
|
48
|
+
padding="lg"
|
49
|
+
{...props}
|
50
|
+
>
|
51
|
+
<Card
|
52
|
+
shadow="deepest"
|
53
|
+
{...props}
|
54
|
+
>
|
55
|
+
{
|
56
|
+
'We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. - Cesar Chavez'
|
57
|
+
}
|
58
|
+
</Card>
|
59
|
+
</FlexItem>
|
60
|
+
</Flex>
|
61
|
+
</Background>
|
62
|
+
<Flex marginTop="xl">
|
63
|
+
<FlexItem fixedSize="250px">
|
64
|
+
<Select
|
65
|
+
blankSelection="Select a Transition..."
|
66
|
+
label=""
|
67
|
+
name="dropdown"
|
68
|
+
onChange={handleTransition}
|
69
|
+
options={options}
|
70
|
+
transition={transition}
|
71
|
+
{...props}
|
72
|
+
/>
|
73
|
+
</FlexItem>
|
74
|
+
</Flex>
|
75
|
+
</>
|
76
|
+
)
|
77
|
+
}
|
35
78
|
|
36
79
|
export default BackgroundImage
|
@@ -0,0 +1 @@
|
|
1
|
+
To add a lazyload on the background image simply use the `transition` prop and one of the three string options `"fade"`, `"blur"`, or `"scale"`.
|
@@ -3,11 +3,12 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
import pbChart from '../plugins/pb_chart'
|
8
8
|
|
9
9
|
type BarGraphProps = {
|
10
10
|
axisTitle: string,
|
11
|
+
dark?: Boolean,
|
11
12
|
xAxisCategories: array,
|
12
13
|
yAxisMin: number,
|
13
14
|
yAxisMax: number,
|
@@ -30,6 +31,7 @@ type BarGraphProps = {
|
|
30
31
|
export default class BarGraph extends React.Component<BarGraphProps> {
|
31
32
|
static defaultProps = {
|
32
33
|
className: 'pb_bar_graph',
|
34
|
+
dark: false,
|
33
35
|
type: 'column',
|
34
36
|
legend: false,
|
35
37
|
toggleLegendClick: true,
|
@@ -38,6 +40,7 @@ export default class BarGraph extends React.Component<BarGraphProps> {
|
|
38
40
|
componentDidMount() {
|
39
41
|
const {
|
40
42
|
axisTitle,
|
43
|
+
dark,
|
41
44
|
xAxisCategories,
|
42
45
|
yAxisMin,
|
43
46
|
yAxisMax,
|
@@ -56,6 +59,7 @@ export default class BarGraph extends React.Component<BarGraphProps> {
|
|
56
59
|
|
57
60
|
new pbChart(`.${className}`, {
|
58
61
|
axisTitle: axisTitle,
|
62
|
+
dark,
|
59
63
|
chartData: chartData,
|
60
64
|
colors: colors,
|
61
65
|
id: id,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
import Icon from '../pb_icon/_icon.jsx'
|
9
9
|
|
@@ -15,6 +15,7 @@ type ButtonPropTypes = {
|
|
15
15
|
data?: object,
|
16
16
|
disabled?: boolean,
|
17
17
|
fixedWidth?: boolean,
|
18
|
+
form?: string,
|
18
19
|
fullWidth?: boolean,
|
19
20
|
icon?: string,
|
20
21
|
id?: string,
|
@@ -22,7 +23,7 @@ type ButtonPropTypes = {
|
|
22
23
|
loading?: boolean,
|
23
24
|
newWindow?: boolean,
|
24
25
|
onClick?: EventHandler,
|
25
|
-
size
|
26
|
+
size?: 'sm' | 'md' | 'lg',
|
26
27
|
text?: string,
|
27
28
|
type: 'inline' | null,
|
28
29
|
htmlType: string | 'button',
|
@@ -36,19 +37,19 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
36
37
|
disabled = false,
|
37
38
|
fullWidth = false,
|
38
39
|
loading = false,
|
39
|
-
size = null,
|
40
40
|
type = 'inline',
|
41
41
|
variant = 'primary',
|
42
|
+
size = null,
|
42
43
|
} = props
|
43
44
|
|
44
45
|
let className = 'pb_button_kit'
|
45
46
|
|
46
47
|
className += `${variant !== null ? `_${variant}` : ''}`
|
47
48
|
className += `${type !== null ? `_${type}` : ''}`
|
48
|
-
className += `${size !== null ? `_${size}` : ''}`
|
49
49
|
className += `${fullWidth ? '_block' : ''}`
|
50
50
|
className += disabled ? '_disabled' : '_enabled'
|
51
51
|
className += loading ? '_loading' : ''
|
52
|
+
className += `${size !== null ? ` size_${size}` : ''}`
|
52
53
|
|
53
54
|
return className
|
54
55
|
}
|
@@ -69,6 +70,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
69
70
|
text,
|
70
71
|
htmlType = 'button',
|
71
72
|
value,
|
73
|
+
form = null
|
72
74
|
} = props
|
73
75
|
|
74
76
|
const ariaProps = buildAriaProps(aria)
|
@@ -106,6 +108,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
106
108
|
className={css}
|
107
109
|
href={link}
|
108
110
|
id={id}
|
111
|
+
rel="noreferrer"
|
109
112
|
role="link"
|
110
113
|
target={newWindow ? '_blank' : null}
|
111
114
|
>
|
@@ -118,6 +121,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
118
121
|
{...dataProps}
|
119
122
|
className={css}
|
120
123
|
disabled={disabled}
|
124
|
+
form={form}
|
121
125
|
id={id}
|
122
126
|
onClick={onClick}
|
123
127
|
role="button"
|
@@ -1,7 +1,24 @@
|
|
1
1
|
@import "./button_mixins";
|
2
2
|
|
3
|
-
|
3
|
+
$pb_button_sizes: (
|
4
|
+
"sm": 0.75rem,
|
5
|
+
"md": 0.875rem,
|
6
|
+
"lg": 1.125rem,
|
7
|
+
);
|
8
|
+
|
9
|
+
[class*=pb_button_kit]{
|
4
10
|
@include pb_button;
|
11
|
+
// Size =================
|
12
|
+
@each $name, $size in $pb_button_sizes {
|
13
|
+
&[class*=size_#{$name}] {
|
14
|
+
font-size: $size;
|
15
|
+
padding: calc(#{$size} / 2) calc(#{$size} * 2.42) !important;
|
16
|
+
@if $name == "sm" {
|
17
|
+
min-height: 0;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
5
22
|
// Variants =================
|
6
23
|
&[class*=_primary] {
|
7
24
|
@include pb_button_primary;
|
@@ -18,6 +18,10 @@ module Playbook
|
|
18
18
|
prop :text
|
19
19
|
prop :type
|
20
20
|
prop :value
|
21
|
+
prop :size, type: Playbook::Props::Enum,
|
22
|
+
values: ["sm", "md", "lg", nil],
|
23
|
+
default: nil
|
24
|
+
prop :form, default: nil
|
21
25
|
|
22
26
|
def options
|
23
27
|
{
|
@@ -29,6 +33,7 @@ module Playbook
|
|
29
33
|
role: "button",
|
30
34
|
type: type,
|
31
35
|
value: value,
|
36
|
+
form: form,
|
32
37
|
}.compact
|
33
38
|
end
|
34
39
|
|
@@ -44,12 +49,13 @@ module Playbook
|
|
44
49
|
link ? "a" : "button"
|
45
50
|
end
|
46
51
|
|
47
|
-
private
|
48
|
-
|
49
52
|
def classname
|
50
|
-
generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
53
|
+
button_class = generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
54
|
+
button_class + size_class
|
51
55
|
end
|
52
56
|
|
57
|
+
private
|
58
|
+
|
53
59
|
def disabled_class
|
54
60
|
disabled ? "disabled" : "enabled"
|
55
61
|
end
|
@@ -61,6 +67,10 @@ module Playbook
|
|
61
67
|
def loading_class
|
62
68
|
loading ? "loading" : nil
|
63
69
|
end
|
70
|
+
|
71
|
+
def size_class
|
72
|
+
size ? " size_#{size}" : ""
|
73
|
+
end
|
64
74
|
end
|
65
75
|
end
|
66
76
|
end
|
@@ -89,3 +89,16 @@ test('click event', async () => {
|
|
89
89
|
|
90
90
|
expect(screen.getByText('clicked button!')).toBeInTheDocument()
|
91
91
|
})
|
92
|
+
|
93
|
+
test('size prop', () => {
|
94
|
+
render(
|
95
|
+
<Button
|
96
|
+
data={{ testid: 'size-test' }}
|
97
|
+
size="sm"
|
98
|
+
/>
|
99
|
+
)
|
100
|
+
|
101
|
+
const kit = screen.getByTestId('size-test')
|
102
|
+
|
103
|
+
expect(kit).toHaveClass('pb_button_kit_primary_inline_enabled size_sm')
|
104
|
+
})
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, tag: "a", link: "http://google.com"
|
1
|
+
<%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "Go to Google"}, tag: "a", link: "http://google.com"}) %>
|