react-window 2.0.0-alpha.1 → 2.0.0-alpha.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.
@@ -1,6 +1,7 @@
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";
3
- function B(t) {
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) {
4
5
  if (t !== void 0)
5
6
  switch (typeof t) {
6
7
  case "number":
@@ -12,63 +13,62 @@ 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: i,
23
+ style: n
24
24
  }) {
25
- const { styleHeight: f, styleWidth: o } = E(
25
+ const { styleHeight: c, styleWidth: o } = M(
26
26
  () => ({
27
- styleHeight: B(l?.height),
28
- styleWidth: B(l?.width)
27
+ styleHeight: W(n?.height),
28
+ styleWidth: W(n?.width)
29
29
  }),
30
- [l?.height, l?.width]
31
- ), [u, a] = P({
30
+ [n?.height, n?.width]
31
+ ), [f, p] = $({
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 || i === "only-height" && c !== void 0 || i === "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 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 : {
42
+ height: d.height,
43
+ width: d.width
44
44
  });
45
45
  }
46
46
  });
47
47
  return b.observe(e, { box: t }), () => {
48
48
  b?.unobserve(e);
49
49
  };
50
- }, [t, O, e, f, o]), E(
50
+ }, [t, I, e, c, o]), M(
51
51
  () => ({
52
- height: f ?? u.height,
53
- width: o ?? u.width
52
+ height: c ?? f.height,
53
+ width: o ?? f.width
54
54
  }),
55
- [u, f, o]
55
+ [f, c, o]
56
56
  );
57
57
  }
58
- function $(t, r = "Assertion error") {
58
+ function E(t, r = "Assertion error") {
59
59
  if (!t)
60
60
  throw console.error(r), Error(r);
61
61
  }
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
- $(s !== void 0, "Unexpected bounds cache miss");
71
+ E(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
@@ -77,91 +77,91 @@ 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: i
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 - i, o = Math.max(
86
86
  0,
87
- r.get(n + 1).scrollOffset - c
88
- ), u = Math.min(
89
- l,
90
- r.get(n).scrollOffset
87
+ r.get(l + 1).scrollOffset - i
88
+ ), f = Math.min(
89
+ n,
90
+ r.get(l).scrollOffset
91
91
  );
92
- switch (t === "smart" && (e >= o && e <= u ? t = "auto" : t = "center"), t) {
92
+ switch (t === "smart" && (e >= o && e <= f ? t = "auto" : t = "center"), t) {
93
93
  case "start":
94
- return Math.min(f, u);
94
+ return Math.min(c, f);
95
95
  case "end":
96
96
  return o;
97
97
  case "center": {
98
- const a = Math.round(
99
- o + (u - o) / 2
98
+ const p = Math.round(
99
+ o + (f - o) / 2
100
100
  );
101
- return a < Math.ceil(c / 2) ? 0 : a > f ? f : a;
101
+ return p < Math.ceil(i / 2) ? 0 : p > c ? c : p;
102
102
  }
103
103
  case "auto":
104
104
  default:
105
- return e >= o && e <= u ? e : e < o ? o : u;
105
+ return e >= o && e <= f ? e : e < o ? o : f;
106
106
  }
107
107
  }
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; ) {
118
- const u = t.get(o);
119
- if (u.scrollOffset + u.size > r)
115
+ const i = s - 1;
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)
120
120
  break;
121
121
  o++;
122
122
  }
123
- for (l = o, l = Math.max(0, l - e); o < c; ) {
124
- const u = t.get(o);
125
- if (u.scrollOffset + u.size >= r + n)
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)
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(i, o), c = Math.min(s - 1, c + e), n < 0 ? [0, -1] : [n, c];
130
130
  }
