@tap-payments/os-micro-frontend-shared 0.1.48-test.5 → 0.1.48-test.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.
@@ -5,7 +5,7 @@ interface Props extends Omit<TooltipProps, 'children'> {
5
5
  placement?: TooltipProps['placement'];
6
6
  children?: ReactElement;
7
7
  className?: string;
8
- intersectionRoot?: Element | null;
8
+ intersectionRoot?: HTMLElement | null;
9
9
  }
10
10
  declare function Tooltip({ className, title, placement, children, intersectionRoot, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
11
11
  export default Tooltip;
@@ -10,16 +10,16 @@ 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';
13
+ import { useRef, useState, useEffect, cloneElement } from 'react';
14
14
  import { StyledTooltip } from './styles';
15
15
  function Tooltip(_a) {
16
16
  var { className, title, placement = 'top', children, intersectionRoot = null } = _a, rest = __rest(_a, ["className", "title", "placement", "children", "intersectionRoot"]);
17
- const toolTipRef = useRef(null);
17
+ const anchorRef = useRef(null);
18
18
  const [inView, setInView] = useState(true);
19
19
  useEffect(() => {
20
- if (!toolTipRef.current)
20
+ if (!anchorRef.current)
21
21
  return;
22
- const currentElement = toolTipRef.current;
22
+ const currentElement = anchorRef.current;
23
23
  const observer = new IntersectionObserver((entries) => {
24
24
  const entry = entries[0];
25
25
  setInView(entry.isIntersecting);
@@ -33,12 +33,6 @@ function Tooltip(_a) {
33
33
  observer.unobserve(currentElement);
34
34
  };
35
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, {}) })));
36
+ return (_jsx(StyledTooltip, Object.assign({ classes: { popper: className }, title: title, placement: placement, arrow: true, disableHoverListener: !inView }, rest, { children: children ? cloneElement(children, { ref: anchorRef }) : _jsx(_Fragment, {}) })));
43
37
  }
44
38
  export default Tooltip;
@@ -3,6 +3,5 @@ import { BoxProps } from '@mui/material/Box';
3
3
  interface WidgetI extends BoxProps {
4
4
  children: ReactNode;
5
5
  }
6
- declare function Widget({ children, ...props }: WidgetI): import("react/jsx-runtime").JSX.Element;
7
- declare const _default: import("react").MemoExoticComponent<typeof Widget>;
6
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<WidgetI, "ref"> & import("react").RefAttributes<HTMLElement>>>;
8
7
  export default _default;
@@ -10,10 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo } from 'react';
13
+ import { memo, forwardRef } from 'react';
14
14
  import { WidgetStyled } from './style';
15
- function Widget(_a) {
15
+ const Widget = forwardRef(function Widget(_a, ref) {
16
16
  var { children } = _a, props = __rest(_a, ["children"]);
17
- return (_jsx(WidgetStyled, Object.assign({ component: "article", "data-testid": "Widget" }, props, { children: children })));
18
- }
17
+ return (_jsx(WidgetStyled, Object.assign({ ref: ref, component: "article", "data-testid": "Widget" }, props, { children: children })));
18
+ });
19
19
  export default memo(Widget);
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",
5
- "testVersion": 5,
4
+ "version": "0.1.48-test.7",
5
+ "testVersion": 7,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",