hrm_ui_lib 2.4.37 → 2.4.38

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.
@@ -12,7 +12,7 @@ export const PopoverDesktop = (props) => {
12
12
  tooltipRef: popoverRef,
13
13
  initialPosition: position
14
14
  });
15
- useHideOnScroll(hideMessage);
15
+ useHideOnScroll(hideMessage, parent);
16
16
  useOnOutsideClick(popoverRef, hideMessage, clicked, useId());
17
17
  return (_jsxs(_Fragment, { children: [clicked && (_jsx("div", { "data-id": dataId ? `${dataId}-popover-content` : '', className: classNames(`popover popover--${popoverPosition}`, className), ref: setPopoverRef, style: popoverStyles, children: _jsx("div", { className: "popover__inner scrollbar scrollbar--vertical pr-8", children: linkAddons ? (_jsx(Link, { dataId: linkAddons.dataId, url: linkAddons.url, beforeLink: linkAddons.beforeLink, afterLink: linkAddons.afterLink, target: linkAddons.target, className: 'popover__link', children: text })) : (_jsx(Text, { dataId: dataId ? `${dataId}-popover-text` : '', type: "primary", weight: "regular", lineHeight: "medium", size: "small", as: "div", children: text })) }) })), children] }));
18
18
  };
@@ -1 +1 @@
1
- export declare const useHideOnScroll: (hide: () => void) => null;
1
+ export declare const useHideOnScroll: (hide: () => void, elementRef?: HTMLElement | null) => null;
@@ -1,14 +1,15 @@
1
1
  import { useEffect } from 'react';
2
2
  import { CUSTOM_SCROLL_NAME, CUSTOM_SCROLL_MESSAGE } from '../consts';
3
- export const useHideOnScroll = (hide) => {
3
+ export const useHideOnScroll = (hide, elementRef) => {
4
+ const scrollElement = elementRef !== null && elementRef !== void 0 ? elementRef : document;
4
5
  useEffect(() => {
5
- document.addEventListener('scroll', hide);
6
+ scrollElement.addEventListener('scroll', hide);
6
7
  return () => {
7
- document.removeEventListener('scroll', hide);
8
+ scrollElement.removeEventListener('scroll', hide);
8
9
  };
9
10
  }, []);
10
11
  useEffect(() => {
11
- document.addEventListener(CUSTOM_SCROLL_NAME, (event) => {
12
+ scrollElement.addEventListener(CUSTOM_SCROLL_NAME, (event) => {
12
13
  const customEvent = event;
13
14
  // Check the event type
14
15
  if (customEvent.detail === CUSTOM_SCROLL_MESSAGE) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "2.4.37",
3
+ "version": "2.4.38",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",