@stellar-expert/ui-framework 1.11.4 → 1.11.6
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/info-tooltip.js +2 -2
- package/controls/tooltip.js +7 -7
- package/fonts/icons/config.json +728 -26
- package/fonts/icons/icons-embedded.scss +206 -10
- package/package.json +1 -1
package/controls/info-tooltip.js
CHANGED
|
@@ -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…</a>}
|
|
11
11
|
</Tooltip>
|
package/controls/tooltip.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
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) {
|
|
@@ -45,11 +45,11 @@ function calculateTooltipPosition(target, node, desiredPlace, offset) {
|
|
|
45
45
|
|
|
46
46
|
let place
|
|
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
|
|