indicator-ui 0.0.154 → 0.0.155

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/dist/index.js CHANGED
@@ -11344,21 +11344,14 @@ __webpack_require__.r(__webpack_exports__);
11344
11344
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
11345
11345
 
11346
11346
 
11347
- function ScrollProvider({ onScroll, onScrollTop, onScrollBottom, children, accuracy = 10, }) {
11347
+ /**
11348
+ * Компонент для отслеживания скролла в разных обстоятельствах.
11349
+ * */
11350
+ function ScrollProvider({ onScroll, onScrollTop, onScrollBottom, children, accuracy = 10, wrapper = (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {}), }) {
11348
11351
  const elementRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
11349
- // Преобразуем children в массив и находим первый DOM-элемент
11350
- const arrayChildren = react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children);
11351
- const firstElement = arrayChildren.find((item) => react__WEBPACK_IMPORTED_MODULE_1___default().isValidElement(item) &&
11352
- (typeof item.type === "string" ||
11353
- item.type?.$$typeof === Symbol.for("react.forward_ref")));
11354
- // Если нашли, клонируем его и добавляем ref
11355
- const clonedFirstElement = firstElement
11356
- // @ts-ignore
11357
- ? (0,react__WEBPACK_IMPORTED_MODULE_1__.cloneElement)(firstElement, { ref: elementRef })
11358
- : null;
11359
11352
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
11360
11353
  if (elementRef.current) {
11361
- const handleScroll = (event) => {
11354
+ const handleScroll = (_event) => {
11362
11355
  const el = elementRef.current;
11363
11356
  if (!el)
11364
11357
  return;
@@ -11397,8 +11390,7 @@ function ScrollProvider({ onScroll, onScrollTop, onScrollBottom, children, accur
11397
11390
  };
11398
11391
  }
11399
11392
  }, [onScroll, onScrollTop, onScrollBottom]);
11400
- // Рендерим клонированный элемент и остальные дочерние элементы
11401
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: [clonedFirstElement, arrayChildren.filter(child => child !== firstElement)] }));
11393
+ return react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(wrapper, { ref: elementRef, children: children });
11402
11394
  }
11403
11395
 
11404
11396