react-window 2.0.1 → 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 (75) hide show
  1. package/README.md +8 -9
  2. package/dist/react-window.cjs +1 -1
  3. package/dist/react-window.cjs.map +1 -1
  4. package/dist/react-window.js +322 -317
  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-e4JJmmZM.js.map → CellComponent.example-B6rd3A81.js.map} +1 -1
  8. package/docs/assets/{ComponentProps-DMkeake1.js → ComponentProps-DjtQqosW.js} +2 -2
  9. package/docs/assets/{ComponentProps-DMkeake1.js.map → ComponentProps-DjtQqosW.js.map} +1 -1
  10. package/docs/assets/ContinueLink-BgDdBmAq.js +2 -0
  11. package/docs/assets/{ContinueLink-CbPhCk1k.js.map → ContinueLink-BgDdBmAq.js.map} +1 -1
  12. package/docs/assets/{FixedRowHeightsRoute-D8GuxxOL.js → FixedRowHeightsRoute-D2uTbdlK.js} +2 -2
  13. package/docs/assets/{FixedRowHeightsRoute-D8GuxxOL.js.map → FixedRowHeightsRoute-D2uTbdlK.js.map} +1 -1
  14. package/docs/assets/{FormattedCode-CAmuOSRw.js → FormattedCode-Bgu5KYpx.js} +2 -2
  15. package/docs/assets/{FormattedCode-CAmuOSRw.js.map → FormattedCode-Bgu5KYpx.js.map} +1 -1
  16. package/docs/assets/{GettingStartedRoute-zN9jVy3e.js → GettingStartedRoute-DFMvu5xc.js} +2 -2
  17. package/docs/assets/{GettingStartedRoute-zN9jVy3e.js.map → GettingStartedRoute-DFMvu5xc.js.map} +1 -1
  18. package/docs/assets/Grid-BmNZGHKY.js +2 -0
  19. package/docs/assets/Grid-BmNZGHKY.js.map +1 -0
  20. package/docs/assets/{Header-BYp8JKXz.js → Header-D5XYa_k5.js} +2 -2
  21. package/docs/assets/{Header-BYp8JKXz.js.map → Header-D5XYa_k5.js.map} +1 -1
  22. package/docs/assets/{HorizontalListsRoute-rNcKbQ1k.js → HorizontalListsRoute-BshOgFUz.js} +2 -2
  23. package/docs/assets/{HorizontalListsRoute-rNcKbQ1k.js.map → HorizontalListsRoute-BshOgFUz.js.map} +1 -1
  24. package/docs/assets/{ImperativeApiRoute-DntU9ReR.js → ImperativeApiRoute-BAWsk-vD.js} +2 -2
  25. package/docs/assets/{ImperativeApiRoute-DntU9ReR.js.map → ImperativeApiRoute-BAWsk-vD.js.map} +1 -1
  26. package/docs/assets/{ImperativeApiRoute-DD9Z7HWg.js → ImperativeApiRoute-DQIcyOMg.js} +2 -2
  27. package/docs/assets/ImperativeApiRoute-DQIcyOMg.js.map +1 -0
  28. package/docs/assets/List-C7ANWJ5i.js +2 -0
  29. package/docs/assets/List-C7ANWJ5i.js.map +1 -0
  30. package/docs/assets/{LoadingSpinner-Z5HQViRD.js → LoadingSpinner-C5G0kF8B.js} +2 -2
  31. package/docs/assets/{LoadingSpinner-Z5HQViRD.js.map → LoadingSpinner-C5G0kF8B.js.map} +1 -1
  32. package/docs/assets/{PageNotFound-B0nx-Cz_.js → PageNotFound-CmFn1Y8A.js} +2 -2
  33. package/docs/assets/{PageNotFound-B0nx-Cz_.js.map → PageNotFound-CmFn1Y8A.js.map} +1 -1
  34. package/docs/assets/{PlatformRequirementsRoute-C00ZSzCF.js → PlatformRequirementsRoute-DrlH5Zzd.js} +2 -2
  35. package/docs/assets/{PlatformRequirementsRoute-C00ZSzCF.js.map → PlatformRequirementsRoute-DrlH5Zzd.js.map} +1 -1
  36. package/docs/assets/PropsRoute-Du5tQlP4.js +2 -0
  37. package/docs/assets/{PropsRoute-D9jETWHk.js.map → PropsRoute-Du5tQlP4.js.map} +1 -1
  38. package/docs/assets/PropsRoute-Y6h__YZK.js +2 -0
  39. package/docs/assets/{PropsRoute-D77WXdPD.js.map → PropsRoute-Y6h__YZK.js.map} +1 -1
  40. package/docs/assets/{RTLGridsRoute-C49T7mLs.js → RTLGridsRoute-Bh6j-Do_.js} +2 -2
  41. package/docs/assets/{RTLGridsRoute-C49T7mLs.js.map → RTLGridsRoute-Bh6j-Do_.js.map} +1 -1
  42. package/docs/assets/{RenderingGridRoute-pTuxJ89O.js → RenderingGridRoute-BiAH8mBy.js} +2 -2
  43. package/docs/assets/{RenderingGridRoute-pTuxJ89O.js.map → RenderingGridRoute-BiAH8mBy.js.map} +1 -1
  44. package/docs/assets/{ScratchpadRoute-AXfI00Be.js → ScratchpadRoute-NKLpLi0x.js} +2 -2
  45. package/docs/assets/{ScratchpadRoute-AXfI00Be.js.map → ScratchpadRoute-NKLpLi0x.js.map} +1 -1
  46. package/docs/assets/{Select-C5ovWBbK.js → Select-DYzOjrIR.js} +2 -2
  47. package/docs/assets/{Select-C5ovWBbK.js.map → Select-DYzOjrIR.js.map} +1 -1
  48. package/docs/assets/{SupportRoute-C1V_AF9b.js → SupportRoute-B3HtlCgf.js} +2 -2
  49. package/docs/assets/{SupportRoute-C1V_AF9b.js.map → SupportRoute-B3HtlCgf.js.map} +1 -1
  50. package/docs/assets/{TabularDataRoute-B79B4UDS.js → TabularDataRoute-Dw2CznU_.js} +2 -2
  51. package/docs/assets/{TabularDataRoute-B79B4UDS.js.map → TabularDataRoute-Dw2CznU_.js.map} +1 -1
  52. package/docs/assets/{VariableRowHeightsRoute-Bf7uZQG0.js → VariableRowHeightsRoute-BtjBfaPU.js} +2 -2
  53. package/docs/assets/{VariableRowHeightsRoute-Bf7uZQG0.js.map → VariableRowHeightsRoute-BtjBfaPU.js.map} +1 -1
  54. package/docs/assets/arePropsEqual-J86giKVT.js +2 -0
  55. package/docs/assets/arePropsEqual-J86giKVT.js.map +1 -0
  56. package/docs/assets/{index-B_YQ7rlN.js → index-6dOV2kLd.js} +3 -3
  57. package/docs/assets/{index-B_YQ7rlN.js.map → index-6dOV2kLd.js.map} +1 -1
  58. package/docs/assets/{useCitiesByState-azL1M3ue.js → useCitiesByState-aLkpFxPh.js} +2 -2
  59. package/docs/assets/{useCitiesByState-azL1M3ue.js.map → useCitiesByState-aLkpFxPh.js.map} +1 -1
  60. package/docs/assets/{useContacts-BItVOkyi.js → useContacts-QMK0xyhD.js} +2 -2
  61. package/docs/assets/{useContacts-BItVOkyi.js.map → useContacts-QMK0xyhD.js.map} +1 -1
  62. package/docs/index.html +1 -1
  63. package/docs/stats.html +1 -1
  64. package/package.json +1 -1
  65. package/docs/assets/CellComponent.example-e4JJmmZM.js +0 -2
  66. package/docs/assets/ContinueLink-CbPhCk1k.js +0 -2
  67. package/docs/assets/Grid-DH-j7ODh.js +0 -2
  68. package/docs/assets/Grid-DH-j7ODh.js.map +0 -1
  69. package/docs/assets/ImperativeApiRoute-DD9Z7HWg.js.map +0 -1
  70. package/docs/assets/List-C4KHYcVU.js +0 -2
  71. package/docs/assets/List-C4KHYcVU.js.map +0 -1
  72. package/docs/assets/PropsRoute-D77WXdPD.js +0 -2
  73. package/docs/assets/PropsRoute-D9jETWHk.js +0 -2
  74. package/docs/assets/arePropsEqual-D3jAKwxp.js +0 -2
  75. package/docs/assets/arePropsEqual-D3jAKwxp.js.map +0 -1
