playbook_ui 9.7.0.pre.alpha.a11y.btn → 9.7.0.pre.alphawidth1
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_button/_button.jsx +19 -8
- data/app/pb_kits/playbook/pb_button/button.rb +4 -6
- 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 +0 -3
- 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 +0 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +4 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +7 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.jsx +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.md +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +3 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +8 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.html.erb +13 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.jsx +43 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.md +1 -0
- data/app/pb_kits/playbook/pb_form_group/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_group/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/form_group.rb +10 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a4e16697962adfdbfb453aae9013b077e229bb1043d6584b6c872f7a876d57d
|
4
|
+
data.tar.gz: 565485a903d9e946589f765a24e2518e5380fa05818917780560f42eb02a08f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aae8d85a3f348aef5f23c41f22a4d5917bd729e007a2766a33cdc79b54ac60504063f31f1e2d021f3bc6ce16486e32832a0eca0c681560191a9d4ac1049b213
|
7
|
+
data.tar.gz: 95d568d4915960a1370c2200456c8f6d2a9f7d2963a86477e92e8158fa0f75a00ed305b4be7a04b5e007645f8fa177bf23773088d249e5eb8e40b1e1d399a769
|
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
-
import {
|
5
|
+
import { 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?:
|
12
|
+
aria?: {
|
13
|
+
label: string,
|
14
|
+
},
|
13
15
|
children?: array<React.ReactChild>,
|
14
16
|
className?: string | array<string>,
|
15
17
|
data?: object,
|
@@ -53,9 +55,20 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
53
55
|
return className
|
54
56
|
}
|
55
57
|
|
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
|
+
|
56
70
|
const Button = (props: ButtonPropTypes) => {
|
57
71
|
const {
|
58
|
-
aria = {},
|
59
72
|
children,
|
60
73
|
className,
|
61
74
|
data = {},
|
@@ -71,7 +84,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
71
84
|
value,
|
72
85
|
} = props
|
73
86
|
|
74
|
-
const
|
87
|
+
const buttonAria = buttonAriaProps(props)
|
75
88
|
const dataProps = buildDataProps(data)
|
76
89
|
const css = classnames(
|
77
90
|
buttonClassName(props),
|
@@ -101,12 +114,11 @@ const Button = (props: ButtonPropTypes) => {
|
|
101
114
|
return (
|
102
115
|
<If condition={link !== null}>
|
103
116
|
<a
|
104
|
-
{...
|
117
|
+
{...buttonAria}
|
105
118
|
{...dataProps}
|
106
119
|
className={css}
|
107
120
|
href={link}
|
108
121
|
id={id}
|
109
|
-
role="link"
|
110
122
|
target={newWindow ? '_blank' : null}
|
111
123
|
>
|
112
124
|
<If condition={loading}>{loadingIcon}</If>
|
@@ -114,13 +126,12 @@ const Button = (props: ButtonPropTypes) => {
|
|
114
126
|
</a>
|
115
127
|
<Else />
|
116
128
|
<button
|
117
|
-
{...
|
129
|
+
{...buttonAria}
|
118
130
|
{...dataProps}
|
119
131
|
className={css}
|
120
132
|
disabled={disabled}
|
121
133
|
id={id}
|
122
134
|
onClick={onClick}
|
123
|
-
role="button"
|
124
135
|
type={htmlType}
|
125
136
|
value={value}
|
126
137
|
>
|
@@ -21,12 +21,11 @@ module Playbook
|
|
21
21
|
|
22
22
|
def options
|
23
23
|
{
|
24
|
-
|
25
|
-
class: classname,
|
24
|
+
id: id,
|
26
25
|
data: data,
|
26
|
+
class: classname,
|
27
27
|
disabled: disabled,
|
28
|
-
|
29
|
-
role: "button",
|
28
|
+
aria: aria,
|
30
29
|
type: type,
|
31
30
|
value: value,
|
32
31
|
}.compact
|
@@ -35,8 +34,7 @@ module Playbook
|
|
35
34
|
def link_options
|
36
35
|
options.merge(
|
37
36
|
href: link,
|
38
|
-
|
39
|
-
target: new_window ? "_blank" : "_self",
|
37
|
+
target: new_window ? "_blank" : "_self"
|
40
38
|
)
|
41
39
|
end
|
42
40
|
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "
|
1
|
+
<%= pb_rails("button", props: { text: "Button with ARIA", aria: {label: "button"}, tag: "a", link: "http://google.com" }) %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= pb_rails("button", props: { text: "A Tag Button",
|
2
|
-
<%= pb_rails("button", props: { text: "Open in new Window",
|
3
|
-
<%= pb_rails("button", props: { text: "A Tag Button Disabled",
|
1
|
+
<%= pb_rails("button", props: { text: "A Tag Button", tag: "a", link: "http://google.com" }) %>
|
2
|
+
<%= pb_rails("button", props: { text: "Open in new Window", new_window: true, link: "http://google.com" }) %>
|
3
|
+
<%= pb_rails("button", props: { text: "A Tag Button Disabled", disabled: true, link: "http://google.com" }) %>
|
@@ -4,14 +4,12 @@ import { Button } from '../../'
|
|
4
4
|
const ButtonLink = (props) => (
|
5
5
|
<div>
|
6
6
|
<Button
|
7
|
-
aria={{ label: 'Link to Google' }}
|
8
7
|
link="https://google.com"
|
9
8
|
text="A Tag Button"
|
10
9
|
{...props}
|
11
10
|
/>
|
12
11
|
{' '}
|
13
12
|
<Button
|
14
|
-
aria={{ label: 'Link to Google in new window' }}
|
15
13
|
link="https://google.com"
|
16
14
|
newWindow
|
17
15
|
text="Open in New Window"
|
@@ -19,7 +17,6 @@ const ButtonLink = (props) => (
|
|
19
17
|
/>
|
20
18
|
{' '}
|
21
19
|
<Button
|
22
|
-
aria={{ label: 'Disabled link to Google' }}
|
23
20
|
disabled
|
24
21
|
link="https://google.com"
|
25
22
|
text="A Tag Button Disabled"
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= pb_rails("button", props: {
|
2
|
-
<%= pb_rails("button", props: {
|
3
|
-
<%= pb_rails("button", props: {
|
1
|
+
<%= pb_rails("button", props: { text: "Button Primary", loading: true }) %>
|
2
|
+
<%= pb_rails("button", props: { text: "Button Primary", variant: "secondary", loading: true }) %>
|
3
|
+
<%= pb_rails("button", props: { text: "Button Primary", variant: "link", loading: true }) %>
|
@@ -4,14 +4,12 @@ import { Button } from '../../'
|
|
4
4
|
const ButtonLoading = (props) => (
|
5
5
|
<div>
|
6
6
|
<Button
|
7
|
-
aria={{ label: 'Loading' }}
|
8
7
|
loading
|
9
8
|
text="Button Primary"
|
10
9
|
{...props}
|
11
10
|
/>
|
12
11
|
{' '}
|
13
12
|
<Button
|
14
|
-
aria={{ label: 'Loading' }}
|
15
13
|
loading
|
16
14
|
text="Button Secondary"
|
17
15
|
variant="secondary"
|
@@ -19,7 +17,6 @@ const ButtonLoading = (props) => (
|
|
19
17
|
/>
|
20
18
|
{' '}
|
21
19
|
<Button
|
22
|
-
aria={{ label: 'Loading' }}
|
23
20
|
loading
|
24
21
|
text="A Tag Button Disabled"
|
25
22
|
variant="link"
|
@@ -17,15 +17,17 @@ type FixedConfirmationToastProps = {
|
|
17
17
|
closeable?: boolean,
|
18
18
|
data?: string,
|
19
19
|
id?: string,
|
20
|
-
|
20
|
+
multiLine?: boolean,
|
21
|
+
status?: 'success' | 'error' | 'neutral' | 'tip',
|
21
22
|
text: string,
|
22
23
|
}
|
23
24
|
|
24
25
|
const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
|
25
26
|
const [showToast, toggleToast] = useState(true)
|
26
|
-
const { className, closeable = false, status = 'neutral', text } = props
|
27
|
+
const { className, closeable = false, multiLine = false, status = 'neutral', text } = props
|
27
28
|
const css = classnames(
|
28
29
|
`pb_fixed_confirmation_toast_kit_${status}`,
|
30
|
+
{ '_multi_line': multiLine },
|
29
31
|
globalProps(props),
|
30
32
|
className
|
31
33
|
)
|
@@ -47,6 +47,13 @@ $confirmation_toast_colors: (
|
|
47
47
|
.pb_icon {
|
48
48
|
color: $white;
|
49
49
|
}
|
50
|
+
|
51
|
+
&[class*=_multi_line] .pb_fixed_confirmation_toast_text {
|
52
|
+
color: $white;
|
53
|
+
margin: 0 $space_md 0 $space_md;
|
54
|
+
max-width: 100%;
|
55
|
+
white-space: break-spaces;
|
56
|
+
}
|
50
57
|
}
|
51
58
|
}
|
52
59
|
}
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.jsx
CHANGED
@@ -5,8 +5,9 @@ const FixedConfirmationToastMultiLine = (props) => {
|
|
5
5
|
return (
|
6
6
|
<div>
|
7
7
|
<FixedConfirmationToast
|
8
|
+
multiLine
|
8
9
|
status="tip"
|
9
|
-
text=
|
10
|
+
text="Scan to Assign Selected Items. Click here to generate report"
|
10
11
|
{...props}
|
11
12
|
/>
|
12
13
|
</div>
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.md
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
Multi-line is used when the given text will not fit on one line. Using Multi Line allows the height of the confirmation toast to grow.
|
2
|
+
Multi-line is used when the given text will not fit on one line. Using Multi Line allows the height of the confirmation toast to grow. Simply resize the screen to see the fixed confirmation toast wrap the text.
|
@@ -7,6 +7,8 @@ module Playbook
|
|
7
7
|
values: %w[success error neutral tip],
|
8
8
|
default: "neutral"
|
9
9
|
prop :text, type: Playbook::Props::String
|
10
|
+
prop :multi_line, type: Playbook::Props::Boolean,
|
11
|
+
default: false
|
10
12
|
prop :closeable, type: Playbook::Props::Boolean,
|
11
13
|
default: false
|
12
14
|
|
@@ -18,6 +20,10 @@ module Playbook
|
|
18
20
|
closeable.present? ? " remove_toast" : ""
|
19
21
|
end
|
20
22
|
|
23
|
+
def multi_line_class
|
24
|
+
multi_line.present? ? "multi_line" : nil
|
25
|
+
end
|
26
|
+
|
21
27
|
def icon_value
|
22
28
|
case status
|
23
29
|
when "success"
|
@@ -32,7 +38,7 @@ module Playbook
|
|
32
38
|
end
|
33
39
|
|
34
40
|
def classname
|
35
|
-
generate_classname("pb_fixed_confirmation_toast_kit", status) + close_class
|
41
|
+
generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -10,6 +10,7 @@ type FormGroupProps = {
|
|
10
10
|
children?: Node,
|
11
11
|
className?: string,
|
12
12
|
data?: object,
|
13
|
+
fullWidth?: boolean,
|
13
14
|
id?: string,
|
14
15
|
}
|
15
16
|
|
@@ -18,13 +19,14 @@ const FormGroup = (props: FormGroupProps) => {
|
|
18
19
|
aria = {},
|
19
20
|
className,
|
20
21
|
data = {},
|
22
|
+
fullWidth = false,
|
21
23
|
id,
|
22
24
|
children,
|
23
25
|
} = props
|
24
26
|
|
25
27
|
const ariaProps = buildAriaProps(aria)
|
26
28
|
const dataProps = buildDataProps(data)
|
27
|
-
const classes = classnames(buildCss('pb_form_group_kit'), globalProps(props), className)
|
29
|
+
const classes = classnames(buildCss('pb_form_group_kit', { full: fullWidth }), globalProps(props), className)
|
28
30
|
|
29
31
|
return (
|
30
32
|
<div
|
@@ -4,6 +4,14 @@
|
|
4
4
|
align-items: flex-end;
|
5
5
|
justify-content: flex-start;
|
6
6
|
|
7
|
+
&[class*=_full] {
|
8
|
+
display: flex;
|
9
|
+
justify-content: space-between;
|
10
|
+
& > div {
|
11
|
+
width: 100%;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
7
15
|
& [class^=pb_text_input_kit] .text_input_wrapper,
|
8
16
|
& [class^=pb_date_picker_kit] .input_wrapper,
|
9
17
|
& [class^=pb_select] {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div>
|
2
|
+
<%= pb_rails("form_group", props: { full_width: true }) do %>
|
3
|
+
<%= pb_rails("text_input", props: { label: "First Name", placeholder: "Enter First Name" }) %>
|
4
|
+
<%= pb_rails("text_input", props: { label: "Middle Intial", placeholder: "Enter Middle Initial" }) %>
|
5
|
+
<%= pb_rails("text_input", props: { label: "Last Name", placeholder: "Enter Last Name" }) %>
|
6
|
+
<% end %>
|
7
|
+
<br/>
|
8
|
+
<br/>
|
9
|
+
<%= pb_rails("form_group", props: { full_width: true }) do %>
|
10
|
+
<%= pb_rails("text_input", props: { placeholder: "Search" }) %>
|
11
|
+
<%= pb_rails("button", props: { text: "Submit", variant: "secondary" }) %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Button, FormGroup, TextInput } from '../../'
|
3
|
+
|
4
|
+
const FormGroupFullWidth = (props) => (
|
5
|
+
<div>
|
6
|
+
<div>
|
7
|
+
<FormGroup fullWidth>
|
8
|
+
<TextInput
|
9
|
+
label="First Name"
|
10
|
+
placeholder="Enter First Name"
|
11
|
+
{...props}
|
12
|
+
/>
|
13
|
+
<TextInput
|
14
|
+
label="Middle Intial"
|
15
|
+
placeholder="Enter Middle Initial"
|
16
|
+
{...props}
|
17
|
+
/>
|
18
|
+
<TextInput
|
19
|
+
label="Last Name"
|
20
|
+
placeholder="Enter Last Name"
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
</FormGroup>
|
24
|
+
</div>
|
25
|
+
<br />
|
26
|
+
<div>
|
27
|
+
<FormGroup fullWidth>
|
28
|
+
<TextInput
|
29
|
+
placeholder="Search"
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
<Button
|
33
|
+
onClick={() => alert('Button Clicked!')}
|
34
|
+
text="Submit"
|
35
|
+
variant="secondary"
|
36
|
+
{...props}
|
37
|
+
/>
|
38
|
+
</FormGroup>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
)
|
42
|
+
|
43
|
+
export default FormGroupFullWidth
|
@@ -0,0 +1 @@
|
|
1
|
+
Full Width is a prop that can be added to any of the Form Group options. This prop allows the Form Group to stretch the full width of the div.
|
@@ -3,6 +3,7 @@ examples:
|
|
3
3
|
rails:
|
4
4
|
- form_group_default: Default
|
5
5
|
- form_group_button: Button
|
6
|
+
- form_group_full_width: Full Width
|
6
7
|
- form_group_date_picker: Date Picker
|
7
8
|
# - form_group_typeahead: Typeahead
|
8
9
|
- form_group_select: Select
|
@@ -13,6 +14,7 @@ examples:
|
|
13
14
|
react:
|
14
15
|
- form_group_default: Default
|
15
16
|
- form_group_button: Button
|
17
|
+
- form_group_full_width: Full Width
|
16
18
|
- form_group_date_picker: Date Picker
|
17
19
|
# - form_group_typeahead: Typeahead
|
18
20
|
- form_group_select: Select
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { default as FormGroupDefault } from './_form_group_default.jsx'
|
2
2
|
export { default as FormGroupButton } from './_form_group_button.jsx'
|
3
|
+
export { default as FormGroupFullWidth } from './_form_group_full_width.jsx'
|
3
4
|
export { default as FormGroupDatePicker } from './_form_group_date_picker.jsx'
|
4
|
-
// export { default as FormGroupTypeahead } from './_form_group_typeahead.jsx'
|
5
5
|
export { default as FormGroupSelect } from './_form_group_select.jsx'
|
6
6
|
export { default as FormGroupSelectableCard } from './_form_group_selectable_card.jsx'
|
7
7
|
export { default as FormGroupSelectableCardIcon } from './_form_group_selectable_card_icon.jsx'
|
@@ -3,8 +3,17 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbFormGroup
|
5
5
|
class FormGroup < Playbook::KitBase
|
6
|
+
prop :full_width, type: Playbook::Props::Boolean,
|
7
|
+
default: false
|
8
|
+
|
6
9
|
def classname
|
7
|
-
generate_classname("pb_form_group_kit")
|
10
|
+
generate_classname("pb_form_group_kit", full_width_class)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def full_width_class
|
16
|
+
full_width ? "full" : nil
|
8
17
|
end
|
9
18
|
end
|
10
19
|
end
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.7.0.pre.
|
4
|
+
version: 9.7.0.pre.alphawidth1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-04-
|
12
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1004,6 +1004,9 @@ files:
|
|
1004
1004
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.jsx
|
1005
1005
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_default.html.erb
|
1006
1006
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_default.jsx
|
1007
|
+
- app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.html.erb
|
1008
|
+
- app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.jsx
|
1009
|
+
- app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.md
|
1007
1010
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb
|
1008
1011
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx
|
1009
1012
|
- app/pb_kits/playbook/pb_form_group/docs/_form_group_selectable_card.html.erb
|