playbook_ui 10.19.0.pre.popover.alpha1 → 10.21.0.pre.alpha.jg1
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/pb_background/_background.jsx +7 -2
- 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_body/_body.jsx +3 -1
- data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +0 -17
- data/app/pb_kits/playbook/pb_button/button.rb +3 -6
- data/app/pb_kits/playbook/pb_button/button.test.js +0 -13
- data/app/pb_kits/playbook/pb_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -1
- data/app/pb_kits/playbook/pb_caption/_caption.scss +7 -0
- data/app/pb_kits/playbook/pb_caption/caption.rb +5 -2
- data/app/pb_kits/playbook/pb_date/_date.jsx +1 -1
- data/app/pb_kits/playbook/pb_date/date.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +3 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +10 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.html.erb +5 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.jsx +18 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss +127 -0
- data/app/pb_kits/playbook/pb_image/_image.jsx +12 -14
- data/app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb +1 -0
- data/app/pb_kits/playbook/pb_image/docs/_default_image.jsx +48 -35
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image.jsx +46 -35
- data/app/pb_kits/playbook/pb_legend/_legend.jsx +1 -7
- data/app/pb_kits/playbook/pb_legend/_legend.scss +6 -2
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.jsx +29 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.md +2 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_legend/docs/_legend_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_legend/docs/example.yml +4 -4
- data/app/pb_kits/playbook/pb_legend/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_legend/legend.rb +1 -2
- data/app/pb_kits/playbook/pb_legend/legend.test.js +29 -0
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +4 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/index.js +9 -4
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +6 -2
- data/app/pb_kits/playbook/pb_section_separator/_section_separator_mixin.scss +0 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -3
- data/app/pb_kits/playbook/pb_title/_title.jsx +2 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +2 -3
- data/app/pb_kits/playbook/pb_title/title.rb +5 -2
- data/lib/playbook/version.rb +2 -2
- metadata +11 -5
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +0 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +0 -26
- data/app/pb_kits/playbook/pb_button/docs/_button_size.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: 89c2b4d5b904ea641d5c4e5e1a436bdb70f5b8ad5292d6a9491f66dfba2406f2
|
4
|
+
data.tar.gz: 9246be8a7160010539031d1be35b247d9dc90a7f62f5cdfb7257785fdda564c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d2c607e9942698c68473dbf6c3a468a0db61f4bad82c992497df0784d272936bd038ac11914f3ec07e16523872c592212cee958f007856911d4b31fd11523c
|
7
|
+
data.tar.gz: fb7262bf896606e9f7a4e39673962702a1d187cb19557317f9848cc1e8844b9b29c0aed208c4bc8acceaaf81941b23c03f990d5f917b0398f4104311aa68d281
|
@@ -6,6 +6,7 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
6
6
|
import { globalProps } from '../utilities/globalProps.js'
|
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"`.
|
@@ -21,6 +21,7 @@ type BodyProps = {
|
|
21
21
|
status?: 'negative' | 'neutral' | 'positive',
|
22
22
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
|
23
23
|
text?: string,
|
24
|
+
variant: null | 'link',
|
24
25
|
}
|
25
26
|
|
26
27
|
const Body = (props: BodyProps) => {
|
@@ -36,12 +37,13 @@ const Body = (props: BodyProps) => {
|
|
36
37
|
status,
|
37
38
|
tag = 'div',
|
38
39
|
text,
|
40
|
+
variant = null,
|
39
41
|
} = props
|
40
42
|
|
41
43
|
const ariaProps = buildAriaProps(aria)
|
42
44
|
const dataProps = buildDataProps(data)
|
43
45
|
const classes = classnames(
|
44
|
-
buildCss('pb_body_kit', color, status),
|
46
|
+
buildCss('pb_body_kit', color, variant, status),
|
45
47
|
globalProps(props),
|
46
48
|
className
|
47
49
|
)
|
@@ -22,7 +22,7 @@ type ButtonPropTypes = {
|
|
22
22
|
loading?: boolean,
|
23
23
|
newWindow?: boolean,
|
24
24
|
onClick?: EventHandler,
|
25
|
-
size
|
25
|
+
size: 'large' | 'medium' | 'small',
|
26
26
|
text?: string,
|
27
27
|
type: 'inline' | null,
|
28
28
|
htmlType: string | 'button',
|
@@ -36,16 +36,16 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
36
36
|
disabled = false,
|
37
37
|
fullWidth = false,
|
38
38
|
loading = false,
|
39
|
+
size = null,
|
39
40
|
type = 'inline',
|
40
41
|
variant = 'primary',
|
41
|
-
size = null,
|
42
42
|
} = props
|
43
43
|
|
44
44
|
let className = 'pb_button_kit'
|
45
45
|
|
46
|
-
className += `${size !== null ? `_${size}` : ''}`
|
47
46
|
className += `${variant !== null ? `_${variant}` : ''}`
|
48
47
|
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' : ''
|
@@ -1,24 +1,7 @@
|
|
1
1
|
@import "./button_mixins";
|
2
2
|
|
3
|
-
$pb_button_sizes: (
|
4
|
-
"sm": 0.75rem,
|
5
|
-
"md": 0.875rem,
|
6
|
-
"lg": 1.125rem,
|
7
|
-
);
|
8
|
-
|
9
3
|
[class^=pb_button_kit]{
|
10
4
|
@include pb_button;
|
11
|
-
// Size =================
|
12
|
-
@each $name, $size in $pb_button_sizes {
|
13
|
-
&[class*=_#{$name}] {
|
14
|
-
font-size: $size;
|
15
|
-
padding: calc(#{$size} / 2) calc(#{$size} * 2.42) !important;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
&[class*=_sm] {
|
19
|
-
min-height: 0;
|
20
|
-
}
|
21
|
-
|
22
5
|
// Variants =================
|
23
6
|
&[class*=_primary] {
|
24
7
|
@include pb_button_primary;
|
@@ -18,9 +18,6 @@ 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
21
|
|
25
22
|
def options
|
26
23
|
{
|
@@ -47,12 +44,12 @@ module Playbook
|
|
47
44
|
link ? "a" : "button"
|
48
45
|
end
|
49
46
|
|
47
|
+
private
|
48
|
+
|
50
49
|
def classname
|
51
|
-
generate_classname("pb_button_kit",
|
50
|
+
generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
52
51
|
end
|
53
52
|
|
54
|
-
private
|
55
|
-
|
56
53
|
def disabled_class
|
57
54
|
disabled ? "disabled" : "enabled"
|
58
55
|
end
|
@@ -89,16 +89,3 @@ 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_sm_primary_inline_enabled')
|
104
|
-
})
|
@@ -7,7 +7,6 @@ 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
|
11
10
|
react:
|
12
11
|
- button_default: Button Variants
|
13
12
|
- button_full_width: Button Full Width
|
@@ -16,4 +15,3 @@ examples:
|
|
16
15
|
- button_block_content: Button Block Content
|
17
16
|
- button_accessibility: Button Accessibility Options
|
18
17
|
- button_options: Button Additional Options (onClick)
|
19
|
-
- button_size: Button Size
|
@@ -5,4 +5,3 @@ 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'
|
@@ -30,6 +30,7 @@ const Caption = (props: CaptionProps) => {
|
|
30
30
|
size = 'md',
|
31
31
|
tag = 'div',
|
32
32
|
text,
|
33
|
+
variant = null,
|
33
34
|
} = props
|
34
35
|
const tagOptions = [
|
35
36
|
'h1',
|
@@ -48,7 +49,7 @@ const Caption = (props: CaptionProps) => {
|
|
48
49
|
const ariaProps = buildAriaProps(aria)
|
49
50
|
const dataProps = buildDataProps(data)
|
50
51
|
const css = classnames(
|
51
|
-
buildCss('pb_caption_kit', size, color),
|
52
|
+
buildCss('pb_caption_kit', size, variant, color),
|
52
53
|
globalProps(props),
|
53
54
|
className,
|
54
55
|
)
|
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
[class^="pb_caption_kit"] {
|
5
5
|
@include caption;
|
6
|
+
&[class*="_link"] {
|
7
|
+
color: $primary;
|
8
|
+
}
|
6
9
|
|
7
10
|
&[class^="pb_caption_kit_lg"] {
|
8
11
|
@include caption_lg;
|
@@ -11,6 +14,10 @@
|
|
11
14
|
&[class^="pb_caption_kit_xs"] {
|
12
15
|
@include caption_xs;
|
13
16
|
}
|
17
|
+
|
18
|
+
&[class*="link"] {
|
19
|
+
color: $primary;
|
20
|
+
}
|
14
21
|
|
15
22
|
@include pb_caption_kit_colors;
|
16
23
|
|
@@ -10,14 +10,17 @@ module Playbook
|
|
10
10
|
values: %w[h1 h2 h3 h4 h5 h6 p span div caption],
|
11
11
|
default: "div"
|
12
12
|
prop :text
|
13
|
-
prop :variant,
|
13
|
+
prop :variant, type: Playbook::Props::Enum,
|
14
|
+
values: [nil, "link"],
|
15
|
+
default: nil,
|
16
|
+
deprecated: true
|
14
17
|
|
15
18
|
prop :color, type: Playbook::Props::Enum,
|
16
19
|
values: [nil, "default", "light", "lighter", "success", "error", "link"],
|
17
20
|
default: nil
|
18
21
|
|
19
22
|
def classname
|
20
|
-
generate_classname("pb_caption_kit", size, color)
|
23
|
+
generate_classname("pb_caption_kit", size, variant, color)
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
@@ -42,7 +42,7 @@
|
|
42
42
|
<%= pb_rails("caption", props: {
|
43
43
|
tag: "div",
|
44
44
|
}) do %>
|
45
|
-
<%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true, size:
|
45
|
+
<%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true, size: "sm" }) %>
|
46
46
|
<% end %>
|
47
47
|
<% end %>
|
48
48
|
|
@@ -40,6 +40,7 @@ type DatePickerProps = {
|
|
40
40
|
onChange: (String) => void,
|
41
41
|
pickerId?: String,
|
42
42
|
placeholder?: String,
|
43
|
+
plugins?: Boolean,
|
43
44
|
type?: String,
|
44
45
|
yearRange?: Array,
|
45
46
|
}
|
@@ -73,6 +74,7 @@ const DatePicker = (props: DatePickerProps) => {
|
|
73
74
|
onChange = () => {},
|
74
75
|
pickerId,
|
75
76
|
placeholder = 'Select Date',
|
77
|
+
plugins = false,
|
76
78
|
yearRange = [ 1900, 2100 ],
|
77
79
|
} = props
|
78
80
|
|
@@ -100,6 +102,7 @@ const DatePicker = (props: DatePickerProps) => {
|
|
100
102
|
mode: mode,
|
101
103
|
onChange: onChange,
|
102
104
|
pickerId: pickerId,
|
105
|
+
plugins: plugins,
|
103
106
|
yearRange: yearRange,
|
104
107
|
})
|
105
108
|
}, [])
|
@@ -41,6 +41,8 @@ module Playbook
|
|
41
41
|
required: true
|
42
42
|
prop :placeholder, type: Playbook::Props::String,
|
43
43
|
default: "Select Date"
|
44
|
+
prop :plugins, type: Playbook::Props::Boolean,
|
45
|
+
default: false
|
44
46
|
prop :required, type: Playbook::Props::Boolean,
|
45
47
|
default: false
|
46
48
|
prop :year_range, type: Playbook::Props::Array,
|
@@ -64,6 +66,7 @@ module Playbook
|
|
64
66
|
minDate: min_date,
|
65
67
|
mode: mode,
|
66
68
|
pickerId: picker_id,
|
69
|
+
plugins: plugins,
|
67
70
|
required: required,
|
68
71
|
yearRange: year_range,
|
69
72
|
}.to_json.html_safe
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import flatpickr from 'flatpickr'
|
2
|
+
import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'
|
2
3
|
|
3
4
|
const datePickerHelper = (config) => {
|
4
5
|
const {
|
@@ -13,6 +14,7 @@ const datePickerHelper = (config) => {
|
|
13
14
|
mode,
|
14
15
|
onChange = () => {},
|
15
16
|
pickerId,
|
17
|
+
plugins,
|
16
18
|
required,
|
17
19
|
yearRange,
|
18
20
|
} = config
|
@@ -50,6 +52,10 @@ const datePickerHelper = (config) => {
|
|
50
52
|
}
|
51
53
|
}
|
52
54
|
|
55
|
+
const setMonthAndYearPlugin = () => (
|
56
|
+
plugins ? [ monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }) ] : []
|
57
|
+
)
|
58
|
+
|
53
59
|
// ===========================================================
|
54
60
|
// | Flatpickr initializer w/ config |
|
55
61
|
// ===========================================================
|
@@ -97,6 +103,7 @@ const datePickerHelper = (config) => {
|
|
97
103
|
onYearChange: [() => {
|
98
104
|
yearChangeHook()
|
99
105
|
}],
|
106
|
+
plugins: setMonthAndYearPlugin(),
|
100
107
|
prevArrow: '<i class="far fa-angle-left"></i>',
|
101
108
|
static: true,
|
102
109
|
})
|
@@ -153,8 +160,10 @@ const datePickerHelper = (config) => {
|
|
153
160
|
}
|
154
161
|
|
155
162
|
// Adding dropdown icons to year and month selects
|
156
|
-
picker.monthElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down month-dropdown-icon"></i>')
|
157
163
|
dropdown.insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
|
164
|
+
if (picker.monthElements[0].parentElement) {
|
165
|
+
return picker.monthElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down month-dropdown-icon"></i>')
|
166
|
+
}
|
158
167
|
|
159
168
|
// Remove readonly attribute for validation and or text input
|
160
169
|
if (allowInput){
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import DatePicker from '../_date_picker'
|
4
|
+
|
5
|
+
const DatePickerMonthAndYear = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<DatePicker
|
9
|
+
label="Date Picker"
|
10
|
+
pickerId="disabled-date"
|
11
|
+
plugins
|
12
|
+
{...props}
|
13
|
+
/>
|
14
|
+
</div>
|
15
|
+
)
|
16
|
+
}
|
17
|
+
|
18
|
+
export default DatePickerMonthAndYear
|
@@ -0,0 +1 @@
|
|
1
|
+
By default month&year plugin is disabled. To activate it set `plugins` prop to `true`. If you're using React just pass a `plugins` prop to the kit.
|
@@ -16,6 +16,7 @@ examples:
|
|
16
16
|
- date_picker_year_range: Year Range
|
17
17
|
- date_picker_anti_patterns: Anti-Patterns
|
18
18
|
- date_picker_inline: Inline
|
19
|
+
- date_picker_month_and_year: Month & Year Only
|
19
20
|
|
20
21
|
|
21
22
|
react:
|
@@ -34,3 +35,4 @@ examples:
|
|
34
35
|
- date_picker_hooks: Hooks
|
35
36
|
- date_picker_year_range: Year Range
|
36
37
|
- date_picker_inline: Inline
|
38
|
+
- date_picker_month_and_year: Month & Year Only
|
@@ -13,3 +13,4 @@ export { default as DatePickerHooks } from './_date_picker_hooks.jsx'
|
|
13
13
|
export { default as DatePickerFlatpickrMethods } from './_date_picker_flatpickr_methods.jsx'
|
14
14
|
export { default as DatePickerYearRange } from './_date_picker_year_range.jsx'
|
15
15
|
export { default as DatePickerInline } from './_date_picker_inline.jsx'
|
16
|
+
export { default as DatePickerMonthAndYear } from './_date_picker_month_and_year.jsx'
|