package/README.md CHANGED
@@ -2,15 +2,17 @@
2
2
 
3
3
  `react-window` is a component library that helps render large lists of data quickly and without the performance problems that often go along with rendering a lot of data. It's used in a lot of places, from React DevTools to the Replay browser.
4
4
 
5
- ## Sponsors
5
+ ## Support
6
6
 
7
- If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or [buy me a coffee](http://givebrian.coffee/).
7
+ If you like this project there are several ways to support it:
8
8
 
9
- The following wonderful companies have sponsored react-window:
9
+ - [Become a GitHub sponsor](https://github.com/sponsors/bvaughn/)
10
+ - [Become an Open Collective sponsor](https://opencollective.com/react-window#sponsor)
11
+ - or [buy me a coffee](http://givebrian.coffee/)
10
12
 
11
- <a href="https://opencollective.com/react-window/sponsor/0/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/1/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/2/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/3/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/4/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/5/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/6/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/7/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/8/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/9/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/10/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/10/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/11/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/11/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/12/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/12/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/13/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/13/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/14/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/14/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/15/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/15/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/16/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/16/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/17/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/17/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/18/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/18/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/19/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/19/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/20/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/20/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/21/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/21/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/22/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/22/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/23/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/23/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/24/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/24/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/25/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/25/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/26/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/26/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/27/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/27/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/28/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/28/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/29/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/29/avatar.svg"></a>
13
+ The following wonderful companies and individuals have sponsored react-window:
12
14
 
13
- [Learn more about becoming a sponsor!](https://opencollective.com/react-window#sponsor)
15
+ <a href="https://opencollective.com/react-window/sponsor/0/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/1/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/2/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/3/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/4/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/5/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/6/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/7/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/8/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/9/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/10/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/10/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/11/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/11/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/12/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/12/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/13/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/13/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/14/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/14/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/15/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/15/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/16/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/16/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/17/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/17/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/18/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/18/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/19/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/19/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/20/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/20/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/21/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/21/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/22/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/22/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/23/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/23/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/24/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/24/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/25/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/25/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/26/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/26/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/27/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/27/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/28/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/28/avatar.svg"></a> <a href="https://opencollective.com/react-window/sponsor/29/website" target="_blank"><img src="https://opencollective.com/react-window/sponsor/29/avatar.svg"></a>
14
16
 
15
17
  <a href="https://opencollective.com/react-window/backer/0/website" target="_blank"><img src="https://opencollective.com/react-window/backer/0/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/1/website" target="_blank"><img src="https://opencollective.com/react-window/backer/1/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/2/website" target="_blank"><img src="https://opencollective.com/react-window/backer/2/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/3/website" target="_blank"><img src="https://opencollective.com/react-window/backer/3/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/4/website" target="_blank"><img src="https://opencollective.com/react-window/backer/4/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/5/website" target="_blank"><img src="https://opencollective.com/react-window/backer/5/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/6/website" target="_blank"><img src="https://opencollective.com/react-window/backer/6/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/7/website" target="_blank"><img src="https://opencollective.com/react-window/backer/7/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/8/website" target="_blank"><img src="https://opencollective.com/react-window/backer/8/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/9/website" target="_blank"><img src="https://opencollective.com/react-window/backer/9/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/10/website" target="_blank"><img src="https://opencollective.com/react-window/backer/10/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/11/website" target="_blank"><img src="https://opencollective.com/react-window/backer/11/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/12/website" target="_blank"><img src="https://opencollective.com/react-window/backer/12/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/13/website" target="_blank"><img src="https://opencollective.com/react-window/backer/13/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/14/website" target="_blank"><img src="https://opencollective.com/react-window/backer/14/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/15/website" target="_blank"><img src="https://opencollective.com/react-window/backer/15/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/16/website" target="_blank"><img src="https://opencollective.com/react-window/backer/16/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/17/website" target="_blank"><img src="https://opencollective.com/react-window/backer/17/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/18/website" target="_blank"><img src="https://opencollective.com/react-window/backer/18/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/19/website" target="_blank"><img src="https://opencollective.com/react-window/backer/19/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/20/website" target="_blank"><img src="https://opencollective.com/react-window/backer/20/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/21/website" target="_blank"><img src="https://opencollective.com/react-window/backer/21/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/22/website" target="_blank"><img src="https://opencollective.com/react-window/backer/22/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/23/website" target="_blank"><img src="https://opencollective.com/react-window/backer/23/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/24/website" target="_blank"><img src="https://opencollective.com/react-window/backer/24/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/25/website" target="_blank"><img src="https://opencollective.com/react-window/backer/25/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/26/website" target="_blank"><img src="https://opencollective.com/react-window/backer/26/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/27/website" target="_blank"><img src="https://opencollective.com/react-window/backer/27/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/28/website" target="_blank"><img src="https://opencollective.com/react-window/backer/28/avatar.svg"></a> <a href="https://opencollective.com/react-window/backer/29/website" target="_blank"><img src="https://opencollective.com/react-window/backer/29/avatar.svg"></a>
16
18
 
@@ -22,8 +24,6 @@ Begin by installing the library from NPM:
22
24
  npm install react-window
23
25
  ```
24
26
 
25
- and documentation is included within the docs folder.
26
-
27
27
  ## Documentation
28
28
 
29
29
  Documentation for this project is available at [react-window.vercel.app](https://react-window.vercel.app/).
@@ -38,8 +38,7 @@ npx serve -s docs
38
38
  npx serve -s ./node_modules/react-window/docs
39
39
  ```
40
40
 
41
- > [!NOTE]
42
- > Older version 1.x documentation can be found at [react-window-v1.vercel.app](https://react-window-v1.vercel.app/) or on the NPM page for a specific version, e.g. [1.8.11](https://www.npmjs.com/package/react-window/v/1.8.11).)
41
+ > **Note**: Older version 1.x documentation can be found at [react-window-v1.vercel.app](https://react-window-v1.vercel.app/) or on the NPM page for a specific version, e.g. [1.8.11](https://www.npmjs.com/package/react-window/v/1.8.11).)
43
42
 
44
43
  ## TypeScript types
45
44
 
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),n=require("react");function Z(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function _(e,t){const[s,r]=n.useState(t==="rtl");return n.useLayoutEffect(()=>{e&&(t||r(Z(e)))},[t,e]),s}const F=typeof window<"u"?n.useLayoutEffect:n.useEffect;function P(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function N({box:e,defaultHeight:t,defaultWidth:s,disabled:r,element:o,mode:l,style:c}){const{styleHeight:f,styleWidth:i}=n.useMemo(()=>({styleHeight:P(c?.height),styleWidth:P(c?.width)}),[c?.height,c?.width]),[u,g]=n.useState({height:t,width:s}),z=r||l==="only-height"&&f!==void 0||l==="only-width"&&i!==void 0||f!==void 0&&i!==void 0;return F(()=>{if(o===null||z)return;const x=new ResizeObserver(L=>{for(const v of L){const{contentRect:w,target:S}=v;o===S&&g(p=>p.height===w.height&&p.width===w.width?p:{height:w.height,width:w.width})}});return x.observe(o,{box:e}),()=>{x?.unobserve(o)}},[e,z,o,f,i]),n.useMemo(()=>({height:f??u.height,width:i??u.width}),[u,f,i])}function ee(e){const t=n.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return F(()=>{t.current=e},[e]),n.useCallback(s=>t.current?.(s),[t])}let G=null;function te(e=!1){if(G===null||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",s.direction="rtl";const r=document.createElement("div"),o=r.style;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}return G}function U({containerElement:e,direction:t,isRtl:s,scrollOffset:r}){if(t==="horizontal"&&s)switch(te()){case"negative":return-r;case"positive-descending":{if(e){const{clientWidth:o,scrollLeft:l,scrollWidth:c}=e;return c-o-l}break}}return r}function E(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function J({cachedBounds:e,itemCount:t,itemSize:s}){if(t===0)return 0;if(typeof s=="number")return t*s;{const r=e.get(e.size===0?0:e.size-1);E(r!==void 0,"Unexpected bounds cache miss");const o=(r.scrollOffset+r.size)/e.size;return t*o}}function se({align:e,cachedBounds:t,index:s,itemCount:r,itemSize:o,containerScrollOffset:l,containerSize:c}){const f=J({cachedBounds:t,itemCount:r,itemSize:o}),i=t.get(s),u=Math.max(0,Math.min(f-c,i.scrollOffset)),g=Math.max(0,i.scrollOffset-c+i.size);switch(e==="smart"&&(l>=g&&l<=u?e="auto":e="center"),e){case"start":return u;case"end":return g;case"center":return i.scrollOffset<=c/2?0:i.scrollOffset+i.size/2>=f-c/2?f-c:i.scrollOffset+i.size/2-c/2;case"auto":default:return l>=g&&l<=u?l:l<g?g:u}}function Y({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:r,overscanCount:o}){const l=r-1;let c=0,f=-1,i=0;for(;i<l;){const u=e.get(i);if(u.scrollOffset+u.size>t)break;i++}for(c=i,c=Math.max(0,c-o);i<l;){const u=e.get(i);if(u.scrollOffset+u.size>=t+s)break;i++}return f=Math.min(l,i),f=Math.min(r-1,f+o),c<0?[0,-1]:[c,f]}function re({itemCount:e,itemProps:t,itemSize:s}){const r=new Map;return{get(o){for(E(o<e,`Invalid index ${o}`);r.size-1<o;){const c=r.size;let f;switch(typeof s){case"function":{f=s(c,t);break}case"number":{f=s;break}}if(c===0)r.set(c,{size:f,scrollOffset:0});else{const i=r.get(c-1);E(i!==void 0,`Unexpected bounds cache miss for index ${o}`),r.set(c,{scrollOffset:i.scrollOffset+i.size,size:f})}}const l=r.get(o);return E(l!==void 0,`Unexpected bounds cache miss for index ${o}`),l},set(o,l){r.set(o,l)},get size(){return r.size}}}function oe({itemCount:e,itemProps:t,itemSize:s}){return n.useMemo(()=>re({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function le({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{E(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),E(e!==void 0,"Container size must be defined if a percentage item size is specified"),s=e*parseInt(t)/100;break}default:{s=t;break}}return s}function D({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:r,isRtl:o=!1,itemCount:l,itemProps:c,itemSize:f,onResize:i,overscanCount:u}){const[g,z]=n.useState([0,-1]),[x,L]=[Math.min(l-1,g[0]),Math.min(l-1,g[1])],{height:v=s,width:w=s}=N({defaultHeight:r==="vertical"?s:void 0,defaultWidth:r==="horizontal"?s:void 0,element:e,mode:r==="vertical"?"only-height":"only-width",style:t}),S=n.useRef({height:0,width:0}),p=r==="vertical"?v:w,a=le({containerSize:p,itemSize:f});n.useLayoutEffect(()=>{if(typeof i=="function"){const d=S.current;(d.height!==v||d.width!==w)&&(i({height:v,width:w},{...d}),d.height=v,d.width=w)}},[v,i,w]);const h=oe({itemCount:l,itemProps:c,itemSize:a}),y=n.useCallback(d=>h.get(d),[h]),W=n.useCallback(()=>J({cachedBounds:h,itemCount:l,itemSize:a}),[h,l,a]),k=n.useCallback(d=>{const b=U({containerElement:e,direction:r,isRtl:o,scrollOffset:d});return Y({cachedBounds:h,containerScrollOffset:b,containerSize:p,itemCount:l,overscanCount:u})},[h,e,p,r,o,l,u]);F(()=>{const d=(r==="vertical"?e?.scrollTop:e?.scrollLeft)??0;z(k(d))},[e,r,k]),F(()=>{if(!e)return;const d=()=>{z(b=>{const{scrollLeft:$,scrollTop:H}=e,I=U({containerElement:e,direction:r,isRtl:o,scrollOffset:r==="vertical"?H:$}),O=Y({cachedBounds:h,containerScrollOffset:I,containerSize:p,itemCount:l,overscanCount:u});return O[0]===b[0]&&O[1]===b[1]?b:O})};return e.addEventListener("scroll",d),()=>{e.removeEventListener("scroll",d)}},[h,e,p,r,l,u]);const m=ee(({align:d="auto",behavior:b="auto",containerScrollOffset:$,index:H})=>{let I=se({align:d,cachedBounds:h,containerScrollOffset:$,containerSize:p,index:H,itemCount:l,itemSize:a});if(e)if(I=U({containerElement:e,direction:r,isRtl:o,scrollOffset:I}),typeof e.scrollTo=="function")r==="horizontal"?e.scrollTo({left:I,behavior:b||void 0}):e.scrollTo({behavior:b||void 0,top:I});else{const O=k(I);(O[0]!==x||O[1]!==L)&&z(O)}});return{getCellBounds:y,getEstimatedSize:W,scrollToIndex:m,startIndex:x,stopIndex:L}}function K(e){return n.useMemo(()=>e,Object.values(e))}function A(e,t){if(e===t)return!0;if(!!e!=!!t||(E(e!==void 0),E(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(const s in e)if(!Object.is(t[s],e[s]))return!1;return!0}function Q(e,t){const{style:s,...r}=e,{style:o,...l}=t;return A(s,o)&&A(r,l)}function ie({cellComponent:e,cellProps:t,className:s,columnCount:r,columnWidth:o,defaultHeight:l=0,defaultWidth:c=0,dir:f,gridRef:i,onCellsRendered:u,onResize:g,overscanCount:z=3,rowCount:x,rowHeight:L,style:v,...w}){const S=K(t),p=n.useMemo(()=>n.memo(e,Q),[e]),[a,h]=n.useState(null),y=_(a,f),{getCellBounds:W,getEstimatedSize:k,startIndex:m,scrollToIndex:d,stopIndex:b}=D({containerElement:a,defaultContainerSize:c,direction:"horizontal",isRtl:y,itemCount:r,itemProps:S,itemSize:o,onResize:g,overscanCount:z}),{getCellBounds:$,getEstimatedSize:H,startIndex:I,scrollToIndex:O,stopIndex:B}=D({containerElement:a,defaultContainerSize:l,direction:"vertical",itemCount:x,itemProps:S,itemSize:L,onResize:g,overscanCount:z});n.useImperativeHandle(i,()=>({get element(){return a},scrollToCell({behavior:M="auto",columnAlign:T="auto",columnIndex:R,rowAlign:j="auto",rowIndex:C}){O({align:j,behavior:M,containerScrollOffset:a?.scrollTop??0,index:C}),d({align:T,behavior:M,containerScrollOffset:a?.scrollLeft??0,index:R})},scrollToColumn({align:M="auto",behavior:T="auto",index:R}){d({align:M,behavior:T,containerScrollOffset:a?.scrollLeft??0,index:R})},scrollToRow({align:M="auto",behavior:T="auto",index:R}){O({align:M,behavior:T,containerScrollOffset:a?.scrollTop??0,index:R})}}),[a,d,O]),n.useEffect(()=>{m>=0&&b>=0&&I>=0&&B>=0&&u&&u({columnStartIndex:m,columnStopIndex:b,rowStartIndex:I,rowStopIndex:B})},[u,m,b,I,B]);const X=n.useMemo(()=>{const M=[];if(r>0&&x>0)for(let T=I;T<=B;T++){const R=$(T);for(let j=m;j<=b;j++){const C=W(j);M.push(n.createElement(p,{...S,columnIndex:j,key:`${T}-${j}`,rowIndex:T,style:{position:"absolute",left:y?void 0:0,right:y?0:void 0,transform:`translate(${y?-C.scrollOffset:C.scrollOffset}px, ${R.scrollOffset}px)`,height:x>1?R.size:"100%",width:C.size}}))}}return M},[p,S,r,m,b,W,$,y,x,I,B]);return q.jsx("div",{...w,className:s,dir:f,ref:h,style:{width:"100%",height:"100%",...v,maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto"},children:q.jsx("div",{className:s,style:{position:"relative",height:H(),width:k()},children:X})})}const ne=n.useState,ce=n.useRef;function fe({className:e,defaultHeight:t=0,listRef:s,onResize:r,onRowsRendered:o,overscanCount:l=3,rowComponent:c,rowCount:f,rowHeight:i,rowProps:u,style:g,...z}){const x=K(u),L=n.useMemo(()=>n.memo(c,Q),[c]),[v,w]=n.useState(null),{getCellBounds:S,getEstimatedSize:p,scrollToIndex:a,startIndex:h,stopIndex:y}=D({containerElement:v,defaultContainerSize:t,direction:"vertical",itemCount:f,itemProps:x,itemSize:i,onResize:r,overscanCount:l});n.useImperativeHandle(s,()=>({get element(){return v},scrollToRow({align:k="auto",behavior:m="auto",index:d}){a({align:k,behavior:m,containerScrollOffset:v?.scrollTop??0,index:d})}}),[v,a]),n.useEffect(()=>{h>=0&&y>=0&&o&&o({startIndex:h,stopIndex:y})},[o,h,y]);const W=n.useMemo(()=>{const k=[];if(f>0)for(let m=h;m<=y;m++){const d=S(m);k.push(n.createElement(L,{...x,key:m,index:m,style:{position:"absolute",left:0,transform:`translateY(${d.scrollOffset}px)`,height:d.size,width:"100%"}}))}return k},[L,S,f,x,h,y]);return q.jsx("div",{...z,className:e,ref:w,style:{...g,maxHeight:"100%",flexGrow:1,overflowY:"auto"},children:q.jsx("div",{className:e,style:{height:p(),position:"relative",width:"100%"},children:W})})}const ue=n.useState,de=n.useRef;let V=-1;function ae(e=!1){if(V===-1||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",document.body.appendChild(t),V=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return V}exports.Grid=ie;exports.List=fe;exports.getScrollbarSize=ae;exports.useGridCallbackRef=ne;exports.useGridRef=ce;exports.useListCallbackRef=ue;exports.useListRef=de;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),i=require("react");function N(e){let t=e;for(;t;){if(t.dir)return t.dir==="rtl";t=t.parentElement}return!1}function ee(e,t){const[s,o]=i.useState(t==="rtl");return i.useLayoutEffect(()=>{e&&(t||o(N(e)))},[t,e]),s}const F=typeof window<"u"?i.useLayoutEffect:i.useEffect;function P(e){if(e!==void 0)switch(typeof e){case"number":return e;case"string":{if(e.endsWith("px"))return parseFloat(e);break}}}function te({box:e,defaultHeight:t,defaultWidth:s,disabled:o,element:r,mode:l,style:c}){const{styleHeight:f,styleWidth:n}=i.useMemo(()=>({styleHeight:P(c?.height),styleWidth:P(c?.width)}),[c?.height,c?.width]),[u,p]=i.useState({height:t,width:s}),I=o||l==="only-height"&&f!==void 0||l==="only-width"&&n!==void 0||f!==void 0&&n!==void 0;return F(()=>{if(r===null||I)return;const w=new ResizeObserver(L=>{for(const g of L){const{contentRect:y,target:z}=g;r===z&&p(m=>m.height===y.height&&m.width===y.width?m:{height:y.height,width:y.width})}});return w.observe(r,{box:e}),()=>{w?.unobserve(r)}},[e,I,r,f,n]),i.useMemo(()=>({height:f??u.height,width:n??u.width}),[u,f,n])}function se(e){const t=i.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return F(()=>{t.current=e},[e]),i.useCallback(s=>t.current?.(s),[t])}let H=null;function oe(e=!1){if(H===null||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",s.direction="rtl";const o=document.createElement("div"),r=o.style;return r.width="100px",r.height="100px",t.appendChild(o),document.body.appendChild(t),t.scrollLeft>0?H="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?H="negative":H="positive-ascending"),document.body.removeChild(t),H}return H}function U({containerElement:e,direction:t,isRtl:s,scrollOffset:o}){if(t==="horizontal"&&s)switch(oe()){case"negative":return-o;case"positive-descending":{if(e){const{clientWidth:r,scrollLeft:l,scrollWidth:c}=e;return c-r-l}break}}return o}function j(e,t="Assertion error"){if(!e)throw console.error(t),Error(t)}function J({cachedBounds:e,itemCount:t,itemSize:s}){if(t===0)return 0;if(typeof s=="number")return t*s;{const o=e.get(e.size===0?0:e.size-1);j(o!==void 0,"Unexpected bounds cache miss");const r=(o.scrollOffset+o.size)/e.size;return t*r}}function re({align:e,cachedBounds:t,index:s,itemCount:o,itemSize:r,containerScrollOffset:l,containerSize:c}){const f=J({cachedBounds:t,itemCount:o,itemSize:r}),n=t.get(s),u=Math.max(0,Math.min(f-c,n.scrollOffset)),p=Math.max(0,n.scrollOffset-c+n.size);switch(e==="smart"&&(l>=p&&l<=u?e="auto":e="center"),e){case"start":return u;case"end":return p;case"center":return n.scrollOffset<=c/2?0:n.scrollOffset+n.size/2>=f-c/2?f-c:n.scrollOffset+n.size/2-c/2;case"auto":default:return l>=p&&l<=u?l:l<p?p:u}}function Y({cachedBounds:e,containerScrollOffset:t,containerSize:s,itemCount:o,overscanCount:r}){const l=o-1;let c=0,f=-1,n=0;for(;n<l;){const u=e.get(n);if(u.scrollOffset+u.size>t)break;n++}for(c=n,c=Math.max(0,c-r);n<l;){const u=e.get(n);if(u.scrollOffset+u.size>=t+s)break;n++}return f=Math.min(l,n),f=Math.min(o-1,f+r),c<0?[0,-1]:[c,f]}function le({itemCount:e,itemProps:t,itemSize:s}){const o=new Map;return{get(r){for(j(r<e,`Invalid index ${r}`);o.size-1<r;){const c=o.size;let f;switch(typeof s){case"function":{f=s(c,t);break}case"number":{f=s;break}}if(c===0)o.set(c,{size:f,scrollOffset:0});else{const n=o.get(c-1);j(n!==void 0,`Unexpected bounds cache miss for index ${r}`),o.set(c,{scrollOffset:n.scrollOffset+n.size,size:f})}}const l=o.get(r);return j(l!==void 0,`Unexpected bounds cache miss for index ${r}`),l},set(r,l){o.set(r,l)},get size(){return o.size}}}function ne({itemCount:e,itemProps:t,itemSize:s}){return i.useMemo(()=>le({itemCount:e,itemProps:t,itemSize:s}),[e,t,s])}function ie({containerSize:e,itemSize:t}){let s;switch(typeof t){case"string":{j(t.endsWith("%"),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),j(e!==void 0,"Container size must be defined if a percentage item size is specified"),s=e*parseInt(t)/100;break}default:{s=t;break}}return s}function D({containerElement:e,containerStyle:t,defaultContainerSize:s=0,direction:o,isRtl:r=!1,itemCount:l,itemProps:c,itemSize:f,onResize:n,overscanCount:u}){const[p,I]=i.useState([0,-1]),[w,L]=[Math.min(l-1,p[0]),Math.min(l-1,p[1])],{height:g=s,width:y=s}=te({defaultHeight:o==="vertical"?s:void 0,defaultWidth:o==="horizontal"?s:void 0,element:e,mode:o==="vertical"?"only-height":"only-width",style:t}),z=i.useRef({height:0,width:0}),m=o==="vertical"?g:y,a=ie({containerSize:m,itemSize:f});i.useLayoutEffect(()=>{if(typeof n=="function"){const d=z.current;(d.height!==g||d.width!==y)&&(n({height:g,width:y},{...d}),d.height=g,d.width=y)}},[g,n,y]);const h=ne({itemCount:l,itemProps:c,itemSize:a}),b=i.useCallback(d=>h.get(d),[h]),$=i.useCallback(()=>J({cachedBounds:h,itemCount:l,itemSize:a}),[h,l,a]),k=i.useCallback(d=>{const v=U({containerElement:e,direction:o,isRtl:r,scrollOffset:d});return Y({cachedBounds:h,containerScrollOffset:v,containerSize:m,itemCount:l,overscanCount:u})},[h,e,m,o,r,l,u]);F(()=>{const d=(o==="vertical"?e?.scrollTop:e?.scrollLeft)??0;I(k(d))},[e,o,k]),F(()=>{if(!e)return;const d=()=>{I(v=>{const{scrollLeft:G,scrollTop:M}=e,S=U({containerElement:e,direction:o,isRtl:r,scrollOffset:o==="vertical"?M:G}),W=Y({cachedBounds:h,containerScrollOffset:S,containerSize:m,itemCount:l,overscanCount:u});return W[0]===v[0]&&W[1]===v[1]?v:W})};return e.addEventListener("scroll",d),()=>{e.removeEventListener("scroll",d)}},[h,e,m,o,l,u]);const x=se(({align:d="auto",containerScrollOffset:v,index:G})=>{let M=re({align:d,cachedBounds:h,containerScrollOffset:v,containerSize:m,index:G,itemCount:l,itemSize:a});if(e){if(M=U({containerElement:e,direction:o,isRtl:r,scrollOffset:M}),typeof e.scrollTo!="function"){const S=k(M);(S[0]!==w||S[1]!==L)&&I(S)}return M}});return{getCellBounds:b,getEstimatedSize:$,scrollToIndex:x,startIndex:w,stopIndex:L}}function K(e){return i.useMemo(()=>e,Object.values(e))}function A(e,t){if(e===t)return!0;if(!!e!=!!t||(j(e!==void 0),j(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(const s in e)if(!Object.is(t[s],e[s]))return!1;return!0}function Q(e,t){const{style:s,...o}=e,{style:r,...l}=t;return A(s,r)&&A(o,l)}function ce({cellComponent:e,cellProps:t,className:s,columnCount:o,columnWidth:r,defaultHeight:l=0,defaultWidth:c=0,dir:f,gridRef:n,onCellsRendered:u,onResize:p,overscanCount:I=3,rowCount:w,rowHeight:L,style:g,...y}){const z=K(t),m=i.useMemo(()=>i.memo(e,Q),[e]),[a,h]=i.useState(null),b=ee(a,f),{getCellBounds:$,getEstimatedSize:k,startIndex:x,scrollToIndex:d,stopIndex:v}=D({containerElement:a,defaultContainerSize:c,direction:"horizontal",isRtl:b,itemCount:o,itemProps:z,itemSize:r,onResize:p,overscanCount:I}),{getCellBounds:G,getEstimatedSize:M,startIndex:S,scrollToIndex:W,stopIndex:B}=D({containerElement:a,defaultContainerSize:l,direction:"vertical",itemCount:w,itemProps:z,itemSize:L,onResize:p,overscanCount:I});i.useImperativeHandle(n,()=>({get element(){return a},scrollToCell({behavior:R="auto",columnAlign:O="auto",columnIndex:E,rowAlign:T="auto",rowIndex:C}){const Z=d({align:O,containerScrollOffset:a?.scrollLeft??0,index:E}),_=W({align:T,containerScrollOffset:a?.scrollTop??0,index:C});typeof a?.scrollTo=="function"&&a.scrollTo({behavior:R,left:Z,top:_})},scrollToColumn({align:R="auto",behavior:O="auto",index:E}){const T=d({align:R,containerScrollOffset:a?.scrollLeft??0,index:E});typeof a?.scrollTo=="function"&&a.scrollTo({behavior:O,left:T})},scrollToRow({align:R="auto",behavior:O="auto",index:E}){const T=W({align:R,containerScrollOffset:a?.scrollTop??0,index:E});typeof a?.scrollTo=="function"&&a.scrollTo({behavior:O,top:T})}}),[a,d,W]),i.useEffect(()=>{x>=0&&v>=0&&S>=0&&B>=0&&u&&u({columnStartIndex:x,columnStopIndex:v,rowStartIndex:S,rowStopIndex:B})},[u,x,v,S,B]);const X=i.useMemo(()=>{const R=[];if(o>0&&w>0)for(let O=S;O<=B;O++){const E=G(O);for(let T=x;T<=v;T++){const C=$(T);R.push(i.createElement(m,{...z,columnIndex:T,key:`${O}-${T}`,rowIndex:O,style:{position:"absolute",left:b?void 0:0,right:b?0:void 0,transform:`translate(${b?-C.scrollOffset:C.scrollOffset}px, ${E.scrollOffset}px)`,height:w>1?E.size:"100%",width:C.size}}))}}return R},[m,z,o,x,v,$,G,b,w,S,B]);return q.jsx("div",{...y,className:s,dir:f,ref:h,style:{width:"100%",height:"100%",...g,maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto"},children:q.jsx("div",{className:s,style:{position:"relative",height:M(),width:k()},children:X})})}const fe=i.useState,ue=i.useRef;function de({className:e,defaultHeight:t=0,listRef:s,onResize:o,onRowsRendered:r,overscanCount:l=3,rowComponent:c,rowCount:f,rowHeight:n,rowProps:u,style:p,...I}){const w=K(u),L=i.useMemo(()=>i.memo(c,Q),[c]),[g,y]=i.useState(null),{getCellBounds:z,getEstimatedSize:m,scrollToIndex:a,startIndex:h,stopIndex:b}=D({containerElement:g,defaultContainerSize:t,direction:"vertical",itemCount:f,itemProps:w,itemSize:n,onResize:o,overscanCount:l});i.useImperativeHandle(s,()=>({get element(){return g},scrollToRow({align:k="auto",behavior:x="auto",index:d}){const v=a({align:k,containerScrollOffset:g?.scrollTop??0,index:d});typeof g?.scrollTo=="function"&&g.scrollTo({behavior:x,top:v})}}),[g,a]),i.useEffect(()=>{h>=0&&b>=0&&r&&r({startIndex:h,stopIndex:b})},[r,h,b]);const $=i.useMemo(()=>{const k=[];if(f>0)for(let x=h;x<=b;x++){const d=z(x);k.push(i.createElement(L,{...w,key:x,index:x,style:{position:"absolute",left:0,transform:`translateY(${d.scrollOffset}px)`,height:d.size,width:"100%"}}))}return k},[L,z,f,w,h,b]);return q.jsx("div",{...I,className:e,ref:y,style:{...p,maxHeight:"100%",flexGrow:1,overflowY:"auto"},children:q.jsx("div",{className:e,style:{height:m(),position:"relative",width:"100%"},children:$})})}const ae=i.useState,he=i.useRef;let V=-1;function ge(e=!1){if(V===-1||e){const t=document.createElement("div"),s=t.style;s.width="50px",s.height="50px",s.overflow="scroll",document.body.appendChild(t),V=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return V}exports.Grid=ce;exports.List=de;exports.getScrollbarSize=ge;exports.useGridCallbackRef=fe;exports.useGridRef=ue;exports.useListCallbackRef=ae;exports.useListRef=he;
2
2
  //# sourceMappingURL=react-window.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-window.cjs","sources":["../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/assert.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/shallowCompare.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/components/list/List.tsx","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useLayoutEffect, useState, type HTMLAttributes } from \"react\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useLayoutEffect(() => {\n if (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style?: CSSProperties;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((args: Args) => ref.current?.(args), [ref]) as (\n args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = document.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (getRTLOffsetType()) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\n const maxOffset = Math.max(\n 0,\n Math.min(estimatedTotalSize - containerSize, bounds.scrollOffset)\n );\n const minOffset = Math.max(\n 0,\n bounds.scrollOffset - containerSize + bounds.size\n );\n\n if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): [number, number] {\n const maxIndex = itemCount - 1;\n\n let startIndex = 0;\n let stopIndex = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndex = currentIndex;\n startIndex = Math.max(0, startIndex - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndex = Math.min(maxIndex, currentIndex);\n stopIndex = Math.min(itemCount - 1, stopIndex + overscanCount);\n\n return startIndex < 0 ? [0, -1] : [startIndex, stopIndex];\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseInt(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n return itemSize;\n}\n","import {\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n}) {\n const [indices, setIndices] = useState([0, -1]);\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const [startIndex, stopIndex] = [\n Math.min(itemCount - 1, indices[0]),\n Math.min(itemCount - 1, indices[1])\n ];\n\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n const containerSize = direction === \"vertical\" ? height : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n useIsomorphicLayoutEffect(() => {\n const scrollOffset =\n (direction === \"vertical\"\n ? containerElement?.scrollTop\n : containerElement?.scrollLeft) ?? 0;\n\n setIndices(getStartStopIndices(scrollOffset));\n }, [containerElement, direction, getStartStopIndices]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (next[0] === prev[0] && next[1] === prev[1]) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n itemCount,\n overscanCount\n ]);\n\n const scrollToIndex = useStableCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n containerScrollOffset: number;\n index: number;\n }) => {\n let scrollOffset = getOffsetForIndex({\n align,\n cachedBounds,\n containerScrollOffset,\n containerSize,\n index,\n itemCount,\n itemSize\n });\n\n if (containerElement) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (typeof containerElement.scrollTo === \"function\") {\n if (direction === \"horizontal\") {\n containerElement.scrollTo({\n left: scrollOffset,\n behavior: behavior || undefined\n });\n } else {\n containerElement.scrollTo({\n behavior: behavior || undefined,\n top: scrollOffset\n });\n }\n } else {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (next[0] !== startIndex || next[1] !== stopIndex) {\n setIndices(next);\n }\n }\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n };\n}\n","import { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { style: CSSProperties },\n nextProps: { style: CSSProperties }\n): boolean {\n const { style: prevStyle, ...prevRest } = prevProps;\n const { style: nextStyle, ...nextRest } = nextProps;\n\n return (\n shallowCompare(prevStyle, nextStyle) && shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<CellProps extends object>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n className,\n columnCount,\n columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n style,\n ...rest\n}: GridProps<CellProps>) {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndex: columnStartIndex,\n scrollToIndex: scrollToColumnIndex,\n stopIndex: columnStopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultWidth,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndex: rowStartIndex,\n scrollToIndex: scrollToRowIndex,\n stopIndex: rowStopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n scrollToRowIndex({\n align: rowAlign,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n scrollToColumnIndex({\n align: columnAlign,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\n });\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n scrollToColumnIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\n });\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n scrollToRowIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndex >= 0 &&\n columnStopIndex >= 0 &&\n rowStartIndex >= 0 &&\n rowStopIndex >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n });\n }\n }, [\n onCellsRendered,\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowBounds = getRowBounds(rowIndex);\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n children.push(\n <CellComponent\n {...(cellProps as CellProps)}\n columnIndex={columnIndex}\n key={`${rowIndex}-${columnIndex}`}\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowCount > 1 ? rowBounds.size : \"100%\",\n width: columnBounds.size\n }}\n />\n );\n }\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndex,\n columnStopIndex,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndex,\n rowStopIndex\n ]);\n\n return (\n <div\n {...rest}\n className={className}\n dir={dir}\n ref={setElement}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style,\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n height: getEstimatedHeight(),\n width: getEstimatedWidth()\n }}\n >\n {cells}\n </div>\n </div>\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<RowProps extends object>({\n className,\n defaultHeight = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight,\n rowProps: rowPropsUnstable,\n style,\n ...rest\n}: ListProps<RowProps>) {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n scrollToIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToIndex]\n );\n\n useEffect(() => {\n if (startIndex >= 0 && stopIndex >= 0 && onRowsRendered) {\n onRowsRendered({\n startIndex,\n stopIndex\n });\n }\n }, [onRowsRendered, startIndex, stopIndex]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (let index = startIndex; index <= stopIndex; index++) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n key={index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n height: bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [RowComponent, getCellBounds, rowCount, rowProps, startIndex, stopIndex]);\n\n return (\n <div\n {...rest}\n className={className}\n ref={setElement}\n style={{\n ...style,\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n height: getEstimatedSize(),\n position: \"relative\",\n width: \"100%\"\n }}\n >\n {rows}\n </div>\n </div>\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","let size: number = -1;\n\nexport function getScrollbarSize(recalculate: boolean = false): number {\n if (size === -1 || recalculate) {\n const div = document.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n document.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n document.body.removeChild(div);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(value: number) {\n size = value;\n}\n"],"names":["isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","useLayoutEffect","useIsomorphicLayoutEffect","useEffect","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cachedRTLResult","getRTLOffsetType","recalculate","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollLeft","scrollWidth","assert","expectedCondition","message","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndex","stopIndex","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","behavior","useMemoizedObject","unstableObject","shallowCompare","a","b","key","arePropsEqual","prevProps","nextProps","prevStyle","prevRest","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndex","scrollToColumnIndex","columnStopIndex","getRowBounds","getEstimatedHeight","rowStartIndex","scrollToRowIndex","rowStopIndex","useImperativeHandle","columnAlign","columnIndex","rowAlign","rowIndex","cells","children","rowBounds","columnBounds","createElement","jsx","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,EAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCRO,SAASC,EACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,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AA,SCHW0J,GAAa/H,EAAAA,OCN1B,IAAI2C,EAAe,GAEZ,SAASqF,GAAiB3H,EAAuB,GAAe,CACrE,GAAIsC,IAAS,IAAMtC,EAAa,CAC9B,MAAM4H,EAAM,SAAS,cAAc,KAAK,EAClCjJ,EAAQiJ,EAAI,MAClBjJ,EAAM,MAAQ,OACdA,EAAM,OAAS,OACfA,EAAM,SAAW,SAEjB,SAAS,KAAK,YAAYiJ,CAAG,EAE7BtF,EAAOsF,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAOtF,CACT"}
1
+ {"version":3,"file":"react-window.cjs","sources":["../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/assert.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/shallowCompare.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/components/list/List.tsx","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useLayoutEffect, useState, type HTMLAttributes } from \"react\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useLayoutEffect(() => {\n if (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style?: CSSProperties;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((args: Args) => ref.current?.(args), [ref]) as (\n args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = document.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (getRTLOffsetType()) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\n const maxOffset = Math.max(\n 0,\n Math.min(estimatedTotalSize - containerSize, bounds.scrollOffset)\n );\n const minOffset = Math.max(\n 0,\n bounds.scrollOffset - containerSize + bounds.size\n );\n\n if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): [number, number] {\n const maxIndex = itemCount - 1;\n\n let startIndex = 0;\n let stopIndex = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndex = currentIndex;\n startIndex = Math.max(0, startIndex - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndex = Math.min(maxIndex, currentIndex);\n stopIndex = Math.min(itemCount - 1, stopIndex + overscanCount);\n\n return startIndex < 0 ? [0, -1] : [startIndex, stopIndex];\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseInt(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n return itemSize;\n}\n","import {\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n}) {\n const [indices, setIndices] = useState([0, -1]);\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const [startIndex, stopIndex] = [\n Math.min(itemCount - 1, indices[0]),\n Math.min(itemCount - 1, indices[1])\n ];\n\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n const containerSize = direction === \"vertical\" ? height : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n useIsomorphicLayoutEffect(() => {\n const scrollOffset =\n (direction === \"vertical\"\n ? containerElement?.scrollTop\n : containerElement?.scrollLeft) ?? 0;\n\n setIndices(getStartStopIndices(scrollOffset));\n }, [containerElement, direction, getStartStopIndices]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (next[0] === prev[0] && next[1] === prev[1]) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n itemCount,\n overscanCount\n ]);\n\n const scrollToIndex = useStableCallback(\n ({\n align = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => {\n let scrollOffset = getOffsetForIndex({\n align,\n cachedBounds,\n containerScrollOffset,\n containerSize,\n index,\n itemCount,\n itemSize\n });\n\n if (containerElement) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (typeof containerElement.scrollTo !== \"function\") {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (next[0] !== startIndex || next[1] !== stopIndex) {\n setIndices(next);\n }\n }\n\n return scrollOffset;\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n };\n}\n","import { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { style: CSSProperties },\n nextProps: { style: CSSProperties }\n): boolean {\n const { style: prevStyle, ...prevRest } = prevProps;\n const { style: nextStyle, ...nextRest } = nextProps;\n\n return (\n shallowCompare(prevStyle, nextStyle) && shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<CellProps extends object>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n className,\n columnCount,\n columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n style,\n ...rest\n}: GridProps<CellProps>) {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndex: columnStartIndex,\n scrollToIndex: scrollToColumnIndex,\n stopIndex: columnStopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultWidth,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndex: rowStartIndex,\n scrollToIndex: scrollToRowIndex,\n stopIndex: rowStopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n const left = scrollToColumnIndex({\n align: columnAlign,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\n });\n const top = scrollToRowIndex({\n align: rowAlign,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left,\n top\n });\n }\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const left = scrollToColumnIndex({\n align,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left\n });\n }\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const top = scrollToRowIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n top\n });\n }\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndex >= 0 &&\n columnStopIndex >= 0 &&\n rowStartIndex >= 0 &&\n rowStopIndex >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n });\n }\n }, [\n onCellsRendered,\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowBounds = getRowBounds(rowIndex);\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n children.push(\n <CellComponent\n {...(cellProps as CellProps)}\n columnIndex={columnIndex}\n key={`${rowIndex}-${columnIndex}`}\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowCount > 1 ? rowBounds.size : \"100%\",\n width: columnBounds.size\n }}\n />\n );\n }\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndex,\n columnStopIndex,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndex,\n rowStopIndex\n ]);\n\n return (\n <div\n {...rest}\n className={className}\n dir={dir}\n ref={setElement}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style,\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n height: getEstimatedHeight(),\n width: getEstimatedWidth()\n }}\n >\n {cells}\n </div>\n </div>\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<RowProps extends object>({\n className,\n defaultHeight = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight,\n rowProps: rowPropsUnstable,\n style,\n ...rest\n}: ListProps<RowProps>) {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n } = useVirtualizer({\n containerElement: element,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const top = scrollToIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n top\n });\n }\n }\n }),\n [element, scrollToIndex]\n );\n\n useEffect(() => {\n if (startIndex >= 0 && stopIndex >= 0 && onRowsRendered) {\n onRowsRendered({\n startIndex,\n stopIndex\n });\n }\n }, [onRowsRendered, startIndex, stopIndex]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (let index = startIndex; index <= stopIndex; index++) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n key={index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n height: bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [RowComponent, getCellBounds, rowCount, rowProps, startIndex, stopIndex]);\n\n return (\n <div\n {...rest}\n className={className}\n ref={setElement}\n style={{\n ...style,\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n height: getEstimatedSize(),\n position: \"relative\",\n width: \"100%\"\n }}\n >\n {rows}\n </div>\n </div>\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","let size: number = -1;\n\nexport function getScrollbarSize(recalculate: boolean = false): number {\n if (size === -1 || recalculate) {\n const div = document.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n document.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n document.body.removeChild(div);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(value: number) {\n size = value;\n}\n"],"names":["isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","useLayoutEffect","useIsomorphicLayoutEffect","useEffect","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cachedRTLResult","getRTLOffsetType","recalculate","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollLeft","scrollWidth","assert","expectedCondition","message","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndex","stopIndex","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","shallowCompare","a","b","key","arePropsEqual","prevProps","nextProps","prevStyle","prevRest","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndex","scrollToColumnIndex","columnStopIndex","getRowBounds","getEstimatedHeight","rowStartIndex","scrollToRowIndex","rowStopIndex","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","left","top","cells","children","rowBounds","columnBounds","createElement","jsx","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,EAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCRO,SAASC,GACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,IAAQ,KAAK,EAEhDI,OAAAA,EAAAA,gBAAgB,IAAM,CAChBP,IACGG,GACHE,EAASN,EAAMC,CAAO,CAAC,EAG7B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChBO,MAAMI,EACX,OAAO,OAAW,IAAcD,EAAAA,gBAAkBE,EAAAA,UCD7C,SAASC,EACdN,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAAIA,EAAM,SAAS,IAAI,EACrB,OAAO,WAAWA,CAAK,EAEzB,KACF,CAAA,CAGN,CCdO,SAASO,GAAkB,CAChC,IAAAC,EACA,cAAAC,EACA,aAAAC,EACA,SAAUC,EACV,QAAAf,EACA,KAAAgB,EACA,MAAAC,CACF,EAQG,CACD,KAAM,CAAE,YAAAC,EAAa,WAAAC,CAAA,EAAeC,EAAAA,QAClC,KAAO,CACL,YAAaV,EAAuBO,GAAO,MAAM,EACjD,WAAYP,EAAuBO,GAAO,KAAK,CAAA,GAEjD,CAACA,GAAO,OAAQA,GAAO,KAAK,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