playbook_ui 2.9.6 → 2.9.7
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_avatar/_avatar.html.erb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.html.erb +5 -5
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.html.erb +4 -4
- data/app/pb_kits/playbook/pb_button/_button.html.erb +3 -21
- data/app/pb_kits/playbook/pb_button/button.rb +47 -124
- data/app/pb_kits/playbook/pb_caption/caption.rb +1 -1
- data/app/pb_kits/playbook/pb_contact/_contact.html.erb +1 -1
- data/app/pb_kits/playbook/pb_contact/_contact.jsx +18 -8
- data/app/pb_kits/playbook/pb_contact/contact.rb +11 -2
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +4 -1
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +3 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.html.erb +12 -4
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -4
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +13 -70
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_align.html.erb +6 -6
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_align.jsx +6 -6
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.html.erb +6 -6
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +6 -6
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.html.erb +3 -3
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +12 -33
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +4 -2
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified.html.erb +0 -1
- data/app/pb_kits/playbook/pb_layout/_body.html.erb +2 -2
- data/app/pb_kits/playbook/pb_layout/_layout.html.erb +2 -2
- data/app/pb_kits/playbook/pb_layout/_sidebar.html.erb +2 -2
- data/app/pb_kits/playbook/pb_layout/body.rb +5 -29
- data/app/pb_kits/playbook/pb_layout/layout.rb +31 -76
- data/app/pb_kits/playbook/pb_layout/sidebar.rb +5 -29
- data/app/pb_kits/playbook/pb_list/_item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_list/_list.html.erb +3 -4
- data/app/pb_kits/playbook/pb_list/item.rb +5 -29
- data/app/pb_kits/playbook/pb_list/list.rb +41 -90
- data/app/pb_kits/playbook/pb_message/_message.html.erb +18 -5
- data/app/pb_kits/playbook/pb_message/docs/_message_default.html.erb +10 -20
- data/app/pb_kits/playbook/pb_message/message.rb +15 -72
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +1 -0
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +2 -1
- data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.html.erb +4 -1
- data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.html.erb +4 -1
- data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.jsx +4 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb +2 -2
- data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +6 -35
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.html.erb +11 -11
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +5 -5
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +9 -51
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.html.erb +5 -2
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +1 -1
- data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx +3 -3
- data/app/pb_kits/playbook/pb_stat_change/stat_change.rb +10 -60
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.html.erb +2 -2
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +6 -39
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
- data/app/pb_kits/playbook/pb_user/_user.html.erb +13 -4
- data/app/pb_kits/playbook/pb_user/docs/_user_default.html.erb +3 -6
- data/app/pb_kits/playbook/pb_user/docs/_user_size.html.erb +3 -6
- data/app/pb_kits/playbook/pb_user/docs/_user_vertical_size.html.erb +3 -6
- data/app/pb_kits/playbook/pb_user/user.rb +23 -95
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.html.erb +1 -1
- data/app/pb_kits/playbook/pb_user_badge/user_badge.rb +13 -49
- data/app/pb_kits/playbook/pb_vertical_nav/_item.html.erb +4 -2
- data/app/pb_kits/playbook/pb_vertical_nav/_vertical_nav.html.erb +9 -5
- data/app/pb_kits/playbook/pb_vertical_nav/item.rb +10 -49
- data/app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb +7 -58
- data/app/pb_kits/playbook/props.rb +1 -0
- data/app/pb_kits/playbook/props/date.rb +11 -0
- data/lib/playbook/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5f2bd958a96f0dbfd28803cf2985193685e6befec0ee99cc70b88a9b240724
|
4
|
+
data.tar.gz: c0431904190cb6d3f70b773becf328aa27b270dbcef67325799f6e22bc174536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca568cf8bd38190150704d38a8b209d7732b523162206e8e0900d1e1a34687e1b476a6b02467f2280e8f06337f5b92ceb27716bd383a35abe2924f8dfefbdfbf
|
7
|
+
data.tar.gz: 974ccaefbb7da619678d5345f04c1a8be13ae97aacb20342d09eaf4ae3f7c2909dfd88d027fb167f4f49fbafb0121fe7c3e8e5bd8d2d69b622ae010f8915e9ed
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= content_tag(:div,
|
7
7
|
data: { initials: object.initials },
|
8
8
|
class: "avatar_wrapper") do %>
|
9
|
-
<%= pb_rails("image", props: object.
|
9
|
+
<%= pb_rails("image", props: { url: object.image_url }) if object.image_url.present? %>
|
10
10
|
<% end %>
|
11
11
|
<%= pb_rails("online_status", props: object.online_status_props) if object.status %>
|
12
12
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= pb_rails("avatar", props: {
|
2
2
|
name: "Terry Johnson",
|
3
3
|
size: "xs",
|
4
|
-
|
4
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
5
5
|
status: "online"
|
6
6
|
}) %>
|
7
7
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<%= pb_rails("avatar", props: {
|
11
11
|
name: "Terry Johnson",
|
12
12
|
size: "sm",
|
13
|
-
|
13
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
14
14
|
status: "away"
|
15
15
|
}) %>
|
16
16
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<%= pb_rails("avatar", props: {
|
20
20
|
name: "Terry Johnson",
|
21
21
|
size: "md",
|
22
|
-
|
22
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
23
23
|
status: "offline"
|
24
24
|
}) %>
|
25
25
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<%= pb_rails("avatar", props: {
|
29
29
|
name: "Terry Johnson",
|
30
30
|
size: "lg",
|
31
|
-
|
31
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
32
32
|
status: "online"
|
33
33
|
}) %>
|
34
34
|
|
@@ -37,6 +37,6 @@
|
|
37
37
|
<%= pb_rails("avatar", props: {
|
38
38
|
name: "Terry Johnson",
|
39
39
|
size: "xl",
|
40
|
-
|
40
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
41
41
|
status: "away"
|
42
42
|
}) %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= pb_rails("avatar", props: {
|
2
2
|
name: "Terry Johnson",
|
3
3
|
size: "sm",
|
4
|
-
|
4
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg"
|
5
5
|
}) %>
|
6
6
|
|
7
7
|
<br>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<%= pb_rails("avatar", props: {
|
10
10
|
name: "Terry Johnson",
|
11
11
|
size: "sm",
|
12
|
-
|
12
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
13
13
|
status: "online"
|
14
14
|
}) %>
|
15
15
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<%= pb_rails("avatar", props: {
|
19
19
|
name: "Terry Johnson",
|
20
20
|
size: "sm",
|
21
|
-
|
21
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
22
22
|
status: "away"
|
23
23
|
}) %>
|
24
24
|
|
@@ -27,6 +27,6 @@
|
|
27
27
|
<%= pb_rails("avatar", props: {
|
28
28
|
name: "Terry Johnson",
|
29
29
|
size: "sm",
|
30
|
-
|
30
|
+
image_url: "https://randomuser.me/api/portraits/men/44.jpg",
|
31
31
|
status: "offline"
|
32
32
|
}) %>
|
@@ -1,23 +1,5 @@
|
|
1
|
-
<%
|
2
|
-
# Buttons should not have link options: href, target
|
3
|
-
options = {
|
4
|
-
id: object.id,
|
5
|
-
data: object.data,
|
6
|
-
class: object.classname(object.kit_class),
|
7
|
-
disabled: object.disabled,
|
8
|
-
aria: object.aria,
|
9
|
-
type: object.type,
|
10
|
-
value: object.value
|
11
|
-
}.compact
|
12
|
-
|
13
|
-
link_options = {
|
14
|
-
href: object.link,
|
15
|
-
target: object.new_window
|
16
|
-
}
|
17
|
-
%>
|
18
|
-
|
19
1
|
<%= content_tag(object.tag,
|
20
|
-
object.tag == "button" ? options :
|
21
|
-
<%=
|
22
|
-
<span class="pb_button_content"><%= object.
|
2
|
+
object.tag == "button" ? object.options : object.link_options) do %>
|
3
|
+
<%= pb_rails("icon", props: { icon: "spinner", pulse: true, fixed_width: true, classname: "loading-icon" }) %>
|
4
|
+
<span class="pb_button_content"><%= !object.children.nil? ? capture(&object.children) : object.text %></span>
|
23
5
|
<% end %>
|
@@ -2,144 +2,67 @@
|
|
2
2
|
|
3
3
|
module Playbook
|
4
4
|
module PbButton
|
5
|
-
class Button
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
self.configured_link = link
|
44
|
-
self.configured_loading = loading
|
45
|
-
self.configured_new_window = new_window
|
46
|
-
self.configured_variant = variant
|
47
|
-
self.configured_tag = tag
|
48
|
-
self.configured_text = text
|
49
|
-
self.configured_type = type
|
50
|
-
self.configured_value = value
|
51
|
-
self.block = block_given? ? block : nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def disabled
|
55
|
-
is_true? configured_disabled
|
5
|
+
class Button
|
6
|
+
include Playbook::Props
|
7
|
+
|
8
|
+
partial "pb_button/button"
|
9
|
+
|
10
|
+
prop :disabled, type: Playbook::Props::Boolean,
|
11
|
+
default: false
|
12
|
+
prop :full_width, type: Playbook::Props::Boolean,
|
13
|
+
default: false
|
14
|
+
prop :link
|
15
|
+
prop :loading, type: Playbook::Props::Boolean,
|
16
|
+
default: false
|
17
|
+
prop :new_window, type: Playbook::Props::Boolean,
|
18
|
+
default: false
|
19
|
+
prop :variant, type: Playbook::Props::Enum,
|
20
|
+
values: %w[primary secondary link],
|
21
|
+
default: "primary"
|
22
|
+
prop :text
|
23
|
+
prop :type
|
24
|
+
prop :value
|
25
|
+
|
26
|
+
def options
|
27
|
+
{
|
28
|
+
id: id,
|
29
|
+
data: data,
|
30
|
+
class: classname,
|
31
|
+
disabled: disabled,
|
32
|
+
aria: aria,
|
33
|
+
type: type,
|
34
|
+
value: value,
|
35
|
+
}.compact
|
36
|
+
end
|
37
|
+
|
38
|
+
def link_options
|
39
|
+
options.merge(
|
40
|
+
href: link,
|
41
|
+
target: new_window ? "_blank" : "_self"
|
42
|
+
)
|
56
43
|
end
|
57
44
|
|
58
|
-
def
|
59
|
-
|
45
|
+
def tag
|
46
|
+
link ? "a" : "button"
|
60
47
|
end
|
61
48
|
|
62
|
-
|
63
|
-
loading ? "loading" : nil
|
64
|
-
end
|
49
|
+
private
|
65
50
|
|
66
|
-
def
|
67
|
-
|
68
|
-
pulse: true,
|
69
|
-
fixed_width: true,
|
70
|
-
classname: "loading-icon")
|
71
|
-
ApplicationController.renderer.render(partial: pb_icon, as: :object)
|
51
|
+
def classname
|
52
|
+
generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
72
53
|
end
|
73
54
|
|
74
55
|
def disabled_class
|
75
|
-
|
56
|
+
disabled ? "disabled" : "enabled"
|
76
57
|
end
|
77
58
|
|
78
59
|
def full_width_class
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
def link
|
83
|
-
default_value(configured_link, "")
|
84
|
-
end
|
85
|
-
|
86
|
-
def variant
|
87
|
-
variant_options = %w[primary secondary link]
|
88
|
-
one_of_value(configured_variant, variant_options, "primary")
|
89
|
-
end
|
90
|
-
|
91
|
-
def tag
|
92
|
-
tag_options = %w[button a]
|
93
|
-
if link.empty?
|
94
|
-
one_of_value(configured_tag, tag_options, "button")
|
95
|
-
else
|
96
|
-
"a"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def new_window
|
101
|
-
true_value(configured_new_window, "_blank", "_self")
|
60
|
+
full_width ? "block" : "inline"
|
102
61
|
end
|
103
62
|
|
104
|
-
def
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
def type
|
109
|
-
default_value(configured_type, "button")
|
110
|
-
end
|
111
|
-
|
112
|
-
def value
|
113
|
-
configured_value unless configured_value == DEFAULT
|
114
|
-
end
|
115
|
-
|
116
|
-
def yield(context:)
|
117
|
-
!block.nil? ? context.capture(&block) : text
|
118
|
-
end
|
119
|
-
|
120
|
-
def kit_class
|
121
|
-
kit_options = [
|
122
|
-
"pb_button_kit",
|
123
|
-
variant,
|
124
|
-
full_width_class,
|
125
|
-
disabled_class,
|
126
|
-
loading_class,
|
127
|
-
]
|
128
|
-
kit_options.compact.join("_")
|
129
|
-
end
|
130
|
-
|
131
|
-
def to_partial_path
|
132
|
-
"pb_button/button"
|
133
|
-
end
|
134
|
-
|
135
|
-
private
|
136
|
-
|
137
|
-
DEFAULT = Object.new
|
138
|
-
private_constant :DEFAULT
|
139
|
-
def default_configuration
|
140
|
-
DEFAULT
|
63
|
+
def loading_class
|
64
|
+
loading ? "loading" : nil
|
141
65
|
end
|
142
|
-
attr_accessor(*PROPS)
|
143
66
|
end
|
144
67
|
end
|
145
68
|
end
|
@@ -4,6 +4,6 @@
|
|
4
4
|
class: object.classname) do %>
|
5
5
|
<%= pb_rails("body", props: { tag: "span", classname: "pb_contact_kit", color: "light" }) do %>
|
6
6
|
<%= pb_rails("icon", props: { icon: object.contact_icon, fixed_width: true }) %>
|
7
|
-
<%= object.
|
7
|
+
<%= object.formatted_contact_info if object.contact_value%>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
@@ -14,6 +14,7 @@ type ContactProps = {
|
|
14
14
|
className?: String | Array<String>,
|
15
15
|
dark?: Boolean,
|
16
16
|
contactValue: String,
|
17
|
+
contactDetail?: String,
|
17
18
|
}
|
18
19
|
|
19
20
|
const kitClasses = ({}: ContactProps) => {
|
@@ -26,19 +27,28 @@ const Contact = ({
|
|
26
27
|
className,
|
27
28
|
dark=false,
|
28
29
|
contactValue,
|
30
|
+
contactDetail="",
|
29
31
|
}: ContactProps) => {
|
30
32
|
|
33
|
+
const formatDetail = (contactDetail) => {
|
34
|
+
if (contactDetail !== undefined) {
|
35
|
+
return `\u00b7 ${contactDetail}`
|
36
|
+
} else {
|
37
|
+
return contactDetail
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
31
41
|
const css = classnames(kitClasses({contactType}), className)
|
32
42
|
|
33
|
-
const
|
43
|
+
const formatContact = (contactString, contactType) => {
|
34
44
|
if (contactType == "email") {
|
35
|
-
return
|
45
|
+
return contactString
|
36
46
|
} else {
|
37
|
-
|
38
|
-
|
39
|
-
if (
|
40
|
-
let intlCode = (
|
41
|
-
return [intlCode, '(',
|
47
|
+
const cleaned = contactString.replace(/\D/g, '')
|
48
|
+
const phoneNumber = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/)
|
49
|
+
if (phoneNumber) {
|
50
|
+
let intlCode = (phoneNumber[1] ? '+1 ' : '')
|
51
|
+
return [intlCode, '(', phoneNumber[2], ') ', phoneNumber[3], '-', phoneNumber[4]].join('')
|
42
52
|
}
|
43
53
|
return null
|
44
54
|
}
|
@@ -63,7 +73,7 @@ const Contact = ({
|
|
63
73
|
<div className={css}>
|
64
74
|
<Body dark={dark} color="light" >
|
65
75
|
<Icon icon={contactTypeIcon} fixedWidth="true" />
|
66
|
-
{` ${
|
76
|
+
{` ${formatContact(contactValue, contactType)} ${formatDetail(contactDetail)}`}
|
67
77
|
</Body>
|
68
78
|
</div>
|
69
79
|
)
|
@@ -12,6 +12,7 @@ module Playbook
|
|
12
12
|
|
13
13
|
prop :contact_type
|
14
14
|
prop :contact_value
|
15
|
+
prop :contact_detail
|
15
16
|
|
16
17
|
def classname
|
17
18
|
generate_classname("pb_contact_kit")
|
@@ -32,6 +33,12 @@ module Playbook
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
36
|
+
def formatted_contact_info
|
37
|
+
"#{formatted_contact_value} #{separator} #{contact_detail}"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
35
42
|
def formatted_contact_value
|
36
43
|
if contact_type == "email"
|
37
44
|
contact_value
|
@@ -40,11 +47,13 @@ module Playbook
|
|
40
47
|
end
|
41
48
|
end
|
42
49
|
|
43
|
-
private
|
44
|
-
|
45
50
|
def formatted_value
|
46
51
|
contact_value.to_s.gsub(/\D/, "")
|
47
52
|
end
|
53
|
+
|
54
|
+
def separator
|
55
|
+
contact_detail ? "\u00b7" : ""
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
@@ -1,18 +1,21 @@
|
|
1
1
|
<%= pb_rails("contact", props: {
|
2
2
|
contact_type: "cell",
|
3
3
|
contact_value: "349-185-9988",
|
4
|
+
contact_detail: "John's Cell",
|
4
5
|
}) %>
|
5
6
|
|
6
7
|
<%= pb_rails("contact", props: {
|
7
8
|
contact_value: 5555555555,
|
9
|
+
contact_detail: "Home",
|
8
10
|
}) %>
|
9
11
|
|
10
12
|
<%= pb_rails("contact", props: {
|
11
13
|
contact_type: "email",
|
12
|
-
contact_value: "email@example.com"
|
14
|
+
contact_value: "email@example.com"
|
13
15
|
}) %>
|
14
16
|
|
15
17
|
<%= pb_rails("contact", props: {
|
16
18
|
contact_type: "work",
|
17
19
|
contact_value: "3245627482",
|
20
|
+
contact_detail: "John's Work",
|
18
21
|
}) %>
|