playbook_ui 11.2.7 → 11.3.0.pre.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/index.js +1 -0
- data/app/pb_kits/playbook/pb_collapsible/{_collapsible.jsx → _collapsible.tsx} +4 -6
- data/app/pb_kits/playbook/pb_collapsible/child_kits/{CollapsibleContent.jsx → CollapsibleContent.tsx} +3 -5
- data/app/pb_kits/playbook/pb_collapsible/child_kits/{CollapsibleMain.jsx → CollapsibleMain.tsx} +4 -4
- data/app/pb_kits/playbook/pb_collapsible/{context.js → context.ts} +0 -0
- data/app/pb_kits/playbook/pb_collapsible/types.d.ts +1 -0
- data/app/pb_kits/playbook/pb_currency/_currency.scss +2 -1
- data/app/pb_kits/playbook/pb_distribution_bar/{_distribution_bar.jsx → _distribution_bar.tsx} +5 -7
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_list/list.rb +6 -8
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +49 -6
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +144 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.jsx +59 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.md +5 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +10 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.jsx +52 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.jsx +40 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.jsx +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_with_icon_circle.html.erb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +7 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +50 -0
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/dist/reset.css +60 -1
- data/lib/playbook/version.rb +2 -2
- metadata +22 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f967a874bbc5da6ef545ed133328666b04dab22fcbf922340c0ba605289c21
|
4
|
+
data.tar.gz: 58d5fec99769fd4351f47b17f51acb8f08f921e32e7fe7fb06c0d0dd8e0fc2a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e0f4f113b1ab02fab3e4569b8486406fa36c002dd383daa38c88db267070af2704b587931b22bb62133fbc23b7d2e0f375960627e591f0bd5412dca2dcc4c3e
|
7
|
+
data.tar.gz: 2935e5481d78744eb0b81d5acc4f7934407433545c2f784819275889c3b213da422d12bd1fba5b7ef53680089ce381932b7aa739f7b164128d2aa0b2e973c3da
|
@@ -98,6 +98,7 @@ export { default as Title } from './pb_title/_title'
|
|
98
98
|
export { default as TitleCount } from './pb_title_count/_title_count'
|
99
99
|
export { default as TitleDetail } from './pb_title_detail/_title_detail'
|
100
100
|
export { default as Toggle } from './pb_toggle/_toggle'
|
101
|
+
export { default as Tooltip } from './pb_tooltip/_tooltip'
|
101
102
|
export { default as TreemapChart } from './pb_treemap_chart/_treemap_chart'
|
102
103
|
export { default as Typeahead } from './pb_typeahead/_typeahead'
|
103
104
|
export { default as User } from './pb_user/_user'
|
@@ -1,7 +1,4 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React, { useState } from 'react'
|
4
|
-
|
5
2
|
import classnames from 'classnames'
|
6
3
|
|
7
4
|
import { globalProps } from '../utilities/globalProps'
|
@@ -12,8 +9,8 @@ import CollapsibleMain from './child_kits/CollapsibleMain'
|
|
12
9
|
import CollapsibleContext from './context'
|
13
10
|
|
14
11
|
type CollapsibleProps = {
|
15
|
-
children
|
16
|
-
aria?:
|
12
|
+
children?: JSX.Element | [],
|
13
|
+
aria?: {[key: string]: string},
|
17
14
|
className?: string,
|
18
15
|
collapsed?: boolean,
|
19
16
|
data?: object,
|
@@ -21,6 +18,7 @@ type CollapsibleProps = {
|
|
21
18
|
padding?: string,
|
22
19
|
}
|
23
20
|
|
21
|
+
|
24
22
|
const useCollapsible = (initial = false) => {
|
25
23
|
const [collapsed, setCollapsed] = useState(initial)
|
26
24
|
|
@@ -41,7 +39,7 @@ const Collapsible = ({
|
|
41
39
|
...props
|
42
40
|
}: CollapsibleProps) => {
|
43
41
|
const [isCollapsed, collapse] = useCollapsible(collapsed)
|
44
|
-
const CollapsibleParent = React.Children.toArray(children)
|
42
|
+
const CollapsibleParent = React.Children.toArray(children) as JSX.Element[]
|
45
43
|
|
46
44
|
if (CollapsibleParent.length !== 2) {
|
47
45
|
throw new Error('Collapsible requires <CollapsibleMain> and <CollapsibleContent> to function properly.')
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import classnames from 'classnames'
|
4
2
|
import React, { useContext } from 'react'
|
5
3
|
import AnimateHeight from 'react-animate-height'
|
@@ -8,8 +6,8 @@ import { globalProps } from '../../utilities/globalProps'
|
|
8
6
|
|
9
7
|
import CollapsibleContext from '../context'
|
10
8
|
|
11
|
-
type CollapsibleContentProps = {
|
12
|
-
children
|
9
|
+
export type CollapsibleContentProps = {
|
10
|
+
children?: React.ReactNode[] | React.ReactNode | string,
|
13
11
|
className?: string,
|
14
12
|
padding?: string,
|
15
13
|
}
|
@@ -20,7 +18,7 @@ const CollapsibleContent = ({
|
|
20
18
|
padding = 'md',
|
21
19
|
...props
|
22
20
|
}: CollapsibleContentProps) => {
|
23
|
-
const context = useContext(CollapsibleContext)
|
21
|
+
const context: {[key: string]: boolean | string} = useContext(CollapsibleContext)
|
24
22
|
const contentCSS = buildCss('pb_collapsible_content_kit')
|
25
23
|
const contentSpacing = globalProps(props, { padding })
|
26
24
|
|
data/app/pb_kits/playbook/pb_collapsible/child_kits/{CollapsibleMain.jsx → CollapsibleMain.tsx}
RENAMED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
1
|
|
3
2
|
import classnames from 'classnames'
|
4
3
|
import React, { useContext } from 'react'
|
@@ -10,13 +9,14 @@ import FlexItem from '../../pb_flex/_flex_item'
|
|
10
9
|
import CollapsibleContext from '../context'
|
11
10
|
|
12
11
|
type CollapsibleMainProps = {
|
13
|
-
children:
|
12
|
+
children: React.ReactNode[] | React.ReactNode,
|
14
13
|
className?: string,
|
15
14
|
padding?: string,
|
15
|
+
cursor?: string
|
16
16
|
}
|
17
17
|
|
18
18
|
type IconProps = {
|
19
|
-
collapsed: boolean
|
19
|
+
collapsed: boolean | (()=> void)
|
20
20
|
}
|
21
21
|
|
22
22
|
const Icon = ({ collapsed }: IconProps) => {
|
@@ -40,7 +40,7 @@ const CollapsibleMain = ({
|
|
40
40
|
|
41
41
|
...props
|
42
42
|
}: CollapsibleMainProps) => {
|
43
|
-
const context = useContext(CollapsibleContext)
|
43
|
+
const context: {[key: string]: (()=> void)} | boolean = useContext(CollapsibleContext)
|
44
44
|
const mainCSS = buildCss('pb_collapsible_main_kit')
|
45
45
|
const mainSpacing = globalProps(props, { cursor, padding })
|
46
46
|
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'react-animate-height'
|
@@ -23,6 +23,7 @@
|
|
23
23
|
}
|
24
24
|
[class^=pb_currency_wrapper] {
|
25
25
|
display: flex;
|
26
|
+
align-items: baseline;
|
26
27
|
|
27
28
|
&[class*=_deemphasized] [class^=pb_body_kit][class*=_light] {
|
28
29
|
color: $text_lt_default;
|
@@ -48,7 +49,7 @@
|
|
48
49
|
|
49
50
|
& > [class*=dollar_sign] {
|
50
51
|
display: flex;
|
51
|
-
align-
|
52
|
+
align-self: flex-start;
|
52
53
|
}
|
53
54
|
& > [class*=unit] {
|
54
55
|
display: flex;
|
data/app/pb_kits/playbook/pb_distribution_bar/{_distribution_bar.jsx → _distribution_bar.tsx}
RENAMED
@@ -1,26 +1,24 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { globalProps } from '../utilities/globalProps'
|
6
4
|
|
7
5
|
type DistributionBarProps = {
|
8
6
|
className?: string,
|
9
|
-
colors:
|
7
|
+
colors: [],
|
10
8
|
data?: string,
|
11
9
|
id?: string,
|
12
10
|
size?: "lg" | "sm",
|
13
|
-
widths?:
|
11
|
+
widths?: number[],
|
14
12
|
}
|
15
13
|
|
16
|
-
const normalizeCharacters = (widths) => {
|
14
|
+
const normalizeCharacters = (widths: number[]) => {
|
17
15
|
return widths.map((width) => {
|
18
16
|
return parseInt(width.toString().replace(/[^0-9.]/gi, ''))
|
19
17
|
})
|
20
18
|
}
|
21
19
|
|
22
|
-
const barValues = (normalizedValues, colors) => {
|
23
|
-
const arrSum = (value) => value.reduce((a, b) => a + b, 0)
|
20
|
+
const barValues = (normalizedValues: number[], colors: []) => {
|
21
|
+
const arrSum = (value: number[]) => value.reduce((a, b) => a + b, 0)
|
24
22
|
const widthSum = arrSum(normalizedValues)
|
25
23
|
return normalizedValues.map((value, i) => {
|
26
24
|
return (
|
@@ -19,14 +19,12 @@ module Playbook
|
|
19
19
|
prop :tabindex
|
20
20
|
|
21
21
|
def list_classname
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
layout_class,
|
29
|
-
].compact.join("_")
|
22
|
+
generate_classname("pb_list_kit",
|
23
|
+
xpadding_class,
|
24
|
+
borderless_class,
|
25
|
+
dark_class,
|
26
|
+
size_class,
|
27
|
+
layout_class)
|
30
28
|
end
|
31
29
|
|
32
30
|
def ordered_class
|
@@ -23,6 +23,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
23
23
|
}
|
24
24
|
|
25
25
|
[class^="pb_tooltip_kit"] {
|
26
|
+
~ .tooltip_tooltip,
|
26
27
|
.tooltip_tooltip {
|
27
28
|
display: block;
|
28
29
|
opacity: 0;
|
@@ -52,15 +53,42 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
52
53
|
border-width: 10px;
|
53
54
|
margin-bottom: 50px;
|
54
55
|
}
|
56
|
+
|
57
|
+
&.visible,
|
55
58
|
&.show {
|
56
|
-
opacity: 1;
|
57
59
|
z-index: $z_9;
|
58
|
-
margin-bottom: $space_sm;
|
59
|
-
background-color: $white;
|
60
60
|
padding: $space_xs $space_sm;
|
61
61
|
box-shadow: $shadow_deeper;
|
62
62
|
border-radius: $border_rad_light;
|
63
|
+
}
|
63
64
|
|
65
|
+
// react only
|
66
|
+
&.visible {
|
67
|
+
color: $white;
|
68
|
+
background-color: rgba($black, $opacity_9);
|
69
|
+
&.right {
|
70
|
+
box-shadow: -8px 0 28px 0 $tooltip_shadow;
|
71
|
+
}
|
72
|
+
&.bottom {
|
73
|
+
box-shadow: 0 -12px 28px 0 $tooltip_shadow;
|
74
|
+
}
|
75
|
+
&.left {
|
76
|
+
box-shadow: 8px 0 28px 0 $tooltip_shadow;
|
77
|
+
}
|
78
|
+
// react arrow
|
79
|
+
.arrow_bg {
|
80
|
+
width: 10px;
|
81
|
+
height: 10px;
|
82
|
+
background-color: rgba($black, $opacity_9);
|
83
|
+
transform: rotate(45deg);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
//rails only
|
88
|
+
&.show {
|
89
|
+
opacity: 1;
|
90
|
+
margin-bottom: $space_sm;
|
91
|
+
background-color: $white;
|
64
92
|
&.fade_out {
|
65
93
|
animation-name: fadeOut;
|
66
94
|
animation-duration: 150ms;
|
@@ -69,14 +97,29 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
69
97
|
}
|
70
98
|
}
|
71
99
|
}
|
100
|
+
|
101
|
+
&.dark,
|
72
102
|
&[class*=_dark]{
|
73
|
-
|
74
|
-
|
75
|
-
|
103
|
+
~.tooltip_tooltip,
|
104
|
+
.tooltip_tooltip {
|
105
|
+
//react
|
106
|
+
&.visible {
|
107
|
+
color: $charcoal;
|
108
|
+
background-color: $white;
|
109
|
+
}
|
110
|
+
//rails
|
111
|
+
&.show {
|
112
|
+
color: $white;
|
113
|
+
background-color: rgba($black, $opacity_9);
|
114
|
+
}
|
76
115
|
.arrow {
|
77
116
|
border-color: $black transparent transparent transparent;
|
78
117
|
opacity: $opacity_9;
|
79
118
|
}
|
119
|
+
// react arrow
|
120
|
+
.arrow_bg {
|
121
|
+
background-color: $white;
|
122
|
+
}
|
80
123
|
&.flipped {
|
81
124
|
.arrow {
|
82
125
|
border-color: transparent transparent $black transparent;
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* @flow*/
|
2
|
+
|
3
|
+
import React, { useRef, useState } from "react"
|
4
|
+
import classnames from "classnames"
|
5
|
+
import {
|
6
|
+
Placement,
|
7
|
+
offset,
|
8
|
+
arrow,
|
9
|
+
shift,
|
10
|
+
useFloating,
|
11
|
+
useInteractions,
|
12
|
+
useHover,
|
13
|
+
flip,
|
14
|
+
safePolygon,
|
15
|
+
} from "@floating-ui/react-dom-interactions"
|
16
|
+
import { GlobalProps, globalProps } from "../utilities/globalProps"
|
17
|
+
import { buildAriaProps, buildDataProps } from "../utilities/props"
|
18
|
+
import Flex from "../pb_flex/_flex"
|
19
|
+
|
20
|
+
type TooltipProps = {
|
21
|
+
aria?: { [key: string]: string },
|
22
|
+
data?: { [key: string]: string },
|
23
|
+
text: string,
|
24
|
+
icon?: string,
|
25
|
+
interaction?: boolean,
|
26
|
+
placement?: Placement,
|
27
|
+
children: JSX.Element,
|
28
|
+
zIndex?: Pick<GlobalProps, "ZIndex">,
|
29
|
+
} & GlobalProps
|
30
|
+
|
31
|
+
const Tooltip = (props: TooltipProps) => {
|
32
|
+
const {
|
33
|
+
aria = {},
|
34
|
+
children,
|
35
|
+
data = {},
|
36
|
+
icon = null,
|
37
|
+
interaction = false,
|
38
|
+
text,
|
39
|
+
placement: preferredPlacement = "top",
|
40
|
+
zIndex,
|
41
|
+
...rest
|
42
|
+
} = props
|
43
|
+
|
44
|
+
console.log(rest)
|
45
|
+
|
46
|
+
const dataProps: { [key: string]: any } = buildDataProps(data)
|
47
|
+
const ariaProps: { [key: string]: any } = buildAriaProps(aria)
|
48
|
+
|
49
|
+
const css = classnames(globalProps({...rest}))
|
50
|
+
const [open, setOpen] = useState(false)
|
51
|
+
const arrowRef = useRef(null)
|
52
|
+
const {
|
53
|
+
x,
|
54
|
+
y,
|
55
|
+
reference,
|
56
|
+
floating,
|
57
|
+
strategy,
|
58
|
+
context,
|
59
|
+
placement,
|
60
|
+
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
|
61
|
+
} = useFloating({
|
62
|
+
placement: preferredPlacement,
|
63
|
+
open,
|
64
|
+
onOpenChange(open) {
|
65
|
+
setOpen(open)
|
66
|
+
},
|
67
|
+
middleware: [
|
68
|
+
offset(10),
|
69
|
+
shift(),
|
70
|
+
flip({
|
71
|
+
fallbackPlacements: ["top", "right", "bottom", "left"],
|
72
|
+
fallbackStrategy: "initialPlacement",
|
73
|
+
flipAlignment: false,
|
74
|
+
}),
|
75
|
+
arrow({
|
76
|
+
element: arrowRef,
|
77
|
+
}),
|
78
|
+
],
|
79
|
+
})
|
80
|
+
|
81
|
+
const { getFloatingProps } = useInteractions([
|
82
|
+
useHover(context, {
|
83
|
+
handleClose: interaction ? safePolygon({
|
84
|
+
blockPointerEvents: false
|
85
|
+
}) : null,
|
86
|
+
})
|
87
|
+
])
|
88
|
+
|
89
|
+
const staticSide = {
|
90
|
+
top: "bottom",
|
91
|
+
right: "left",
|
92
|
+
bottom: "top",
|
93
|
+
left: "right",
|
94
|
+
}[placement.split("-")[0]]
|
95
|
+
|
96
|
+
return (
|
97
|
+
<>
|
98
|
+
<div
|
99
|
+
ref={reference}
|
100
|
+
className={`pb_tooltip_kit ${css}`}
|
101
|
+
style={{ display: "inline-flex" }}
|
102
|
+
role="tooltip_trigger"
|
103
|
+
{...ariaProps}
|
104
|
+
{...dataProps}
|
105
|
+
>
|
106
|
+
{children}
|
107
|
+
</div>
|
108
|
+
{open && (
|
109
|
+
<div
|
110
|
+
{...getFloatingProps({
|
111
|
+
role: "tooltip",
|
112
|
+
ref: floating,
|
113
|
+
className: `tooltip_tooltip ${placement} visible`,
|
114
|
+
style: {
|
115
|
+
position: strategy,
|
116
|
+
top: y ?? 0,
|
117
|
+
left: x ?? 0,
|
118
|
+
zIndex: zIndex ?? 0,
|
119
|
+
},
|
120
|
+
})}
|
121
|
+
>
|
122
|
+
<Flex gap="xs" align="center">
|
123
|
+
{icon && (
|
124
|
+
<i className={`pb_icon_kit far fa-${icon} fa-fw`} />
|
125
|
+
)}
|
126
|
+
{text}
|
127
|
+
</Flex>
|
128
|
+
<div
|
129
|
+
ref={arrowRef}
|
130
|
+
className="arrow_bg"
|
131
|
+
style={{
|
132
|
+
position: strategy,
|
133
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
134
|
+
top: arrowY != null ? `${arrowY}px` : "",
|
135
|
+
[staticSide]: "-5px",
|
136
|
+
}}
|
137
|
+
/>
|
138
|
+
</div>
|
139
|
+
)}
|
140
|
+
</>
|
141
|
+
)
|
142
|
+
}
|
143
|
+
|
144
|
+
export default Tooltip
|
@@ -0,0 +1,59 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import { Tooltip, Flex, FlexItem } from '../..';
|
5
|
+
|
6
|
+
const TooltipDefaultReact = (props) => {
|
7
|
+
|
8
|
+
return (
|
9
|
+
<Flex
|
10
|
+
flexDirection='row'
|
11
|
+
gap='md'
|
12
|
+
justifyContent='center'
|
13
|
+
wrap
|
14
|
+
>
|
15
|
+
<FlexItem>
|
16
|
+
<Tooltip
|
17
|
+
placement='top'
|
18
|
+
text="Whoa. I'm a Tooltip"
|
19
|
+
zIndex={10}
|
20
|
+
{...props}
|
21
|
+
>
|
22
|
+
{'Hover here (Top)'}
|
23
|
+
</Tooltip>
|
24
|
+
</FlexItem>
|
25
|
+
<FlexItem>
|
26
|
+
<Tooltip
|
27
|
+
placement='bottom'
|
28
|
+
text="Whoa. I'm a Tooltip"
|
29
|
+
zIndex={10}
|
30
|
+
{...props}
|
31
|
+
>
|
32
|
+
{'Hover here (Bottom)'}
|
33
|
+
</Tooltip>
|
34
|
+
</FlexItem>
|
35
|
+
<FlexItem>
|
36
|
+
<Tooltip
|
37
|
+
placement='right'
|
38
|
+
text="Whoa. I'm a Tooltip"
|
39
|
+
zIndex={10}
|
40
|
+
{...props}
|
41
|
+
>
|
42
|
+
{'Hover here (Right)'}
|
43
|
+
</Tooltip>
|
44
|
+
</FlexItem>
|
45
|
+
<FlexItem>
|
46
|
+
<Tooltip
|
47
|
+
placement='left'
|
48
|
+
text="Whoa. I'm a Tooltip"
|
49
|
+
zIndex={10}
|
50
|
+
{...props}
|
51
|
+
>
|
52
|
+
{'Hover here (Left)'}
|
53
|
+
</Tooltip>
|
54
|
+
</FlexItem>
|
55
|
+
</Flex>
|
56
|
+
)
|
57
|
+
}
|
58
|
+
|
59
|
+
export default TooltipDefaultReact
|
@@ -0,0 +1,5 @@
|
|
1
|
+
You can define the tooltip placement sending the prop `placement` with one of the available options: `top | right | bottom | left`.
|
2
|
+
|
3
|
+
If you don't specify a desired `placement`, the component will automatically choose the one that fits better.
|
4
|
+
|
5
|
+
If the desired `placement` doesn't fit on screen, the component will automatically switch to the one that fits better.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= pb_rails("icon_circle", props: { icon: "paper-plane", id: "result-1-sample-email-link" }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("tooltip", props: {
|
4
|
+
trigger_element_id: "result-1-sample-email-link",
|
5
|
+
tooltip_id: "sample-email-tooltip-result-1",
|
6
|
+
position: "top",
|
7
|
+
dark: true
|
8
|
+
}) do %>
|
9
|
+
Send Email
|
10
|
+
<% end %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import { Tooltip, Button, Flex } from '../..'
|
5
|
+
|
6
|
+
const TooltipIcon = (props) => {
|
7
|
+
return (
|
8
|
+
<Flex flexDirection='row'
|
9
|
+
gap='md'
|
10
|
+
wrap
|
11
|
+
>
|
12
|
+
<Tooltip
|
13
|
+
icon='paper-plane'
|
14
|
+
placement='top'
|
15
|
+
text='Send Email'
|
16
|
+
zIndex={10}
|
17
|
+
{...props}
|
18
|
+
>
|
19
|
+
<Button text='Tooltip With Icon' />
|
20
|
+
</Tooltip>
|
21
|
+
<Tooltip
|
22
|
+
icon='paper-plane'
|
23
|
+
placement='bottom'
|
24
|
+
text='Send Email'
|
25
|
+
zIndex={10}
|
26
|
+
{...props}
|
27
|
+
>
|
28
|
+
<Button text='Tooltip With Icon' />
|
29
|
+
</Tooltip>
|
30
|
+
<Tooltip
|
31
|
+
icon='paper-plane'
|
32
|
+
placement='right'
|
33
|
+
text='Send Email'
|
34
|
+
zIndex={10}
|
35
|
+
{...props}
|
36
|
+
>
|
37
|
+
<Button text='Tooltip With Icon' />
|
38
|
+
</Tooltip>
|
39
|
+
<Tooltip
|
40
|
+
icon='paper-plane'
|
41
|
+
placement='left'
|
42
|
+
text='Send Email'
|
43
|
+
zIndex={10}
|
44
|
+
{...props}
|
45
|
+
>
|
46
|
+
<Button text='Tooltip With Icon' />
|
47
|
+
</Tooltip>
|
48
|
+
</Flex>
|
49
|
+
)
|
50
|
+
}
|
51
|
+
|
52
|
+
export default TooltipIcon
|
@@ -0,0 +1 @@
|
|
1
|
+
Set the prop `icon` with the desired icon to display inside the tooltip.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import { Tooltip, Button, Flex, FlexItem } from '../..';
|
5
|
+
|
6
|
+
const TooltipInteraction = (props) => {
|
7
|
+
|
8
|
+
return (
|
9
|
+
<Flex
|
10
|
+
flexDirection='row'
|
11
|
+
gap='md'
|
12
|
+
justifyContent='center'
|
13
|
+
wrap
|
14
|
+
>
|
15
|
+
<FlexItem>
|
16
|
+
<Tooltip
|
17
|
+
interaction
|
18
|
+
placement='top'
|
19
|
+
text="You can copy me"
|
20
|
+
zIndex={10}
|
21
|
+
{...props}
|
22
|
+
>
|
23
|
+
<Button text="With Interaction"/>
|
24
|
+
</Tooltip>
|
25
|
+
</FlexItem>
|
26
|
+
<FlexItem>
|
27
|
+
<Tooltip
|
28
|
+
placement='top'
|
29
|
+
text="I'm just a regular tooltip"
|
30
|
+
zIndex={10}
|
31
|
+
{...props}
|
32
|
+
>
|
33
|
+
<Button text="No Interaction"/>
|
34
|
+
</Tooltip>
|
35
|
+
</FlexItem>
|
36
|
+
</Flex>
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
export default TooltipInteraction
|
@@ -0,0 +1 @@
|
|
1
|
+
Set the prop `interaction` as `true` for cases that require users to copy the content inside the tooltip.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// @flow
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import { Tooltip, Flex, CircleIconButton } from '../..'
|
5
|
+
|
6
|
+
const TooltipMargin = (props) => {
|
7
|
+
return (
|
8
|
+
<Flex
|
9
|
+
flexDirection='row'
|
10
|
+
justifyContent='center'
|
11
|
+
wrap
|
12
|
+
>
|
13
|
+
<Tooltip
|
14
|
+
margin='md'
|
15
|
+
placement='top'
|
16
|
+
text='Send Email'
|
17
|
+
zIndex={10}
|
18
|
+
{...props}
|
19
|
+
>
|
20
|
+
<CircleIconButton
|
21
|
+
icon='paper-plane'
|
22
|
+
/>
|
23
|
+
</Tooltip>
|
24
|
+
<Tooltip
|
25
|
+
margin='md'
|
26
|
+
placement='top'
|
27
|
+
text='Send Email'
|
28
|
+
zIndex={10}
|
29
|
+
{...props}
|
30
|
+
>
|
31
|
+
<CircleIconButton
|
32
|
+
icon='paper-plane'
|
33
|
+
/>
|
34
|
+
</Tooltip>
|
35
|
+
</Flex>
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
export default TooltipMargin
|
@@ -0,0 +1,3 @@
|
|
1
|
+
You should set `margin` in the `tooltip` component itself. If you add this prop to the child, it will cause the tooltip to be pulled away from the trigger.
|
2
|
+
|
3
|
+
It is not recommended to set `padding` in the `tooltip` nor its child, doing so will cause it to be pulled away from its trigger element.
|
@@ -4,4 +4,10 @@ examples:
|
|
4
4
|
- tooltip_default: Default
|
5
5
|
- tooltip_selectors: Using Common Selectors
|
6
6
|
- tooltip_white: White
|
7
|
-
- tooltip_with_icon_circle: Icon Circle
|
7
|
+
- tooltip_with_icon_circle: Icon Circle Tooltip
|
8
|
+
|
9
|
+
react:
|
10
|
+
- tooltip_default_react: Default
|
11
|
+
- tooltip_interaction: Content Interaction
|
12
|
+
- tooltip_margin: Margin
|
13
|
+
- tooltip_icon: Tooltip with Icon
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { cleanup, render, screen, fireEvent } from "../utilities/test-utils";
|
3
|
+
import { Button, Tooltip } from "..";
|
4
|
+
|
5
|
+
function TooltipTest() {
|
6
|
+
const text = "this is a text",
|
7
|
+
placement = "top",
|
8
|
+
triggerText = "hover me",
|
9
|
+
zIndex = "10";
|
10
|
+
|
11
|
+
return (
|
12
|
+
<Tooltip
|
13
|
+
data={{ testid: "primary-test" }}
|
14
|
+
placement={placement}
|
15
|
+
text={text}
|
16
|
+
zIndex={zIndex}
|
17
|
+
>
|
18
|
+
<Button text={triggerText} />
|
19
|
+
</Tooltip>
|
20
|
+
);
|
21
|
+
}
|
22
|
+
|
23
|
+
test("renders the component", () => {
|
24
|
+
render(<TooltipTest />);
|
25
|
+
|
26
|
+
const kit = screen.getByTestId("primary-test");
|
27
|
+
expect(kit).toBeInTheDocument();
|
28
|
+
expect(kit).toHaveClass("pb_tooltip_kit");
|
29
|
+
|
30
|
+
cleanup();
|
31
|
+
});
|
32
|
+
|
33
|
+
test("opens on mouseenter", () => {
|
34
|
+
render(<TooltipTest />);
|
35
|
+
|
36
|
+
fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
|
37
|
+
expect(screen.queryByRole("tooltip")).toBeInTheDocument();
|
38
|
+
|
39
|
+
cleanup();
|
40
|
+
});
|
41
|
+
|
42
|
+
test("closes on mouseleave", () => {
|
43
|
+
render(<TooltipTest />);
|
44
|
+
|
45
|
+
fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
|
46
|
+
fireEvent.mouseLeave(screen.getByRole("tooltip_trigger"));
|
47
|
+
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
48
|
+
|
49
|
+
cleanup();
|
50
|
+
});
|
@@ -92,6 +92,7 @@ import * as Title from 'pb_title/docs'
|
|
92
92
|
import * as TitleCount from 'pb_title_count/docs'
|
93
93
|
import * as TitleDetail from 'pb_title_detail/docs'
|
94
94
|
import * as Toggle from 'pb_toggle/docs'
|
95
|
+
import * as Tooltip from 'pb_tooltip/docs'
|
95
96
|
import * as TreemapChart from 'pb_treemap_chart/docs'
|
96
97
|
import * as Typeahead from 'pb_typeahead/docs'
|
97
98
|
import * as User from 'pb_user/docs'
|
@@ -188,6 +189,7 @@ WebpackerReact.setup({
|
|
188
189
|
...TitleCount,
|
189
190
|
...TitleDetail,
|
190
191
|
...Toggle,
|
192
|
+
...Tooltip,
|
191
193
|
...TreemapChart,
|
192
194
|
...Typeahead,
|
193
195
|
...User,
|
data/dist/reset.css
CHANGED
@@ -1,2 +1,61 @@
|
|
1
|
-
|
1
|
+
/* CLEAN UP AND REMOVE */
|
2
|
+
/* Headings */
|
3
|
+
/* Standard Font Weights */
|
4
|
+
/* Non_Standard Font Weights */
|
5
|
+
/*=====================================
|
6
|
+
Base colors should not be documented.
|
7
|
+
Only document color use.
|
8
|
+
|
9
|
+
Colors -----------------------------*/
|
10
|
+
/* Specialty Gradient -----------------*/
|
11
|
+
/* Interface colors -------------------*/
|
12
|
+
/* Main colors ------------------------*/
|
13
|
+
/*=====================================
|
14
|
+
|
15
|
+
Background colors ------------------*/
|
16
|
+
/* Card colors ------------------*/
|
17
|
+
/* Active colors ----------------------*/
|
18
|
+
/* Hover colors -----------------------*/
|
19
|
+
/* Focus colors -----------------------*/
|
20
|
+
/* Border colors ----------------------*/
|
21
|
+
/* Shadow colors ----------------------*/
|
22
|
+
/* Text colors ------------------------*/
|
23
|
+
/* Data colors ------------------------*/
|
24
|
+
/* Status colors ----------------------*/
|
25
|
+
/* Link colors ------------------------*/
|
26
|
+
/* Product colors ---------------------*/
|
27
|
+
/* Category colors ---------------------*/
|
28
|
+
* {
|
29
|
+
box-sizing: border-box;
|
30
|
+
margin: 0;
|
31
|
+
padding: 0; }
|
32
|
+
*:before, *:after {
|
33
|
+
box-sizing: border-box; }
|
34
|
+
|
35
|
+
html {
|
36
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
37
|
+
height: 100vh;
|
38
|
+
overflow-x: hidden; }
|
39
|
+
|
40
|
+
body {
|
41
|
+
font-family: "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans_serif;
|
42
|
+
font-size: 16px;
|
43
|
+
line-height: 1.5;
|
44
|
+
background-color: #F3F7FB;
|
45
|
+
height: 100%;
|
46
|
+
letter-spacing: 0;
|
47
|
+
font-weight: 400;
|
48
|
+
font-style: normal;
|
49
|
+
text-rendering: optimizeLegibility;
|
50
|
+
-moz-font-feature-settings: "liga" on;
|
51
|
+
color: #242B42;
|
52
|
+
margin: 0 !important;
|
53
|
+
padding: 0 !important;
|
54
|
+
box-sizing: border-box;
|
55
|
+
min-height: 100vh;
|
56
|
+
padding: 50px; }
|
57
|
+
|
58
|
+
a {
|
59
|
+
text-decoration: none;
|
60
|
+
color: #0056CF; }
|
2
61
|
|
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: 11.
|
4
|
+
version: 11.3.0.pre.alpha1
|
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: 2022-08-
|
12
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -567,10 +567,10 @@ files:
|
|
567
567
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/_footer.md
|
568
568
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml
|
569
569
|
- app/pb_kits/playbook/pb_circle_icon_button/docs/index.js
|
570
|
-
- app/pb_kits/playbook/pb_collapsible/_collapsible.jsx
|
571
570
|
- app/pb_kits/playbook/pb_collapsible/_collapsible.scss
|
572
|
-
- app/pb_kits/playbook/pb_collapsible/
|
573
|
-
- app/pb_kits/playbook/pb_collapsible/child_kits/
|
571
|
+
- app/pb_kits/playbook/pb_collapsible/_collapsible.tsx
|
572
|
+
- app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx
|
573
|
+
- app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx
|
574
574
|
- app/pb_kits/playbook/pb_collapsible/collapsible.html.erb
|
575
575
|
- app/pb_kits/playbook/pb_collapsible/collapsible.rb
|
576
576
|
- app/pb_kits/playbook/pb_collapsible/collapsible.test.js
|
@@ -578,12 +578,13 @@ files:
|
|
578
578
|
- app/pb_kits/playbook/pb_collapsible/collapsible_content.rb
|
579
579
|
- app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb
|
580
580
|
- app/pb_kits/playbook/pb_collapsible/collapsible_main.rb
|
581
|
-
- app/pb_kits/playbook/pb_collapsible/context.
|
581
|
+
- app/pb_kits/playbook/pb_collapsible/context.ts
|
582
582
|
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.html.erb
|
583
583
|
- app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx
|
584
584
|
- app/pb_kits/playbook/pb_collapsible/docs/example.yml
|
585
585
|
- app/pb_kits/playbook/pb_collapsible/docs/index.js
|
586
586
|
- app/pb_kits/playbook/pb_collapsible/index.js
|
587
|
+
- app/pb_kits/playbook/pb_collapsible/types.d.ts
|
587
588
|
- app/pb_kits/playbook/pb_contact/_contact.scss
|
588
589
|
- app/pb_kits/playbook/pb_contact/_contact.tsx
|
589
590
|
- app/pb_kits/playbook/pb_contact/contact.html.erb
|
@@ -809,8 +810,8 @@ files:
|
|
809
810
|
- app/pb_kits/playbook/pb_dialog/docs/_dialog_status.md
|
810
811
|
- app/pb_kits/playbook/pb_dialog/docs/example.yml
|
811
812
|
- app/pb_kits/playbook/pb_dialog/docs/index.js
|
812
|
-
- app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx
|
813
813
|
- app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.scss
|
814
|
+
- app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx
|
814
815
|
- app/pb_kits/playbook/pb_distribution_bar/distribution_bar.html.erb
|
815
816
|
- app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb
|
816
817
|
- app/pb_kits/playbook/pb_distribution_bar/docs/_description.md
|
@@ -1989,15 +1990,27 @@ files:
|
|
1989
1990
|
- app/pb_kits/playbook/pb_toggle/toggle.html.erb
|
1990
1991
|
- app/pb_kits/playbook/pb_toggle/toggle.rb
|
1991
1992
|
- app/pb_kits/playbook/pb_tooltip/_tooltip.scss
|
1993
|
+
- app/pb_kits/playbook/pb_tooltip/_tooltip.tsx
|
1992
1994
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb
|
1995
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.jsx
|
1996
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.md
|
1997
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb
|
1998
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.jsx
|
1999
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.md
|
2000
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.jsx
|
2001
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.md
|
2002
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.jsx
|
2003
|
+
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_margin.md
|
1993
2004
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_selectors.html.erb
|
1994
2005
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_selectors.md
|
1995
2006
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_white.html.erb
|
1996
2007
|
- app/pb_kits/playbook/pb_tooltip/docs/_tooltip_with_icon_circle.html.erb
|
1997
2008
|
- app/pb_kits/playbook/pb_tooltip/docs/example.yml
|
2009
|
+
- app/pb_kits/playbook/pb_tooltip/docs/index.js
|
1998
2010
|
- app/pb_kits/playbook/pb_tooltip/index.js
|
1999
2011
|
- app/pb_kits/playbook/pb_tooltip/tooltip.html.erb
|
2000
2012
|
- app/pb_kits/playbook/pb_tooltip/tooltip.rb
|
2013
|
+
- app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx
|
2001
2014
|
- app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
|
2002
2015
|
- app/pb_kits/playbook/pb_treemap_chart/docs/_description.md
|
2003
2016
|
- app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb
|
@@ -2251,9 +2264,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2251
2264
|
version: '0'
|
2252
2265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2253
2266
|
requirements:
|
2254
|
-
- - "
|
2267
|
+
- - ">"
|
2255
2268
|
- !ruby/object:Gem::Version
|
2256
|
-
version:
|
2269
|
+
version: 1.3.1
|
2257
2270
|
requirements: []
|
2258
2271
|
rubygems_version: 3.3.7
|
2259
2272
|
signing_key:
|