@symbo.ls/tooltip 3.0.100 → 3.1.2

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.
Files changed (2) hide show
  1. package/index.js +51 -48
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -3,23 +3,20 @@
3
3
  import { isDefined } from '@domql/utils'
4
4
 
5
5
  export const Tooltip = {
6
- extends: 'Flex',
7
-
8
- props: {
9
- theme: 'dialog',
10
- background: 'black',
11
- flow: 'column',
12
- shape: 'tooltip',
13
- shapeDirection: 'left',
14
- padding: 'Z1 A',
15
- round: 'Y2',
16
- width: 'fit-content',
17
- minWidth: 'D2',
18
- maxWidth: 'F2',
19
- gap: 'X',
20
- textAlign: 'center'
21
- },
6
+ display: 'flex',
22
7
 
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) => el.call('isDefined', el.call('exec', el.parent.props.description, el)) || el.props.text,
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
- props: ({ props }) => ({
48
- position: 'absolute',
49
- pointerEvents: 'none',
50
- opacity: '0',
51
- visibility: 'hidden',
52
- transition: 'C defaultBezier opacity, C defaultBezier visibility, B defaultBezier transform',
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
- transform: 'translate3d(10%,-50%,0)',
69
- left: '112%',
70
- top: '50%',
67
+ ? {
68
+ transform: 'translate3d(10%,-50%,0)',
69
+ left: '112%',
70
+ top: '50%',
71
71
 
72
- '.isActive': {
73
- transform: 'translate3d(0%,-50%,0)',
74
- opacity: 1,
75
- visibility: 'visible'
76
- }
72
+ '.isActive': {
73
+ transform: 'translate3d(0%,-50%,0)',
74
+ opacity: 1,
75
+ visibility: 'visible'
77
76
  }
78
- : ({ props }) => props.shapeDirection === 'bottom'
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
- transform: 'translate3d(10%,-50%,0)',
93
- right: '112%',
94
- top: '50%',
92
+ ? {
93
+ transform: 'translate3d(10%,-50%,0)',
94
+ right: '112%',
95
+ top: '50%',
95
96
 
96
- '.isActive': {
97
- transform: 'translate3d(0%,-50%,0)',
98
- opacity: 1,
99
- visibility: 'visible'
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
- props: (el) => {
108
+ position: 'relative',
109
+ zIndex: 999,
110
+
111
+ props: el => {
108
112
  const { Tooltip, TooltipHidden } = el
109
- const TooltipElem = (Tooltip || TooltipHidden)
113
+ const TooltipElem = Tooltip || TooltipHidden
110
114
  if (!TooltipElem) return
111
- const TooltipActive = TooltipElem && TooltipElem.props && TooltipElem.props['.isActive']
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.0.100",
3
+ "version": "3.1.2",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "1302a0674cc4d420f304737973a7f7bece86f359",
6
+ "gitHead": "429b36616aa04c8587a26ce3c129815115e35897",
7
7
  "dependencies": {
8
- "@symbo.ls/atoms": "^3.0.100"
8
+ "@symbo.ls/atoms": "^3.1.2"
9
9
  },
10
10
  "source": "src/index.js"
11
11
  }