@stellar-expert/ui-framework 1.13.3 → 1.13.5
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/controls/tooltip.js +12 -12
- package/controls/tooltip.scss +18 -12
- package/effect/effect-description.js +2 -2
- package/package.json +1 -1
package/controls/tooltip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useState, useRef
|
|
1
|
+
import React, {useState, useRef} from 'react'
|
|
2
2
|
import cn from 'classnames'
|
|
3
3
|
import './tooltip.scss'
|
|
4
4
|
|
|
@@ -53,13 +53,11 @@ function calculateTooltipPosition(target, node, desiredPlace, offset) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const {top: parentTop, left: parentLeft} = target.getBoundingClientRect()
|
|
57
|
-
|
|
58
56
|
return {
|
|
59
57
|
place,
|
|
60
58
|
position: {
|
|
61
|
-
top:
|
|
62
|
-
left:
|
|
59
|
+
top: getTipOffsetTop(place) + window.scrollY | 0,
|
|
60
|
+
left: getTipOffsetLeft(place) + window.scrollX | 0
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
}
|
|
@@ -97,28 +95,28 @@ function getMouseOffset(element) {
|
|
|
97
95
|
* @param {Number} tipHeight
|
|
98
96
|
* */
|
|
99
97
|
function getDefaultPosition(targetWidth, targetHeight, tipWidth, tipHeight) {
|
|
100
|
-
const notchSize =
|
|
98
|
+
const notchSize = 4
|
|
101
99
|
return {
|
|
102
100
|
top: {
|
|
103
101
|
l: -tipWidth / 2,
|
|
104
102
|
r: tipWidth / 2,
|
|
105
|
-
t: -targetHeight / 2 - tipHeight
|
|
103
|
+
t: -targetHeight / 2 - tipHeight + notchSize,
|
|
106
104
|
b: -targetHeight / 2
|
|
107
105
|
},
|
|
108
106
|
bottom: {
|
|
109
107
|
l: -tipWidth / 2,
|
|
110
108
|
r: tipWidth / 2,
|
|
111
|
-
t: targetHeight / 2
|
|
109
|
+
t: targetHeight / 2 - notchSize,
|
|
112
110
|
b: targetHeight / 2 + tipHeight
|
|
113
111
|
},
|
|
114
112
|
left: {
|
|
115
|
-
l: -tipWidth - targetWidth / 2,
|
|
113
|
+
l: -tipWidth - targetWidth / 2 + notchSize,
|
|
116
114
|
r: -targetWidth / 2 + notchSize,
|
|
117
115
|
t: -tipHeight / 2,
|
|
118
116
|
b: tipHeight / 2
|
|
119
117
|
},
|
|
120
118
|
right: {
|
|
121
|
-
l: targetWidth / 2
|
|
119
|
+
l: targetWidth / 2 - notchSize / 2,
|
|
122
120
|
r: tipWidth + targetWidth / 2,
|
|
123
121
|
t: -tipHeight / 2,
|
|
124
122
|
b: tipHeight / 2
|
|
@@ -180,6 +178,7 @@ export const Tooltip = React.memo(function Tooltip({
|
|
|
180
178
|
return
|
|
181
179
|
const {currentTarget} = e
|
|
182
180
|
setRendered(true)
|
|
181
|
+
content.current.showPopover()
|
|
183
182
|
setTimeout(() => {
|
|
184
183
|
if (visible)
|
|
185
184
|
return
|
|
@@ -193,6 +192,7 @@ export const Tooltip = React.memo(function Tooltip({
|
|
|
193
192
|
function onMouseLeave(e) {
|
|
194
193
|
if (!visible)
|
|
195
194
|
return
|
|
195
|
+
content.current.hidePopover()
|
|
196
196
|
setVisible(false)
|
|
197
197
|
setRendered(false)
|
|
198
198
|
}
|
|
@@ -215,8 +215,8 @@ export const Tooltip = React.memo(function Tooltip({
|
|
|
215
215
|
containerStyle.maxWidth = maxWidth
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
return React.cloneElement(trigger, triggerProps, <div className="tooltip-wrapper" style={containerStyle}>
|
|
219
|
-
<div
|
|
218
|
+
return React.cloneElement(trigger, triggerProps, <div ref={content} className="tooltip-wrapper" style={containerStyle} popover="auto">
|
|
219
|
+
<div className={cn('tooltip', place, {visible})}>
|
|
220
220
|
<div className="tooltip-content">{rendered ? children : null}</div>
|
|
221
221
|
</div>
|
|
222
222
|
</div>)
|
package/controls/tooltip.scss
CHANGED
|
@@ -5,11 +5,20 @@ $tooltip-notch-shadow-color: var(--color-border-shadow);
|
|
|
5
5
|
.tooltip-wrapper {
|
|
6
6
|
width: 40rem;
|
|
7
7
|
max-width: Min(40rem, 60vw);
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: .8rem;
|
|
8
10
|
position: absolute;
|
|
9
11
|
visibility: hidden;
|
|
10
12
|
opacity: 0;
|
|
11
13
|
transition: opacity 0.15s ease 0.4s, visibility 0.15s ease 0.4s;
|
|
12
14
|
z-index: 10;
|
|
15
|
+
background: transparent;
|
|
16
|
+
border: none;
|
|
17
|
+
|
|
18
|
+
&:popover-open {
|
|
19
|
+
visibility: visible;
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
.tooltip {
|
|
@@ -24,6 +33,7 @@ $tooltip-notch-shadow-color: var(--color-border-shadow);
|
|
|
24
33
|
padding: 1rem 1.4rem;
|
|
25
34
|
letter-spacing: normal;
|
|
26
35
|
word-break: normal;
|
|
36
|
+
visibility: hidden;
|
|
27
37
|
|
|
28
38
|
&:before {
|
|
29
39
|
content: "";
|
|
@@ -37,29 +47,29 @@ $tooltip-notch-shadow-color: var(--color-border-shadow);
|
|
|
37
47
|
|
|
38
48
|
&.top:before {
|
|
39
49
|
left: 50%;
|
|
40
|
-
bottom: -.
|
|
50
|
+
bottom: -.2em;
|
|
41
51
|
box-shadow: 1px 1px 0 $tooltip-notch-shadow-color;
|
|
42
|
-
margin-left: -0.
|
|
52
|
+
margin-left: -0.26rem;
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
&.bottom:before {
|
|
46
56
|
left: 50%;
|
|
47
|
-
top: -.
|
|
57
|
+
top: -.2em;
|
|
48
58
|
box-shadow: -1px -1px 0 $tooltip-notch-shadow-color;
|
|
49
|
-
margin-left: -0.
|
|
59
|
+
margin-left: -0.26rem;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
&.left:before {
|
|
53
|
-
right: -.
|
|
63
|
+
right: -.2em;
|
|
54
64
|
top: 50%;
|
|
55
|
-
margin-top: -0.
|
|
65
|
+
margin-top: -0.26em;
|
|
56
66
|
box-shadow: 1px -1px 0 $tooltip-notch-shadow-color;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
&.right:before {
|
|
60
|
-
left: -.
|
|
70
|
+
left: -.2em;
|
|
61
71
|
top: 50%;
|
|
62
|
-
margin-top: -0.
|
|
72
|
+
margin-top: -0.26em;
|
|
63
73
|
box-shadow: -1px 1px 0 $tooltip-notch-shadow-color;
|
|
64
74
|
}
|
|
65
75
|
|
|
@@ -101,9 +111,5 @@ $tooltip-notch-shadow-color: var(--color-border-shadow);
|
|
|
101
111
|
&:before {
|
|
102
112
|
opacity: 1;
|
|
103
113
|
}
|
|
104
|
-
|
|
105
|
-
& > .tooltip-wrapper {
|
|
106
|
-
opacity: 1;
|
|
107
|
-
}
|
|
108
114
|
}
|
|
109
115
|
}
|
|
@@ -25,10 +25,10 @@ export function EffectDescription({effect, operation}) {
|
|
|
25
25
|
return <>Account <AccountAddress account={effect.source}/> removed</>
|
|
26
26
|
case 'accountCredited':
|
|
27
27
|
return <><Amount asset={effect.asset} amount={effect.amount} adjust/> credited to
|
|
28
|
-
account <AccountAddress account={effect.source}/></>
|
|
28
|
+
{effect.source.startsWith('C') ? 'contract' : 'account'} <AccountAddress account={effect.source}/></>
|
|
29
29
|
case 'accountDebited':
|
|
30
30
|
return <><Amount asset={effect.asset} amount={effect.amount} adjust/> debited from
|
|
31
|
-
account <AccountAddress account={effect.source}/></>
|
|
31
|
+
{effect.source.startsWith('C') ? 'contract' : 'account'} <AccountAddress account={effect.source}/></>
|
|
32
32
|
case 'accountThresholdsUpdated':
|
|
33
33
|
return <>Account <AccountAddress account={effect.source}/> set thresholds to {effect.thresholds.join('/')}</>
|
|
34
34
|
case 'accountHomeDomainUpdated':
|