react-virtuoso 4.0.5 → 4.0.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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { createContext, forwardRef, useState, useImperativeHandle, createElement, useLayoutEffect, useEffect, useCallback, useContext, useRef, memo } from "react";
3
- import { flushSync } from "react-dom";
1
+ import React from "react";
2
+ import ReactDOM from "react-dom";
4
3
  const PUBLISH = 0;
5
4
  const SUBSCRIBE = 1;
6
5
  const RESET = 2;
@@ -320,13 +319,13 @@ function omit(keys, obj) {
320
319
  }
321
320
  return result;
322
321
  }
323
- const useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? useLayoutEffect : useEffect;
322
+ const useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
324
323
  function systemToComponent(systemSpec, map2, Root) {
325
324
  const requiredPropNames = Object.keys(map2.required || {});
326
325
  const optionalPropNames = Object.keys(map2.optional || {});
327
326
  const methodNames = Object.keys(map2.methods || {});
328
327
  const eventNames = Object.keys(map2.events || {});
329
- const Context = createContext({});
328
+ const Context = React.createContext({});
330
329
  function applyPropsToSystem(system2, props) {
331
330
  if (system2["propsReady"]) {
332
331
  publish(system2["propsReady"], false);
@@ -360,12 +359,12 @@ function systemToComponent(systemSpec, map2, Root) {
360
359
  return handlers;
361
360
  }, {});
362
361
  }
363
- const Component = forwardRef((propsWithChildren, ref) => {
362
+ const Component = React.forwardRef((propsWithChildren, ref) => {
364
363
  const { children, ...props } = propsWithChildren;
365
- const [system2] = useState(() => {
364
+ const [system2] = React.useState(() => {
366
365
  return tap(init(systemSpec), (system22) => applyPropsToSystem(system22, props));
367
366
  });
368
- const [handlers] = useState(curry1to0(buildEventHandlers, system2));
367
+ const [handlers] = React.useState(curry1to0(buildEventHandlers, system2));
369
368
  useIsomorphicLayoutEffect$2(() => {
370
369
  for (const eventName of eventNames) {
371
370
  if (eventName in props) {
@@ -379,11 +378,11 @@ function systemToComponent(systemSpec, map2, Root) {
379
378
  useIsomorphicLayoutEffect$2(() => {
380
379
  applyPropsToSystem(system2, props);
381
380
  });
382
- useImperativeHandle(ref, always(buildMethods(system2)));
383
- return createElement(
381
+ React.useImperativeHandle(ref, always(buildMethods(system2)));
382
+ return React.createElement(
384
383
  Context.Provider,
385
384
  { value: system2 },
386
- Root ? createElement(
385
+ Root ? React.createElement(
387
386
  Root,
388
387
  omit([...requiredPropNames, ...optionalPropNames, ...eventNames], props),
389
388
  children
@@ -391,12 +390,12 @@ function systemToComponent(systemSpec, map2, Root) {
391
390
  );
392
391
  });
393
392
  const usePublisher2 = (key) => {
394
- return useCallback(curry2to1(publish, useContext(Context)[key]), [key]);
393
+ return React.useCallback(curry2to1(publish, React.useContext(Context)[key]), [key]);
395
394
  };
396
395
  const useEmitterValue2 = (key) => {
397
- const system2 = useContext(Context);
396
+ const system2 = React.useContext(Context);
398
397
  const source = system2[key];
399
- const [value, setValue] = useState(curry1to0(getValue, source));
398
+ const [value, setValue] = React.useState(curry1to0(getValue, source));
400
399
  useIsomorphicLayoutEffect$2(
401
400
  () => subscribe(source, (next) => {
402
401
  if (next !== value) {
@@ -408,7 +407,7 @@ function systemToComponent(systemSpec, map2, Root) {
408
407
  return value;
409
408
  };
410
409
  const useEmitter2 = (key, callback) => {
411
- const context = useContext(Context);
410
+ const context = React.useContext(Context);
412
411
  const source = context[key];
413
412
  useIsomorphicLayoutEffect$2(() => subscribe(source, callback), [callback, source]);
414
413
  };
@@ -419,7 +418,7 @@ function systemToComponent(systemSpec, map2, Root) {
419
418
  useEmitter: useEmitter2
420
419
  };
421
420
  }
422
- const useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
421
+ const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
423
422
  const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
424
423
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
425
424
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
@@ -459,7 +458,7 @@ const loggerSystem = system(
459
458
  { singleton: true }
460
459
  );
461
460
  function useSizeWithElRef(callback, enabled = true) {
462
- const ref = useRef(null);
461
+ const ref = React.useRef(null);
463
462
  let callbackRef = (_el) => {
464
463
  };
465
464
  if (typeof ResizeObserver !== "undefined") {
@@ -553,10 +552,10 @@ function approximatelyEqual(num1, num2) {
553
552
  return Math.abs(num1 - num2) < 1.01;
554
553
  }
555
554
  function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, scrollerElement, scrollerRefCallback = noop, customScrollParent) {
556
- const scrollerRef = useRef(null);
557
- const scrollTopTarget = useRef(null);
558
- const timeoutRef = useRef(null);
559
- const handler = useCallback(
555
+ const scrollerRef = React.useRef(null);
556
+ const scrollTopTarget = React.useRef(null);
557
+ const timeoutRef = React.useRef(null);
558
+ const handler = React.useCallback(
560
559
  (ev) => {
561
560
  const el = ev.target;
562
561
  const windowScroll = el === window || el === document;
@@ -573,7 +572,7 @@ function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, s
573
572
  if (ev.suppressFlushSync) {
574
573
  call2();
575
574
  } else {
576
- flushSync(call2);
575
+ ReactDOM.flushSync(call2);
577
576
  }
578
577
  if (scrollTopTarget.current !== null) {
579
578
  if (scrollTop === scrollTopTarget.current || scrollTop <= 0 || scrollTop === scrollHeight - viewportHeight) {
@@ -588,7 +587,7 @@ function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, s
588
587
  },
589
588
  [scrollContainerStateCallback, smoothScrollTargetReached]
590
589
  );
591
- useEffect(() => {
590
+ React.useEffect(() => {
592
591
  const localRef = customScrollParent ? customScrollParent : scrollerRef.current;
593
592
  scrollerRefCallback(customScrollParent ? customScrollParent : scrollerRef.current);
594
593
  handler({ target: localRef, suppressFlushSync: true });
@@ -2670,8 +2669,8 @@ const positionStickyCssValue = simpleMemoize(() => {
2670
2669
  return node.style.position === WEBKIT_STICKY ? WEBKIT_STICKY : STICKY;
2671
2670
  });
2672
2671
  function useWindowViewportRectRef(callback, customScrollParent) {
2673
- const viewportInfo = useRef(null);
2674
- const calculateInfo = useCallback(
2672
+ const viewportInfo = React.useRef(null);
2673
+ const calculateInfo = React.useCallback(
2675
2674
  (element) => {
2676
2675
  if (element === null || !element.offsetParent) {
2677
2676
  return;
@@ -2698,10 +2697,10 @@ function useWindowViewportRectRef(callback, customScrollParent) {
2698
2697
  [callback, customScrollParent]
2699
2698
  );
2700
2699
  const { callbackRef, ref } = useSizeWithElRef(calculateInfo);
2701
- const scrollAndResizeEventHandler = useCallback(() => {
2700
+ const scrollAndResizeEventHandler = React.useCallback(() => {
2702
2701
  calculateInfo(ref.current);
2703
2702
  }, [calculateInfo, ref]);
2704
- useEffect(() => {
2703
+ React.useEffect(() => {
2705
2704
  if (customScrollParent) {
2706
2705
  customScrollParent.addEventListener("scroll", scrollAndResizeEventHandler);
2707
2706
  const observer = new ResizeObserver(scrollAndResizeEventHandler);
@@ -2721,8 +2720,8 @@ function useWindowViewportRectRef(callback, customScrollParent) {
2721
2720
  }, [scrollAndResizeEventHandler, customScrollParent]);
2722
2721
  return callbackRef;
2723
2722
  }
2724
- const VirtuosoMockContext = createContext(void 0);
2725
- const VirtuosoGridMockContext = createContext(void 0);
2723
+ const VirtuosoMockContext = React.createContext(void 0);
2724
+ const VirtuosoGridMockContext = React.createContext(void 0);
2726
2725
  function identity(value) {
2727
2726
  return value;
2728
2727
  }
@@ -2766,10 +2765,10 @@ const listComponentPropsSystem = /* @__PURE__ */ system(() => {
2766
2765
  const combinedSystem$2 = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
2767
2766
  return { ...listSystem2, ...propsSystem };
2768
2767
  }, tup(listSystem, listComponentPropsSystem));
2769
- const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ jsx("div", { style: { height } });
2768
+ const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ React.createElement("div", { style: { height } });
2770
2769
  const GROUP_STYLE = { position: positionStickyCssValue(), zIndex: 1, overflowAnchor: "none" };
2771
2770
  const ITEM_STYLE = { overflowAnchor: "none" };
2772
- const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = false }) {
2771
+ const Items$1 = /* @__PURE__ */ React.memo(function VirtuosoItems({ showTopList = false }) {
2773
2772
  const listState = useEmitterValue$2("listState");
2774
2773
  const sizeRanges = usePublisher$2("sizeRanges");
2775
2774
  const useWindowScroll = useEmitterValue$2("useWindowScroll");
@@ -2793,7 +2792,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
2793
2792
  listGap,
2794
2793
  customScrollParent
2795
2794
  );
2796
- const [deviation, setDeviation] = useState(0);
2795
+ const [deviation, setDeviation] = React.useState(0);
2797
2796
  useEmitter$2("deviation", (value) => {
2798
2797
  if (deviation !== value) {
2799
2798
  setDeviation(value);
@@ -2815,9 +2814,9 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
2815
2814
  marginTop: deviation
2816
2815
  };
2817
2816
  if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) {
2818
- return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
2817
+ return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
2819
2818
  }
2820
- return createElement(
2819
+ return React.createElement(
2821
2820
  ListComponent,
2822
2821
  {
2823
2822
  ...contextPropIfNotDomElement(ListComponent, context),
@@ -2829,7 +2828,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
2829
2828
  const index = item.originalIndex;
2830
2829
  const key = computeItemKey(index + listState.firstItemIndex, item.data, context);
2831
2830
  if (isSeeking) {
2832
- return createElement(ScrollSeekPlaceholder, {
2831
+ return React.createElement(ScrollSeekPlaceholder, {
2833
2832
  ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
2834
2833
  key,
2835
2834
  index: item.index,
@@ -2839,7 +2838,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
2839
2838
  });
2840
2839
  }
2841
2840
  if (item.type === "group") {
2842
- return createElement(
2841
+ return React.createElement(
2843
2842
  GroupComponent,
2844
2843
  {
2845
2844
  ...contextPropIfNotDomElement(GroupComponent, context),
@@ -2852,7 +2851,7 @@ const Items$1 = /* @__PURE__ */ memo(function VirtuosoItems({ showTopList = fals
2852
2851
  groupContent(item.index)
2853
2852
  );
2854
2853
  } else {
2855
- return createElement(
2854
+ return React.createElement(
2856
2855
  ItemComponent,
2857
2856
  {
2858
2857
  ...contextPropIfNotDomElement(ItemComponent, context),
@@ -2895,24 +2894,24 @@ function contextPropIfNotDomElement(element, context) {
2895
2894
  }
2896
2895
  return { context };
2897
2896
  }
2898
- const Header$1 = /* @__PURE__ */ memo(function VirtuosoHeader() {
2897
+ const Header$1 = /* @__PURE__ */ React.memo(function VirtuosoHeader() {
2899
2898
  const Header2 = useEmitterValue$2("HeaderComponent");
2900
2899
  const headerHeight = usePublisher$2("headerHeight");
2901
2900
  const headerFooterTag = useEmitterValue$2("headerFooterTag");
2902
2901
  const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
2903
2902
  const context = useEmitterValue$2("context");
2904
- return Header2 ? createElement(headerFooterTag, { ref }, createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
2903
+ return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
2905
2904
  });
2906
- const Footer$1 = /* @__PURE__ */ memo(function VirtuosoFooter() {
2905
+ const Footer$1 = /* @__PURE__ */ React.memo(function VirtuosoFooter() {
2907
2906
  const Footer2 = useEmitterValue$2("FooterComponent");
2908
2907
  const footerHeight = usePublisher$2("footerHeight");
2909
2908
  const headerFooterTag = useEmitterValue$2("headerFooterTag");
2910
2909
  const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
2911
2910
  const context = useEmitterValue$2("context");
2912
- return Footer2 ? createElement(headerFooterTag, { ref }, createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
2911
+ return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
2913
2912
  });
2914
2913
  function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
2915
- const Scroller2 = memo(function VirtuosoScroller({ style, children, ...props }) {
2914
+ const Scroller2 = React.memo(function VirtuosoScroller({ style, children, ...props }) {
2916
2915
  const scrollContainerStateCallback = usePublisher2("scrollContainerState");
2917
2916
  const ScrollerComponent = useEmitterValue2("ScrollerComponent");
2918
2917
  const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
@@ -2926,7 +2925,7 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
2926
2925
  );
2927
2926
  useEmitter2("scrollTo", scrollToCallback);
2928
2927
  useEmitter2("scrollBy", scrollByCallback);
2929
- return createElement(
2928
+ return React.createElement(
2930
2929
  ScrollerComponent,
2931
2930
  {
2932
2931
  ref: scrollerRef,
@@ -2943,7 +2942,7 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
2943
2942
  return Scroller2;
2944
2943
  }
2945
2944
  function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
2946
- const Scroller2 = memo(function VirtuosoWindowScroller({ style, children, ...props }) {
2945
+ const Scroller2 = React.memo(function VirtuosoWindowScroller({ style, children, ...props }) {
2947
2946
  const scrollContainerStateCallback = usePublisher2("windowScrollContainerState");
2948
2947
  const ScrollerComponent = useEmitterValue2("ScrollerComponent");
2949
2948
  const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
@@ -2966,7 +2965,7 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
2966
2965
  }, [scrollerRef, customScrollParent]);
2967
2966
  useEmitter2("windowScrollTo", scrollToCallback);
2968
2967
  useEmitter2("scrollBy", scrollByCallback);
2969
- return createElement(
2968
+ return React.createElement(
2970
2969
  ScrollerComponent,
2971
2970
  {
2972
2971
  style: { position: "relative", ...style, ...totalListHeight !== 0 ? { height: totalListHeight + deviation } : {} },
@@ -2980,53 +2979,46 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
2980
2979
  return Scroller2;
2981
2980
  }
2982
2981
  const Viewport$2 = ({ children }) => {
2983
- const ctx = useContext(VirtuosoMockContext);
2982
+ const ctx = React.useContext(VirtuosoMockContext);
2984
2983
  const viewportHeight = usePublisher$2("viewportHeight");
2985
2984
  const fixedItemHeight = usePublisher$2("fixedItemHeight");
2986
2985
  const viewportRef = useSize(compose(viewportHeight, (el) => correctItemSize(el, "height")));
2987
- useEffect(() => {
2986
+ React.useEffect(() => {
2988
2987
  if (ctx) {
2989
2988
  viewportHeight(ctx.viewportHeight);
2990
2989
  fixedItemHeight(ctx.itemHeight);
2991
2990
  }
2992
2991
  }, [ctx, viewportHeight, fixedItemHeight]);
2993
- return /* @__PURE__ */ jsx("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element", children });
2992
+ return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children);
2994
2993
  };
2995
2994
  const WindowViewport$2 = ({ children }) => {
2996
- const ctx = useContext(VirtuosoMockContext);
2995
+ const ctx = React.useContext(VirtuosoMockContext);
2997
2996
  const windowViewportRect = usePublisher$2("windowViewportRect");
2998
2997
  const fixedItemHeight = usePublisher$2("fixedItemHeight");
2999
2998
  const customScrollParent = useEmitterValue$2("customScrollParent");
3000
2999
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
3001
- useEffect(() => {
3000
+ React.useEffect(() => {
3002
3001
  if (ctx) {
3003
3002
  fixedItemHeight(ctx.itemHeight);
3004
3003
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
3005
3004
  }
3006
3005
  }, [ctx, windowViewportRect, fixedItemHeight]);
3007
- return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window", children });
3006
+ return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children);
3008
3007
  };
3009
3008
  const TopItemListContainer = ({ children }) => {
3010
3009
  const TopItemList = useEmitterValue$2("TopItemListComponent");
3011
3010
  const headerHeight = useEmitterValue$2("headerHeight");
3012
3011
  const style = { ...topItemListStyle, marginTop: `${headerHeight}px` };
3013
3012
  const context = useEmitterValue$2("context");
3014
- return createElement(TopItemList || "div", { style, context }, children);
3013
+ return React.createElement(TopItemList || "div", { style, context }, children);
3015
3014
  };
3016
- const ListRoot = /* @__PURE__ */ memo(function VirtuosoRoot(props) {
3015
+ const ListRoot = /* @__PURE__ */ React.memo(function VirtuosoRoot(props) {
3017
3016
  const useWindowScroll = useEmitterValue$2("useWindowScroll");
3018
3017
  const showTopList = useEmitterValue$2("topItemsIndexes").length > 0;
3019
3018
  const customScrollParent = useEmitterValue$2("customScrollParent");
3020
3019
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$2 : Scroller$2;
3021
3020
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$2 : Viewport$2;
3022
- return /* @__PURE__ */ jsxs(TheScroller, { ...props, children: [
3023
- showTopList && /* @__PURE__ */ jsx(TopItemListContainer, { children: /* @__PURE__ */ jsx(Items$1, { showTopList: true }) }),
3024
- /* @__PURE__ */ jsxs(TheViewport, { children: [
3025
- /* @__PURE__ */ jsx(Header$1, {}),
3026
- /* @__PURE__ */ jsx(Items$1, {}),
3027
- /* @__PURE__ */ jsx(Footer$1, {})
3028
- ] })
3029
- ] });
3021
+ return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, showTopList && /* @__PURE__ */ React.createElement(TopItemListContainer, null, /* @__PURE__ */ React.createElement(Items$1, { showTopList: true })), /* @__PURE__ */ React.createElement(TheViewport, null, /* @__PURE__ */ React.createElement(Header$1, null), /* @__PURE__ */ React.createElement(Items$1, null), /* @__PURE__ */ React.createElement(Footer$1, null)));
3030
3022
  });
3031
3023
  const {
3032
3024
  Component: List,
@@ -3125,6 +3117,9 @@ function buildItems(startIndex, endIndex, data) {
3125
3117
  function gapComparator(prev, next) {
3126
3118
  return prev && prev.column === next.column && prev.row === next.row;
3127
3119
  }
3120
+ function dimensionComparator(prev, next) {
3121
+ return prev && prev.width === next.width && prev.height === next.height;
3122
+ }
3128
3123
  const gridSystem = /* @__PURE__ */ system(
3129
3124
  ([
3130
3125
  { overscan, visibleRange, listBoundary },
@@ -3169,11 +3164,11 @@ const gridSystem = /* @__PURE__ */ system(
3169
3164
  duc(totalCount),
3170
3165
  visibleRange,
3171
3166
  duc(gap, gapComparator),
3172
- duc(itemDimensions, (prev, next) => prev && prev.width === next.width && prev.height === next.height),
3167
+ duc(itemDimensions, dimensionComparator),
3168
+ duc(viewportDimensions, dimensionComparator),
3173
3169
  data
3174
3170
  ),
3175
- withLatestFrom(viewportDimensions),
3176
- map(([[totalCount2, [startOffset, endOffset], gap2, item, data2], viewport]) => {
3171
+ map(([totalCount2, [startOffset, endOffset], gap2, item, viewport, data2]) => {
3177
3172
  const { row: rowGap, column: columnGap } = gap2;
3178
3173
  const { height: itemHeight, width: itemWidth } = item;
3179
3174
  const { width: viewportWidth } = viewport;
@@ -3393,7 +3388,7 @@ const gridComponentPropsSystem = /* @__PURE__ */ system(() => {
3393
3388
  const combinedSystem$1 = /* @__PURE__ */ system(([gridSystem2, gridComponentPropsSystem2]) => {
3394
3389
  return { ...gridSystem2, ...gridComponentPropsSystem2 };
3395
3390
  }, tup(gridSystem, gridComponentPropsSystem));
3396
- const GridItems = /* @__PURE__ */ memo(function GridItems2() {
3391
+ const GridItems = /* @__PURE__ */ React.memo(function GridItems2() {
3397
3392
  const gridState = useEmitterValue$1("gridState");
3398
3393
  const listClassName = useEmitterValue$1("listClassName");
3399
3394
  const itemClassName = useEmitterValue$1("itemClassName");
@@ -3420,7 +3415,7 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
3420
3415
  column: resolveGapValue("column-gap", getComputedStyle(el).columnGap, log)
3421
3416
  });
3422
3417
  });
3423
- return createElement(
3418
+ return React.createElement(
3424
3419
  ListComponent,
3425
3420
  {
3426
3421
  ref: listRef,
@@ -3431,13 +3426,13 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
3431
3426
  },
3432
3427
  gridState.items.map((item) => {
3433
3428
  const key = computeItemKey(item.index, item.data, context);
3434
- return isSeeking ? createElement(ScrollSeekPlaceholder, {
3429
+ return isSeeking ? React.createElement(ScrollSeekPlaceholder, {
3435
3430
  key,
3436
3431
  ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3437
3432
  index: item.index,
3438
3433
  height: gridState.itemHeight,
3439
3434
  width: gridState.itemWidth
3440
- }) : createElement(
3435
+ }) : React.createElement(
3441
3436
  ItemComponent,
3442
3437
  { ...contextPropIfNotDomElement(ItemComponent, context), className: itemClassName, "data-index": item.index, key },
3443
3438
  itemContent(item.index, item.data, context)
@@ -3445,61 +3440,57 @@ const GridItems = /* @__PURE__ */ memo(function GridItems2() {
3445
3440
  })
3446
3441
  );
3447
3442
  });
3448
- const Header = memo(function VirtuosoHeader2() {
3443
+ const Header = React.memo(function VirtuosoHeader2() {
3449
3444
  const Header2 = useEmitterValue$1("HeaderComponent");
3450
3445
  const headerHeight = usePublisher$1("headerHeight");
3451
3446
  const headerFooterTag = useEmitterValue$1("headerFooterTag");
3452
3447
  const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
3453
3448
  const context = useEmitterValue$1("context");
3454
- return Header2 ? createElement(headerFooterTag, { ref }, createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
3449
+ return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
3455
3450
  });
3456
- const Footer = memo(function VirtuosoGridFooter() {
3451
+ const Footer = React.memo(function VirtuosoGridFooter() {
3457
3452
  const Footer2 = useEmitterValue$1("FooterComponent");
3458
3453
  const footerHeight = usePublisher$1("footerHeight");
3459
3454
  const headerFooterTag = useEmitterValue$1("headerFooterTag");
3460
3455
  const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
3461
3456
  const context = useEmitterValue$1("context");
3462
- return Footer2 ? createElement(headerFooterTag, { ref }, createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
3457
+ return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
3463
3458
  });
3464
3459
  const Viewport$1 = ({ children }) => {
3465
- const ctx = useContext(VirtuosoGridMockContext);
3460
+ const ctx = React.useContext(VirtuosoGridMockContext);
3466
3461
  const itemDimensions = usePublisher$1("itemDimensions");
3467
3462
  const viewportDimensions = usePublisher$1("viewportDimensions");
3468
3463
  const viewportRef = useSize((el) => {
3469
3464
  viewportDimensions(el.getBoundingClientRect());
3470
3465
  });
3471
- useEffect(() => {
3466
+ React.useEffect(() => {
3472
3467
  if (ctx) {
3473
3468
  viewportDimensions({ height: ctx.viewportHeight, width: ctx.viewportWidth });
3474
3469
  itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
3475
3470
  }
3476
3471
  }, [ctx, viewportDimensions, itemDimensions]);
3477
- return /* @__PURE__ */ jsx("div", { style: viewportStyle, ref: viewportRef, children });
3472
+ return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef }, children);
3478
3473
  };
3479
3474
  const WindowViewport$1 = ({ children }) => {
3480
- const ctx = useContext(VirtuosoGridMockContext);
3475
+ const ctx = React.useContext(VirtuosoGridMockContext);
3481
3476
  const windowViewportRect = usePublisher$1("windowViewportRect");
3482
3477
  const itemDimensions = usePublisher$1("itemDimensions");
3483
3478
  const customScrollParent = useEmitterValue$1("customScrollParent");
3484
3479
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
3485
- useEffect(() => {
3480
+ React.useEffect(() => {
3486
3481
  if (ctx) {
3487
3482
  itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
3488
3483
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: ctx.viewportWidth });
3489
3484
  }
3490
3485
  }, [ctx, windowViewportRect, itemDimensions]);
3491
- return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle, children });
3486
+ return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle }, children);
3492
3487
  };
3493
- const GridRoot = /* @__PURE__ */ memo(function GridRoot2({ ...props }) {
3488
+ const GridRoot = /* @__PURE__ */ React.memo(function GridRoot2({ ...props }) {
3494
3489
  const useWindowScroll = useEmitterValue$1("useWindowScroll");
3495
3490
  const customScrollParent = useEmitterValue$1("customScrollParent");
3496
3491
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$1 : Scroller$1;
3497
3492
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$1 : Viewport$1;
3498
- return /* @__PURE__ */ jsx(TheScroller, { ...props, children: /* @__PURE__ */ jsxs(TheViewport, { children: [
3499
- /* @__PURE__ */ jsx(Header, {}),
3500
- /* @__PURE__ */ jsx(GridItems, {}),
3501
- /* @__PURE__ */ jsx(Footer, {})
3502
- ] }) });
3493
+ return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, /* @__PURE__ */ React.createElement(TheViewport, null, /* @__PURE__ */ React.createElement(Header, null), /* @__PURE__ */ React.createElement(GridItems, null), /* @__PURE__ */ React.createElement(Footer, null)));
3503
3494
  });
3504
3495
  const {
3505
3496
  Component: Grid,
@@ -3555,10 +3546,7 @@ function resolveGapValue(property, value, log) {
3555
3546
  }
3556
3547
  const VirtuosoGrid = Grid;
3557
3548
  const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
3558
- const itemContent = statefulStream((index) => /* @__PURE__ */ jsxs("td", { children: [
3559
- "Item $",
3560
- index
3561
- ] }));
3549
+ const itemContent = statefulStream((index) => /* @__PURE__ */ React.createElement("td", null, "Item $", index));
3562
3550
  const context = statefulStream(null);
3563
3551
  const fixedHeaderContent = statefulStream(null);
3564
3552
  const fixedFooterContent = statefulStream(null);
@@ -3597,9 +3585,9 @@ const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
3597
3585
  const combinedSystem = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
3598
3586
  return { ...listSystem2, ...propsSystem };
3599
3587
  }, tup(listSystem, tableComponentPropsSystem));
3600
- const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { style: { height } }) });
3601
- const DefaultFillerRow = ({ height }) => /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { style: { height, padding: 0, border: 0 } }) });
3602
- const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
3588
+ const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height } }));
3589
+ const DefaultFillerRow = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height, padding: 0, border: 0 } }));
3590
+ const Items = /* @__PURE__ */ React.memo(function VirtuosoItems2() {
3603
3591
  const listState = useEmitterValue("listState");
3604
3592
  const sizeRanges = usePublisher("sizeRanges");
3605
3593
  const useWindowScroll = useEmitterValue("useWindowScroll");
@@ -3620,7 +3608,7 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
3620
3608
  void 0,
3621
3609
  customScrollParent
3622
3610
  );
3623
- const [deviation, setDeviation] = useState(0);
3611
+ const [deviation, setDeviation] = React.useState(0);
3624
3612
  useEmitter("deviation", (value) => {
3625
3613
  if (deviation !== value) {
3626
3614
  ref.current.style.marginTop = `${value}px`;
@@ -3639,17 +3627,17 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
3639
3627
  const statefulTotalCount = useEmitterValue("statefulTotalCount");
3640
3628
  const context = useEmitterValue("context");
3641
3629
  if (statefulTotalCount === 0 && EmptyPlaceholder) {
3642
- return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
3630
+ return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
3643
3631
  }
3644
3632
  const paddingTop = listState.offsetTop + paddingTopAddition + deviation;
3645
3633
  const paddingBottom = listState.offsetBottom;
3646
- const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ jsx(FillerRow, { height: paddingTop, context }, "padding-top") : null;
3647
- const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ jsx(FillerRow, { height: paddingBottom, context }, "padding-bottom") : null;
3634
+ const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingTop, key: "padding-top", context }) : null;
3635
+ const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom", context }) : null;
3648
3636
  const items = listState.items.map((item) => {
3649
3637
  const index = item.originalIndex;
3650
3638
  const key = computeItemKey(index + firstItemIndex, item.data, context);
3651
3639
  if (isSeeking) {
3652
- return createElement(ScrollSeekPlaceholder, {
3640
+ return React.createElement(ScrollSeekPlaceholder, {
3653
3641
  ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3654
3642
  key,
3655
3643
  index: item.index,
@@ -3657,7 +3645,7 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
3657
3645
  type: item.type || "item"
3658
3646
  });
3659
3647
  }
3660
- return createElement(
3648
+ return React.createElement(
3661
3649
  TableRowComponent,
3662
3650
  {
3663
3651
  ...contextPropIfNotDomElement(TableRowComponent, context),
@@ -3671,40 +3659,40 @@ const Items = /* @__PURE__ */ memo(function VirtuosoItems2() {
3671
3659
  itemContent(item.index, item.data, context)
3672
3660
  );
3673
3661
  });
3674
- return createElement(
3662
+ return React.createElement(
3675
3663
  TableBodyComponent,
3676
3664
  { ref: callbackRef, "data-test-id": "virtuoso-item-list", ...contextPropIfNotDomElement(TableBodyComponent, context) },
3677
3665
  [paddingTopEl, ...items, paddingBottomEl]
3678
3666
  );
3679
3667
  });
3680
3668
  const Viewport = ({ children }) => {
3681
- const ctx = useContext(VirtuosoMockContext);
3669
+ const ctx = React.useContext(VirtuosoMockContext);
3682
3670
  const viewportHeight = usePublisher("viewportHeight");
3683
3671
  const fixedItemHeight = usePublisher("fixedItemHeight");
3684
3672
  const viewportRef = useSize(compose(viewportHeight, (el) => correctItemSize(el, "height")));
3685
- useEffect(() => {
3673
+ React.useEffect(() => {
3686
3674
  if (ctx) {
3687
3675
  viewportHeight(ctx.viewportHeight);
3688
3676
  fixedItemHeight(ctx.itemHeight);
3689
3677
  }
3690
3678
  }, [ctx, viewportHeight, fixedItemHeight]);
3691
- return /* @__PURE__ */ jsx("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element", children });
3679
+ return /* @__PURE__ */ React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children);
3692
3680
  };
3693
3681
  const WindowViewport = ({ children }) => {
3694
- const ctx = useContext(VirtuosoMockContext);
3682
+ const ctx = React.useContext(VirtuosoMockContext);
3695
3683
  const windowViewportRect = usePublisher("windowViewportRect");
3696
3684
  const fixedItemHeight = usePublisher("fixedItemHeight");
3697
3685
  const customScrollParent = useEmitterValue("customScrollParent");
3698
3686
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
3699
- useEffect(() => {
3687
+ React.useEffect(() => {
3700
3688
  if (ctx) {
3701
3689
  fixedItemHeight(ctx.itemHeight);
3702
3690
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
3703
3691
  }
3704
3692
  }, [ctx, windowViewportRect, fixedItemHeight]);
3705
- return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window", children });
3693
+ return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children);
3706
3694
  };
3707
- const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
3695
+ const TableRoot = /* @__PURE__ */ React.memo(function TableVirtuosoRoot(props) {
3708
3696
  const useWindowScroll = useEmitterValue("useWindowScroll");
3709
3697
  const customScrollParent = useEmitterValue("customScrollParent");
3710
3698
  const fixedHeaderHeight = usePublisher("fixedHeaderHeight");
@@ -3719,7 +3707,7 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
3719
3707
  const TheTable = useEmitterValue("TableComponent");
3720
3708
  const TheTHead = useEmitterValue("TableHeadComponent");
3721
3709
  const TheTFoot = useEmitterValue("TableFooterComponent");
3722
- const theHead = fixedHeaderContent ? createElement(
3710
+ const theHead = fixedHeaderContent ? React.createElement(
3723
3711
  TheTHead,
3724
3712
  {
3725
3713
  key: "TableHead",
@@ -3729,7 +3717,7 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
3729
3717
  },
3730
3718
  fixedHeaderContent()
3731
3719
  ) : null;
3732
- const theFoot = fixedFooterContent ? createElement(
3720
+ const theFoot = fixedFooterContent ? React.createElement(
3733
3721
  TheTFoot,
3734
3722
  {
3735
3723
  key: "TableFoot",
@@ -3739,11 +3727,11 @@ const TableRoot = /* @__PURE__ */ memo(function TableVirtuosoRoot(props) {
3739
3727
  },
3740
3728
  fixedFooterContent()
3741
3729
  ) : null;
3742
- return /* @__PURE__ */ jsx(TheScroller, { ...props, children: /* @__PURE__ */ jsx(TheViewport, { children: createElement(TheTable, { style: { borderSpacing: 0 }, ...contextPropIfNotDomElement(TheTable, context) }, [
3730
+ return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, /* @__PURE__ */ React.createElement(TheViewport, null, React.createElement(TheTable, { style: { borderSpacing: 0 }, ...contextPropIfNotDomElement(TheTable, context) }, [
3743
3731
  theHead,
3744
- /* @__PURE__ */ jsx(Items, {}, "TableBody"),
3732
+ /* @__PURE__ */ React.createElement(Items, { key: "TableBody" }),
3745
3733
  theFoot
3746
- ]) }) });
3734
+ ])));
3747
3735
  });
3748
3736
  const {
3749
3737
  Component: Table,
@@ -27,7 +27,7 @@
27
27
  *
28
28
  * @packageDocumentation
29
29
  */
30
- import { ComponentType, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
30
+ import React from 'react';
31
31
  import * as u from '../urx';
32
32
  import type { Emitter, Publisher, AnySystemSpec, SR, Stream } from '../urx';
33
33
  /** @internal */
@@ -86,7 +86,7 @@ export type MethodsFromPropMap<E extends AnySystemSpec, M extends SystemPropsMap
86
86
  *
87
87
  * @typeParam T the type of the component
88
88
  */
89
- export type RefHandle<T> = T extends ForwardRefExoticComponent<RefAttributes<infer Handle>> ? Handle : never;
89
+ export type RefHandle<T> = T extends React.ForwardRefExoticComponent<React.RefAttributes<infer Handle>> ? Handle : never;
90
90
  /**
91
91
  * Converts a system spec to React component by mapping the system streams to component properties, events and methods. Returns hooks for querying and modifying
92
92
  * the system streams from the component's child components.
@@ -101,9 +101,9 @@ export type RefHandle<T> = T extends ForwardRefExoticComponent<RefAttributes<inf
101
101
  * <hr />
102
102
  */
103
103
  export declare function systemToComponent<SS extends AnySystemSpec, M extends SystemPropsMap<SS>, S extends SR<SS>, R>(systemSpec: SS, map: M, Root?: R): {
104
- Component: ForwardRefExoticComponent<import("react").PropsWithoutRef<{ [K in Extract<keyof M["required"], string>]: M["required"][K] extends string ? ReturnType<SS["constructor"]>[M["required"][K]] extends Observable<infer R_1> ? R_1 : never : never; } & { [K_1 in Extract<keyof M["optional"], string>]?: (M["optional"][K_1] extends string ? ReturnType<SS["constructor"]>[M["optional"][K_1]] extends Observable<infer R_2> ? R_2 : never : never) | undefined; } & { [K_2 in Extract<keyof M["events"], string>]?: (M["events"][K_2] extends string ? ReturnType<SS["constructor"]>[M["events"][K_2]] extends Observable<infer R_3> ? (value: R_3) => void : never : never) | undefined; } & (R extends ComponentType<infer RP> ? RP : {
105
- children?: ReactNode;
106
- })> & RefAttributes<MethodsFromPropMap<SS, M>>>;
104
+ Component: React.ForwardRefExoticComponent<React.PropsWithoutRef<{ [K in Extract<keyof M["required"], string>]: M["required"][K] extends string ? ReturnType<SS["constructor"]>[M["required"][K]] extends Observable<infer R_1> ? R_1 : never : never; } & { [K_1 in Extract<keyof M["optional"], string>]?: (M["optional"][K_1] extends string ? ReturnType<SS["constructor"]>[M["optional"][K_1]] extends Observable<infer R_2> ? R_2 : never : never) | undefined; } & { [K_2 in Extract<keyof M["events"], string>]?: (M["events"][K_2] extends string ? ReturnType<SS["constructor"]>[M["events"][K_2]] extends Observable<infer R_3> ? (value: R_3) => void : never : never) | undefined; } & (R extends React.ComponentType<infer RP> ? RP : {
105
+ children?: React.ReactNode;
106
+ })> & React.RefAttributes<MethodsFromPropMap<SS, M>>>;
107
107
  usePublisher: <K_3 extends keyof S>(key: K_3) => (value: S[K_3] extends u.Stream<infer R_4> ? R_4 : never) => void;
108
108
  useEmitterValue: <K_4 extends keyof S, V = S[K_4] extends u.StatefulStream<infer R_5> ? R_5 : never>(key: K_4) => V;
109
109
  useEmitter: <K_5 extends keyof S, V_1 = S[K_5] extends u.Stream<infer R_6> ? R_6 : never>(key: K_5, callback: (value: V_1) => void) => void;