@stellar-expert/ui-framework 1.11.5 → 1.11.7

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.
@@ -4,8 +4,8 @@ import cn from 'classnames'
4
4
  import {Tooltip} from './tooltip'
5
5
  import './info-tooltip.scss'
6
6
 
7
- export const InfoTooltip = React.memo(function InfoTooltip({children, link, icon = 'icon-help'}) {
8
- return <Tooltip trigger={<i className={cn('trigger icon info-tooltip small', icon)}/>}>
7
+ export const InfoTooltip = React.memo(function InfoTooltip({children, link, icon = 'icon-help', ...otherProps}) {
8
+ return <Tooltip trigger={<i className={cn('trigger icon info-tooltip small', icon)} {...otherProps}/>}>
9
9
  {children}
10
10
  {!!link && <a href={link} className="info-tooltip-link" target="_blank">Read more&hellip;</a>}
11
11
  </Tooltip>
@@ -12,12 +12,12 @@ import './tooltip.scss'
12
12
  */
13
13
  function calculateTooltipPosition(target, node, desiredPlace, offset) {
14
14
  //dimensions of node and target
15
- const {width: tipWidth, height: tipHeight} = getBoundingRect(node),
16
- {width: targetWidth, height: targetHeight} = getBoundingRect(target)
15
+ const {width: tipWidth, height: tipHeight} = getBoundingRect(node)
16
+ const {width: targetWidth, height: targetHeight} = getBoundingRect(target)
17
17
  //mouse offset
18
- const {mouseX, mouseY} = getMouseOffset(target),
19
- {offsetX, offsetY} = parseOffset(offset),
20
- defaultOffset = getDefaultPosition(targetWidth, targetHeight, tipWidth, tipHeight)
18
+ const {mouseX, mouseY} = getMouseOffset(target)
19
+ const {offsetX, offsetY} = parseOffset(offset)
20
+ const defaultOffset = getDefaultPosition(targetWidth, targetHeight, tipWidth, tipHeight)
21
21
 
22
22
  // Get the edge offset of the tooltip
23
23
  function getTipOffsetLeft(place) {
@@ -43,13 +43,13 @@ function calculateTooltipPosition(target, node, desiredPlace, offset) {
43
43
  getTipOffsetBottom(p) > window.innerHeight //outside bottom
44
44
  }
45
45
 
46
- let place
46
+ let place = 'top'
47
47
  if (!isOutside(desiredPlace)) {
48
- place = desiredPlace
48
+ place = desiredPlace || 'top'
49
49
  } else {
50
50
  const possiblePlacements = (['top', 'bottom', 'left', 'right']).filter(p => !isOutside(p))
51
51
  if (possiblePlacements.length > 0 && isOutside(desiredPlace)) {
52
- place = possiblePlacements[0]
52
+ place = possiblePlacements[0] || 'top'
53
53
  }
54
54
  }
55
55
 
@@ -166,7 +166,8 @@ export const Tooltip = React.memo(function Tooltip({trigger, desiredPlace = 'top
166
166
  content = useRef(null)
167
167
 
168
168
  function mouseEnter(e) {
169
- if (visible) return
169
+ if (visible)
170
+ return
170
171
  const {place, position} = calculateTooltipPosition(e.currentTarget, content.current, desiredPlace, offset)
171
172
  setVisible(true)
172
173
  setPosition(position)
@@ -174,7 +175,8 @@ export const Tooltip = React.memo(function Tooltip({trigger, desiredPlace = 'top
174
175
  }
175
176
 
176
177
  function mouseLeave(e) {
177
- if (!visible) return
178
+ if (!visible)
179
+ return
178
180
  setVisible(false)
179
181
  }
180
182
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/ui-framework",
3
- "version": "1.11.5",
3
+ "version": "1.11.7",
4
4
  "description": "StellarExpert shared UI components library",
5
5
  "main": "index.js",
6
6
  "module": "./index.js",
@@ -86,7 +86,7 @@ export const TxOperationsList = React.memo(function TxOperationsList({
86
86
  }
87
87
  //hide some operations in large transactions to prevent interface hanging
88
88
  if (operations.length > 5) {
89
- operations = operations.subarray(0, 5)
89
+ operations = operations.slice(0, 5)
90
90
  opdiff = parsedTx.operations.length - operations.length
91
91
  }
92
92
  }