react-window 2.0.2-alpha.0 → 2.0.2-alpha.1

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