react-virtuoso 4.10.1 → 4.10.2

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,4 +1,5 @@
1
- import React from "react";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { createElement } from "react";
2
3
  import ReactDOM from "react-dom";
3
4
  const PUBLISH = 0;
4
5
  const SUBSCRIBE = 1;
@@ -322,7 +323,7 @@ function omit(keys, obj) {
322
323
  }
323
324
  return result;
324
325
  }
325
- const useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
326
+ const useIsomorphicLayoutEffect$1 = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
326
327
  function systemToComponent(systemSpec, map2, Root) {
327
328
  const requiredPropNames = Object.keys(map2.required || {});
328
329
  const optionalPropNames = Object.keys(map2.optional || {});
@@ -368,7 +369,7 @@ function systemToComponent(systemSpec, map2, Root) {
368
369
  return tap(init(systemSpec), (system22) => applyPropsToSystem(system22, props));
369
370
  });
370
371
  const [handlers] = React.useState(curry1to0(buildEventHandlers, system2));
371
- useIsomorphicLayoutEffect$2(() => {
372
+ useIsomorphicLayoutEffect$1(() => {
372
373
  for (const eventName of eventNames) {
373
374
  if (eventName in props) {
374
375
  subscribe(handlers[eventName], props[eventName]);
@@ -378,19 +379,12 @@ function systemToComponent(systemSpec, map2, Root) {
378
379
  Object.values(handlers).map(reset);
379
380
  };
380
381
  }, [props, handlers, system2]);
381
- useIsomorphicLayoutEffect$2(() => {
382
+ useIsomorphicLayoutEffect$1(() => {
382
383
  applyPropsToSystem(system2, props);
383
384
  });
384
385
  React.useImperativeHandle(ref, always(buildMethods(system2)));
385
- return React.createElement(
386
- Context.Provider,
387
- { value: system2 },
388
- Root ? React.createElement(
389
- Root,
390
- omit([...requiredPropNames, ...optionalPropNames, ...eventNames], props),
391
- children
392
- ) : children
393
- );
386
+ const RootComponent = Root;
387
+ return /* @__PURE__ */ jsx(Context.Provider, { value: system2, children: Root ? /* @__PURE__ */ jsx(RootComponent, { ...omit([...requiredPropNames, ...optionalPropNames, ...eventNames], props), children }) : children });
394
388
  });
395
389
  const usePublisher2 = (key) => {
396
390
  return React.useCallback(curry2to1(publish, React.useContext(Context)[key]), [key]);
@@ -414,7 +408,7 @@ function systemToComponent(systemSpec, map2, Root) {
414
408
  const system2 = React.useContext(Context);
415
409
  const source = system2[key];
416
410
  const [value, setValue] = React.useState(curry1to0(getValue, source));
417
- useIsomorphicLayoutEffect$2(
411
+ useIsomorphicLayoutEffect$1(
418
412
  () => subscribe(source, (next) => {
419
413
  if (next !== value) {
420
414
  setValue(always(next));
@@ -428,7 +422,7 @@ function systemToComponent(systemSpec, map2, Root) {
428
422
  const useEmitter2 = (key, callback) => {
429
423
  const context = React.useContext(Context);
430
424
  const source = context[key];
431
- useIsomorphicLayoutEffect$2(() => subscribe(source, callback), [callback, source]);
425
+ useIsomorphicLayoutEffect$1(() => subscribe(source, callback), [callback, source]);
432
426
  };
433
427
  return {
434
428
  Component,
@@ -438,7 +432,6 @@ function systemToComponent(systemSpec, map2, Root) {
438
432
  };
439
433
  }
440
434
  const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
441
- const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
442
435
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
443
436
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
444
437
  LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
@@ -768,8 +761,7 @@ function newTree() {
768
761
  return NIL_NODE;
769
762
  }
770
763
  function remove(node, key) {
771
- if (empty(node))
772
- return NIL_NODE;
764
+ if (empty(node)) return NIL_NODE;
773
765
  const { k, l, r } = node;
774
766
  if (key === k) {
775
767
  if (empty(l)) {
@@ -3085,7 +3077,7 @@ const listComponentPropsSystem = /* @__PURE__ */ system(() => {
3085
3077
  const groupContent = statefulStream((index) => `Group ${index}`);
3086
3078
  const components = statefulStream({});
3087
3079
  const computeItemKey = statefulStream(identity);
3088
- const headerFooterTag = statefulStream("div");
3080
+ const HeaderFooterTag = statefulStream("div");
3089
3081
  const scrollerRef = statefulStream(noop);
3090
3082
  const distinctProp = (propName, defaultValue = null) => {
3091
3083
  return statefulStreamFromEmitter(
@@ -3103,7 +3095,7 @@ const listComponentPropsSystem = /* @__PURE__ */ system(() => {
3103
3095
  groupContent,
3104
3096
  components,
3105
3097
  computeItemKey,
3106
- headerFooterTag,
3098
+ HeaderFooterTag,
3107
3099
  scrollerRef,
3108
3100
  FooterComponent: distinctProp("Footer"),
3109
3101
  HeaderComponent: distinctProp("Header"),
@@ -3119,7 +3111,7 @@ const listComponentPropsSystem = /* @__PURE__ */ system(() => {
3119
3111
  const combinedSystem$2 = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
3120
3112
  return { ...listSystem2, ...propsSystem };
3121
3113
  }, tup(listSystem, listComponentPropsSystem));
3122
- const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ React.createElement("div", { style: { height } });
3114
+ const DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ jsx("div", { style: { height } });
3123
3115
  const GROUP_STYLE = { position: positionStickyCssValue(), zIndex: 1, overflowAnchor: "none" };
3124
3116
  const ITEM_STYLE$1 = { overflowAnchor: "none" };
3125
3117
  const HORIZONTAL_ITEM_STYLE = { ...ITEM_STYLE$1, display: "inline-block", height: "100%" };
@@ -3183,59 +3175,62 @@ const Items$1 = /* @__PURE__ */ React.memo(function VirtuosoItems({ showTopList
3183
3175
  ...initialItemFinalLocationReached ? {} : { visibility: "hidden" }
3184
3176
  };
3185
3177
  if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) {
3186
- return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
3178
+ return /* @__PURE__ */ jsx(EmptyPlaceholder, { ...contextPropIfNotDomElement(EmptyPlaceholder, context) });
3187
3179
  }
3188
- return React.createElement(
3180
+ return /* @__PURE__ */ jsx(
3189
3181
  ListComponent,
3190
3182
  {
3191
3183
  ...contextPropIfNotDomElement(ListComponent, context),
3192
3184
  ref: callbackRef,
3193
3185
  style: containerStyle,
3194
- "data-testid": showTopList ? "virtuoso-top-item-list" : "virtuoso-item-list"
3195
- },
3196
- (showTopList ? listState.topItems : listState.items).map((item) => {
3197
- const index = item.originalIndex;
3198
- const key = computeItemKey(index + listState.firstItemIndex, item.data, context);
3199
- if (isSeeking) {
3200
- return React.createElement(ScrollSeekPlaceholder, {
3201
- ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3202
- key,
3203
- index: item.index,
3204
- height: item.size,
3205
- type: item.type || "item",
3206
- ...item.type === "group" ? {} : { groupIndex: item.groupIndex }
3207
- });
3208
- }
3209
- if (item.type === "group") {
3210
- return React.createElement(
3211
- GroupComponent,
3212
- {
3213
- ...contextPropIfNotDomElement(GroupComponent, context),
3214
- key,
3215
- "data-index": index,
3216
- "data-known-size": item.size,
3217
- "data-item-index": item.index,
3218
- style: GROUP_STYLE
3219
- },
3220
- groupContent(item.index, context)
3221
- );
3222
- } else {
3223
- return React.createElement(
3224
- ItemComponent,
3225
- {
3226
- ...contextPropIfNotDomElement(ItemComponent, context),
3227
- ...itemPropIfNotDomElement(ItemComponent, item.data),
3228
- key,
3229
- "data-index": index,
3230
- "data-known-size": item.size,
3231
- "data-item-index": item.index,
3232
- "data-item-group-index": item.groupIndex,
3233
- style: horizontalDirection ? HORIZONTAL_ITEM_STYLE : ITEM_STYLE$1
3234
- },
3235
- hasGroups2 ? itemContent(item.index, item.groupIndex, item.data, context) : itemContent(item.index, item.data, context)
3236
- );
3237
- }
3238
- })
3186
+ "data-testid": showTopList ? "virtuoso-top-item-list" : "virtuoso-item-list",
3187
+ children: (showTopList ? listState.topItems : listState.items).map((item) => {
3188
+ const index = item.originalIndex;
3189
+ const key = computeItemKey(index + listState.firstItemIndex, item.data, context);
3190
+ if (isSeeking) {
3191
+ return /* @__PURE__ */ createElement(
3192
+ ScrollSeekPlaceholder,
3193
+ {
3194
+ ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3195
+ key,
3196
+ index: item.index,
3197
+ height: item.size,
3198
+ type: item.type || "item",
3199
+ ...item.type === "group" ? {} : { groupIndex: item.groupIndex }
3200
+ }
3201
+ );
3202
+ }
3203
+ if (item.type === "group") {
3204
+ return /* @__PURE__ */ createElement(
3205
+ GroupComponent,
3206
+ {
3207
+ ...contextPropIfNotDomElement(GroupComponent, context),
3208
+ key,
3209
+ "data-index": index,
3210
+ "data-known-size": item.size,
3211
+ "data-item-index": item.index,
3212
+ style: GROUP_STYLE
3213
+ },
3214
+ groupContent(item.index, context)
3215
+ );
3216
+ } else {
3217
+ return /* @__PURE__ */ createElement(
3218
+ ItemComponent,
3219
+ {
3220
+ ...contextPropIfNotDomElement(ItemComponent, context),
3221
+ ...itemPropIfNotDomElement(ItemComponent, item.data),
3222
+ key,
3223
+ "data-index": index,
3224
+ "data-known-size": item.size,
3225
+ "data-item-index": item.index,
3226
+ "data-item-group-index": item.groupIndex,
3227
+ style: horizontalDirection ? HORIZONTAL_ITEM_STYLE : ITEM_STYLE$1
3228
+ },
3229
+ hasGroups2 ? itemContent(item.index, item.groupIndex, item.data, context) : itemContent(item.index, item.data, context)
3230
+ );
3231
+ }
3232
+ })
3233
+ }
3239
3234
  );
3240
3235
  });
3241
3236
  const scrollerStyle = {
@@ -3275,26 +3270,26 @@ function itemPropIfNotDomElement(element, item) {
3275
3270
  const Header$1 = /* @__PURE__ */ React.memo(function VirtuosoHeader() {
3276
3271
  const Header2 = useEmitterValue$2("HeaderComponent");
3277
3272
  const headerHeight = usePublisher$2("headerHeight");
3278
- const headerFooterTag = useEmitterValue$2("headerFooterTag");
3273
+ const HeaderFooterTag = useEmitterValue$2("HeaderFooterTag");
3279
3274
  const ref = useSize(
3280
3275
  React.useMemo(() => (el) => headerHeight(correctItemSize(el, "height")), [headerHeight]),
3281
3276
  true,
3282
3277
  useEmitterValue$2("skipAnimationFrameInResizeObserver")
3283
3278
  );
3284
3279
  const context = useEmitterValue$2("context");
3285
- return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
3280
+ return Header2 ? /* @__PURE__ */ jsx(HeaderFooterTag, { ref, children: /* @__PURE__ */ jsx(Header2, { ...contextPropIfNotDomElement(Header2, context) }) }) : null;
3286
3281
  });
3287
3282
  const Footer$1 = /* @__PURE__ */ React.memo(function VirtuosoFooter() {
3288
3283
  const Footer2 = useEmitterValue$2("FooterComponent");
3289
3284
  const footerHeight = usePublisher$2("footerHeight");
3290
- const headerFooterTag = useEmitterValue$2("headerFooterTag");
3285
+ const HeaderFooterTag = useEmitterValue$2("HeaderFooterTag");
3291
3286
  const ref = useSize(
3292
3287
  React.useMemo(() => (el) => footerHeight(correctItemSize(el, "height")), [footerHeight]),
3293
3288
  true,
3294
3289
  useEmitterValue$2("skipAnimationFrameInResizeObserver")
3295
3290
  );
3296
3291
  const context = useEmitterValue$2("context");
3297
- return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
3292
+ return Footer2 ? /* @__PURE__ */ jsx(HeaderFooterTag, { ref, children: /* @__PURE__ */ jsx(Footer2, { ...contextPropIfNotDomElement(Footer2, context) }) }) : null;
3298
3293
  });
3299
3294
  function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
3300
3295
  const Scroller2 = React.memo(function VirtuosoScroller({ style, children, ...props }) {
@@ -3315,7 +3310,7 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
3315
3310
  useEmitter2("scrollTo", scrollToCallback);
3316
3311
  useEmitter2("scrollBy", scrollByCallback);
3317
3312
  const defaultStyle = horizontalDirection ? horizontalScrollerStyle : scrollerStyle;
3318
- return React.createElement(
3313
+ return /* @__PURE__ */ jsx(
3319
3314
  ScrollerComponent,
3320
3315
  {
3321
3316
  ref: scrollerRef,
@@ -3324,9 +3319,9 @@ function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, u
3324
3319
  "data-virtuoso-scroller": true,
3325
3320
  tabIndex: 0,
3326
3321
  ...props,
3327
- ...contextPropIfNotDomElement(ScrollerComponent, context)
3328
- },
3329
- children
3322
+ ...contextPropIfNotDomElement(ScrollerComponent, context),
3323
+ children
3324
+ }
3330
3325
  );
3331
3326
  });
3332
3327
  return Scroller2;
@@ -3347,7 +3342,7 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
3347
3342
  noop,
3348
3343
  customScrollParent
3349
3344
  );
3350
- useIsomorphicLayoutEffect$1(() => {
3345
+ useIsomorphicLayoutEffect(() => {
3351
3346
  scrollerRef.current = customScrollParent ? customScrollParent : window;
3352
3347
  return () => {
3353
3348
  scrollerRef.current = null;
@@ -3355,15 +3350,15 @@ function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitt
3355
3350
  }, [scrollerRef, customScrollParent]);
3356
3351
  useEmitter2("windowScrollTo", scrollToCallback);
3357
3352
  useEmitter2("scrollBy", scrollByCallback);
3358
- return React.createElement(
3353
+ return /* @__PURE__ */ jsx(
3359
3354
  ScrollerComponent,
3360
3355
  {
3361
3356
  style: { position: "relative", ...style, ...totalListHeight !== 0 ? { height: totalListHeight + deviation } : {} },
3362
3357
  "data-virtuoso-scroller": true,
3363
3358
  ...props,
3364
- ...contextPropIfNotDomElement(ScrollerComponent, context)
3365
- },
3366
- children
3359
+ ...contextPropIfNotDomElement(ScrollerComponent, context),
3360
+ children
3361
+ }
3367
3362
  );
3368
3363
  });
3369
3364
  return Scroller2;
@@ -3385,7 +3380,7 @@ const Viewport$2 = ({ children }) => {
3385
3380
  fixedItemHeight(ctx.itemHeight);
3386
3381
  }
3387
3382
  }, [ctx, viewportHeight, fixedItemHeight]);
3388
- return /* @__PURE__ */ React.createElement("div", { style: viewportStyle(alignToBottom), ref: viewportRef, "data-viewport-type": "element" }, children);
3383
+ return /* @__PURE__ */ jsx("div", { style: viewportStyle(alignToBottom), ref: viewportRef, "data-viewport-type": "element", children });
3389
3384
  };
3390
3385
  const WindowViewport$2 = ({ children }) => {
3391
3386
  const ctx = React.useContext(VirtuosoMockContext);
@@ -3404,14 +3399,14 @@ const WindowViewport$2 = ({ children }) => {
3404
3399
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
3405
3400
  }
3406
3401
  }, [ctx, windowViewportRect, fixedItemHeight]);
3407
- return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle(alignToBottom), "data-viewport-type": "window" }, children);
3402
+ return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle(alignToBottom), "data-viewport-type": "window", children });
3408
3403
  };
3409
3404
  const TopItemListContainer = ({ children }) => {
3410
3405
  const TopItemList = useEmitterValue$2("TopItemListComponent") || "div";
3411
3406
  const headerHeight = useEmitterValue$2("headerHeight");
3412
3407
  const style = { ...topItemListStyle, marginTop: `${headerHeight}px` };
3413
3408
  const context = useEmitterValue$2("context");
3414
- return React.createElement(TopItemList, { style, ...contextPropIfNotDomElement(TopItemList, context) }, children);
3409
+ return /* @__PURE__ */ jsx(TopItemList, { style, ...contextPropIfNotDomElement(TopItemList, context), children });
3415
3410
  };
3416
3411
  const ListRoot = /* @__PURE__ */ React.memo(function VirtuosoRoot(props) {
3417
3412
  const useWindowScroll = useEmitterValue$2("useWindowScroll");
@@ -3419,7 +3414,14 @@ const ListRoot = /* @__PURE__ */ React.memo(function VirtuosoRoot(props) {
3419
3414
  const customScrollParent = useEmitterValue$2("customScrollParent");
3420
3415
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$2 : Scroller$2;
3421
3416
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$2 : Viewport$2;
3422
- 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)));
3417
+ return /* @__PURE__ */ jsxs(TheScroller, { ...props, children: [
3418
+ showTopList && /* @__PURE__ */ jsx(TopItemListContainer, { children: /* @__PURE__ */ jsx(Items$1, { showTopList: true }) }),
3419
+ /* @__PURE__ */ jsxs(TheViewport, { children: [
3420
+ /* @__PURE__ */ jsx(Header$1, {}),
3421
+ /* @__PURE__ */ jsx(Items$1, {}),
3422
+ /* @__PURE__ */ jsx(Footer$1, {})
3423
+ ] })
3424
+ ] });
3423
3425
  });
3424
3426
  const {
3425
3427
  Component: List,
@@ -3451,7 +3453,7 @@ const {
3451
3453
  fixedItemHeight: "fixedItemHeight",
3452
3454
  itemSize: "itemSize",
3453
3455
  scrollSeekConfiguration: "scrollSeekConfiguration",
3454
- headerFooterTag: "headerFooterTag",
3456
+ headerFooterTag: "HeaderFooterTag",
3455
3457
  data: "data",
3456
3458
  initialItemCount: "initialItemCount",
3457
3459
  initialScrollTop: "initialScrollTop",
@@ -3959,59 +3961,67 @@ const GridItems = /* @__PURE__ */ React.memo(function GridItems2() {
3959
3961
  if (stateRestoreInProgress) {
3960
3962
  return null;
3961
3963
  }
3962
- useIsomorphicLayoutEffect$1(() => {
3964
+ useIsomorphicLayoutEffect(() => {
3963
3965
  if (gridState.itemHeight > 0 && gridState.itemWidth > 0) {
3964
3966
  reportReadyState(true);
3965
3967
  }
3966
3968
  }, [gridState]);
3967
- return React.createElement(
3969
+ return /* @__PURE__ */ jsx(
3968
3970
  ListComponent,
3969
3971
  {
3970
3972
  ref: listRef,
3971
3973
  className: listClassName,
3972
3974
  ...contextPropIfNotDomElement(ListComponent, context),
3973
3975
  style: { paddingTop: gridState.offsetTop, paddingBottom: gridState.offsetBottom },
3974
- "data-testid": "virtuoso-item-list"
3975
- },
3976
- gridState.items.map((item) => {
3977
- const key = computeItemKey(item.index, item.data, context);
3978
- return isSeeking ? React.createElement(ScrollSeekPlaceholder, {
3979
- key,
3980
- ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3981
- index: item.index,
3982
- height: gridState.itemHeight,
3983
- width: gridState.itemWidth
3984
- }) : React.createElement(
3985
- ItemComponent,
3986
- { ...contextPropIfNotDomElement(ItemComponent, context), className: itemClassName, "data-index": item.index, key },
3987
- itemContent(item.index, item.data, context)
3988
- );
3989
- })
3976
+ "data-testid": "virtuoso-item-list",
3977
+ children: gridState.items.map((item) => {
3978
+ const key = computeItemKey(item.index, item.data, context);
3979
+ return isSeeking ? /* @__PURE__ */ jsx(
3980
+ ScrollSeekPlaceholder,
3981
+ {
3982
+ ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
3983
+ index: item.index,
3984
+ height: gridState.itemHeight,
3985
+ width: gridState.itemWidth
3986
+ },
3987
+ key
3988
+ ) : /* @__PURE__ */ createElement(
3989
+ ItemComponent,
3990
+ {
3991
+ ...contextPropIfNotDomElement(ItemComponent, context),
3992
+ className: itemClassName,
3993
+ "data-index": item.index,
3994
+ key
3995
+ },
3996
+ itemContent(item.index, item.data, context)
3997
+ );
3998
+ })
3999
+ }
3990
4000
  );
3991
4001
  });
3992
4002
  const Header = React.memo(function VirtuosoHeader2() {
3993
4003
  const Header2 = useEmitterValue$1("HeaderComponent");
3994
4004
  const headerHeight = usePublisher$1("headerHeight");
3995
- const headerFooterTag = useEmitterValue$1("headerFooterTag");
4005
+ const HeaderFooterTag = useEmitterValue$1("headerFooterTag");
3996
4006
  const ref = useSize(
3997
4007
  React.useMemo(() => (el) => headerHeight(correctItemSize(el, "height")), [headerHeight]),
3998
4008
  true,
3999
4009
  false
4000
4010
  );
4001
4011
  const context = useEmitterValue$1("context");
4002
- return Header2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
4012
+ return Header2 ? /* @__PURE__ */ jsx(HeaderFooterTag, { ref, children: /* @__PURE__ */ jsx(Header2, { ...contextPropIfNotDomElement(Header2, context) }) }) : null;
4003
4013
  });
4004
4014
  const Footer = React.memo(function VirtuosoGridFooter() {
4005
4015
  const Footer2 = useEmitterValue$1("FooterComponent");
4006
4016
  const footerHeight = usePublisher$1("footerHeight");
4007
- const headerFooterTag = useEmitterValue$1("headerFooterTag");
4017
+ const HeaderFooterTag = useEmitterValue$1("headerFooterTag");
4008
4018
  const ref = useSize(
4009
4019
  React.useMemo(() => (el) => footerHeight(correctItemSize(el, "height")), [footerHeight]),
4010
4020
  true,
4011
4021
  false
4012
4022
  );
4013
4023
  const context = useEmitterValue$1("context");
4014
- return Footer2 ? React.createElement(headerFooterTag, { ref }, React.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
4024
+ return Footer2 ? /* @__PURE__ */ jsx(HeaderFooterTag, { ref, children: /* @__PURE__ */ jsx(Footer2, { ...contextPropIfNotDomElement(Footer2, context) }) }) : null;
4015
4025
  });
4016
4026
  const Viewport$1 = ({ children }) => {
4017
4027
  const ctx = React.useContext(VirtuosoGridMockContext);
@@ -4033,7 +4043,7 @@ const Viewport$1 = ({ children }) => {
4033
4043
  itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
4034
4044
  }
4035
4045
  }, [ctx, viewportDimensions, itemDimensions]);
4036
- return /* @__PURE__ */ React.createElement("div", { style: viewportStyle(false), ref: viewportRef }, children);
4046
+ return /* @__PURE__ */ jsx("div", { style: viewportStyle(false), ref: viewportRef, children });
4037
4047
  };
4038
4048
  const WindowViewport$1 = ({ children }) => {
4039
4049
  const ctx = React.useContext(VirtuosoGridMockContext);
@@ -4047,14 +4057,18 @@ const WindowViewport$1 = ({ children }) => {
4047
4057
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: ctx.viewportWidth });
4048
4058
  }
4049
4059
  }, [ctx, windowViewportRect, itemDimensions]);
4050
- return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle(false) }, children);
4060
+ return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle(false), children });
4051
4061
  };
4052
4062
  const GridRoot = /* @__PURE__ */ React.memo(function GridRoot2({ ...props }) {
4053
4063
  const useWindowScroll = useEmitterValue$1("useWindowScroll");
4054
4064
  const customScrollParent = useEmitterValue$1("customScrollParent");
4055
4065
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$1 : Scroller$1;
4056
4066
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$1 : Viewport$1;
4057
- 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)));
4067
+ return /* @__PURE__ */ jsx(TheScroller, { ...props, children: /* @__PURE__ */ jsxs(TheViewport, { children: [
4068
+ /* @__PURE__ */ jsx(Header, {}),
4069
+ /* @__PURE__ */ jsx(GridItems, {}),
4070
+ /* @__PURE__ */ jsx(Footer, {})
4071
+ ] }) });
4058
4072
  });
4059
4073
  const {
4060
4074
  Component: Grid,
@@ -4115,7 +4129,10 @@ function resolveGapValue(property, value, log) {
4115
4129
  }
4116
4130
  const VirtuosoGrid = Grid;
4117
4131
  const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
4118
- const itemContent = statefulStream((index) => /* @__PURE__ */ React.createElement("td", null, "Item $", index));
4132
+ const itemContent = statefulStream((index) => /* @__PURE__ */ jsxs("td", { children: [
4133
+ "Item $",
4134
+ index
4135
+ ] }));
4119
4136
  const context = statefulStream(null);
4120
4137
  const fixedHeaderContent = statefulStream(null);
4121
4138
  const fixedFooterContent = statefulStream(null);
@@ -4154,8 +4171,8 @@ const tableComponentPropsSystem = /* @__PURE__ */ system(() => {
4154
4171
  const combinedSystem = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
4155
4172
  return { ...listSystem2, ...propsSystem };
4156
4173
  }, tup(listSystem, tableComponentPropsSystem));
4157
- const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height } }));
4158
- const DefaultFillerRow = ({ height }) => /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { style: { height, padding: 0, border: 0 } }));
4174
+ const DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { style: { height } }) });
4175
+ const DefaultFillerRow = ({ height }) => /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { style: { height, padding: 0, border: 0 } }) });
4159
4176
  const ITEM_STYLE = { overflowAnchor: "none" };
