react-window 2.1.2 → 2.2.0-alpha.0

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 (152) 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 +18 -2
  4. package/dist/react-window.js +540 -451
  5. package/dist/react-window.js.map +1 -1
  6. package/package.json +3 -4
  7. package/docs/assets/AriaRolesRoute-CioRrafx.js +0 -2
  8. package/docs/assets/AriaRolesRoute-CioRrafx.js.map +0 -1
  9. package/docs/assets/AriaRolesRoute-CjzrHhTE.js +0 -2
  10. package/docs/assets/AriaRolesRoute-CjzrHhTE.js.map +0 -1
  11. package/docs/assets/AriaRolesRoute-DILWjLTS.js +0 -2
  12. package/docs/assets/AriaRolesRoute-DILWjLTS.js.map +0 -1
  13. package/docs/assets/CellComponent.example-uUYIhpiW.js +0 -2
  14. package/docs/assets/CellComponent.example-uUYIhpiW.js.map +0 -1
  15. package/docs/assets/Code-nwWF-WcI.css +0 -1
  16. package/docs/assets/Code-r2plEB3N.js +0 -2
  17. package/docs/assets/Code-r2plEB3N.js.map +0 -1
  18. package/docs/assets/ComponentProps-CnDy_aV8.js +0 -2
  19. package/docs/assets/ComponentProps-CnDy_aV8.js.map +0 -1
  20. package/docs/assets/ContinueLink-BDXFlJ2t.js +0 -2
  21. package/docs/assets/ContinueLink-BDXFlJ2t.js.map +0 -1
  22. package/docs/assets/FixedRowHeightsRoute-CCpmgQDh.js +0 -2
  23. package/docs/assets/FixedRowHeightsRoute-CCpmgQDh.js.map +0 -1
  24. package/docs/assets/GettingStartedRoute-bLneovGd.js +0 -2
  25. package/docs/assets/GettingStartedRoute-bLneovGd.js.map +0 -1
  26. package/docs/assets/Grid-BjC_BndR.js +0 -2
  27. package/docs/assets/Grid-BjC_BndR.js.map +0 -1
  28. package/docs/assets/Header-CWpEkQSA.js +0 -2
  29. package/docs/assets/Header-CWpEkQSA.js.map +0 -1
  30. package/docs/assets/HorizontalListsRoute-CIfKb2Dg.js +0 -2
  31. package/docs/assets/HorizontalListsRoute-CIfKb2Dg.js.map +0 -1
  32. package/docs/assets/ImagesRoute-jiaLWXKV.js +0 -2
  33. package/docs/assets/ImagesRoute-jiaLWXKV.js.map +0 -1
  34. package/docs/assets/ImperativeApiRoute-DRVezybQ.js +0 -2
  35. package/docs/assets/ImperativeApiRoute-DRVezybQ.js.map +0 -1
  36. package/docs/assets/ImperativeApiRoute-DXzOo4Dn.js +0 -2
  37. package/docs/assets/ImperativeApiRoute-DXzOo4Dn.js.map +0 -1
  38. package/docs/assets/List-CB_lBMmJ.js +0 -2
  39. package/docs/assets/List-CB_lBMmJ.js.map +0 -1
  40. package/docs/assets/LoadingSpinner-D94ZhMZx.js +0 -2
  41. package/docs/assets/LoadingSpinner-D94ZhMZx.js.map +0 -1
  42. package/docs/assets/PageNotFound-CZublSHx.js +0 -2
  43. package/docs/assets/PageNotFound-CZublSHx.js.map +0 -1
  44. package/docs/assets/PlatformRequirementsRoute-Bq7s0cCu.js +0 -2
  45. package/docs/assets/PlatformRequirementsRoute-Bq7s0cCu.js.map +0 -1
  46. package/docs/assets/PropsRoute-DrhCHCJM.js +0 -2
  47. package/docs/assets/PropsRoute-DrhCHCJM.js.map +0 -1
  48. package/docs/assets/PropsRoute-Hhqv1kyZ.js +0 -2
  49. package/docs/assets/PropsRoute-Hhqv1kyZ.js.map +0 -1
  50. package/docs/assets/RTLGridsRoute-C7t1OLVr.js +0 -2
  51. package/docs/assets/RTLGridsRoute-C7t1OLVr.js.map +0 -1
  52. package/docs/assets/RenderingGridRoute-Cd7Z3aKa.js +0 -2
  53. package/docs/assets/RenderingGridRoute-Cd7Z3aKa.js.map +0 -1
  54. package/docs/assets/ScratchpadRoute-BE3BnYuC.js +0 -2
  55. package/docs/assets/ScratchpadRoute-BE3BnYuC.js.map +0 -1
  56. package/docs/assets/Select-D7Hzggtt.js +0 -2
  57. package/docs/assets/Select-D7Hzggtt.js.map +0 -1
  58. package/docs/assets/StickyRowsRoute-BFaLUY3R.js +0 -2
  59. package/docs/assets/StickyRowsRoute-BFaLUY3R.js.map +0 -1
  60. package/docs/assets/SupportRoute-DbxH2zGy.js +0 -2
  61. package/docs/assets/SupportRoute-DbxH2zGy.js.map +0 -1
  62. package/docs/assets/TabularDataRoute-DI0yJsDS.js +0 -2
  63. package/docs/assets/TabularDataRoute-DI0yJsDS.js.map +0 -1
  64. package/docs/assets/VariableRowHeightsRoute-cSpZuhJh.js +0 -2
  65. package/docs/assets/VariableRowHeightsRoute-cSpZuhJh.js.map +0 -1
  66. package/docs/assets/addresses-CDQyd4n9.js +0 -2
  67. package/docs/assets/addresses-CDQyd4n9.js.map +0 -1
  68. package/docs/assets/arePropsEqual-CaQN03VG.js +0 -2
  69. package/docs/assets/arePropsEqual-CaQN03VG.js.map +0 -1
  70. package/docs/assets/contacts-Bxrk2JS2.js +0 -2
  71. package/docs/assets/contacts-Bxrk2JS2.js.map +0 -1
  72. package/docs/assets/index-C1XSX8kr.css +0 -1
  73. package/docs/assets/index-Cnm6lMUF.js +0 -3
  74. package/docs/assets/index-Cnm6lMUF.js.map +0 -1
  75. package/docs/assets/useCitiesByState-DF2_rnmt.js +0 -2
  76. package/docs/assets/useCitiesByState-DF2_rnmt.js.map +0 -1
  77. package/docs/assets/useContacts-X0AOlpLx.js +0 -2
  78. package/docs/assets/useContacts-X0AOlpLx.js.map +0 -1
  79. package/docs/data/addresses.json +0 -23932
  80. package/docs/data/contacts.json +0 -4202
  81. package/docs/data/names.json +0 -1002
  82. package/docs/favicon.svg +0 -16
  83. package/docs/generated/README.md +0 -1
  84. package/docs/generated/code-snippets/CellComponent.json +0 -3
  85. package/docs/generated/code-snippets/CellComponentAriaRoles.json +0 -3
  86. package/docs/generated/code-snippets/FixedHeightList.json +0 -3
  87. package/docs/generated/code-snippets/FixedHeightRowComponent.json +0 -3
  88. package/docs/generated/code-snippets/FlexboxLayout.json +0 -3
  89. package/docs/generated/code-snippets/Grid.json +0 -3
  90. package/docs/generated/code-snippets/GridAriaRoles.json +0 -3
  91. package/docs/generated/code-snippets/HorizontalList.json +0 -3
  92. package/docs/generated/code-snippets/HorizontalListCellRenderer.json +0 -3
  93. package/docs/generated/code-snippets/ImageRow.json +0 -3
  94. package/docs/generated/code-snippets/Images.json +0 -3
  95. package/docs/generated/code-snippets/ListAriaRoles.json +0 -3
  96. package/docs/generated/code-snippets/ListVariableRowHeights.json +0 -3
  97. package/docs/generated/code-snippets/ListWithStickyRows.json +0 -3
  98. package/docs/generated/code-snippets/RowComponentAriaRoles.json +0 -3
  99. package/docs/generated/code-snippets/RtlGrid.json +0 -3
  100. package/docs/generated/code-snippets/TableAriaAttributes.json +0 -3
  101. package/docs/generated/code-snippets/TableAriaOverrideProps.json +0 -3
  102. package/docs/generated/code-snippets/columnWidth.json +0 -3
  103. package/docs/generated/code-snippets/gridRefClickEventHandler.json +0 -3
  104. package/docs/generated/code-snippets/listRefClickEventHandler.json +0 -3
  105. package/docs/generated/code-snippets/rowHeight.json +0 -3
  106. package/docs/generated/code-snippets/useGridCallbackRef.json +0 -3
  107. package/docs/generated/code-snippets/useGridRef.json +0 -3
  108. package/docs/generated/code-snippets/useGridRefImport.json +0 -3
  109. package/docs/generated/code-snippets/useImageSizeCache.json +0 -3
  110. package/docs/generated/code-snippets/useListCallbackRef.json +0 -3
  111. package/docs/generated/code-snippets/useListRef.json +0 -3
  112. package/docs/generated/code-snippets/useListRefImport.json +0 -3
  113. package/docs/generated/js-docs/Grid.json +0 -1030
  114. package/docs/generated/js-docs/List.json +0 -927
  115. package/docs/images/animal-3546613_1280.jpg +0 -0
  116. package/docs/images/ball-bearings-1958083_1280.jpg +0 -0
  117. package/docs/images/bourke-luck-potholes-163065_1280.jpg +0 -0
  118. package/docs/images/child-1439468_1280.jpg +0 -0
  119. package/docs/images/digiart-3405596_1280.jpg +0 -0
  120. package/docs/images/electrical-cable-mess-2654084_1280.jpg +0 -0
  121. package/docs/images/elephant-8608983_1280.jpg +0 -0
  122. package/docs/images/fema-4987740_1280.jpg +0 -0
  123. package/docs/images/log-3135150_1280.jpg +0 -0
  124. package/docs/images/man-1838330_1280.jpg +0 -0
  125. package/docs/images/manipulation-2735724_1280.jpg +0 -0
  126. package/docs/images/newborn-6467761_1280.jpg +0 -0
  127. package/docs/images/old-farm-house-2096642_1280.jpg +0 -0
  128. package/docs/images/people-2557534_1280.jpg +0 -0
  129. package/docs/images/photo-1516712109157-6a67f5d73fa1.jpg +0 -0
  130. package/docs/images/photo-1562123408-fbf8cbf92c03.jpg +0 -0
  131. package/docs/images/sculpture-99484_1280.jpg +0 -0
  132. package/docs/images/sport-4765008_1280.jpg +0 -0
  133. package/docs/images/styrofoam-19493_1280.jpg +0 -0
  134. package/docs/images/trabi-328402_1280.jpg +0 -0
  135. package/docs/images/trailers-5073244_1280.jpg +0 -0
  136. package/docs/images/tub-114349_1280.jpg +0 -0
  137. package/docs/images/venus-fly-trap-3684935_1280.jpg +0 -0
  138. package/docs/images/web-5013633_1280.jpg +0 -0
  139. package/docs/images/winter-1675197_1280.jpg +0 -0
  140. package/docs/images/woman-1838149_1280.jpg +0 -0
  141. package/docs/index.html +0 -39
  142. package/docs/og.html +0 -42
  143. package/docs/og.png +0 -0
  144. package/docs/robots.txt +0 -2
  145. package/docs/stats.html +0 -4949
  146. package/docs/svgs/checkbox-checked.svg +0 -1
  147. package/docs/svgs/checkbox-indeterminate.svg +0 -1
  148. package/docs/svgs/checkbox-unchecked.svg +0 -1
  149. package/docs/svgs/github.svg +0 -3
  150. package/docs/svgs/npm.svg +0 -1
  151. package/docs/svgs/radio-checked.svg +0 -1
  152. package/docs/svgs/radio-unchecked.svg +0 -1
