react-window 2.0.0-alpha.2 → 2.0.0-alpha.3

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.
Files changed (28) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/react-window.cjs +1 -1
  3. package/dist/react-window.d.ts +3 -3
  4. package/dist/react-window.js +262 -256
  5. package/docs/assets/index-C0dH_qJq.js +67 -0
  6. package/docs/assets/index-DuD8RcK_.css +1 -0
  7. package/docs/generated/code-snippets/CellComponent.json +2 -2
  8. package/docs/generated/code-snippets/FixedHeightList.json +2 -2
  9. package/docs/generated/code-snippets/FixedHeightRowComponent.json +2 -2
  10. package/docs/generated/code-snippets/FlexboxLayout.json +2 -2
  11. package/docs/generated/code-snippets/Grid.json +2 -2
  12. package/docs/generated/code-snippets/ListVariableRowHeights.json +2 -2
  13. package/docs/generated/code-snippets/columnWidth.json +2 -2
  14. package/docs/generated/code-snippets/gridRefClickEventHandler.json +2 -2
  15. package/docs/generated/code-snippets/listRefClickEventHandler.json +2 -2
  16. package/docs/generated/code-snippets/rowHeight.json +2 -2
  17. package/docs/generated/code-snippets/useGridCallbackRef.json +2 -2
  18. package/docs/generated/code-snippets/useGridRef.json +2 -2
  19. package/docs/generated/code-snippets/useGridRefImport.json +1 -1
  20. package/docs/generated/code-snippets/useListCallbackRef.json +2 -2
  21. package/docs/generated/code-snippets/useListRef.json +2 -2
  22. package/docs/generated/code-snippets/useListRefImport.json +1 -1
  23. package/docs/generated/js-docs/Grid.json +43 -27
  24. package/docs/index.html +2 -2
  25. package/docs/stats.html +1 -1
  26. package/package.json +1 -1
  27. package/docs/assets/index-BMf3NlnJ.css +0 -1
  28. package/docs/assets/index-BPRxcSBS.js +0 -67
@@ -1,7 +1,7 @@
1
1
  import { jsx as j } from "react/jsx-runtime";