4160
4177
  const Items = /* @__PURE__ */ React.memo(function VirtuosoItems2() {
4161
4178
  const listState = useEmitterValue("listState");
@@ -4199,25 +4216,28 @@ const Items = /* @__PURE__ */ React.memo(function VirtuosoItems2() {
4199
4216
  const statefulTotalCount = useEmitterValue("statefulTotalCount");
4200
4217
  const context = useEmitterValue("context");
4201
4218
  if (statefulTotalCount === 0 && EmptyPlaceholder) {
4202
- return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
4219
+ return /* @__PURE__ */ jsx(EmptyPlaceholder, { ...contextPropIfNotDomElement(EmptyPlaceholder, context) });
4203
4220
  }
4204
4221
  const paddingTop = listState.offsetTop + paddingTopAddition + deviation;
4205
4222
  const paddingBottom = listState.offsetBottom;
4206
- const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingTop, key: "padding-top", context }) : null;
4207
- const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ React.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom", context }) : null;
4223
+ const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ jsx(FillerRow, { height: paddingTop, context }, "padding-top") : null;
4224
+ const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ jsx(FillerRow, { height: paddingBottom, context }, "padding-bottom") : null;
4208
4225
  const items = listState.items.map((item) => {
4209
4226
  const index = item.originalIndex;
4210
4227
  const key = computeItemKey(index + firstItemIndex, item.data, context);
4211
4228
  if (isSeeking) {
4212
- return React.createElement(ScrollSeekPlaceholder, {
4213
- ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
4214
- key,
4215
- index: item.index,
4216
- height: item.size,
4217
- type: item.type || "item"
4218
- });
4229
+ return /* @__PURE__ */ createElement(
4230
+ ScrollSeekPlaceholder,
4231
+ {
4232
+ ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
4233
+ key,
4234
+ index: item.index,
4235
+ height: item.size,
4236
+ type: item.type || "item"
4237
+ }
4238
+ );
4219
4239
  }
4220
- return React.createElement(
4240
+ return /* @__PURE__ */ createElement(
4221
4241
  TableRowComponent,
4222
4242
  {
4223
4243
  ...contextPropIfNotDomElement(TableRowComponent, context),
@@ -4231,11 +4251,11 @@ const Items = /* @__PURE__ */ React.memo(function VirtuosoItems2() {
4231
4251
  itemContent(item.index, item.data, context)
4232
4252
  );
4233
4253
  });
4234
- return React.createElement(
4235
- TableBodyComponent,
4236
- { ref: callbackRef, "data-testid": "virtuoso-item-list", ...contextPropIfNotDomElement(TableBodyComponent, context) },
4237
- [paddingTopEl, ...items, paddingBottomEl]
4238
- );
4254
+ return /* @__PURE__ */ jsxs(TableBodyComponent, { ref: callbackRef, "data-testid": "virtuoso-item-list", ...contextPropIfNotDomElement(TableBodyComponent, context), children: [
4255
+ paddingTopEl,
4256
+ items,
4257
+ paddingBottomEl
4258
+ ] });
4239
4259
  });
4240
4260
  const Viewport = ({ children }) => {
4241
4261
  const ctx = React.useContext(VirtuosoMockContext);
@@ -4252,7 +4272,7 @@ const Viewport = ({ children }) => {
4252
4272
  fixedItemHeight(ctx.itemHeight);
4253
4273
  }
4254
4274
  }, [ctx, viewportHeight, fixedItemHeight]);
4255
- return /* @__PURE__ */ React.createElement("div", { style: viewportStyle(false), ref: viewportRef, "data-viewport-type": "element" }, children);
4275
+ return /* @__PURE__ */ jsx("div", { style: viewportStyle(false), ref: viewportRef, "data-viewport-type": "element", children });
4256
4276
  };
4257
4277
  const WindowViewport = ({ children }) => {
4258
4278
  const ctx = React.useContext(VirtuosoMockContext);
@@ -4270,7 +4290,7 @@ const WindowViewport = ({ children }) => {
4270
4290
  windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
4271
4291
  }
4272
4292
  }, [ctx, windowViewportRect, fixedItemHeight]);
4273
- return /* @__PURE__ */ React.createElement("div", { ref: viewportRef, style: viewportStyle(false), "data-viewport-type": "window" }, children);
4293
+ return /* @__PURE__ */ jsx("div", { ref: viewportRef, style: viewportStyle(false), "data-viewport-type": "window", children });
4274
4294
  };
