@tap-payments/os-micro-frontend-shared 0.1.48-test.6 → 0.1.48-test.8
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.
|
@@ -5,7 +5,6 @@ interface Props extends Omit<TooltipProps, 'children'> {
|
|
|
5
5
|
placement?: TooltipProps['placement'];
|
|
6
6
|
children?: ReactElement;
|
|
7
7
|
className?: string;
|
|
8
|
-
intersectionRoot?: Element | null;
|
|
9
8
|
}
|
|
10
|
-
declare function Tooltip({ className, title, placement, children,
|
|
9
|
+
declare function Tooltip({ className, title, placement, children, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default Tooltip;
|
|
@@ -10,35 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { useRef, useState, useEffect } from 'react';
|
|
14
13
|
import { StyledTooltip } from './styles';
|
|
15
14
|
function Tooltip(_a) {
|
|
16
|
-
var { className, title, placement = 'top', children
|
|
17
|
-
|
|
18
|
-
const [inView, setInView] = useState(true);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (!toolTipRef.current)
|
|
21
|
-
return;
|
|
22
|
-
const currentElement = toolTipRef.current;
|
|
23
|
-
const observer = new IntersectionObserver((entries) => {
|
|
24
|
-
const entry = entries[0];
|
|
25
|
-
setInView(entry.isIntersecting);
|
|
26
|
-
}, {
|
|
27
|
-
root: intersectionRoot,
|
|
28
|
-
rootMargin: '0px',
|
|
29
|
-
threshold: 0,
|
|
30
|
-
});
|
|
31
|
-
observer.observe(currentElement);
|
|
32
|
-
return () => {
|
|
33
|
-
observer.unobserve(currentElement);
|
|
34
|
-
};
|
|
35
|
-
}, [intersectionRoot]);
|
|
36
|
-
return (_jsx(StyledTooltip, Object.assign({ ref: toolTipRef, classes: { popper: className }, title: title, placement: placement, arrow: true, componentsProps: {
|
|
37
|
-
tooltip: {
|
|
38
|
-
sx: {
|
|
39
|
-
display: inView ? 'block' : 'none',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
} }, rest, { children: children || _jsx(_Fragment, {}) })));
|
|
15
|
+
var { className, title, placement = 'top', children } = _a, rest = __rest(_a, ["className", "title", "placement", "children"]);
|
|
16
|
+
return (_jsx(StyledTooltip, Object.assign({ classes: { popper: className }, title: title, placement: placement, arrow: true }, rest, { children: children || _jsx(_Fragment, {}) })));
|
|
43
17
|
}
|
|
44
18
|
export default Tooltip;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.48-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.48-test.8",
|
|
5
|
+
"testVersion": 8,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|