react-window 2.0.0 → 2.0.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.
Files changed (69) hide show
  1. package/README.md +29 -3
  2. package/dist/react-window.cjs +1 -1
  3. package/dist/react-window.cjs.map +1 -1
  4. package/dist/react-window.js +322 -319
  5. package/dist/react-window.js.map +1 -1
  6. package/docs/assets/CellComponent.example-B6rd3A81.js +2 -0
  7. package/docs/assets/CellComponent.example-B6rd3A81.js.map +1 -0
  8. package/docs/assets/ComponentProps-DjtQqosW.js +2 -0
  9. package/docs/assets/ComponentProps-DjtQqosW.js.map +1 -0
  10. package/docs/assets/ContinueLink-BgDdBmAq.js +2 -0
  11. package/docs/assets/ContinueLink-BgDdBmAq.js.map +1 -0
  12. package/docs/assets/FixedRowHeightsRoute-D2uTbdlK.js +2 -0
  13. package/docs/assets/FixedRowHeightsRoute-D2uTbdlK.js.map +1 -0
  14. package/docs/assets/FormattedCode-Bgu5KYpx.js +2 -0
  15. package/docs/assets/FormattedCode-Bgu5KYpx.js.map +1 -0
  16. package/docs/assets/FormattedCode-nwWF-WcI.css +1 -0
  17. package/docs/assets/GettingStartedRoute-DFMvu5xc.js +2 -0
  18. package/docs/assets/GettingStartedRoute-DFMvu5xc.js.map +1 -0
  19. package/docs/assets/Grid-BmNZGHKY.js +2 -0
  20. package/docs/assets/Grid-BmNZGHKY.js.map +1 -0
  21. package/docs/assets/Header-D5XYa_k5.js +2 -0
  22. package/docs/assets/Header-D5XYa_k5.js.map +1 -0
  23. package/docs/assets/HorizontalListsRoute-BshOgFUz.js +2 -0
  24. package/docs/assets/HorizontalListsRoute-BshOgFUz.js.map +1 -0
  25. package/docs/assets/ImperativeApiRoute-BAWsk-vD.js +2 -0
  26. package/docs/assets/ImperativeApiRoute-BAWsk-vD.js.map +1 -0
  27. package/docs/assets/ImperativeApiRoute-DQIcyOMg.js +2 -0
  28. package/docs/assets/ImperativeApiRoute-DQIcyOMg.js.map +1 -0
  29. package/docs/assets/List-C7ANWJ5i.js +2 -0
  30. package/docs/assets/List-C7ANWJ5i.js.map +1 -0
  31. package/docs/assets/LoadingSpinner-C5G0kF8B.js +2 -0
  32. package/docs/assets/LoadingSpinner-C5G0kF8B.js.map +1 -0
  33. package/docs/assets/PageNotFound-CmFn1Y8A.js +2 -0
  34. package/docs/assets/PageNotFound-CmFn1Y8A.js.map +1 -0
  35. package/docs/assets/PlatformRequirementsRoute-DrlH5Zzd.js +2 -0
  36. package/docs/assets/PlatformRequirementsRoute-DrlH5Zzd.js.map +1 -0
  37. package/docs/assets/PropsRoute-Du5tQlP4.js +2 -0
  38. package/docs/assets/PropsRoute-Du5tQlP4.js.map +1 -0
  39. package/docs/assets/PropsRoute-Y6h__YZK.js +2 -0
  40. package/docs/assets/PropsRoute-Y6h__YZK.js.map +1 -0
  41. package/docs/assets/RTLGridsRoute-Bh6j-Do_.js +2 -0
  42. package/docs/assets/RTLGridsRoute-Bh6j-Do_.js.map +1 -0
  43. package/docs/assets/RenderingGridRoute-BiAH8mBy.js +2 -0
  44. package/docs/assets/RenderingGridRoute-BiAH8mBy.js.map +1 -0
  45. package/docs/assets/ScratchpadRoute-NKLpLi0x.js +2 -0
  46. package/docs/assets/ScratchpadRoute-NKLpLi0x.js.map +1 -0
  47. package/docs/assets/Select-DYzOjrIR.js +2 -0
  48. package/docs/assets/Select-DYzOjrIR.js.map +1 -0
  49. package/docs/assets/SupportRoute-B3HtlCgf.js +2 -0
  50. package/docs/assets/SupportRoute-B3HtlCgf.js.map +1 -0
  51. package/docs/assets/TabularDataRoute-Dw2CznU_.js +2 -0
  52. package/docs/assets/TabularDataRoute-Dw2CznU_.js.map +1 -0
  53. package/docs/assets/VariableRowHeightsRoute-BtjBfaPU.js +2 -0
  54. package/docs/assets/VariableRowHeightsRoute-BtjBfaPU.js.map +1 -0
  55. package/docs/assets/arePropsEqual-J86giKVT.js +2 -0
  56. package/docs/assets/arePropsEqual-J86giKVT.js.map +1 -0
  57. package/docs/assets/index-6dOV2kLd.js +3 -0
  58. package/docs/assets/index-6dOV2kLd.js.map +1 -0
  59. package/docs/assets/index-CQLn-JKf.css +1 -0
  60. package/docs/assets/useCitiesByState-aLkpFxPh.js +2 -0
  61. package/docs/assets/useCitiesByState-aLkpFxPh.js.map +1 -0
  62. package/docs/assets/useContacts-QMK0xyhD.js +2 -0
  63. package/docs/assets/useContacts-QMK0xyhD.js.map +1 -0
  64. package/docs/index.html +9 -3
  65. package/docs/robots.txt +2 -0
  66. package/docs/stats.html +1 -1
  67. package/package.json +4 -1
  68. package/docs/assets/index-AW1og9rz.css +0 -1
  69. package/docs/assets/index-LE94V_KA.js +0 -68
