playbook_ui 13.11.1 → 13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655
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_card/_card_mixin.scss +0 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.rb +3 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls.html.erb +22 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls_multiple.html.erb +40 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_external_controls_multiple.md +1 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_collapsible/index.js +4 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_border_swift.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default_swift.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_flip_swift.md +11 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_rotate_swift.md +11 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_sizes_swift.md +46 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_image/docs/_image_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image_swift.md +47 -0
- data/app/pb_kits/playbook/pb_image/docs/_size_image_swift.md +47 -0
- data/app/pb_kits/playbook/pb_image/docs/_size_none_image_swift.md +15 -0
- data/app/pb_kits/playbook/pb_image/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_examples_swift.md +72 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_details_swift.md +41 -0
- data/app/pb_kits/playbook/pb_label_value/docs/_label_value_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_label_value/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_default_swift.md +57 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_props_swift.md +12 -0
- data/app/pb_kits/playbook/pb_message/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +13 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +5 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +14 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +18 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_header.html.erb +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_hover.scss +26 -2
- data/app/pb_kits/playbook/pb_table/styles/_table-dark.scss +1 -17
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +4 -3
- data/app/pb_kits/playbook/pb_table/table_header.rb +28 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +35 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +29 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +24 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +27 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +11 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +9 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +10 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +6 -0
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +25 -9
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.jsx +0 -2
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.jsx +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_selectors.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.md +5 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip_react.jsx +45 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip_react.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +6 -0
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +34 -0
- data/app/pb_kits/playbook/playbook-doc.js +1 -1
- data/dist/playbook-rails.js +3 -3
- data/lib/playbook/version.rb +2 -2
- metadata +56 -7
@@ -9,12 +9,10 @@ const TooltipDefaultReact = (props) => {
|
|
9
9
|
<Flex
|
10
10
|
flexDirection='row'
|
11
11
|
gap='md'
|
12
|
-
justifyContent='center'
|
13
12
|
wrap
|
14
13
|
>
|
15
14
|
<FlexItem>
|
16
15
|
<Tooltip
|
17
|
-
className={"customClassNameHere"}
|
18
16
|
placement='top'
|
19
17
|
text="Whoa. I'm a Tooltip"
|
20
18
|
zIndex={10}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= pb_rails("flex", props: {
|
1
|
+
<%= pb_rails("flex", props: { orientation: "column" }) do %>
|
2
2
|
<%= pb_rails("flex/flex_item", props: {margin_top: "md"}) do %>
|
3
3
|
<%= pb_rails("button", props: {classname: "tooltip-example-trigger", text: "Example 1"}) %>
|
4
4
|
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
<%= pb_rails("flex", props: { orientation: "column", gap: "md" }) do %>
|
3
|
+
<%= pb_rails("button", props: {text: "Toggle state", id: "toggle-tooltip-button"}) %>
|
4
|
+
<%= pb_rails("body") do %>
|
5
|
+
Tooltip is: <code id="show-tooltip-state">enabled</code>
|
6
|
+
<% end %>
|
7
|
+
<%= pb_rails("flex/flex_item") do %>
|
8
|
+
<span id="truncated-tooltip-1">Hover me</span>
|
9
|
+
<%= pb_rails("tooltip", props: {
|
10
|
+
trigger_element_selector: "#truncated-tooltip-1",
|
11
|
+
tooltip_id: "truncated-1",
|
12
|
+
position: "right",
|
13
|
+
}) do %>
|
14
|
+
Tooltip is enabled
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
|
20
|
+
<script>
|
21
|
+
const toggleTooltipButton = document.getElementById("toggle-tooltip-button");
|
22
|
+
const showTooltipStateText = document.getElementById("show-tooltip-state");
|
23
|
+
|
24
|
+
function hideTooltipIfNotTruncated(tooltipId) {
|
25
|
+
const tooltipElement = document.querySelector(
|
26
|
+
`[data-pb-tooltip-tooltip-id="${tooltipId}"]`
|
27
|
+
);
|
28
|
+
|
29
|
+
tooltipElement.dataset.pbTooltipShowTooltip =
|
30
|
+
tooltipElement.dataset.pbTooltipShowTooltip == "false" ? "true" : "false";
|
31
|
+
|
32
|
+
showTooltipStateText.innerText =
|
33
|
+
tooltipElement.dataset.pbTooltipShowTooltip == "false" ? "disabled" : "enabled";
|
34
|
+
}
|
35
|
+
|
36
|
+
toggleTooltipButton.addEventListener("click", () => {
|
37
|
+
hideTooltipIfNotTruncated("truncated-1");
|
38
|
+
});
|
39
|
+
</script>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
You can build your own logic to control whether to show or hide the tooltip.
|
2
|
+
|
3
|
+
Click on the `Toggle state` button to change the state of the component and hover over the 'hover me' text to see it in action.
|
4
|
+
|
5
|
+
Each Tooltip has a `dataset` with the `pbTooltipShowTooltip` property set to true by default. To update it, access the `pbTooltipShowTooltip` in the dataset of your tooltip element: `yourTooltip.dataset.pbTooltipShowTooltip = 'false'`
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import React, { useState } from 'react'
|
4
|
+
import { Button, Body, Flex, FlexItem, Tooltip } from '../..'
|
5
|
+
|
6
|
+
const TooltipShowTooltipReact = (props) => {
|
7
|
+
const [showTooltip, setShowTooltip] = useState(true);
|
8
|
+
|
9
|
+
return (
|
10
|
+
<Flex
|
11
|
+
flexDirection='column'
|
12
|
+
gap='md'
|
13
|
+
wrap
|
14
|
+
>
|
15
|
+
<FlexItem>
|
16
|
+
<Button
|
17
|
+
onClick={()=> setShowTooltip(!showTooltip)}
|
18
|
+
text="Toggle state"
|
19
|
+
/>
|
20
|
+
</FlexItem>
|
21
|
+
<FlexItem>
|
22
|
+
<Body >
|
23
|
+
<p>
|
24
|
+
{'Tooltip is: '}
|
25
|
+
<code>{showTooltip ? "enabled" : "disabled"}</code>
|
26
|
+
</p>
|
27
|
+
</Body>
|
28
|
+
</FlexItem>
|
29
|
+
<FlexItem>
|
30
|
+
<Tooltip
|
31
|
+
placement='right'
|
32
|
+
showTooltip={showTooltip}
|
33
|
+
text='Tooltip is enabled'
|
34
|
+
zIndex={10}
|
35
|
+
{...props}
|
36
|
+
>
|
37
|
+
{'Hover me.'}
|
38
|
+
</Tooltip>
|
39
|
+
</FlexItem>
|
40
|
+
|
41
|
+
</Flex>
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
export default TooltipShowTooltipReact
|
@@ -4,6 +4,7 @@ examples:
|
|
4
4
|
- tooltip_default: Default
|
5
5
|
- tooltip_selectors: Using Common Selectors
|
6
6
|
- tooltip_with_icon_circle: Icon Circle Tooltip
|
7
|
+
- tooltip_show_tooltip: Show Tooltip
|
7
8
|
|
8
9
|
react:
|
9
10
|
- tooltip_default_react: Default
|
@@ -11,3 +12,5 @@ examples:
|
|
11
12
|
- tooltip_margin: Margin
|
12
13
|
- tooltip_icon: Tooltip with Icon
|
13
14
|
- tooltip_delay: Delay
|
15
|
+
- tooltip_show_tooltip_react: Show Tooltip
|
16
|
+
|
@@ -3,3 +3,4 @@ export { default as TooltipInteraction } from './_tooltip_interaction'
|
|
3
3
|
export { default as TooltipMargin } from './_tooltip_margin'
|
4
4
|
export { default as TooltipIcon } from './_tooltip_icon'
|
5
5
|
export { default as TooltipDelay } from './_tooltip_delay'
|
6
|
+
export { default as TooltipShowTooltipReact } from './_tooltip_show_tooltip_react'
|
@@ -54,6 +54,8 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
showTooltip(trigger) {
|
57
|
+
if (this.shouldShowTooltip === "false") return
|
58
|
+
|
57
59
|
this.popper = createPopper(trigger, this.tooltip, {
|
58
60
|
placement: this.position,
|
59
61
|
modifiers: [
|
@@ -127,4 +129,8 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
127
129
|
get triggerElementSelector() {
|
128
130
|
return this.element.dataset.pbTooltipTriggerElementSelector
|
129
131
|
}
|
132
|
+
|
133
|
+
get shouldShowTooltip() {
|
134
|
+
return this.element.dataset.pbTooltipShowTooltip
|
135
|
+
}
|
130
136
|
}
|
@@ -20,7 +20,8 @@ module Playbook
|
|
20
20
|
pb_tooltip_position: position,
|
21
21
|
pb_tooltip_trigger_element_selector: trigger_element_selector,
|
22
22
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
23
|
-
pb_tooltip_tooltip_id: tooltip_id
|
23
|
+
pb_tooltip_tooltip_id: tooltip_id,
|
24
|
+
pb_tooltip_show_tooltip: true
|
24
25
|
)
|
25
26
|
end
|
26
27
|
|
@@ -92,5 +92,39 @@ test("has position fixed", async () => {
|
|
92
92
|
cleanup();
|
93
93
|
})
|
94
94
|
|
95
|
+
cleanup();
|
96
|
+
});
|
97
|
+
|
98
|
+
test("display tooltip with showTooltip set to true", async () => {
|
99
|
+
render(
|
100
|
+
<Tooltip
|
101
|
+
data={{ testid: "fixed-position-test" }}
|
102
|
+
showTooltip
|
103
|
+
/>
|
104
|
+
);
|
105
|
+
|
106
|
+
fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
|
107
|
+
await waitFor(() => {
|
108
|
+
expect(screen.queryByRole("tooltip")).toBeInTheDocument();
|
109
|
+
cleanup();
|
110
|
+
})
|
111
|
+
|
112
|
+
cleanup();
|
113
|
+
});
|
114
|
+
|
115
|
+
test("doesn't display tooltip with showTooltip set to false", async () => {
|
116
|
+
render(
|
117
|
+
<Tooltip
|
118
|
+
data={{ testid: "fixed-position-test" }}
|
119
|
+
showTooltip={false}
|
120
|
+
/>
|
121
|
+
);
|
122
|
+
|
123
|
+
fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
|
124
|
+
await waitFor(() => {
|
125
|
+
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
126
|
+
cleanup();
|
127
|
+
})
|
128
|
+
|
95
129
|
cleanup();
|
96
130
|
});
|
@@ -104,7 +104,7 @@ import * as UserBadge from 'pb_user_badge/docs'
|
|
104
104
|
import * as Walkthrough from 'pb_walkthrough/docs'
|
105
105
|
import * as WeekdayStacked from 'pb_weekday_stacked/docs'
|
106
106
|
|
107
|
-
WebpackerReact.
|
107
|
+
WebpackerReact.registerComponents({
|
108
108
|
...Avatar,
|
109
109
|
...AvatarActionButton,
|
110
110
|
...Background,
|