playbook_ui 9.10.0.pre.alpha2 → 9.12.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/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +1 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +51 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +49 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +55 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +9 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.rb +12 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +7 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.rb +11 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.test.js +35 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.html.erb +17 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +56 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button/_button.jsx +8 -19
- data/app/pb_kits/playbook/pb_button/button.rb +5 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.jsx +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_link.html.erb +3 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_link.jsx +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +3 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +3 -0
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +45 -11
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +17 -6
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +12 -5
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb +5 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx +38 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +32 -16
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +23 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +12 -8
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +9 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +35 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb +8 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +19 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +6 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +13 -11
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +18 -13
- data/app/pb_kits/playbook/pb_passphrase/useZxcvbn.js +3 -3
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +7 -3
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +80 -31
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +98 -0
- data/app/pb_kits/playbook/pb_text_input/add_on.html.erb +13 -0
- data/app/pb_kits/playbook/pb_text_input/add_on.rb +30 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.html.erb +24 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.jsx +82 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.html.erb +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +7 -16
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +36 -2
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +2 -2
- data/lib/playbook/props.rb +1 -0
- data/lib/playbook/props/nested_props.rb +23 -0
- data/lib/playbook/version.rb +1 -1
- metadata +36 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1460f77a2ef88bf84e6e7388b473d73517373e9ef0d690418f318bf13eb49f6
|
4
|
+
data.tar.gz: 814d426340141a35d9286a0df82747538023dde241b7ec662c68bdfe6ef59585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c7ca89a529a1b173ac9cdd097813f342024c0428bac7830a6c0fa2fedc8e2951e6f7eea46bcaadbf85d8a65d5cd53d329c9d3c13abf5b0db0b001f11610bed
|
7
|
+
data.tar.gz: 73a48d081d1f1db44d7b788816ccc4e6c02657cf7e0b3107da11d18e1889bb716810717ab0259cb6385a31dd02b90c6ff8162896998732b97c2936f7f821a85f
|
@@ -10,6 +10,7 @@ export Background from './pb_background/_background.jsx'
|
|
10
10
|
export Badge from './pb_badge/_badge.jsx'
|
11
11
|
export BarGraph from './pb_bar_graph/_bar_graph.jsx'
|
12
12
|
export Body from './pb_body/_body.jsx'
|
13
|
+
export BreadCrumbs from './pb_bread_crumbs/_bread_crumbs.jsx'
|
13
14
|
export Button from './pb_button/_button.jsx'
|
14
15
|
export ButtonToolbar from './pb_button_toolbar/_button_toolbar.jsx'
|
15
16
|
export Caption from './pb_caption/_caption.jsx'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
import { globalProps } from '../utilities/globalProps.js'
|
6
|
+
|
7
|
+
import {
|
8
|
+
buildAriaProps,
|
9
|
+
buildCss,
|
10
|
+
buildDataProps,
|
11
|
+
} from '../utilities/props'
|
12
|
+
|
13
|
+
type BreadCrumbItemProps = {
|
14
|
+
aria?: object,
|
15
|
+
className?: string,
|
16
|
+
data?: object,
|
17
|
+
id?: string,
|
18
|
+
component?: element
|
19
|
+
}
|
20
|
+
const BreadCrumbItem = (props: BreadCrumbItemProps) => {
|
21
|
+
const {
|
22
|
+
aria = {},
|
23
|
+
className,
|
24
|
+
data = {},
|
25
|
+
id,
|
26
|
+
component = 'a',
|
27
|
+
...rest
|
28
|
+
} = props
|
29
|
+
const ariaProps = buildAriaProps(aria)
|
30
|
+
const dataProps = buildDataProps(data)
|
31
|
+
const css = classnames(
|
32
|
+
buildCss('pb_bread_crumb_item_kit'),
|
33
|
+
globalProps(props),
|
34
|
+
className
|
35
|
+
)
|
36
|
+
const Component = component || 'span'
|
37
|
+
return (
|
38
|
+
<div
|
39
|
+
{...ariaProps}
|
40
|
+
{...dataProps}
|
41
|
+
className={css}
|
42
|
+
id={id}
|
43
|
+
>
|
44
|
+
<Component
|
45
|
+
className="pb_bread_crumb_item"
|
46
|
+
{...rest}
|
47
|
+
/>
|
48
|
+
</div>
|
49
|
+
)
|
50
|
+
}
|
51
|
+
export default BreadCrumbItem
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
import { globalProps } from '../utilities/globalProps.js'
|
6
|
+
|
7
|
+
import {
|
8
|
+
buildAriaProps,
|
9
|
+
buildCss,
|
10
|
+
buildDataProps,
|
11
|
+
} from '../utilities/props'
|
12
|
+
|
13
|
+
type BreadCrumbsProps = {
|
14
|
+
aria?: object,
|
15
|
+
className?: string,
|
16
|
+
data?: object,
|
17
|
+
id?: string,
|
18
|
+
text?: string,
|
19
|
+
children?: node
|
20
|
+
}
|
21
|
+
const BreadCrumbs = (props: BreadCrumbsProps) => {
|
22
|
+
const {
|
23
|
+
aria = { label: 'Breadcrumb Navigation' },
|
24
|
+
className,
|
25
|
+
data = {},
|
26
|
+
id,
|
27
|
+
children,
|
28
|
+
} = props
|
29
|
+
const ariaProps = buildAriaProps(aria)
|
30
|
+
const dataProps = buildDataProps(data)
|
31
|
+
const css = classnames(
|
32
|
+
buildCss('pb_bread_crumbs_kit'),
|
33
|
+
globalProps(props),
|
34
|
+
className
|
35
|
+
)
|
36
|
+
|
37
|
+
return (
|
38
|
+
<nav
|
39
|
+
{...ariaProps}
|
40
|
+
{...dataProps}
|
41
|
+
className={css}
|
42
|
+
id={id}
|
43
|
+
>
|
44
|
+
{children}
|
45
|
+
</nav>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
export default BreadCrumbs
|
@@ -0,0 +1,55 @@
|
|
1
|
+
@import "../tokens/border_radius";
|
2
|
+
@import "../tokens/colors";
|
3
|
+
@import "../tokens/opacity";
|
4
|
+
@import "../tokens/spacing";
|
5
|
+
@import "../tokens/typography";
|
6
|
+
|
7
|
+
[class^=pb_bread_crumbs_kit] {
|
8
|
+
$pb_badge_height: 18px;
|
9
|
+
|
10
|
+
display: inline-flex;
|
11
|
+
align-items: center;
|
12
|
+
justify-content: center;
|
13
|
+
border-radius: $border_rad_light;
|
14
|
+
padding: 0 $space_xs/2;
|
15
|
+
border-width: 1px;
|
16
|
+
border-style: solid;
|
17
|
+
border-color: $card_light;
|
18
|
+
|
19
|
+
svg {
|
20
|
+
margin-right: 8px;
|
21
|
+
}
|
22
|
+
.pb_bread_crumb_item {
|
23
|
+
display: flex;
|
24
|
+
flex-direction: row;
|
25
|
+
align-items: center;
|
26
|
+
|
27
|
+
}
|
28
|
+
.pb_bread_crumb_item_kit {
|
29
|
+
display: flex;
|
30
|
+
flex-direction: row;
|
31
|
+
align-items: center;
|
32
|
+
}
|
33
|
+
.pb_bread_crumb_item_kit:not(:last-child):after {
|
34
|
+
content: '/';
|
35
|
+
padding-left: 8px;
|
36
|
+
padding-right: 8px;
|
37
|
+
}
|
38
|
+
|
39
|
+
@each $color_name, $color_value in $status_colors {
|
40
|
+
&[class*=_#{$color_name}] {
|
41
|
+
background: rgba($color_value, $opacity_1);
|
42
|
+
color: map-get($status_color_text, $color_name);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
&.dark {
|
47
|
+
border-width: 0;
|
48
|
+
|
49
|
+
@each $color_name, $color_value in $status_colors {
|
50
|
+
&[class*=_#{$color_name}] {
|
51
|
+
background: rgba(mix($bg_dark, $color_value, 10%), $opacity_2);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
import BreadCrumbs from './_bread_crumbs'
|
4
|
+
import BreadCrumbItem from './_bread_crumb_item'
|
5
|
+
import { Icon, Title } from '../'
|
6
|
+
|
7
|
+
it('should render bread crumbs', () => {
|
8
|
+
const testId = 'breadCrumbs'
|
9
|
+
render(
|
10
|
+
<BreadCrumbs
|
11
|
+
data={{ testid: testId }}
|
12
|
+
name={name}
|
13
|
+
>
|
14
|
+
<Icon
|
15
|
+
icon="home"
|
16
|
+
size="1x"
|
17
|
+
/>
|
18
|
+
<BreadCrumbItem
|
19
|
+
dark
|
20
|
+
href="/home"
|
21
|
+
>
|
22
|
+
<Title
|
23
|
+
size="4"
|
24
|
+
tag="span"
|
25
|
+
text="Home"
|
26
|
+
/>
|
27
|
+
</BreadCrumbItem>
|
28
|
+
</BreadCrumbs>
|
29
|
+
)
|
30
|
+
const kit = screen.getByTestId(testId)
|
31
|
+
const label = screen.getByText('Home')
|
32
|
+
|
33
|
+
expect(kit).toHaveClass('pb_bread_crumbs_kit')
|
34
|
+
expect(label).toHaveTextContent('Home')
|
35
|
+
})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
<div>
|
3
|
+
<%= pb_rails("bread_crumbs", props: { aria: { label: "Breadcrumb Navigation" } }) do%>
|
4
|
+
<%= pb_rails("icon", props: { icon: "home"}) %>
|
5
|
+
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/" }) do %>
|
6
|
+
<%= pb_rails("title", props: { size: 4, text: "Home", tag: "span" }) %>
|
7
|
+
<%end%>
|
8
|
+
<%= pb_rails("icon", props: { icon: 'users'}) %>
|
9
|
+
<%= pb_rails("bread_crumbs/bread_crumb_item", props: { link: "/users" }) do %>
|
10
|
+
<%= pb_rails("title", props: { size: 4, text: "Users", tag: "span" }) %>
|
11
|
+
<%end%>
|
12
|
+
<%= pb_rails("icon", props: { icon: "user"}) %>
|
13
|
+
<%= pb_rails("bread_crumbs/bread_crumb_item") do %>
|
14
|
+
<%= pb_rails("title", props: { size: 4, text: "User", tag: "span" }) %>
|
15
|
+
<%end%>
|
16
|
+
<%end%>
|
17
|
+
</div>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import BreadCrumbs from '../_bread_crumbs.jsx'
|
3
|
+
import { Icon, Title } from '../../'
|
4
|
+
import BreadCrumbItem from '../_bread_crumb_item'
|
5
|
+
|
6
|
+
const Link = (props) => <BreadCrumbItem {...props} />
|
7
|
+
const BreadCrumbsDefault = (props) => {
|
8
|
+
return (
|
9
|
+
<BreadCrumbs
|
10
|
+
text="+1"
|
11
|
+
{...props}
|
12
|
+
>
|
13
|
+
<Icon
|
14
|
+
icon="home"
|
15
|
+
size="1x"
|
16
|
+
/>
|
17
|
+
<BreadCrumbItem
|
18
|
+
{...props}
|
19
|
+
href="/home"
|
20
|
+
>
|
21
|
+
<Title
|
22
|
+
size="4"
|
23
|
+
tag="span"
|
24
|
+
text="Home"
|
25
|
+
/>
|
26
|
+
</BreadCrumbItem>
|
27
|
+
<Icon
|
28
|
+
icon="users"
|
29
|
+
size="1x"
|
30
|
+
/>
|
31
|
+
<Link
|
32
|
+
{...props}
|
33
|
+
href="/users"
|
34
|
+
>
|
35
|
+
<Title
|
36
|
+
size="4"
|
37
|
+
tag="span"
|
38
|
+
text="Users"
|
39
|
+
/>
|
40
|
+
</Link>
|
41
|
+
<Icon
|
42
|
+
icon="user"
|
43
|
+
size="1x"
|
44
|
+
/>
|
45
|
+
<Link {...props}>
|
46
|
+
<Title
|
47
|
+
size="4"
|
48
|
+
tag="span"
|
49
|
+
text="User"
|
50
|
+
/>
|
51
|
+
</Link>
|
52
|
+
</BreadCrumbs>
|
53
|
+
)
|
54
|
+
}
|
55
|
+
|
56
|
+
export default BreadCrumbsDefault
|
@@ -0,0 +1 @@
|
|
1
|
+
BreadCrumbs can be used for keeping a user aware of there route location.
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as BreadCrumbsDefault } from './_bread_crumbs_default.jsx'
|
@@ -2,16 +2,14 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
-
import { buildDataProps } from '../utilities/props'
|
5
|
+
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
6
|
import { globalProps } from '../utilities/globalProps.js'
|
7
7
|
|
8
8
|
import Icon from '../pb_icon/_icon.jsx'
|
9
9
|
|
10
10
|
type EventHandler = (SyntheticInputEvent<HTMLInputElement>) => void
|
11
11
|
type ButtonPropTypes = {
|
12
|
-
aria?:
|
13
|
-
label: string,
|
14
|
-
},
|
12
|
+
aria?: object,
|
15
13
|
children?: array<React.ReactChild>,
|
16
14
|
className?: string | array<string>,
|
17
15
|
data?: object,
|
@@ -55,20 +53,9 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
55
53
|
return className
|
56
54
|
}
|
57
55
|
|
58
|
-
const buttonAriaProps = (props: ButtonPropTypes) => {
|
59
|
-
const { aria } = props
|
60
|
-
if (typeof aria !== 'object') return {}
|
61
|
-
const { label } = aria
|
62
|
-
|
63
|
-
const ariaProps = {}
|
64
|
-
|
65
|
-
if (label !== null) ariaProps['aria-label'] = label
|
66
|
-
|
67
|
-
return ariaProps
|
68
|
-
}
|
69
|
-
|
70
56
|
const Button = (props: ButtonPropTypes) => {
|
71
57
|
const {
|
58
|
+
aria = {},
|
72
59
|
children,
|
73
60
|
className,
|
74
61
|
data = {},
|
@@ -84,7 +71,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
84
71
|
value,
|
85
72
|
} = props
|
86
73
|
|
87
|
-
const
|
74
|
+
const ariaProps = buildAriaProps(aria)
|
88
75
|
const dataProps = buildDataProps(data)
|
89
76
|
const css = classnames(
|
90
77
|
buttonClassName(props),
|
@@ -114,11 +101,12 @@ const Button = (props: ButtonPropTypes) => {
|
|
114
101
|
return (
|
115
102
|
<If condition={link !== null}>
|
116
103
|
<a
|
117
|
-
{...
|
104
|
+
{...ariaProps}
|
118
105
|
{...dataProps}
|
119
106
|
className={css}
|
120
107
|
href={link}
|
121
108
|
id={id}
|
109
|
+
role="link"
|
122
110
|
target={newWindow ? '_blank' : null}
|
123
111
|
>
|
124
112
|
<If condition={loading}>{loadingIcon}</If>
|
@@ -126,12 +114,13 @@ const Button = (props: ButtonPropTypes) => {
|
|
126
114
|
</a>
|
127
115
|
<Else />
|
128
116
|
<button
|
129
|
-
{...
|
117
|
+
{...ariaProps}
|
130
118
|
{...dataProps}
|
131
119
|
className={css}
|
132
120
|
disabled={disabled}
|
133
121
|
id={id}
|
134
122
|
onClick={onClick}
|
123
|
+
role="button"
|
135
124
|
type={htmlType}
|
136
125
|
value={value}
|
137
126
|
>
|