131
131
  function _({
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
- 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,
139
+ for (E(e < t, `Invalid index ${e}`); s.size - 1 < e; ) {
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);
148
- $(
147
+ const o = s.get(n - 1);
148
+ E(
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);
158
- return $(
159
- c !== void 0,
157
+ const i = s.get(e);
158
+ return E(
159
+ i !== void 0,
160
160
  `Unexpected bounds cache miss for index ${e}`
161
- ), c;
161
+ ), i;
162
162
  },
163
- set(e, c) {
164
- s.set(e, c);
163
+ set(e, i) {
164
+ s.set(e, i);
165
165
  },
166
166
  get size() {
167
167
  return s.size;
@@ -171,267 +171,271 @@ function _({
171
171
  function N({
172
172
  itemCount: t,
173
173
  itemProps: r,
174
- itemSize: n
174
+ itemSize: l
175
175
  }) {
176
- return E(
176
+ return M(
177
177
  () => _({
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: i,
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, f] = $([0, -1]), [p, I] = [
196
+ Math.min(e - 1, o[0]),
197
+ Math.min(e - 1, o[1])
198
+ ], { height: b = l, width: y = 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
+ }), w = s === "vertical" ? b : y, d = N({
202
205
  itemCount: e,
203
- itemProps: c,
204
- itemSize: l
205
- }), w = L(
206
- (i) => d.get(i),
206
+ itemProps: i,
207
+ itemSize: n
208
+ }), x = R(
209
+ (u) => d.get(u),
207
210
  [d]
208
- ), g = L(
211
+ ), z = R(
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(
216
- (i) => Z({
217
+ [d, e, n]
218
+ ), h = R(
219
+ (u) => Z({
217
220
  cachedBounds: d,
218
- containerScrollOffset: i,
219
- containerSize: m,
221
+ containerScrollOffset: u,
222
+ containerSize: w,
220
223
  itemCount: e,
221
- overscanCount: f
224
+ overscanCount: c
222
225
  }),
223
- [d, m, e, f]
226
+ [d, w, e, c]
224
227
  );
225
228
  q(() => {
226
- a(v(0));
227
- }, [v]);
228
- const p = L(
229
+ const u = (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0;
230
+ f(h(u));
231
+ }, [t, s, h]);
232
+ const a = R(
229
233
  ({
230
- align: i = "auto",
231
- behavior: x = "auto",
232
- containerScrollOffset: z,
233
- index: I
234
+ align: u = "auto",
235
+ behavior: O = "auto",
236
+ containerScrollOffset: m,
237
+ index: g
234
238
  }) => {
235
- const h = X({
236
- align: i,
239
+ const S = X({
240
+ align: u,
237
241
  cachedBounds: d,
238
- containerScrollOffset: z,
239
- containerSize: m,
240
- index: I,
242
+ containerScrollOffset: m,
243
+ containerSize: w,
244
+ index: g,
241
245
  itemCount: e
242
246
  });
243
247
  s === "horizontal" ? t?.scrollTo({
244
- left: h,
245
- behavior: x || void 0
248
+ left: S,
249
+ behavior: O || void 0
246
250
  }) : t?.scrollTo({
247
- behavior: x || void 0,
248
- top: h
251
+ behavior: O || void 0,
252
+ top: S
249
253
  });
250
254
  },
251
- [d, t, m, s, e]
255
+ [d, t, w, s, e]
252
256
  );
253
257
  return {
254
- getCellBounds: w,
255
- getEstimatedHeight: g,
258
+ getCellBounds: x,
259
+ getEstimatedHeight: z,
256
260
  onScroll: () => {
257
- const i = v(
261
+ const u = h(
258
262
  (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0
259
263
  );
260
- (i[0] !== o || i[1] !== u) && a(i);
264
+ (u[0] !== p || u[1] !== I) && f(u);
261
265
  },
262
- scrollToIndex: p,
263
- startIndex: o,
264
- stopIndex: u
266
+ scrollToIndex: a,
267
+ startIndex: p,
268
+ stopIndex: I
265
269
  };
266
270
  }
267
271
  function A(t) {
268
- return E(() => t, Object.values(t));
272
+ return M(() => t, Object.values(t));
269
273
  }
270
- function G(t, r) {
274
+ function B(t, r) {
271
275
  if (t === r)
272
276
  return !0;
273
- if (!!t != !!r || ($(t !== void 0), $(r !== void 0), Object.keys(t).length !== Object.keys(r).length))
277
+ if (!!t != !!r || (E(t !== void 0), E(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
284
  function D(t, r) {
281
- const { style: n, ...s } = t, { style: e, ...c } = r;
282
- return G(n, e) && G(s, c);
285
+ const { style: l, ...s } = t, { style: e, ...i } = r;
286
+ return B(l, e) && B(s, i);
283
287
  }
284
288
  function et({
285
289
  cellComponent: t,
286
290
  cellProps: r,
287
- className: n,
291
+ className: l,
288
292
  columnCount: s,
289
293
  columnWidth: e,
290
- defaultHeight: c = 0,
291
- defaultWidth: l = 0,
292
- gridRef: f,
294
+ defaultHeight: i = 0,
295
+ defaultWidth: n = 0,
296
+ gridRef: c,
293
297
  onCellsRendered: o,
294
- overscanCount: u = 3,
295
- rowCount: a,
296
- rowHeight: O,
298
+ overscanCount: f = 3,
299
+ rowCount: p,
300
+ rowHeight: I,
297
301
  style: b,
298
- ...m
302
+ ...y
299
303
  }) {
300
- const d = A(r), w = E(
304
+ const w = A(r), d = M(
301
305
  () => V(t, D),
302
306
  [t]
303
- ), [g, v] = P(null), p = R({
304
- containerElement: g,
305
- defaultContainerSize: l,
307
+ ), [x, z] = $(null), h = G({
308
+ containerElement: x,
309
+ defaultContainerSize: n,
306
310
  direction: "horizontal",
307
311
  itemCount: s,
308
- itemProps: d,
312
+ itemProps: w,
309
313
  itemSize: e,
310
- overscanCount: u
311
- }), i = R({
312
- containerElement: g,
313
- defaultContainerSize: c,
314
+ overscanCount: f
315
+ }), a = G({
316
+ containerElement: x,
317
+ defaultContainerSize: i,
314
318
  direction: "vertical",
315
- itemCount: a,
316
- itemProps: d,
317
- itemSize: O,
318
- overscanCount: u
319
- }), { startIndex: x, stopIndex: z } = p, { startIndex: I, stopIndex: h } = i;
319
+ itemCount: p,
320
+ itemProps: w,
321
+ itemSize: I,
322
+ overscanCount: f
323
+ }), { startIndex: u, stopIndex: O } = h, { startIndex: m, stopIndex: g } = a;
320
324
  U(
321
- f,
325
+ c,
322
326
  () => ({
323
327
  get element() {
324
- return g;
328
+ return x;
325
329
  },
326
330
  scrollToCell({
327
- behavior: S = "auto",
328
- columnAlign: y = "auto",
329
- columnIndex: T,
330
- rowAlign: H = "auto",
331
- rowIndex: k
331
+ behavior: T = "auto",
332
+ columnAlign: v = "auto",
333
+ columnIndex: H,
334
+ rowAlign: k = "auto",
335
+ rowIndex: L
332
336
  }) {
333
- i?.scrollToIndex({
334
- align: H,
335
- behavior: S,
336
- containerScrollOffset: g?.scrollTop ?? 0,
337
- index: k
338
- }), p?.scrollToIndex({
339
- align: y,
340
- behavior: S,
341
- containerScrollOffset: g?.scrollLeft ?? 0,
342
- index: T
337
+ a?.scrollToIndex({
338
+ 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
343
347
  });
344
348
  },
345
349
  scrollToColumn({
346
- align: S = "auto",
347
- behavior: y = "auto",
348
- index: T
350
+ align: T = "auto",
351
+ behavior: v = "auto",
352
+ index: H
349
353
  }) {
350
- p?.scrollToIndex({
351
- align: S,
352
- behavior: y,
353
- containerScrollOffset: g?.scrollLeft ?? 0,
354
- index: T
354
+ h?.scrollToIndex({
355
+ align: T,
356
+ behavior: v,
357
+ containerScrollOffset: x?.scrollLeft ?? 0,
358
+ index: H
355
359
  });
356
360
  },
357
361
  scrollToRow({
358
- align: S = "auto",
359
- behavior: y = "auto",
360
- index: T
362
+ align: T = "auto",
363
+ behavior: v = "auto",
364
+ index: H
361
365
  }) {
362
- i?.scrollToIndex({
363
- align: S,
364
- behavior: y,
365
- containerScrollOffset: g?.scrollTop ?? 0,
366
- index: T
366
+ a?.scrollToIndex({
367
+ align: T,
368
+ behavior: v,
369
+ containerScrollOffset: x?.scrollTop ?? 0,
370
+ index: H
367
371
  });
368
372
  }
369
373
  }),
370
- [p, g, i]
371
- ), W(() => {
372
- x >= 0 && z >= 0 && I >= 0 && h >= 0 && o && o({
373
- columnStartIndex: x,
374
- columnStopIndex: z,
375
- rowStartIndex: I,
376
- rowStopIndex: h
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
381
  });
378
382
  }, [
379
383
  o,
380
- x,
381
- z,
382
- I,
383
- h
384
+ u,
385
+ O,
386
+ m,
387
+ g
384
388
  ]);
385
- const M = E(() => {
386
- const S = [];
387
- if (p && s > 0 && i && a > 0)
388
- for (let y = I; y <= h; y++) {
389
- const T = i.getCellBounds(y);
390
- for (let H = x; H <= z; H++) {
391
- const k = p.getCellBounds(H);
392
- S.push(
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(
393
397
  /* @__PURE__ */ F(
394
- w,
398
+ d,
395
399
  {
396
- ...d,
397
- columnIndex: H,
398
- key: `${y}-${H}`,
399
- rowIndex: y,
400
+ ...w,
401
+ columnIndex: k,
402
+ key: `${v}-${k}`,
403
+ rowIndex: v,
400
404
  style: {
401
405
  position: "absolute",
402
406
  left: 0,
403
- transform: `translate(${k.scrollOffset}px, ${T.scrollOffset}px)`,
404
- height: T.size,
405
- width: k.size
407
+ transform: `translate(${L.scrollOffset}px, ${H.scrollOffset}px)`,
408
+ height: H.size,
409
+ width: L.size
406
410
  }
407
411
  }
408
412
  )
409
413
  );
410
414
  }
411
415
  }
412
- return S;
416
+ return T;
413
417
  }, [
414
- w,
415
418
  d,
419
+ w,
416
420
  s,
417
- x,
418
- z,
419
- p,
420
- a,
421
- I,
421
+ u,
422
+ O,
422
423
  h,
423
- i
424
+ p,
425
+ m,
426
+ g,
427
+ a
424
428
  ]);
425
429
  return /* @__PURE__ */ j(
426
430
  "div",
427
431
  {
428
432
  role: "grid",
429
- ...m,
430
- className: n,
433
+ ...y,
434
+ className: l,
431
435
  onScroll: () => {
432
- p.onScroll(), i.onScroll();
436
+ h.onScroll(), a.onScroll();
433
437
  },
434
- ref: v,
438
+ ref: z,
435
439
  style: {
436
440
  ...b,
437
441
  maxHeight: "100%",
@@ -442,112 +446,112 @@ function et({
442
446
  children: /* @__PURE__ */ j(
443
447
  "div",
444
448
  {
445
- className: n,
449
+ className: l,
446
450
  style: {
447
451
  position: "relative",
448
- height: i?.getEstimatedHeight(),
449
- width: p?.getEstimatedHeight()
452
+ height: a?.getEstimatedHeight(),
453
+ width: h?.getEstimatedHeight()
450
454
  },
451
- children: M
455
+ children: S
452
456
  }
453
457
  )
454
458
  }
455
459
  );
456
460
  }
457
- const st = Y;
458
- function ot({
461
+ const st = $, ot = Y;
462
+ function rt({
459
463
  className: t,
460
464
  defaultHeight: r = 0,
461
- listRef: n,
465
+ listRef: l,
462
466
  onRowsRendered: s,
463
467
  overscanCount: e = 3,
464
- rowComponent: c,
465
- rowCount: l,
466
- rowHeight: f,
468
+ rowComponent: i,
469
+ rowCount: n,
470
+ rowHeight: c,
467
471
  rowProps: o,
468
- style: u,
469
- ...a
472
+ style: f,
473
+ ...p
470
474
  }) {
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
- startIndex: i,
480
- stopIndex: x
481
- } = R({
482
- containerElement: m,
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
485
+ } = G({
486
+ containerElement: y,
483
487
  defaultContainerSize: r,
484
488
  direction: "vertical",
485
- itemCount: l,
486
- itemProps: O,
487
- itemSize: f,
489
+ itemCount: n,
490
+ itemProps: I,
491
+ itemSize: c,
488
492
  overscanCount: e
489
493
  });
490
494
  U(
491
- n,
495
+ l,
492
496
  () => ({
493
497
  get element() {
494
- return m;
498
+ return y;
495
499
  },
496
500
  scrollToRow({
497
- align: I = "auto",
498
- behavior: h = "auto",
499
- index: M
501
+ align: m = "auto",
502
+ behavior: g = "auto",
503
+ index: S
500
504
  }) {
501
- p({
502
- align: I,
503
- behavior: h,
504
- containerScrollOffset: m?.scrollTop ?? 0,
505
- index: M
505
+ h({
506
+ align: m,
507
+ behavior: g,
508
+ containerScrollOffset: y?.scrollTop ?? 0,
509
+ index: S
506
510
  });
507
511
  }
508
512
  }),
509
- [m, p]
510
- ), W(() => {
511
- i >= 0 && x >= 0 && s && s({
512
- startIndex: i,
513
- stopIndex: x
513
+ [y, h]
514
+ ), P(() => {
515
+ a >= 0 && u >= 0 && s && s({
516
+ startIndex: a,
517
+ stopIndex: u
514
518
  });
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(
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(
522
526
  /* @__PURE__ */ F(
523
527
  b,
524
528
  {
525
- ...O,
526
- key: h,
527
- index: h,
529
+ ...I,
530
+ key: g,
531
+ index: g,
528
532
  style: {
529
533
  position: "absolute",
530
534
  left: 0,
531
- transform: `translateY(${M.scrollOffset}px)`,
532
- height: M.size,
535
+ transform: `translateY(${S.scrollOffset}px)`,
536
+ height: S.size,
533
537
  width: "100%"
534
538
  }
535
539
  }
536
540
  )
537
541
  );
538
542
  }
539
- return I;
540
- }, [b, w, l, O, i, x]);
543
+ return m;
544
+ }, [b, d, n, I, a, u]);
541
545
  return /* @__PURE__ */ j(
542
546
  "div",
543
547
  {
544
548
  role: "list",
545
- ...a,
549
+ ...p,
546
550
  className: t,
547
- onScroll: v,
548
- ref: d,
551
+ onScroll: z,
552
+ ref: w,
549
553
  style: {
550
- ...u,
554
+ ...f,
551
555
  maxHeight: "100%",
552
556
  flexGrow: 1,
553
557
  overflowY: "auto"
@@ -557,20 +561,22 @@ function ot({
557
561
  {
558
562
  className: t,
559
563
  style: {
560
- height: g(),
564
+ height: x(),
561
565
  position: "relative",
562
566
  width: "100%"
563
567
  },
564
- children: z
568
+ children: O
565
569
  }
566
570
  )
567
571
  }
568
572
  );
569
573
  }
570
- const rt = Y;
574
+ const lt = $, nt = Y;
571
575
  export {
572
576
  et as Grid,
573
- ot as List,
574
- st as useGridRef,
575
- rt as useListRef
577
+ rt as List,
578
+ st as useGridCallbackRef,
579
+ ot as useGridRef,
580
+ lt as useListCallbackRef,
581
+ nt as useListRef
576
582
  };