playbook_ui 10.18.1 → 10.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +2 -1
- data/app/pb_kits/playbook/pb_body/body.rb +1 -1
- data/app/pb_kits/playbook/pb_body/body.test.js +29 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +5 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_light.md +6 -0
- 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 +6 -6
- data/app/pb_kits/playbook/pb_caption/_caption.scss +6 -17
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +13 -3
- data/app/pb_kits/playbook/pb_caption/caption.rb +3 -5
- data/app/pb_kits/playbook/pb_caption/caption.test.js +29 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.html.erb +3 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.jsx +25 -0
- data/app/pb_kits/playbook/pb_caption/docs/_caption_colors.md +6 -0
- data/app/pb_kits/playbook/pb_caption/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -2
- 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_nav/_bold_mixin.scss +22 -0
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +17 -1
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +9 -2
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_horizontal_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_bold_vertical_nav.jsx +39 -0
- data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_nav/nav.rb +1 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +3 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +1 -0
- 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 +62 -13
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +21 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.jsx +12 -3
- data/app/pb_kits/playbook/pb_title/_title.jsx +6 -4
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +17 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.jsx +37 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_colors.md +6 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light.md +3 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +2 -3
- data/app/pb_kits/playbook/pb_title/title.rb +5 -4
- data/app/pb_kits/playbook/pb_title/title.test.js +29 -0
- data/app/pb_kits/playbook/utilities/_line_height.scss +11 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +7 -1
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/line_height.rb +29 -0
- data/lib/playbook/version.rb +1 -1
- metadata +28 -14
- 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
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.html.erb +0 -3
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.jsx +0 -27
- data/app/pb_kits/playbook/pb_caption/docs/_caption_example.md +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.jsx +0 -17
- data/app/pb_kits/playbook/pb_caption/docs/_caption_variants.md +0 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.html.erb +0 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.jsx +0 -19
- data/app/pb_kits/playbook/pb_title/docs/_title_variants.md +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aee1f2c048d8521387c720ec1de805f4b141ac36d596a51cd785cda18964425
|
4
|
+
data.tar.gz: c66e833a6eae63f445b75cb3c89845a9096e57c45771c085102d1f2ee1b5dac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e232f695466a3fa606ef20b3416d2c4684e613ae6a278c3d7c957e502dcebecb6ad28109db1422a89928451bee0df24728d2e0bdfc30143ca5422e314bfc6c45
|
7
|
+
data.tar.gz: 45904dac97847a942877f532d363552702f762bee32c97e096a346efeb32d0fb8e55e7fc7b81ebcf767a0fb1b95ec722669eb989fe85b7f4f13606d130e2a16a
|
@@ -12,7 +12,7 @@ type BodyProps = {
|
|
12
12
|
aria?: object,
|
13
13
|
className?: string,
|
14
14
|
children?: array<React.ReactChild>,
|
15
|
-
color?: 'default' | 'light' | 'lighter',
|
15
|
+
color?: 'default' | 'light' | 'lighter' | 'link',
|
16
16
|
dark?: boolean,
|
17
17
|
data?: object,
|
18
18
|
highlightedText?: array<string>,
|
@@ -6,6 +6,7 @@ $pb_body_colors: (
|
|
6
6
|
default: $text_lt_default,
|
7
7
|
light: $text_lt_light,
|
8
8
|
lighter: $text_lt_lighter,
|
9
|
+
link: $primary,
|
9
10
|
);
|
10
11
|
|
11
12
|
$pb_dark_body_colors: (
|
@@ -63,4 +64,4 @@ $pb_body_status: (
|
|
63
64
|
|
64
65
|
@mixin pb_body_positive {
|
65
66
|
@include pb_body($success);
|
66
|
-
}
|
67
|
+
}
|
@@ -4,7 +4,7 @@ module Playbook
|
|
4
4
|
module PbBody
|
5
5
|
class Body < Playbook::KitBase
|
6
6
|
prop :color, type: Playbook::Props::Enum,
|
7
|
-
values: %w[default light lighter],
|
7
|
+
values: %w[default light lighter link],
|
8
8
|
default: "default"
|
9
9
|
prop :status, type: Playbook::Props::Enum,
|
10
10
|
values: %w[neutral negative positive],
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Body from './_body'
|
5
|
+
|
6
|
+
test('returns namespaced class name', () => {
|
7
|
+
render(
|
8
|
+
<Body
|
9
|
+
data={{ testid: 'primary-test' }}
|
10
|
+
text="Test colors"
|
11
|
+
/>
|
12
|
+
)
|
13
|
+
|
14
|
+
const kit = screen.getByTestId('primary-test')
|
15
|
+
expect(kit).toHaveClass('pb_body_kit')
|
16
|
+
})
|
17
|
+
|
18
|
+
test('with colors', () => {
|
19
|
+
render(
|
20
|
+
<Body
|
21
|
+
color="success"
|
22
|
+
data={{ testid: 'primary-test' }}
|
23
|
+
text="Test colors"
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
const kit = screen.getByTestId('primary-test')
|
28
|
+
expect(kit).toHaveClass('pb_body_kit_success')
|
29
|
+
})
|
@@ -0,0 +1,6 @@
|
|
1
|
+
##### Prop
|
2
|
+
This kit uses `default` color by default, and can be replaced with colors below:
|
3
|
+
|
4
|
+
* `light` `lighter` `success` `error` `link`
|
5
|
+
|
6
|
+
- These colors are not for standard usage. You can use the color prop to make fixes if colors are not appearing properly, but consult your UX team members if you are deciding to implement it
|
@@ -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'
|
@@ -3,33 +3,33 @@
|
|
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.js'
|
6
|
+
import { deprecatedProps, globalProps } from '../utilities/globalProps.js'
|
7
7
|
|
8
8
|
type CaptionProps = {
|
9
9
|
aria?: object,
|
10
|
-
className?: string,
|
11
10
|
children: array<React.ReactNode> | React.ReactNode,
|
11
|
+
className?: string,
|
12
|
+
color?: "default" | "light" | "lighter" | "success" | "error" | "link",
|
12
13
|
data?: object,
|
13
14
|
id?: string,
|
14
15
|
size?: "xs" | "sm" | "md" | "lg" | "xl",
|
15
16
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div" | "caption",
|
16
17
|
text?: string,
|
17
18
|
variant?: null | "link",
|
18
|
-
color?: "default" | "link" | "light",
|
19
19
|
};
|
20
20
|
|
21
21
|
const Caption = (props: CaptionProps) => {
|
22
|
+
if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
|
22
23
|
const {
|
23
24
|
aria = {},
|
24
|
-
className,
|
25
25
|
children,
|
26
|
+
className,
|
26
27
|
color,
|
27
28
|
data = {},
|
28
29
|
id,
|
29
30
|
size = 'md',
|
30
31
|
tag = 'div',
|
31
32
|
text,
|
32
|
-
variant = null,
|
33
33
|
} = props
|
34
34
|
const tagOptions = [
|
35
35
|
'h1',
|
@@ -48,7 +48,7 @@ const Caption = (props: CaptionProps) => {
|
|
48
48
|
const ariaProps = buildAriaProps(aria)
|
49
49
|
const dataProps = buildDataProps(data)
|
50
50
|
const css = classnames(
|
51
|
-
buildCss('pb_caption_kit', size,
|
51
|
+
buildCss('pb_caption_kit', size, color),
|
52
52
|
globalProps(props),
|
53
53
|
className,
|
54
54
|
)
|
@@ -10,26 +10,15 @@
|
|
10
10
|
|
11
11
|
&[class^="pb_caption_kit_xs"] {
|
12
12
|
@include caption_xs;
|
13
|
-
&[class*="_link"] {
|
14
|
-
color: $primary;}
|
15
13
|
}
|
16
14
|
|
17
|
-
|
18
|
-
color: $text_lt_light;
|
19
|
-
}
|
20
|
-
|
21
|
-
&[class*="default"] {
|
22
|
-
color: $text_lt_default;
|
23
|
-
}
|
24
|
-
|
25
|
-
&[class*="link"] {
|
26
|
-
color: $primary;
|
27
|
-
}
|
15
|
+
@include pb_caption_kit_colors;
|
28
16
|
|
29
|
-
|
30
|
-
@
|
31
|
-
|
32
|
-
|
17
|
+
&.dark {
|
18
|
+
@include caption_dark;
|
19
|
+
@each $name, $color in $pb_dark_caption_colors {
|
20
|
+
&[class*="_#{$name}"] {
|
21
|
+
color: $color;
|
33
22
|
}
|
34
23
|
}
|
35
24
|
}
|
@@ -4,13 +4,16 @@
|
|
4
4
|
$pb_caption_colors: (
|
5
5
|
default: $text_lt_default,
|
6
6
|
light: $text_lt_light,
|
7
|
-
link: $primary
|
7
|
+
link: $primary,
|
8
|
+
lighter: $text_lt_lighter,
|
9
|
+
success: $success,
|
10
|
+
error: $error,
|
8
11
|
);
|
9
12
|
|
10
13
|
$pb_dark_caption_colors: (
|
11
|
-
default:
|
14
|
+
default: $text_dk_default,
|
12
15
|
light: $text_dk_light,
|
13
|
-
link: $primary
|
16
|
+
link: $primary,
|
14
17
|
);
|
15
18
|
|
16
19
|
|
@@ -39,3 +42,10 @@ $pb_dark_caption_colors: (
|
|
39
42
|
@mixin caption_dark {
|
40
43
|
color: $text_dk_light;
|
41
44
|
}
|
45
|
+
@mixin pb_caption_kit_colors {
|
46
|
+
@each $name, $color in $pb_caption_colors {
|
47
|
+
&[class*="#{$name}"] {
|
48
|
+
color: $color
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
@@ -10,16 +10,14 @@ 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,
|
14
|
-
values: [nil, "link"],
|
15
|
-
default: nil
|
13
|
+
prop :variant, deprecated: true
|
16
14
|
|
17
15
|
prop :color, type: Playbook::Props::Enum,
|
18
|
-
values: [nil, "light", "
|
16
|
+
values: [nil, "default", "light", "lighter", "success", "error", "link"],
|
19
17
|
default: nil
|
20
18
|
|
21
19
|
def classname
|
22
|
-
generate_classname("pb_caption_kit", size,
|
20
|
+
generate_classname("pb_caption_kit", size, color)
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Caption from './_caption'
|
5
|
+
|
6
|
+
test('returns namespaced class name', () => {
|
7
|
+
render(
|
8
|
+
<Caption
|
9
|
+
data={{ testid: 'primary-test' }}
|
10
|
+
text="Test colors"
|
11
|
+
/>
|
12
|
+
)
|
13
|
+
|
14
|
+
const kit = screen.getByTestId('primary-test')
|
15
|
+
expect(kit).toHaveClass('pb_caption_kit_md')
|
16
|
+
})
|
17
|
+
|
18
|
+
test('with colors', () => {
|
19
|
+
render(
|
20
|
+
<Caption
|
21
|
+
color="success"
|
22
|
+
data={{ testid: 'primary-test' }}
|
23
|
+
text="Test colors"
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
const kit = screen.getByTestId('primary-test')
|
28
|
+
expect(kit).toHaveClass('pb_caption_kit_md_success')
|
29
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Caption } from '../../'
|
3
|
+
|
4
|
+
const CaptionColors = (props) => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<Caption
|
8
|
+
text="Test colors"
|
9
|
+
{...props}
|
10
|
+
/>
|
11
|
+
<Caption
|
12
|
+
color="success"
|
13
|
+
text="Test colors"
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
<Caption
|
17
|
+
color="link"
|
18
|
+
text="Test colors"
|
19
|
+
{...props}
|
20
|
+
/>
|
21
|
+
</div>
|
22
|
+
)
|
23
|
+
}
|
24
|
+
|
25
|
+
export default CaptionColors
|
@@ -0,0 +1,6 @@
|
|
1
|
+
##### Prop
|
2
|
+
Caption kit will use `light` color by default. Other available colors are:
|
3
|
+
|
4
|
+
* `default` `lighter` `success` `error` `link`
|
5
|
+
|
6
|
+
- These colors are not for standard usage. You can use the color prop to make fixes if colors are not appearing properly, but consult your UX team members if you are deciding to implement it
|
@@ -2,9 +2,9 @@ examples:
|
|
2
2
|
rails:
|
3
3
|
- caption_light: Default
|
4
4
|
- caption_block: Block
|
5
|
-
-
|
5
|
+
- caption_colors: Colors
|
6
6
|
|
7
7
|
react:
|
8
8
|
- caption_light: Default
|
9
9
|
- caption_block: Block
|
10
|
-
-
|
10
|
+
- caption_colors: Colors
|
@@ -1,4 +1,3 @@
|
|
1
1
|
export { default as CaptionLight } from './_caption_light.jsx'
|
2
|
-
export { default as
|
2
|
+
export { default as CaptionColors } from './_caption_colors.jsx'
|
3
3
|
export { default as CaptionBlock } from './_caption_block.jsx'
|
4
|
-
export { default as CaptionExample } from './_caption_example.jsx'
|
@@ -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'
|