4275
4295
  const TableRoot = /* @__PURE__ */ React.memo(function TableVirtuosoRoot(props) {
4276
4296
  const useWindowScroll = useEmitterValue("useWindowScroll");
@@ -4295,31 +4315,31 @@ const TableRoot = /* @__PURE__ */ React.memo(function TableVirtuosoRoot(props) {
4295
4315
  const TheTable = useEmitterValue("TableComponent");
4296
4316
  const TheTHead = useEmitterValue("TableHeadComponent");
4297
4317
  const TheTFoot = useEmitterValue("TableFooterComponent");
4298
- const theHead = fixedHeaderContent ? React.createElement(
4318
+ const theHead = fixedHeaderContent ? /* @__PURE__ */ jsx(
4299
4319
  TheTHead,
4300
4320
  {
4301
- key: "TableHead",
4302
4321
  style: { zIndex: 2, position: "sticky", top: 0 },
4303
4322
  ref: theadRef,
4304
- ...contextPropIfNotDomElement(TheTHead, context)
4323
+ ...contextPropIfNotDomElement(TheTHead, context),
4324
+ children: fixedHeaderContent()
4305
4325
  },
4306
- fixedHeaderContent()
4326
+ "TableHead"
4307
4327
  ) : null;
4308
- const theFoot = fixedFooterContent ? React.createElement(
4328
+ const theFoot = fixedFooterContent ? /* @__PURE__ */ jsx(
4309
4329
  TheTFoot,
4310
4330
  {
4311
- key: "TableFoot",
4312
4331
  style: { zIndex: 1, position: "sticky", bottom: 0 },
4313
4332
  ref: tfootRef,
4314
- ...contextPropIfNotDomElement(TheTFoot, context)
4333
+ ...contextPropIfNotDomElement(TheTFoot, context),
4334
+ children: fixedFooterContent()
4315
4335
  },
4316
- fixedFooterContent()
4336
+ "TableFoot"
4317
4337
  ) : null;
4318
- return /* @__PURE__ */ React.createElement(TheScroller, { ...props }, /* @__PURE__ */ React.createElement(TheViewport, null, React.createElement(
4319
- TheTable,
4320
- { style: { borderSpacing: 0, overflowAnchor: "none" }, ...contextPropIfNotDomElement(TheTable, context) },
4321
- [theHead, /* @__PURE__ */ React.createElement(Items, { key: "TableBody" }), theFoot]
4322
- )));
4338
+ return /* @__PURE__ */ jsx(TheScroller, { ...props, children: /* @__PURE__ */ jsx(TheViewport, { children: /* @__PURE__ */ jsxs(TheTable, { style: { borderSpacing: 0, overflowAnchor: "none" }, ...contextPropIfNotDomElement(TheTable, context), children: [
4339
+ theHead,
4340
+ /* @__PURE__ */ jsx(Items, {}, "TableBody"),
4341
+ theFoot
4342
+ ] }) }) });
4323
4343
  });
4324
4344
  const {
4325
4345
  Component: Table,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-virtuoso",
3
3
  "author": "Petyo Ivanov",
4
4
  "sideEffects": false,
5
- "version": "4.10.1",
5
+ "version": "4.10.2",
6
6
  "homepage": "https://virtuoso.dev/",
7
7
  "license": "MIT",
8
8
  "source": "src/index.tsx",
@@ -59,7 +59,7 @@
59
59
  "@types/react-router-dom": "^5.3.3",
60
60
  "@typescript-eslint/eslint-plugin": "^5.59.2",
61
61
  "@typescript-eslint/parser": "^5.59.2",
62
- "@vitejs/plugin-react": "^4.0.0",
62
+ "@vitejs/plugin-react": "^4.3.1",
63
63
  "clsx": "^1.2.1",
64
64
  "eslint": "^8.39.0",
65
65
  "eslint-config-prettier": "^8.8.0",
@@ -77,9 +77,9 @@
77
77
  "playwright": "^1.33.0",
78
78
  "prettier": "^2.2.1",
79
79
  "prism-react-renderer": "^1.3.5",
80
- "react": "^18.2.0",
80
+ "react": "18.3.1",
81
81
  "react-beautiful-dnd": "^13.1.1",
82
- "react-dom": "^18.2.0",
82
+ "react-dom": "18.3.1",
83
83
  "react-router-dom": "^6.14.0",
84
84
  "semantic-release": "^19.0.5",
85
85
  "terser": "^5.17.1",
@@ -87,9 +87,9 @@
87
87
  "typedoc": "^0.24.6",
88
88
  "typedoc-plugin-markdown": "^3.15.3",
89
89
  "typescript": "^5.0.4",
90
- "vite": "^4.3.5",
91
- "vite-plugin-dts": "^2.3.0",
92
- "vitest": "^0.31.0"
90
+ "vite": "^5.4.2",
91
+ "vite-plugin-dts": "^4.0.3",
92
+ "vitest": "^2.0.5"
93
93
  },
94
94
  "packageManager": "pnpm@8.14.3+sha256.2d0363bb6c314daa67087ef07743eea1ba2e2d360c835e8fec6b5575e4ed9484",
95
95
  "engines": {