playbook_ui 14.7.0.pre.rc.9 → 14.7.0.pre.rc.10
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_form_pill/_form_pill.scss +6 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +30 -26
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +24 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +3 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +46 -8
- data/dist/chunks/{_typeahead-BV_n6U5W.js → _typeahead-BJrdFWHc.js} +2 -2
- data/dist/chunks/{_weekday_stacked-BLVPFG6h.js → _weekday_stacked-Bh_d6CAO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ba0fb7af5321d4991f68fcd5719c84aa6a965fcdd65be52f9e0b2bc2840e041
|
4
|
+
data.tar.gz: 9ead572649755359a8b45bdb4a9d82be48dc7842f6133639af6d5590fc87eeaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cbbb674356aef72b2dc3c07e74a96c3a2a08d0e749ebaae79a2b167839abcdaf298b2f40d095b360c4526167235b4e5ea70519a55e670b234edc5e45a7a7d51
|
7
|
+
data.tar.gz: 561ecc4d74956c039c41c341c13310ec3e4603fa39d11895c4a249b8f17f9cd553afc4a748172335cb285fe855c1d34d038736f784686e6c53c8421830c7f748
|
@@ -142,7 +142,9 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
142
142
|
height: 12px !important;
|
143
143
|
width: 12px !important;
|
144
144
|
padding-right: $space_xs;
|
145
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag
|
145
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
146
|
+
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
147
|
+
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
146
148
|
padding-left: 0;
|
147
149
|
}
|
148
150
|
}
|
@@ -169,7 +171,9 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
169
171
|
}
|
170
172
|
.pb_form_pill_icon {
|
171
173
|
padding-right: $space_xxs;
|
172
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag
|
174
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
175
|
+
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
176
|
+
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
173
177
|
padding-left: 0;
|
174
178
|
}
|
175
179
|
}
|
@@ -3,6 +3,7 @@ import classnames from 'classnames'
|
|
3
3
|
import Title from '../pb_title/_title'
|
4
4
|
import Icon from '../pb_icon/_icon'
|
5
5
|
import Avatar from '../pb_avatar/_avatar'
|
6
|
+
import Tooltip from '../pb_tooltip/_tooltip'
|
6
7
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
7
8
|
import { buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
9
|
|
@@ -62,6 +63,30 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
62
63
|
const dataProps = buildDataProps(data)
|
63
64
|
const htmlProps = buildHtmlProps(htmlOptions)
|
64
65
|
|
66
|
+
const renderTitle = (content: string, className: string) => {
|
67
|
+
const titleComponent = (
|
68
|
+
<Title
|
69
|
+
className={className}
|
70
|
+
size={4}
|
71
|
+
text={content}
|
72
|
+
truncate={props.truncate}
|
73
|
+
/>
|
74
|
+
)
|
75
|
+
if (props.truncate) {
|
76
|
+
return (
|
77
|
+
<Tooltip
|
78
|
+
interaction
|
79
|
+
placement="top"
|
80
|
+
position="fixed"
|
81
|
+
text={content}
|
82
|
+
>
|
83
|
+
{titleComponent}
|
84
|
+
</Tooltip>
|
85
|
+
)
|
86
|
+
}
|
87
|
+
return titleComponent
|
88
|
+
}
|
89
|
+
|
65
90
|
return (
|
66
91
|
<div className={css}
|
67
92
|
id={id}
|
@@ -77,12 +102,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
77
102
|
size="xxs"
|
78
103
|
status={null}
|
79
104
|
/>
|
80
|
-
|
81
|
-
className="pb_form_pill_text"
|
82
|
-
size={4}
|
83
|
-
text={name}
|
84
|
-
truncate={props.truncate}
|
85
|
-
/>
|
105
|
+
{renderTitle(name, "pb_form_pill_text")}
|
86
106
|
</>
|
87
107
|
)}
|
88
108
|
{((name && icon && !text) || (name && icon && text)) && (
|
@@ -93,12 +113,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
93
113
|
size="xxs"
|
94
114
|
status={null}
|
95
115
|
/>
|
96
|
-
|
97
|
-
className="pb_form_pill_text"
|
98
|
-
size={4}
|
99
|
-
text={name}
|
100
|
-
truncate={props.truncate}
|
101
|
-
/>
|
116
|
+
{renderTitle(name, "pb_form_pill_text")}
|
102
117
|
<Icon
|
103
118
|
className="pb_form_pill_icon"
|
104
119
|
color={color}
|
@@ -113,22 +128,10 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
113
128
|
color={color}
|
114
129
|
icon={icon}
|
115
130
|
/>
|
116
|
-
|
117
|
-
className="pb_form_pill_tag"
|
118
|
-
size={4}
|
119
|
-
text={text}
|
120
|
-
truncate={props.truncate}
|
121
|
-
/>
|
131
|
+
{renderTitle(text, "pb_form_pill_tag")}
|
122
132
|
</>
|
123
133
|
)}
|
124
|
-
{(!name && !icon && text) && (
|
125
|
-
<Title
|
126
|
-
className="pb_form_pill_tag"
|
127
|
-
size={4}
|
128
|
-
text={text}
|
129
|
-
truncate={props.truncate}
|
130
|
-
/>
|
131
|
-
)}
|
134
|
+
{(!name && !icon && text) && renderTitle(text, "pb_form_pill_tag")}
|
132
135
|
<div
|
133
136
|
className="pb_form_pill_close"
|
134
137
|
onClick={onClick}
|
@@ -143,4 +146,5 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
143
146
|
</div>
|
144
147
|
)
|
145
148
|
}
|
149
|
+
|
146
150
|
export default FormPill
|
@@ -13,7 +13,30 @@
|
|
13
13
|
id: "typeahead-form-pill",
|
14
14
|
is_multi: true,
|
15
15
|
options: names,
|
16
|
-
label: "
|
16
|
+
label: "Truncation Within Typeahead",
|
17
17
|
pills: true,
|
18
18
|
truncate: 1,
|
19
19
|
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %>
|
22
|
+
<%= pb_rails("card", props: { max_width: "xs" }) do %>
|
23
|
+
<%= pb_rails("form_pill", props: {
|
24
|
+
name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
|
25
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
26
|
+
tabindex: 0,
|
27
|
+
truncate: 1,
|
28
|
+
id: "truncation-1"
|
29
|
+
}) %>
|
30
|
+
<%= pb_rails("form_pill", props: {
|
31
|
+
icon: "badge-check",
|
32
|
+
text: "icon and a very long tag to show truncation",
|
33
|
+
tabindex: 0,
|
34
|
+
truncate: 1,
|
35
|
+
id: "truncation-2"
|
36
|
+
}) %>
|
37
|
+
<%= pb_rails("form_pill", props: {
|
38
|
+
text: "form pill long tag no tooltip show truncation",
|
39
|
+
tabindex: 0,
|
40
|
+
truncate: 1,
|
41
|
+
}) %>
|
42
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import Typeahead from '
|
2
|
+
import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
|
3
3
|
|
4
4
|
const names = [
|
5
5
|
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
@@ -15,11 +15,34 @@ const FormPillTruncatedText = (props) => {
|
|
15
15
|
<Typeahead
|
16
16
|
htmlOptions={{ style: { maxWidth: "240px" }}}
|
17
17
|
isMulti
|
18
|
-
label="
|
18
|
+
label="Truncation Within Typeahead"
|
19
19
|
options={names}
|
20
20
|
truncate={1}
|
21
21
|
{...props}
|
22
22
|
/>
|
23
|
+
<Caption text="Form Pill Truncation"/>
|
24
|
+
<Card maxWidth="xs">
|
25
|
+
<FormPill
|
26
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
27
|
+
name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
|
28
|
+
onClick={() => alert('Click!')}
|
29
|
+
tabIndex={0}
|
30
|
+
truncate={1}
|
31
|
+
/>
|
32
|
+
<FormPill
|
33
|
+
icon="badge-check"
|
34
|
+
onClick={() => {alert('Click!')}}
|
35
|
+
tabIndex={0}
|
36
|
+
text="icon and a very long tag to show truncation"
|
37
|
+
truncate={1}
|
38
|
+
/>
|
39
|
+
<FormPill
|
40
|
+
onClick={() => {alert('Click!')}}
|
41
|
+
tabIndex={0}
|
42
|
+
text="form pill with a very long tag to show truncation"
|
43
|
+
truncate={1}
|
44
|
+
/>
|
45
|
+
</Card>
|
23
46
|
</>
|
24
47
|
)
|
25
48
|
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
For Form Pills with longer text, the truncate global prop can be used to truncate the label within each Form Pill. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
|
2
|
+
|
3
|
+
__NOTE__: For Rails Form Pills (not ones embedded within a React-rendered Typeahead or MultiLevelSelect), a unique `id` is required to enable the Tooltip functionality displaying the text or tag section of the Form Pill.
|
@@ -0,0 +1 @@
|
|
1
|
+
For Form Pills with longer text, the `truncate` global prop can be used to truncate the label within each Form Pill. Hover over the truncated Form Pill and a Tooltip containing the text or tag section of the Form Pill will appear. See [here](https://playbook.powerapp.cloud/visual_guidelines/truncate) for more information on the truncate global prop.
|
@@ -1,19 +1,57 @@
|
|
1
1
|
<%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
|
2
2
|
<% if object.name.present? %>
|
3
3
|
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xxs" }) %>
|
4
|
-
|
4
|
+
<% if object.truncate %>
|
5
|
+
<div>
|
6
|
+
<%= pb_rails("title", props: {
|
7
|
+
classname: "pb_form_pill_text truncate_#{object.truncate}",
|
8
|
+
id: object.id,
|
9
|
+
size: 4,
|
10
|
+
text: object.name,
|
11
|
+
}) %>
|
12
|
+
<% if object.id.present? %>
|
13
|
+
<%= pb_rails("tooltip", props: {
|
14
|
+
position: "top",
|
15
|
+
tooltip_id: "tooltip-#{object.id}",
|
16
|
+
trigger_element_selector: "##{object.id}"
|
17
|
+
}) do %>
|
18
|
+
<%= object.name %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<% else %>
|
23
|
+
<%= pb_rails("title", props: { classname: "pb_form_pill_text", id: object.id, size: 4, text: object.name }) %>
|
24
|
+
<% end %>
|
5
25
|
<% if object.icon.present? %>
|
6
26
|
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
7
27
|
<% end %>
|
8
28
|
<% elsif object.text.present? %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
29
|
+
<% if object.icon.present? %>
|
30
|
+
<%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
|
31
|
+
<% end %>
|
32
|
+
<% if object.truncate %>
|
33
|
+
<div>
|
34
|
+
<%= pb_rails("title", props: {
|
35
|
+
classname: "pb_form_pill_tag truncate_#{object.truncate}",
|
36
|
+
id: object.id,
|
37
|
+
size: 4,
|
38
|
+
text: object.text,
|
39
|
+
}) %>
|
40
|
+
<% if object.id.present? %>
|
41
|
+
<%= pb_rails("tooltip", props: {
|
42
|
+
position: "top",
|
43
|
+
tooltip_id: "tooltip-#{object.id}",
|
44
|
+
trigger_element_selector: "##{object.id}"
|
45
|
+
}) do %>
|
46
|
+
<%= object.text %>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
<% else %>
|
51
|
+
<%= pb_rails("title", props: { classname: "pb_form_pill_tag", id: object.id, size: 4, text: object.text, }) %>
|
52
|
+
<% end %>
|
15
53
|
<% end %>
|
16
54
|
<%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
|
17
55
|
<%= pb_rails("icon", props: { icon: 'times', fixed_width: true, size: object.close_icon_size }) %>
|
18
56
|
<% end %>
|
19
|
-
<% end %>
|
57
|
+
<% end %>
|