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