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