playbook_ui 14.13.0.pre.rc.6 → 14.13.0.pre.rc.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.scss +9 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +11 -7
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +6 -7
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +2 -1
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +15 -0
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +28 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +5 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +3 -3
- data/app/pb_kits/playbook/pb_copy_button/index.js +47 -0
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +11 -2
- data/app/pb_kits/playbook/pb_link/_link.tsx +18 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_target.html.erb +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_target.jsx +29 -0
- data/app/pb_kits/playbook/pb_link/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_link/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_link/link.html.erb +1 -1
- data/app/pb_kits/playbook/pb_link/link.rb +6 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tooltip.html.erb +6 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +6 -9
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +6 -9
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +26 -0
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +0 -1
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +45 -27
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +5 -1
- data/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
- data/app/pb_kits/playbook/pb_user/user.rb +1 -0
- data/app/pb_kits/playbook/pb_user/user.test.js +14 -0
- data/dist/chunks/{_typeahead-BIhRQo8Q.js → _typeahead-CkemExmL.js} +3 -3
- data/dist/chunks/{_weekday_stacked-CttHBFW3.js → _weekday_stacked-C2x2rHKi.js} +2 -2
- data/dist/chunks/{lib-kMuhBuU7.js → lib-DjpLC8uO.js} +1 -1
- data/dist/chunks/{pb_form_validation-DBJ0wZuS.js → pb_form_validation-S56UaHZl.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- 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 +20 -6
@@ -1,16 +1,18 @@
|
|
1
1
|
examples:
|
2
|
-
|
2
|
+
|
3
3
|
rails:
|
4
4
|
- link_color: Color
|
5
5
|
- link_underline: Underline
|
6
6
|
- link_icon: Icon
|
7
7
|
- link_disabled: Disabled
|
8
8
|
- link_tag: Tag
|
9
|
-
|
10
|
-
|
9
|
+
- link_target: Target
|
10
|
+
|
11
|
+
|
11
12
|
react:
|
12
13
|
- link_color: Color
|
13
14
|
- link_underline: Underline
|
14
15
|
- link_icon: Icon
|
15
16
|
- link_disabled: Disabled
|
16
17
|
- link_tag: Tag
|
18
|
+
- link_target: Target
|
@@ -2,4 +2,5 @@ export { default as LinkColor } from './_link_color.jsx'
|
|
2
2
|
export { default as LinkUnderline } from './_link_underline.jsx'
|
3
3
|
export { default as LinkIcon } from './_link_icon.jsx'
|
4
4
|
export { default as LinkDisabled } from './_link_disabled.jsx'
|
5
|
-
export { default as LinkTag } from './_link_tag.jsx'
|
5
|
+
export { default as LinkTag } from './_link_tag.jsx'
|
6
|
+
export { default as LinkTarget } from './_link_target.jsx'
|
@@ -11,9 +11,11 @@ module Playbook
|
|
11
11
|
prop :href
|
12
12
|
prop :icon
|
13
13
|
prop :icon_right
|
14
|
+
prop :tabindex
|
14
15
|
prop :tag, type: Playbook::Props::Enum,
|
15
16
|
values: %w[a h1 h2 h3 h4 h5 h6 p span div],
|
16
17
|
default: "a"
|
18
|
+
prop :target
|
17
19
|
prop :text
|
18
20
|
prop :underline, type: Playbook::Props::Boolean,
|
19
21
|
default: false
|
@@ -26,6 +28,10 @@ module Playbook
|
|
26
28
|
text
|
27
29
|
end
|
28
30
|
|
31
|
+
def target_attribute
|
32
|
+
target if target && href
|
33
|
+
end
|
34
|
+
|
29
35
|
private
|
30
36
|
|
31
37
|
def color_class
|
@@ -90,3 +90,33 @@ test('adds icon right', () => {
|
|
90
90
|
const icon = kit.querySelector('.pb_icon_kit')
|
91
91
|
expect(icon).toBeInTheDocument();
|
92
92
|
})
|
93
|
+
|
94
|
+
test('should render target prop', () => {
|
95
|
+
render(
|
96
|
+
<Link
|
97
|
+
data={{ testid: 'target-test' }}
|
98
|
+
href="https://playbook.powerapp.cloud/"
|
99
|
+
target="blank"
|
100
|
+
/>
|
101
|
+
)
|
102
|
+
|
103
|
+
const kit = screen.getByTestId('target-test')
|
104
|
+
|
105
|
+
expect(kit).toHaveAttribute('target', 'blank')
|
106
|
+
})
|
107
|
+
|
108
|
+
|
109
|
+
test('should render child target prop', () => {
|
110
|
+
render(
|
111
|
+
<Link
|
112
|
+
data={{ testid: 'target-test' }}
|
113
|
+
href="https://playbook.powerapp.cloud/"
|
114
|
+
tabIndex={0}
|
115
|
+
target="child"
|
116
|
+
/>
|
117
|
+
)
|
118
|
+
|
119
|
+
const kit = screen.getByTestId('target-test')
|
120
|
+
|
121
|
+
expect(kit).toHaveAttribute('target', 'child')
|
122
|
+
})
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-1", tooltip: "Tooltip for step 1", tooltip_position: "right", step_direction: "horizontal" }) do %>
|
3
3
|
step 1
|
4
4
|
<% end %>
|
5
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-2", tooltip: "Tooltip for step 2", step_direction: "horizontal" }) do %>
|
5
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-2", tooltip: "Tooltip for step 2", tooltip_position: "left", step_direction: "horizontal" }) do %>
|
6
6
|
step 2
|
7
7
|
<% end %>
|
8
8
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "active", classname: "tooltip-trigger-3", tooltip: "Tooltip for step 3", tooltip_position: "left", step_direction: "horizontal" }) do %>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-4", tooltip: "Tooltip for step 4", tooltip_position: "bottom" }) do %>
|
12
12
|
step 4
|
13
13
|
<% end %>
|
14
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-5", tooltip: "Tooltip for step 5" }) do %>
|
14
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-5", tooltip: "Tooltip for step 5", tooltip_position: "left" }) do %>
|
15
15
|
step 5
|
16
16
|
<% end %>
|
17
17
|
<% end %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<br /><br />
|
20
20
|
|
21
21
|
<%= pb_rails("progress_step", props: {orientation: "vertical"}) do %>
|
22
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-6", tooltip: "Tooltip step 1", step_direction: "vertical" }) do %>
|
22
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-6", tooltip: "Tooltip step 1", step_direction: "vertical", tooltip_position: "left" }) do %>
|
23
23
|
<% end %>
|
24
24
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "active", classname: "tooltip-trigger-7", tooltip: "Tooltip step 2", tooltip_position: "left"}) do %>
|
25
25
|
<% end %>
|
@@ -31,10 +31,10 @@
|
|
31
31
|
|
32
32
|
<br /><br>
|
33
33
|
<%= pb_rails("progress_step",props:{ variant:"tracker", icon:true}) do %>
|
34
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-10", tooltip: "The order has been received", step_direction: "horizontal" , tooltip_position: "right"
|
34
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "complete", classname: "tooltip-trigger-10", tooltip: "The order has been received", step_direction: "horizontal" , tooltip_position: "right" }) do %>
|
35
35
|
<%= pb_rails("caption", props:{text: "Ordered"})%>
|
36
36
|
<% end %>
|
37
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "active", classname: "tooltip-trigger-11", tooltip:"Item(s) have been shipped" }) do %>
|
37
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "active", classname: "tooltip-trigger-11", tooltip:"Item(s) have been shipped", tooltip_position: "right" }) do %>
|
38
38
|
<%= pb_rails("caption", props:{text: "Shipped"})%>
|
39
39
|
<% end %>
|
40
40
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-12", tooltip:"This step has not been reached", tooltip_position: "left" }) do %>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "active", icon: "exclamation-triangle", classname: "tooltip-trigger-14", tooltip: "More details needed before shipment", tooltip_position: "bottom" }) do %>
|
51
51
|
<%= pb_rails("caption", props:{text: "Shipped"})%>
|
52
52
|
<% end %>
|
53
|
-
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-15", tooltip: "This step is inactive"}) do %>
|
53
|
+
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-15", tooltip: "This step is inactive", tooltip_position: "bottom"}) do %>
|
54
54
|
<%= pb_rails("caption", props:{text: "Out for Delivery"})%>
|
55
55
|
<% end %>
|
56
56
|
<%= pb_rails("progress_step/progress_step_item", props: {status: "inactive", classname: "tooltip-trigger-16", tooltip: "Estimated delivery: Jun 27", tooltip_position: "left"}) do %>
|
@@ -39,20 +39,17 @@
|
|
39
39
|
</tr>
|
40
40
|
</tbody>
|
41
41
|
<% end %>
|
42
|
-
|
43
42
|
<%= pb_rails("table", props: { size: "sm", margin_bottom: "lg" }) do %>
|
44
43
|
<colgroup>
|
45
44
|
<%= pb_rails("background", props: { background_color: "error_subtle", tag: "col" }) %>
|
46
|
-
<%= pb_rails("background", props: { background_color: "
|
45
|
+
<%= pb_rails("background", props: { background_color: "info_subtle", tag: "col" }) %>
|
47
46
|
<%= pb_rails("background", props: { background_color: "warning_subtle", tag: "col" }) %>
|
48
47
|
</colgroup>
|
49
|
-
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
</tr>
|
55
|
-
<% end %>
|
48
|
+
<thead>
|
49
|
+
<th>Column 1</th>
|
50
|
+
<th>Column 2</th>
|
51
|
+
<th>Column 3</th>
|
52
|
+
</thead>
|
56
53
|
<tbody>
|
57
54
|
<tr>
|
58
55
|
<td>Value 1</td>
|
@@ -68,7 +68,7 @@ const TableWithBackgroundKit = (props) => {
|
|
68
68
|
tag='col'
|
69
69
|
/>
|
70
70
|
<Background
|
71
|
-
backgroundColor="
|
71
|
+
backgroundColor="info_subtle"
|
72
72
|
tag='col'
|
73
73
|
/>
|
74
74
|
<Background
|
@@ -76,16 +76,13 @@ const TableWithBackgroundKit = (props) => {
|
|
76
76
|
tag='col'
|
77
77
|
/>
|
78
78
|
</colgroup>
|
79
|
-
<
|
80
|
-
backgroundColor="card_light"
|
81
|
-
tag='thead'
|
82
|
-
>
|
79
|
+
<thead>
|
83
80
|
<tr>
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
<th>{'Column 1'}</th>
|
82
|
+
<th>{'Column 2'}</th>
|
83
|
+
<th>{'Column 3'}</th>
|
87
84
|
</tr>
|
88
|
-
</
|
85
|
+
</thead>
|
89
86
|
<tbody>
|
90
87
|
<tr>
|
91
88
|
<td>{'Value 1'}</td>
|
@@ -74,6 +74,31 @@
|
|
74
74
|
&.table-card {
|
75
75
|
background: none !important;
|
76
76
|
|
77
|
+
&.dark {
|
78
|
+
tbody, .pb_table_tbody {
|
79
|
+
tr, .pb_table_tr {
|
80
|
+
td, .pb_table_td {
|
81
|
+
background: $bg_dark_card !important;
|
82
|
+
border-color: $border_dark !important;
|
83
|
+
&:before {
|
84
|
+
color: $text_dk_light !important;
|
85
|
+
}
|
86
|
+
&:after {
|
87
|
+
height: 0;
|
88
|
+
background-color: transparent;
|
89
|
+
}
|
90
|
+
|
91
|
+
&:first-child {
|
92
|
+
border-radius: $border_rad_light $border_rad_light 0 0 !important;
|
93
|
+
}
|
94
|
+
&:last-child {
|
95
|
+
border-radius: 0 0 $border_rad_light $border_rad_light !important;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
77
102
|
tbody, .pb_table_tbody {
|
78
103
|
tr, .pb_table_tr {
|
79
104
|
td, .pb_table_td {
|
@@ -81,6 +106,7 @@
|
|
81
106
|
border-left-width: 1px !important;
|
82
107
|
border-right-width: 1px !important;
|
83
108
|
border-top-width: 1px !important;
|
109
|
+
|
84
110
|
&:after {
|
85
111
|
height: 0;
|
86
112
|
background-color: transparent;
|
@@ -74,6 +74,31 @@
|
|
74
74
|
&.table-card {
|
75
75
|
background: none !important;
|
76
76
|
|
77
|
+
&.dark {
|
78
|
+
tbody, .pb_table_tbody {
|
79
|
+
tr, .pb_table_tr {
|
80
|
+
td, .pb_table_td {
|
81
|
+
background: $bg_dark_card !important;
|
82
|
+
border-color: $border_dark !important;
|
83
|
+
&:before {
|
84
|
+
color: $text_dk_light !important;
|
85
|
+
}
|
86
|
+
&:after {
|
87
|
+
height: 0;
|
88
|
+
background-color: transparent;
|
89
|
+
}
|
90
|
+
|
91
|
+
&:first-child {
|
92
|
+
border-radius: $border_rad_light $border_rad_light 0 0 !important;
|
93
|
+
}
|
94
|
+
&:last-child {
|
95
|
+
border-radius: 0 0 $border_rad_light $border_rad_light !important;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
77
102
|
tbody, .pb_table_tbody {
|
78
103
|
tr, .pb_table_tr {
|
79
104
|
td, .pb_table_td {
|
@@ -74,6 +74,31 @@
|
|
74
74
|
&.table-card {
|
75
75
|
background: none !important;
|
76
76
|
|
77
|
+
&.dark {
|
78
|
+
tbody, .pb_table_tbody {
|
79
|
+
tr, .pb_table_tr {
|
80
|
+
td, .pb_table_td {
|
81
|
+
background: $bg_dark_card !important;
|
82
|
+
border-color: $border_dark !important;
|
83
|
+
&:before {
|
84
|
+
color: $text_dk_light !important;
|
85
|
+
}
|
86
|
+
&:after {
|
87
|
+
height: 0;
|
88
|
+
background-color: transparent;
|
89
|
+
}
|
90
|
+
|
91
|
+
&:first-child {
|
92
|
+
border-radius: $border_rad_light $border_rad_light 0 0 !important;
|
93
|
+
}
|
94
|
+
&:last-child {
|
95
|
+
border-radius: 0 0 $border_rad_light $border_rad_light !important;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
77
102
|
tbody, .pb_table_tbody {
|
78
103
|
tr, .pb_table_tr {
|
79
104
|
td, .pb_table_td {
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
2
|
-
|
3
2
|
import {
|
4
3
|
createPopperLite as createPopper,
|
5
4
|
flip,
|
@@ -17,27 +16,34 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
17
16
|
|
18
17
|
connect() {
|
19
18
|
this.triggerElements.forEach((trigger) => {
|
20
|
-
|
21
|
-
this.mouseenterTimeout = setTimeout(() => {
|
22
|
-
this.showTooltip(trigger)
|
23
|
-
this.checkCloseTooltip(trigger)
|
24
|
-
}, TOOLTIP_TIMEOUT)
|
19
|
+
const method = this.triggerMethod
|
25
20
|
|
26
|
-
|
21
|
+
if (method === 'click') {
|
22
|
+
trigger.addEventListener('click', () => {
|
23
|
+
this.showTooltip(trigger)
|
24
|
+
})
|
25
|
+
} else {
|
26
|
+
trigger.addEventListener('mouseenter', () => {
|
27
|
+
this.mouseenterTimeout = setTimeout(() => {
|
28
|
+
this.showTooltip(trigger)
|
29
|
+
this.checkCloseTooltip(trigger)
|
30
|
+
}, TOOLTIP_TIMEOUT)
|
31
|
+
|
32
|
+
trigger.addEventListener('mouseleave', () => {
|
33
|
+
clearTimeout(this.mouseenterTimeout)
|
34
|
+
setTimeout(() => {
|
35
|
+
this.hideTooltip()
|
36
|
+
}, 0)
|
37
|
+
}, { once: true })
|
38
|
+
})
|
39
|
+
|
40
|
+
this.tooltip.addEventListener('mouseenter', () => {
|
27
41
|
clearTimeout(this.mouseenterTimeout)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
})
|
34
|
-
})
|
35
|
-
|
36
|
-
this.tooltip.addEventListener('mouseenter', () => {
|
37
|
-
clearTimeout(this.mouseenterTimeout)
|
38
|
-
})
|
39
|
-
this.tooltip.addEventListener('mouseleave', () => {
|
40
|
-
this.hideTooltip()
|
42
|
+
})
|
43
|
+
this.tooltip.addEventListener('mouseleave', () => {
|
44
|
+
this.hideTooltip()
|
45
|
+
})
|
46
|
+
}
|
41
47
|
})
|
42
48
|
}
|
43
49
|
|
@@ -54,7 +60,7 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
54
60
|
}
|
55
61
|
|
56
62
|
showTooltip(trigger) {
|
57
|
-
if (this.shouldShowTooltip ===
|
63
|
+
if (this.shouldShowTooltip === 'false') return
|
58
64
|
|
59
65
|
this.popper = createPopper(trigger, this.tooltip, {
|
60
66
|
placement: this.position,
|
@@ -78,6 +84,13 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
78
84
|
],
|
79
85
|
})
|
80
86
|
this.tooltip.classList.add('show')
|
87
|
+
|
88
|
+
if (this.triggerMethod === 'click') {
|
89
|
+
clearTimeout(this.autoHideTimeout)
|
90
|
+
this.autoHideTimeout = setTimeout(() => {
|
91
|
+
this.hideTooltip()
|
92
|
+
}, 1000)
|
93
|
+
}
|
81
94
|
}
|
82
95
|
|
83
96
|
hideTooltip() {
|
@@ -94,25 +107,26 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
94
107
|
let triggerEl
|
95
108
|
|
96
109
|
if (this.triggerElementId) {
|
97
|
-
triggerEl = document.querySelector(`#${this.triggerElementId}`)
|
110
|
+
triggerEl = document.querySelector(`#${this.triggerElementId}`)
|
98
111
|
} else {
|
99
112
|
const selectorIsId = this.triggerElementSelector.indexOf('#') > -1
|
100
|
-
triggerEl = selectorIsId
|
101
|
-
document.
|
113
|
+
triggerEl = selectorIsId
|
114
|
+
? document.querySelector(`${this.triggerElementSelector}`)
|
115
|
+
: document.querySelectorAll(`${this.triggerElementSelector}`)
|
102
116
|
}
|
103
117
|
|
104
118
|
if (!triggerEl) {
|
105
|
-
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
|
106
119
|
console.error('Tooltip Kit: an invalid or unavailable DOM reference was provided!')
|
107
120
|
return []
|
108
121
|
}
|
109
122
|
|
110
123
|
if (!triggerEl.length) triggerEl = [triggerEl]
|
111
|
-
return this._triggerElements =
|
124
|
+
return (this._triggerElements = this._triggerElements || triggerEl)
|
112
125
|
}
|
113
126
|
|
114
127
|
get tooltip() {
|
115
|
-
return this._tooltip =
|
128
|
+
return (this._tooltip =
|
129
|
+
this._tooltip || this.element.querySelector(`#${this.tooltipId}`))
|
116
130
|
}
|
117
131
|
|
118
132
|
get position() {
|
@@ -134,4 +148,8 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
134
148
|
get shouldShowTooltip() {
|
135
149
|
return this.element.dataset.pbTooltipShowTooltip
|
136
150
|
}
|
151
|
+
|
152
|
+
get triggerMethod() {
|
153
|
+
return this.element.dataset.pbTooltipTriggerMethod || 'hover'
|
154
|
+
}
|
137
155
|
}
|
@@ -9,6 +9,9 @@ module Playbook
|
|
9
9
|
prop :tooltip_id
|
10
10
|
prop :dark, type: Playbook::Props::Boolean,
|
11
11
|
default: false
|
12
|
+
prop :trigger_method, type: Playbook::Props::Enum,
|
13
|
+
values: %w[hover click],
|
14
|
+
default: "hover"
|
12
15
|
|
13
16
|
def classname
|
14
17
|
generate_classname("pb_tooltip_kit", dark_class)
|
@@ -21,7 +24,8 @@ module Playbook
|
|
21
24
|
pb_tooltip_trigger_element_selector: trigger_element_selector,
|
22
25
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
23
26
|
pb_tooltip_tooltip_id: tooltip_id,
|
24
|
-
pb_tooltip_show_tooltip: true
|
27
|
+
pb_tooltip_show_tooltip: true,
|
28
|
+
pb_tooltip_trigger_method: trigger_method
|
25
29
|
)
|
26
30
|
end
|
27
31
|
|
@@ -13,6 +13,7 @@ type UserProps = {
|
|
13
13
|
aria?: {[key: string]: string},
|
14
14
|
avatar?: boolean,
|
15
15
|
avatarUrl?: string,
|
16
|
+
bold?: boolean,
|
16
17
|
className?: string,
|
17
18
|
dark?: boolean,
|
18
19
|
data?: {[key: string]: string},
|
@@ -32,6 +33,7 @@ const User = (props: UserProps): React.ReactElement => {
|
|
32
33
|
aria = {},
|
33
34
|
avatar = false,
|
34
35
|
avatarUrl,
|
36
|
+
bold = true,
|
35
37
|
className,
|
36
38
|
dark = false,
|
37
39
|
data = {},
|
@@ -75,6 +77,7 @@ const User = (props: UserProps): React.ReactElement => {
|
|
75
77
|
}
|
76
78
|
<div className="content_wrapper">
|
77
79
|
<Title
|
80
|
+
bold={bold}
|
78
81
|
dark={dark}
|
79
82
|
size={size == 'lg' ? 3 : 4}
|
80
83
|
text={name}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<div class="pb--doc-demo-row">
|
2
|
+
<div>
|
3
|
+
<%= pb_rails("user", props: {
|
4
|
+
name: "Anna Black",
|
5
|
+
title: "Remodeling Consultant",
|
6
|
+
orientation: "vertical",
|
7
|
+
align: "center",
|
8
|
+
size: "lg",
|
9
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
10
|
+
bold: false
|
11
|
+
}) %>
|
12
|
+
</div>
|
13
|
+
<div>
|
14
|
+
<%= pb_rails("user", props: {
|
15
|
+
name: "Anna Black",
|
16
|
+
title: "Remodeling Consultant",
|
17
|
+
orientation: "horizontal",
|
18
|
+
align: "left",
|
19
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
20
|
+
bold: false
|
21
|
+
}) %>
|
22
|
+
</div>
|
23
|
+
<div>
|
24
|
+
<%= pb_rails("user", props: {
|
25
|
+
name: "Anna Black",
|
26
|
+
orientation: "horizontal",
|
27
|
+
align: "left",
|
28
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
29
|
+
bold: false
|
30
|
+
}) %>
|
31
|
+
|
32
|
+
<br>
|
33
|
+
|
34
|
+
<%= pb_rails("user", props: {
|
35
|
+
name: "Anna Black",
|
36
|
+
orientation: "horizontal",
|
37
|
+
align: "left",
|
38
|
+
avatar: true,
|
39
|
+
bold: false
|
40
|
+
}) %>
|
41
|
+
</div>
|
42
|
+
</div>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { User } from 'playbook-ui'
|
3
|
+
|
4
|
+
const UserLightWeight = (props) => {
|
5
|
+
return (
|
6
|
+
<div className="pb--doc-demo-row">
|
7
|
+
|
8
|
+
<div>
|
9
|
+
<User
|
10
|
+
align="center"
|
11
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
12
|
+
bold={false}
|
13
|
+
name="Anna Black"
|
14
|
+
orientation="vertical"
|
15
|
+
size="lg"
|
16
|
+
title="Remodeling Consultant"
|
17
|
+
{...props}
|
18
|
+
/>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div>
|
22
|
+
<User
|
23
|
+
align="left"
|
24
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
25
|
+
bold={false}
|
26
|
+
name="Anna Black"
|
27
|
+
orientation="horizontal"
|
28
|
+
title="Remodeling Consultant"
|
29
|
+
{...props}
|
30
|
+
/>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div>
|
34
|
+
<User
|
35
|
+
align="left"
|
36
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
37
|
+
bold={false}
|
38
|
+
name="Anna Black"
|
39
|
+
orientation="horizontal"
|
40
|
+
{...props}
|
41
|
+
/>
|
42
|
+
|
43
|
+
<br />
|
44
|
+
|
45
|
+
<User
|
46
|
+
align="left"
|
47
|
+
avatar
|
48
|
+
bold={false}
|
49
|
+
name="Anna Black"
|
50
|
+
orientation="horizontal"
|
51
|
+
{...props}
|
52
|
+
/>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
)
|
57
|
+
}
|
58
|
+
|
59
|
+
export default UserLightWeight
|
@@ -2,6 +2,7 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- user_default: Default
|
5
|
+
- user_light_weight: Light Weight
|
5
6
|
- user_with_territory: With Territory
|
6
7
|
- user_text_only: Text Only
|
7
8
|
- user_size: Horizontal Size
|
@@ -11,6 +12,7 @@ examples:
|
|
11
12
|
|
12
13
|
react:
|
13
14
|
- user_default: Default
|
15
|
+
- user_light_weight: Light Weight
|
14
16
|
- user_with_territory: With Territory
|
15
17
|
- user_text_only: Text Only
|
16
18
|
- user_size: Horizontal Size
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export { default as UserDefault } from './_user_default.jsx'
|
2
|
+
export { default as UserLightWeight } from './_user_light_weight.jsx'
|
2
3
|
export { default as UserWithTerritory } from './_user_with_territory.jsx'
|
3
4
|
export { default as UserTextOnly } from './_user_text_only.jsx'
|
4
5
|
export { default as UserSize } from './_user_size.jsx'
|
@@ -12,7 +12,7 @@
|
|
12
12
|
}) %>
|
13
13
|
<% end %>
|
14
14
|
<%= content_tag(:div, class: "content_wrapper") do %>
|
15
|
-
<%= pb_rails("title", props: { text: object.name, size: object.title_size, dark: object.dark }) %>
|
15
|
+
<%= pb_rails("title", props: { text: object.name, size: object.title_size, dark: object.dark, bold: object.bold }) %>
|
16
16
|
<%= pb_rails("body", props: {
|
17
17
|
text: "#{object.details}",
|
18
18
|
dark: object.dark,
|
@@ -26,3 +26,17 @@ test('subtitle prop accepts a node', () => {
|
|
26
26
|
|
27
27
|
expect(screen.getByTestId('test-subtitle-block')).toHaveTextContent('test caption')
|
28
28
|
})
|
29
|
+
|
30
|
+
test('bold prop applies correct styling when false', () => {
|
31
|
+
render(
|
32
|
+
<User
|
33
|
+
bold={false}
|
34
|
+
data={{ testid: 'test-bold-false' }}
|
35
|
+
name="Anna Black"
|
36
|
+
/>
|
37
|
+
)
|
38
|
+
const titleElement = screen.getByText("Anna Black")
|
39
|
+
expect(titleElement).toBeInTheDocument()
|
40
|
+
|
41
|
+
expect(titleElement).toHaveClass('pb_title_kit_size_4_thin')
|
42
|
+
})
|