2
- import { useLayoutEffect as J, useEffect as P, useMemo as M, useState as $, useCallback as R, memo as V, useImperativeHandle as U, createElement as F, useRef as Y } from "react";
3
- const q = typeof window < "u" ? J : P;
4
- function W(t) {
2
+ import { useLayoutEffect as J, useEffect as W, useMemo as H, useState as L, useCallback as P, memo as V, useImperativeHandle as F, createElement as N, useRef as Y } from "react";
3
+ const q = typeof window < "u" ? J : W;
4
+ function B(t) {
5
5
  if (t !== void 0)
6
6
  switch (typeof t) {
7
7
  case "number":
@@ -19,43 +19,43 @@ function K({
19
19
  defaultWidth: l,
20
20
  disabled: s,
21
21
  element: e,
22
- mode: i,
22
+ mode: f,
23
23
  style: n
24
24
  }) {
25
- const { styleHeight: c, styleWidth: o } = M(
25
+ const { styleHeight: c, styleWidth: o } = H(
26
26
  () => ({
27
- styleHeight: W(n?.height),
28
- styleWidth: W(n?.width)
27
+ styleHeight: B(n?.height),
28
+ styleWidth: B(n?.width)
29
29
  }),
30
30
  [n?.height, n?.width]
31
- ), [f, p] = $({
31
+ ), [u, w] = L({
32
32
  height: r,
33
33
  width: l
34
- }), I = s || i === "only-height" && c !== void 0 || i === "only-width" && o !== void 0 || c !== void 0 && o !== void 0;
34
+ }), I = s || f === "only-height" && c !== void 0 || f === "only-width" && o !== void 0 || c !== void 0 && o !== void 0;
35
35
  return q(() => {
36
36
  if (e === null || I)
37
37
  return;
38
- const b = new ResizeObserver((y) => {
39
- for (const w of y) {
40
- const { contentRect: d, target: x } = w;
41
- e === x && p((z) => z.height === d.height && z.width === d.width ? z : {
38
+ const O = new ResizeObserver((S) => {
39
+ for (const m of S) {
40
+ const { contentRect: d, target: b } = m;
41
+ e === b && w((a) => a.height === d.height && a.width === d.width ? a : {
42
42
  height: d.height,
43
43
  width: d.width
44
44
  });
45
45
  }
46
46
  });
47
- return b.observe(e, { box: t }), () => {
48
- b?.unobserve(e);
47
+ return O.observe(e, { box: t }), () => {
48
+ O?.unobserve(e);
49
49
  };
50
- }, [t, I, e, c, o]), M(
50
+ }, [t, I, e, c, o]), H(
51
51
  () => ({
52
- height: c ?? f.height,
53
- width: o ?? f.width
52
+ height: c ?? u.height,
53
+ width: o ?? u.width
54
54
  }),
55
- [f, c, o]
55
+ [u, c, o]
56
56
  );
57
57
  }
58
- function E(t, r = "Assertion error") {
58
+ function $(t, r = "Assertion error") {
59
59
  if (!t)
60
60
  throw console.error(r), Error(r);
61
61
  }
@@ -68,7 +68,7 @@ function Q({
68
68
  return r * l;
69
69
  if (t.size > 0) {
70
70
  const s = t.get(t.size - 1);
71
- E(s !== void 0, "Unexpected bounds cache miss");
71
+ $(s !== void 0, "Unexpected bounds cache miss");
72
72
  const e = (s.scrollOffset + s.size) / t.size;
73
73
  return r * e;
74
74
  } else
@@ -80,29 +80,29 @@ function X({
80
80
  index: l,
81
81
  itemCount: s,
82
82
  containerScrollOffset: e,
83
- containerSize: i
83
+ containerSize: f
84
84
  }) {
85
- const n = r.get(s - 1).scrollOffset, c = n + n - i, o = Math.max(
85
+ const n = r.get(s - 1).scrollOffset, c = n + n - f, o = Math.max(
86
86
  0,
87
- r.get(l + 1).scrollOffset - i
88
- ), f = Math.min(
87
+ r.get(l + 1).scrollOffset - f
88
+ ), u = Math.min(
89
89
  n,
90
90
  r.get(l).scrollOffset
91
91
  );
92
- switch (t === "smart" && (e >= o && e <= f ? t = "auto" : t = "center"), t) {
92
+ switch (t === "smart" && (e >= o && e <= u ? t = "auto" : t = "center"), t) {
93
93
  case "start":
94
- return Math.min(c, f);
94
+ return Math.min(c, u);
95
95
  case "end":
96
96
  return o;
97
97
  case "center": {
98
- const p = Math.round(
99
- o + (f - o) / 2
98
+ const w = Math.round(
99
+ o + (u - o) / 2
100
100
  );
101
- return p < Math.ceil(i / 2) ? 0 : p > c ? c : p;
101
+ return w < Math.ceil(f / 2) ? 0 : w > c ? c : w;
102
102
  }
103
103
  case "auto":
104
104
  default:
105
- return e >= o && e <= f ? e : e < o ? o : f;
105
+ return e >= o && e <= u ? e : e < o ? o : u;
106
106
  }
107
107
  }
108
108
  function Z({
@@ -112,23 +112,23 @@ function Z({
112
112
  itemCount: s,
113
113
  overscanCount: e
114
114
  }) {
115
- const i = s - 1;
115
+ const f = s - 1;
116
116
  let n = 0, c = -1, o = 0;
117
- for (; o < i; ) {
118
- const f = t.get(o);
119
- if (f.scrollOffset + f.size > r)
117
+ for (; o < f; ) {
118
+ const u = t.get(o);
119
+ if (u.scrollOffset + u.size > r)
120
120
  break;
121
121
  o++;
122
122
  }
123
- for (n = o, n = Math.max(0, n - e); o < i; ) {
124
- const f = t.get(o);
125
- if (f.scrollOffset + f.size >= r + l)
123
+ for (n = o, n = Math.max(0, n - e); o < f; ) {
124
+ const u = t.get(o);
125
+ if (u.scrollOffset + u.size >= r + l)
126
126
  break;
127
127
  o++;
128
128
  }
129
- return c = Math.min(i, o), c = Math.min(s - 1, c + e), n < 0 ? [0, -1] : [n, c];
129
+ return c = Math.min(f, o), c = Math.min(s - 1, c + e), n < 0 ? [0, -1] : [n, c];
130
130
  }
131
- function _({
131
+ function C({
132
132
  itemCount: t,
133
133
  itemProps: r,
134
134
  itemSize: l
@@ -136,7 +136,7 @@ function _({
136
136
  const s = /* @__PURE__ */ new Map();
137
137
  return {
138
138
  get(e) {
139
- for (E(e < t, `Invalid index ${e}`); s.size - 1 < e; ) {
139
+ for ($(e < t, `Invalid index ${e}`); s.size - 1 < e; ) {
140
140
  const n = s.size, c = typeof l == "number" ? l : l(n, r);
141
141
  if (n === 0)
142
142
  s.set(n, {
@@ -145,7 +145,7 @@ function _({
145
145
  });
146
146
  else {
147
147
  const o = s.get(n - 1);
148
- E(
148
+ $(
149
149
  o !== void 0,
150
150
  `Unexpected bounds cache miss for index ${e}`
151
151
  ), s.set(n, {
@@ -154,27 +154,27 @@ function _({
154
154
  });
155
155
  }
156
156
  }
157
- const i = s.get(e);
158
- return E(
159
- i !== void 0,
157
+ const f = s.get(e);
158
+ return $(
159
+ f !== void 0,
160
160
  `Unexpected bounds cache miss for index ${e}`
161
- ), i;
161
+ ), f;
162
162
  },
163
- set(e, i) {
164
- s.set(e, i);
163
+ set(e, f) {
164
+ s.set(e, f);
165
165
  },
166
166
  get size() {
167
167
  return s.size;
168
168
  }
169
169
  };
170
170
  }
171
- function N({
171
+ function tt({
172
172
  itemCount: t,
173
173
  itemProps: r,
174
174
  itemSize: l
175
175
  }) {
176
- return M(
177
- () => _({
176
+ return H(
177
+ () => C({
178
178
  itemCount: t,
179
179
  itemProps: r,
180
180
  itemSize: l
@@ -188,256 +188,259 @@ function G({
188
188
  defaultContainerSize: l = 0,
189
189
  direction: s,
190
190
  itemCount: e,
191
- itemProps: i,
191
+ itemProps: f,
192
192
  itemSize: n,
193
193
  overscanCount: c
194
194
  }) {
195
- const [o, f] = $([0, -1]), [p, I] = [
195
+ const [o, u] = L([0, -1]), [w, I] = [
196
196
  Math.min(e - 1, o[0]),
197
197
  Math.min(e - 1, o[1])
198
- ], { height: b = l, width: y = l } = K({
198
+ ], { height: O = l, width: S = l } = K({
199
199
  defaultHeight: s === "vertical" ? l : void 0,
200
200
  defaultWidth: s === "horizontal" ? l : void 0,
201
201
  element: t,
202
202
  mode: s === "vertical" ? "only-height" : "only-width",
203
203
  style: r
204
- }), w = s === "vertical" ? b : y, d = N({
204
+ }), m = s === "vertical" ? O : S, d = tt({
205
205
  itemCount: e,
206
- itemProps: i,
206
+ itemProps: f,
207
207
  itemSize: n
208
- }), x = R(
209
- (u) => d.get(u),
208
+ }), b = P(
209
+ (i) => d.get(i),
210
210
  [d]
211
- ), z = R(
211
+ ), a = P(
212
212
  () => Q({
213
213
  cachedBounds: d,
214
214
  itemCount: e,
215
215
  itemSize: n
216
216
  }),
217
217
  [d, e, n]
218
- ), h = R(
219
- (u) => Z({
218
+ ), M = P(
219
+ (i) => Z({
220
220
  cachedBounds: d,
221
- containerScrollOffset: u,
222
- containerSize: w,
221
+ containerScrollOffset: i,
222
+ containerSize: m,
223
223
  itemCount: e,
224
224
  overscanCount: c
225
225
  }),
226
- [d, w, e, c]
226
+ [d, m, e, c]
227
227
  );
228
228
  q(() => {
229
- const u = (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0;
230
- f(h(u));
231
- }, [t, s, h]);
232
- const a = R(
229
+ const i = (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0;
230
+ u(M(i));
231
+ }, [t, s, M]);
232
+ const g = P(
233
233
  ({
234
- align: u = "auto",
235
- behavior: O = "auto",
236
- containerScrollOffset: m,
237
- index: g
234
+ align: i = "auto",
235
+ behavior: p = "auto",
236
+ containerScrollOffset: z,
237
+ index: x
238
238
  }) => {
239
- const S = X({
240
- align: u,
239
+ const h = X({
240
+ align: i,
241
241
  cachedBounds: d,
242
- containerScrollOffset: m,
243
- containerSize: w,
244
- index: g,
242
+ containerScrollOffset: z,
243
+ containerSize: m,
244
+ index: x,
245
245
  itemCount: e
246
246
  });
247
247
  s === "horizontal" ? t?.scrollTo({
248
- left: S,
249
- behavior: O || void 0
248
+ left: h,
249
+ behavior: p || void 0
250
250
  }) : t?.scrollTo({
251
- behavior: O || void 0,
252
- top: S
251
+ behavior: p || void 0,
252
+ top: h
253
253
  });
254
254
  },
255
- [d, t, w, s, e]
255
+ [d, t, m, s, e]
256
256
  );
257
257
  return {
258
- getCellBounds: x,
259
- getEstimatedHeight: z,
258
+ getCellBounds: b,
259
+ getEstimatedHeight: a,
260
260
  onScroll: () => {
261
- const u = h(
261
+ const i = M(
262
262
  (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0
263
263
  );
264
- (u[0] !== p || u[1] !== I) && f(u);
264
+ (i[0] !== w || i[1] !== I) && u(i);
265
265
  },
266
- scrollToIndex: a,
267
- startIndex: p,
266
+ scrollToIndex: g,
267
+ startIndex: w,
268
268
  stopIndex: I
269
269
  };
270
270
  }
271
271
  function A(t) {
272
- return M(() => t, Object.values(t));
272
+ return H(() => t, Object.values(t));
273
273
  }
274
- function B(t, r) {
274
+ function U(t, r) {
275
275
  if (t === r)
276
276
  return !0;
277
- if (!!t != !!r || (E(t !== void 0), E(r !== void 0), Object.keys(t).length !== Object.keys(r).length))
277
+ if (!!t != !!r || ($(t !== void 0), $(r !== void 0), Object.keys(t).length !== Object.keys(r).length))
278
278
  return !1;
279
279
  for (const l in t)
280
280
  if (!Object.is(r[l], t[l]))
281
281
  return !1;
282
282
  return !0;
283
283
  }
284
- function D(t, r) {
285
- const { style: l, ...s } = t, { style: e, ...i } = r;
286
- return B(l, e) && B(s, i);
284
+ function _(t, r) {
285
+ const { style: l, ...s } = t, { style: e, ...f } = r;
286
+ return U(l, e) && U(s, f);
287
287
  }
288
- function et({
288
+ const D = () => {
289
+ };
290
+ function ot({
289
291
  cellComponent: t,
290
292
  cellProps: r,
291
293
  className: l,
292
294
  columnCount: s,
293
295
  columnWidth: e,
294
- defaultHeight: i = 0,
296
+ defaultHeight: f = 0,
295
297
  defaultWidth: n = 0,
296
298
  gridRef: c,
297
299
  onCellsRendered: o,
298
- overscanCount: f = 3,
299
- rowCount: p,
300
- rowHeight: I,
301
- style: b,
302
- ...y
300
+ onScroll: u = D,
301
+ overscanCount: w = 3,
302
+ rowCount: I,
303
+ rowHeight: O,
304
+ style: S,
305
+ ...m
303
306
  }) {
304
- const w = A(r), d = M(
305
- () => V(t, D),
307
+ const d = A(r), b = H(
308
+ () => V(t, _),
306
309
  [t]
307
- ), [x, z] = $(null), h = G({
308
- containerElement: x,
310
+ ), [a, M] = L(null), g = G({
311
+ containerElement: a,
309
312
  defaultContainerSize: n,
310
313
  direction: "horizontal",
311
314
  itemCount: s,
312
- itemProps: w,
315
+ itemProps: d,
313
316
  itemSize: e,
314
- overscanCount: f
315
- }), a = G({
316
- containerElement: x,
317
- defaultContainerSize: i,
317
+ overscanCount: w
318
+ }), i = G({
319
+ containerElement: a,
320
+ defaultContainerSize: f,
318
321
  direction: "vertical",
319
- itemCount: p,
320
- itemProps: w,
321
- itemSize: I,
322
- overscanCount: f
323
- }), { startIndex: u, stopIndex: O } = h, { startIndex: m, stopIndex: g } = a;
324
- U(
322
+ itemCount: I,
323
+ itemProps: d,
324
+ itemSize: O,
325
+ overscanCount: w
326
+ }), { startIndex: p, stopIndex: z } = g, { startIndex: x, stopIndex: h } = i;
327
+ F(
325
328
  c,
326
329
  () => ({
327
330
  get element() {
328
- return x;
331
+ return a;
329
332
  },
330
333
  scrollToCell({
331
- behavior: T = "auto",
332
- columnAlign: v = "auto",
333
- columnIndex: H,
334
+ behavior: v = "auto",
335
+ columnAlign: y = "auto",
336
+ columnIndex: T,
334
337
  rowAlign: k = "auto",
335
- rowIndex: L
338
+ rowIndex: R
336
339
  }) {
337
- a?.scrollToIndex({
340
+ i?.scrollToIndex({
338
341
  align: k,
339
- behavior: T,
340
- containerScrollOffset: x?.scrollTop ?? 0,
341
- index: L
342
- }), h?.scrollToIndex({
343
- align: v,
344
- behavior: T,
345
- containerScrollOffset: x?.scrollLeft ?? 0,
346
- index: H
342
+ behavior: v,
343
+ containerScrollOffset: a?.scrollTop ?? 0,
344
+ index: R
345
+ }), g?.scrollToIndex({
346
+ align: y,
347
+ behavior: v,
348
+ containerScrollOffset: a?.scrollLeft ?? 0,
349
+ index: T
347
350
  });
348
351
  },
349
352
  scrollToColumn({
350
- align: T = "auto",
351
- behavior: v = "auto",
352
- index: H
353
+ align: v = "auto",
354
+ behavior: y = "auto",
355
+ index: T
353
356
  }) {
354
- h?.scrollToIndex({
355
- align: T,
356
- behavior: v,
357
- containerScrollOffset: x?.scrollLeft ?? 0,
358
- index: H
357
+ g?.scrollToIndex({
358
+ align: v,
359
+ behavior: y,
360
+ containerScrollOffset: a?.scrollLeft ?? 0,
361
+ index: T
359
362
  });
360
363
  },
361
364
  scrollToRow({
362
- align: T = "auto",
363
- behavior: v = "auto",
364
- index: H
365
+ align: v = "auto",
366
+ behavior: y = "auto",
367
+ index: T
365
368
  }) {
366
- a?.scrollToIndex({
367
- align: T,
368
- behavior: v,
369
- containerScrollOffset: x?.scrollTop ?? 0,
370
- index: H
369
+ i?.scrollToIndex({
370
+ align: v,
371
+ behavior: y,
372
+ containerScrollOffset: a?.scrollTop ?? 0,
373
+ index: T
371
374
  });
372
375
  }
373
376
  }),
374
- [h, x, a]
375
- ), P(() => {
376
- u >= 0 && O >= 0 && m >= 0 && g >= 0 && o && o({
377
- columnStartIndex: u,
378
- columnStopIndex: O,
379
- rowStartIndex: m,
380
- rowStopIndex: g
377
+ [g, a, i]
378
+ ), W(() => {
379
+ p >= 0 && z >= 0 && x >= 0 && h >= 0 && o && o({
380
+ columnStartIndex: p,
381
+ columnStopIndex: z,
382
+ rowStartIndex: x,
383
+ rowStopIndex: h
381
384
  });
382
385
  }, [
383
386
  o,
384
- u,
385
- O,
386
- m,
387
- g
387
+ p,
388
+ z,
389
+ x,
390
+ h
388
391
  ]);
389
- const S = M(() => {
390
- const T = [];
391
- if (h && s > 0 && a && p > 0)
392
- for (let v = m; v <= g; v++) {
393
- const H = a.getCellBounds(v);
394
- for (let k = u; k <= O; k++) {
395
- const L = h.getCellBounds(k);
396
- T.push(
397
- /* @__PURE__ */ F(
398
- d,
392
+ const E = H(() => {
393
+ const v = [];
394
+ if (g && s > 0 && i && I > 0)
395
+ for (let y = x; y <= h; y++) {
396
+ const T = i.getCellBounds(y);
397
+ for (let k = p; k <= z; k++) {
398
+ const R = g.getCellBounds(k);
399
+ v.push(
400
+ /* @__PURE__ */ N(
401
+ b,
399
402
  {
400
- ...w,
403
+ ...d,
401
404
  columnIndex: k,
402
- key: `${v}-${k}`,
403
- rowIndex: v,
405
+ key: `${y}-${k}`,
406
+ rowIndex: y,
404
407
  style: {
405
408
  position: "absolute",
406
409
  left: 0,
407
- transform: `translate(${L.scrollOffset}px, ${H.scrollOffset}px)`,
408
- height: H.size,
409
- width: L.size
410
+ transform: `translate(${R.scrollOffset}px, ${T.scrollOffset}px)`,
411
+ height: T.size,
412
+ width: R.size
410
413
  }
411
414
  }
412
415
  )
413
416
  );
414
417
  }
415
418
  }
416
- return T;
419
+ return v;
417
420
  }, [
421
+ b,
418
422
  d,
419
- w,
420
423
  s,
421
- u,
422
- O,
423
- h,
424
424
  p,
425
- m,
425
+ z,
426
426
  g,
427
- a
427
+ I,
428
+ x,
429
+ h,
430
+ i
428
431
  ]);
429
432
  return /* @__PURE__ */ j(
430
433
  "div",
431
434
  {
432
435
  role: "grid",
433
- ...y,
436
+ ...m,
434
437
  className: l,
435
- onScroll: () => {
436
- h.onScroll(), a.onScroll();
438
+ onScroll: (v) => {
439
+ g.onScroll(), i.onScroll(), u(v);
437
440
  },
438
- ref: z,
441
+ ref: M,
439
442
  style: {
440
- ...b,
443
+ ...S,
441
444
  maxHeight: "100%",
442
445
  maxWidth: "100%",
443
446
  flexGrow: 1,
@@ -449,109 +452,112 @@ function et({
449
452
  className: l,
450
453
  style: {
451
454
  position: "relative",
452
- height: a?.getEstimatedHeight(),
453
- width: h?.getEstimatedHeight()
455
+ height: i?.getEstimatedHeight(),
456
+ width: g?.getEstimatedHeight()
454
457
  },
455
- children: S
458
+ children: E
456
459
  }
457
460
  )
458
461
  }
459
462
  );
460
463
  }
461
- const st = $, ot = Y;
462
- function rt({
464
+ const rt = L, lt = Y;
465
+ function nt({
463
466
  className: t,
464
467
  defaultHeight: r = 0,
465
468
  listRef: l,
466
469
  onRowsRendered: s,
467
- overscanCount: e = 3,
468
- rowComponent: i,
469
- rowCount: n,
470
- rowHeight: c,
471
- rowProps: o,
472
- style: f,
473
- ...p
470
+ onScroll: e = D,
471
+ overscanCount: f = 3,
472
+ rowComponent: n,
473
+ rowCount: c,
474
+ rowHeight: o,
475
+ rowProps: u,
476
+ style: w,
477
+ ...I
474
478
  }) {
475
- const I = A(o), b = M(
476
- () => V(i, D),
477
- [i]
478
- ), [y, w] = $(null), {
479
- getCellBounds: d,
480
- getEstimatedHeight: x,
481
- onScroll: z,
482
- scrollToIndex: h,
483
- startIndex: a,
484
- stopIndex: u
479
+ const O = A(u), S = H(
480
+ () => V(n, _),
481
+ [n]
482
+ ), [m, d] = L(null), {
483
+ getCellBounds: b,
484
+ getEstimatedHeight: a,
485
+ onScroll: M,
486
+ scrollToIndex: g,
487
+ startIndex: i,
488
+ stopIndex: p
485
489
  } = G({
486
- containerElement: y,
490
+ containerElement: m,
487
491
  defaultContainerSize: r,
488
492
  direction: "vertical",
489
- itemCount: n,
490
- itemProps: I,
491
- itemSize: c,
492
- overscanCount: e
493
+ itemCount: c,
494
+ itemProps: O,
495
+ itemSize: o,
496
+ overscanCount: f
493
497
  });
494
- U(
498
+ F(
495
499
  l,
496
500
  () => ({
497
501
  get element() {
498
- return y;
502
+ return m;
499
503
  },
500
504
  scrollToRow({
501
- align: m = "auto",
502
- behavior: g = "auto",
503
- index: S
505
+ align: x = "auto",
506
+ behavior: h = "auto",
507
+ index: E
504
508
  }) {
505
- h({
506
- align: m,
507
- behavior: g,
508
- containerScrollOffset: y?.scrollTop ?? 0,
509
- index: S
509
+ g({
510
+ align: x,
511
+ behavior: h,
512
+ containerScrollOffset: m?.scrollTop ?? 0,
513
+ index: E
510
514
  });
511
515
  }
512
516
  }),
513
- [y, h]
514
- ), P(() => {
515
- a >= 0 && u >= 0 && s && s({
516
- startIndex: a,
517
- stopIndex: u
517
+ [m, g]
518
+ ), W(() => {
519
+ i >= 0 && p >= 0 && s && s({
520
+ startIndex: i,
521
+ stopIndex: p
518
522
  });
519
- }, [s, a, u]);
520
- const O = M(() => {
521
- const m = [];
522
- if (n > 0)
523
- for (let g = a; g <= u; g++) {
524
- const S = d(g);
525
- m.push(
526
- /* @__PURE__ */ F(
527
- b,
523
+ }, [s, i, p]);
524
+ const z = H(() => {
525
+ const x = [];
526
+ if (c > 0)
527
+ for (let h = i; h <= p; h++) {
528
+ const E = b(h);
529
+ x.push(
530
+ /* @__PURE__ */ N(
531
+ S,
528
532
  {
529
- ...I,
530
- key: g,
531
- index: g,
533
+ ...O,
534
+ key: h,
535
+ index: h,
532
536
  style: {
533
537
  position: "absolute",
534
538
  left: 0,
535
- transform: `translateY(${S.scrollOffset}px)`,
536
- height: S.size,
539
+ transform: `translateY(${E.scrollOffset}px)`,
540
+ height: E.size,
537
541
  width: "100%"
538
542
  }
539
543
  }
540
544
  )
541
545
  );
542
546
  }
543
- return m;
544
- }, [b, d, n, I, a, u]);
547
+ return x;
548
+ }, [S, b, c, O, i, p]);
545
549
  return /* @__PURE__ */ j(
546
550
  "div",
547
551
  {
548
552
  role: "list",
549
- ...p,
553
+ ...I,
550
554
  className: t,
551
- onScroll: z,
552
- ref: w,
555
+ onScroll: (x) => {
556
+ M(), e(x);
557
+ },
558
+ ref: d,
553
559
  style: {
554
- ...f,
560
+ ...w,
555
561
  maxHeight: "100%",
556
562
  flexGrow: 1,
557
563
  overflowY: "auto"
@@ -561,22 +567,22 @@ function rt({
561
567
  {
562
568
  className: t,
563
569
  style: {
564
- height: x(),
570
+ height: a(),
565
571
  position: "relative",
566
572
  width: "100%"
567
573
  },
568
- children: O
574
+ children: z
569
575
  }
570
576
  )
571
577
  }
572
578
  );
573
579
  }
574
- const lt = $, nt = Y;
580
+ const it = L, ct = Y;
575
581
  export {
576
- et as Grid,
577
- rt as List,
578
- st as useGridCallbackRef,
579
- ot as useGridRef,
580
- lt as useListCallbackRef,
581
- nt as useListRef
582
+ ot as Grid,
583
+ nt as List,
584
+ rt as useGridCallbackRef,
585
+ lt as useGridRef,
586
+ it as useListCallbackRef,
587
+ ct as useListRef
582
588
  };