react-window 2.0.0-alpha.4 → 2.0.0-alpha.5

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