playbook_ui 10.21.0.pre.alpha.jg1 → 10.21.0.pre.alpha.lightbox
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_avatar/_avatar.jsx +1 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
- 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_background/_background.jsx +2 -7
- data/app/pb_kits/playbook/pb_background/_background.scss +8 -24
- data/app/pb_kits/playbook/pb_background/background.rb +6 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +2 -50
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +28 -71
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +4 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
- data/app/pb_kits/playbook/pb_button/button.rb +11 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -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 +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- 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_dashboard/pbChartsDarkTheme.js +215 -0
- 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_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
- data/app/pb_kits/playbook/pb_image/_image.jsx +1 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
- 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_lightbox/Carousel/Slide.jsx +55 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.jsx +54 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.jsx +39 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.jsx +82 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/index.jsx +59 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/styles.scss +110 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/useSlides.js +66 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.jsx +112 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox_context.jsx +3 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox_header.jsx +71 -0
- data/app/pb_kits/playbook/pb_lightbox/_lightbox_header_icon.jsx +26 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.jsx +95 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +64 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.md +1 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +64 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/index.js +3 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +21 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useWindowSize.js +25 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +90 -0
- data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +4 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -4
- 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_rich_text_editor/_rich_text_editor.jsx +4 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +2 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
- data/lib/playbook/version.rb +2 -2
- metadata +28 -3
- data/app/pb_kits/playbook/pb_background/docs/_background_image.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c75501fe979ac41342124f523c7746d81bdab2ece4c13d8a9b3fc8808c5c445
|
4
|
+
data.tar.gz: 63f5a9fc07a22b4e1ca25819e3db56e20927f073f6774bde288a38110694227a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df78b95db1bf1cc80316580d79d38b5d96e02f8161d9b67dfb8d7195894e9f27c2eceb132920d56c21a924082fedb48bc86df78a15f941941587c8ab60d81c6b
|
7
|
+
data.tar.gz: 6f39130d39966ff49e67d5ad511e4c0447b767de0ded3fa22da749802a5552d2102cbb6e01b7f5cb8d05f3717ae35ad6b4acfb47e0598a6c69bc06135df18fe0
|
@@ -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'
|
@@ -55,6 +54,7 @@ export { default as Layout } from './pb_layout/_layout'
|
|
55
54
|
export { default as Legend } from './pb_legend/_legend'
|
56
55
|
export { default as LineGraph } from './pb_line_graph/_line_graph'
|
57
56
|
export { default as List } from './pb_list/_list'
|
57
|
+
export { default as Lightbox } from './pb_lightbox/_lightbox'
|
58
58
|
export { default as ListItem } from './pb_list/_list_item'
|
59
59
|
export { default as LoadingInline } from './pb_loading_inline/_loading_inline'
|
60
60
|
export { default as Message } from './pb_message/_message'
|
@@ -101,6 +101,7 @@ export { default as Toggle } from './pb_toggle/_toggle'
|
|
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
|
|
@@ -44,7 +44,7 @@ const Avatar = (props: AvatarProps) => {
|
|
44
44
|
const dataProps = buildDataProps(data)
|
45
45
|
const ariaProps = buildAriaProps(aria)
|
46
46
|
const classes = classnames(
|
47
|
-
buildCss('pb_avatar_kit', size),
|
47
|
+
buildCss('pb_avatar_kit', `size_${size}`),
|
48
48
|
globalProps(props),
|
49
49
|
className
|
50
50
|
)
|
@@ -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;
|
@@ -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)
|
@@ -6,7 +6,6 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
6
6
|
import { globalProps } from '../utilities/globalProps.js'
|
7
7
|
|
8
8
|
type BackgroundProps = {
|
9
|
-
alt?: string,
|
10
9
|
aria?: object,
|
11
10
|
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
11
|
children?: array<React.ReactNode> | React.ReactNode,
|
@@ -16,12 +15,10 @@ type BackgroundProps = {
|
|
16
15
|
imageUrl?: string,
|
17
16
|
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
18
17
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
|
19
|
-
transition?: 'fade' | 'blur' | 'scale',
|
20
18
|
}
|
21
19
|
|
22
20
|
const Background = (props: BackgroundProps) => {
|
23
21
|
const {
|
24
|
-
alt = '',
|
25
22
|
aria = {},
|
26
23
|
backgroundColor = 'light',
|
27
24
|
children,
|
@@ -30,24 +27,22 @@ const Background = (props: BackgroundProps) => {
|
|
30
27
|
id,
|
31
28
|
imageUrl = '',
|
32
29
|
tag = 'div',
|
33
|
-
transition = '',
|
34
30
|
} = props
|
35
31
|
|
36
32
|
const ariaProps = buildAriaProps(aria)
|
37
33
|
const dataProps = buildDataProps(data)
|
38
34
|
|
35
|
+
const classes = classnames(buildCss('pb_background_kit'), globalProps(props), `pb_background_color_${backgroundColor}`, className)
|
36
|
+
const Tag = `${tag}`
|
39
37
|
const backgroundStyle = {
|
40
38
|
backgroundImage: `url(${imageUrl})`,
|
41
39
|
backgroundSize: 'cover',
|
42
40
|
}
|
43
|
-
const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), `pb_background_color_${backgroundColor}`, className)
|
44
|
-
const Tag = `${tag}`
|
45
41
|
|
46
42
|
return (
|
47
43
|
<>
|
48
44
|
<If condition={imageUrl}>
|
49
45
|
<Tag
|
50
|
-
alt={alt}
|
51
46
|
style={backgroundStyle}
|
52
47
|
{...ariaProps}
|
53
48
|
{...dataProps}
|
@@ -22,30 +22,14 @@ $background_colors: map-merge($additional_colors, $merge_kits2);
|
|
22
22
|
}
|
23
23
|
};
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
transition: opacity 400ms ease-in;
|
30
|
-
}
|
31
|
-
}
|
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
|
-
}
|
25
|
+
.blur_up {
|
26
|
+
-webkit-filter: blur(6px);
|
27
|
+
filter: blur(6px);
|
28
|
+
transition: filter 550ms, -webkit-filter 550ms;
|
40
29
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
&.lazyloaded {
|
46
|
-
opacity: 1;
|
47
|
-
transform: scale(1);
|
48
|
-
transition: 700ms ease-in;
|
49
|
-
}
|
30
|
+
|
31
|
+
.blur_up.lazyloaded {
|
32
|
+
-webkit-filter: blur(0);
|
33
|
+
filter: blur(0);
|
50
34
|
}
|
51
35
|
}
|
@@ -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
|
-
|
19
15
|
def classname
|
20
|
-
generate_classname("pb_background_kit", image_classname, separator: " ")
|
16
|
+
generate_classname("pb_background_kit", image_classname, background_color_classname, separator: " ")
|
21
17
|
end
|
22
18
|
|
23
19
|
private
|
24
20
|
|
25
21
|
def image_classname
|
26
|
-
image_url.present? ? "lazyload
|
22
|
+
image_url.present? ? "lazyload blur_up" : ""
|
23
|
+
end
|
24
|
+
|
25
|
+
def background_color_classname
|
26
|
+
!image_url.present? ? "pb_background_color_#{background_color}" : ""
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= pb_rails("background", props: {
|
2
|
-
<%= pb_rails("flex", props: { horizontal: "center", orientation: "column"
|
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 %>
|
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,51 +11,3 @@
|
|
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,79 +1,36 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
import { Background } from '../..'
|
3
|
-
import { Card, Flex, FlexItem,
|
3
|
+
import { Card, Flex, FlexItem, 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
|
-
|
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}
|
5
|
+
const BackgroundImage = (props) => (
|
6
|
+
<Background imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80">
|
7
|
+
<Flex
|
8
|
+
orientation="column"
|
9
|
+
vertical="center"
|
10
|
+
{...props}
|
11
|
+
>
|
12
|
+
<FlexItem>
|
13
|
+
<Title
|
14
|
+
dark
|
15
|
+
padding="lg"
|
16
|
+
size={1}
|
17
|
+
text="Background Kit Image"
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
</FlexItem>
|
21
|
+
<FlexItem
|
22
|
+
padding="lg"
|
31
23
|
{...props}
|
32
24
|
>
|
33
|
-
<
|
34
|
-
|
35
|
-
vertical="center"
|
25
|
+
<Card
|
26
|
+
shadow="deepest"
|
36
27
|
{...props}
|
37
28
|
>
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
}
|
29
|
+
{'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'}
|
30
|
+
</Card>
|
31
|
+
</FlexItem>
|
32
|
+
</Flex>
|
33
|
+
</Background>
|
34
|
+
)
|
78
35
|
|
79
36
|
export default BackgroundImage
|
@@ -8,6 +8,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,
|
@@ -22,7 +22,7 @@ type ButtonPropTypes = {
|
|
22
22
|
loading?: boolean,
|
23
23
|
newWindow?: boolean,
|
24
24
|
onClick?: EventHandler,
|
25
|
-
size
|
25
|
+
size?: 'sm' | 'md' | 'lg',
|
26
26
|
text?: string,
|
27
27
|
type: 'inline' | null,
|
28
28
|
htmlType: string | 'button',
|
@@ -36,19 +36,19 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
36
36
|
disabled = false,
|
37
37
|
fullWidth = false,
|
38
38
|
loading = false,
|
39
|
-
size = null,
|
40
39
|
type = 'inline',
|
41
40
|
variant = 'primary',
|
41
|
+
size = null,
|
42
42
|
} = props
|
43
43
|
|
44
44
|
let className = 'pb_button_kit'
|
45
45
|
|
46
46
|
className += `${variant !== null ? `_${variant}` : ''}`
|
47
47
|
className += `${type !== null ? `_${type}` : ''}`
|
48
|
-
className += `${size !== null ? `_${size}` : ''}`
|
49
48
|
className += `${fullWidth ? '_block' : ''}`
|
50
49
|
className += disabled ? '_disabled' : '_enabled'
|
51
50
|
className += loading ? '_loading' : ''
|
51
|
+
className += `${size !== null ? ` size_${size}` : ''}`
|
52
52
|
|
53
53
|
return className
|
54
54
|
}
|
@@ -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
|
+
}
|
17
|
+
@if $name == "sm" {
|
18
|
+
min-height: 0;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
5
22
|
// Variants =================
|
6
23
|
&[class*=_primary] {
|
7
24
|
@include pb_button_primary;
|
@@ -18,6 +18,9 @@ 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
|
21
24
|
|
22
25
|
def options
|
23
26
|
{
|
@@ -44,12 +47,13 @@ module Playbook
|
|
44
47
|
link ? "a" : "button"
|
45
48
|
end
|
46
49
|
|
47
|
-
private
|
48
|
-
|
49
50
|
def classname
|
50
|
-
generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
51
|
+
button_class = generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
52
|
+
button_class + size_class
|
51
53
|
end
|
52
54
|
|
55
|
+
private
|
56
|
+
|
53
57
|
def disabled_class
|
54
58
|
disabled ? "disabled" : "enabled"
|
55
59
|
end
|
@@ -61,6 +65,10 @@ module Playbook
|
|
61
65
|
def loading_class
|
62
66
|
loading ? "loading" : nil
|
63
67
|
end
|
68
|
+
|
69
|
+
def size_class
|
70
|
+
size ? " size_#{size}" : ""
|
71
|
+
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
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
|
+
})
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Button } from '../../'
|
3
|
+
|
4
|
+
const ButtonSize = (props) => (
|
5
|
+
<div>
|
6
|
+
<Button
|
7
|
+
size="sm"
|
8
|
+
text="Button sm size"
|
9
|
+
{...props}
|
10
|
+
/>
|
11
|
+
{' '}
|
12
|
+
<Button
|
13
|
+
size="md"
|
14
|
+
text="Button md size"
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
{' '}
|
18
|
+
<Button
|
19
|
+
size="lg"
|
20
|
+
text="Button lg size"
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
</div>
|
24
|
+
)
|
25
|
+
|
26
|
+
export default ButtonSize
|
@@ -0,0 +1 @@
|
|
1
|
+
By default button has the `md` size style, even if you don't explicitly pass a size prop.
|
@@ -7,6 +7,7 @@ examples:
|
|
7
7
|
- button_block_content: Button Block Content
|
8
8
|
- button_accessibility: Button Accessibility Options
|
9
9
|
- button_options: Button Additional Options
|
10
|
+
- button_size: Button Size
|
10
11
|
react:
|
11
12
|
- button_default: Button Variants
|
12
13
|
- button_full_width: Button Full Width
|
@@ -15,3 +16,4 @@ examples:
|
|
15
16
|
- button_block_content: Button Block Content
|
16
17
|
- button_accessibility: Button Accessibility Options
|
17
18
|
- button_options: Button Additional Options (onClick)
|
19
|
+
- button_size: Button Size
|
@@ -5,3 +5,4 @@ export { default as ButtonLoading } from './_button_loading.jsx'
|
|
5
5
|
export { default as ButtonBlockContent } from './_button_block_content.jsx'
|
6
6
|
export { default as ButtonAccessibility } from './_button_accessibility.jsx'
|
7
7
|
export { default as ButtonOptions } from './_button_options.jsx'
|
8
|
+
export { default as ButtonSize } from './_button_size.jsx'
|
@@ -14,6 +14,7 @@ type CircleChartProps = {
|
|
14
14
|
children: Node,
|
15
15
|
className?: string,
|
16
16
|
colors: array,
|
17
|
+
dark?: Boolean,
|
17
18
|
data?: Object,
|
18
19
|
dataLabelHtml: string,
|
19
20
|
dataLabels: boolean,
|
@@ -40,6 +41,7 @@ const CircleChart = (props: CircleChartProps) => {
|
|
40
41
|
children,
|
41
42
|
className,
|
42
43
|
colors = [],
|
44
|
+
dark = false,
|
43
45
|
data = {},
|
44
46
|
dataLabelHtml = '<div>{point.name}</div>',
|
45
47
|
dataLabels = false,
|
@@ -81,6 +83,7 @@ const CircleChart = (props: CircleChartProps) => {
|
|
81
83
|
borderColor: roundedBorderColor,
|
82
84
|
borderWidth: roundedBorderWidth,
|
83
85
|
chartData: formattedChartData,
|
86
|
+
dark,
|
84
87
|
title,
|
85
88
|
type: style,
|
86
89
|
showInLegend: legend,
|