@symbo.ls/tooltip 3.0.6 → 3.1.1
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.
- package/index.js +50 -47
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -5,21 +5,18 @@ import { isDefined } from '@domql/utils'
|
|
|
5
5
|
export const Tooltip = {
|
|
6
6
|
extends: 'Flex',
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
textAlign: 'center'
|
|
21
|
-
},
|
|
22
|
-
|
|
8
|
+
theme: 'dialog',
|
|
9
|
+
background: 'black',
|
|
10
|
+
flow: 'column',
|
|
11
|
+
shape: 'tooltip',
|
|
12
|
+
shapeDirection: 'left',
|
|
13
|
+
padding: 'Z1 A',
|
|
14
|
+
round: 'Y2',
|
|
15
|
+
width: 'fit-content',
|
|
16
|
+
minWidth: 'D2',
|
|
17
|
+
maxWidth: 'F2',
|
|
18
|
+
gap: 'X',
|
|
19
|
+
textAlign: 'center',
|
|
23
20
|
attr: { tooltip: true },
|
|
24
21
|
|
|
25
22
|
Title: {
|
|
@@ -31,7 +28,9 @@ export const Tooltip = {
|
|
|
31
28
|
},
|
|
32
29
|
|
|
33
30
|
P: {
|
|
34
|
-
if: (el, s) =>
|
|
31
|
+
if: (el, s) =>
|
|
32
|
+
el.call('isDefined', el.call('exec', el.parent.props.description, el)) ||
|
|
33
|
+
el.props.text,
|
|
35
34
|
width: 'fit-content',
|
|
36
35
|
fontSize: 'Z2',
|
|
37
36
|
margin: '0',
|
|
@@ -44,13 +43,14 @@ export const Tooltip = {
|
|
|
44
43
|
export const TooltipHidden = {
|
|
45
44
|
extends: 'Tooltip',
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
pointerEvents: 'none',
|
|
48
|
+
opacity: '0',
|
|
49
|
+
visibility: 'hidden',
|
|
50
|
+
transition:
|
|
51
|
+
'C defaultBezier opacity, C defaultBezier visibility, B defaultBezier transform',
|
|
53
52
|
|
|
53
|
+
props: ({ props }) => ({
|
|
54
54
|
...(!props.shapeDirection || props.shapeDirection === 'top'
|
|
55
55
|
? {
|
|
56
56
|
top: '112%',
|
|
@@ -64,18 +64,19 @@ export const TooltipHidden = {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
: props.shapeDirection === 'right'
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
? {
|
|
68
|
+
transform: 'translate3d(10%,-50%,0)',
|
|
69
|
+
left: '112%',
|
|
70
|
+
top: '50%',
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
72
|
+
'.isActive': {
|
|
73
|
+
transform: 'translate3d(0%,-50%,0)',
|
|
74
|
+
opacity: 1,
|
|
75
|
+
visibility: 'visible'
|
|
77
76
|
}
|
|
78
|
-
|
|
77
|
+
}
|
|
78
|
+
: ({ props }) =>
|
|
79
|
+
props.shapeDirection === 'bottom'
|
|
79
80
|
? {
|
|
80
81
|
transform: 'translate3d(-50%,-10%,0)',
|
|
81
82
|
bottom: '112%',
|
|
@@ -88,30 +89,32 @@ export const TooltipHidden = {
|
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
: props.shapeDirection === 'left'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
? {
|
|
93
|
+
transform: 'translate3d(10%,-50%,0)',
|
|
94
|
+
right: '112%',
|
|
95
|
+
top: '50%',
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
97
|
+
'.isActive': {
|
|
98
|
+
transform: 'translate3d(0%,-50%,0)',
|
|
99
|
+
opacity: 1,
|
|
100
|
+
visibility: 'visible'
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
}
|
|
103
|
+
: {})
|
|
103
104
|
})
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export const TooltipParent = {
|
|
107
|
-
|
|
108
|
+
position: 'relative',
|
|
109
|
+
zIndex: 999,
|
|
110
|
+
|
|
111
|
+
props: el => {
|
|
108
112
|
const { Tooltip, TooltipHidden } = el
|
|
109
|
-
const TooltipElem =
|
|
113
|
+
const TooltipElem = Tooltip || TooltipHidden
|
|
110
114
|
if (!TooltipElem) return
|
|
111
|
-
const TooltipActive =
|
|
115
|
+
const TooltipActive =
|
|
116
|
+
TooltipElem && TooltipElem.props && TooltipElem.props['.isActive']
|
|
112
117
|
return {
|
|
113
|
-
position: 'relative',
|
|
114
|
-
zIndex: 999,
|
|
115
118
|
':hover, &:focus-visible': {
|
|
116
119
|
zIndex: 1000,
|
|
117
120
|
'& [tooltip]': TooltipActive || {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/tooltip",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "39fb7a8c07355468ccce79e2f787ca3fa0715692",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@symbo.ls/atoms": "^3.
|
|
8
|
+
"@symbo.ls/atoms": "^3.1.1"
|
|
9
9
|
},
|
|
10
10
|
"source": "src/index.js"
|
|
11
11
|
}
|