playbook_ui 10.18.2 → 10.20.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 +4 -2
- 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_caption/_caption.jsx +5 -4
- data/app/pb_kits/playbook/pb_caption/_caption.scss +11 -15
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +13 -3
- data/app/pb_kits/playbook/pb_caption/caption.rb +3 -2
- 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/_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_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 -3
- 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 +6 -2
- 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 +2 -2
- metadata +28 -11
- 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: 58801952abf6ff0d0a76aa1af436b9baa6e360c543051398d43e972f2fdf3268
|
4
|
+
data.tar.gz: f693eaafecd9f29945efbdf72eccd26e762c40a1887e8744e62e895bfae300ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f29aa234d6d47e8cd9c851eab5c17b06fe11349c23c09eef7fa6e0e21aad7a97e7e5fafc44b1baeed7ae679a57ae6c88d5049a70dcdec4c1dd3a336c4a31e87f
|
7
|
+
data.tar.gz: 30bd72269287a8da66a40d0181000ce5d679675a28af2897f739d0b147b7089333e64da5e55035e88d1b8b1b25974ad966f8d9f00853dd6e82bb6160141ec050
|
@@ -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>,
|
@@ -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
|
)
|
@@ -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
|
@@ -3,26 +3,27 @@
|
|
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,
|
@@ -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;
|
@@ -10,26 +13,19 @@
|
|
10
13
|
|
11
14
|
&[class^="pb_caption_kit_xs"] {
|
12
15
|
@include caption_xs;
|
13
|
-
&[class*="_link"] {
|
14
|
-
color: $primary;}
|
15
|
-
}
|
16
|
-
|
17
|
-
&[class*="light"] {
|
18
|
-
color: $text_lt_light;
|
19
16
|
}
|
20
|
-
|
21
|
-
&[class*="default"] {
|
22
|
-
color: $text_lt_default;
|
23
|
-
}
|
24
|
-
|
17
|
+
|
25
18
|
&[class*="link"] {
|
26
19
|
color: $primary;
|
27
20
|
}
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
@include pb_caption_kit_colors;
|
23
|
+
|
24
|
+
&.dark {
|
25
|
+
@include caption_dark;
|
26
|
+
@each $name, $color in $pb_dark_caption_colors {
|
27
|
+
&[class*="_#{$name}"] {
|
28
|
+
color: $color;
|
33
29
|
}
|
34
30
|
}
|
35
31
|
}
|
@@ -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
|
+
}
|
@@ -12,10 +12,11 @@ module Playbook
|
|
12
12
|
prop :text
|
13
13
|
prop :variant, type: Playbook::Props::Enum,
|
14
14
|
values: [nil, "link"],
|
15
|
-
default: nil
|
15
|
+
default: nil,
|
16
|
+
deprecated: true
|
16
17
|
|
17
18
|
prop :color, type: Playbook::Props::Enum,
|
18
|
-
values: [nil, "light", "
|
19
|
+
values: [nil, "default", "light", "lighter", "success", "error", "link"],
|
19
20
|
default: nil
|
20
21
|
|
21
22
|
def classname
|
@@ -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'
|
@@ -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'
|
@@ -0,0 +1,127 @@
|
|
1
|
+
@import "../../tokens/colors";
|
2
|
+
|
3
|
+
|
4
|
+
.numInput {
|
5
|
+
border-left: none !important;
|
6
|
+
}
|
7
|
+
|
8
|
+
// Manual Import
|
9
|
+
.flatpickr-monthSelect-months {
|
10
|
+
margin: 10px 1px 3px 1px;
|
11
|
+
flex-wrap: wrap;
|
12
|
+
}
|
13
|
+
|
14
|
+
.flatpickr-monthSelect-month {
|
15
|
+
background: none;
|
16
|
+
border: 1px solid transparent;
|
17
|
+
border-radius: 4px;
|
18
|
+
-webkit-box-sizing: border-box;
|
19
|
+
box-sizing: border-box;
|
20
|
+
color: $text_lt_default;
|
21
|
+
cursor: pointer;
|
22
|
+
display: inline-block;
|
23
|
+
font-weight: 400;
|
24
|
+
margin: 0.5px;
|
25
|
+
justify-content: center;
|
26
|
+
padding: 10px;
|
27
|
+
position: relative;
|
28
|
+
-webkit-box-pack: center;
|
29
|
+
-webkit-justify-content: center;
|
30
|
+
-ms-flex-pack: center;
|
31
|
+
text-align: center;
|
32
|
+
width: 33%;
|
33
|
+
}
|
34
|
+
|
35
|
+
.flatpickr-monthSelect-month.flatpickr-disabled {
|
36
|
+
color: #eee;
|
37
|
+
}
|
38
|
+
|
39
|
+
.flatpickr-monthSelect-month.flatpickr-disabled:hover,
|
40
|
+
.flatpickr-monthSelect-month.flatpickr-disabled:focus {
|
41
|
+
cursor: not-allowed;
|
42
|
+
background: none !important;
|
43
|
+
}
|
44
|
+
|
45
|
+
.flatpickr-monthSelect-theme-dark {
|
46
|
+
background: #3f4458;
|
47
|
+
}
|
48
|
+
|
49
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year {
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month,
|
54
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month {
|
55
|
+
color: #fff;
|
56
|
+
fill: #fff;
|
57
|
+
}
|
58
|
+
|
59
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month {
|
60
|
+
color: rgba(255, 255, 255, 0.95);
|
61
|
+
}
|
62
|
+
|
63
|
+
.flatpickr-monthSelect-month.today {
|
64
|
+
border-color: #959ea9;
|
65
|
+
}
|
66
|
+
|
67
|
+
.flatpickr-monthSelect-month.inRange,
|
68
|
+
.flatpickr-monthSelect-month.inRange.today,
|
69
|
+
.flatpickr-monthSelect-month:hover,
|
70
|
+
.flatpickr-monthSelect-month:focus {
|
71
|
+
background: $active_light;
|
72
|
+
font-weight: $bold;
|
73
|
+
color: $text_lt_default;
|
74
|
+
cursor: pointer;
|
75
|
+
outline: 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,
|
79
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,
|
80
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus {
|
81
|
+
background: #646c8c;
|
82
|
+
border-color: #646c8c;
|
83
|
+
}
|
84
|
+
|
85
|
+
.flatpickr-monthSelect-month.today:hover,
|
86
|
+
.flatpickr-monthSelect-month.today:focus {
|
87
|
+
background: #959ea9;
|
88
|
+
border-color: #959ea9;
|
89
|
+
color: #fff;
|
90
|
+
}
|
91
|
+
|
92
|
+
.flatpickr-monthSelect-month.selected,
|
93
|
+
.flatpickr-monthSelect-month.startRange,
|
94
|
+
.flatpickr-monthSelect-month.endRange {
|
95
|
+
background-color: $primary;
|
96
|
+
font-weight: $bold;
|
97
|
+
box-shadow: none;
|
98
|
+
color: #fff;
|
99
|
+
border-color: $primary;
|
100
|
+
}
|
101
|
+
|
102
|
+
.flatpickr-monthSelect-month.startRange {
|
103
|
+
border-radius: 50px 0 0 50px;
|
104
|
+
}
|
105
|
+
|
106
|
+
.flatpickr-monthSelect-month.endRange {
|
107
|
+
border-radius: 0 50px 50px 0;
|
108
|
+
}
|
109
|
+
|
110
|
+
.flatpickr-monthSelect-month.startRange.endRange {
|
111
|
+
border-radius: 50px;
|
112
|
+
}
|
113
|
+
|
114
|
+
.flatpickr-monthSelect-month.inRange {
|
115
|
+
border-radius: 0;
|
116
|
+
box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
|
117
|
+
}
|
118
|
+
|
119
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,
|
120
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,
|
121
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange {
|
122
|
+
background: #80cbc4;
|
123
|
+
-webkit-box-shadow: none;
|
124
|
+
box-shadow: none;
|
125
|
+
color: #fff;
|
126
|
+
border-color: #80cbc4;
|
127
|
+
}
|