@@ -1,6 +1,6 @@
1
- import { jsx as _ } from "react/jsx-runtime";
2
- import { useState as j, useLayoutEffect as ee, useEffect as te, useMemo as H, useRef as K, useCallback as N, memo as ie, useImperativeHandle as le, createElement as P } from "react";
3
- function pe(e) {
1
+ import { jsx as P } from "react/jsx-runtime";
2
+ import { useState as $, useLayoutEffect as se, useEffect as J, useMemo as L, useRef as K, useCallback as U, memo as le, useImperativeHandle as ce, createElement as X } from "react";
3
+ function xe(e) {
4
4
  let t = e;
5
5
  for (; t; ) {
6
6
  if (t.dir)
@@ -9,14 +9,14 @@ function pe(e) {
9
9
  }
10
10
  return !1;
11
11
  }
12
- function xe(e, t) {
13
- const [s, r] = j(t === "rtl");
14
- return ee(() => {
15
- e && (t || r(pe(e)));
12
+ function ve(e, t) {
13
+ const [s, r] = $(t === "rtl");
14
+ return se(() => {
15
+ e && (t || r(xe(e)));
16
16
  }, [t, e]), s;
17
17
  }
18
- const J = typeof window < "u" ? ee : te;
19
- function ne(e) {
18
+ const q = typeof window < "u" ? se : J;
19
+ function oe(e) {
20
20
  if (e !== void 0)
21
21
  switch (typeof e) {
22
22
  case "number":
@@ -28,101 +28,101 @@ function ne(e) {
28
28
  }
29
29
  }
30
30
  }
31
- function ge({
31
+ function be({
32
32
  box: e,
33
33
  defaultHeight: t,
34
34
  defaultWidth: s,
35
35
  disabled: r,
36
- element: o,
37
- mode: n,
38
- style: l
36
+ element: n,
37
+ mode: o,
38
+ style: i
39
39
  }) {
40
- const { styleHeight: c, styleWidth: i } = H(
40
+ const { styleHeight: a, styleWidth: l } = L(
41
41
  () => ({
42
- styleHeight: ne(l?.height),
43
- styleWidth: ne(l?.width)
42
+ styleHeight: oe(i?.height),
43
+ styleWidth: oe(i?.width)
44
44
  }),
45
- [l?.height, l?.width]
46
- ), [f, d] = j({
45
+ [i?.height, i?.width]
46
+ ), [c, d] = $({
47
47
  height: t,
48
48
  width: s
49
- }), p = r || n === "only-height" && c !== void 0 || n === "only-width" && i !== void 0 || c !== void 0 && i !== void 0;
50
- return J(() => {
51
- if (o === null || p)
49
+ }), f = r || o === "only-height" && a !== void 0 || o === "only-width" && l !== void 0 || a !== void 0 && l !== void 0;
50
+ return q(() => {
51
+ if (n === null || f)
52
52
  return;
53
- const y = new ResizeObserver((S) => {
54
- for (const V of S) {
55
- const { contentRect: b, target: g } = V;
56
- o === g && d((m) => m.height === b.height && m.width === b.width ? m : {
57
- height: b.height,
58
- width: b.width
53
+ const p = new ResizeObserver((b) => {
54
+ for (const m of b) {
55
+ const { contentRect: I, target: g } = m;
56
+ n === g && d((w) => w.height === I.height && w.width === I.width ? w : {
57
+ height: I.height,
58
+ width: I.width
59
59
  });
60
60
  }
61
61
  });
62
- return y.observe(o, { box: e }), () => {
63
- y?.unobserve(o);
62
+ return p.observe(n, { box: e }), () => {
63
+ p?.unobserve(n);
64
64
  };
65
- }, [e, p, o, c, i]), H(
65
+ }, [e, f, n, a, l]), L(
66
66
  () => ({
67
- height: c ?? f.height,
68
- width: i ?? f.width
67
+ height: a ?? c.height,
68
+ width: l ?? c.width
69
69
  }),
70
- [f, c, i]
70
+ [c, a, l]
71
71
  );
72
72
  }
73
- function Ie(e) {
73
+ function ae(e) {
74
74
  const t = K(() => {
75
75
  throw new Error("Cannot call an event handler while rendering.");
76
76
  });
77
- return J(() => {
77
+ return q(() => {
78
78
  t.current = e;
79
- }, [e]), N((s) => t.current?.(s), [t]);
79
+ }, [e]), U((s) => t.current?.(s), [t]);
80
80
  }
81
- let G = null;
82
- function ve(e = !1) {
83
- if (G === null || e) {
81
+ let F = null;
82
+ function Ie(e = !1) {
83
+ if (F === 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 ? G = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? G = "negative" : G = "positive-ascending"), document.body.removeChild(t), G;
86
+ const r = document.createElement("div"), n = r.style;
87
+ return n.width = "100px", n.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? F = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? F = "negative" : F = "positive-ascending"), document.body.removeChild(t), F;
88
88
  }
89
- return G;
89
+ return F;
90
90
  }
91
- function X({
91
+ function Z({
92
92
  containerElement: e,
93
93
  direction: t,
94
94
  isRtl: s,
95
95
  scrollOffset: r
96
96
  }) {
97
97
  if (t === "horizontal" && s)
98
- switch (ve()) {
98
+ switch (Ie()) {
99
99
  case "negative":
100
100
  return -r;
101
101
  case "positive-descending": {
102
102
  if (e) {
103
- const { clientWidth: o, scrollLeft: n, scrollWidth: l } = e;
104
- return l - o - n;
103
+ const { clientWidth: n, scrollLeft: o, scrollWidth: i } = e;
104
+ return i - n - o;
105
105
  }
106
106
  break;
107
107
  }
108
108
  }
109
109
  return r;
110
110
  }
111
- function B(e, t = "Assertion error") {
111
+ function H(e, t = "Assertion error") {
112
112
  if (!e)
113
113
  throw console.error(t), Error(t);
114
114
  }
115
115
  function Y(e, t) {
116
116
  if (e === t)
117
117
  return !0;
118
- if (!!e != !!t || (B(e !== void 0), B(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
118
+ if (!!e != !!t || (H(e !== void 0), H(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
119
119
  return !1;
120
120
  for (const s in e)
121
121
  if (!Object.is(t[s], e[s]))
122
122
  return !1;
123
123
  return !0;
124
124
  }
125
- function ce({
125
+ function fe({
126
126
  cachedBounds: e,
127
127
  itemCount: t,
128
128
  itemSize: s
@@ -135,69 +135,69 @@ function ce({
135
135
  const r = e.get(
136
136
  e.size === 0 ? 0 : e.size - 1
137
137
  );
138
- B(r !== void 0, "Unexpected bounds cache miss");
139
- const o = (r.scrollOffset + r.size) / e.size;
140
- return t * o;
138
+ H(r !== void 0, "Unexpected bounds cache miss");
139
+ const n = (r.scrollOffset + r.size) / e.size;
140
+ return t * n;
141
141
  }
142
142
  }
143
- function be({
143
+ function we({
144
144
  align: e,
145
145
  cachedBounds: t,
146
146
  index: s,
147
147
  itemCount: r,
148
- itemSize: o,
149
- containerScrollOffset: n,
150
- containerSize: l
148
+ itemSize: n,
149
+ containerScrollOffset: o,
150
+ containerSize: i
151
151
  }) {
152
- const c = ce({
152
+ const a = fe({
153
153
  cachedBounds: t,
154
154
  itemCount: r,
155
- itemSize: o
156
- }), i = t.get(s), f = Math.max(
155
+ itemSize: n
156
+ }), l = t.get(s), c = Math.max(
157
157
  0,
158
- Math.min(c - l, i.scrollOffset)
158
+ Math.min(a - i, l.scrollOffset)
159
159
  ), d = Math.max(
160
160
  0,
161
- i.scrollOffset - l + i.size
161
+ l.scrollOffset - i + l.size
162
162
  );
163
- switch (e === "smart" && (n >= d && n <= f ? e = "auto" : e = "center"), e) {
163
+ switch (e === "smart" && (o >= d && o <= c ? e = "auto" : e = "center"), e) {
164
164
  case "start":
165
- return f;
165
+ return c;
166
166
  case "end":
167
167
  return d;
168
168
  case "center":
169
- return i.scrollOffset <= l / 2 ? 0 : i.scrollOffset + i.size / 2 >= c - l / 2 ? c - l : i.scrollOffset + i.size / 2 - l / 2;
169
+ return l.scrollOffset <= i / 2 ? 0 : l.scrollOffset + l.size / 2 >= a - i / 2 ? a - i : l.scrollOffset + l.size / 2 - i / 2;
170
170
  case "auto":
171
171
  default:
172
- return n >= d && n <= f ? n : n < d ? d : f;
172
+ return o >= d && o <= c ? o : o < d ? d : c;
173
173
  }
174
174
  }
175
- function oe({
175
+ function ie({
176
176
  cachedBounds: e,
177
177
  containerScrollOffset: t,
178
178
  containerSize: s,
179
179
  itemCount: r,
180
- overscanCount: o
180
+ overscanCount: n
181
181
  }) {
182
- const n = r - 1;
183
- let l = 0, c = -1, i = 0, f = -1, d = 0;
184
- for (; d < n; ) {
185
- const p = e.get(d);
186
- if (p.scrollOffset + p.size > t)
182
+ const o = r - 1;
183
+ let i = 0, a = -1, l = 0, c = -1, d = 0;
184
+ for (; d < o; ) {
185
+ const f = e.get(d);
186
+ if (f.scrollOffset + f.size > t)
187
187
  break;
188
188
  d++;
189
189
  }
190
- for (l = d, i = Math.max(0, l - o); d < n; ) {
191
- const p = e.get(d);
192
- if (p.scrollOffset + p.size >= t + s)
190
+ for (i = d, l = Math.max(0, i - n); d < o; ) {
191
+ const f = e.get(d);
192
+ if (f.scrollOffset + f.size >= t + s)
193
193
  break;
194
194
  d++;
195
195
  }
196
- return c = Math.min(n, d), f = Math.min(r - 1, c + o), l < 0 && (l = 0, c = -1, i = 0, f = -1), {
197
- startIndexVisible: l,
198
- stopIndexVisible: c,
199
- startIndexOverscan: i,
200
- stopIndexOverscan: f
196
+ return a = Math.min(o, d), c = Math.min(r - 1, a + n), i < 0 && (i = 0, a = -1, l = 0, c = -1), {
197
+ startIndexVisible: i,
198
+ stopIndexVisible: a,
199
+ startIndexOverscan: l,
200
+ stopIndexOverscan: c
201
201
  };
202
202
  }
203
203
  function me({
@@ -207,56 +207,56 @@ function me({
207
207
  }) {
208
208
  const r = /* @__PURE__ */ new Map();
209
209
  return {
210
- get(o) {
211
- for (B(o < e, `Invalid index ${o}`); r.size - 1 < o; ) {
212
- const l = r.size;
213
- let c;
210
+ get(n) {
211
+ for (H(n < e, `Invalid index ${n}`); r.size - 1 < n; ) {
212
+ const i = r.size;
213
+ let a;
214
214
  switch (typeof s) {
215
215
  case "function": {
216
- c = s(l, t);
216
+ a = s(i, t);
217
217
  break;
218
218
  }
219
219
  case "number": {
220
- c = s;
220
+ a = s;
221
221
  break;
222
222
  }
223
223
  }
224
- if (l === 0)
225
- r.set(l, {
226
- size: c,
224
+ if (i === 0)
225
+ r.set(i, {
226
+ size: a,
227
227
  scrollOffset: 0
228
228
  });
229
229
  else {
230
- const i = r.get(l - 1);
231
- B(
232
- i !== void 0,
233
- `Unexpected bounds cache miss for index ${o}`
234
- ), r.set(l, {
235
- scrollOffset: i.scrollOffset + i.size,
236
- size: c
230
+ const l = r.get(i - 1);
231
+ H(
232
+ l !== void 0,
233
+ `Unexpected bounds cache miss for index ${n}`
234
+ ), r.set(i, {
235
+ scrollOffset: l.scrollOffset + l.size,
236
+ size: a
237
237
  });
238
238
  }
239
239
  }
240
- const n = r.get(o);
241
- return B(
242
- n !== void 0,
243
- `Unexpected bounds cache miss for index ${o}`
244
- ), n;
240
+ const o = r.get(n);
241
+ return H(
242
+ o !== void 0,
243
+ `Unexpected bounds cache miss for index ${n}`
244
+ ), o;
245
245
  },
246
- set(o, n) {
247
- r.set(o, n);
246
+ set(n, o) {
247
+ r.set(n, o);
248
248
  },
249
249
  get size() {
250
250
  return r.size;
251
251
  }
252
252
  };
253
253
  }
254
- function we({
254
+ function Oe({
255
255
  itemCount: e,
256
256
  itemProps: t,
257
257
  itemSize: s
258
258
  }) {
259
- return H(
259
+ return L(
260
260
  () => me({
261
261
  itemCount: e,
262
262
  itemProps: t,
@@ -265,17 +265,17 @@ function we({
265
265
  [e, t, s]
266
266
  );
267
267
  }
268
- function Oe({
268
+ function ye({
269
269
  containerSize: e,
270
270
  itemSize: t
271
271
  }) {
272
272
  let s;
273
273
  switch (typeof t) {
274
274
  case "string": {
275
- B(
275
+ H(
276
276
  t.endsWith("%"),
277
277
  `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`
278
- ), B(
278
+ ), H(
279
279
  e !== void 0,
280
280
  "Container size must be defined if a percentage item size is specified"
281
281
  ), s = e * parseInt(t) / 100;
@@ -288,393 +288,393 @@ function Oe({
288
288
  }
289
289
  return s;
290
290
  }
291
- function C({
291
+ function ee({
292
292
  containerElement: e,
293
293
  containerStyle: t,
294
294
  defaultContainerSize: s = 0,
295
295
  direction: r,
296
- isRtl: o = !1,
297
- itemCount: n,
298
- itemProps: l,
299
- itemSize: c,
300
- onResize: i,
301
- overscanCount: f
296
+ isRtl: n = !1,
297
+ itemCount: o,
298
+ itemProps: i,
299
+ itemSize: a,
300
+ onResize: l,
301
+ overscanCount: c
302
302
  }) {
303
- const [d, p] = j({
303
+ const [d, f] = $({
304
304
  startIndexVisible: 0,
305
305
  startIndexOverscan: 0,
306
306
  stopIndexVisible: -1,
307
307
  stopIndexOverscan: -1
308
308
  }), {
309
- startIndexVisible: y,
310
- startIndexOverscan: S,
311
- stopIndexVisible: V,
312
- stopIndexOverscan: b
309
+ startIndexVisible: p,
310
+ startIndexOverscan: b,
311
+ stopIndexVisible: m,
312
+ stopIndexOverscan: I
313
313
  } = {
314
- startIndexVisible: Math.min(n - 1, d.startIndexVisible),
315
- startIndexOverscan: Math.min(n - 1, d.startIndexOverscan),
316
- stopIndexVisible: Math.min(n - 1, d.stopIndexVisible),
317
- stopIndexOverscan: Math.min(n - 1, d.stopIndexOverscan)
318
- }, { height: g = s, width: m = s } = ge({
314
+ startIndexVisible: Math.min(o - 1, d.startIndexVisible),
315
+ startIndexOverscan: Math.min(o - 1, d.startIndexOverscan),
316
+ stopIndexVisible: Math.min(o - 1, d.stopIndexVisible),
317
+ stopIndexOverscan: Math.min(o - 1, d.stopIndexOverscan)
318
+ }, { height: g = s, width: w = s } = be({
319
319
  defaultHeight: r === "vertical" ? s : void 0,
320
320
  defaultWidth: r === "horizontal" ? s : void 0,
321
321
  element: e,
322
322
  mode: r === "vertical" ? "only-height" : "only-width",
323
323
  style: t
324
- }), k = K({
324
+ }), y = K({
325
325
  height: 0,
326
326
  width: 0
327
- }), O = r === "vertical" ? g : m, a = Oe({ containerSize: O, itemSize: c });
328
- ee(() => {
329
- if (typeof i == "function") {
330
- const u = k.current;
331
- (u.height !== g || u.width !== m) && (i({ height: g, width: m }, { ...u }), u.height = g, u.width = m);
327
+ }), V = r === "vertical" ? g : w, u = ye({ containerSize: V, itemSize: a });
328
+ se(() => {
329
+ if (typeof l == "function") {
330
+ const h = y.current;
331
+ (h.height !== g || h.width !== w) && (l({ height: g, width: w }, { ...h }), h.height = g, h.width = w);
332
332
  }
333
- }, [g, i, m]);
334
- const x = we({
335
- itemCount: n,
336
- itemProps: l,
337
- itemSize: a
338
- }), z = N(
339
- (u) => x.get(u),
340
- [x]
341
- ), T = N(
342
- () => ce({
343
- cachedBounds: x,
344
- itemCount: n,
345
- itemSize: a
333
+ }, [g, l, w]);
334
+ const z = Oe({
335
+ itemCount: o,
336
+ itemProps: i,
337
+ itemSize: u
338
+ }), k = U(
339
+ (h) => z.get(h),
340
+ [z]
341
+ ), S = U(
342
+ () => fe({
343
+ cachedBounds: z,
344
+ itemCount: o,
345
+ itemSize: u
346
346
  }),
347
- [x, n, a]
348
- ), M = N(
349
- (u) => {
350
- const I = X({
347
+ [z, o, u]
348
+ ), W = U(
349
+ (h) => {
350
+ const T = Z({
351
351
  containerElement: e,
352
352
  direction: r,
353
- isRtl: o,
354
- scrollOffset: u
353
+ isRtl: n,
354
+ scrollOffset: h
355
355
  });
356
- return oe({
357
- cachedBounds: x,
358
- containerScrollOffset: I,
359
- containerSize: O,
360
- itemCount: n,
361
- overscanCount: f
356
+ return ie({
357
+ cachedBounds: z,
358
+ containerScrollOffset: T,
359
+ containerSize: V,
360
+ itemCount: o,
361
+ overscanCount: c
362
362
  });
363
363
  },
364
364
  [
365
- x,
365
+ z,
366
366
  e,
367
- O,
367
+ V,
368
368
  r,
369
- o,
370
369
  n,
371
- f
370
+ o,
371
+ c
372
372
  ]
373
373
  );
374
- J(() => {
375
- const u = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
376
- p(M(u));
377
- }, [e, r, M]), J(() => {
374
+ q(() => {
375
+ const h = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
376
+ f(W(h));
377
+ }, [e, r, W]), q(() => {
378
378
  if (!e)
379
379
  return;
380
- const u = () => {
381
- p((I) => {
382
- const { scrollLeft: h, scrollTop: v } = e, E = X({
380
+ const h = () => {
381
+ f((T) => {
382
+ const { scrollLeft: E, scrollTop: v } = e, x = Z({
383
383
  containerElement: e,
384
384
  direction: r,
385
- isRtl: o,
386
- scrollOffset: r === "vertical" ? v : h
387
- }), q = oe({
388
- cachedBounds: x,
389
- containerScrollOffset: E,
390
- containerSize: O,
391
- itemCount: n,
392
- overscanCount: f
385
+ isRtl: n,
386
+ scrollOffset: r === "vertical" ? v : E
387
+ }), A = ie({
388
+ cachedBounds: z,
389
+ containerScrollOffset: x,
390
+ containerSize: V,
391
+ itemCount: o,
392
+ overscanCount: c
393
393
  });
394
- return Y(q, I) ? I : q;
394
+ return Y(A, T) ? T : A;
395
395
  });
396
396
  };
397
- return e.addEventListener("scroll", u), () => {
398
- e.removeEventListener("scroll", u);
397
+ return e.addEventListener("scroll", h), () => {
398
+ e.removeEventListener("scroll", h);
399
399
  };
400
400
  }, [
401
- x,
401
+ z,
402
402
  e,
403
- O,
403
+ V,
404
404
  r,
405
- n,
406
- f
405
+ o,
406
+ c
407
407
  ]);
408
- const L = Ie(
408
+ const O = ae(
409
409
  ({
410
- align: u = "auto",
411
- containerScrollOffset: I,
412
- index: h
410
+ align: h = "auto",
411
+ containerScrollOffset: T,
412
+ index: E
413
413
  }) => {
414
- let v = be({
415
- align: u,
416
- cachedBounds: x,
417
- containerScrollOffset: I,
418
- containerSize: O,
419
- index: h,
420
- itemCount: n,
421
- itemSize: a
414
+ let v = we({
415
+ align: h,
416
+ cachedBounds: z,
417
+ containerScrollOffset: T,
418
+ containerSize: V,
419
+ index: E,
420
+ itemCount: o,
421
+ itemSize: u
422
422
  });
423
423
  if (e) {
424
- if (v = X({
424
+ if (v = Z({
425
425
  containerElement: e,
426
426
  direction: r,
427
- isRtl: o,
427
+ isRtl: n,
428
428
  scrollOffset: v
429
429
  }), typeof e.scrollTo != "function") {
430
- const E = M(v);
431
- Y(d, E) || p(E);
430
+ const x = W(v);
431
+ Y(d, x) || f(x);
432
432
  }
433
433
  return v;
434
434
  }
435
435
  }
436
436
  );
437
437
  return {
438
- getCellBounds: z,
439
- getEstimatedSize: T,
440
- scrollToIndex: L,
441
- startIndexOverscan: S,
442
- startIndexVisible: y,
443
- stopIndexOverscan: b,
444
- stopIndexVisible: V
438
+ getCellBounds: k,
439
+ getEstimatedSize: S,
440
+ scrollToIndex: O,
441
+ startIndexOverscan: b,
442
+ startIndexVisible: p,
443
+ stopIndexOverscan: I,
444
+ stopIndexVisible: m
445
445
  };
446
446
  }
447
447
  function de(e) {
448
- return H(() => e, Object.values(e));
448
+ return L(() => e, Object.values(e));
449
449
  }
450
- function ae(e, t) {
450
+ function ue(e, t) {
451
451
  const {
452
452
  ariaAttributes: s,
453
453
  style: r,
454
- ...o
454
+ ...n
455
455
  } = e, {
456
- ariaAttributes: n,
457
- style: l,
458
- ...c
456
+ ariaAttributes: o,
457
+ style: i,
458
+ ...a
459
459
  } = t;
460
- return Y(s, n) && Y(r, l) && Y(o, c);
460
+ return Y(s, o) && Y(r, i) && Y(n, a);
461
461
  }
462
- function ze({
462
+ function Re({
463
463
  cellComponent: e,
464
464
  cellProps: t,
465
465
  children: s,
466
466
  className: r,
467
- columnCount: o,
468
- columnWidth: n,
469
- defaultHeight: l = 0,
470
- defaultWidth: c = 0,
471
- dir: i,
472
- gridRef: f,
467
+ columnCount: n,
468
+ columnWidth: o,
469
+ defaultHeight: i = 0,
470
+ defaultWidth: a = 0,
471
+ dir: l,
472
+ gridRef: c,
473
473
  onCellsRendered: d,
474
- onResize: p,
475
- overscanCount: y = 3,
476
- rowCount: S,
477
- rowHeight: V,
478
- style: b,
474
+ onResize: f,
475
+ overscanCount: p = 3,
476
+ rowCount: b,
477
+ rowHeight: m,
478
+ style: I,
479
479
  tagName: g = "div",
480
- ...m
480
+ ...w
481
481
  }) {
482
- const k = de(t), O = H(
483
- () => ie(e, ae),
482
+ const y = de(t), V = L(
483
+ () => le(e, ue),
484
484
  [e]
485
- ), [a, x] = j(null), z = xe(a, i), {
486
- getCellBounds: T,
487
- getEstimatedSize: M,
488
- startIndexOverscan: L,
489
- startIndexVisible: u,
490
- scrollToIndex: I,
491
- stopIndexOverscan: h,
485
+ ), [u, z] = $(null), k = ve(u, l), {
486
+ getCellBounds: S,
487
+ getEstimatedSize: W,
488
+ startIndexOverscan: O,
489
+ startIndexVisible: h,
490
+ scrollToIndex: T,
491
+ stopIndexOverscan: E,
492
492
  stopIndexVisible: v
493
- } = C({
494
- containerElement: a,
495
- containerStyle: b,
496
- defaultContainerSize: c,
493
+ } = ee({
494
+ containerElement: u,
495
+ containerStyle: I,
496
+ defaultContainerSize: a,
497
497
  direction: "horizontal",
498
- isRtl: z,
499
- itemCount: o,
500
- itemProps: k,
501
- itemSize: n,
502
- onResize: p,
503
- overscanCount: y
498
+ isRtl: k,
499
+ itemCount: n,
500
+ itemProps: y,
501
+ itemSize: o,
502
+ onResize: f,
503
+ overscanCount: p
504
504
  }), {
505
- getCellBounds: E,
506
- getEstimatedSize: q,
507
- startIndexOverscan: F,
508
- startIndexVisible: se,
505
+ getCellBounds: x,
506
+ getEstimatedSize: A,
507
+ startIndexOverscan: M,
508
+ startIndexVisible: re,
509
509
  scrollToIndex: Q,
510
- stopIndexOverscan: U,
511
- stopIndexVisible: re
512
- } = C({
513
- containerElement: a,
514
- containerStyle: b,
515
- defaultContainerSize: l,
510
+ stopIndexOverscan: _,
511
+ stopIndexVisible: ne
512
+ } = ee({
513
+ containerElement: u,
514
+ containerStyle: I,
515
+ defaultContainerSize: i,
516
516
  direction: "vertical",
517
- itemCount: S,
518
- itemProps: k,
519
- itemSize: V,
520
- onResize: p,
521
- overscanCount: y
517
+ itemCount: b,
518
+ itemProps: y,
519
+ itemSize: m,
520
+ onResize: f,
521
+ overscanCount: p
522
522
  });
523
- le(
524
- f,
523
+ ce(
524
+ c,
525
525
  () => ({
526
526
  get element() {
527
- return a;
527
+ return u;
528
528
  },
529
529
  scrollToCell({
530
- behavior: R = "auto",
531
- columnAlign: w = "auto",
532
- columnIndex: W,
533
- rowAlign: A = "auto",
534
- rowIndex: $
530
+ behavior: B = "auto",
531
+ columnAlign: R = "auto",
532
+ columnIndex: j,
533
+ rowAlign: D = "auto",
534
+ rowIndex: G
535
535
  }) {
536
- const D = I({
537
- align: w,
538
- containerScrollOffset: a?.scrollLeft ?? 0,
539
- index: W
540
- }), he = Q({
541
- align: A,
542
- containerScrollOffset: a?.scrollTop ?? 0,
543
- index: $
536
+ const N = T({
537
+ align: R,
538
+ containerScrollOffset: u?.scrollLeft ?? 0,
539
+ index: j
540
+ }), ge = Q({
541
+ align: D,
542
+ containerScrollOffset: u?.scrollTop ?? 0,
543
+ index: G
544
544
  });
545
- typeof a?.scrollTo == "function" && a.scrollTo({
546
- behavior: R,
547
- left: D,
548
- top: he
545
+ typeof u?.scrollTo == "function" && u.scrollTo({
546
+ behavior: B,
547
+ left: N,
548
+ top: ge
549
549
  });
550
550
  },
551
551
  scrollToColumn({
552
- align: R = "auto",
553
- behavior: w = "auto",
554
- index: W
552
+ align: B = "auto",
553
+ behavior: R = "auto",
554
+ index: j
555
555
  }) {
556
- const A = I({
557
- align: R,
558
- containerScrollOffset: a?.scrollLeft ?? 0,
559
- index: W
556
+ const D = T({
557
+ align: B,
558
+ containerScrollOffset: u?.scrollLeft ?? 0,
559
+ index: j
560
560
  });
561
- typeof a?.scrollTo == "function" && a.scrollTo({
562
- behavior: w,
563
- left: A
561
+ typeof u?.scrollTo == "function" && u.scrollTo({
562
+ behavior: R,
563
+ left: D
564
564
  });
565
565
  },
566
566
  scrollToRow({
567
- align: R = "auto",
568
- behavior: w = "auto",
569
- index: W
567
+ align: B = "auto",
568
+ behavior: R = "auto",
569
+ index: j
570
570
  }) {
571
- const A = Q({
572
- align: R,
573
- containerScrollOffset: a?.scrollTop ?? 0,
574
- index: W
571
+ const D = Q({
572
+ align: B,
573
+ containerScrollOffset: u?.scrollTop ?? 0,
574
+ index: j
575
575
  });
576
- typeof a?.scrollTo == "function" && a.scrollTo({
577
- behavior: w,
578
- top: A
576
+ typeof u?.scrollTo == "function" && u.scrollTo({
577
+ behavior: R,
578
+ top: D
579
579
  });
580
580
  }
581
581
  }),
582
- [a, I, Q]
583
- ), te(() => {
584
- L >= 0 && h >= 0 && F >= 0 && U >= 0 && d && d(
582
+ [u, T, Q]
583
+ ), J(() => {
584
+ O >= 0 && E >= 0 && M >= 0 && _ >= 0 && d && d(
585
585
  {
586
- columnStartIndex: u,
586
+ columnStartIndex: h,
587
587
  columnStopIndex: v,
588
- rowStartIndex: se,
589
- rowStopIndex: re
588
+ rowStartIndex: re,
589
+ rowStopIndex: ne
590
590
  },
591
591
  {
592
- columnStartIndex: L,
593
- columnStopIndex: h,
594
- rowStartIndex: F,
595
- rowStopIndex: U
592
+ columnStartIndex: O,
593
+ columnStopIndex: E,
594
+ rowStartIndex: M,
595
+ rowStopIndex: _
596
596
  }
597
597
  );
598
598
  }, [
599
599
  d,
600
- L,
601
- u,
600
+ O,
602
601
  h,
602
+ E,
603
603
  v,
604
- F,
605
- se,
606
- U,
607
- re
604
+ M,
605
+ re,
606
+ _,
607
+ ne
608
608
  ]);
609
- const fe = H(() => {
610
- const R = [];
611
- if (o > 0 && S > 0)
612
- for (let w = F; w <= U; w++) {
613
- const W = E(w), A = [];
614
- for (let $ = L; $ <= h; $++) {
615
- const D = T($);
616
- A.push(
617
- /* @__PURE__ */ P(
618
- O,
609
+ const he = L(() => {
610
+ const B = [];
611
+ if (n > 0 && b > 0)
612
+ for (let R = M; R <= _; R++) {
613
+ const j = x(R), D = [];
614
+ for (let G = O; G <= E; G++) {
615
+ const N = S(G);
616
+ D.push(
617
+ /* @__PURE__ */ X(
618
+ V,
619
619
  {
620
- ...k,
620
+ ...y,
621
621
  ariaAttributes: {
622
- "aria-colindex": $ + 1,
622
+ "aria-colindex": G + 1,
623
623
  role: "gridcell"
624
624
  },
625
- columnIndex: $,
626
- key: $,
627
- rowIndex: w,
625
+ columnIndex: G,
626
+ key: G,
627
+ rowIndex: R,
628
628
  style: {
629
629
  position: "absolute",
630
- left: z ? void 0 : 0,
631
- right: z ? 0 : void 0,
632
- transform: `translate(${z ? -D.scrollOffset : D.scrollOffset}px, ${W.scrollOffset}px)`,
633
- height: W.size,
634
- width: D.size
630
+ left: k ? void 0 : 0,
631
+ right: k ? 0 : void 0,
632
+ transform: `translate(${k ? -N.scrollOffset : N.scrollOffset}px, ${j.scrollOffset}px)`,
633
+ height: j.size,
634
+ width: N.size
635
635
  }
636
636
  }
637
637
  )
638
638
  );
639
639
  }
640
- R.push(
641
- /* @__PURE__ */ _("div", { role: "row", "aria-rowindex": w + 1, children: A }, w)
640
+ B.push(
641
+ /* @__PURE__ */ P("div", { role: "row", "aria-rowindex": R + 1, children: D }, R)
642
642
  );
643
643
  }
644
- return R;
644
+ return B;
645
645
  }, [
646
+ V,
647
+ y,
648
+ n,
646
649
  O,
647
- k,
648
- o,
649
- L,
650
- h,
651
- T,
652
650
  E,
653
- z,
654
651
  S,
655
- F,
656
- U
657
- ]), ue = /* @__PURE__ */ _(
652
+ x,
653
+ k,
654
+ b,
655
+ M,
656
+ _
657
+ ]), pe = /* @__PURE__ */ P(
658
658
  "div",
659
659
  {
660
660
  "aria-hidden": !0,
661
661
  style: {
662
- height: q(),
663
- width: M(),
662
+ height: A(),
663
+ width: W(),
664
664
  zIndex: -1
665
665
  }
666
666
  }
667
667
  );
668
- return P(
668
+ return X(
669
669
  g,
670
670
  {
671
- "aria-colcount": o,
672
- "aria-rowcount": S,
671
+ "aria-colcount": n,
672
+ "aria-rowcount": b,
673
673
  role: "grid",
674
- ...m,
674
+ ...w,
675
675
  className: r,
676
- dir: i,
677
- ref: x,
676
+ dir: l,
677
+ ref: z,
678
678
  style: {
679
679
  position: "relative",
680
680
  width: "100%",
@@ -683,177 +683,266 @@ function ze({
683
683
  maxWidth: "100%",
684
684
  flexGrow: 1,
685
685
  overflow: "auto",
686
- ...b
686
+ ...I
687
687
  }
688
688
  },
689
- fe,
689
+ he,
690
690
  s,
691
- ue
691
+ pe
692
692
  );
693
693
  }
694
- const Te = j, Ve = K;
695
- function ke({
694
+ const Ve = $, Ee = K;
695
+ function ze(e) {
696
+ return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
697
+ }
698
+ const te = "data-react-window-index";
699
+ function Ae({
696
700
  children: e,
697
701
  className: t,
698
702
  defaultHeight: s = 0,
699
703
  listRef: r,
700
- onResize: o,
701
- onRowsRendered: n,
702
- overscanCount: l = 3,
703
- rowComponent: c,
704
- rowCount: i,
705
- rowHeight: f,
704
+ onResize: n,
705
+ onRowsRendered: o,
706
+ overscanCount: i = 3,
707
+ rowComponent: a,
708
+ rowCount: l,
709
+ rowHeight: c,
706
710
  rowProps: d,
707
- tagName: p = "div",
708
- style: y,
709
- ...S
711
+ tagName: f = "div",
712
+ style: p,
713
+ ...b
710
714
  }) {
711
- const V = de(d), b = H(
712
- () => ie(c, ae),
713
- [c]
714
- ), [g, m] = j(null), {
715
- getCellBounds: k,
716
- getEstimatedSize: O,
717
- scrollToIndex: a,
718
- startIndexOverscan: x,
719
- startIndexVisible: z,
720
- stopIndexOverscan: T,
721
- stopIndexVisible: M
722
- } = C({
715
+ const m = de(d), I = L(
716
+ () => le(a, ue),
717
+ [a]
718
+ ), [g, w] = $(null), y = ze(c), V = L(() => y ? (v) => c.getRowHeight(v) ?? c.getAverageRowHeight() : c, [y, c]), {
719
+ getCellBounds: u,
720
+ getEstimatedSize: z,
721
+ scrollToIndex: k,
722
+ startIndexOverscan: S,
723
+ startIndexVisible: W,
724
+ stopIndexOverscan: O,
725
+ stopIndexVisible: h
726
+ } = ee({
723
727
  containerElement: g,
724
- containerStyle: y,
728
+ containerStyle: p,
725
729
  defaultContainerSize: s,
726
730
  direction: "vertical",
727
- itemCount: i,
728
- itemProps: V,
729
- itemSize: f,
730
- onResize: o,
731
- overscanCount: l
731
+ itemCount: l,
732
+ itemProps: m,
733
+ itemSize: V,
734
+ onResize: n,
735
+ overscanCount: i
732
736
  });
733
- le(
737
+ ce(
734
738
  r,
735
739
  () => ({
736
740
  get element() {
737
741
  return g;
738
742
  },
739
743
  scrollToRow({
740
- align: I = "auto",
741
- behavior: h = "auto",
742
- index: v
744
+ align: v = "auto",
745
+ behavior: x = "auto",
746
+ index: A
743
747
  }) {
744
- const E = a({
745
- align: I,
748
+ const M = k({
749
+ align: v,
746
750
  containerScrollOffset: g?.scrollTop ?? 0,
747
- index: v
751
+ index: A
748
752
  });
749
753
  typeof g?.scrollTo == "function" && g.scrollTo({
750
- behavior: h,
751
- top: E
754
+ behavior: x,
755
+ top: M
752
756
  });
753
757
  }
754
758
  }),
755
- [g, a]
756
- ), te(() => {
757
- x >= 0 && T >= 0 && n && n(
759
+ [g, k]
760
+ ), q(() => {
761
+ if (!g)
762
+ return;
763
+ const v = Array.from(g.children).filter((x, A) => {
764
+ if (x.hasAttribute("aria-hidden"))
765
+ return !1;
766
+ const M = `${S + A}`;
767
+ return x.setAttribute(te, M), !0;
768
+ });
769
+ if (y)
770
+ return c.observeRowElements(v);
771
+ }, [
772
+ g,
773
+ y,
774
+ c,
775
+ S,
776
+ O
777
+ ]), J(() => {
778
+ S >= 0 && O >= 0 && o && o(
758
779
  {
759
- startIndex: z,
760
- stopIndex: M
780
+ startIndex: W,
781
+ stopIndex: h
761
782
  },
762
783
  {
763
- startIndex: x,
764
- stopIndex: T
784
+ startIndex: S,
785
+ stopIndex: O
765
786
  }
766
787
  );
767
788
  }, [
768
- n,
769
- x,
770
- z,
771
- T,
772
- M
789
+ o,
790
+ S,
791
+ W,
792
+ O,
793
+ h
773
794
  ]);
774
- const L = H(() => {
775
- const I = [];
776
- if (i > 0)
777
- for (let h = x; h <= T; h++) {
778
- const v = k(h);
779
- I.push(
780
- /* @__PURE__ */ P(
781
- b,
795
+ const T = L(() => {
796
+ const v = [];
797
+ if (l > 0)
798
+ for (let x = S; x <= O; x++) {
799
+ const A = u(x);
800
+ v.push(
801
+ /* @__PURE__ */ X(
802
+ I,
782
803
  {
783
- ...V,
804
+ ...m,
784
805
  ariaAttributes: {
785
- "aria-posinset": h + 1,
786
- "aria-setsize": i,
806
+ "aria-posinset": x + 1,
807
+ "aria-setsize": l,
787
808
  role: "listitem"
788
809
  },
789
- key: h,
790
- index: h,
810
+ key: x,
811
+ index: x,
791
812
  style: {
792
813
  position: "absolute",
793
814
  left: 0,
794
- transform: `translateY(${v.scrollOffset}px)`,
795
- height: v.size,
815
+ transform: `translateY(${A.scrollOffset}px)`,
816
+ // In case of dynamic row heights, don't specify a height style
817
+ // otherwise a default/estimated height would mask the actual height
818
+ height: y ? void 0 : A.size,
796
819
  width: "100%"
797
820
  }
798
821
  }
799
822
  )
800
823
  );
801
824
  }
802
- return I;
825
+ return v;
803
826
  }, [
804
- b,
805
- k,
806
- i,
807
- V,
808
- x,
809
- T
810
- ]), u = /* @__PURE__ */ _(
827
+ I,
828
+ u,
829
+ y,
830
+ l,
831
+ m,
832
+ S,
833
+ O
834
+ ]), E = /* @__PURE__ */ P(
811
835
  "div",
812
836
  {
813
837
  "aria-hidden": !0,
814
838
  style: {
815
- height: O(),
839
+ height: z(),
816
840
  width: "100%",
817
841
  zIndex: -1
818
842
  }
819
843
  }
820
844
  );
821
- return P(
822
- p,
845
+ return X(
846
+ f,
823
847
  {
824
848
  role: "list",
825
- ...S,
849
+ ...b,
826
850
  className: t,
827
- ref: m,
851
+ ref: w,
828
852
  style: {
829
853
  position: "relative",
830
854
  maxHeight: "100%",
831
855
  flexGrow: 1,
832
856
  overflowY: "auto",
833
- ...y
857
+ ...p
834
858
  }
835
859
  },
836
- L,
860
+ T,
837
861
  e,
838
- u
862
+ E
863
+ );
864
+ }
865
+ function ke({
866
+ defaultRowHeight: e,
867
+ key: t
868
+ }) {
869
+ const [s, r] = $({
870
+ key: t,
871
+ map: /* @__PURE__ */ new Map()
872
+ });
873
+ s.key !== t && r({
874
+ key: t,
875
+ map: /* @__PURE__ */ new Map()
876
+ });
877
+ const { map: n } = s, o = U(() => {
878
+ let f = 0;
879
+ return n.forEach((p) => {
880
+ f += p;
881
+ }), f === 0 ? e : f / n.size;
882
+ }, [e, n]), i = U(
883
+ (f) => n.get(f),
884
+ [n]
885
+ ), a = U((f, p) => {
886
+ r((b) => {
887
+ if (b.map.get(f) === p)
888
+ return b;
889
+ const m = new Map(b.map);
890
+ return m.set(f, p), {
891
+ ...b,
892
+ map: m
893
+ };
894
+ });
895
+ }, []), l = ae(
896
+ (f) => {
897
+ f.length !== 0 && f.forEach((p) => {
898
+ const { borderBoxSize: b, target: m } = p, I = m.getAttribute(te);
899
+ H(
900
+ I !== null,
901
+ `Invalid ${te} attribute value`
902
+ );
903
+ const g = parseInt(I), { blockSize: w } = b[0];
904
+ w && a(g, w);
905
+ });
906
+ }
907
+ ), [c] = $(
908
+ () => new ResizeObserver(l)
909
+ );
910
+ J(() => () => {
911
+ c.disconnect();
912
+ }, [c]);
913
+ const d = U(
914
+ (f) => (f.forEach((p) => c.observe(p)), () => {
915
+ f.forEach((p) => c.unobserve(p));
916
+ }),
917
+ [c]
918
+ );
919
+ return L(
920
+ () => ({
921
+ getAverageRowHeight: o,
922
+ getRowHeight: i,
923
+ setRowHeight: a,
924
+ observeRowElements: d
925
+ }),
926
+ [o, i, a, d]
839
927
  );
840
928
  }
841
- const Le = j, Ee = K;
842
- let Z = -1;
843
- function Me(e = !1) {
844
- if (Z === -1 || e) {
929
+ const Le = $, Me = K;
930
+ let C = -1;
931
+ function He(e = !1) {
932
+ if (C === -1 || e) {
845
933
  const t = document.createElement("div"), s = t.style;
846
- s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), Z = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
934
+ s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), C = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
847
935
  }
848
- return Z;
936
+ return C;
849
937
  }
850
938
  export {
851
- ze as Grid,
852
- ke as List,
853
- Me as getScrollbarSize,
854
- Te as useGridCallbackRef,
855
- Ve as useGridRef,
939
+ Re as Grid,
940
+ Ae as List,
941
+ He as getScrollbarSize,
942
+ ke as useDynamicRowHeight,
943
+ Ve as useGridCallbackRef,
944
+ Ee as useGridRef,
856
945
  Le as useListCallbackRef,
857
- Ee as useListRef
946
+ Me as useListRef
858
947
  };
859
948
  //# sourceMappingURL=react-window.js.map