@@ -1,5 +1,5 @@
1
1
  import { jsx as D } from "react/jsx-runtime";
2
- import { useState as E, useLayoutEffect as J, useEffect as K, useMemo as W, useRef as q, useCallback as V, memo as _, useImperativeHandle as N, createElement as ee } from "react";
2
+ import { useState as B, useLayoutEffect as J, useEffect as K, useMemo as W, useRef as q, useCallback as V, memo as _, useImperativeHandle as N, createElement as ee } from "react";
3
3
  function ie(e) {
4
4
  let t = e;
5
5
  for (; t; ) {
@@ -9,10 +9,10 @@ function ie(e) {
9
9
  }
10
10
  return !1;
11
11
  }
12
- function le(e, t) {
13
- const [s, r] = E(t === "rtl");
12
+ function ce(e, t) {
13
+ const [s, o] = B(t === "rtl");
14
14
  return J(() => {
15
- e && (t || r(ie(e)));
15
+ e && (t || o(ie(e)));
16
16
  }, [t, e]), s;
17
17
  }
18
18
  const Y = typeof window < "u" ? J : K;
@@ -28,41 +28,41 @@ function Q(e) {
28
28
  }
29
29
  }
30
30
  }
31
- function ne({
31
+ function fe({
32
32
  box: e,
33
33
  defaultHeight: t,
34
34
  defaultWidth: s,
35
- disabled: r,
36
- element: o,
37
- mode: i,
38
- style: n
35
+ disabled: o,
36
+ element: r,
37
+ mode: n,
38
+ style: i
39
39
  }) {
40
40
  const { styleHeight: c, styleWidth: l } = W(
41
41
  () => ({
42
- styleHeight: Q(n?.height),
43
- styleWidth: Q(n?.width)
42
+ styleHeight: Q(i?.height),
43
+ styleWidth: Q(i?.width)
44
44
  }),
45
- [n?.height, n?.width]
46
- ), [f, a] = E({
45
+ [i?.height, i?.width]
46
+ ), [f, p] = B({
47
47
  height: t,
48
48
  width: s
49
- }), I = r || i === "only-height" && c !== void 0 || i === "only-width" && l !== void 0 || c !== void 0 && l !== void 0;
49
+ }), b = o || n === "only-height" && c !== void 0 || n === "only-width" && l !== void 0 || c !== void 0 && l !== void 0;
50
50
  return Y(() => {
51
- if (o === null || I)
51
+ if (r === null || b)
52
52
  return;
53
- const v = new ResizeObserver((k) => {
54
- for (const x of k) {
55
- const { contentRect: w, target: z } = x;
56
- o === z && a((g) => g.height === w.height && g.width === w.width ? g : {
57
- height: w.height,
58
- width: w.width
53
+ const w = new ResizeObserver((k) => {
54
+ for (const a of k) {
55
+ const { contentRect: m, target: I } = a;
56
+ r === I && p((g) => g.height === m.height && g.width === m.width ? g : {
57
+ height: m.height,
58
+ width: m.width
59
59
  });
60
60
  }
61
61
  });
62
- return v.observe(o, { box: e }), () => {
63
- v?.unobserve(o);
62
+ return w.observe(r, { box: e }), () => {
63
+ w?.unobserve(r);
64
64
  };
65
- }, [e, I, o, c, l]), W(
65
+ }, [e, b, r, c, l]), W(
66
66
  () => ({
67
67
  height: c ?? f.height,
68
68
  width: l ?? f.width
@@ -70,7 +70,7 @@ function ne({
70
70
  [f, c, l]
71
71
  );
72
72
  }
73
- function ce(e) {
73
+ function ue(e) {
74
74
  const t = q(() => {
75
75
  throw new Error("Cannot call an event handler while rendering.");
76
76
  });
@@ -78,35 +78,35 @@ function ce(e) {
78
78
  t.current = e;
79
79
  }, [e]), V((s) => t.current?.(s), [t]);
80
80
  }
81
- let j = null;
82
- function fe(e = !1) {
83
- if (j === null || e) {
81
+ let G = null;
82
+ function de(e = !1) {
83
+ if (G === null || e) {
84
84
  const t = document.createElement("div"), s = t.style;
85
85
  s.width = "50px", s.height = "50px", s.overflow = "scroll", s.direction = "rtl";
86
- const r = document.createElement("div"), o = r.style;
87
- return o.width = "100px", o.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? j = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? j = "negative" : j = "positive-ascending"), document.body.removeChild(t), j;
86
+ const o = document.createElement("div"), r = o.style;
87
+ return r.width = "100px", r.height = "100px", t.appendChild(o), document.body.appendChild(t), t.scrollLeft > 0 ? G = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? G = "negative" : G = "positive-ascending"), document.body.removeChild(t), G;
88
88
  }
89
- return j;
89
+ return G;
90
90
  }
91
91
  function A({
92
92
  containerElement: e,
93
93
  direction: t,
94
94
  isRtl: s,
95
- scrollOffset: r
95
+ scrollOffset: o
96
96
  }) {
97
97
  if (t === "horizontal" && s)
98
- switch (fe()) {
98
+ switch (de()) {
99
99
  case "negative":
100
- return -r;
100
+ return -o;
101
101
  case "positive-descending": {
102
102
  if (e) {
103
- const { clientWidth: o, scrollLeft: i, scrollWidth: n } = e;
104
- return n - o - i;
103
+ const { clientWidth: r, scrollLeft: n, scrollWidth: i } = e;
104
+ return i - r - n;
105
105
  }
106
106
  break;
107
107
  }
108
108
  }
109
- return r;
109
+ return o;
110
110
  }
111
111
  function R(e, t = "Assertion error") {
112
112
  if (!e)
@@ -122,83 +122,83 @@ function te({
122
122
  if (typeof s == "number")
123
123
  return t * s;
124
124
  {
125
- const r = e.get(
125
+ const o = e.get(
126
126
  e.size === 0 ? 0 : e.size - 1
127
127
  );
128
- R(r !== void 0, "Unexpected bounds cache miss");
129
- const o = (r.scrollOffset + r.size) / e.size;
130
- return t * o;
128
+ R(o !== void 0, "Unexpected bounds cache miss");
129
+ const r = (o.scrollOffset + o.size) / e.size;
130
+ return t * r;
131
131
  }
132
132
  }
133
- function de({
133
+ function he({
134
134
  align: e,
135
135
  cachedBounds: t,
136
136
  index: s,
137
- itemCount: r,
138
- itemSize: o,
139
- containerScrollOffset: i,
140
- containerSize: n
137
+ itemCount: o,
138
+ itemSize: r,
139
+ containerScrollOffset: n,
140
+ containerSize: i
141
141
  }) {
142
142
  const c = te({
143
143
  cachedBounds: t,
144
- itemCount: r,
145
- itemSize: o
144
+ itemCount: o,
145
+ itemSize: r
146
146
  }), l = t.get(s), f = Math.max(
147
147
  0,
148
- Math.min(c - n, l.scrollOffset)
149
- ), a = Math.max(
148
+ Math.min(c - i, l.scrollOffset)
149
+ ), p = Math.max(
150
150
  0,
151
- l.scrollOffset - n + l.size
151
+ l.scrollOffset - i + l.size
152
152
  );
153
- switch (e === "smart" && (i >= a && i <= f ? e = "auto" : e = "center"), e) {
153
+ switch (e === "smart" && (n >= p && n <= f ? e = "auto" : e = "center"), e) {
154
154
  case "start":
155
155
  return f;
156
156
  case "end":
157
- return a;
157
+ return p;
158
158
  case "center":
159
- return l.scrollOffset <= n / 2 ? 0 : l.scrollOffset + l.size / 2 >= c - n / 2 ? c - n : l.scrollOffset + l.size / 2 - n / 2;
159
+ return l.scrollOffset <= i / 2 ? 0 : l.scrollOffset + l.size / 2 >= c - i / 2 ? c - i : l.scrollOffset + l.size / 2 - i / 2;
160
160
  case "auto":
161
161
  default:
162
- return i >= a && i <= f ? i : i < a ? a : f;
162
+ return n >= p && n <= f ? n : n < p ? p : f;
163
163
  }
164
164
  }
165
165
  function X({
166
166
  cachedBounds: e,
167
167
  containerScrollOffset: t,
168
168
  containerSize: s,
169
- itemCount: r,
170
- overscanCount: o
169
+ itemCount: o,
170
+ overscanCount: r
171
171
  }) {
172
- const i = r - 1;
173
- let n = 0, c = -1, l = 0;
174
- for (; l < i; ) {
172
+ const n = o - 1;
173
+ let i = 0, c = -1, l = 0;
174
+ for (; l < n; ) {
175
175
  const f = e.get(l);
176
176
  if (f.scrollOffset + f.size > t)
177
177
  break;
178
178
  l++;
179
179
  }
180
- for (n = l, n = Math.max(0, n - o); l < i; ) {
180
+ for (i = l, i = Math.max(0, i - r); l < n; ) {
181
181
  const f = e.get(l);
182
182
  if (f.scrollOffset + f.size >= t + s)
183
183
  break;
184
184
  l++;
185
185
  }
186
- return c = Math.min(i, l), c = Math.min(r - 1, c + o), n < 0 ? [0, -1] : [n, c];
186
+ return c = Math.min(n, l), c = Math.min(o - 1, c + r), i < 0 ? [0, -1] : [i, c];
187
187
  }
188
- function ue({
188
+ function ae({
189
189
  itemCount: e,
190
190
  itemProps: t,
191
191
  itemSize: s
192
192
  }) {
193
- const r = /* @__PURE__ */ new Map();
193
+ const o = /* @__PURE__ */ new Map();
194
194
  return {
195
- get(o) {
196
- for (R(o < e, `Invalid index ${o}`); r.size - 1 < o; ) {
197
- const n = r.size;
195
+ get(r) {
196
+ for (R(r < e, `Invalid index ${r}`); o.size - 1 < r; ) {
197
+ const i = o.size;
198
198
  let c;
199
199
  switch (typeof s) {
200
200
  case "function": {
201
- c = s(n, t);
201
+ c = s(i, t);
202
202
  break;
203
203
  }
204
204
  case "number": {
@@ -206,43 +206,43 @@ function ue({
206
206
  break;
207
207
  }
208
208
  }
209
- if (n === 0)
210
- r.set(n, {
209
+ if (i === 0)
210
+ o.set(i, {
211
211
  size: c,
212
212
  scrollOffset: 0
213
213
  });
214
214
  else {
215
- const l = r.get(n - 1);
215
+ const l = o.get(i - 1);
216
216
  R(
217
217
  l !== void 0,
218
- `Unexpected bounds cache miss for index ${o}`
219
- ), r.set(n, {
218
+ `Unexpected bounds cache miss for index ${r}`
219
+ ), o.set(i, {
220
220
  scrollOffset: l.scrollOffset + l.size,
221
221
  size: c
222
222
  });
223
223
  }
224
224
  }
225
- const i = r.get(o);
225
+ const n = o.get(r);
226
226
  return R(
227
- i !== void 0,
228
- `Unexpected bounds cache miss for index ${o}`
229
- ), i;
227
+ n !== void 0,
228
+ `Unexpected bounds cache miss for index ${r}`
229
+ ), n;
230
230
  },
231
- set(o, i) {
232
- r.set(o, i);
231
+ set(r, n) {
232
+ o.set(r, n);
233
233
  },
234
234
  get size() {
235
- return r.size;
235
+ return o.size;
236
236
  }
237
237
  };
238
238
  }
239
- function he({
239
+ function pe({
240
240
  itemCount: e,
241
241
  itemProps: t,
242
242
  itemSize: s
243
243
  }) {
244
244
  return W(
245
- () => ue({
245
+ () => ae({
246
246
  itemCount: e,
247
247
  itemProps: t,
248
248
  itemSize: s
@@ -250,7 +250,7 @@ function he({
250
250
  [e, t, s]
251
251
  );
252
252
  }
253
- function ae({
253
+ function ge({
254
254
  containerSize: e,
255
255
  itemSize: t
256
256
  }) {
@@ -277,60 +277,60 @@ function C({
277
277
  containerElement: e,
278
278
  containerStyle: t,
279
279
  defaultContainerSize: s = 0,
280
- direction: r,
281
- isRtl: o = !1,
282
- itemCount: i,
283
- itemProps: n,
280
+ direction: o,
281
+ isRtl: r = !1,
282
+ itemCount: n,
283
+ itemProps: i,
284
284
  itemSize: c,
285
285
  onResize: l,
286
286
  overscanCount: f
287
287
  }) {
288
- const [a, I] = E([0, -1]), [v, k] = [
289
- Math.min(i - 1, a[0]),
290
- Math.min(i - 1, a[1])
291
- ], { height: x = s, width: w = s } = ne({
292
- defaultHeight: r === "vertical" ? s : void 0,
293
- defaultWidth: r === "horizontal" ? s : void 0,
288
+ const [p, b] = B([0, -1]), [w, k] = [
289
+ Math.min(n - 1, p[0]),
290
+ Math.min(n - 1, p[1])
291
+ ], { height: a = s, width: m = s } = fe({
292
+ defaultHeight: o === "vertical" ? s : void 0,
293
+ defaultWidth: o === "horizontal" ? s : void 0,
294
294
  element: e,
295
- mode: r === "vertical" ? "only-height" : "only-width",
295
+ mode: o === "vertical" ? "only-height" : "only-width",
296
296
  style: t
297
- }), z = q({
297
+ }), I = q({
298
298
  height: 0,
299
299
  width: 0
300
- }), g = r === "vertical" ? x : w, u = ae({ containerSize: g, itemSize: c });
300
+ }), g = o === "vertical" ? a : m, d = ge({ containerSize: g, itemSize: c });
301
301
  J(() => {
302
302
  if (typeof l == "function") {
303
- const d = z.current;
304
- (d.height !== x || d.width !== w) && (l({ height: x, width: w }, { ...d }), d.height = x, d.width = w);
303
+ const u = I.current;
304
+ (u.height !== a || u.width !== m) && (l({ height: a, width: m }, { ...u }), u.height = a, u.width = m);
305
305
  }
306
- }, [x, l, w]);
307
- const h = he({
308
- itemCount: i,
309
- itemProps: n,
310
- itemSize: u
306
+ }, [a, l, m]);
307
+ const h = pe({
308
+ itemCount: n,
309
+ itemProps: i,
310
+ itemSize: d
311
311
  }), y = V(
312
- (d) => h.get(d),
312
+ (u) => h.get(u),
313
313
  [h]
314
- ), B = V(
314
+ ), H = V(
315
315
  () => te({
316
316
  cachedBounds: h,
317
- itemCount: i,
318
- itemSize: u
317
+ itemCount: n,
318
+ itemSize: d
319
319
  }),
320
- [h, i, u]
321
- ), T = V(
322
- (d) => {
323
- const m = A({
320
+ [h, n, d]
321
+ ), S = V(
322
+ (u) => {
323
+ const v = A({
324
324
  containerElement: e,
325
- direction: r,
326
- isRtl: o,
327
- scrollOffset: d
325
+ direction: o,
326
+ isRtl: r,
327
+ scrollOffset: u
328
328
  });
329
329
  return X({
330
330
  cachedBounds: h,
331
- containerScrollOffset: m,
331
+ containerScrollOffset: v,
332
332
  containerSize: g,
333
- itemCount: i,
333
+ itemCount: n,
334
334
  overscanCount: f
335
335
  });
336
336
  },
@@ -338,87 +338,80 @@ function C({
338
338
  h,
339
339
  e,
340
340
  g,
341
- r,
342
341
  o,
343
- i,
342
+ r,
343
+ n,
344
344
  f
345
345
  ]
346
346
  );
347
347
  Y(() => {
348
- const d = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
349
- I(T(d));
350
- }, [e, r, T]), Y(() => {
348
+ const u = (o === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
349
+ b(S(u));
350
+ }, [e, o, S]), Y(() => {
351
351
  if (!e)
352
352
  return;
353
- const d = () => {
354
- I((m) => {
355
- const { scrollLeft: H, scrollTop: G } = e, b = A({
353
+ const u = () => {
354
+ b((v) => {
355
+ const { scrollLeft: j, scrollTop: L } = e, z = A({
356
356
  containerElement: e,
357
- direction: r,
358
- isRtl: o,
359
- scrollOffset: r === "vertical" ? G : H
360
- }), O = X({
357
+ direction: o,
358
+ isRtl: r,
359
+ scrollOffset: o === "vertical" ? L : j
360
+ }), $ = X({
361
361
  cachedBounds: h,
362
- containerScrollOffset: b,
362
+ containerScrollOffset: z,
363
363
  containerSize: g,
364
- itemCount: i,
364
+ itemCount: n,
365
365
  overscanCount: f
366
366
  });
367
- return O[0] === m[0] && O[1] === m[1] ? m : O;
367
+ return $[0] === v[0] && $[1] === v[1] ? v : $;
368
368
  });
369
369
  };
370
- return e.addEventListener("scroll", d), () => {
371
- e.removeEventListener("scroll", d);
370
+ return e.addEventListener("scroll", u), () => {
371
+ e.removeEventListener("scroll", u);
372
372
  };
373
373
  }, [
374
374
  h,
375
375
  e,
376
376
  g,
377
- r,
378
- i,
377
+ o,
378
+ n,
379
379
  f
380
380
  ]);
381
- const p = ce(
381
+ const x = ue(
382
382
  ({
383
- align: d = "auto",
384
- behavior: m = "auto",
385
- containerScrollOffset: H,
386
- index: G
383
+ align: u = "auto",
384
+ containerScrollOffset: v,
385
+ index: j
387
386
  }) => {
388
- let b = de({
389
- align: d,
387
+ let L = he({
388
+ align: u,
390
389
  cachedBounds: h,
391
- containerScrollOffset: H,
390
+ containerScrollOffset: v,
392
391
  containerSize: g,
393
- index: G,
394
- itemCount: i,
395
- itemSize: u
392
+ index: j,
393
+ itemCount: n,
394
+ itemSize: d
396
395
  });
397
- if (e)
398
- if (b = A({
396
+ if (e) {
397
+ if (L = A({
399
398
  containerElement: e,
400
- direction: r,
401
- isRtl: o,
402
- scrollOffset: b
403
- }), typeof e.scrollTo == "function")
404
- r === "horizontal" ? e.scrollTo({
405
- left: b,
406
- behavior: m || void 0
407
- }) : e.scrollTo({
408
- behavior: m || void 0,
409
- top: b
410
- });
411
- else {
412
- const O = T(b);
413
- (O[0] !== v || O[1] !== k) && I(O);
399
+ direction: o,
400
+ isRtl: r,
401
+ scrollOffset: L
402
+ }), typeof e.scrollTo != "function") {
403
+ const z = S(L);
404
+ (z[0] !== w || z[1] !== k) && b(z);
414
405
  }
406
+ return L;
407
+ }
415
408
  }
416
409
  );
417
410
  return {
418
411
  getCellBounds: y,
419
- getEstimatedSize: B,
420
- scrollToIndex: p,
421
- startIndex: v,
412
+ getEstimatedSize: H,
413
+ scrollToIndex: x,
414
+ startIndex: w,
422
415
  stopIndex: k
423
416
  };
424
417
  }
@@ -435,149 +428,158 @@ function Z(e, t) {
435
428
  return !1;
436
429
  return !0;
437
430
  }
438
- function re(e, t) {
439
- const { style: s, ...r } = e, { style: o, ...i } = t;
440
- return Z(s, o) && Z(r, i);
431
+ function oe(e, t) {
432
+ const { style: s, ...o } = e, { style: r, ...n } = t;
433
+ return Z(s, r) && Z(o, n);
441
434
  }
442
- function ve({
435
+ function we({
443
436
  cellComponent: e,
444
437
  cellProps: t,
445
438
  className: s,
446
- columnCount: r,
447
- columnWidth: o,
448
- defaultHeight: i = 0,
449
- defaultWidth: n = 0,
439
+ columnCount: o,
440
+ columnWidth: r,
441
+ defaultHeight: n = 0,
442
+ defaultWidth: i = 0,
450
443
  dir: c,
451
444
  gridRef: l,
452
445
  onCellsRendered: f,
453
- onResize: a,
454
- overscanCount: I = 3,
455
- rowCount: v,
446
+ onResize: p,
447
+ overscanCount: b = 3,
448
+ rowCount: w,
456
449
  rowHeight: k,
457
- style: x,
458
- ...w
450
+ style: a,
451
+ ...m
459
452
  }) {
460
- const z = se(t), g = W(
461
- () => _(e, re),
453
+ const I = se(t), g = W(
454
+ () => _(e, oe),
462
455
  [e]
463
- ), [u, h] = E(null), y = le(u, c), {
464
- getCellBounds: B,
465
- getEstimatedSize: T,
466
- startIndex: p,
467
- scrollToIndex: d,
468
- stopIndex: m
456
+ ), [d, h] = B(null), y = ce(d, c), {
457
+ getCellBounds: H,
458
+ getEstimatedSize: S,
459
+ startIndex: x,
460
+ scrollToIndex: u,
461
+ stopIndex: v
469
462
  } = C({
470
- containerElement: u,
471
- defaultContainerSize: n,
463
+ containerElement: d,
464
+ defaultContainerSize: i,
472
465
  direction: "horizontal",
473
466
  isRtl: y,
474
- itemCount: r,
475
- itemProps: z,
476
- itemSize: o,
477
- onResize: a,
478
- overscanCount: I
467
+ itemCount: o,
468
+ itemProps: I,
469
+ itemSize: r,
470
+ onResize: p,
471
+ overscanCount: b
479
472
  }), {
480
- getCellBounds: H,
481
- getEstimatedSize: G,
482
- startIndex: b,
483
- scrollToIndex: O,
473
+ getCellBounds: j,
474
+ getEstimatedSize: L,
475
+ startIndex: z,
476
+ scrollToIndex: $,
484
477
  stopIndex: F
485
478
  } = C({
486
- containerElement: u,
487
- defaultContainerSize: i,
479
+ containerElement: d,
480
+ defaultContainerSize: n,
488
481
  direction: "vertical",
489
- itemCount: v,
490
- itemProps: z,
482
+ itemCount: w,
483
+ itemProps: I,
491
484
  itemSize: k,
492
- onResize: a,
493
- overscanCount: I
485
+ onResize: p,
486
+ overscanCount: b
494
487
  });
495
488
  N(
496
489
  l,
497
490
  () => ({
498
491
  get element() {
499
- return u;
492
+ return d;
500
493
  },
501
494
  scrollToCell({
502
- behavior: L = "auto",
503
- columnAlign: S = "auto",
495
+ behavior: E = "auto",
496
+ columnAlign: O = "auto",
504
497
  columnIndex: M,
505
- rowAlign: $ = "auto",
498
+ rowAlign: T = "auto",
506
499
  rowIndex: U
507
500
  }) {
508
- O({
509
- align: $,
510
- behavior: L,
511
- containerScrollOffset: u?.scrollTop ?? 0,
512
- index: U
513
- }), d({
514
- align: S,
515
- behavior: L,
516
- containerScrollOffset: u?.scrollLeft ?? 0,
501
+ const ne = u({
502
+ align: O,
503
+ containerScrollOffset: d?.scrollLeft ?? 0,
517
504
  index: M
505
+ }), le = $({
506
+ align: T,
507
+ containerScrollOffset: d?.scrollTop ?? 0,
508
+ index: U
509
+ });
510
+ typeof d?.scrollTo == "function" && d.scrollTo({
511
+ behavior: E,
512
+ left: ne,
513
+ top: le
518
514
  });
519
515
  },
520
516
  scrollToColumn({
521
- align: L = "auto",
522
- behavior: S = "auto",
517
+ align: E = "auto",
518
+ behavior: O = "auto",
523
519
  index: M
524
520
  }) {
525
- d({
526
- align: L,
527
- behavior: S,
528
- containerScrollOffset: u?.scrollLeft ?? 0,
521
+ const T = u({
522
+ align: E,
523
+ containerScrollOffset: d?.scrollLeft ?? 0,
529
524
  index: M
530
525
  });
526
+ typeof d?.scrollTo == "function" && d.scrollTo({
527
+ behavior: O,
528
+ left: T
529
+ });
531
530
  },
532
531
  scrollToRow({
533
- align: L = "auto",
534
- behavior: S = "auto",
532
+ align: E = "auto",
533
+ behavior: O = "auto",
535
534
  index: M
536
535
  }) {
537
- O({
538
- align: L,
539
- behavior: S,
540
- containerScrollOffset: u?.scrollTop ?? 0,
536
+ const T = $({
537
+ align: E,
538
+ containerScrollOffset: d?.scrollTop ?? 0,
541
539
  index: M
542
540
  });
541
+ typeof d?.scrollTo == "function" && d.scrollTo({
542
+ behavior: O,
543
+ top: T
544
+ });
543
545
  }
544
546
  }),
545
- [u, d, O]
547
+ [d, u, $]
546
548
  ), K(() => {
547
- p >= 0 && m >= 0 && b >= 0 && F >= 0 && f && f({
548
- columnStartIndex: p,
549
- columnStopIndex: m,
550
- rowStartIndex: b,
549
+ x >= 0 && v >= 0 && z >= 0 && F >= 0 && f && f({
550
+ columnStartIndex: x,
551
+ columnStopIndex: v,
552
+ rowStartIndex: z,
551
553
  rowStopIndex: F
552
554
  });
553
555
  }, [
554
556
  f,
555
- p,
556
- m,
557
- b,
557
+ x,
558
+ v,
559
+ z,
558
560
  F
559
561
  ]);
560
- const oe = W(() => {
561
- const L = [];
562
- if (r > 0 && v > 0)
563
- for (let S = b; S <= F; S++) {
564
- const M = H(S);
565
- for (let $ = p; $ <= m; $++) {
566
- const U = B($);
567
- L.push(
562
+ const re = W(() => {
563
+ const E = [];
564
+ if (o > 0 && w > 0)
565
+ for (let O = z; O <= F; O++) {
566
+ const M = j(O);
567
+ for (let T = x; T <= v; T++) {
568
+ const U = H(T);
569
+ E.push(
568
570
  /* @__PURE__ */ ee(
569
571
  g,
570
572
  {
571
- ...z,
572
- columnIndex: $,
573
- key: `${S}-${$}`,
574
- rowIndex: S,
573
+ ...I,
574
+ columnIndex: T,
575
+ key: `${O}-${T}`,
576
+ rowIndex: O,
575
577
  style: {
576
578
  position: "absolute",
577
579
  left: y ? void 0 : 0,
578
580
  right: y ? 0 : void 0,
579
581
  transform: `translate(${y ? -U.scrollOffset : U.scrollOffset}px, ${M.scrollOffset}px)`,
580
- height: v > 1 ? M.size : "100%",
582
+ height: w > 1 ? M.size : "100%",
581
583
  width: U.size
582
584
  }
583
585
  }
@@ -585,32 +587,31 @@ function ve({
585
587
  );
586
588
  }
587
589
  }
588
- return L;
590
+ return E;
589
591
  }, [
590
592
  g,
591
- z,
592
- r,
593
- p,
594
- m,
595
- B,
593
+ I,
594
+ o,
595
+ x,
596
+ v,
596
597
  H,
598
+ j,
597
599
  y,
598
- v,
599
- b,
600
+ w,
601
+ z,
600
602
  F
601
603
  ]);
602
604
  return /* @__PURE__ */ D(
603
605
  "div",
604
606
  {
605
- role: "grid",
606
- ...w,
607
+ ...m,
607
608
  className: s,
608
609
  dir: c,
609
610
  ref: h,
610
611
  style: {
611
612
  width: "100%",
612
613
  height: "100%",
613
- ...x,
614
+ ...a,
614
615
  maxHeight: "100%",
615
616
  maxWidth: "100%",
616
617
  flexGrow: 1,
@@ -622,109 +623,111 @@ function ve({
622
623
  className: s,
623
624
  style: {
624
625
  position: "relative",
625
- height: G(),
626
- width: T()
626
+ height: L(),
627
+ width: S()
627
628
  },
628
- children: oe
629
+ children: re
629
630
  }
630
631
  )
631
632
  }
632
633
  );
633
634
  }
634
- const xe = E, we = q;
635
- function me({
635
+ const me = B, ye = q;
636
+ function be({
636
637
  className: e,
637
638
  defaultHeight: t = 0,
638
639
  listRef: s,
639
- onResize: r,
640
- onRowsRendered: o,
641
- overscanCount: i = 3,
642
- rowComponent: n,
640
+ onResize: o,
641
+ onRowsRendered: r,
642
+ overscanCount: n = 3,
643
+ rowComponent: i,
643
644
  rowCount: c,
644
645
  rowHeight: l,
645
646
  rowProps: f,
646
- style: a,
647
- ...I
647
+ style: p,
648
+ ...b
648
649
  }) {
649
- const v = se(f), k = W(
650
- () => _(n, re),
651
- [n]
652
- ), [x, w] = E(null), {
653
- getCellBounds: z,
650
+ const w = se(f), k = W(
651
+ () => _(i, oe),
652
+ [i]
653
+ ), [a, m] = B(null), {
654
+ getCellBounds: I,
654
655
  getEstimatedSize: g,
655
- scrollToIndex: u,
656
+ scrollToIndex: d,
656
657
  startIndex: h,
657
658
  stopIndex: y
658
659
  } = C({
659
- containerElement: x,
660
+ containerElement: a,
660
661
  defaultContainerSize: t,
661
662
  direction: "vertical",
662
663
  itemCount: c,
663
- itemProps: v,
664
+ itemProps: w,
664
665
  itemSize: l,
665
- onResize: r,
666
- overscanCount: i
666
+ onResize: o,
667
+ overscanCount: n
667
668
  });
668
669
  N(
669
670
  s,
670
671
  () => ({
671
672
  get element() {
672
- return x;
673
+ return a;
673
674
  },
674
675
  scrollToRow({
675
- align: T = "auto",
676
- behavior: p = "auto",
677
- index: d
676
+ align: S = "auto",
677
+ behavior: x = "auto",
678
+ index: u
678
679
  }) {
679
- u({
680
- align: T,
681
- behavior: p,
682
- containerScrollOffset: x?.scrollTop ?? 0,
683
- index: d
680
+ const v = d({
681
+ align: S,
682
+ containerScrollOffset: a?.scrollTop ?? 0,
683
+ index: u
684
+ });
685
+ typeof a?.scrollTo == "function" && a.scrollTo({
686
+ behavior: x,
687
+ top: v
684
688
  });
685
689
  }
686
690
  }),
687
- [x, u]
691
+ [a, d]
688
692
  ), K(() => {
689
- h >= 0 && y >= 0 && o && o({
693
+ h >= 0 && y >= 0 && r && r({
690
694
  startIndex: h,
691
695
  stopIndex: y
692
696
  });
693
- }, [o, h, y]);
694
- const B = W(() => {
695
- const T = [];
697
+ }, [r, h, y]);
698
+ const H = W(() => {
699
+ const S = [];
696
700
  if (c > 0)
697
- for (let p = h; p <= y; p++) {
698
- const d = z(p);
699
- T.push(
701
+ for (let x = h; x <= y; x++) {
702
+ const u = I(x);
703
+ S.push(
700
704
  /* @__PURE__ */ ee(
701
705
  k,
702
706
  {
703
- ...v,
704
- key: p,
705
- index: p,
707
+ ...w,
708
+ key: x,
709
+ index: x,
706
710
  style: {
707
711
  position: "absolute",
708
712
  left: 0,
709
- transform: `translateY(${d.scrollOffset}px)`,
710
- height: d.size,
713
+ transform: `translateY(${u.scrollOffset}px)`,
714
+ height: u.size,
711
715
  width: "100%"
712
716
  }
713
717
  }
714
718
  )
715
719
  );
716
720
  }
717
- return T;
718
- }, [k, z, c, v, h, y]);
721
+ return S;
722
+ }, [k, I, c, w, h, y]);
719
723
  return /* @__PURE__ */ D(
720
724
  "div",
721
725
  {
722
- role: "list",
723
- ...I,
726
+ ...b,
724
727
  className: e,
725
- ref: w,
728
+ ref: m,
726
729
  style: {
727
- ...a,
730
+ ...p,
728
731
  maxHeight: "100%",
729
732
  flexGrow: 1,
730
733
  overflowY: "auto"
@@ -738,15 +741,15 @@ function me({
738
741
  position: "relative",
739
742
  width: "100%"
740
743
  },
741
- children: B
744
+ children: H
742
745
  }
743
746
  )
744
747
  }
745
748
  );
746
749
  }
747
- const ye = E, be = q;
750
+ const Ie = B, ze = q;
748
751
  let P = -1;
749
- function Ie(e = !1) {
752
+ function Oe(e = !1) {
750
753
  if (P === -1 || e) {
751
754
  const t = document.createElement("div"), s = t.style;
752
755
  s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), P = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
@@ -754,12 +757,12 @@ function Ie(e = !1) {
754
757
  return P;
755
758
  }
756
759
  export {
757
- ve as Grid,
758
- me as List,
759
- Ie as getScrollbarSize,
760
- xe as useGridCallbackRef,
761
- we as useGridRef,
762
- ye as useListCallbackRef,
763
- be as useListRef
760
+ we as Grid,
761
+ be as List,
762
+ Oe as getScrollbarSize,
763
+ me as useGridCallbackRef,
764
+ ye as useGridRef,
765
+ Ie as useListCallbackRef,
766
+ ze as useListRef
764
767
  };
765
768
  //# sourceMappingURL=react-window.js.map